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

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

?? demo12_3.cpp

?? 一本外國人寫的關于3D游戲編程的書的源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
// DEMO12_3.CPP - vector tracking demo min game
// the vector tracking code can be found in Move_Mines()

// INCLUDES ///////////////////////////////////////////////

#define INITGUID

#define WIN32_LEAN_AND_MEAN  

#include <windows.h>   // include important windows stuff
#include <windowsx.h> 
#include <mmsystem.h>
#include <iostream.h> // include important C/C++ stuff
#include <conio.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h> 
#include <math.h>
#include <io.h>
#include <fcntl.h>

#include <ddraw.h>  // directX includes
#include <dsound.h>
#include <dmksctrl.h>
#include <dmusici.h>
#include <dmusicc.h>
#include <dmusicf.h>
#include <dinput.h>
#include "T3DLIB1.h" // game library includes
#include "T3DLIB2.h"
#include "T3DLIB3.h"


//#include "mono.h"

// DEFINES ////////////////////////////////////////////////

// mathematical defines
CONST float FRICTION = 0.1;

// defines for windows 
#define WINDOW_CLASS_NAME "WINCLASS"  // class name

#define WINDOW_WIDTH    640            // size of window viewport
#define WINDOW_HEIGHT   480

// size of universe
#define UNIVERSE_MIN_X   (-8000)
#define UNIVERSE_MAX_X   (8000)
#define UNIVERSE_MIN_Y   (-8000)
#define UNIVERSE_MAX_Y   (8000)

// weapons defines
#define MAX_PLASMA         32   // max number of plasma pulses
#define PLASMA_SPEED       16   // pixels/sec of plasma pulse
#define PLASMA_SPEED_SLOW  12   // slow version for gunships

#define PLASMA_STATE_OFF   0   // this plasma is dead or off
#define PLASMA_STATE_ON    1   // this one is alive and in flight
#define PLASMA_RANGE_1     30  // type 1 plasma disruptor

#define PLASMA_ANIM_PLAYER     0  // a plasma torpedeo from player
#define PLASMA_ANIM_ENEMY      1  // a plasma torpedeo from any enemy

// asteroid field defines
#define MAX_ROCKS             300
#define ROCK_STATE_OFF        0   // this rock is dead or off
#define ROCK_STATE_ON         1   // this one is alive and in flight

#define ROCK_LARGE            0   // sizes of rock
#define ROCK_MEDIUM           1
#define ROCK_SMALL            2

// explosion defines 
#define MAX_BURSTS            8
#define BURST_STATE_OFF       0   // this burst is dead or off
#define BURST_STATE_ON        1   // this one is alive

// defines for player states
#define PLAYER_STATE_DEAD           0
#define PLAYER_STATE_DYING          1
#define PLAYER_STATE_INVINCIBLE     2
#define PLAYER_STATE_ALIVE          3
#define PLAYER_REGEN_COUNT          100 // click before regenerating

#define WRAITH_INDEX_DIR            3 // index of direction var

#define MAX_PLAYER_SPEED            16

// sound id's
#define MAX_FIRE_SOUNDS       8
#define MAX_EXPL_SOUNDS       8


// defines for stations
#define MAX_STATIONS           20

// life state for stations
#define STATION_STATE_DEAD       0
#define STATION_STATE_ALIVE      1
#define STATION_STATE_DAMAGED    2  
#define STATION_STATE_DYING      3

#define STATION_SHIELDS_ANIM_ON  0  // animations for shields
#define STATION_SHIELDS_ANIM_OFF 1 

#define STATION_RANGE_RING       300

#define INDEX_STATION_DAMAGE     2  // tracks the current damage of station
#define MAX_STATION_DAMAGE      100

#define STATION_MIN_UPLINK_DISTANCE  150


// defines for mines
#define MAX_MINES                16

// life state for stations
#define MINE_STATE_DEAD       0
#define MINE_STATE_ALIVE      1
#define MINE_STATE_DAMAGED    2  
#define MINE_STATE_DYING      3

#define MINE_STATE_AI_ACTIVATED   1
#define MINE_STATE_AI_SLEEP       0

#define INDEX_MINE_AI_STATE       1  // state of ai system
#define INDEX_MINE_DAMAGE         2  // tracks the current damage of MINE
#define INDEX_MINE_CONTACT_COUNT  3  // tracks how long mine has been in contact with player

#define MAX_MINE_DAMAGE            50 
#define MAX_MINE_CONTACT_COUNT     20

#define MAX_MINE_VELOCITY        16  
#define MIN_MINE_TRACKING_DIST   1000
#define MIN_MINE_ACTIVATION_DIST 250 

// defines for the star field

#define MAX_STARS                256   // number of stars in universe

#define STAR_PLANE_0             0    // far plane
#define STAR_PLANE_1             1    // near plane
#define STAR_PLANE_2             2

#define STAR_COLOR_0             8    // color of farthest star plane
#define STAR_COLOR_1             7
#define STAR_COLOR_2             15   // color of nearest star plane


// defines for particle system
#define PARTICLE_STATE_DEAD               0
#define PARTICLE_STATE_ALIVE              1

// types of particles
#define PARTICLE_TYPE_FLICKER             0
#define PARTICLE_TYPE_FADE                1 

// color of particle
#define PARTICLE_COLOR_RED                0
#define PARTICLE_COLOR_GREEN              1
#define PARTICLE_COLOR_BLUE               2
#define PARTICLE_COLOR_WHITE              3

#define MAX_PARTICLES                     128

// color ranges
#define COLOR_RED_START                   32
#define COLOR_RED_END                     47

#define COLOR_GREEN_START                 96
#define COLOR_GREEN_END                   111

#define COLOR_BLUE_START                  144
#define COLOR_BLUE_END                    159

#define COLOR_WHITE_START                 16
#define COLOR_WHITE_END                   31

// indices used to access data arrays in BOBs 
#define INDEX_WORLD_X                     8
#define INDEX_WORLD_Y                     9

// defines for the states of the main loop
#define GAME_STATE_INIT                  0
#define GAME_STATE_MENU                  1
#define GAME_STATE_RESTART               2
#define GAME_STATE_RUNNING               3
#define GAME_STATE_UPLINK                4
#define GAME_STATE_EXIT                  5
#define GAME_STATE_WAITING_FOR_EXIT      6
#define GAME_STATE_PAUSED                7

// the menu defines
#define MENU_STATE_MAIN                  0   // main menu state 
#define MENU_STATE_INST                  1   // instructions state
#define MENU_SEL_NEW_GAME                0
#define MENU_SEL_INSTRUCTIONS            1
#define MENU_SEL_EXIT                    2
#define MAX_INSTRUCTION_PAGES            6  

// defines for font
#define FONT_NUM_CHARS         96  // entire character set
#define FONT_WIDTH             12
#define FONT_HEIGHT            12
#define FONT_WIDTH_NEXT_NUM    8
#define FONT_WIDTH_NEXT_LOWER  7
#define FONT_WIDTH_NEXT_UPPER  8

// number of starting objects
#define NUM_ACTIVE_MINES             16
#define NUM_ACTIVE_STATIONS          8


// PROTOTYPES /////////////////////////////////////////////

// game console
int  Game_Init(void *parms=NULL);
int  Game_Shutdown(void *parms=NULL);
int  Game_Main(void *parms=NULL);
void Game_Reset(void);

// helper functions for game logic
void Draw_Info(void);
void Start_Burst(int x, int y, int width, int height, int xv,int yv);
void Draw_Bursts(void);
void Move_Bursts(void);
void Delete_Bursts(void);
void Init_Bursts(void);
void Reset_Bursts(void);

void Draw_Rocks(void);
void Start_Rock(int x, int y, int size,int xv, int yv);
void Move_Rocks(void);
void Delete_Rocks(void);
void Init_Rocks(void);
void Reset_Rocks(void);


void Fire_Plasma(int x,int y, int xv, int yv, int source);
void Draw_Plasma(void);
void Move_Plasma(void);
void Delete_Plasma(void);
void Init_Plasma(void);
void Reset_Plasma(void);

void Move_Stars(void);
void Draw_Stars(void);
void Init_Stars(void);
void Reset_Stars(void);


void Init_Reset_Particles(void);
void Draw_Particles(void);
void Move_Particles(void);
void Start_Particle(int type, int color, int count, int x, int y, int xv, int yv);
void Start_Particle_Explosion(int type, int color, int count, 
                              int x, int y, int xv, int yv, int num_particles);

void Reset_Particles(void);


void Init_Stations(void);
void Move_Stations(void);
void Draw_Stations(void);
void Start_Station(int override, int x, int y);
void Reset_Stations(void);


void Init_Mines(void);
void Move_Mines(void);
void Draw_Mines(void);
void Start_Mine(int override, int x, int y, int ai_state);
void Reset_Mines(void);


void Create_Tables(void);
float Fast_Distance_2D(float x, float y);
void Seed_Rocks(void);
int Load_Player(void);
void Draw_Scanner(void);
int Pad_Name(char *filename, char *extension, char *padstring, int num);

int Copy_Screen(UCHAR *source_bitmap,UCHAR *dest_buffer, int lpitch, int transparent);

void Load_Buttons(void);
void Load_HUD(void);


inline void Copy_Palette(LPPALETTEENTRY dest, LPPALETTEENTRY source)
{ memcpy(dest, source, 256*sizeof(PALETTEENTRY)); }


// TYPES //////////////////////////////////////////////////

// used to contain a single star
typedef struct STAR_TYP
        {
        int x,y;                   // position of star
        UCHAR color;               // color of star
        int plane;                 // plane that star is in

        } STAR, *STAR_PTR;


// a single particle
typedef struct PARTICLE_TYP
        {
        int state;           // state of the particle
        int type;            // type of particle effect
        int x,y;             // world position of particle
        int xv,yv;           // velocity of particle
        int curr_color;      // the current rendering color of particle
        int start_color;     // the start color or range effect
        int end_color;       // the ending color of range effect
        int counter;         // general state transition timer
        int max_count;       // max value for counter

        } PARTICLE, *PARTICLE_PTR;

// MACROS ////////////////////////////////////////////////

// used to compute the min and max of two expresions
#define MIN(a, b)  (((a) < (b)) ? (a) : (b)) 
#define MAX(a, b)  (((a) > (b)) ? (b) : (a)) 

// returns a rand in a range
#define RAND_RANGE(a,b) ((a)+(rand()%((b)-(a)+1)))

// GLOBALS ////////////////////////////////////////////////

HWND main_window_handle = NULL; // save the window handle
HINSTANCE main_instance = NULL; // save the instance
char buffer[80];                // used to print text

BITMAP_IMAGE background_bmp, menu_bmp; // used to hold backgrounds
BITMAP_IMAGE menu_sel_bmps[3];   // holds the menu selections
BITMAP_IMAGE andre;

BOB wraith;                   // the player 
BOB plasma[MAX_PLASMA];       // plasma pulses
BOB rocks[MAX_ROCKS];         // the asteroids
BOB rock_s, rock_m, rock_l;   // the master templates for surface info
BOB bursts[MAX_BURSTS];       // the explosion bursts
BOB stations[MAX_STATIONS];   // the starbase stations
BOB mines[MAX_MINES];         // the predator mines
BOB hud;                      // the art for the scanner hud
BOB stationsmall;             // small station bob

int rock_sizes[3] = {96,56,32}; // X,Y dims for scaler

STAR stars[MAX_STARS];          // the star field

PARTICLE particles[MAX_PARTICLES]; // the particles for the particle engine

// player state variables
int player_state       = PLAYER_STATE_ALIVE;
int player_score       = 0;   // the score
int player_ships       = 3;   // ships left
int player_regen_counter = 0; // used to track when to regen
int player_damage      = 0;   // damage of player
int player_counter     = 0;   // used for state transition tracking
int player_regen_count = 0;   // used to regenerate player
int player_shield_count = 0;  // used to display shields
int ready_counter = 0,        // used to draw a little "get ready"
    ready_state   = 0;

float mine_tracking_rate = 2; // rate that mines track player

int win_counter = 0,          // tracks if player won
    player_won = 0;   

int station_id = -1,          // uplink station id
    num_stations_destroyed = 0;

int intro_done = 0;           // flags if intro has played already

int game_paused      = 0,
    pause_debounce   = 0,
    huds_on          = 1,
    scanner_on       = 1,
    huds_debounce    = 0,
    scanner_debounce = 0;

// color palettes, so we don't have to reload all the time
PALETTEENTRY         game_palette[256]; // holds the main game palette
PALETTEENTRY         menu_palette[256]; // gee what do you think
PALETTEENTRY         andre_palette[256]; // for me

// positional and state info for player
float player_x=0,
      player_y=0,
	  player_dx=0, 
      player_dy=0, 
	  player_xv=0, 
	  player_yv=0,
      vel = 0;
// these contain the virual cos, sin lookup tables for the 16 sector circle
float cos_look16[16],
      sin_look16[16];

// sound id's
int intro_music_id  = -1,
    main_music_id   = -1,
    ready_id        = -1,
    engines_id      = -1,
    scream_id       = -1,
    game_over_id    = -1,
    mine_powerup_id = -1,
    deactivate_id   = -1,
    main_menu_id    = -1,
    beep0_id             = -1,
    beep1_id             = -1,
    station_blow_id      = -1,
    station_throb_id     = -1;

int expl_ids[MAX_EXPL_SOUNDS] = {-1,-1,-1,-1,-1,-1,-1,-1};
int fire_ids[MAX_FIRE_SOUNDS] = {-1,-1,-1,-1,-1,-1,-1,-1};
int game_state                = GAME_STATE_INIT;   // initial game state

// FUNCTIONS //////////////////////////////////////////////

LRESULT CALLBACK WindowProc(HWND hwnd, 
						    UINT msg, 
                            WPARAM wparam, 
                            LPARAM lparam)
{
// this is the main message handler of the system

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国v欧美v日本v亚洲v| 日韩片之四级片| 日韩一级黄色大片| 亚洲私人影院在线观看| 韩国午夜理伦三级不卡影院| 91小视频在线免费看| 2017欧美狠狠色| 亚洲一区二区在线播放相泽| 国产成a人亚洲| 欧美成人一区二区| 亚洲h精品动漫在线观看| av福利精品导航| 久久精品夜夜夜夜久久| 日本不卡123| 欧美日本乱大交xxxxx| 亚洲日本在线天堂| 99re这里只有精品视频首页| 国产日韩欧美高清在线| 精品一区免费av| 日韩欧美中文字幕公布| 日韩中文字幕不卡| 欧美人妇做爰xxxⅹ性高电影| 亚洲激情校园春色| 91亚洲精品乱码久久久久久蜜桃| 日本一区二区不卡视频| 国产精品伊人色| 久久久精品国产免大香伊| 久久精品国产77777蜜臀| 欧美一区二区播放| 秋霞影院一区二区| 欧美一级片免费看| 免费在线欧美视频| 日韩欧美在线网站| 国产在线不卡一区| 国产欧美综合在线观看第十页| 精品一区二区综合| 久久久精品中文字幕麻豆发布| 国内外成人在线| 亚洲成人一二三| 欧美性猛交xxxxxx富婆| 亚洲国产欧美在线人成| 欧美色视频在线观看| 亚洲大片精品永久免费| 精品视频1区2区| 免费人成网站在线观看欧美高清| 91精品国产色综合久久不卡电影 | 在线观看免费一区| 亚洲黄色av一区| 欧美疯狂做受xxxx富婆| 日本午夜一本久久久综合| 日韩女优av电影在线观看| 美女视频黄频大全不卡视频在线播放 | 国产精品久久久久精k8| 色视频一区二区| 亚洲成人黄色小说| 精品国产一区二区亚洲人成毛片| 国产乱国产乱300精品| 亚洲图片激情小说| 欧美视频一区二区三区| 精品一区二区三区在线视频| 久久久久99精品国产片| 欧美做爰猛烈大尺度电影无法无天| 日韩一区精品视频| 国产欧美一区二区精品性| 欧洲一区二区三区免费视频| 五月综合激情婷婷六月色窝| 久久久www成人免费毛片麻豆| 91丨porny丨户外露出| 日韩电影在线观看网站| 国产精品亲子伦对白| 欧美另类一区二区三区| 国产一区二区影院| 一区二区三区免费| 精品欧美一区二区三区精品久久| 99精品一区二区| 日韩av一级电影| 亚洲欧美视频在线观看| 91精品国产全国免费观看| 成人免费视频国产在线观看| 视频在线观看国产精品| 亚洲四区在线观看| 国产亚洲欧美在线| 欧美丰满高潮xxxx喷水动漫| 处破女av一区二区| 日韩电影一区二区三区| 亚洲激情图片小说视频| 久久久蜜桃精品| 欧美日韩高清在线播放| 91免费版在线| 高清在线成人网| 韩国女主播成人在线观看| 亚洲国产cao| 亚洲欧美日韩国产成人精品影院| 日韩欧美中文字幕公布| 欧美日韩亚洲综合一区二区三区| 97se狠狠狠综合亚洲狠狠| 国产高清视频一区| 狠狠久久亚洲欧美| 日韩和欧美一区二区三区| 一区二区免费看| 中文字幕日韩精品一区| 国产欧美视频一区二区| 国产天堂亚洲国产碰碰| 欧美成人一区二区三区在线观看| 欧美高清视频www夜色资源网| 91麻豆精品一区二区三区| 不卡欧美aaaaa| 99精品视频一区二区| 国产精品996| 国产91高潮流白浆在线麻豆| 黄页网站大全一区二区| 久久se这里有精品| 国产美女精品在线| 国产自产2019最新不卡| 精品一二三四在线| 国模一区二区三区白浆| 国内精品久久久久影院色| 国产自产视频一区二区三区| 国产精品一区在线| 成人美女在线观看| av在线不卡观看免费观看| 色综合网站在线| 日本韩国一区二区三区视频| 日本道精品一区二区三区| 欧美在线一区二区| 4438x成人网最大色成网站| 欧美老女人在线| 日韩一区二区三区四区五区六区| 欧美一卡二卡三卡四卡| 26uuu另类欧美| 久久久久久久综合色一本| 国产精品国产三级国产有无不卡 | 波多野结衣一区二区三区| 99视频超级精品| 欧美在线视频你懂得| 6080午夜不卡| 久久人人爽爽爽人久久久| 国产午夜精品一区二区三区嫩草| 久久久久高清精品| 亚洲精品中文字幕乱码三区| 亚洲第一狼人社区| 激情亚洲综合在线| 东方aⅴ免费观看久久av| 色婷婷亚洲精品| 欧美一区二区大片| 国产精品久线在线观看| 亚洲成a人片在线不卡一二三区| 丝袜脚交一区二区| 不卡一二三区首页| 欧美日韩精品是欧美日韩精品| 日韩一区二区视频| 国产精品美女久久久久久久久| 亚洲黄色在线视频| 韩国三级电影一区二区| 色婷婷av一区二区三区大白胸 | 国产精品女主播av| 亚洲www啪成人一区二区麻豆| 国产激情视频一区二区在线观看| 91视频在线看| 欧美精品一区二区三区蜜桃视频| 亚洲乱码国产乱码精品精98午夜 | 亚洲综合色在线| 国产一区二区三区高清播放| 一本久久综合亚洲鲁鲁五月天| 日韩欧美专区在线| 亚洲一区二区在线免费看| 国产成人日日夜夜| 欧美一区二区啪啪| 一区二区免费在线| 成人一级视频在线观看| 欧美一区二区黄色| 亚洲bt欧美bt精品| 色天天综合色天天久久| 久久久精品中文字幕麻豆发布| 天天综合色天天综合色h| 99国产精品视频免费观看| 精品成人在线观看| 日本午夜精品视频在线观看| 一本高清dvd不卡在线观看| 国产清纯在线一区二区www| 日韩电影免费在线观看网站| 91在线丨porny丨国产| 国产婷婷色一区二区三区| 精品在线观看视频| 日韩一区二区三| 天天av天天翘天天综合网| 色呦呦国产精品| 18欧美亚洲精品| 从欧美一区二区三区| 国产亚洲精品aa| 精品亚洲成a人在线观看 | 日本伊人色综合网| 欧美日韩一级二级| 亚洲国产美国国产综合一区二区| 成人av电影观看| 国产精品少妇自拍| proumb性欧美在线观看| 久久久激情视频| 成人激情午夜影院| 国产精品久久久久久久久久久免费看|