亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? demo12_6_16b.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
Destroy_BOB(&skelaton);
Destroy_BOB(&bat);

// shutdown directdraw last
DDraw_Shutdown();

// now directsound
DSound_Stop_All_Sounds();
DSound_Shutdown();

// shut down directinput
DInput_Shutdown();

// return success
return(1);
} // end Game_Shutdown

//////////////////////////////////////////////////////////

void Skelaton_AI(void)
{
// this function controls the ai of the skelaton and the pattern
// processing


// these are local defines to help compute the direction to move the
// skelaton if it needs to hunt down bat, note they are all in power
// of 2 order, hence, they are mutually exclusive

#define WEST_BIT     1
#define EAST_BIT     2
#define NORTH_BIT    4 
#define SOUTH_BIT    8 

// test if it's time to process a new instruction
if (curr_pattern==NULL)
   {
   // select a random pattern in pattern bank
   skelaton_pattern_index = rand()%NUM_PATTERNS;
   curr_pattern = patterns[skelaton_pattern_index];
   
   // now reset instuction pointer
   skelaton_ip = 0;

   // reset counter
   skelaton_counter = 0;
 
   } // end if

// process next instruction if it's time
if (--skelaton_counter <= 0)
    {
    // get next instruction
    opcode  = curr_pattern[skelaton_ip++];
    operand = curr_pattern[skelaton_ip++];

    // test what the opcode is
    switch(opcode)
        {
        case OPC_E:
            {
            // set direction to east
            Set_Vel_BOB(&skelaton,3,0);
  
            // set animation to east
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;

        case OPC_NE:
            {
            // set direction to northeast
            Set_Vel_BOB(&skelaton,3,-3);
  
            // set animation to northeast
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;

        case OPC_N: 
            {
            // set direction to north
            Set_Vel_BOB(&skelaton,0,-3);
  
            // set animation to north
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;            

        case OPC_NW:
            {
            // set direction to northwest
            Set_Vel_BOB(&skelaton,-3,-3);
  
            // set animation to northwest
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;            

        case OPC_W: 
            {
            // set direction to west
            Set_Vel_BOB(&skelaton,-3,0);
  
            // set animation to west
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;
			 
            } break;            

        case OPC_SW:
            {
            // set direction to southwest
            Set_Vel_BOB(&skelaton,-3,3);
  
            // set animation to southwest
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;            

        case OPC_S: 
            {
            // set direction to south
            Set_Vel_BOB(&skelaton,0,3);
  
            // set animation to south
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;            

        case OPC_SE:
            {
            // set direction to southeast
            Set_Vel_BOB(&skelaton,3,3);
  
            // set animation to southeast
            Set_Animation_BOB(&skelaton,opcode);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;            

        case OPC_STOP: 
            {
            // stop motion
            Set_Vel_BOB(&skelaton,0,0);
            
            // set counter to instuction operand
            skelaton_counter = operand;

            } break;

        case OPC_RAND:
            {
            // set counter to instuction operand
            skelaton_counter = 0;

            } break;

        case OPC_TEST_DIST:
             {
             // test distance between bat and skelaton
             // if bat is too far, then move toward bat

             int dx = (bat.x - skelaton.x);
             int dy = (bat.y - skelaton.y);

             // test distance against minimum lonelyness
             if (sqrt((dx*dx) + (dy*dy)) > MIN_LONELYNESS)
                {
                // the skelaton needs to be pointed toward the bat (player)
                // this is a bit hard because we need to point the skelaton
                // in 1 of 8 directions, instead of just giving him a velocity
                // to solve the problem well break it up into a dx and a dy and then
                // use a look up table to set everything up right
   
                DSound_Play(laugh_sound_id);

                int direction = 0; // the bit encoded direction

                // first east-west
                if (bat.x > skelaton.x)
                   direction|=EAST_BIT;
                else
                if (bat.x < skelaton.x)
                   direction|=WEST_BIT;
                
                // now north-south
                if (bat.y > skelaton.y)
                   direction|=SOUTH_BIT;
                else
                if (bat.y < skelaton.y)
                   direction|=NORTH_BIT;
          
                // test final direction, note this could be compressed into
                // another look up table, but this is simpler 
                switch(direction)
                        {
                        case WEST_BIT:
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,-3,0);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_W);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;

                            } break;

                        case EAST_BIT:     
                             {
                            // set motion
                            Set_Vel_BOB(&skelaton,3,0);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_E);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;

                             } break;

                        case NORTH_BIT:     
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,0,-3);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_N);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;

                            } break;

                        case SOUTH_BIT:     
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,0,3);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_S);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;
                            } break;

                        case (NORTH_BIT | WEST_BIT):
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,-3,-3);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_NW);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;
                            } break;

                        case (NORTH_BIT | EAST_BIT):
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,3,-3);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_NE);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;
                            } break;

                        case (SOUTH_BIT | WEST_BIT):
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,-3,3);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_SW);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;
                            } break;

                        case (SOUTH_BIT | EAST_BIT):
                            {
                            // set motion
                            Set_Vel_BOB(&skelaton,3,3);
  
                            // set animation 
                            Set_Animation_BOB(&skelaton,OPC_SE);
            
                            // set counter to instuction operand
                            skelaton_counter = operand;
                            } break;

                        default: break;

                        } // end switch 
               
                } // end if

             } break;

        case OPC_END: 
            {
            // stop motion
            Set_Vel_BOB(&skelaton,0,0);
            
            // select a random pattern in pattern bank
            skelaton_pattern_index = rand()%NUM_PATTERNS;
            curr_pattern = patterns[skelaton_pattern_index];
   
            // now reset instuction pointer
            skelaton_ip = 0;

            // reset counter
            skelaton_counter = 0;

            } break;
        
        default: break;

        } // end switch

    } // end if


// draw stats
sprintf(buffer,"Pattern #%d",skelaton_pattern_index);
Draw_Text_GDI(buffer,10, 400,RGB(0,255,0), lpddsback);

sprintf(buffer,"Opcode=%s Operand=%d",opcode_names[opcode],operand);
Draw_Text_GDI(buffer,10, 416,RGB(0,255,0), lpddsback);

sprintf(buffer,"Instruction Ptr=%d ", skelaton_ip);
Draw_Text_GDI(buffer,10, 432,RGB(0,255,0), lpddsback);

sprintf(buffer,"Counter=%d ", skelaton_counter);
Draw_Text_GDI(buffer,10, 448,RGB(0,255,0), lpddsback);

} // end skelaton_AI

//////////////////////////////////////////////////////////

int Game_Main(void *parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!

int index; // looping var

// start the timing clock
Start_Clock();

// clear the drawing surface
DDraw_Fill_Surface(lpddsback, 0);

// lock back buffer and copy background into it
DDraw_Lock_Back_Surface();

// draw background
Draw_Bitmap16(&background_bmp, back_buffer, back_lpitch,0);

// unlock back surface
DDraw_Unlock_Back_Surface();

// read keyboard
DInput_Read_Keyboard();

// do the ai on skelaton
Skelaton_AI();

// animate the bat
Animate_BOB(&bat);

// the animate the skelaton unless its stopped
if (opcode!=OPC_STOP)
   Animate_BOB(&skelaton);

// move skelaton
Move_BOB(&skelaton);

// test if skelaton is off screen, if so wrap around
if (skelaton.x >= SCREEN_WIDTH)
   skelaton.x = -skelaton.width;
else
if (skelaton.x < -skelaton.width)
   skelaton.x = SCREEN_WIDTH;

if (skelaton.y >= SCREEN_HEIGHT)
   skelaton.y = -skelaton.height;
else
if (skelaton.y < -skelaton.height)
   skelaton.y = SCREEN_HEIGHT;

// let player move the bat
// allow player to move
if (keyboard_state[DIK_RIGHT])
   bat.x+=4;
else
if (keyboard_state[DIK_LEFT])
   bat.x-=4;

if (keyboard_state[DIK_UP])
   bat.y-=4;
else
if (keyboard_state[DIK_DOWN])
   bat.y+=4;


// test if bat is off screen, if so wrap around
if (bat.x >= SCREEN_WIDTH)
   bat.x = -bat.width;
else
if (bat.x < -bat.width)
   bat.x = SCREEN_WIDTH;

if (bat.y >= SCREEN_HEIGHT)
   bat.y = -bat.height;
else
if (bat.y < -bat.height)
   bat.y = SCREEN_HEIGHT;

// draw the skelaton
Draw_BOB(&skelaton, lpddsback);

// draw the bat
Draw_BOB16(&bat, lpddsback);

// draw title
Draw_Text_GDI("(16-Bit Version) Skelaton Pattern Demo With Tracking",10, 10,RGB(0,255,255), lpddsback);

// flip the surfaces
DDraw_Flip();

// sync to 30ish fps
Wait_Clock(30);

// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE) || keyboard_state[DIK_ESCAPE])
    {
    PostMessage(main_window_handle, WM_DESTROY,0,0);

    // stop all sounds
    DSound_Stop_All_Sounds();

    } // end if

// return success
return(1);

} // end Game_Main

//////////////////////////////////////////////////////////

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产91久久久久久最新毛片| 欧美一区二区三区免费观看视频| 国产一区二区三区四区五区入口| 免费观看91视频大全| 日韩精品一卡二卡三卡四卡无卡| 五月综合激情日本mⅴ| 午夜电影网亚洲视频| 免费黄网站欧美| 精品一区二区三区的国产在线播放| 久国产精品韩国三级视频| 精品一区二区三区视频| 成人性生交大合| 色噜噜狠狠成人中文综合| 欧美日韩国产在线观看| 欧美变态tickling挠脚心| 欧美国产一区二区在线观看| 国产精品乱人伦| 亚洲午夜国产一区99re久久| 日本欧美久久久久免费播放网| 国产一区二三区好的| 成人av资源下载| 3d动漫精品啪啪| 国产欧美日韩三区| 午夜久久久影院| 国产高清不卡一区| 欧美性三三影院| 337p粉嫩大胆噜噜噜噜噜91av | 欧美大胆一级视频| 久久免费精品国产久精品久久久久 | 丁香婷婷综合色啪| 欧洲国内综合视频| 欧美精品一区二区三区高清aⅴ| 久久久www成人免费无遮挡大片| 综合激情网...| 久久精品国产999大香线蕉| 成人激情小说网站| 日韩欧美亚洲一区二区| 亚洲精品免费在线| 国产成人在线影院| 欧美日韩极品在线观看一区| 久久久99精品久久| 免费观看在线综合色| 色哟哟一区二区| 久久精品欧美日韩精品| 日韩福利电影在线| 91在线免费播放| 久久午夜羞羞影院免费观看| 午夜精品免费在线| 91亚洲精华国产精华精华液| 久久人人爽人人爽| 蓝色福利精品导航| 91麻豆精品国产| 亚洲一区二区五区| 一本一道综合狠狠老| 国产精品免费aⅴ片在线观看| 蜜桃久久av一区| 欧美另类高清zo欧美| 亚洲精品成人精品456| 国产成人av自拍| 国产亚洲综合性久久久影院| 加勒比av一区二区| 亚洲精品一区二区三区精华液| 天天色综合成人网| 911国产精品| 免费高清在线视频一区·| 欧美视频一区二区三区四区| 亚洲宅男天堂在线观看无病毒| 99这里只有久久精品视频| 国产精品伦一区| 91麻豆免费视频| 一个色在线综合| 欧美日韩在线免费视频| 亚洲超碰97人人做人人爱| 91黄色激情网站| 午夜精品久久久久久久99水蜜桃 | 欧美成人精品高清在线播放| 日本视频一区二区| 日韩欧美二区三区| 国产精华液一区二区三区| 欧美激情在线一区二区| 97se亚洲国产综合在线| 一区二区三区四区不卡视频| 欧美日韩一区二区三区不卡| 石原莉奈一区二区三区在线观看| 日韩手机在线导航| 国产福利91精品一区二区三区| 国产日韩av一区| 91视频免费播放| 午夜视频一区在线观看| 精品国产伦一区二区三区免费| 国产精品自拍网站| 一区二区三区美女| 欧美一区二区高清| 国产99精品国产| 亚洲精品成人悠悠色影视| 欧美高清视频在线高清观看mv色露露十八| 午夜精品久久久久久久99水蜜桃 | 首页国产丝袜综合| 精品成人免费观看| 97久久超碰精品国产| 日韩中文字幕1| 久久久久久97三级| 色偷偷88欧美精品久久久 | 日韩亚洲欧美在线| 国产成人在线视频免费播放| 亚洲欧美日韩国产成人精品影院| 欧美日韩精品欧美日韩精品| 国产成人免费高清| 亚洲一区二区三区四区在线观看| 日韩一区二区三区免费看| 99久久国产综合精品色伊| 日本女优在线视频一区二区 | 亚洲精品中文在线影院| 精品国产91久久久久久久妲己| 99riav久久精品riav| 精品一区二区免费在线观看| 一区二区在线观看免费| 日韩欧美国产wwwww| 在线亚洲欧美专区二区| 国产成人亚洲综合a∨婷婷图片| 亚洲国产乱码最新视频| 日本一区二区电影| 日韩久久免费av| 欧美高清激情brazzers| 91女厕偷拍女厕偷拍高清| 国产精品主播直播| 老色鬼精品视频在线观看播放| 亚洲一二三四久久| 亚洲人成网站影音先锋播放| 久久精品一区蜜桃臀影院| 日韩一区二区精品在线观看| 欧美日韩一区二区在线观看视频| 99国产精品一区| 成人av电影在线播放| 国产精品一区二区久久不卡| 久久精品国产亚洲aⅴ| 午夜视频久久久久久| 亚洲一区二区影院| 亚洲国产精品精华液网站| 亚洲免费av在线| 亚洲美女屁股眼交3| 国产精品九色蝌蚪自拍| 国产欧美日韩中文久久| 国产视频亚洲色图| 日本一区二区三区免费乱视频| 欧美成人性福生活免费看| 日韩一区二区电影网| 欧美一区二区三区不卡| 91麻豆精品国产| 日韩免费观看2025年上映的电影| 91精品国产综合久久香蕉麻豆| 69p69国产精品| 欧美一级午夜免费电影| 日韩一区二区在线免费观看| 日韩欧美激情四射| 2023国产精品| 国产精品毛片无遮挡高清| 国产精品久久久久影院亚瑟| 亚洲天堂a在线| 亚洲一区二区三区四区五区中文| 亚洲一线二线三线视频| 天天综合网 天天综合色| 青青国产91久久久久久| 国产剧情一区在线| av一区二区久久| 欧洲生活片亚洲生活在线观看| 欧美性xxxxxx少妇| 91麻豆精品国产| 国产午夜精品福利| 亚洲女厕所小便bbb| 日韩国产精品大片| 国产精品原创巨作av| av一区二区三区四区| 欧美美女直播网站| 久久久91精品国产一区二区精品| 国产精品久久二区二区| 五月天激情综合网| 国产成人aaa| 欧美剧情电影在线观看完整版免费励志电影 | 2021国产精品久久精品| 中文字幕一区二区三区蜜月| 五月婷婷综合激情| 国产精品99久久不卡二区| 色天使久久综合网天天| 欧美电影免费观看高清完整版在线观看 | 国内精品视频666| 91国产成人在线| 欧美成人在线直播| 亚洲综合久久av| 国产丶欧美丶日本不卡视频| 色综合天天综合在线视频| 欧美一级生活片| 中文字幕一区二区三区在线观看 | 国产美女精品一区二区三区| 欧美在线看片a免费观看| 久久久久久久av麻豆果冻| 一区二区成人在线观看| 国产成人精品午夜视频免费 | 欧美日韩国产电影| 久久综合色播五月|