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

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

?? outpost.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
} // end Init_Stars

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

void Move_Stars(void)
{
// this function moves the star field, note that the star field is always
// in screen coordinates, otherwise, we would need thousands of stars to
// fill up the universe instead of 50!

int index,   // looping variable
    star_x,  // used as fast aliases to star position
    star_y,
    plane_0_dx,
    plane_0_dy,
    plane_1_dx,
    plane_1_dy,
    plane_2_dx,
    plane_2_dy;

// pre-compute plane translations
plane_0_dx = -int(player_xv) >> 2;
plane_0_dy = -int(player_yv) >> 2;

plane_1_dx = -int(player_xv) >> 1;
plane_1_dy = -int(player_yv) >> 1;

plane_2_dx = -int(player_xv);
plane_2_dy = -int(player_yv);

// move all the stars based on the motion of the player

for (index=0; index < MAX_STARS; index++)
    {
    // locally cache star position to speed up calculations
    star_x = stars[index].x;
    star_y = stars[index].y;

    // test which star field star is in so it is translated with correct
    // perspective

    switch(stars[index].plane)
          {
          case STAR_PLANE_0:
               {
               // move the star based on differntial motion of player
               // far plane is divided by 4

               star_x+=plane_0_dx;
               star_y+=plane_0_dy;

               } break;

          case STAR_PLANE_1:
               {
               // move the star based on differntial motion of player
               // middle plane is divided by 2

               star_x+=plane_1_dx;
               star_y+=plane_1_dy;

               } break;

          case STAR_PLANE_2:
               {
               // move the star based on differntial motion of player
               // near plane is divided by 1

               star_x+=plane_2_dx;
               star_y+=plane_2_dy;

               } break;

          } // end switch plane

    // test if a star has flown off an edge

    if (star_x >= SCREEN_WIDTH)
        star_x = star_x-SCREEN_WIDTH;
    else
    if (star_x < 0)
        star_x = SCREEN_WIDTH + star_x;

    if (star_y >= SCREEN_HEIGHT)
        star_y = star_y-SCREEN_HEIGHT;
    else
    if (star_y < 0)
        star_y = SCREEN_HEIGHT+star_y;

    // reset stars position in structure
    stars[index].x = star_x;
    stars[index].y = star_y;

    } // end for index

} // end Move_Stars

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

void Draw_Stars(void)
{
// this function draws all the stars

// lock back surface
DDraw_Lock_Back_Surface();

// draw all the stars
for (int index=0; index < MAX_STARS; index++)
    {
    // draw stars 
    Draw_Pixel(stars[index].x,stars[index].y, stars[index].color,back_buffer, back_lpitch);

    } // end for index

// unlock the secondary surface
DDraw_Unlock_Back_Surface();

} // end Draw_Stars

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

void Draw_Scanner(void)
{
// this function draws the scanner

int index,sx,sy; // looping and position

// lock back surface
DDraw_Lock_Back_Surface();

// draw all the rocks
for (index=0; index < MAX_ROCKS; index++)
    {
    // draw rock blips
	if (rocks[index].state==ROCK_STATE_ON)
		{
		sx = ((rocks[index].varsI[INDEX_WORLD_X] - UNIVERSE_MIN_X) >> 7) + (SCREEN_WIDTH/2) - ((UNIVERSE_MAX_X - UNIVERSE_MIN_X) >> 8);
		sy = ((rocks[index].varsI[INDEX_WORLD_Y] - UNIVERSE_MIN_Y) >> 7) + 32;
	    
		Draw_Pixel(sx,sy,8,back_buffer, back_lpitch);
		} // end if

    } // end for index


// draw all the gunships
for (index=0; index < MAX_GUNSHIPS; index++)
    {
    // draw gunship blips
	if (gunships[index].state==GUNSHIP_STATE_ALIVE)
		{
		sx = ((gunships[index].varsI[INDEX_WORLD_X] - UNIVERSE_MIN_X) >> 7) + (SCREEN_WIDTH/2) - ((UNIVERSE_MAX_X - UNIVERSE_MIN_X) >> 8);
		sy = ((gunships[index].varsI[INDEX_WORLD_Y] - UNIVERSE_MIN_Y) >> 7) + 32;
	    
		Draw_Pixel(sx,sy,14,back_buffer, back_lpitch);
		Draw_Pixel(sx+1,sy,14,back_buffer, back_lpitch);

		} // end if

    } // end for index

// draw all the mines
for (index=0; index < MAX_MINES; index++)
    {
    // draw gunship blips
	if (mines[index].state==MINE_STATE_ALIVE)
		{
		sx = ((mines[index].varsI[INDEX_WORLD_X] - UNIVERSE_MIN_X) >> 7) + (SCREEN_WIDTH/2) - ((UNIVERSE_MAX_X - UNIVERSE_MIN_X) >> 8);
		sy = ((mines[index].varsI[INDEX_WORLD_Y] - UNIVERSE_MIN_Y) >> 7) + 32;
	    
		Draw_Pixel(sx,sy,12,back_buffer, back_lpitch);
		Draw_Pixel(sx,sy+1,12,back_buffer, back_lpitch);

		} // end if

    } // end for index

// unlock the secondary surface
DDraw_Unlock_Back_Surface();

// draw all the stations
for (index=0; index < MAX_STATIONS; index++)
    {
    // draw station blips
	if (stations[index].state==STATION_STATE_ALIVE)
		{
		sx = ((stations[index].varsI[INDEX_WORLD_X] - UNIVERSE_MIN_X) >> 7) + (SCREEN_WIDTH/2) - ((UNIVERSE_MAX_X - UNIVERSE_MIN_X) >> 8);
		sy = ((stations[index].varsI[INDEX_WORLD_Y] - UNIVERSE_MIN_Y) >> 7) + 32;
	    
        // test for state
		if (stations[index].anim_state == STATION_SHIELDS_ANIM_ON)
			{
            stationsmall.curr_frame = 0;
            stationsmall.x = sx - 3;
            stationsmall.y = sy - 3; 
            Draw_BOB(&stationsmall,lpddsback);            


			} // end if
		else
			{

            stationsmall.curr_frame = 1;
            stationsmall.x = sx - 3;
            stationsmall.y = sy - 3; 
            Draw_BOB(&stationsmall,lpddsback);  


			} // end if

		} // end if

    } // end for index


// unlock the secondary surface
DDraw_Lock_Back_Surface();

// draw player as white blip
sx = ((int(player_x) - UNIVERSE_MIN_X) >> 7) + (SCREEN_WIDTH/2) - ((UNIVERSE_MAX_X - UNIVERSE_MIN_X) >> 8);
sy = ((int(player_y) - UNIVERSE_MIN_Y) >> 7) + 32;

int col = rand()%256;

Draw_Pixel(sx,sy,col,back_buffer, back_lpitch);
Draw_Pixel(sx+1,sy,col,back_buffer, back_lpitch);
Draw_Pixel(sx,sy+1,col,back_buffer, back_lpitch);
Draw_Pixel(sx+1,sy+1,col,back_buffer, back_lpitch);

// unlock the secondary surface
DDraw_Unlock_Back_Surface();

// now draw the art around the edges

hud.x          = 320-64;
hud.y          = 32-4;
hud.curr_frame = 0;
Draw_BOB(&hud,lpddsback);

hud.x          = 320+64-16;
hud.y          = 32-4;
hud.curr_frame = 1;
Draw_BOB(&hud,lpddsback);

hud.x          = 320-64;
hud.y          = 32+128-20;
hud.curr_frame = 2;
Draw_BOB(&hud,lpddsback);


hud.x          = 320+64-16;
hud.y          = 32+128-20;
hud.curr_frame = 3;
Draw_BOB(&hud,lpddsback);


} // end Draw_Scanner


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

void Init_Stations(void)
{
// this function loads and initializes the stations to a known state
	
static int shields_on_anim[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
           shields_off_anim[1] = {16};

int frame;  // looping va

// create the first bob
Create_BOB(&stations[0],0,0,192,144,17,
            BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_ANIM,
            DDSCAPS_SYSTEMMEMORY);

// load animation frames 
for (frame=0; frame <= 16; frame++)
	{
	// load the rocks imagery 
    Pad_Name("OUTART/STATION", "BMP", buffer, frame);
	Load_Bitmap_File(&bitmap8bit, buffer);		

    // load the actual .BMP
    Load_Frame_BOB(&stations[0],&bitmap8bit,frame,0,0,BITMAP_EXTRACT_MODE_ABS);  

    // unload data infile
    Unload_Bitmap_File(&bitmap8bit);

	} // end if

// set state to off
stations[0].state  = STATION_STATE_ALIVE;

// set anim state
stations[0].anim_state = STATION_SHIELDS_ANIM_ON;

// set damage to 0
stations[0].varsI[INDEX_STATION_DAMAGE] = 0;

// set animation rate
Set_Anim_Speed_BOB(&stations[0],15);

// load in the shield on/off animations
Load_Animation_BOB(&stations[0], STATION_SHIELDS_ANIM_ON, 16, shields_on_anim);
Load_Animation_BOB(&stations[0], STATION_SHIELDS_ANIM_OFF, 1, shields_off_anim);

// set animation to on
Set_Animation_BOB(&stations[0], STATION_SHIELDS_ANIM_ON);

// make copies
for (int ship=1; ship < MAX_STATIONS; ship++)
    {
    memcpy(&stations[ship], &stations[0], sizeof(BOB));
    } // end for pulse


    // load the miniature station
    Create_BOB(&stationsmall,0,0,8,8,2,
               BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_FRAME,
               DDSCAPS_SYSTEMMEMORY);

    Load_Bitmap_File(&bitmap8bit, "OUTART/STATIONSMALL8.BMP");		

    // load the actual .BMP
    Load_Frame_BOB(&stationsmall,&bitmap8bit,0,0,0,BITMAP_EXTRACT_MODE_CELL);  
    Load_Frame_BOB(&stationsmall,&bitmap8bit,1,1,0,BITMAP_EXTRACT_MODE_CELL);  

    // unload data infile
    Unload_Bitmap_File(&bitmap8bit);


} // end Init_Stations

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

void Reset_Stations(void)
{
// this function resets all the stations in preparation for another run

for (int index=0; index < MAX_STATIONS; index++)
	{
    // set state to off
    stations[index].state  = STATION_STATE_DEAD;

    // set anim state
    stations[index].anim_state = STATION_SHIELDS_ANIM_ON;

    // set damage to 0
    stations[index].varsI[INDEX_STATION_DAMAGE] = 0;

    } // end for

} // end Reset_Stations

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

void Start_Station(int override=0, int x=0, int y=0)
{
// this functions starts a station, note that if override = 1
// then the function uses the sent data otherwise it's random

// first find an available stations
for (int index=0; index < MAX_STATIONS; index++)
	{
	// is this one dead
	if (stations[index].state  == STATION_STATE_DEAD)
		{
		// position the station

		int xpos = RAND_RANGE((UNIVERSE_MIN_X+256),(UNIVERSE_MAX_X-256));
		int ypos = RAND_RANGE((UNIVERSE_MIN_Y+256),(UNIVERSE_MAX_Y-256));

        // set position
		stations[index].varsI[INDEX_WORLD_X] = xpos;
		stations[index].varsI[INDEX_WORLD_Y] = ypos;

        // start a mine up in the vicinity
        int ang = rand()%16;
		float mine_x = xpos + STATION_RANGE_RING*cos_look16[ang];
		float mine_y = ypos + STATION_RANGE_RING*sin_look16[ang];

        // start a deactivated mine
        Start_Mine(1, mine_x, mine_y, MINE_STATE_AI_SLEEP);    

  	    // set velocity
		stations[index].xv = 0;
		stations[index].yv = 0;

		// set remaining state variables
		stations[index].state  = STATION_STATE_ALIVE;

		// set animation to on
        Set_Animation_BOB(&stations[index], STATION_SHIELDS_ANIM_ON);

		// set anim state
        stations[index].anim_state = STATION_SHIELDS_ANIM_ON;

        // set damage to 0
        stations[index].varsI[INDEX_STATION_DAMAGE] = 0;

		// done so exit
		return;

		} // end if
	
	} // end for index

} // end Start_Station

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

void Move_Stations(void)
{
// this function moves/animates all the stations

for (int index=0; index < MAX_STATIONS; index++)
    {
    // test if station is alive
    if (stations[index].state == STATION_STATE_ALIVE)
        {
        // move the stations
        stations[index].varsI[INDEX_WORLD_X]+=stations[index].xv;
        stations[index].varsI[INDEX_WORLD_Y]+=stations[index].yv;
          
        // test for boundaries
        if (stations[index].varsI[INDEX_WORLD_X] > UNIVERSE_MAX_X)
           {
  		   stations[index].varsI[INDEX_WORLD_X] = UNIVERSE_MIN_X;
           } // end if
		else
		if (stations[index].varsI[INDEX_WORLD_X] < UNIVERSE_MIN_X )
           {
  		   stations[index].varsI[INDEX_WORLD_X] = UNIVERSE_MAX_X;
           } // end if	    

		if (stations[index].varsI[INDEX_WORLD_Y] > UNIVERSE_MAX_Y)
           {
		   stations[index].varsI[INDEX_WORLD_Y] = UNIVERSE_MIN_Y;
           } // end if
		else
		if (stations[index].varsI[INDEX_WORLD_Y] < UNIVERSE_MIN_Y ) 
           {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产色综合一区| 麻豆精品久久久| 亚洲精品中文在线观看| 亚洲免费伊人电影| 亚洲第一av色| 99这里都是精品| 51精品久久久久久久蜜臀| 精品成人一区二区三区四区| 欧美电影免费观看高清完整版在线 | 黄色资源网久久资源365| 国产jizzjizz一区二区| 国产成人午夜视频| 日韩女同互慰一区二区| 成人欧美一区二区三区视频网页 | 欧美一级黄色大片| 国产精品网站导航| 亚洲成a人在线观看| 99re6这里只有精品视频在线观看| 91精品久久久久久蜜臀| 日本一区二区免费在线观看视频| 亚洲美女偷拍久久| 成人黄色小视频在线观看| 欧美日韩成人综合| 欧美国产欧美综合| 蜜臀a∨国产成人精品| 欧美日本韩国一区| 综合久久国产九一剧情麻豆| 久久99久久久久| 7777精品伊人久久久大香线蕉的| 国产精品传媒入口麻豆| 九九精品一区二区| 欧美日本在线视频| 亚洲国产成人porn| 色菇凉天天综合网| 国产精品第13页| 国产乱码精品一区二区三| 久久先锋资源网| 天天综合日日夜夜精品| 91福利在线导航| 亚洲情趣在线观看| 欧美系列在线观看| 一区二区三区四区亚洲| 成人午夜私人影院| 欧美电影在线免费观看| 日本女人一区二区三区| 欧美日韩一区小说| 亚洲国产一区二区三区| 99久久综合精品| 中文字幕中文字幕一区二区| 国产成人一区在线| 国产日韩欧美综合一区| 91视频.com| 亚洲制服丝袜av| 91国偷自产一区二区三区成为亚洲经典 | 亚洲欧美日韩精品久久久久| 国产91丝袜在线播放九色| 久久久亚洲精品一区二区三区| 国产激情精品久久久第一区二区| 精品国精品国产| 国产一区二区免费看| 久久青草欧美一区二区三区| 成人动漫一区二区在线| 国产精品成人免费精品自在线观看 | 亚洲一区二区在线免费看| 欧美四级电影在线观看| 久久成人麻豆午夜电影| 久久欧美中文字幕| 成人av网站在线观看免费| 精品国产91九色蝌蚪| 91免费观看在线| 亚洲成人一区二区在线观看| 欧美精品一二三四| 美日韩一区二区三区| 亚洲国产成人在线| 色诱亚洲精品久久久久久| 亚洲h动漫在线| 欧美一区二区久久久| 成人av小说网| 亚洲高清免费在线| 欧美成人在线直播| 国产盗摄女厕一区二区三区| 一区二区国产视频| 欧美mv日韩mv| 成人av网站免费观看| 亚洲乱码国产乱码精品精的特点 | 一区二区三区四区国产精品| 欧美精品三级日韩久久| 精品午夜久久福利影院| 中文字幕不卡在线观看| 日韩精品中文字幕一区 | 一本色道久久加勒比精品| 日韩在线卡一卡二| 国产农村妇女毛片精品久久麻豆 | 亚洲乱码中文字幕| 欧美一卡2卡3卡4卡| 国产·精品毛片| 婷婷国产在线综合| 日本一区二区免费在线观看视频| 精品婷婷伊人一区三区三| 国产在线看一区| 一区二区在线免费观看| 中文天堂在线一区| 欧美电影免费观看高清完整版在| av高清不卡在线| 免费观看在线色综合| 亚洲精品一二三区| 日韩视频不卡中文| 在线中文字幕一区| 成人午夜激情片| 日本麻豆一区二区三区视频| 1024成人网色www| 26uuu另类欧美| 欧美放荡的少妇| 欧美日韩视频在线第一区| 成人激情开心网| 国产成人精品免费看| 美女视频第一区二区三区免费观看网站 | 国产寡妇亲子伦一区二区| 国产成人av电影在线| 久久激情五月婷婷| 亚洲一卡二卡三卡四卡| 一区二区三区在线视频观看| 亚洲天堂中文字幕| 亚洲视频电影在线| 亚洲色图欧美在线| 亚洲黄色小视频| 亚洲黄网站在线观看| 一个色在线综合| 亚洲v中文字幕| 日韩精品视频网站| 久久精品国产成人一区二区三区| 久久精品国产精品亚洲红杏| 久久精品国产第一区二区三区| 韩国成人在线视频| 国产不卡视频一区二区三区| 成人精品高清在线| 一本大道久久a久久综合婷婷| 在线观看日韩av先锋影音电影院| 欧美日韩综合色| 精品少妇一区二区三区在线播放 | 精品国产一区二区三区忘忧草 | 日韩精品91亚洲二区在线观看 | 一个色在线综合| 日本网站在线观看一区二区三区 | www.欧美色图| 色婷婷久久久久swag精品| 制服丝袜亚洲色图| 久久综合一区二区| 日韩一区日韩二区| 日韩电影在线观看网站| 国产精品一级黄| 91在线国内视频| 91精品啪在线观看国产60岁| wwwwww.欧美系列| 亚洲人成在线观看一区二区| 日韩在线一区二区三区| 国产东北露脸精品视频| 91黄色激情网站| www日韩大片| 一区二区三区精密机械公司| 麻豆精品视频在线观看免费| 成人av资源下载| 欧美一区二区女人| 中文字幕一区二区三区不卡| 亚洲mv在线观看| 成人av在线一区二区三区| 6080日韩午夜伦伦午夜伦| 国产视频视频一区| 日韩中文字幕1| 99久久99久久精品免费观看| 日韩午夜三级在线| 亚洲一区二区三区四区在线| 国产综合一区二区| 欧美一区二区三区在线视频| 国产精品久久久久久久久图文区 | 欧美一级理论片| 亚洲日本在线a| 成人综合日日夜夜| 欧美一级片在线观看| 亚洲视频一区二区在线观看| 国产在线一区二区| 欧美精品粉嫩高潮一区二区| 亚洲蜜臀av乱码久久精品| 国产一区二区三区在线观看免费视频| 91成人看片片| 中文字幕一区二区三区不卡| 国产一区二区伦理| 精品国产a毛片| 日韩电影一二三区| 欧美午夜精品一区二区蜜桃| 亚洲国产高清在线观看视频| 国内精品视频一区二区三区八戒| 欧美放荡的少妇| 午夜一区二区三区视频| a美女胸又www黄视频久久| 久久久国产午夜精品| 日本中文字幕一区二区视频| 在线免费亚洲电影| 亚洲精品免费电影| 91国偷自产一区二区开放时间|