From 4d7b45b68e3a6c1553d5f92370951b05ba827120 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Nov 2021 21:45:12 +0100 Subject: [PATCH] - SW: first batch of short handling. --- source/games/sw/src/actor.cpp | 4 +- source/games/sw/src/ai.cpp | 66 ++++------ source/games/sw/src/ai.h | 2 +- source/games/sw/src/game.h | 212 ++++++++++++++++----------------- source/games/sw/src/panel.cpp | 50 ++++---- source/games/sw/src/rooms.cpp | 2 +- source/games/sw/src/sprite.cpp | 4 +- source/games/sw/src/track.cpp | 4 +- source/games/sw/src/weapon.cpp | 16 ++- source/games/sw/src/weapon.h | 14 +-- source/games/sw/src/zombie.cpp | 1 - 11 files changed, 171 insertions(+), 204 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index f4633b228..ff4e2d5e7 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -308,7 +308,7 @@ void DoDebrisCurrent(DSWActor* actor) // attempt to move away from wall if (ret.type != kHitNone) { - short rang = RANDOM_P2(2048); + int rang = RANDOM_P2(2048); nx = MulScale((sectp->speed >> 2), bcos(sectp->ang + rang), 14); nx = MulScale((sectp->speed >> 2), bsin(sectp->ang + rang), 14); @@ -603,7 +603,7 @@ void KeepActorOnFloor(DSWActor* actor) } -int DoActorBeginSlide(DSWActor* actor, short ang, short vel, short dec) +int DoActorBeginSlide(DSWActor* actor, int ang, int vel, int dec) { USERp u = actor->u(); diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 20975981b..ba09aba70 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -41,17 +41,12 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS ANIMATOR InitActorRunToward; -bool FAF_Sector(short); -bool DropAhead(DSWActor* actor, short min_height); +bool FAF_Sector(int sectnum); +bool DropAhead(DSWActor* actor, int min_height); ANIMATORp ChooseAction(DECISION decision[]); -//static short ZigZagDeltaAng[] = {-200, 200}; - -// Choose between two things -short AttackOrRun = 200; - #define CHOOSE2(value) (RANDOM_P2(1024) < (value)) int Distance(int x1, int y1, int x2, int y2) @@ -146,13 +141,10 @@ void DoActorSetSpeed(DSWActor* actor, uint8_t speed) ANIMATORp ChooseAction(DECISION decision[]) { - short random_value; - short i; - // !JIM! Here is an opportunity for some AI, instead of randomness! - random_value = RANDOM_P2(1024<<5)>>5; + int random_value = RANDOM_P2(1024<<5)>>5; - for (i = 0; true; i++) + for (int i = 0; true; i++) { ASSERT(i < 10); @@ -167,14 +159,11 @@ ANIMATORp ChooseAction(DECISION decision[]) !AIC - Sometimes just want the offset of the action */ -short ChooseActionNumber(short decision[]) +int ChooseActionNumber(int16_t decision[]) { - short random_value; - short i; + int random_value = RANDOM_P2(1024<<5)>>5; - random_value = RANDOM_P2(1024<<5)>>5; - - for (i = 0; true; i++) + for (int i = 0; true; i++) { if (random_value <= decision[i]) { @@ -259,7 +248,7 @@ int CanHitPlayer(DSWActor* actor) SPRITEp sp = &actor->s(); HITINFO hitinfo; int xvect,yvect,zvect; - short ang; + int ang; // if actor can still see the player int zhs, zhh; @@ -314,7 +303,7 @@ int DoActorPickClosePlayer(DSWActor* actor) USERp u = actor->u(); SPRITEp sp = &actor->s(); int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c; - short pnum; + int pnum; PLAYERp pp; // if actor can still see the player int look_height = SPRITEp_TOS(sp); @@ -436,7 +425,7 @@ TARGETACTOR: DSWActor* GetPlayerSpriteNum(DSWActor* actor) { USERp u = actor->u(); - short pnum; + int pnum; PLAYERp pp; TRAVERSE_CONNECT(pnum) @@ -1008,11 +997,12 @@ short FindTrackToPlayer(DSWActor* actor) auto u = actor->u(); SPRITEp sp = &actor->s(); - short point, track_dir, track; - short i, *type, size; + int point, track_dir, track; + int i, size; + const uint16_t* type; int zdiff; - static short PlayerAbove[] = + static const uint16_t PlayerAbove[] = { BIT(TT_LADDER), BIT(TT_STAIRS), @@ -1022,7 +1012,7 @@ short FindTrackToPlayer(DSWActor* actor) BIT(TT_SCAN) }; - static short PlayerBelow[] = + static const uint16_t PlayerBelow[] = { BIT(TT_JUMP_DOWN), BIT(TT_STAIRS), @@ -1031,7 +1021,7 @@ short FindTrackToPlayer(DSWActor* actor) BIT(TT_SCAN) }; - static short PlayerOnLevel[] = + static const uint16_t PlayerOnLevel[] = { BIT(TT_DUCK_N_SHOOT), BIT(TT_HIDE_N_SHOOT), @@ -1091,10 +1081,10 @@ short FindTrackToPlayer(DSWActor* actor) short FindTrackAwayFromPlayer(DSWActor* actor) { auto u = actor->u(); - short point, track_dir, track; + int point, track_dir, track; unsigned int i; - static short RunAwayTracks[] = + static const int16_t RunAwayTracks[] = { BIT(TT_EXIT), BIT(TT_LADDER), @@ -1136,10 +1126,10 @@ short FindTrackAwayFromPlayer(DSWActor* actor) short FindWanderTrack(DSWActor* actor) { auto u = actor->u(); - short point, track_dir, track; + int point, track_dir, track; unsigned int i; - static short WanderTracks[] = + static const int16_t WanderTracks[] = { BIT(TT_DUCK_N_SHOOT), BIT(TT_HIDE_N_SHOOT), @@ -1286,22 +1276,6 @@ int InitActorAttack(DSWActor* actor) return 0; } -#if 0 - // if low on health determine if needs to run away - if (u->Health < 26) - { - if (CHOOSE2(AttackOrRun)) - { - InitActorRunAway(actor); - - // could do a FindHealth here - - return 0; - } - - } -#endif - // Hari Kari for Ninja's if (u->ActorActionSet->Death2) { diff --git a/source/games/sw/src/ai.h b/source/games/sw/src/ai.h index bf54413eb..54c3d7d8c 100644 --- a/source/games/sw/src/ai.h +++ b/source/games/sw/src/ai.h @@ -71,7 +71,7 @@ extern ATTRIBUTE DefaultAttrib; // AI.C functions bool ActorMoveHitReact(DSWActor* actor); -short ChooseActionNumber(short decision[]); +int ChooseActionNumber(int16_t decision[]); bool CanSeePlayer(DSWActor* actor); int DoActorPickClosePlayer(DSWActor* actor); int InitActorDecide(DSWActor* actor); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 49f6a3997..123956982 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -213,11 +213,11 @@ inline int32_t FIXED(int32_t msw, int32_t lsw) #define SP_TAG10(sp) (LSB_VAR((sp)->owner)) #define SP_TAG11(sp) ((sp)->shade) #define SP_TAG12(sp) ((sp)->pal) -#define SP_TAG13(sp) LittleShort(*((short*)&(sp)->xoffset)) -#define SP_TAG14(sp) LittleShort(*((short*)&(sp)->xrepeat)) +#define SP_TAG13(sp) LittleShort(*((int16_t*)&(sp)->xoffset)) +#define SP_TAG14(sp) LittleShort(*((int16_t*)&(sp)->xrepeat)) #define SP_TAG15(sp) ((sp)->z) -#define SET_SP_TAG13(sp,val) (*((short*)&(sp)->xoffset)) = LittleShort((short)val) -#define SET_SP_TAG14(sp,val) (*((short*)&(sp)->xrepeat)) = LittleShort((short)val) +#define SET_SP_TAG13(sp,val) (*((int16_t*)&(sp)->xoffset)) = LittleShort((int16_t)val) +#define SET_SP_TAG14(sp,val) (*((int16_t*)&(sp)->xrepeat)) = LittleShort((int16_t)val) #define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1; i = connectpoint2[i]) @@ -750,7 +750,7 @@ struct PLAYERstruct int oposx, oposy, oposz; // holds last valid move position - short lv_sectnum; + int lv_sectnum; int lv_x,lv_y,lv_z; REMOTE_CONTROL remote; @@ -758,7 +758,7 @@ struct PLAYERstruct SECTOR_OBJECTp sop; // will either be sop_remote or sop_control int jump_count, jump_speed; // jumping - short down_speed, up_speed; // diving + int16_t down_speed, up_speed; // diving int z_speed,oz_speed; // used for diving and flying instead of down_speed, up_speed int climb_ndx; int hiz,loz; @@ -768,19 +768,19 @@ struct PLAYERstruct SPRITEp last_camera_sp; int circle_camera_dist; int six,siy,siz; // save player interp position for PlayerSprite - short siang; + int16_t siang; int xvect, yvect; int oxvect, oyvect; int friction; int slide_xvect, slide_yvect; - short slide_ang; + int16_t slide_ang; int slide_dec; float drive_avel; - short view_outside_dang; // outside view delta ang - short circle_camera_ang; - short camera_check_time_delay; + int16_t view_outside_dang; // outside view delta ang + int16_t circle_camera_ang; + int16_t camera_check_time_delay; int cursectnum,lastcursectnum; fixed_t turn180_target; // 180 degree turn @@ -789,25 +789,25 @@ struct PLAYERstruct int hvel,tilt,tilt_dest; PlayerHorizon horizon; PlayerAngle angle; - short recoil_amt; - short recoil_speed; - short recoil_ndx; + int16_t recoil_amt; + int16_t recoil_speed; + int16_t recoil_ndx; fixed_t recoil_ohorizoff, recoil_horizoff; int oldposx,oldposy,oldposz; int RevolveX, RevolveY; - short RevolveDeltaAng; + int16_t RevolveDeltaAng; binangle RevolveAng; - short pnum; // carry along the player number + int16_t pnum; // carry along the player number - short LadderSector; + int16_t LadderSector; int lx,ly; // ladder x and y - short JumpDuration; - short WadeDepth; - short bob_amt; - short bob_ndx; - short bcnt; // bob count + int16_t JumpDuration; + int16_t WadeDepth; + int16_t bob_amt; + int16_t bob_ndx; + int16_t bcnt; // bob count int bob_z, obob_z; //Multiplayer variables @@ -841,11 +841,11 @@ struct PLAYERstruct uint8_t HasKey[8]; // Weapon stuff - short SwordAng; + int16_t SwordAng; int WpnGotOnceFlags; // for no respawn mode where weapons are allowed grabbed only once int WpnFlags; - short WpnAmmo[MAX_WEAPONS]; - short WpnNum; + int16_t WpnAmmo[MAX_WEAPONS]; + int16_t WpnNum; PANEL_SPRITEp CurWpn; PANEL_SPRITEp Wpn[MAX_WEAPONS]; PANEL_SPRITEp Chops; @@ -855,29 +855,29 @@ struct PLAYERstruct uint8_t WpnFlameType; // Guardian weapons fire uint8_t WpnFirstType; // First weapon type - Sword/Shuriken uint8_t WeaponType; // for weapons with secondary functions - short FirePause; // for sector objects - limits rapid firing + int16_t FirePause; // for sector objects - limits rapid firing // // Inventory Vars // - short InventoryNum; - short InventoryBarTics; - short InventoryTics[MAX_INVENTORY]; - short InventoryPercent[MAX_INVENTORY]; + int16_t InventoryNum; + int16_t InventoryBarTics; + int16_t InventoryTics[MAX_INVENTORY]; + int16_t InventoryPercent[MAX_INVENTORY]; int8_t InventoryAmount[MAX_INVENTORY]; bool InventoryActive[MAX_INVENTORY]; - short DiveTics; - short DiveDamageTics; + int16_t DiveTics; + int16_t DiveDamageTics; // Death stuff uint16_t DeathType; - short Kills; - short KilledPlayer[MAX_SW_PLAYERS_REG]; - short SecretsFound; + int16_t Kills; + int16_t KilledPlayer[MAX_SW_PLAYERS_REG]; + int16_t SecretsFound; // Health - short Armor; - short MaxHealth; + int16_t Armor; + int16_t MaxHealth; char PlayerName[32]; @@ -886,14 +886,14 @@ struct PLAYERstruct uint8_t TeamColor; // used in team play and also used in regular mulit-play for show // palette fading up and down for player hit and get items - short FadeTics; // Tics between each fade cycle - short FadeAmt; // Current intensity of fade + int16_t FadeTics; // Tics between each fade cycle + int16_t FadeAmt; // Current intensity of fade bool NightVision; // Is player's night vision active? uint8_t StartColor; // Darkest color in color range being used //short electro[64]; bool IsAI; // Is this and AI character? - short fta,ftq; // First time active and first time quote, for talking in multiplayer games - short NumFootPrints; // Number of foot prints left to lay down + int16_t fta,ftq; // First time active and first time quote, for talking in multiplayer games + int16_t NumFootPrints; // Number of foot prints left to lay down uint8_t WpnUziType; // Toggle between single or double uzi's if you own 2. uint8_t WpnShotgunType; // Shotgun has normal or fully automatic fire uint8_t WpnShotgunAuto; // 50-0 automatic shotgun rounds @@ -903,10 +903,10 @@ struct PLAYERstruct bool InitingNuke; bool TestNukeInit; bool NukeInitialized; // Nuke already has counted down - short FistAng; // KungFu attack angle + int16_t FistAng; // KungFu attack angle uint8_t WpnKungFuMove; // KungFu special moves - short Reverb; // Player's current reverb setting - short Heads; // Number of Accursed Heads orbiting player + int16_t Reverb; // Player's current reverb setting + int16_t Heads; // Number of Accursed Heads orbiting player int PlayerVersion; char cookieQuote[256]; // Should be an FString but must be POD for now so that PLAYER remains POD. @@ -1010,10 +1010,10 @@ typedef struct STATEp *DeathFall; STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK]; - short CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK]; + int16_t CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK]; STATEp *Attack[MAX_ACTOR_ATTACK]; - short AttackPercent[MAX_ACTOR_ATTACK]; + int16_t AttackPercent[MAX_ACTOR_ATTACK]; STATEp *Special[2]; STATEp *Duck; @@ -1105,25 +1105,25 @@ struct USER int Tics; int oz; // serialized copy of sprite.oz - short RotNum; - short ID; + int16_t RotNum; + int16_t ID; // Health/Pain related - short Health; - short MaxHealth; + int16_t Health; + int16_t MaxHealth; - short LastDamage; // last damage amount taken - short PainThreshold; // amount of damage that can be taken before + int16_t LastDamage; // last damage amount taken + int16_t PainThreshold; // amount of damage that can be taken before // going into pain frames. // jump & fall - short jump_speed; - short jump_grav; + int16_t jump_speed; + int16_t jump_grav; // clipmove - short ceiling_dist; - short floor_dist; - short lo_step; + int16_t ceiling_dist; + int16_t floor_dist; + int16_t lo_step; int hiz,loz; int zclip; // z height to move up for clipmove int active_range; @@ -1132,7 +1132,7 @@ struct USER // if a player's sprite points to player structure PLAYERp PlayerP; - short Sibling; + int16_t Sibling; // @@ -1146,14 +1146,14 @@ struct USER // velocity int vel_tgt; - short vel_rate; + int16_t vel_rate; uint8_t speed; // Ordinal Speed Range 0-3 from slow to fast - short Counter; - short Counter2; - short Counter3; - short DamageTics; - short BladeDamageTics; + int16_t Counter; + int16_t Counter2; + int16_t Counter3; + int16_t DamageTics; + int16_t BladeDamageTics; unsigned int Radius; // for distance checking int OverlapZ; // for z overlap variable @@ -1165,38 +1165,35 @@ struct USER // scaling - short scale_speed; + int16_t scale_speed; unsigned short scale_value; - short scale_tgt; + int16_t scale_tgt; // zig zagging - short DistCheck; - //short ZigZagDist; - //short ZigZagAng; - //short ZigZagDir; + int16_t DistCheck; - short Dist; - short TargetDist; - short WaitTics; + int16_t Dist; + int16_t TargetDist; + int16_t WaitTics; // track - short track; - short point; - short track_dir; + int16_t track; + int16_t point; + int16_t track_dir; int track_vel; // sliding variables - slide backwards etc - short slide_ang; + int16_t slide_ang; int slide_vel; - short slide_dec; + int16_t slide_dec; - short motion_blur_dist; - short motion_blur_num; + int16_t motion_blur_dist; + int16_t motion_blur_num; - short wait_active_check; // for enemy checking of player - short inactive_time; // length of time actor has been unaware of his tgt + int16_t wait_active_check; // for enemy checking of player + int16_t inactive_time; // length of time actor has been unaware of his tgt int sx,sy,sz; - short sang; + int16_t sang; uint8_t spal; // save off default palette number Collision coll; // same thing broken up into useful components. @@ -1207,12 +1204,12 @@ struct USER int8_t LastWeaponNum; int8_t WeaponNum; - short bounce; // count bounces off wall for killing shrap stuff + int16_t bounce; // count bounces off wall for killing shrap stuff // !JIM! my extensions int ShellNum; // This is shell no. 0 to whatever // Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS) - short FlagOwner; // The spritenum of the original flag (abused to hell by other things) - short Vis; // Shading upgrade, for shooting, etc... + int16_t FlagOwner; // Not the spritenum of the original flag (abused to hell by other things) + int16_t Vis; // Shading upgrade, for shooting, etc... bool DidAlert; // Has actor done his alert noise before? int16_t oangdiff; // Used for interpolating sprite angles @@ -1224,7 +1221,7 @@ using USERp = USER*; struct USERSAVE { - short Health; + int16_t Health; int8_t WeaponNum; int8_t LastWeaponNum; @@ -1393,7 +1390,7 @@ enum typedef struct { - short high; + int16_t high; } RANGE,*RANGEp; @@ -1487,7 +1484,7 @@ enum ShrapType typedef struct TARGET_SORT { DSWActor* actor; - short dang; + int16_t dang; int dist; int weight; } *TARGET_SORTp; @@ -1510,9 +1507,9 @@ typedef enum DoorType DOOR_TYPE; typedef struct { DOOR_TYPE Type; - short Sector; - short Speed; - short TimeOut; + int Sector; + int16_t Speed; + int16_t TimeOut; } DOOR_AUTO_CLOSE, *DOOR_AUTO_CLOSEp; #define MAX_DOOR_AUTO_CLOSE 16 @@ -1520,13 +1517,14 @@ typedef struct typedef struct { int origx[17], origy[17]; - short sector, angopen, angclosed, angopendir, sang, anginc, wall[17]; + int sector; + int16_t angopen, angclosed, angopendir, sang, anginc, wall[17]; } SWING; typedef struct SINE_WAVE_FLOOR { - int floor_origz, ceiling_origz, range; - short sector, sintable_ndx, speed_shift; + int floor_origz, ceiling_origz, range, sector; + int16_t sintable_ndx, speed_shift; uint8_t flags; } *SINE_WAVE_FLOORp; @@ -1535,8 +1533,8 @@ extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21]; typedef struct SINE_WALL { - int orig_xy, range; - short wall, sintable_ndx, speed_shift, type; + int orig_xy, range, wall; + int16_t sintable_ndx, speed_shift, type; } *SINE_WALLp; #define MAX_SINE_WALL 10 @@ -1545,7 +1543,7 @@ extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS]; struct SPRING_BOARD { - short Sector, TimeOut; + int Sector, TimeOut; }; extern SPRING_BOARD SpringBoard[20]; @@ -1553,7 +1551,7 @@ extern SWING Rotate[17]; typedef struct { - short sector, speed; + int sector, speed; int xmid, ymid; } SPIN; @@ -1578,7 +1576,7 @@ enum typedef struct TRACK_POINT { int x,y,z; - short ang, tag_low, tag_high, filler; + int16_t ang, tag_low, tag_high, filler; } *TRACK_POINTp; typedef struct TRACK @@ -1672,12 +1670,12 @@ struct SECTOR_OBJECTstruct crush_z, op_main_sector, // main sector operational SO moves in - for speed purposes flags, - sector[MAX_SO_SECTOR]; // hold the sector numbers of the sector object - - short xorig[MAX_SO_POINTS], // save the original x & y location of each wall so it can be - yorig[MAX_SO_POINTS], // refreshed + sector[MAX_SO_SECTOR], // hold the sector numbers of the sector object sectnum, // current secnum of midpoint - mid_sector, // middle sector + mid_sector; // middle sector + + int16_t xorig[MAX_SO_POINTS], // save the original x & y location of each wall so it can be + yorig[MAX_SO_POINTS], // refreshed max_damage, // max damage ram_damage, // damage taken by ramming wait_tics, // @@ -1804,7 +1802,7 @@ int NewStateGroup(DSWActor* actor, STATEp SpriteGroup[]); void SectorMidPoint(short sectnum, int *xmid, int *ymid, int *zmid); USERp SpawnUser(DSWActor* actor, short id, STATEp state); -short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, short *track_point_num, short *track_dir); +short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int *track_point_num, int *track_dir); // Some sounds were checked by storing handles in static local variables. // Problems with this design: @@ -2053,7 +2051,7 @@ void computergetinput(int snum,InputPacket *syn); // jplayer.c void DrawOverlapRoom(int tx,int ty,int tz,fixed_t tq16ang,fixed_t tq16horiz,short tsectnum); // rooms.c void SetupMirrorTiles(void); // rooms.c -bool FAF_Sector(short sectnum); // rooms.c +bool FAF_Sector(int sectnum); // rooms.c int GetZadjustment(short sectnum,short hitag); // rooms.c void InitSetup(void); // setup.c diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index c651723bc..2fd47872f 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -1163,7 +1163,7 @@ pSwordBobSetup(PANEL_SPRITEp psp) void pSwordHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -1232,7 +1232,7 @@ pSwordAttack(PANEL_SPRITEp psp) void pSwordRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics * pspPresentRetractScale(picnum, 136); @@ -1461,7 +1461,7 @@ pLStarBobSetup(PANEL_SPRITEp psp) void pStarHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -1525,7 +1525,7 @@ pStarThrow(PANEL_SPRITEp psp) void pStarRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -2210,7 +2210,7 @@ pUziStartReload(PANEL_SPRITEp psp) void pUziHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -2368,7 +2368,7 @@ void pUziRetract(PANEL_SPRITEp psp) { // PANEL_SPRITEp sib = psp->sibling; - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -2760,7 +2760,7 @@ pShotgunRecoilUp(PANEL_SPRITEp psp) void pShotgunReloadDown(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -2878,7 +2878,7 @@ PANEL_STATE ps_ShotgunFlash[] = void pShotgunHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -3013,7 +3013,7 @@ pShotgunFire(PANEL_SPRITEp psp) void pShotgunRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -3280,7 +3280,7 @@ pRailBobSetup(PANEL_SPRITEp psp) void pRailHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -3383,7 +3383,7 @@ pRailFire(PANEL_SPRITEp psp) void pRailRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -3698,7 +3698,7 @@ pHotheadBobSetup(PANEL_SPRITEp psp) void pHotheadHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupx(); psp->x += 3 * synctics; @@ -3797,7 +3797,7 @@ pHotheadAttack(PANEL_SPRITEp psp) void pHotheadRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -4146,7 +4146,7 @@ pMicroBobSetup(PANEL_SPRITEp psp) void pMicroHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -4357,7 +4357,7 @@ pMicroFire(PANEL_SPRITEp psp) void pMicroRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -4563,7 +4563,7 @@ pHeartBobSetup(PANEL_SPRITEp psp) void pHeartHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -4667,7 +4667,7 @@ pHeartAttack(PANEL_SPRITEp psp) void pHeartRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -5010,7 +5010,7 @@ InitWeaponGrenade(PLAYERp pp) void pGrenadeRecoilDown(PANEL_SPRITEp psp) { -// short picnum = psp->picndx; +// int picnum = psp->picndx; psp->backupcoords(); @@ -5096,7 +5096,7 @@ pGrenadeBobSetup(PANEL_SPRITEp psp) void pGrenadeHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -5158,7 +5158,7 @@ pGrenadeFire(PANEL_SPRITEp psp) void pGrenadeRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -5346,7 +5346,7 @@ pMineBobSetup(PANEL_SPRITEp psp) void pMineHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -5405,7 +5405,7 @@ pMineThrow(PANEL_SPRITEp psp) void pMineRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -5636,7 +5636,7 @@ void ChopsSetRetract(PLAYERp pp) void pChopsRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 6 * synctics; @@ -6175,7 +6175,7 @@ pFistBobSetup(PANEL_SPRITEp psp) void pFistHide(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; @@ -6251,7 +6251,7 @@ pFistAttack(PANEL_SPRITEp psp) void pFistRetract(PANEL_SPRITEp psp) { - short picnum = psp->picndx; + int picnum = psp->picndx; psp->backupy(); psp->y += 3 * synctics; diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index fe3dd3e2b..5ab9ec96c 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -81,7 +81,7 @@ DSWActor* InsertActor(int sectnum, int stat) return pActor; } -bool FAF_Sector(short sectnum) +bool FAF_Sector(int sectnum) { SPRITEp sp; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 8e30aee50..85cf728ad 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -92,7 +92,6 @@ int DoSlidorInstantClose(DSWActor*); void InitWeaponRocket(PLAYERp); void InitWeaponUzi(PLAYERp); -bool FAF_Sector(short sectnum); int MoveSkip4, MoveSkip2, MoveSkip8; int MinEnemySkill; @@ -4809,8 +4808,7 @@ bool ActorDrop(DSWActor* actor, int x, int y, int z, short new_sector, short min } // Primarily used in ai.c for now - need to get rid of -bool -DropAhead(DSWActor* actor, short min_height) +bool DropAhead(DSWActor* actor, int min_height) { SPRITEp sp = &actor->s(); int dax, day; diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index b3a0f5c6c..53107deba 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -116,7 +116,7 @@ point to the sprite. */ -short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, short *track_point_num, short *track_dir) +short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int *track_point_num, int *track_dir) { USERp u = actor->u(); SPRITEp sp = &actor->s(); @@ -124,7 +124,7 @@ short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, short * int dist, near_dist = 999999, zdiff; int track_sect=0; - short i; + int i; short end_point[2] = {0,0}; TRACKp t, near_track = nullptr; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 917e2984c..8f2c2e64b 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -63,8 +63,6 @@ DAMAGE_DATA DamageData[] = }; #undef DAMAGE_TABLE -short ADJUST=120; - FOOT_TYPE FootMode=WATER_FOOT; bool left_foot = false; int FinishTimer = 0; @@ -72,18 +70,18 @@ int FinishTimer = 0; // This is how many bullet shells have been spawned since the beginning of the game. int ShellCount = 0; -//short Zombies = 0; -short StarQueueHead=0; +//int Zombies = 0; +int StarQueueHead=0; DSWActor* StarQueue[MAX_STAR_QUEUE]; -short HoleQueueHead=0; +int HoleQueueHead=0; DSWActor* HoleQueue[MAX_HOLE_QUEUE]; -short WallBloodQueueHead=0; +int WallBloodQueueHead=0; DSWActor* WallBloodQueue[MAX_WALLBLOOD_QUEUE]; -short FloorBloodQueueHead=0; +int FloorBloodQueueHead=0; DSWActor* FloorBloodQueue[MAX_FLOORBLOOD_QUEUE]; -short GenericQueueHead=0; +int GenericQueueHead=0; DSWActor* GenericQueue[MAX_GENERIC_QUEUE]; -short LoWangsQueueHead=0; +int LoWangsQueueHead=0; DSWActor* LoWangsQueue[MAX_LOWANGS_QUEUE]; void SpawnBreakStaticFlames(DSWActor* actor); diff --git a/source/games/sw/src/weapon.h b/source/games/sw/src/weapon.h index 77c2203f9..e1e83a34f 100644 --- a/source/games/sw/src/weapon.h +++ b/source/games/sw/src/weapon.h @@ -58,17 +58,17 @@ enum }; -extern short StarQueueHead; +extern int StarQueueHead; extern DSWActor* StarQueue[MAX_STAR_QUEUE]; -extern short HoleQueueHead; +extern int HoleQueueHead; extern DSWActor* HoleQueue[MAX_HOLE_QUEUE]; -extern short WallBloodQueueHead; +extern int WallBloodQueueHead; extern DSWActor* WallBloodQueue[MAX_WALLBLOOD_QUEUE]; -extern short FloorBloodQueueHead; +extern int FloorBloodQueueHead; extern DSWActor* FloorBloodQueue[MAX_FLOORBLOOD_QUEUE]; -extern short GenericQueueHead; +extern int GenericQueueHead; extern DSWActor* GenericQueue[MAX_GENERIC_QUEUE]; -extern short LoWangsQueueHead; +extern int LoWangsQueueHead; extern DSWActor* LoWangsQueue[MAX_LOWANGS_QUEUE]; void ChangeState(DSWActor* actor, STATEp statep); @@ -168,7 +168,7 @@ extern short target_ang; bool SpriteOverlap(short, short); DSWActor* SpawnShotgunSparks(PLAYERp pp, short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z, short hit_ang); -int DoActorBeginSlide(DSWActor* actor, short ang, short vel, short dec); +int DoActorBeginSlide(DSWActor* actor, int ang, int vel, int dec); int GetOverlapSector(int x, int y, short *over, short *under); bool MissileHitDiveArea(DSWActor*); diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 80ca5c968..9daff0a3b 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -40,7 +40,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -//extern short Zombies; #define ZOMBIE_TIME_LIMIT ((120*20)/ACTORMOVETICS) DECISION ZombieBattle[] =