- SW: first batch of short handling.

This commit is contained in:
Christoph Oelckers 2021-11-21 21:45:12 +01:00
parent e179b9332d
commit 4d7b45b68e
11 changed files with 171 additions and 204 deletions

View file

@ -308,7 +308,7 @@ void DoDebrisCurrent(DSWActor* actor)
// attempt to move away from wall // attempt to move away from wall
if (ret.type != kHitNone) 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), bcos(sectp->ang + rang), 14);
nx = MulScale((sectp->speed >> 2), bsin(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(); USERp u = actor->u();

View file

@ -41,17 +41,12 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
ANIMATOR InitActorRunToward; ANIMATOR InitActorRunToward;
bool FAF_Sector(short); bool FAF_Sector(int sectnum);
bool DropAhead(DSWActor* actor, short min_height); bool DropAhead(DSWActor* actor, int min_height);
ANIMATORp ChooseAction(DECISION decision[]); ANIMATORp ChooseAction(DECISION decision[]);
//static short ZigZagDeltaAng[] = {-200, 200};
// Choose between two things
short AttackOrRun = 200;
#define CHOOSE2(value) (RANDOM_P2(1024) < (value)) #define CHOOSE2(value) (RANDOM_P2(1024) < (value))
int Distance(int x1, int y1, int x2, int y2) 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[]) ANIMATORp ChooseAction(DECISION decision[])
{ {
short random_value;
short i;
// !JIM! Here is an opportunity for some AI, instead of randomness! // !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); ASSERT(i < 10);
@ -167,14 +159,11 @@ ANIMATORp ChooseAction(DECISION decision[])
!AIC - Sometimes just want the offset of the action !AIC - Sometimes just want the offset of the action
*/ */
short ChooseActionNumber(short decision[]) int ChooseActionNumber(int16_t decision[])
{ {
short random_value; int random_value = RANDOM_P2(1024<<5)>>5;
short i;
random_value = RANDOM_P2(1024<<5)>>5; for (int i = 0; true; i++)
for (i = 0; true; i++)
{ {
if (random_value <= decision[i]) if (random_value <= decision[i])
{ {
@ -259,7 +248,7 @@ int CanHitPlayer(DSWActor* actor)
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
HITINFO hitinfo; HITINFO hitinfo;
int xvect,yvect,zvect; int xvect,yvect,zvect;
short ang; int ang;
// if actor can still see the player // if actor can still see the player
int zhs, zhh; int zhs, zhh;
@ -314,7 +303,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
USERp u = actor->u(); USERp u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c; int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c;
short pnum; int pnum;
PLAYERp pp; PLAYERp pp;
// if actor can still see the player // if actor can still see the player
int look_height = SPRITEp_TOS(sp); int look_height = SPRITEp_TOS(sp);
@ -436,7 +425,7 @@ TARGETACTOR:
DSWActor* GetPlayerSpriteNum(DSWActor* actor) DSWActor* GetPlayerSpriteNum(DSWActor* actor)
{ {
USERp u = actor->u(); USERp u = actor->u();
short pnum; int pnum;
PLAYERp pp; PLAYERp pp;
TRAVERSE_CONNECT(pnum) TRAVERSE_CONNECT(pnum)
@ -1008,11 +997,12 @@ short FindTrackToPlayer(DSWActor* actor)
auto u = actor->u(); auto u = actor->u();
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
short point, track_dir, track; int point, track_dir, track;
short i, *type, size; int i, size;
const uint16_t* type;
int zdiff; int zdiff;
static short PlayerAbove[] = static const uint16_t PlayerAbove[] =
{ {
BIT(TT_LADDER), BIT(TT_LADDER),
BIT(TT_STAIRS), BIT(TT_STAIRS),
@ -1022,7 +1012,7 @@ short FindTrackToPlayer(DSWActor* actor)
BIT(TT_SCAN) BIT(TT_SCAN)
}; };
static short PlayerBelow[] = static const uint16_t PlayerBelow[] =
{ {
BIT(TT_JUMP_DOWN), BIT(TT_JUMP_DOWN),
BIT(TT_STAIRS), BIT(TT_STAIRS),
@ -1031,7 +1021,7 @@ short FindTrackToPlayer(DSWActor* actor)
BIT(TT_SCAN) BIT(TT_SCAN)
}; };
static short PlayerOnLevel[] = static const uint16_t PlayerOnLevel[] =
{ {
BIT(TT_DUCK_N_SHOOT), BIT(TT_DUCK_N_SHOOT),
BIT(TT_HIDE_N_SHOOT), BIT(TT_HIDE_N_SHOOT),
@ -1091,10 +1081,10 @@ short FindTrackToPlayer(DSWActor* actor)
short FindTrackAwayFromPlayer(DSWActor* actor) short FindTrackAwayFromPlayer(DSWActor* actor)
{ {
auto u = actor->u(); auto u = actor->u();
short point, track_dir, track; int point, track_dir, track;
unsigned int i; unsigned int i;
static short RunAwayTracks[] = static const int16_t RunAwayTracks[] =
{ {
BIT(TT_EXIT), BIT(TT_EXIT),
BIT(TT_LADDER), BIT(TT_LADDER),
@ -1136,10 +1126,10 @@ short FindTrackAwayFromPlayer(DSWActor* actor)
short FindWanderTrack(DSWActor* actor) short FindWanderTrack(DSWActor* actor)
{ {
auto u = actor->u(); auto u = actor->u();
short point, track_dir, track; int point, track_dir, track;
unsigned int i; unsigned int i;
static short WanderTracks[] = static const int16_t WanderTracks[] =
{ {
BIT(TT_DUCK_N_SHOOT), BIT(TT_DUCK_N_SHOOT),
BIT(TT_HIDE_N_SHOOT), BIT(TT_HIDE_N_SHOOT),
@ -1286,22 +1276,6 @@ int InitActorAttack(DSWActor* actor)
return 0; 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 // Hari Kari for Ninja's
if (u->ActorActionSet->Death2) if (u->ActorActionSet->Death2)
{ {

View file

@ -71,7 +71,7 @@ extern ATTRIBUTE DefaultAttrib;
// AI.C functions // AI.C functions
bool ActorMoveHitReact(DSWActor* actor); bool ActorMoveHitReact(DSWActor* actor);
short ChooseActionNumber(short decision[]); int ChooseActionNumber(int16_t decision[]);
bool CanSeePlayer(DSWActor* actor); bool CanSeePlayer(DSWActor* actor);
int DoActorPickClosePlayer(DSWActor* actor); int DoActorPickClosePlayer(DSWActor* actor);
int InitActorDecide(DSWActor* actor); int InitActorDecide(DSWActor* actor);

View file

@ -213,11 +213,11 @@ inline int32_t FIXED(int32_t msw, int32_t lsw)
#define SP_TAG10(sp) (LSB_VAR((sp)->owner)) #define SP_TAG10(sp) (LSB_VAR((sp)->owner))
#define SP_TAG11(sp) ((sp)->shade) #define SP_TAG11(sp) ((sp)->shade)
#define SP_TAG12(sp) ((sp)->pal) #define SP_TAG12(sp) ((sp)->pal)
#define SP_TAG13(sp) LittleShort(*((short*)&(sp)->xoffset)) #define SP_TAG13(sp) LittleShort(*((int16_t*)&(sp)->xoffset))
#define SP_TAG14(sp) LittleShort(*((short*)&(sp)->xrepeat)) #define SP_TAG14(sp) LittleShort(*((int16_t*)&(sp)->xrepeat))
#define SP_TAG15(sp) ((sp)->z) #define SP_TAG15(sp) ((sp)->z)
#define SET_SP_TAG13(sp,val) (*((short*)&(sp)->xoffset)) = LittleShort((short)val) #define SET_SP_TAG13(sp,val) (*((int16_t*)&(sp)->xoffset)) = LittleShort((int16_t)val)
#define SET_SP_TAG14(sp,val) (*((short*)&(sp)->xrepeat)) = LittleShort((short)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]) #define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1; i = connectpoint2[i])
@ -750,7 +750,7 @@ struct PLAYERstruct
int oposx, oposy, oposz; int oposx, oposy, oposz;
// holds last valid move position // holds last valid move position
short lv_sectnum; int lv_sectnum;
int lv_x,lv_y,lv_z; int lv_x,lv_y,lv_z;
REMOTE_CONTROL remote; REMOTE_CONTROL remote;
@ -758,7 +758,7 @@ struct PLAYERstruct
SECTOR_OBJECTp sop; // will either be sop_remote or sop_control SECTOR_OBJECTp sop; // will either be sop_remote or sop_control
int jump_count, jump_speed; // jumping 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 z_speed,oz_speed; // used for diving and flying instead of down_speed, up_speed
int climb_ndx; int climb_ndx;
int hiz,loz; int hiz,loz;
@ -768,19 +768,19 @@ struct PLAYERstruct
SPRITEp last_camera_sp; SPRITEp last_camera_sp;
int circle_camera_dist; int circle_camera_dist;
int six,siy,siz; // save player interp position for PlayerSprite int six,siy,siz; // save player interp position for PlayerSprite
short siang; int16_t siang;
int xvect, yvect; int xvect, yvect;
int oxvect, oyvect; int oxvect, oyvect;
int friction; int friction;
int slide_xvect, slide_yvect; int slide_xvect, slide_yvect;
short slide_ang; int16_t slide_ang;
int slide_dec; int slide_dec;
float drive_avel; float drive_avel;
short view_outside_dang; // outside view delta ang int16_t view_outside_dang; // outside view delta ang
short circle_camera_ang; int16_t circle_camera_ang;
short camera_check_time_delay; int16_t camera_check_time_delay;
int cursectnum,lastcursectnum; int cursectnum,lastcursectnum;
fixed_t turn180_target; // 180 degree turn fixed_t turn180_target; // 180 degree turn
@ -789,25 +789,25 @@ struct PLAYERstruct
int hvel,tilt,tilt_dest; int hvel,tilt,tilt_dest;
PlayerHorizon horizon; PlayerHorizon horizon;
PlayerAngle angle; PlayerAngle angle;
short recoil_amt; int16_t recoil_amt;
short recoil_speed; int16_t recoil_speed;
short recoil_ndx; int16_t recoil_ndx;
fixed_t recoil_ohorizoff, recoil_horizoff; fixed_t recoil_ohorizoff, recoil_horizoff;
int oldposx,oldposy,oldposz; int oldposx,oldposy,oldposz;
int RevolveX, RevolveY; int RevolveX, RevolveY;
short RevolveDeltaAng; int16_t RevolveDeltaAng;
binangle RevolveAng; 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 int lx,ly; // ladder x and y
short JumpDuration; int16_t JumpDuration;
short WadeDepth; int16_t WadeDepth;
short bob_amt; int16_t bob_amt;
short bob_ndx; int16_t bob_ndx;
short bcnt; // bob count int16_t bcnt; // bob count
int bob_z, obob_z; int bob_z, obob_z;
//Multiplayer variables //Multiplayer variables
@ -841,11 +841,11 @@ struct PLAYERstruct
uint8_t HasKey[8]; uint8_t HasKey[8];
// Weapon stuff // Weapon stuff
short SwordAng; int16_t SwordAng;
int WpnGotOnceFlags; // for no respawn mode where weapons are allowed grabbed only once int WpnGotOnceFlags; // for no respawn mode where weapons are allowed grabbed only once
int WpnFlags; int WpnFlags;
short WpnAmmo[MAX_WEAPONS]; int16_t WpnAmmo[MAX_WEAPONS];
short WpnNum; int16_t WpnNum;
PANEL_SPRITEp CurWpn; PANEL_SPRITEp CurWpn;
PANEL_SPRITEp Wpn[MAX_WEAPONS]; PANEL_SPRITEp Wpn[MAX_WEAPONS];
PANEL_SPRITEp Chops; PANEL_SPRITEp Chops;
@ -855,29 +855,29 @@ struct PLAYERstruct
uint8_t WpnFlameType; // Guardian weapons fire uint8_t WpnFlameType; // Guardian weapons fire
uint8_t WpnFirstType; // First weapon type - Sword/Shuriken uint8_t WpnFirstType; // First weapon type - Sword/Shuriken
uint8_t WeaponType; // for weapons with secondary functions 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 // Inventory Vars
// //
short InventoryNum; int16_t InventoryNum;
short InventoryBarTics; int16_t InventoryBarTics;
short InventoryTics[MAX_INVENTORY]; int16_t InventoryTics[MAX_INVENTORY];
short InventoryPercent[MAX_INVENTORY]; int16_t InventoryPercent[MAX_INVENTORY];
int8_t InventoryAmount[MAX_INVENTORY]; int8_t InventoryAmount[MAX_INVENTORY];
bool InventoryActive[MAX_INVENTORY]; bool InventoryActive[MAX_INVENTORY];
short DiveTics; int16_t DiveTics;
short DiveDamageTics; int16_t DiveDamageTics;
// Death stuff // Death stuff
uint16_t DeathType; uint16_t DeathType;
short Kills; int16_t Kills;
short KilledPlayer[MAX_SW_PLAYERS_REG]; int16_t KilledPlayer[MAX_SW_PLAYERS_REG];
short SecretsFound; int16_t SecretsFound;
// Health // Health
short Armor; int16_t Armor;
short MaxHealth; int16_t MaxHealth;
char PlayerName[32]; 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 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 // palette fading up and down for player hit and get items
short FadeTics; // Tics between each fade cycle int16_t FadeTics; // Tics between each fade cycle
short FadeAmt; // Current intensity of fade int16_t FadeAmt; // Current intensity of fade
bool NightVision; // Is player's night vision active? bool NightVision; // Is player's night vision active?
uint8_t StartColor; // Darkest color in color range being used uint8_t StartColor; // Darkest color in color range being used
//short electro[64]; //short electro[64];
bool IsAI; // Is this and AI character? bool IsAI; // Is this and AI character?
short fta,ftq; // First time active and first time quote, for talking in multiplayer games int16_t 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 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 WpnUziType; // Toggle between single or double uzi's if you own 2.
uint8_t WpnShotgunType; // Shotgun has normal or fully automatic fire uint8_t WpnShotgunType; // Shotgun has normal or fully automatic fire
uint8_t WpnShotgunAuto; // 50-0 automatic shotgun rounds uint8_t WpnShotgunAuto; // 50-0 automatic shotgun rounds
@ -903,10 +903,10 @@ struct PLAYERstruct
bool InitingNuke; bool InitingNuke;
bool TestNukeInit; bool TestNukeInit;
bool NukeInitialized; // Nuke already has counted down bool NukeInitialized; // Nuke already has counted down
short FistAng; // KungFu attack angle int16_t FistAng; // KungFu attack angle
uint8_t WpnKungFuMove; // KungFu special moves uint8_t WpnKungFuMove; // KungFu special moves
short Reverb; // Player's current reverb setting int16_t Reverb; // Player's current reverb setting
short Heads; // Number of Accursed Heads orbiting player int16_t Heads; // Number of Accursed Heads orbiting player
int PlayerVersion; int PlayerVersion;
char cookieQuote[256]; // Should be an FString but must be POD for now so that PLAYER remains POD. 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 *DeathFall;
STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK]; STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK];
short CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK]; int16_t CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK];
STATEp *Attack[MAX_ACTOR_ATTACK]; STATEp *Attack[MAX_ACTOR_ATTACK];
short AttackPercent[MAX_ACTOR_ATTACK]; int16_t AttackPercent[MAX_ACTOR_ATTACK];
STATEp *Special[2]; STATEp *Special[2];
STATEp *Duck; STATEp *Duck;
@ -1105,25 +1105,25 @@ struct USER
int Tics; int Tics;
int oz; // serialized copy of sprite.oz int oz; // serialized copy of sprite.oz
short RotNum; int16_t RotNum;
short ID; int16_t ID;
// Health/Pain related // Health/Pain related
short Health; int16_t Health;
short MaxHealth; int16_t MaxHealth;
short LastDamage; // last damage amount taken int16_t LastDamage; // last damage amount taken
short PainThreshold; // amount of damage that can be taken before int16_t PainThreshold; // amount of damage that can be taken before
// going into pain frames. // going into pain frames.
// jump & fall // jump & fall
short jump_speed; int16_t jump_speed;
short jump_grav; int16_t jump_grav;
// clipmove // clipmove
short ceiling_dist; int16_t ceiling_dist;
short floor_dist; int16_t floor_dist;
short lo_step; int16_t lo_step;
int hiz,loz; int hiz,loz;
int zclip; // z height to move up for clipmove int zclip; // z height to move up for clipmove
int active_range; int active_range;
@ -1132,7 +1132,7 @@ struct USER
// if a player's sprite points to player structure // if a player's sprite points to player structure
PLAYERp PlayerP; PLAYERp PlayerP;
short Sibling; int16_t Sibling;
// //
@ -1146,14 +1146,14 @@ struct USER
// velocity // velocity
int vel_tgt; int vel_tgt;
short vel_rate; int16_t vel_rate;
uint8_t speed; // Ordinal Speed Range 0-3 from slow to fast uint8_t speed; // Ordinal Speed Range 0-3 from slow to fast
short Counter; int16_t Counter;
short Counter2; int16_t Counter2;
short Counter3; int16_t Counter3;
short DamageTics; int16_t DamageTics;
short BladeDamageTics; int16_t BladeDamageTics;
unsigned int Radius; // for distance checking unsigned int Radius; // for distance checking
int OverlapZ; // for z overlap variable int OverlapZ; // for z overlap variable
@ -1165,38 +1165,35 @@ struct USER
// scaling // scaling
short scale_speed; int16_t scale_speed;
unsigned short scale_value; unsigned short scale_value;
short scale_tgt; int16_t scale_tgt;
// zig zagging // zig zagging
short DistCheck; int16_t DistCheck;
//short ZigZagDist;
//short ZigZagAng;
//short ZigZagDir;
short Dist; int16_t Dist;
short TargetDist; int16_t TargetDist;
short WaitTics; int16_t WaitTics;
// track // track
short track; int16_t track;
short point; int16_t point;
short track_dir; int16_t track_dir;
int track_vel; int track_vel;
// sliding variables - slide backwards etc // sliding variables - slide backwards etc
short slide_ang; int16_t slide_ang;
int slide_vel; int slide_vel;
short slide_dec; int16_t slide_dec;
short motion_blur_dist; int16_t motion_blur_dist;
short motion_blur_num; int16_t motion_blur_num;
short wait_active_check; // for enemy checking of player int16_t wait_active_check; // for enemy checking of player
short inactive_time; // length of time actor has been unaware of his tgt int16_t inactive_time; // length of time actor has been unaware of his tgt
int sx,sy,sz; int sx,sy,sz;
short sang; int16_t sang;
uint8_t spal; // save off default palette number uint8_t spal; // save off default palette number
Collision coll; // same thing broken up into useful components. Collision coll; // same thing broken up into useful components.
@ -1207,12 +1204,12 @@ struct USER
int8_t LastWeaponNum; int8_t LastWeaponNum;
int8_t WeaponNum; 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 // !JIM! my extensions
int ShellNum; // This is shell no. 0 to whatever int ShellNum; // This is shell no. 0 to whatever
// Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS) // Shell gets deleted when ShellNum < (ShellCount - MAXSHELLS)
short FlagOwner; // The spritenum of the original flag (abused to hell by other things) int16_t FlagOwner; // Not the spritenum of the original flag (abused to hell by other things)
short Vis; // Shading upgrade, for shooting, etc... int16_t Vis; // Shading upgrade, for shooting, etc...
bool DidAlert; // Has actor done his alert noise before? bool DidAlert; // Has actor done his alert noise before?
int16_t oangdiff; // Used for interpolating sprite angles int16_t oangdiff; // Used for interpolating sprite angles
@ -1224,7 +1221,7 @@ using USERp = USER*;
struct USERSAVE struct USERSAVE
{ {
short Health; int16_t Health;
int8_t WeaponNum; int8_t WeaponNum;
int8_t LastWeaponNum; int8_t LastWeaponNum;
@ -1393,7 +1390,7 @@ enum
typedef struct typedef struct
{ {
short high; int16_t high;
} RANGE,*RANGEp; } RANGE,*RANGEp;
@ -1487,7 +1484,7 @@ enum ShrapType
typedef struct TARGET_SORT typedef struct TARGET_SORT
{ {
DSWActor* actor; DSWActor* actor;
short dang; int16_t dang;
int dist; int dist;
int weight; int weight;
} *TARGET_SORTp; } *TARGET_SORTp;
@ -1510,9 +1507,9 @@ typedef enum DoorType DOOR_TYPE;
typedef struct typedef struct
{ {
DOOR_TYPE Type; DOOR_TYPE Type;
short Sector; int Sector;
short Speed; int16_t Speed;
short TimeOut; int16_t TimeOut;
} DOOR_AUTO_CLOSE, *DOOR_AUTO_CLOSEp; } DOOR_AUTO_CLOSE, *DOOR_AUTO_CLOSEp;
#define MAX_DOOR_AUTO_CLOSE 16 #define MAX_DOOR_AUTO_CLOSE 16
@ -1520,13 +1517,14 @@ typedef struct
typedef struct typedef struct
{ {
int origx[17], origy[17]; 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; } SWING;
typedef struct SINE_WAVE_FLOOR typedef struct SINE_WAVE_FLOOR
{ {
int floor_origz, ceiling_origz, range; int floor_origz, ceiling_origz, range, sector;
short sector, sintable_ndx, speed_shift; int16_t sintable_ndx, speed_shift;
uint8_t flags; uint8_t flags;
} *SINE_WAVE_FLOORp; } *SINE_WAVE_FLOORp;
@ -1535,8 +1533,8 @@ extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21];
typedef struct SINE_WALL typedef struct SINE_WALL
{ {
int orig_xy, range; int orig_xy, range, wall;
short wall, sintable_ndx, speed_shift, type; int16_t sintable_ndx, speed_shift, type;
} *SINE_WALLp; } *SINE_WALLp;
#define MAX_SINE_WALL 10 #define MAX_SINE_WALL 10
@ -1545,7 +1543,7 @@ extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS];
struct SPRING_BOARD struct SPRING_BOARD
{ {
short Sector, TimeOut; int Sector, TimeOut;
}; };
extern SPRING_BOARD SpringBoard[20]; extern SPRING_BOARD SpringBoard[20];
@ -1553,7 +1551,7 @@ extern SWING Rotate[17];
typedef struct typedef struct
{ {
short sector, speed; int sector, speed;
int xmid, ymid; int xmid, ymid;
} SPIN; } SPIN;
@ -1578,7 +1576,7 @@ enum
typedef struct TRACK_POINT typedef struct TRACK_POINT
{ {
int x,y,z; int x,y,z;
short ang, tag_low, tag_high, filler; int16_t ang, tag_low, tag_high, filler;
} *TRACK_POINTp; } *TRACK_POINTp;
typedef struct TRACK typedef struct TRACK
@ -1672,12 +1670,12 @@ struct SECTOR_OBJECTstruct
crush_z, crush_z,
op_main_sector, // main sector operational SO moves in - for speed purposes op_main_sector, // main sector operational SO moves in - for speed purposes
flags, flags,
sector[MAX_SO_SECTOR]; // hold the sector numbers of the sector object 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
sectnum, // current secnum of midpoint 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 max_damage, // max damage
ram_damage, // damage taken by ramming ram_damage, // damage taken by ramming
wait_tics, // wait_tics, //
@ -1804,7 +1802,7 @@ int NewStateGroup(DSWActor* actor, STATEp SpriteGroup[]);
void SectorMidPoint(short sectnum, int *xmid, int *ymid, int *zmid); void SectorMidPoint(short sectnum, int *xmid, int *ymid, int *zmid);
USERp SpawnUser(DSWActor* actor, short id, STATEp state); 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. // Some sounds were checked by storing handles in static local variables.
// Problems with this design: // 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 DrawOverlapRoom(int tx,int ty,int tz,fixed_t tq16ang,fixed_t tq16horiz,short tsectnum); // rooms.c
void SetupMirrorTiles(void); // 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 int GetZadjustment(short sectnum,short hitag); // rooms.c
void InitSetup(void); // setup.c void InitSetup(void); // setup.c

View file

@ -1163,7 +1163,7 @@ pSwordBobSetup(PANEL_SPRITEp psp)
void void
pSwordHide(PANEL_SPRITEp psp) pSwordHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -1232,7 +1232,7 @@ pSwordAttack(PANEL_SPRITEp psp)
void void
pSwordRetract(PANEL_SPRITEp psp) pSwordRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics * pspPresentRetractScale(picnum, 136); psp->y += 3 * synctics * pspPresentRetractScale(picnum, 136);
@ -1461,7 +1461,7 @@ pLStarBobSetup(PANEL_SPRITEp psp)
void void
pStarHide(PANEL_SPRITEp psp) pStarHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -1525,7 +1525,7 @@ pStarThrow(PANEL_SPRITEp psp)
void void
pStarRetract(PANEL_SPRITEp psp) pStarRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -2210,7 +2210,7 @@ pUziStartReload(PANEL_SPRITEp psp)
void void
pUziHide(PANEL_SPRITEp psp) pUziHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -2368,7 +2368,7 @@ void
pUziRetract(PANEL_SPRITEp psp) pUziRetract(PANEL_SPRITEp psp)
{ {
// PANEL_SPRITEp sib = psp->sibling; // PANEL_SPRITEp sib = psp->sibling;
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -2760,7 +2760,7 @@ pShotgunRecoilUp(PANEL_SPRITEp psp)
void void
pShotgunReloadDown(PANEL_SPRITEp psp) pShotgunReloadDown(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -2878,7 +2878,7 @@ PANEL_STATE ps_ShotgunFlash[] =
void void
pShotgunHide(PANEL_SPRITEp psp) pShotgunHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -3013,7 +3013,7 @@ pShotgunFire(PANEL_SPRITEp psp)
void void
pShotgunRetract(PANEL_SPRITEp psp) pShotgunRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -3280,7 +3280,7 @@ pRailBobSetup(PANEL_SPRITEp psp)
void void
pRailHide(PANEL_SPRITEp psp) pRailHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -3383,7 +3383,7 @@ pRailFire(PANEL_SPRITEp psp)
void void
pRailRetract(PANEL_SPRITEp psp) pRailRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -3698,7 +3698,7 @@ pHotheadBobSetup(PANEL_SPRITEp psp)
void void
pHotheadHide(PANEL_SPRITEp psp) pHotheadHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupx(); psp->backupx();
psp->x += 3 * synctics; psp->x += 3 * synctics;
@ -3797,7 +3797,7 @@ pHotheadAttack(PANEL_SPRITEp psp)
void void
pHotheadRetract(PANEL_SPRITEp psp) pHotheadRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -4146,7 +4146,7 @@ pMicroBobSetup(PANEL_SPRITEp psp)
void void
pMicroHide(PANEL_SPRITEp psp) pMicroHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -4357,7 +4357,7 @@ pMicroFire(PANEL_SPRITEp psp)
void void
pMicroRetract(PANEL_SPRITEp psp) pMicroRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -4563,7 +4563,7 @@ pHeartBobSetup(PANEL_SPRITEp psp)
void void
pHeartHide(PANEL_SPRITEp psp) pHeartHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -4667,7 +4667,7 @@ pHeartAttack(PANEL_SPRITEp psp)
void void
pHeartRetract(PANEL_SPRITEp psp) pHeartRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -5010,7 +5010,7 @@ InitWeaponGrenade(PLAYERp pp)
void void
pGrenadeRecoilDown(PANEL_SPRITEp psp) pGrenadeRecoilDown(PANEL_SPRITEp psp)
{ {
// short picnum = psp->picndx; // int picnum = psp->picndx;
psp->backupcoords(); psp->backupcoords();
@ -5096,7 +5096,7 @@ pGrenadeBobSetup(PANEL_SPRITEp psp)
void void
pGrenadeHide(PANEL_SPRITEp psp) pGrenadeHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -5158,7 +5158,7 @@ pGrenadeFire(PANEL_SPRITEp psp)
void void
pGrenadeRetract(PANEL_SPRITEp psp) pGrenadeRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -5346,7 +5346,7 @@ pMineBobSetup(PANEL_SPRITEp psp)
void void
pMineHide(PANEL_SPRITEp psp) pMineHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -5405,7 +5405,7 @@ pMineThrow(PANEL_SPRITEp psp)
void void
pMineRetract(PANEL_SPRITEp psp) pMineRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -5636,7 +5636,7 @@ void ChopsSetRetract(PLAYERp pp)
void void
pChopsRetract(PANEL_SPRITEp psp) pChopsRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 6 * synctics; psp->y += 6 * synctics;
@ -6175,7 +6175,7 @@ pFistBobSetup(PANEL_SPRITEp psp)
void void
pFistHide(PANEL_SPRITEp psp) pFistHide(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;
@ -6251,7 +6251,7 @@ pFistAttack(PANEL_SPRITEp psp)
void void
pFistRetract(PANEL_SPRITEp psp) pFistRetract(PANEL_SPRITEp psp)
{ {
short picnum = psp->picndx; int picnum = psp->picndx;
psp->backupy(); psp->backupy();
psp->y += 3 * synctics; psp->y += 3 * synctics;

View file

@ -81,7 +81,7 @@ DSWActor* InsertActor(int sectnum, int stat)
return pActor; return pActor;
} }
bool FAF_Sector(short sectnum) bool FAF_Sector(int sectnum)
{ {
SPRITEp sp; SPRITEp sp;

View file

@ -92,7 +92,6 @@ int DoSlidorInstantClose(DSWActor*);
void InitWeaponRocket(PLAYERp); void InitWeaponRocket(PLAYERp);
void InitWeaponUzi(PLAYERp); void InitWeaponUzi(PLAYERp);
bool FAF_Sector(short sectnum);
int MoveSkip4, MoveSkip2, MoveSkip8; int MoveSkip4, MoveSkip2, MoveSkip8;
int MinEnemySkill; 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 // Primarily used in ai.c for now - need to get rid of
bool bool DropAhead(DSWActor* actor, int min_height)
DropAhead(DSWActor* actor, short min_height)
{ {
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
int dax, day; int dax, day;

View file

@ -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(); USERp u = actor->u();
SPRITEp sp = &actor->s(); 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 dist, near_dist = 999999, zdiff;
int track_sect=0; int track_sect=0;
short i; int i;
short end_point[2] = {0,0}; short end_point[2] = {0,0};
TRACKp t, near_track = nullptr; TRACKp t, near_track = nullptr;

View file

@ -63,8 +63,6 @@ DAMAGE_DATA DamageData[] =
}; };
#undef DAMAGE_TABLE #undef DAMAGE_TABLE
short ADJUST=120;
FOOT_TYPE FootMode=WATER_FOOT; FOOT_TYPE FootMode=WATER_FOOT;
bool left_foot = false; bool left_foot = false;
int FinishTimer = 0; 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. // This is how many bullet shells have been spawned since the beginning of the game.
int ShellCount = 0; int ShellCount = 0;
//short Zombies = 0; //int Zombies = 0;
short StarQueueHead=0; int StarQueueHead=0;
DSWActor* StarQueue[MAX_STAR_QUEUE]; DSWActor* StarQueue[MAX_STAR_QUEUE];
short HoleQueueHead=0; int HoleQueueHead=0;
DSWActor* HoleQueue[MAX_HOLE_QUEUE]; DSWActor* HoleQueue[MAX_HOLE_QUEUE];
short WallBloodQueueHead=0; int WallBloodQueueHead=0;
DSWActor* WallBloodQueue[MAX_WALLBLOOD_QUEUE]; DSWActor* WallBloodQueue[MAX_WALLBLOOD_QUEUE];
short FloorBloodQueueHead=0; int FloorBloodQueueHead=0;
DSWActor* FloorBloodQueue[MAX_FLOORBLOOD_QUEUE]; DSWActor* FloorBloodQueue[MAX_FLOORBLOOD_QUEUE];
short GenericQueueHead=0; int GenericQueueHead=0;
DSWActor* GenericQueue[MAX_GENERIC_QUEUE]; DSWActor* GenericQueue[MAX_GENERIC_QUEUE];
short LoWangsQueueHead=0; int LoWangsQueueHead=0;
DSWActor* LoWangsQueue[MAX_LOWANGS_QUEUE]; DSWActor* LoWangsQueue[MAX_LOWANGS_QUEUE];
void SpawnBreakStaticFlames(DSWActor* actor); void SpawnBreakStaticFlames(DSWActor* actor);

View file

@ -58,17 +58,17 @@ enum
}; };
extern short StarQueueHead; extern int StarQueueHead;
extern DSWActor* StarQueue[MAX_STAR_QUEUE]; extern DSWActor* StarQueue[MAX_STAR_QUEUE];
extern short HoleQueueHead; extern int HoleQueueHead;
extern DSWActor* HoleQueue[MAX_HOLE_QUEUE]; extern DSWActor* HoleQueue[MAX_HOLE_QUEUE];
extern short WallBloodQueueHead; extern int WallBloodQueueHead;
extern DSWActor* WallBloodQueue[MAX_WALLBLOOD_QUEUE]; extern DSWActor* WallBloodQueue[MAX_WALLBLOOD_QUEUE];
extern short FloorBloodQueueHead; extern int FloorBloodQueueHead;
extern DSWActor* FloorBloodQueue[MAX_FLOORBLOOD_QUEUE]; extern DSWActor* FloorBloodQueue[MAX_FLOORBLOOD_QUEUE];
extern short GenericQueueHead; extern int GenericQueueHead;
extern DSWActor* GenericQueue[MAX_GENERIC_QUEUE]; extern DSWActor* GenericQueue[MAX_GENERIC_QUEUE];
extern short LoWangsQueueHead; extern int LoWangsQueueHead;
extern DSWActor* LoWangsQueue[MAX_LOWANGS_QUEUE]; extern DSWActor* LoWangsQueue[MAX_LOWANGS_QUEUE];
void ChangeState(DSWActor* actor, STATEp statep); void ChangeState(DSWActor* actor, STATEp statep);
@ -168,7 +168,7 @@ extern short target_ang;
bool SpriteOverlap(short, short); 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); 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); int GetOverlapSector(int x, int y, short *over, short *under);
bool MissileHitDiveArea(DSWActor*); bool MissileHitDiveArea(DSWActor*);

View file

@ -40,7 +40,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
//extern short Zombies;
#define ZOMBIE_TIME_LIMIT ((120*20)/ACTORMOVETICS) #define ZOMBIE_TIME_LIMIT ((120*20)/ACTORMOVETICS)
DECISION ZombieBattle[] = DECISION ZombieBattle[] =