diff --git a/Makefile b/Makefile index 981cbe0..24e21c2 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,11 @@ LDLIBS += -L/usr/X11R6/lib -lX11 -lXext -lGL `sdl-config --libs` -lopenal -lm AFLAGS = -g -w+macro-params -w+orphan-labels -w+number-overflow -ROOT = main.c mathline.c math.asm net.c render.c opengl.c openal.c winapi.c stubs.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c object.c shpanim.c sphere.c tables.c vdb.c version.c +ROOT = main.c mathline.c math.asm render.c opengl.c openal.c winapi.c stubs.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c object.c shpanim.c sphere.c tables.c vdb.c version.c AVP = ai_sight.c avpview.c bh_agun.c bh_ais.c bh_alien.c bh_binsw.c bh_cable.c bh_corpse.c bh_deathvol.c bh_debri.c bh_dummy.c bh_fan.c bh_far.c bh_fhug.c bh_gener.c bh_ldoor.c bh_lift.c bh_light.c bh_lnksw.c bh_ltfx.c bh_marin.c bh_mission.c bh_near.c bh_pargen.c bh_plachier.c bh_plift.c bh_pred.c bh_queen.c bh_rubberduck.c bh_selfdest.c bh_snds.c bh_spcl.c bh_swdor.c bh_track.c bh_types.c bh_videoscreen.c bh_waypt.c bh_weap.c bh_xeno.c bonusabilities.c cconvars.cpp cdtrackselection.cpp cheatmodes.c comp_map.c comp_shp.c consolelog.cpp davehook.cpp deaths.c decal.c detaillevels.c dynamics.c dynblock.c equipmnt.c equiputl.cpp extents.c game.c game_statistics.c gamecmds.cpp gamevars.cpp hmodel.c hud.c inventry.c language.c lighting.c load_shp.c los.c maps.c mempool.c messagehistory.c missions.cpp movement.c paintball.c particle.c pfarlocs.c pheromon.c player.c pmove.c psnd.c psndproj.c pvisible.c savegame.c scream.cpp secstats.c sfx.c stratdef.c targeting.c track.c triggers.c weapons.c SHAPES = cube.c SUPPORT = consbind.cpp consbtch.cpp coordstr.cpp daemon.cpp indexfnt.cpp r2base.cpp r2pos666.cpp reflist.cpp refobj.cpp rentrntq.cpp scstring.cpp strtab.cpp strutil.c trig666.cpp wrapstr.cpp -AVPWIN95 = avpchunk.cpp cheat.c chtcodes.cpp d3d_hud.cpp ddplat.cpp endianio.c ffread.cpp ffstdio.cpp gammacontrol.cpp hierplace.cpp iofocus.cpp jsndsup.cpp kzsort.c langplat.c modcmds.cpp npcsetup.cpp objsetup.cpp pathchnk.cpp platsup.c pldghost.c progress_bar.cpp projload.cpp scrshot.cpp strachnk.cpp system.c usr_io.c vision.c +AVPWIN95 = avpchunk.cpp cheat.c chtcodes.cpp d3d_hud.cpp ddplat.cpp endianio.c ffread.cpp ffstdio.cpp gammacontrol.cpp hierplace.cpp iofocus.cpp jsndsup.cpp kzsort.c langplat.c modcmds.cpp npcsetup.cpp objsetup.cpp pathchnk.cpp platsup.c pldghost.c pldnet.c progress_bar.cpp projload.cpp scrshot.cpp strachnk.cpp system.c usr_io.c vision.c FRONTEND = avp_envinfo.c avp_intro.cpp avp_menudata.c GADGETS = ahudgadg.cpp conscmnd.cpp conssym.cpp consvar.cpp gadget.cpp hudgadg.cpp rootgadg.cpp t_ingadg.cpp teletype.cpp textexp.cpp textin.cpp trepgadg.cpp WIN95 = animchnk.cpp animobs.cpp awtexld.cpp awbmpld.cpp awiffld.cpp awpnmld.cpp bmpnames.cpp chnkload.cpp chnktexi.cpp chnktype.cpp chunk.cpp chunkpal.cpp db.c debuglog.cpp dummyobjectchunk.cpp enumchnk.cpp enumsch.cpp envchunk.cpp fail.c fragchnk.cpp gsprchnk.cpp hierchnk.cpp huffman.cpp iff.cpp iff_ilbm.cpp ilbm_ext.cpp io.c list_tem.cpp ltchunk.cpp media.cpp mishchnk.cpp obchunk.cpp oechunk.cpp our_mem.c plat_shp.c plspecfn.c shpchunk.cpp sndchunk.cpp sprchunk.cpp string.cpp texio.c toolchnk.cpp txioctrl.cpp wpchunk.cpp zsp.cpp diff --git a/src/avp/win95/pldnet.c b/src/avp/win95/pldnet.c index e26236f..017d0de 100644 --- a/src/avp/win95/pldnet.c +++ b/src/avp/win95/pldnet.c @@ -15,9 +15,7 @@ #include "bh_debri.h" #include "pvisible.h" #include "bh_plift.h" -#include "dplayext.h" #include "pldnet.h" -#include "dp_func.h" #include "pldghost.h" #include "equipmnt.h" #include "weapons.h" @@ -46,10 +44,119 @@ #define UseLocalAssert Yes #include "ourasert.h" -#include "ShowCmds.h" +#include "showcmds.h" #define DB_LEVEL 3 #include "db.h" + +/* This is stuff I added to get this file to compile for the Linux port */ +#include + +DPID AVPDPNetID; +int QuickStartMultiplayer=1; + +typedef struct DPNAME +{ + char lpszShortNameA[64]; +} DPNAME; +DPNAME AVPDPplayerName; + +#define DP_OK 0 + +typedef int HRESULT; + +int glpDP; /* directplay object */ + +#define DPRECEIVE_ALL 1 +#define DPSYS_ADDPLAYERTOGROUP 2 +#define DPSYS_CREATEPLAYERORGROUP 3 +#define DPPLAYERTYPE_PLAYER 4 +#define DPSYS_DELETEPLAYERFROMGROUP 5 +#define DPSYS_HOST 6 +#define DPSYS_SESSIONLOST 7 +#define DPSYS_SETPLAYERORGROUPDATA 8 +#define DPSYS_SETPLAYERORGROUPNAME 9 +#define DPEXT_HEADER_SIZE 10 +#define DPERR_BUSY 11 +#define DPERR_CONNECTIONLOST 12 +#define DPERR_INVALIDPARAMS 13 +#define DPERR_INVALIDPLAYER 14 +#define DPERR_NOTLOGGEDIN 15 +#define DPERR_SENDTOOBIG 16 +#define DPERR_BUFFERTOOSMALL 17 +#define DPID_SYSMSG 18 +#define DPSYS_DESTROYPLAYERORGROUP 19 +#define DPID_ALLPLAYERS 20 + +typedef struct LPDPMSG_GENERIC +{ + int dwType; +} DPMSG_GENERIC; +typedef DPMSG_GENERIC * LPDPMSG_GENERIC; + +typedef struct LPDPMSG_CREATEPLAYERORGROUP +{ + int dwType; + + DPID dpId; + int dwPlayerType; + + DPNAME dpnName; +} DPMSG_CREATEPLAYERORGROUP; +typedef DPMSG_CREATEPLAYERORGROUP * LPDPMSG_CREATEPLAYERORGROUP; + +typedef struct LPDPMSG_DESTROYPLAYERORGROUP +{ + int dwType; + + DPID dpId; + int dwPlayerType; +} DPMSG_DESTROYPLAYERORGROUP; +typedef DPMSG_DESTROYPLAYERORGROUP * LPDPMSG_DESTROYPLAYERORGROUP; + +BOOL DpExtInit(DWORD cGrntdBufs, DWORD cBytesPerBuf, BOOL bErrChcks) +{ + fprintf(stderr, "DpExtInit(%d, %d, %d)\n", cGrntdBufs, cBytesPerBuf, bErrChcks); + + return FALSE; +} + +void DpExtUnInit() +{ + fprintf(stderr, "DpExtUnInit()\n"); +} + +HRESULT DpExtRecv(int lpDP2A, void *lpidFrom, void *lpidTo, DWORD dwFlags, void *lplpData, LPDWORD lpdwDataSize) +{ + fprintf(stderr, "DpExtRecv(%d, %p, %p, %d, %p, %p)\n", lpDP2A, lpidFrom, lpidTo, dwFlags, lplpData, lpdwDataSize); + + return 1; +} + +HRESULT DpExtSend(int lpDP2A, DPID idFrom, DPID idTo, DWORD dwFlags, void *lpData, DWORD dwDataSize) +{ + fprintf(stderr, "DpExtSend(%d, %d, %d, %d, %p, %d)\n", lpDP2A, idFrom, idTo, dwFlags, lpData, dwDataSize); + + return 1; +} + +int DirectPlay_Disconnect() +{ + fprintf(stderr, "DirectPlay_Disconnect()\n"); + + return 1; +} + +HRESULT IDirectPlayX_GetPlayerName(int glpDP, DPID id, void *data, void *size) +{ + fprintf(stderr, "IDirectPlayX_GetPlayerName(%d, %d, %p, %p)\n", glpDP, id, data, size); + + return 1; +} + +/* End of Linux-related junk */ + + #define CalculateBytesSentPerSecond 0 /*---------------------------------------------------------------------- @@ -62,7 +169,7 @@ NETGAME_GAMEDATA netGameData= 0, //NETGAME_CHARACTERTYPE myNextCharacterType; //if player is currently dead and about to become a new character 0, //NETGAME_SPECIALISTCHARACTERTYPE myCharacterSubType; 0, //unsigned char myStartFlag; - {0,}, //NETGAME_PLAYERDATA playerData[NET_MAXPLAYERS]; + {{0},}, //NETGAME_PLAYERDATA playerData[NET_MAXPLAYERS]; {0,}, //int teamScores[3]; 0, //NETGAME_TYPE gameType; 0, //unsigned char levelNumber; @@ -220,8 +327,8 @@ int LobbiedGame=0; static char sendBuffer[NET_MESSAGEBUFFERSIZE]; static char *endSendBuffer; static int netNextLocalObjectId = 1; -DPID myNetworkKillerId = NULL; -DPID myIgniterId = NULL; +DPID myNetworkKillerId = 0; +DPID myIgniterId = 0; int MyHitBodyPartId=-1; DPID MultiplayerObservedPlayer=0; @@ -392,7 +499,7 @@ void InitAVPNetGame(void) int i,j; for(i=0;i<(NET_MAXPLAYERS);i++) { - netGameData.playerData[i].playerId = NULL; + netGameData.playerData[i].playerId = 0; for(j=0;j<(NET_PLAYERNAMELENGTH);j++) netGameData.playerData[i].name[j] = '\0'; netGameData.playerData[i].characterType = NGCT_Marine; netGameData.playerData[i].characterSubType = NGSCT_General; @@ -695,8 +802,8 @@ void InitAVPNetGameForJoin(void) void MinimalNetCollectMessages(void) { HRESULT res = DP_OK; - DPID dPlayFromId = NULL; - DPID dPlayToId = NULL; + DPID dPlayFromId = 0; + DPID dPlayToId = 0; unsigned char *msgP = NULL; unsigned msgSize = 0; @@ -705,7 +812,7 @@ void MinimalNetCollectMessages(void) { while((res==DP_OK) && glpDP && AVPDPNetID) { - res = DpExtRecv(glpDP,&dPlayFromId,&dPlayToId,DPRECEIVE_ALL,&msgP,(LPDWORD)&msgSize); + res = DpExtRecv(glpDP,&dPlayFromId,&dPlayToId,DPRECEIVE_ALL,&msgP,(LPDWORD)&msgSize); if(res==DP_OK) { /* process last message, if there is one */ @@ -840,7 +947,9 @@ void NetCollectMessages(void) numPredators++; numPredatorsWithLifeLeft+=netGameData.playerData[i].playerHasLives; break; - + + default: + break; } } } @@ -2864,6 +2973,8 @@ char GetWeaponIconFromDamage(DAMAGE_PROFILE* damage) case AMMO_PC_ALIEN_BITE : case AMMO_ALIEN_BITE_KILLSECTION_SUPER : return ICON_JAWS; + default: + break; } return 0; @@ -2956,6 +3067,8 @@ void AddNetMsg_PlayerKilled(int objectId,DAMAGE_PROFILE* damage) case AMMO_NPC_PRAETORIAN_TAIL : messagePtr->killerType=NGCT_AI_Praetorian; break; + default: + break; } } Inform_PlayerHasDied(myNetworkKillerId,AVPDPNetID,messagePtr->killerType,messagePtr->weaponIcon); @@ -4630,6 +4743,8 @@ void AddNetMsg_StrategySynch(void) case I_BehaviourTrackObject : WriteStrategySynch(objectNumber++,TrackObjectGetSynchData(sbPtr)); break; + default: + break; } } @@ -6472,7 +6587,7 @@ static void ProcessNetMsg_LocalObjectState(NETMESSAGE_LOBSTATE *messagePtr, DPID static int GetSizeOfLocalObjectDamagedMessage(char *messagePtr) { int size=sizeof(NETMESSAGE_LOBDAMAGED_HEADER); - NETMESSAGE_LOBDAMAGED_HEADER *messageHeader = (NETMESSAGE_LOBDAMAGED_HEADER*) messagePtr;(NETMESSAGE_LOBDAMAGED_HEADER*) messagePtr; + NETMESSAGE_LOBDAMAGED_HEADER *messageHeader = (NETMESSAGE_LOBDAMAGED_HEADER*) messagePtr; if(messageHeader->damageProfile) size+=sizeof(NETMESSAGE_DAMAGE_PROFILE); if(messageHeader->multiple) size+=sizeof(NETMESSAGE_DAMAGE_MULTIPLE); @@ -7394,6 +7509,8 @@ static void ProcessNetMsg_StrategySynch(NETMESSAGE_STRATEGYSYNCH *messagePtr) case I_BehaviourTrackObject : TrackObjectSetSynchData(sbPtr,ReadStrategySynch(objectNumber++)); break; + default: + break; } } @@ -9425,11 +9542,13 @@ void CreatePlayersImageInMirror(void) CreateAlienHModel(ghostData); break; } - case(I_BehaviourPredatorPlayer): + case(I_BehaviourPredatorPlayer): { CreatePredatorHModel(ghostData,WEAPON_PRED_WRISTBLADE); break; } + default: + break; } sbPtr->SBdptr->HModelControlBlock=&ghostData->HModelController; ProveHModel(sbPtr->SBdptr->HModelControlBlock,sbPtr->SBdptr); @@ -10504,6 +10623,9 @@ int DetermineAvailableCharacterTypes(BOOL ConsiderUsedCharacters) case NGCT_Alien : CharacterTypesAvailable[NGCT_Alien]--; break; + + default: + break; } } } @@ -11042,6 +11164,9 @@ void DoMultiplayerEndGameScreen(void) symbol[0]=FONT_PREDATORSYMBOL; RenderStringCentred(symbol,100,y,0xffffffff); break; + + default: + break; } } diff --git a/src/avp/win95/pldnet.h b/src/avp/win95/pldnet.h index 9ff1c5a..9c57715 100644 --- a/src/avp/win95/pldnet.h +++ b/src/avp/win95/pldnet.h @@ -166,8 +166,7 @@ typedef enum netgame_connectiontype ----------------------------------------------------------------------*/ typedef struct netgame_playerdata { -// DPID playerId; - int playerId; + DPID playerId; char name[NET_PLAYERNAMELENGTH]; NETGAME_CHARACTERTYPE characterType; @@ -303,23 +302,24 @@ typedef struct netgame_gamedata /* --------------------------------------------------------------------- Individual message structures - ----------------------------------------------------------------------*/ + ----------------------------------------------------------------------*/ +/* #pragma pack(push,1) +*/ typedef struct netmessageheader { unsigned char type; -}NETMESSAGEHEADER; +} PACKED NETMESSAGEHEADER; typedef struct gamedescription_playerdata { -// DPID playerId; - int playerId; + DPID playerId; unsigned char characterType:2; unsigned char characterSubType:6; unsigned char startFlag; -}GAMEDESCRIPTION_PLAYERDATA; +} PACKED GAMEDESCRIPTION_PLAYERDATA; typedef struct netmessage_gamedescription { @@ -387,14 +387,14 @@ typedef struct netmessage_gamedescription unsigned int pistolInfiniteAmmo:1; unsigned int specialistPistols:1; -}NETMESSAGE_GAMEDESCRIPTION; +} PACKED NETMESSAGE_GAMEDESCRIPTION; typedef struct netmessage_playerdescription { unsigned char characterType: 3; unsigned char characterSubType: 4; unsigned char startFlag: 1; -}NETMESSAGE_PLAYERDESCRIPTION; +} PACKED NETMESSAGE_PLAYERDESCRIPTION; typedef struct netmessage_playerstate { @@ -436,7 +436,7 @@ typedef struct netmessage_playerstate #endif unsigned int landingNoise:1; -}NETMESSAGE_PLAYERSTATE; +} PACKED NETMESSAGE_PLAYERSTATE; typedef struct netmessage_playerstate_minimal { @@ -451,7 +451,7 @@ typedef struct netmessage_playerstate_minimal unsigned char Special:1; unsigned char CloakingEffectiveness; -}NETMESSAGE_PLAYERSTATE_MINIMAL; +} PACKED NETMESSAGE_PLAYERSTATE_MINIMAL; typedef struct netmessage_playerstate_medium { @@ -461,29 +461,28 @@ typedef struct netmessage_playerstate_medium signed int yOrient: 9; signed int zOrient: 9; -}NETMESSAGE_PLAYERSTATE_MEDIUM; +} PACKED NETMESSAGE_PLAYERSTATE_MEDIUM; typedef struct netmessage_frametimer { unsigned short frame_time; -}NETMESSAGE_FRAMETIMER; +} PACKED NETMESSAGE_FRAMETIMER; typedef struct netmessage_playerkilled { int objectId; -// DPID killerId; - int killerId; + DPID killerId; NETGAME_CHARACTERTYPE myType; //take character types at time of death , in case they change NETGAME_CHARACTERTYPE killerType; char weaponIcon; -}NETMESSAGE_PLAYERKILLED; +} PACKED NETMESSAGE_PLAYERKILLED; typedef struct netmessage_corpsedeathanim { int objectId; int deathId; -}NETMESSAGE_CORPSEDEATHANIM; +} PACKED NETMESSAGE_CORPSEDEATHANIM; typedef struct netmessage_allgamescores { @@ -493,12 +492,12 @@ typedef struct netmessage_allgamescores int aliensKilled[NET_MAXPLAYERS][3]; int deathsFromAI[NET_MAXPLAYERS]; -}NETMESSAGE_ALLGAMESCORES; +} PACKED NETMESSAGE_ALLGAMESCORES; typedef struct netmessage_speciesscores { int teamScores[3]; -}NETMESSAGE_SPECIESSCORES; +} PACKED NETMESSAGE_SPECIESSCORES; typedef struct netmessage_playerscores { @@ -508,7 +507,7 @@ typedef struct netmessage_playerscores int playerScoreAgainst; int aliensKilled[3]; int deathsFromAI; -}NETMESSAGE_PLAYERSCORES; +} PACKED NETMESSAGE_PLAYERSCORES; typedef struct netmessage_scorechange { @@ -517,7 +516,7 @@ typedef struct netmessage_scorechange int fragCount; int killerScoreFor; int victimScoreAgainst; -}NETMESSAGE_SCORECHANGE; +} PACKED NETMESSAGE_SCORECHANGE; typedef struct netmessage_localRicochet { @@ -528,7 +527,7 @@ typedef struct netmessage_localRicochet signed int yDirn; signed int zDirn; unsigned char type; -}NETMESSAGE_LOCALRICOCHET; +} PACKED NETMESSAGE_LOCALRICOCHET; typedef struct netmessage_lobstate { @@ -543,15 +542,14 @@ typedef struct netmessage_lobstate unsigned char IOType; unsigned char subtype; unsigned char event_flag; -}NETMESSAGE_LOBSTATE; +} PACKED NETMESSAGE_LOBSTATE; //damage message is now split into multiple parts , to avoid sending //stuff that isn't required typedef struct netmessage_lobdamaged_header { -// DPID playerId; - int playerId; + DPID playerId; signed int objectId; short ammo_id:11; @@ -561,7 +559,7 @@ typedef struct netmessage_lobdamaged_header short sectionID:1; short delta_seq:1; short direction:1; -}NETMESSAGE_LOBDAMAGED_HEADER; +} PACKED NETMESSAGE_LOBDAMAGED_HEADER; typedef struct netmessage_ghosthierarchydamaged_header { @@ -572,7 +570,7 @@ typedef struct netmessage_ghosthierarchydamaged_header short multiple:1; short sectionID:1; short direction:1; -}NETMESSAGE_GHOSTHIERARCHYDAMAGED_HEADER; +} PACKED NETMESSAGE_GHOSTHIERARCHYDAMAGED_HEADER; typedef struct netmessage_inanimatedamaged_header { @@ -581,7 +579,7 @@ typedef struct netmessage_inanimatedamaged_header short damageProfile:1; short multiple:1; -}NETMESSAGE_INANIMATEDAMAGED_HEADER; +} PACKED NETMESSAGE_INANIMATEDAMAGED_HEADER; typedef struct netmessage_damage_profile { @@ -599,50 +597,49 @@ typedef struct netmessage_damage_profile unsigned int BlowUpSections :1; unsigned int Special :1; unsigned int MakeExitWounds :1; -}NETMESSAGE_DAMAGE_PROFILE; +} PACKED NETMESSAGE_DAMAGE_PROFILE; typedef struct netmessage_damage_multiple { int multiple; -}NETMESSAGE_DAMAGE_MULTIPLE; +} PACKED NETMESSAGE_DAMAGE_MULTIPLE; typedef struct netmessage_damage_section { short SectionID; -}NETMESSAGE_DAMAGE_SECTION; +} PACKED NETMESSAGE_DAMAGE_SECTION; typedef struct netmessage_damage_delta { char Delta_Sequence; char Delta_Sub_Sequence; -}NETMESSAGE_DAMAGE_DELTA; +} PACKED NETMESSAGE_DAMAGE_DELTA; typedef struct netmessage_damage_direction { int direction_x:10; int direction_y:10; int direction_z:10; -}NETMESSAGE_DAMAGE_DIRECTION; +} PACKED NETMESSAGE_DAMAGE_DIRECTION; //that was the last part of the local object damage stuff typedef struct netmessage_lobdestroyed_request { -// DPID playerId; - int playerId; + DPID playerId; signed int objectId; -}NETMESSAGE_LOBDESTROYED_REQUEST; +} PACKED NETMESSAGE_LOBDESTROYED_REQUEST; typedef struct netmessage_lobdestroyed { signed int objectId; -}NETMESSAGE_LOBDESTROYED; +} PACKED NETMESSAGE_LOBDESTROYED; typedef struct netmessage_objectpickedup { char name[8]; -}NETMESSAGE_OBJECTPICKEDUP; +} PACKED NETMESSAGE_OBJECTPICKEDUP; typedef struct netmessage_inanimatedamaged { @@ -666,28 +663,28 @@ typedef struct netmessage_inanimatedamaged int multiple; -}NETMESSAGE_INANIMATEDAMAGED; +} PACKED NETMESSAGE_INANIMATEDAMAGED; typedef struct netmessage_inanimatedestroyed { char name[8]; -}NETMESSAGE_INANIMATEDESTROYED; +} PACKED NETMESSAGE_INANIMATEDESTROYED; typedef struct netmessage_losrequestbinaryswitch { char name[8]; -}NETMESSAGE_LOSREQUESTBINARYSWITCH; +} PACKED NETMESSAGE_LOSREQUESTBINARYSWITCH; typedef struct netmessage_platformliftstate { char name[8]; char state; -}NETMESSAGE_PLATFORMLIFTSTATE; +} PACKED NETMESSAGE_PLATFORMLIFTSTATE; typedef struct netmessage_requestplatformliftactivate { char name[8]; -}NETMESSAGE_REQUESTPLATFORMLIFTACTIVATE; +} PACKED NETMESSAGE_REQUESTPLATFORMLIFTACTIVATE; typedef struct netmessage_agunstate { @@ -700,7 +697,7 @@ typedef struct netmessage_agunstate signed int objectId; unsigned char IAmFiring: 1; unsigned char IAmEnabled: 1; -}NETMESSAGE_AGUNSTATE; +} PACKED NETMESSAGE_AGUNSTATE; /* KJL 17:45:21 20/01/98 - make decal message */ /* currently not optimised for space! */ @@ -711,27 +708,27 @@ typedef struct netmessage_makedecal VECTORCH Position; VECTORCH Direction; int ModuleIndex; -}NETMESSAGE_MAKEDECAL; +} PACKED NETMESSAGE_MAKEDECAL; /* KJL 11:32:52 27/04/98 - explosions */ typedef struct netmessage_makeexplosion { enum EXPLOSION_ID ExplosionID; VECTORCH Position; -}NETMESSAGE_MAKEEXPLOSION; +} PACKED NETMESSAGE_MAKEEXPLOSION; typedef struct netmessage_makeflechetteexplosion { VECTORCH Position; int Seed; -}NETMESSAGE_MAKEFLECHETTEEXPLOSION; +} PACKED NETMESSAGE_MAKEFLECHETTEEXPLOSION; typedef struct netmessage_makeplasmaexplosion { enum EXPLOSION_ID ExplosionID; VECTORCH Position; VECTORCH FromPosition; -}NETMESSAGE_MAKEPLASMAEXPLOSION; +} PACKED NETMESSAGE_MAKEPLASMAEXPLOSION; /* KJL 11:13:59 20/05/98 - pred laser sights */ typedef struct netmessage_predatorsights @@ -746,21 +743,17 @@ typedef struct netmessage_predatorsights signed int zPos: 23; signed int zOrient: 9; - // DPID TargetID; - int TargetID; + DPID TargetID; // 16 bytes (DPID 4 bytes?) - -} NETMESSAGE_PREDATORSIGHTS; +} PACKED NETMESSAGE_PREDATORSIGHTS; typedef struct netmessage_lobonfire { -// DPID playerId; - int playerId; + DPID playerId; signed int objectId; - -}NETMESSAGE_LOBONFIRE; +} PACKED NETMESSAGE_LOBONFIRE; typedef struct netmessage_alienaistate { @@ -790,7 +783,7 @@ typedef struct netmessage_alienaistate unsigned short standard_gravity:1; #endif -}NETMESSAGE_ALIENAISTATE; +} PACKED NETMESSAGE_ALIENAISTATE; typedef struct netmessage_aliensequencechange { @@ -801,7 +794,7 @@ typedef struct netmessage_aliensequencechange short sequence_length; //in 256ths of a second short tweening_time; -}NETMESSAGE_ALIENSEQUENCECHANGE; +} PACKED NETMESSAGE_ALIENSEQUENCECHANGE; typedef struct netmessage_alienaikilled { @@ -811,14 +804,13 @@ typedef struct netmessage_alienaikilled int death_time; int GibbFactor; -// DPID killerId; - int killerId; + DPID killerId; int killCount; unsigned char AlienType: 2;//alien/predalien/praetorian char weaponIcon; -}NETMESSAGE_ALIENAIKILLED; +} PACKED NETMESSAGE_ALIENAIKILLED; typedef struct netmessage_faralienposition { @@ -829,14 +821,14 @@ typedef struct netmessage_faralienposition unsigned int indexIsModuleIndex:1; unsigned int alienType:2; -} NETMESSAGE_FARALIENPOSITION; +} PACKED NETMESSAGE_FARALIENPOSITION; typedef struct netmessage_gibbing { signed int Guid; int gibbFactor; int seed; -} NETMESSAGE_GIBBING; +} PACKED NETMESSAGE_GIBBING; typedef struct netmessage_spotaliensound { @@ -847,7 +839,7 @@ typedef struct netmessage_spotaliensound int vy; int vz; -} NETMESSAGE_SPOTALIENSOUND; +} PACKED NETMESSAGE_SPOTALIENSOUND; typedef struct netmessage_createweapon @@ -856,7 +848,7 @@ typedef struct netmessage_createweapon VECTORCH location; int type; -}NETMESSAGE_CREATEWEAPON; +} PACKED NETMESSAGE_CREATEWEAPON; #define NUMBER_OF_FRAGMENTAL_OBJECTS (64>>3) typedef struct netmessage_fragmentalobjectsstatus @@ -864,7 +856,7 @@ typedef struct netmessage_fragmentalobjectsstatus unsigned char BatchNumber; //send object states over several frames unsigned char StatusBitfield[NUMBER_OF_FRAGMENTAL_OBJECTS]; -}NETMESSAGE_FRAGMENTALOBJECTSSTATUS; +} PACKED NETMESSAGE_FRAGMENTALOBJECTSSTATUS; #define NUMBER_OF_STRATEGIES_TO_SYNCH 16 typedef struct netmessage_strategysynch @@ -873,35 +865,32 @@ typedef struct netmessage_strategysynch int strategyCheckSum; unsigned char StatusBitfield[NUMBER_OF_STRATEGIES_TO_SYNCH>>2]; //2bits per strategy -}NETMESSAGE_STRATEGYSYNCH; +} PACKED NETMESSAGE_STRATEGYSYNCH; //for messages that just require a player id typedef struct netmessage_playerid { -// DPID playerID; - int playerID; - -}NETMESSAGE_PLAYERID; + DPID playerID; +} PACKED NETMESSAGE_PLAYERID; typedef struct netmessage_lms_restart { -// DPID playerID; - int playerID; + DPID playerID; int seed; -}NETMESSAGE_LMS_RESTART; +} PACKED NETMESSAGE_LMS_RESTART; typedef struct netmessage_restartgame { int seed; -}NETMESSAGE_RESTARTGAME; +} PACKED NETMESSAGE_RESTARTGAME; //countdown to restart typedef struct netmessage_lms_restarttimer { unsigned char timer; -}NETMESSAGE_LMS_RESTARTTIMER; +} PACKED NETMESSAGE_LMS_RESTARTTIMER; typedef struct netmessage_spotothersound { @@ -911,16 +900,17 @@ typedef struct netmessage_spotothersound int vz; int explosion:1; -} NETMESSAGE_SPOTOTHERSOUND; +} PACKED NETMESSAGE_SPOTOTHERSOUND; typedef struct multiplayer_start { VECTORCH location; EULER orientation; -}MULTIPLAYER_START; +} PACKED MULTIPLAYER_START; +/* #pragma pack(pop) - +*/ /* --------------------------------------------------------------------- Some prototypes @@ -929,15 +919,13 @@ extern void InitAVPNetGame(void); extern void NetCollectMessages(void); extern void NetSendMessages(void); extern void EndAVPNetGame(void); -//extern int PlayerIdInPlayerList(DPID Id); -extern int PlayerIdInPlayerList(int Id); +extern int PlayerIdInPlayerList(DPID Id); //use assignnewsbname instead of addnetgameobjectid #define AddNetGameObjectID AssignNewSBName extern void AddNetGameObjectID(STRATEGYBLOCK *sbPtr); extern void RecordFinalNetGameScores(void); extern void DoNetScoresForHostDeath(NETGAME_CHARACTERTYPE myType,NETGAME_CHARACTERTYPE killerType); -//extern void RemovePlayerFromGame(DPID id); -extern void RemovePlayerFromGame(int id); +extern void RemovePlayerFromGame(DPID id); extern int EmptySlotInPlayerList(void); extern void TeleportNetPlayerToAStartingPosition(STRATEGYBLOCK *playerSbPtr, int startOfGame); extern int AddUpPlayerFrags(int playerId); @@ -986,11 +974,9 @@ extern void AddNetMsg_SpotAlienSound(int soundCategory,int alienType,int pitch,V extern void AddNetMsg_LocalObjectDestroyed_Request(STRATEGYBLOCK *sbPtr); extern void AddNetMsg_ScoreChange(int killerIndex,int victimIndex); -//extern void AddNetMsg_PlayerID(DPID playerID,unsigned char message); -extern void AddNetMsg_PlayerID(int playerID,unsigned char message); -extern void AddNetMsg_LastManStanding_RestartTimer(unsigned char time); -//extern void AddNetMsg_LastManStanding_Restart(DPID alienID,int seed); -extern void AddNetMsg_LastManStanding_Restart(int alienID,int seed); +extern void AddNetMsg_PlayerID(DPID playerID,unsigned char message); +extern void AddNetMsg_LastManStanding_RestartTimer(char time); +extern void AddNetMsg_LastManStanding_Restart(DPID alienID,int seed); extern void AddNetMsg_CreateWeapon(char* objectName,int type,VECTORCH* location); diff --git a/src/main.c b/src/main.c index 1a2efb1..b94d517 100644 --- a/src/main.c +++ b/src/main.c @@ -117,9 +117,8 @@ int InitialiseWindowsSystem() glPolygonMode(GL_BACK, GL_FILL); glDisable(GL_CULL_FACE); -/* glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); -*/ + return 0; } @@ -764,8 +763,6 @@ int main(int argc, char *argv[]) */ RestartLevel(); } - -// break; /* TODO -- remove when loop works */ } AvP.LevelCompleted = thisLevelHasBeenCompleted; diff --git a/src/net.c b/src/net.c deleted file mode 100644 index 02fb7b1..0000000 --- a/src/net.c +++ /dev/null @@ -1,887 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -#include "fixer.h" - -#include "3dc.h" -#include "platform.h" -#include "inline.h" -#include "gamedef.h" -#include "module.h" -#include "stratdef.h" -#include "projfont.h" -#include "kshape.h" -#include "prototyp.h" -#include "d3d_hud.h" -#include "bh_types.h" -#include "equipmnt.h" -#include "bh_marin.h" -#include "bh_alien.h" -#include "pldghost.h" - -#define UseLocalAssert Yes -#include "ourasert.h" - -DISPLAYBLOCK PlayersMirrorImage; -STRATEGYBLOCK PlayersMirrorImageSB; -NETGHOSTDATABLOCK PlayersMirrorGhost; -DYNAMICSBLOCK PlayersMirrorDynBlock; - -extern int LastHand; - -/* support function for addnetmsg_playerstate() */ -static int MyPlayerHasAMuzzleFlash(STRATEGYBLOCK *sbPtr) -{ - PLAYER_WEAPON_DATA *weaponPtr; - TEMPLATE_WEAPON_DATA *twPtr; - PLAYER_STATUS *playerStatusPtr = (PLAYER_STATUS *)(Player->ObStrategyBlock->SBdataptr); - LOCALASSERT(playerStatusPtr); - - weaponPtr = &(playerStatusPtr->WeaponSlot[playerStatusPtr->SelectedWeaponSlot]); - twPtr = &TemplateWeapon[weaponPtr->WeaponIDNumber]; - - /* first check if we are displaying a muzle flash ourselves */ - if(twPtr->MuzzleFlashShapeName == NULL) return 0; - if(twPtr->PrimaryIsMeleeWeapon) return 0; - - if (weaponPtr->WeaponIDNumber==WEAPON_TWO_PISTOLS) { - if (weaponPtr->CurrentState == WEAPONSTATE_FIRING_PRIMARY) { - if (LastHand) { - return 2; - } else { - return 1; - } - } else if (weaponPtr->CurrentState == WEAPONSTATE_FIRING_SECONDARY) { - if (LastHand) { - return 2; - } else { - return 1; - } - return 0; - } - } - - if (weaponPtr->WeaponIDNumber==WEAPON_MARINE_PISTOL) { - if ((weaponPtr->CurrentState==WEAPONSTATE_FIRING_PRIMARY) - ||(weaponPtr->CurrentState==WEAPONSTATE_FIRING_SECONDARY)) { - //ReleasePrintDebuggingText("Pistol Muzzle Flash 1\n"); - return 1; - } else { - //ReleasePrintDebuggingText("Pistol Muzzle Flash 0\n"); - return 0; - } - } - - if (weaponPtr->CurrentState != WEAPONSTATE_FIRING_PRIMARY) { - return 0; - } - - /* even if we are displaying our own muzzle flash, we don't neccessarily want it to - be visible to other players (because it looks stupid) */ - if((weaponPtr->WeaponIDNumber==WEAPON_PULSERIFLE)|| - (weaponPtr->WeaponIDNumber==WEAPON_MARINE_PISTOL)|| - (weaponPtr->WeaponIDNumber==WEAPON_AUTOSHOTGUN)|| - (weaponPtr->WeaponIDNumber==WEAPON_SMARTGUN)|| - (weaponPtr->WeaponIDNumber==WEAPON_MINIGUN)|| - (weaponPtr->WeaponIDNumber==WEAPON_FRISBEE_LAUNCHER)|| - (weaponPtr->WeaponIDNumber==WEAPON_PRED_PISTOL)|| - (weaponPtr->WeaponIDNumber==WEAPON_PRED_RIFLE)) - { - /* if we get this far, we want to display a muzzle flash */ - return 1; - } - return 0; -} - -/* Patrick 11/7/97 ---------------------------------------------- -Functions for determining our sequence for player update messages ------------------------------------------------------------------*/ - -static MARINE_SEQUENCE GetMyMarineSequence(void) -{ - int playerIsMoving = 0; - int playerIsFiring = 0; - int playerIsCrouching = 0; - int playerIsAlive = 0; - int playerIsJumping = 0; - int usingCloseAttackWeapon; - extern int StaffAttack; - - /* sort out what state we're in */ - if(PlayerStatusPtr->IsAlive) playerIsAlive = 1; - else playerIsAlive = 0; - - if (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_Backward) { - playerIsMoving=-1; - } else if((PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_Forward)|| - (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepLeft)|| - (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepRight)) { - playerIsMoving = 1; - } else { - playerIsMoving = 0; - } - - if ( (Player->ObStrategyBlock->DynPtr->Position.vx==Player->ObStrategyBlock->DynPtr->PrevPosition.vx) - && (Player->ObStrategyBlock->DynPtr->Position.vy==Player->ObStrategyBlock->DynPtr->PrevPosition.vy) - && (Player->ObStrategyBlock->DynPtr->Position.vz==Player->ObStrategyBlock->DynPtr->PrevPosition.vz) ) { - /* Actually not moving - overruled! */ - playerIsMoving=0; - } - - if(PlayerStatusPtr->ShapeState!=PMph_Standing) - { - playerIsCrouching = 1; - } - else - { - playerIsCrouching = 0; - } - - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_FIRING_PRIMARY)|| - (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_PRIMARY)) { - playerIsFiring = 1; - } else { - if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_MARINE_PISTOL) { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_FIRING_SECONDARY)|| - (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_SECONDARY)) { - playerIsFiring = 1; - } else { - playerIsFiring = 0; - } - } else { - playerIsFiring = 0; - } - } - - if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_CUDGEL) - usingCloseAttackWeapon = 1; - else usingCloseAttackWeapon = 0; - - /* Fix cudgel. */ - if (usingCloseAttackWeapon) { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_FIRING_SECONDARY)|| - (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_SECONDARY)) { - playerIsFiring = 1; - } - } - - /* KJL 14:27:14 10/29/97 - deal with jumping & falling */ - { - DYNAMICSBLOCK *dynPtr = Player->ObStrategyBlock->DynPtr; - if (!dynPtr->IsInContactWithFloor && (dynPtr->TimeNotInContactWithFloor==0)) - playerIsJumping=1; - } - - /* and deduce the sequence */ - if(playerIsAlive==0) - { - if(playerIsCrouching) { - return MSQ_CrouchDie; - } else { - return MSQ_StandDieFront; - } - } - - if(playerIsJumping) { - return MSQ_Jump; - } - - /* Put this in here... no running cudgel attacks yet. */ - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with cudgel case! */ - if (StaffAttack>=0) { - return(MSQ_BaseOfCudgelAttacks+StaffAttack); - } - } - - if(playerIsCrouching) - { - if(playerIsMoving>0) { - return MSQ_Crawl; - } else if (playerIsMoving<0) { - return MSQ_Crawl_Backwards; - } else { - return MSQ_Crouch; - } - } - - if(playerIsMoving>0) - { - if(playerIsFiring) { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS) - &&(LastHand)) { - return MSQ_RunningFireSecondary; - } else { - return MSQ_RunningFire; - } - } else { - return MSQ_Walk; - } - } else if (playerIsMoving<0) { - if(playerIsFiring) { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS) - &&(LastHand)) { - return MSQ_RunningFireSecondary_Backwards; - } else { - return MSQ_RunningFire_Backwards; - } - } else { - return MSQ_Walk_Backwards; - } - } - - if(playerIsFiring) { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_TWO_PISTOLS) - &&(LastHand)) { - return MSQ_StandingFireSecondary; - } else { - return MSQ_StandingFire; - } - } else { - if (PlayerStatusPtr->tauntTimer!=0) { - return MSQ_Taunt; - } else { - return MSQ_Stand; - } - } -} - -static ALIEN_SEQUENCE GetMyAlienSequence(void) -{ - extern STRATEGYBLOCK *Biting; - extern int Bit; - int playerIsMoving = 0; - int playerIsFiring = 0; - int playerIsCrouching = 0; - int playerIsAlive = 0; - int playerIsJumping = 0; - - /* sort out what state we're in */ - if(PlayerStatusPtr->IsAlive) playerIsAlive = 1; - else playerIsAlive = 0; - - if (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_Backward) { - playerIsMoving =-1; - } else if ((PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_Forward)|| - (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepLeft)|| - (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepRight)) { - playerIsMoving = 1; - } else { - playerIsMoving = 0; - } - - if ( (Player->ObStrategyBlock->DynPtr->Position.vx==Player->ObStrategyBlock->DynPtr->PrevPosition.vx) - && (Player->ObStrategyBlock->DynPtr->Position.vy==Player->ObStrategyBlock->DynPtr->PrevPosition.vy) - && (Player->ObStrategyBlock->DynPtr->Position.vz==Player->ObStrategyBlock->DynPtr->PrevPosition.vz) ) { - /* Actually not moving - overruled! */ - playerIsMoving=0; - } - - if(PlayerStatusPtr->ShapeState!=PMph_Standing) playerIsCrouching = 1; - else playerIsCrouching = 0; - - /* ChrisF 20/4/98: playerIsFiring now specifies alien weapon behaviour. */ - //if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_FIRING_PRIMARY)|| - // (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_PRIMARY)) - // playerIsFiring = 1; - //else playerIsFiring = 0; - // - //if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber!=WEAPON_ALIEN_SPIT) { - // usingCloseAttackWeapon = 1; - //} else { - // usingCloseAttackWeapon = 0; - //} - - switch(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState) { - case (WEAPONSTATE_FIRING_PRIMARY): - if(Biting) { - playerIsFiring=4; //Eat. - } else { - playerIsFiring=1; //Claw. - } - break; - case (WEAPONSTATE_FIRING_SECONDARY): - playerIsFiring=2; //Tail Poise. - break; - case (WEAPONSTATE_RECOIL_SECONDARY): - playerIsFiring=3; //Tail Strike. - break; - default: - playerIsFiring=0; //Nothing. - break; - } - - - /* KJL 14:27:14 10/29/97 - deal with jumping & falling */ - { - DYNAMICSBLOCK *dynPtr = Player->ObStrategyBlock->DynPtr; - if (!dynPtr->IsInContactWithFloor && (dynPtr->TimeNotInContactWithFloor==0)) - playerIsJumping=1; - } - - /* and deduce the sequence */ - if(playerIsAlive==0) - { - return ASQ_Stand; /* kind of irrelevant really */ - } - - if(playerIsJumping) /* TODO: consider jump & crouch */ - { - switch(playerIsFiring) { - case 1: - return ASQ_Pounce; - break; - case 2: - return ASQ_JumpingTailPoise; - break; - case 3: - return ASQ_JumpingTailStrike; - break; - case 4: - /* What the hell? */ - return ASQ_Eat; - break; - default: - return ASQ_Jump; - break; - } - } - - if(playerIsCrouching) - { - if(playerIsMoving>0) - { - switch(playerIsFiring) { - case 1: - return ASQ_CrawlingAttack_Claw; - break; - case 2: - return ASQ_CrawlingTailPoise; - break; - case 3: - return ASQ_CrawlingTailStrike; - break; - case 4: - /* What the hell? */ - return ASQ_CrouchEat; - break; - default: - if(Player->ObStrategyBlock->DynPtr->OrientMat.mat22>50000) - return ASQ_Scamper; - else - return ASQ_Crawl; - break; - } - } else if(playerIsMoving<0) { - switch(playerIsFiring) { - case 1: - return ASQ_CrawlingAttack_Claw_Backwards; - break; - case 2: - return ASQ_CrawlingTailPoise_Backwards; - break; - case 3: - return ASQ_CrawlingTailStrike_Backwards; - break; - case 4: - /* What the hell? */ - return ASQ_CrouchEat; - break; - default: - if(Player->ObStrategyBlock->DynPtr->OrientMat.mat22>50000) - return ASQ_Scamper_Backwards; - else - return ASQ_Crawl_Backwards; - break; - } - } - - switch(playerIsFiring) { - case 1: - return ASQ_CrouchedAttack_Claw; - break; - case 2: - return ASQ_CrouchedTailPoise; - break; - case 3: - return ASQ_CrouchedTailStrike; - break; - case 4: - return ASQ_Eat; - break; - default: - return ASQ_Crouch; - break; - } - } - - if(playerIsMoving>0) - { - switch(playerIsFiring) { - case 1: - return ASQ_RunningAttack_Claw; - break; - case 2: - return ASQ_RunningTailPoise; - break; - case 3: - return ASQ_RunningTailStrike; - break; - case 4: - /* What the hell? */ - return ASQ_Eat; - break; - default: - return ASQ_Run; - break; - } - } else if(playerIsMoving<0) { - switch(playerIsFiring) { - case 1: - return ASQ_RunningAttack_Claw_Backwards; - break; - case 2: - return ASQ_RunningTailPoise_Backwards; - break; - case 3: - return ASQ_RunningTailStrike_Backwards; - break; - case 4: - /* What the hell? */ - return ASQ_Eat; - break; - default: - return ASQ_Run_Backwards; - break; - } - } - - switch(playerIsFiring) { - case 1: - return ASQ_StandingAttack_Claw; - break; - case 2: - return ASQ_StandingTailPoise; - break; - case 3: - return ASQ_StandingTailStrike; - break; - case 4: - return ASQ_Eat; - break; - default: - if (PlayerStatusPtr->tauntTimer!=0) { - /* Second lowest priority ever. */ - return ASQ_Taunt; - } else { - return ASQ_Stand; - } - break; - } - -} - -static PREDATOR_SEQUENCE GetMyPredatorSequence(void) -{ - int playerIsMoving = 0; - int playerIsFiring = 0; - int playerIsCrouching = 0; - int playerIsAlive = 0; - int playerIsJumping = 0; - int usingCloseAttackWeapon; - extern int StaffAttack; - - /* sort out what state we're in */ - if(PlayerStatusPtr->IsAlive) playerIsAlive = 1; - else playerIsAlive = 0; - - if (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_Backward) { - playerIsMoving=-1; - } else if((PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_Forward)|| - (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepLeft)|| - (PlayerStatusPtr->Mvt_InputRequests.Flags.Rqst_SideStepRight)) { - playerIsMoving = 1; - } else { - playerIsMoving = 0; - } - - if ( (Player->ObStrategyBlock->DynPtr->Position.vx==Player->ObStrategyBlock->DynPtr->PrevPosition.vx) - && (Player->ObStrategyBlock->DynPtr->Position.vy==Player->ObStrategyBlock->DynPtr->PrevPosition.vy) - && (Player->ObStrategyBlock->DynPtr->Position.vz==Player->ObStrategyBlock->DynPtr->PrevPosition.vz) ) { - /* Actually not moving - overruled! */ - playerIsMoving=0; - } - - if(PlayerStatusPtr->ShapeState!=PMph_Standing) playerIsCrouching = 1; - else playerIsCrouching = 0; - - playerIsFiring = 0; - - if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_PRED_SHOULDERCANNON) - { - //the shoulder cannon is fired during recoil (I think) - if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_PRIMARY) - { - playerIsFiring = 1; - } - } - else if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_PRED_WRISTBLADE) - { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_FIRING_PRIMARY)|| - (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_PRIMARY) || - (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_SECONDARY)) - { - if(StaffAttack!=-1) - { - playerIsFiring = 1; - } - } - } - else - { - if((PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_FIRING_PRIMARY)|| - (PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].CurrentState==WEAPONSTATE_RECOIL_PRIMARY)) - { - playerIsFiring = 1; - } - } - - if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_PRED_WRISTBLADE) - usingCloseAttackWeapon = 3; - else if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_PRED_DISC) - usingCloseAttackWeapon = 1; - else if(PlayerStatusPtr->WeaponSlot[PlayerStatusPtr->SelectedWeaponSlot].WeaponIDNumber==WEAPON_PRED_STAFF) - usingCloseAttackWeapon = 2; - else usingCloseAttackWeapon = 0; - - /* KJL 14:27:14 10/29/97 - deal with jumping & falling */ - { - DYNAMICSBLOCK *dynPtr = Player->ObStrategyBlock->DynPtr; - if (!dynPtr->IsInContactWithFloor && (dynPtr->TimeNotInContactWithFloor==0)) - playerIsJumping=1; - } - - /* and deduce the sequence */ - if(playerIsAlive==0) - { - if(playerIsCrouching) { - return PredSQ_CrouchDie; - } else { - return PredSQ_StandDie; - } - } - - if(playerIsJumping) { - return(PredSQ_Jump); - } - - if(playerIsCrouching) - { - if(playerIsMoving>0) - { - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with staff case! */ - if (usingCloseAttackWeapon==2) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfStaffAttacks+StaffAttack); - } - } else if (usingCloseAttackWeapon==3) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfWristbladeAttacks+StaffAttack); - } - } - return PredSQ_CrawlingSwipe; - } else { - return PredSQ_Crawl; - } - } else if (playerIsMoving<0) { - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with staff case! */ - if (usingCloseAttackWeapon==2) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfStaffAttacks+StaffAttack); - } - } else if (usingCloseAttackWeapon==3) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfWristbladeAttacks+StaffAttack); - } - } - return PredSQ_CrawlingSwipe_Backwards; - } else { - return PredSQ_Crawl_Backwards; - } - } - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with staff case! */ - if (usingCloseAttackWeapon==2) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfStaffAttacks+StaffAttack); - } - } else if (usingCloseAttackWeapon==3) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfWristbladeAttacks+StaffAttack); - } - } - return PredSQ_CrouchedSwipe; - } else { - return PredSQ_Crouch; - } - } - - if(playerIsMoving>0) - { - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with staff case! */ - if (usingCloseAttackWeapon==2) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfStaffAttacks+StaffAttack); - } - } else if (usingCloseAttackWeapon==3) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfWristbladeAttacks+StaffAttack); - } - } - return PredSQ_RunningSwipe; - } else { - return PredSQ_Run; - } - } else if (playerIsMoving<0) { - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with staff case! */ - if (usingCloseAttackWeapon==2) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfStaffAttacks+StaffAttack); - } - } else if (usingCloseAttackWeapon==3) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfWristbladeAttacks+StaffAttack); - } - } - return PredSQ_RunningSwipe_Backwards; - } else { - return PredSQ_Run_Backwards; - } - } - - if(playerIsFiring&&usingCloseAttackWeapon) { - /* Deal with staff case! */ - if (usingCloseAttackWeapon==2) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfStaffAttacks+StaffAttack); - } - } else if (usingCloseAttackWeapon==3) { - if (StaffAttack>=0) { - return(PredSQ_BaseOfWristbladeAttacks+StaffAttack); - } - } - return PredSQ_StandingSwipe; - } else { - if (PlayerStatusPtr->tauntTimer!=0) { - return PredSQ_Taunt; - } else { - return PredSQ_Stand; - } - } -} - -BOOL Current_Level_Requires_Mirror_Image() -{ - extern char LevelName[]; - if ( (!stricmp(LevelName,"e3demo")) || (!stricmp(LevelName,"e3demosp")) || (!stricmp(LevelName,"derelict")) ) - { - return TRUE; - } - return FALSE; -} - - -void CreatePlayersImageInMirror(void) -{ - AVP_BEHAVIOUR_TYPE type; - STRATEGYBLOCK *sbPtr = &PlayersMirrorImageSB; - NETGHOSTDATABLOCK *ghostData = &PlayersMirrorGhost; - PlayersMirrorImage.ObStrategyBlock = sbPtr; - - sbPtr->SBdptr = &PlayersMirrorImage; - - sbPtr->SBdataptr = (void *)ghostData; - sbPtr->DynPtr = &PlayersMirrorDynBlock; - - switch(AvP.PlayerType) - { - case(I_Marine): - { - type = I_BehaviourMarinePlayer; - break; - } - case(I_Predator): - { - type = I_BehaviourPredatorPlayer; - break; - } - case(I_Alien): - { - type = I_BehaviourAlienPlayer; - break; - } - } - ghostData->type = type; - ghostData->IOType=IOT_Non; - ghostData->subtype=0; - ghostData->myGunFlash = NULL; - ghostData->SoundHandle = SOUND_NOACTIVEINDEX; - ghostData->currentAnimSequence = 0; - ghostData->CloakingEffectiveness = 0; - ghostData->IgnitionHandshaking = 0; - ghostData->soundStartFlag = 0; - - if(AvP.Network == I_No_Network) - { - ghostData->playerId=0; - } - else - { -// ghostData->playerId=AVPDPNetID; - fprintf(stderr, "CreatePlayersImageInMirror: ghostData->playerId=AVPDPNetID\n"); - } - - /* set the shape */ - - switch(type) - { - case I_BehaviourMarinePlayer: - { - CreateMarineHModel(ghostData,WEAPON_PULSERIFLE); - break; - } - case I_BehaviourAlienPlayer: - { - CreateAlienHModel(ghostData); - break; - } - case I_BehaviourPredatorPlayer: - { - CreatePredatorHModel(ghostData,WEAPON_PRED_WRISTBLADE); - break; - } - default: - break; - } - - sbPtr->SBdptr->HModelControlBlock=&ghostData->HModelController; - ProveHModel(sbPtr->SBdptr->HModelControlBlock,sbPtr->SBdptr); -} - -void DeallocatePlayersMirrorImage() -{ -#if MIRRORING_ON - if(Current_Level_Requires_Mirror_Image()) - { - Dispel_HModel(&PlayersMirrorGhost.HModelController); - } -#endif -} - -void RenderPlayersImageInMirror(void) -{ - STRATEGYBLOCK *sbPtr = &PlayersMirrorImageSB; - NETGHOSTDATABLOCK *ghostData = &PlayersMirrorGhost; - - int sequence; - int weapon; - int firingPrimary; - int firingSecondary; - - switch(AvP.PlayerType) - { - case I_Marine: - { - sequence = (unsigned char)GetMyMarineSequence(); - //check for change of charcter type - if(ghostData->type!=I_BehaviourMarinePlayer) - { - ghostData->type=I_BehaviourMarinePlayer; - //settings currentweapon to -1 will forec the hmodel to be updated - ghostData->CurrentWeapon=-1; - } - - break; - } - case I_Predator: - { - sequence = (unsigned char)GetMyPredatorSequence(); - //check for change of charcter type - if(ghostData->type!=I_BehaviourPredatorPlayer) - { - ghostData->type=I_BehaviourPredatorPlayer; - //settings currentweapon to -1 will forec the hmodel to be updated - ghostData->CurrentWeapon=-1; - } - break; - } - case I_Alien: - { - sequence = (unsigned char)GetMyAlienSequence(); - //check for change of charcter type - if(ghostData->type!=I_BehaviourAlienPlayer) - { - ghostData->type=I_BehaviourAlienPlayer; - //setting currentweapon to -1 will force the hmodel to be updated - ghostData->CurrentWeapon=-1; - } - break; - } - default: - { - LOCALASSERT(1==0); - break; - } - } - /* my current weapon id, and whether I am firing it... */ - { - PLAYER_WEAPON_DATA *weaponPtr; - PLAYER_STATUS *playerStatusPtr = (PLAYER_STATUS *)(Player->ObStrategyBlock->SBdataptr); - LOCALASSERT(playerStatusPtr); - weaponPtr = &(playerStatusPtr->WeaponSlot[playerStatusPtr->SelectedWeaponSlot]); - weapon = (signed char)(weaponPtr->WeaponIDNumber); - - if((weaponPtr->CurrentState==WEAPONSTATE_FIRING_PRIMARY)&&(playerStatusPtr->IsAlive)) - firingPrimary = 1; - else firingPrimary = 0; - if((weaponPtr->CurrentState==WEAPONSTATE_FIRING_SECONDARY)&&(playerStatusPtr->IsAlive)) - firingSecondary = 1; - else firingSecondary = 0; - } - -// if(!(((!(messagePtr->IAmAlive)))&&(netGameData.playerData[playerIndex].characterType==NGCT_Alien))) - { - { - PLAYER_STATUS *playerStatusPtr= (PLAYER_STATUS *) (Player->ObStrategyBlock->SBdataptr); - HandleWeaponElevation(sbPtr,playerStatusPtr->ViewPanX,weapon); - - UpdateGhost(sbPtr,&(Player->ObStrategyBlock->DynPtr->Position),&(Player->ObStrategyBlock->DynPtr->OrientEuler),sequence,AreTwoPistolsInTertiaryFire()); - - - MaintainGhostCloakingStatus(sbPtr,(int)playerStatusPtr->cloakOn); - } - } - { - extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr; - DISPLAYBLOCK *dPtr = &PlayersMirrorImage; - dPtr->ObWorld = PlayersMirrorDynBlock.Position; - dPtr->ObMat = PlayersMirrorDynBlock.OrientMat; - ReflectObject(dPtr); - - PlayersMirrorImage.ObStrategyBlock = 0; - - AddShape(dPtr,Global_VDB_Ptr); - PlayersMirrorImage.ObStrategyBlock = &PlayersMirrorImageSB; - - } - HandleGhostGunFlashEffect(sbPtr,MyPlayerHasAMuzzleFlash(sbPtr)); -} diff --git a/src/stubs.c b/src/stubs.c index 00b7b1c..bdc0152 100644 --- a/src/stubs.c +++ b/src/stubs.c @@ -432,230 +432,4 @@ void dx_line_log(int line, char const * file) fprintf(stderr, "dx_line_log: %s/%d\n", file, line); } - -/* pldnet.c */ -MULTIPLAYER_START* marineStartPositions=0; -MULTIPLAYER_START* predatorStartPositions=0; -MULTIPLAYER_START* alienStartPositions=0; -int numMarineStartPos=0; -int numPredatorStartPos=0; -int numAlienStartPos=0; -NETGAME_GAMEDATA netGameData; /* TODO: this constant is initialized in pldnet.c */ -DPID myIgniterId = 0; -DPID myNetworkKillerId = 0; -int ShowMultiplayerScoreTimer=0; -int MyHitBodyPartId=-1; -DPID MultiplayerObservedPlayer=0; -DPID AVPDPNetID; - -BOOL AreThereAnyLivesLeft() -{ - fprintf(stderr, "AreThereAnyLivesLeft()\n"); - - return FALSE; -} - -void TurnOffMultiplayerObserveMode() -{ - fprintf(stderr, "TurnOffMultiplayerObserveMode()\n"); -} - -void TransmitPlayerLeavingNetMsg() -{ - fprintf(stderr, "TransmitPlayerLeavingNetMsg()\n"); -} - -void TransmitEndOfGameNetMsg() -{ - fprintf(stderr, "TransmitEndOfGameNetMsg()\n"); -} - -void TeleportNetPlayerToAStartingPosition(STRATEGYBLOCK *playerSbPtr, int startOfGame) -{ - fprintf(stderr, "TeleportNetPlayerToAStartingPosition(%p, %d)\n", playerSbPtr, startOfGame); -} - -void SpeciesTag_DetermineMyNextCharacterType() -{ - fprintf(stderr, "SpeciesTag_DetermineMyNextCharacterType()\n"); -} - -void ShowNearestPlayersName() -{ - fprintf(stderr, "ShowNearestPlayersName()\n"); -} - -void RestartNetworkGame(int seed) -{ - fprintf(stderr, "RestartNetworkGame(%d)\n", seed); -} - -int PlayerIdInPlayerList(DPID Id) -{ - fprintf(stderr, "PlayerIdInPlayerList(%d)\n", Id); - - return 0; -} - -void NetSendMessages() -{ - fprintf(stderr, "NetSendMessages()\n"); -} - -void NetCollectMessages() -{ - fprintf(stderr, "NetCollectMessages()\n"); -} - -void GetNextMultiplayerObservedPlayer() -{ - fprintf(stderr, "GetNextMultiplayerObservedPlayer()\n"); -} - -void DoMultiplayerSpecificHud() -{ - fprintf(stderr, "DoMultiplayerSpecificHud()\n"); -} - -void AddNetMsg_AlienAIKilled(STRATEGYBLOCK *sbPtr,int death_code,int death_time, int GibbFactor,DAMAGE_PROFILE* damage) -{ - fprintf(stderr, "AddNetMsg_AlienAIKilled(%p, %d, %d, %d, %p)\n", sbPtr, death_code, death_time, GibbFactor, damage); -} - -void AddNetMsg_AlienAISeqChange(STRATEGYBLOCK *sbPtr,int sequence_type,int sub_sequence,int sequence_length,int tweening_time) -{ - fprintf(stderr, "AddNetMsg_AlienAISeqChange(%p, %d, %d, %d, %d)\n", sbPtr, sequence_type, sub_sequence, sequence_length, tweening_time); -} - -void AddNetMsg_ChatBroadcast(char *string,BOOL same_species_only) -{ - fprintf(stderr, "AddNetMsg_ChatBroadcast(%s, %d)\n", string, same_species_only); -} - -void AddNetMsg_CreateWeapon(char* objectName,int type,VECTORCH* location) -{ - fprintf(stderr, "AddNetMsg_CreateWeapon(%s, %d, %p)\n", objectName, type, location); -} - -void AddNetMsg_FarAlienPosition(STRATEGYBLOCK* sbPtr,int targetModuleIndex,int index,BOOL indexIsModuleIndex) -{ - fprintf(stderr, "AddNetMsg_FarAlienPosition(%p, %d, %d, %d)\n", sbPtr, targetModuleIndex, index, indexIsModuleIndex); -} - -void AddNetMsg_GhostHierarchyDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple, int sectionID,VECTORCH* incoming) -{ - fprintf(stderr, "AddNetMsg_GhostHierarchyDamaged(%p, %p, %d, %d, %p)\n", sbPtr, damage, multiple, sectionID, incoming); -} - -void AddNetMsg_Gibbing(STRATEGYBLOCK *sbPtr,int gibbFactor,int seed) -{ - fprintf(stderr, "AddNetMsg_Gibbing(%p, %d, %d)\n", sbPtr, gibbFactor, seed); -} - -void AddNetMsg_InanimateObjectDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage, int multiple) -{ - fprintf(stderr, "AddNetMsg_InanimateObjectDamaged(%p, %p, %d)\n", sbPtr, damage, multiple); -} - -void AddNetMsg_InanimateObjectDestroyed(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_InanimateObjectDestroyed(%p)\n", sbPtr); -} - -void AddNetMsg_LOSRequestBinarySwitch(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_LOSRequestBinarySwitch(%p)\n", sbPtr); -} - -void AddNetMsg_LocalObjectDamaged(STRATEGYBLOCK *sbPtr, DAMAGE_PROFILE *damage,int multiple, int sectionID,int delta_seq,int delta_sub_seq,VECTORCH* incoming) -{ - fprintf(stderr, "AddNetMsg_LocalObjectDamaged(%p, %p, %d, %d, %d, %d, %p)\n", sbPtr, damage, multiple, sectionID, delta_seq, delta_sub_seq, incoming); -} - -void AddNetMsg_LocalObjectDestroyed(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_LocalObjectDestroyed(%p)\n", sbPtr); -} - -void AddNetMsg_LocalObjectDestroyed_Request(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_LocalObjectDestroyed_Request(%p)\n", sbPtr); -} - -void AddNetMsg_LocalObjectOnFire(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_LocalObjectOnFire(%p)\n", sbPtr); -} - -void AddNetMsg_LocalObjectState(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_LocalObjectState(%p)\n", sbPtr); -} - -void AddNetMsg_MakeDecal(enum DECAL_ID decalID, VECTORCH *normalPtr, VECTORCH *positionPtr, int moduleIndex) -{ - fprintf(stderr, "AddNetMsg_MakeDecal(%d, %p, %p, %d)\n", decalID, normalPtr, positionPtr, moduleIndex); -} - -void AddNetMsg_MakeExplosion(VECTORCH *positionPtr, enum EXPLOSION_ID explosionID) -{ - fprintf(stderr, "AddNetMsg_MakeExplosion(%p, %d)\n", positionPtr, explosionID); -} - -void AddNetMsg_MakeFlechetteExplosion(VECTORCH *positionPtr, int seed) -{ - fprintf(stderr, "AddNetMsg_MakeFlechetteExplosion(%p, %d)\n", positionPtr, seed); -} - -void AddNetMsg_MakePlasmaExplosion(VECTORCH *positionPtr, VECTORCH *fromPositionPtr, enum EXPLOSION_ID explosionID) -{ - fprintf(stderr, "AddNetMsg_MakePlasmaExplosion(%p, %p, %d)\n", positionPtr, fromPositionPtr, explosionID); -} - -void AddNetMsg_ObjectPickedUp(char* objectName) -{ - fprintf(stderr, "AddNetMsg_ObjectPickedUp(%s)\n", objectName); -} - -void AddNetMsg_PlatformLiftState(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_PlatformLiftState(%p)\n", sbPtr); -} - -void AddNetMsg_PlayerDeathAnim(int deathId,int objectId) -{ - fprintf(stderr, "AddNetMsg_PlayerDeathAnim(%d, %d)\n", deathId, objectId); -} - -void AddNetMsg_PlayerKilled(int objectId,DAMAGE_PROFILE* damage) -{ - fprintf(stderr, "AddNetMsg_PlayerKilled(%d, %p)\n", objectId, damage); -} - -void AddNetMsg_PredatorLaserSights(VECTORCH *positionPtr, VECTORCH *normalPtr, DISPLAYBLOCK *dispPtr) -{ - fprintf(stderr, "AddNetMsg_PredatorLaserSights(%p, %p, %p)\n", positionPtr, normalPtr, dispPtr); -} - -void AddNetMsg_RequestPlatformLiftActivate(STRATEGYBLOCK *sbPtr) -{ - fprintf(stderr, "AddNetMsg_RequestPlatformLiftActivate(%p)\n", sbPtr); -} - -void AddNetMsg_RestartNetworkGame(int seed) -{ - fprintf(stderr, "AddNetMsg_RestartNetworkGame(%d)\n", seed); -} - -void AddNetMsg_SpotAlienSound(int soundCategory,int alienType,int pitch,VECTORCH *position) -{ - fprintf(stderr, "AddNetMsg_SpotAlienSound(%d, %d, %d, %p)\n", soundCategory, alienType, pitch, position); -} - -void AddNetMsg_SpotOtherSound(enum soundindex SoundIndex,VECTORCH *position,int explosion) -{ - fprintf(stderr, "AddNetMsg_SpotOtherSound(%d, %p, %d)\n", SoundIndex, position, explosion); -} - - #include "aafont.h" diff --git a/src/win95/db.h b/src/win95/db.h index 7c778db..b46bb75 100644 --- a/src/win95/db.h +++ b/src/win95/db.h @@ -31,8 +31,6 @@ * that fires at level 3 or above, use db_assert3(). */ -#pragma once - /* If you do not set the DB_LEVEL, it is set for you: to 3 */ #ifndef DB_LEVEL #define DB_LEVEL 3