- the rest of sector.cpp, except for the input function.

This commit is contained in:
Christoph Oelckers 2020-05-10 22:20:49 +02:00
parent 92f5236b24
commit 577a800843
17 changed files with 1036 additions and 822 deletions

View file

@ -895,7 +895,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int
void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite,
int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch,
int32_t (*blacklist_sprite_func)(int32_t)) ATTRIBUTE((nonnull(6,7,8)));
int32_t (*blacklist_sprite_func)(int32_t) = nullptr) ATTRIBUTE((nonnull(6,7,8)));
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
int32_t inside(int32_t x, int32_t y, int16_t sectnum);

View file

@ -282,10 +282,10 @@ inline void FTA(int q, DukePlayer_t* p)
P_DoQuote(q, p);
}
void P_SetGamePalette(DukePlayer_t* player, uint32_t palid, ESetPalFlags flags);
void G_OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum);
void G_OffMotorcycle(DukePlayer_t *pPlayer);
void G_OnBoat(DukePlayer_t *pPlayer, int spriteNum);
void G_OffBoat(DukePlayer_t *pPlayer);
void OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum);
void OffMotorcycle(DukePlayer_t *pPlayer);
void OnBoat(DukePlayer_t *pPlayer, int spriteNum);
void OffBoat(DukePlayer_t *pPlayer);
// Cstat protection mask for (currently) spawned MASKWALL* sprites.
// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in A_Spawn()?

View file

@ -92,7 +92,7 @@ G_EXTERN vec3_t mypos, omypos, myvel;
G_EXTERN fix16_t myhoriz, omyhoriz, myhorizoff, omyhorizoff, myang, omyang;
G_EXTERN int16_t mycursectnum, myjumpingcounter;
G_EXTERN uint8_t myjumpingtoggle, myonground, myhardlanding, myreturntocenter;
G_EXTERN int16_t my_moto_speed;
G_EXTERN int16_t my_MotoSpeed;
G_EXTERN uint8_t my_not_on_water, my_moto_on_ground;
G_EXTERN uint8_t my_moto_do_bump, my_moto_bump_fast, my_moto_on_oil, my_moto_on_mud;
G_EXTERN int16_t my_moto_bump, my_moto_bump_target, my_moto_turb;
@ -220,7 +220,7 @@ G_EXTERN int16_t g_fakeBubbaCnt, g_mamaSpawnCnt, g_banjoSong, g_bellTime, g_bell
#define BellTime g_bellTime
#define word_119BE0 g_bellSprite
G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS]; // move these back into the base structs!
G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, g_chickenWeaponTimer, g_RAendLevel, g_RAendEpisode, g_fogType;
G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, g_chickenWeaponTimer, RRRA_ExitedLevel, RRRA_EndEpisode, g_fogType;
G_EXTERN int32_t g_cdTrack;
#define raat607 enemysizecheat // only as a reminder
@ -366,12 +366,22 @@ inline bool isIn(int value, const std::initializer_list<int> &list)
}
// these are mainly here to avoid directly accessing the input data so that it can be more easily refactored later.
inline bool PlayerInput(int pl, int bit)
{
return TEST_SYNC_KEY(g_player[pl].input->bits, bit);
}
inline bool PlayerInputSideVel(int pl)
{
return g_player[pl].input->svel;
}
inline bool PlayerInputForwardVel(int pl)
{
return g_player[pl].input->fvel;
}
enum
{
kHitTypeMask = 0xC000,

View file

@ -250,7 +250,7 @@ typedef struct player_struct {
int16_t drink_amt, eat_amt, drink_ang, eat_ang;
int32_t drink_timer, eat_timer;
int16_t level_end_timer;
int16_t moto_speed, tilt_status, moto_drink;
int16_t MotoSpeed, tilt_status, moto_drink;
uint8_t OnMotorcycle, OnBoat, moto_underwater, not_on_water, moto_on_ground;
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
int16_t moto_bump, moto_bump_target, moto_turb;
@ -392,8 +392,10 @@ inline void SetPlayerPal(DukePlayer_t* pPlayer, PalEntry pe)
pPlayer->pals.b = pe.b;
}
int hitawall(DukePlayer_t* pPlayer, int* hitWall);
void P_AddKills(DukePlayer_t * pPlayer, uint16_t kills);
int32_t A_GetHitscanRange(int spriteNum);
inline int hits(int s) { return A_GetHitscanRange(s); }
void P_GetInput(int playerNum);
void P_GetInputMotorcycle(int playerNum);
void P_GetInputBoat(int playerNum);
@ -438,6 +440,7 @@ int P_GetKneePal(const DukePlayer_t *pPlayer, int hudPal);
int P_GetOverheadPal(const DukePlayer_t *pPlayer);
void P_MadeNoise(int playerNum);
int P_HasKey(int sectNum, int playerNum);
#define haskey P_HasKey
// Get the player index given an TILE_APLAYER sprite pointer.
static inline int P_GetP(const void *pSprite)

View file

@ -141,10 +141,10 @@ int getanimationgoal(const int32_t* animPtr);
bool isanearoperator(int lotag);
bool isanunderoperator(int lotag);
bool checkhitswitch(int playerNum, int wallOrSprite, int nSwitchType);
void P_CheckSectors(int playerNum);
void checksectors(int playerNum);
bool checkhitceiling(int sec);
int setanimation(short animsect, int* animptr, int thegoal, int thevel);
void G_DoFurniture(int wallNum, int sectNum, int playerNum);
void dofurniture(int wallNum, int sectNum, int playerNum);
void dotorch();
#define FORCEFIELD_CSTAT (64+16+4+1)

View file

@ -67,6 +67,8 @@ bool checkhitceiling_d(int sn);
bool checkhitceiling_r(int sn);
void checkhitsprite_d(int i, int sn);
void checkhitsprite_r(int i, int sn);
void checksectors_d(int snum);
void checksectors_r(int snum);
bool isadoorwall(int dapic)
{
@ -118,6 +120,12 @@ void checkhitsprite(int i, int sn)
if (isRR()) checkhitsprite_r(i, sn); else checkhitsprite_d(i, sn);
}
void checksectors(int low)
{
if (isRR()) checksectors_r(low); else checksectors_d(low);
}
//---------------------------------------------------------------------------
//
//

View file

@ -1455,6 +1455,344 @@ void checkhitsprite_d(int i, int sn)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void checksectors_d(int snum)
{
int i = -1, oldz;
struct player_struct* p;
int j, hitscanwall;
short neartagsector, neartagwall, neartagsprite;
int neartaghitdist;
p = &ps[snum];
switch (sector[p->cursectnum].lotag)
{
case 32767:
sector[p->cursectnum].lotag = 0;
FTA(9, p);
p->secret_rooms++;
return;
case -1:
for (i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
{
ud.level_number++;
if ((ud.volume_number && ud.level_number > 10) || ud.level_number > 5)
ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
return;
case -2:
sector[p->cursectnum].lotag = 0;
p->timebeforeexit = 26 * 8;
p->customexitsound = sector[p->cursectnum].hitag;
return;
default:
if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383)
{
if (snum == screenpeek || ud.coop == 1)
spritesound(sector[p->cursectnum].lotag - 10000, p->i);
sector[p->cursectnum].lotag = 0;
}
break;
}
//After this point the the player effects the map with space
if (p->gm & MODE_TYPE || sprite[p->i].extra <= 0) return;
if (ud.cashman && PlayerInput(snum, SK_OPEN))
lotsofmoney(&sprite[p->i], 2);
if (p->newowner >= 0)
{
if (abs(PlayerInputSideVel(snum)) > 768 || abs(PlayerInputForwardVel(snum)) > 768)
{
i = -1;
goto CLEARCAMERAS;
}
}
if (!(PlayerInput(snum, SK_OPEN)) && !PlayerInput(snum, SK_ESCAPE))
p->toggle_key_flag = 0;
else if (!p->toggle_key_flag)
{
if (PlayerInput(snum, SK_ESCAPE))
{
if (p->newowner >= 0)
{
i = -1;
goto CLEARCAMERAS;
}
return;
}
neartagsprite = -1;
p->toggle_key_flag = 1;
hitscanwall = -1;
i = hitawall(p, &hitscanwall);
if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
if (wall[hitscanwall].lotag > 0 && S_CheckSoundPlaying(wall[hitscanwall].lotag) == 0 && snum == screenpeek)
{
spritesound(wall[hitscanwall].lotag, p->i);
return;
}
if (hitscanwall >= 0 && (wall[hitscanwall].cstat & 16))
if (wall[hitscanwall].lotag)
return;
if (p->newowner >= 0)
neartag(p->oposx, p->oposy, p->oposz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else
{
neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (8 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
{
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite >= 0)
{
switch (sprite[neartagsprite].picnum)
{
case FEM1:
case FEM2:
case FEM3:
case FEM4:
case FEM5:
case FEM6:
case FEM7:
case FEM8:
case FEM9:
case FEM10:
case PODFEM1:
case NAKED1:
case STATUE:
case TOUGHGAL:
return;
}
}
neartagsprite = -1;
neartagwall = -1;
neartagsector = -1;
}
}
if (p->newowner == -1 && neartagsprite == -1 && neartagsector == -1 && neartagwall == -1)
if (isanunderoperator(sector[sprite[p->i].sectnum].lotag))
neartagsector = sprite[p->i].sectnum;
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384))
return;
if (neartagsprite == -1 && neartagwall == -1)
if (sector[p->cursectnum].lotag == 2)
{
oldz = hitasprite(p->i, &neartagsprite);
if (oldz > 1280) neartagsprite = -1;
}
if (neartagsprite >= 0)
{
if (checkhitswitch(snum, neartagsprite, 1)) return;
switch (sprite[neartagsprite].picnum)
{
case TOILET:
case STALL:
if (p->last_pissed_time == 0)
{
if (ud.lockout == 0) spritesound(DUKE_URINATE, p->i);
p->last_pissed_time = 26 * 220;
p->transporter_hold = 29 * 2;
if (p->holster_weapon == 0)
{
p->holster_weapon = 1;
p->weapon_pos = -1;
}
if (sprite[p->i].extra <= (p->max_player_health - (p->max_player_health / 10)))
{
sprite[p->i].extra += p->max_player_health / 10;
p->last_extra = sprite[p->i].extra;
}
else if (sprite[p->i].extra < p->max_player_health)
sprite[p->i].extra = p->max_player_health;
}
else if (S_CheckSoundPlaying(FLUSH_TOILET) == 0)
spritesound(FLUSH_TOILET, p->i);
return;
case NUKEBUTTON:
hitawall(p, &j);
if (j >= 0 && wall[j].overpicnum == 0)
if (hittype[neartagsprite].temp_data[0] == 0)
{
hittype[neartagsprite].temp_data[0] = 1;
sprite[neartagsprite].owner = p->i;
p->buttonpalette = sprite[neartagsprite].pal;
if (p->buttonpalette)
ud.secretlevel = sprite[neartagsprite].lotag;
else ud.secretlevel = 0;
}
return;
case WATERFOUNTAIN:
if (hittype[neartagsprite].temp_data[0] != 1)
{
hittype[neartagsprite].temp_data[0] = 1;
sprite[neartagsprite].owner = p->i;
if (sprite[p->i].extra < p->max_player_health)
{
sprite[p->i].extra++;
spritesound(DUKE_DRINKING, p->i);
}
}
return;
case PLUG:
spritesound(SHORT_CIRCUIT, p->i);
sprite[p->i].extra -= 2 + (krand() & 3);
SetPlayerPal(p, PalEntry(32, 48, 48, 64));
break;
case VIEWSCREEN:
case VIEWSCREEN2:
{
i = headspritestat[1];
while (i >= 0)
{
if (sprite[i].picnum == CAMERA1 && sprite[i].yvel == 0 && sprite[neartagsprite].hitag == sprite[i].lotag)
{
sprite[i].yvel = 1; //Using this camera
spritesound(MONITOR_ACTIVE, neartagsprite);
sprite[neartagsprite].owner = i;
sprite[neartagsprite].yvel = 1;
j = p->cursectnum;
p->cursectnum = sprite[i].sectnum;
setpal(p);
p->cursectnum = j;
// parallaxtype = 2;
p->newowner = i;
return;
}
i = nextspritestat[i];
}
}
CLEARCAMERAS:
if (i < 0)
{
p->posx = p->oposx;
p->posy = p->oposy;
p->posz = p->oposz;
p->q16ang = p->oq16ang;
p->newowner = -1;
updatesector(p->posx, p->posy, &p->cursectnum);
setpal(p);
i = headspritestat[1];
while (i >= 0)
{
if (sprite[i].picnum == CAMERA1) sprite[i].yvel = 0;
i = nextspritestat[i];
}
}
else if (p->newowner >= 0)
p->newowner = -1;
return;
}
}
if (!PlayerInput(snum, SK_OPEN)) return;
else if (p->newowner >= 0) { i = -1; goto CLEARCAMERAS; }
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1)
if (abs(hits(p->i)) < 512)
{
if ((krand() & 255) < 16)
spritesound(DUKE_SEARCH2, p->i);
else spritesound(DUKE_SEARCH, p->i);
return;
}
if (neartagwall >= 0)
{
if (wall[neartagwall].lotag > 0 && isadoorwall(wall[neartagwall].picnum))
{
if (hitscanwall == neartagwall || hitscanwall == -1)
checkhitswitch(snum, neartagwall, 0);
return;
}
else if (p->newowner >= 0)
{
i = -1;
goto CLEARCAMERAS;
}
}
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384) == 0 && isanearoperator(sector[neartagsector].lotag))
{
i = headspritesect[neartagsector];
while (i >= 0)
{
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH)
return;
i = nextspritesect[i];
}
operatesectors(neartagsector, p->i);
}
else if ((sector[sprite[p->i].sectnum].lotag & 16384) == 0)
{
if (isanunderoperator(sector[sprite[p->i].sectnum].lotag))
{
i = headspritesect[sprite[p->i].sectnum];
while (i >= 0)
{
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH) return;
i = nextspritesect[i];
}
operatesectors(sprite[p->i].sectnum, p->i);
}
else checkhitswitch(snum, neartagwall, 0);
}
}
}
END_DUKE_NS

View file

@ -685,7 +685,7 @@ bool checkhitswitch_r(int snum, int w, int switchtype)
{
// fixme: This needs to be taken from the level definitions.
if (isRRRA() && ud.level_number == 6 && ud.volume_number == 0)
g_RAendEpisode = 1; // hack to force advancing to episode 2.
RRRA_EndEpisode = 1; // hack to force advancing to episode 2.
ud.level_number = (++ud.level_number < MAXLEVELS) ? ud.level_number : 0;
ud.m_level_number = ud.level_number;
}
@ -1039,7 +1039,7 @@ void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith)
if (s->lotag == 6)
{
for (j = 0; j < 16; j++) RANDOMSCRAP(s, i);
g_spriteExtra[jj]++;
g_spriteExtra[jj]++; // TRANSITIONAL move to sprite or actor
if (g_spriteExtra[jj] == 25)
{
startwall = sector[s->sectnum].wallptr;
@ -2385,4 +2385,484 @@ void checkhitsprite_r(int i, int sn)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void checksectors_r(int snum)
{
int i = -1, oldz;
struct player_struct* p;
int hitscanwall;
short neartagsector, neartagwall, neartagsprite;
int neartaghitdist;
p = &ps[snum];
switch (sector[p->cursectnum].lotag)
{
case 32767:
sector[p->cursectnum].lotag = 0;
FTA(9, p);
p->secret_rooms++;
return;
case -1:
for (i = connecthead; i >= 0; i = connectpoint2[i])
ps[i].gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (!isRRRA() || !RRRA_ExitedLevel)
{
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
ud.m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
{
if (isRRRA() && ud.level_number == 6 && ud.volume_number == 0)
RRRA_EndEpisode = 1;
ud.level_number++;
if (ud.level_number > 6)
ud.level_number = 0;
ud.m_level_number = ud.level_number;
}
RRRA_ExitedLevel = 1;
}
return;
case -2:
sector[p->cursectnum].lotag = 0;
p->timebeforeexit = 26 * 8;
p->customexitsound = sector[p->cursectnum].hitag;
return;
default:
if (sector[p->cursectnum].lotag >= 10000)
{
if (snum == screenpeek || ud.coop == 1)
spritesound(sector[p->cursectnum].lotag - 10000, p->i);
sector[p->cursectnum].lotag = 0;
}
break;
}
//After this point the the player effects the map with space
if (p->gm & MODE_TYPE || sprite[p->i].extra <= 0) return;
if (ud.cashman && PlayerInput(snum, SK_OPEN))
lotsofmoney(&sprite[p->i], 2);
if (!(PlayerInput(snum, SK_OPEN)) && !PlayerInput(snum, SK_ESCAPE))
p->toggle_key_flag = 0;
else if (!p->toggle_key_flag)
{
neartagsprite = -1;
p->toggle_key_flag = 1;
hitscanwall = -1;
hitawall(p, &hitscanwall);
if (isRRRA())
{
if (hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR && snum == screenpeek)
if (numplayers == 1)
{
if (A_CheckSoundPlaying(p->i, 27) == 0 && A_CheckSoundPlaying(p->i, 28) == 0 && A_CheckSoundPlaying(p->i, 29) == 0
&& A_CheckSoundPlaying(p->i, 257) == 0 && A_CheckSoundPlaying(p->i, 258) == 0)
{
short snd = krand() % 5;
if (snd == 0)
spritesound(27, p->i);
else if (snd == 1)
spritesound(28, p->i);
else if (snd == 2)
spritesound(29, p->i);
else if (snd == 3)
spritesound(257, p->i);
else if (snd == 4)
spritesound(258, p->i);
}
return;
}
}
else
{
if (hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
if (wall[hitscanwall].lotag > 0 && A_CheckSoundPlaying(p->i, wall[hitscanwall].lotag) == 0 && snum == screenpeek)
{
spritesound(wall[hitscanwall].lotag, p->i);
return;
}
}
if (hitscanwall >= 0 && (wall[hitscanwall].cstat & 16))
if (wall[hitscanwall].lotag)
return;
if (isRRRA())
{
if (p->OnMotorcycle)
{
if (p->MotoSpeed < 20)
{
OffMotorcycle(p);
return;
}
return;
}
if (p->OnBoat)
{
if (p->MotoSpeed < 20)
{
OffBoat(p);
return;
}
return;
}
neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
}
if (p->newowner >= 0)
neartag(p->oposx, p->oposy, p->oposz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else
{
neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (8 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
{
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite >= 0)
{
switch (sprite[neartagsprite].picnum)
{
case FEM10:
case NAKED1:
case STATUE:
case TOUGHGAL:
return;
case COW:
g_spriteExtra[neartagsprite] = 1; // TRANSITIONAL move to sprite or actor
return;
}
}
neartagsprite = -1;
neartagwall = -1;
neartagsector = -1;
}
}
if (p->newowner == -1 && neartagsprite == -1 && neartagsector == -1 && neartagwall == -1)
if (isanunderoperator(sector[sprite[p->i].sectnum].lotag))
neartagsector = sprite[p->i].sectnum;
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384))
return;
if (neartagsprite == -1 && neartagwall == -1)
if (sector[p->cursectnum].lotag == 2)
{
oldz = hitasprite(p->i, &neartagsprite);
if (oldz > 1280) neartagsprite = -1;
}
if (neartagsprite >= 0)
{
if (checkhitswitch(snum, neartagsprite, 1)) return;
switch (sprite[neartagsprite].picnum)
{
case RRTILE8448:
if (!isRRRA()) return;
if (!A_CheckSoundPlaying(neartagsprite, 340))
A_PlaySound(340, neartagsprite);
return;
case RRTILE8704:
if (!isRRRA()) return;
if (numplayers == 1)
{
static bool alreadydone; // what is this supposed to do? Looks broken.
// This is from RedneckGDX - the version in RR Reconstruction looked like broken nonsense.
if (S_CheckSoundPlaying(neartagsprite, 445) || alreadydone != 0)
{
if (!S_CheckSoundPlaying(neartagsprite, 445) && !S_CheckSoundPlaying(neartagsprite, 446) && !S_CheckSoundPlaying(neartagsprite, 447) && alreadydone != 0)
{
if ((krand() % 2) == 1)
spritesound(446, neartagsprite);
else
spritesound(447, neartagsprite);
}
}
else
{
spritesound(445, neartagsprite);
alreadydone = 1;
}
}
return;
case EMPTYBIKE:
if (!isRRRA()) return;
OnMotorcycle(p, neartagsprite);
return;
case EMPTYBOAT:
if (!isRRRA()) return;
OnBoat(p, neartagsprite);
return;
case RRTILE8164:
case RRTILE8165:
case RRTILE8166:
case RRTILE8167:
case RRTILE8168:
case RRTILE8591:
case RRTILE8592:
case RRTILE8593:
case RRTILE8594:
case RRTILE8595:
if (!isRRRA()) return;
sprite[neartagsprite].extra = 60;
spritesound(235, neartagsprite);
return;
case TOILET:
case STALL:
case RRTILE2121:
case RRTILE2122:
if (p->last_pissed_time == 0)
{
if (ud.lockout == 0) spritesound(435, p->i);
p->last_pissed_time = 26 * 220;
p->transporter_hold = 29 * 2;
if (p->holster_weapon == 0)
{
p->holster_weapon = 1;
p->weapon_pos = -1;
}
if (sprite[p->i].extra <= (p->max_player_health - (p->max_player_health / 10)))
{
sprite[p->i].extra += p->max_player_health / 10;
p->last_extra = sprite[p->i].extra;
}
else if (sprite[p->i].extra < p->max_player_health)
sprite[p->i].extra = p->max_player_health;
}
else if (A_CheckSoundPlaying(p->i, DUKE_GRUNT) == 0)
spritesound(DUKE_GRUNT, p->i);
return;
case WATERFOUNTAIN:
if (hittype[neartagsprite].temp_data[0] != 1)
{
hittype[neartagsprite].temp_data[0] = 1;
sprite[neartagsprite].owner = p->i;
if (sprite[p->i].extra < p->max_player_health)
{
sprite[p->i].extra++;
spritesound(DUKE_DRINKING, p->i);
}
}
return;
case PLUG:
spritesound(SHORT_CIRCUIT, p->i);
sprite[p->i].extra -= 2 + (krand() & 3);
SetPlayerPal(p, PalEntry(32, 48, 48, 64));
break;
}
}
if (!PlayerInput(snum, SK_OPEN)) return;
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1)
if (abs(hits(p->i)) < 512)
{
if ((krand() & 255) < 16)
spritesound(DUKE_SEARCH2, p->i);
else spritesound(DUKE_SEARCH, p->i);
return;
}
if (neartagwall >= 0)
{
if (wall[neartagwall].lotag > 0 && isadoorwall(wall[neartagwall].picnum))
{
if (hitscanwall == neartagwall || hitscanwall == -1)
checkhitswitch(snum, neartagwall, 0);
return;
}
}
if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384) == 0 && isanearoperator(sector[neartagsector].lotag))
{
short unk = 0;
i = headspritesect[neartagsector];
while (i >= 0)
{
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH)
return;
i = nextspritesect[i];
}
if (haskey(neartagsector, snum))
operatesectors(neartagsector, p->i);
else
{
if (g_spriteExtra[neartagsprite] > 3) // TRANSITIONAL move to sprite or actor
spritesound(99, p->i);
else
spritesound(419, p->i);
FTA(41, p);
}
}
else if ((sector[sprite[p->i].sectnum].lotag & 16384) == 0)
{
if (isanunderoperator(sector[sprite[p->i].sectnum].lotag))
{
i = headspritesect[sprite[p->i].sectnum];
while (i >= 0)
{
if (sprite[i].picnum == ACTIVATOR || sprite[i].picnum == MASTERSWITCH) return;
i = nextspritesect[i];
}
if (haskey(neartagsector, snum))
operatesectors(sprite[p->i].sectnum, p->i);
else
{
if (g_spriteExtra[neartagsprite] > 3) // TRANSITIONAL move to sprite or actor
spritesound(99, p->i);
else
spritesound(419, p->i);
FTA(41, p);
}
}
else checkhitswitch(snum, neartagwall, 0);
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void dofurniture(int wl, int sect, int snum)
{
int startwall;
int endwall;
int i;
int var_C;
int x;
int y;
int min_x;
int min_y;
int max_x;
int max_y;
int ins;
int var_cx;
startwall = sector[wall[wl].nextsector].wallptr;;
endwall = startwall + sector[wall[wl].nextsector].wallnum;
var_C = 1;
max_x = max_y = -0x20000;
min_x = min_y = 0x20000;
var_cx = sector[sect].hitag;
if (var_cx > 16)
var_cx = 16;
else if (var_cx == 0)
var_cx = 4;
for (i = startwall; i < endwall; i++)
{
x = wall[i].x;
y = wall[i].y;
if (x > max_x)
max_x = x;
if (y > max_y)
max_y = y;
if (x < min_x)
min_x = x;
if (y < min_y)
min_y = y;
}
max_x += var_cx + 1;
max_y += var_cx + 1;
min_x -= var_cx + 1;
min_y -= var_cx + 1;
ins = inside(max_x, max_y, sect);
if (!ins)
var_C = 0;
ins = inside(max_x, min_y, sect);
if (!ins)
var_C = 0;
ins = inside(min_x, min_y, sect);
if (!ins)
var_C = 0;
ins = inside(min_x, max_y, sect);
if (!ins)
var_C = 0;
if (var_C)
{
if (A_CheckSoundPlaying(ps[snum].i, 389) == 0)
spritesound(389, ps[snum].i);
for (i = startwall; i < endwall; i++)
{
x = wall[i].x;
y = wall[i].y;
switch (wall[wl].lotag)
{
case 42:
y = wall[i].y + var_cx;
dragpoint(i, x, y);
break;
case 41:
x = wall[i].x - var_cx;
dragpoint(i, x, y);
break;
case 40:
y = wall[i].y - var_cx;
dragpoint(i, x, y);
break;
case 43:
x = wall[i].x + var_cx;
dragpoint(i, x, y);
break;
}
}
}
else
{
for (i = startwall; i < endwall; i++)
{
x = wall[i].x;
y = wall[i].y;
switch (wall[wl].lotag)
{
case 42:
y = wall[i].y - (var_cx - 2);
dragpoint(i, x, y);
break;
case 41:
x = wall[i].x + (var_cx - 2);
dragpoint(i, x, y);
break;
case 40:
y = wall[i].y + (var_cx - 2);
dragpoint(i, x, y);
break;
case 43:
x = wall[i].x - (var_cx - 2);
dragpoint(i, x, y);
break;
}
}
}
}
END_DUKE_NS

View file

@ -759,7 +759,7 @@ void G_DoCheats(void)
return;
case CHEAT_RAJOSEPH:
G_OnMotorcycle(pPlayer, 0);
OnMotorcycle(pPlayer, 0);
pPlayer->ammo_amount[MOTORCYCLE_WEAPON] = pPlayer->max_ammo_amount[MOTORCYCLE_WEAPON];
P_DoQuote(126, pPlayer);
end_cheat(pPlayer);
@ -884,7 +884,7 @@ void G_DoCheats(void)
case CHEAT_RAARIJIT:
case CHEAT_RADONUT:
G_OnBoat(pPlayer, 0);
OnBoat(pPlayer, 0);
pPlayer->ammo_amount[BOAT_WEAPON] = pPlayer->max_ammo_amount[BOAT_WEAPON];
P_DoQuote(136, pPlayer);
end_cheat(pPlayer);

View file

@ -212,7 +212,7 @@ int32_t A_CheckInventorySprite(spritetype *s)
}
}
void G_OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum)
void OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum)
{
if (!pPlayer->OnMotorcycle && !(sector[pPlayer->cursectnum].lotag == 2))
{
@ -237,7 +237,7 @@ void G_OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum)
A_PlaySound(186, pPlayer->i);
}
void G_OffMotorcycle(DukePlayer_t *pPlayer)
void OffMotorcycle(DukePlayer_t *pPlayer)
{
int j;
if (pPlayer->OnMotorcycle)
@ -258,7 +258,7 @@ void G_OffMotorcycle(DukePlayer_t *pPlayer)
P_CheckWeapon(pPlayer);
pPlayer->q16horiz = F16(100);
pPlayer->moto_do_bump = 0;
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed = 0;
pPlayer->tilt_status = 0;
pPlayer->moto_drink = 0;
pPlayer->moto_bump_target = 0;
@ -277,7 +277,7 @@ void G_OffMotorcycle(DukePlayer_t *pPlayer)
}
}
void G_OnBoat(DukePlayer_t *pPlayer, int spriteNum)
void OnBoat(DukePlayer_t *pPlayer, int spriteNum)
{
if (!pPlayer->OnBoat)
{
@ -300,7 +300,7 @@ void G_OnBoat(DukePlayer_t *pPlayer, int spriteNum)
}
}
void G_OffBoat(DukePlayer_t *pPlayer)
void OffBoat(DukePlayer_t *pPlayer)
{
int j;
if (pPlayer->OnBoat)
@ -311,7 +311,7 @@ void G_OffBoat(DukePlayer_t *pPlayer)
P_CheckWeapon(pPlayer);
pPlayer->q16horiz = F16(100);
pPlayer->moto_do_bump = 0;
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed = 0;
pPlayer->tilt_status = 0;
pPlayer->moto_drink = 0;
pPlayer->moto_bump_target = 0;
@ -7539,7 +7539,7 @@ int G_DoMoveThings(void)
{
P_ProcessInput(i);
if (!DEER)
P_CheckSectors(i);
checksectors(i);
}
}

View file

@ -2296,7 +2296,7 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
continue;
case CON_IFMOTOFAST:
VM_CONDITIONAL(pPlayer->moto_speed > 60);
VM_CONDITIONAL(pPlayer->MotoSpeed > 60);
continue;
case CON_IFONMOTO:

View file

@ -219,7 +219,7 @@ void Net_ResetPrediction(void)
myonground = g_player[myconnectindex].ps->on_ground;
myhardlanding = g_player[myconnectindex].ps->hard_landing;
myreturntocenter = g_player[myconnectindex].ps->return_to_center;
my_moto_speed = g_player[myconnectindex].ps->moto_speed;
my_MotoSpeed = g_player[myconnectindex].ps->MotoSpeed;
my_not_on_water = g_player[myconnectindex].ps->not_on_water;
my_moto_on_ground = g_player[myconnectindex].ps->moto_on_ground;
my_moto_do_bump = g_player[myconnectindex].ps->moto_do_bump;
@ -249,8 +249,8 @@ void Net_DoPrediction(void)
if (pPlayer->OnMotorcycle && pSprite->extra > 0)
{
int var64, var68, var6c, var74, var7c;
if (my_moto_speed < 0)
my_moto_speed = 0;
if (my_MotoSpeed < 0)
my_MotoSpeed = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH))
{
var64 = 1;
@ -295,52 +295,52 @@ void Net_DoPrediction(void)
}
if (myonground == 1)
{
if (var64 && my_moto_speed > 0)
if (var64 && my_MotoSpeed > 0)
{
if (my_moto_on_oil)
my_moto_speed -= 2;
my_MotoSpeed -= 2;
else
my_moto_speed -= 4;
if (my_moto_speed < 0)
my_moto_speed = 0;
my_MotoSpeed -= 4;
if (my_MotoSpeed < 0)
my_MotoSpeed = 0;
my_moto_bump_target = -30;
my_moto_do_bump = 1;
}
else if (var68 && !var64)
{
if (my_moto_speed < 40)
if (my_MotoSpeed < 40)
{
my_moto_bump_target = 70;
my_moto_bump_fast = 1;
}
my_moto_speed += 2;
if (my_moto_speed > 120)
my_moto_speed = 120;
my_MotoSpeed += 2;
if (my_MotoSpeed > 120)
my_MotoSpeed = 120;
if (!my_not_on_water)
if (my_moto_speed > 80)
my_moto_speed = 80;
if (my_MotoSpeed > 80)
my_MotoSpeed = 80;
}
else if (my_moto_speed > 0)
my_moto_speed--;
if (my_moto_do_bump && (!var64 || my_moto_speed == 0))
else if (my_MotoSpeed > 0)
my_MotoSpeed--;
if (my_moto_do_bump && (!var64 || my_MotoSpeed == 0))
{
my_moto_bump_target = 0;
my_moto_do_bump = 0;
}
if (var6c && my_moto_speed <= 0 && !var64)
if (var6c && my_MotoSpeed <= 0 && !var64)
{
int var88;
my_moto_speed = -15;
my_MotoSpeed = -15;
var88 = var7c;
var7c = var74;
var74 = var88;
}
}
if (my_moto_speed != 0 && myonground == 1)
if (my_MotoSpeed != 0 && myonground == 1)
{
if (!my_moto_bump)
if ((g_globalRandom&3) == 2)
my_moto_bump_target = (my_moto_speed>>4)*((randomseed&7)-4);
my_moto_bump_target = (my_MotoSpeed>>4)*((randomseed&7)-4);
}
if (my_moto_turb)
{
@ -380,10 +380,10 @@ void Net_DoPrediction(void)
{
my_moto_bump_fast = 0;
}
if (my_moto_speed >= 20 && myonground == 1 && (var74 || var7c))
if (my_MotoSpeed >= 20 && myonground == 1 && (var74 || var7c))
{
short var8c, var90, var94, var98;
var8c = my_moto_speed;
var8c = my_MotoSpeed;
var90 = fix16_to_int(myang);
if (var74)
var94 = -10;
@ -430,10 +430,10 @@ void Net_DoPrediction(void)
}
}
}
else if (my_moto_speed >= 20 && myonground == 1 && (my_moto_on_mud || my_moto_on_oil))
else if (my_MotoSpeed >= 20 && myonground == 1 && (my_moto_on_mud || my_moto_on_oil))
{
short var9c, vara0;
var9c = my_moto_speed;
var9c = my_MotoSpeed;
vara0 = fix16_to_int(myang);
if (my_moto_on_oil)
var9c *= 10;
@ -448,8 +448,8 @@ void Net_DoPrediction(void)
else if (pPlayer->OnBoat && pSprite->extra > 0)
{
int vara8, varac, varb0, varb4, varbc, varc4;
if (my_moto_speed < 0)
my_moto_speed = 0;
if (my_MotoSpeed < 0)
my_MotoSpeed = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && TEST_SYNC_KEY(playerBits, SK_JUMP))
{
vara8 = 1;
@ -504,63 +504,63 @@ void Net_DoPrediction(void)
{
if (vara8)
{
if (my_moto_speed <= 25)
if (my_MotoSpeed <= 25)
{
my_moto_speed++;
my_MotoSpeed++;
}
else
{
my_moto_speed -= 2;
if (my_moto_speed < 0)
my_moto_speed = 0;
my_MotoSpeed -= 2;
if (my_MotoSpeed < 0)
my_MotoSpeed = 0;
my_moto_bump_target = 30;
my_moto_do_bump = 1;
}
}
else if (varb0 && my_moto_speed > 0)
else if (varb0 && my_MotoSpeed > 0)
{
my_moto_speed -= 2;
if (my_moto_speed < 0)
my_moto_speed = 0;
my_MotoSpeed -= 2;
if (my_MotoSpeed < 0)
my_MotoSpeed = 0;
my_moto_bump_target = 30;
my_moto_do_bump = 1;
}
else if (varac)
{
if (my_moto_speed < 40)
if (my_MotoSpeed < 40)
if (!my_not_on_water)
{
my_moto_bump_target = -30;
my_moto_bump_fast = 1;
}
my_moto_speed++;
if (my_moto_speed > 120)
my_moto_speed = 120;
my_MotoSpeed++;
if (my_MotoSpeed > 120)
my_MotoSpeed = 120;
}
else if (my_moto_speed > 0)
my_moto_speed--;
if (my_moto_do_bump && (!varb0 || my_moto_speed == 0))
else if (my_MotoSpeed > 0)
my_MotoSpeed--;
if (my_moto_do_bump && (!varb0 || my_MotoSpeed == 0))
{
my_moto_bump_target = 0;
my_moto_do_bump = 0;
}
if (varb4 && my_moto_speed == 0 && !varb0)
if (varb4 && my_MotoSpeed == 0 && !varb0)
{
int vard0;
if (!my_not_on_water)
my_moto_speed = -25;
my_MotoSpeed = -25;
else
my_moto_speed = -20;
my_MotoSpeed = -20;
vard0 = varc4;
varc4 = varbc;
varbc = vard0;
}
}
if (my_moto_speed != 0 && myonground == 1)
if (my_MotoSpeed != 0 && myonground == 1)
{
if (!my_moto_bump)
if ((g_globalRandom & 15) == 14)
my_moto_bump_target = (my_moto_speed>>4)*((randomseed&3)-2);
my_moto_bump_target = (my_MotoSpeed>>4)*((randomseed&3)-2);
}
if (my_moto_turb)
{
@ -602,10 +602,10 @@ void Net_DoPrediction(void)
my_moto_bump_target = 0;
my_moto_bump_fast = 0;
}
if (my_moto_speed > 0 && myonground == 1 && (varbc || varc4))
if (my_MotoSpeed > 0 && myonground == 1 && (varbc || varc4))
{
short vard4, vard8, vardc, vare0;
vard4 = my_moto_speed;
vard4 = my_MotoSpeed;
vard8 = fix16_to_int(myang);
if (varbc)
vardc = -10;
@ -630,8 +630,8 @@ void Net_DoPrediction(void)
}
}
if (my_not_on_water)
if (my_moto_speed > 50)
my_moto_speed -= (my_moto_speed>>1);
if (my_MotoSpeed > 50)
my_MotoSpeed -= (my_MotoSpeed>>1);
}
}
@ -778,14 +778,14 @@ void Net_DoPrediction(void)
{
if (A_CheckEnemySprite(&sprite[spriteNum]))
{
my_moto_speed -= my_moto_speed >> 4;
my_MotoSpeed -= my_MotoSpeed >> 4;
}
}
if (pPlayer->OnBoat)
{
if (A_CheckEnemySprite(&sprite[spriteNum]))
{
my_moto_speed -= my_moto_speed >> 4;
my_MotoSpeed -= my_MotoSpeed >> 4;
}
}
else
@ -942,12 +942,12 @@ check_enemy_sprite:
{
my_moto_bump_target = 80;
my_moto_bump_fast = 1;
myvel.z -= g_spriteGravity*(my_moto_speed>>4);
myvel.z -= g_spriteGravity*(my_MotoSpeed>>4);
my_moto_on_ground = 0;
}
else
{
myvel.z += g_spriteGravity-80+(120-my_moto_speed);
myvel.z += g_spriteGravity-80+(120-my_MotoSpeed);
}
}
else
@ -1200,19 +1200,19 @@ FAKEHORIZONLY:;
var10c = klabs(fix16_to_int(myang)-var108);
if (var10c >= 441 && var10c <= 581)
{
my_moto_speed = 0;
my_MotoSpeed = 0;
}
else if (var10c >= 311 && var10c <= 711)
{
my_moto_speed -= (my_moto_speed>>1)+(my_moto_speed>>2);
my_MotoSpeed -= (my_MotoSpeed>>1)+(my_MotoSpeed>>2);
}
else if (var10c >= 111 && var10c <= 911)
{
my_moto_speed -= (my_moto_speed>>1);
my_MotoSpeed -= (my_MotoSpeed>>1);
}
else
{
my_moto_speed -= (my_moto_speed>>3);
my_MotoSpeed -= (my_MotoSpeed>>3);
}
}
else if (RRRA && pPlayer->OnBoat)
@ -1222,19 +1222,19 @@ FAKEHORIZONLY:;
var118 = klabs(fix16_to_int(myang)-var114);
if (var118 >= 441 && var118 <= 581)
{
my_moto_speed = ((my_moto_speed>>1)+(my_moto_speed>>2))>>2;
my_MotoSpeed = ((my_MotoSpeed>>1)+(my_MotoSpeed>>2))>>2;
}
else if (var118 >= 311 && var118 <= 711)
{
my_moto_speed -= ((my_moto_speed>>1)+(my_moto_speed>>2))>>3;
my_MotoSpeed -= ((my_MotoSpeed>>1)+(my_MotoSpeed>>2))>>3;
}
else if (var118 >= 111 && var118 <= 911)
{
my_moto_speed -= (my_moto_speed>>4);
my_MotoSpeed -= (my_MotoSpeed>>4);
}
else
{
my_moto_speed -= (my_moto_speed>>6);
my_MotoSpeed -= (my_MotoSpeed>>6);
}
}
}
@ -1246,7 +1246,7 @@ FAKEHORIZONLY:;
{
if (A_CheckEnemySprite(&sprite[spriteNum]) || sprite[spriteNum].picnum == TILE_APLAYER)
{
my_moto_speed -= my_moto_speed>>2;
my_MotoSpeed -= my_MotoSpeed>>2;
my_moto_turb = 6;
}
}
@ -1254,7 +1254,7 @@ FAKEHORIZONLY:;
{
if (A_CheckEnemySprite(&sprite[spriteNum]) || sprite[spriteNum].picnum == TILE_APLAYER)
{
my_moto_speed -= my_moto_speed>>2;
my_MotoSpeed -= my_MotoSpeed>>2;
my_moto_turb = 6;
}
}
@ -1350,7 +1350,7 @@ void Net_CorrectPrediction(void)
myonground = p->on_ground;
myhardlanding = p->hard_landing;
myreturntocenter = p->return_to_center;
my_moto_speed = p->moto_speed;
my_MotoSpeed = p->MotoSpeed;
my_not_on_water = p->not_on_water;
my_moto_on_ground = p->moto_on_ground;
my_moto_do_bump = p->moto_do_bump;

View file

@ -3675,9 +3675,9 @@ void P_GetInputMotorcycle(int playerNum)
static int32_t lastInputClock; // MED
int32_t const elapsedTics = (int32_t)totalclock - lastInputClock;
int const moveBack = buttonMap.ButtonDown(gamefunc_Move_Backward) && pPlayer->moto_speed <= 0;
int const moveBack = buttonMap.ButtonDown(gamefunc_Move_Backward) && pPlayer->MotoSpeed <= 0;
if (pPlayer->moto_speed == 0 || !pPlayer->on_ground)
if (pPlayer->MotoSpeed == 0 || !pPlayer->on_ground)
{
if (turnLeft)
{
@ -3700,7 +3700,7 @@ void P_GetInputMotorcycle(int playerNum)
pPlayer->tilt_status--;
if (pPlayer->tilt_status < -10)
pPlayer->tilt_status = -10;
if (turnHeldTime >= TURBOTURNTIME && pPlayer->moto_speed > 0)
if (turnHeldTime >= TURBOTURNTIME && pPlayer->MotoSpeed > 0)
{
if (moveBack)
input.q16avel = fix16_sadd(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
@ -3721,7 +3721,7 @@ void P_GetInputMotorcycle(int playerNum)
pPlayer->tilt_status++;
if (pPlayer->tilt_status > 10)
pPlayer->tilt_status = 10;
if (turnHeldTime >= TURBOTURNTIME && pPlayer->moto_speed > 0)
if (turnHeldTime >= TURBOTURNTIME && pPlayer->MotoSpeed > 0)
{
if (moveBack)
input.q16avel = fix16_ssub(input.q16avel, fix16_from_dbl(scaleAdjustmentToInterval(turnAmount)));
@ -3749,7 +3749,7 @@ void P_GetInputMotorcycle(int playerNum)
if (pPlayer->moto_underwater)
{
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed = 0;
}
else
{
@ -3761,7 +3761,7 @@ void P_GetInputMotorcycle(int playerNum)
input.q16avel = fix16_mul(input.q16avel, avelScale);
localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel);
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
localInput.fvel = clamp((input.fvel += pPlayer->moto_speed), -(MAXVELMOTO / 8), MAXVELMOTO);
localInput.fvel = clamp((input.fvel += pPlayer->MotoSpeed), -(MAXVELMOTO / 8), MAXVELMOTO);
if (TEST_SYNC_KEY(localInput.bits, SK_JUMP))
{
@ -3885,7 +3885,7 @@ void P_GetInputBoat(int playerNum)
static int32_t lastInputClock; // MED
int32_t const elapsedTics = (int32_t)totalclock - lastInputClock;
if (pPlayer->moto_speed != 0)
if (pPlayer->MotoSpeed != 0)
{
if (turnLeft || pPlayer->moto_drink < 0)
{
@ -3948,7 +3948,7 @@ void P_GetInputBoat(int playerNum)
input.q16avel = fix16_mul(input.q16avel, avelScale);
localInput.q16avel = fix16_sadd(localInput.q16avel, input.q16avel);
pPlayer->q16ang = fix16_sadd(pPlayer->q16ang, input.q16avel) & 0x7FFFFFF;
localInput.fvel = clamp((input.fvel += pPlayer->moto_speed), -(MAXVELMOTO / 8), MAXVELMOTO);
localInput.fvel = clamp((input.fvel += pPlayer->MotoSpeed), -(MAXVELMOTO / 8), MAXVELMOTO);
}
int dword_A99D4, dword_A99D8, dword_A99DC, dword_A99E0;
@ -4608,7 +4608,7 @@ void P_DropWeapon(int const playerNum)
pPlayer->gotweapon.Clear(MOTORCYCLE_WEAPON);
pPlayer->q16horiz = F16(100);
pPlayer->moto_do_bump = 0;
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed = 0;
pPlayer->tilt_status = 0;
pPlayer->moto_drink = 0;
pPlayer->moto_bump_target = 0;
@ -4624,7 +4624,7 @@ void P_DropWeapon(int const playerNum)
pPlayer->gotweapon.Clear(BOAT_WEAPON);
pPlayer->q16horiz = F16(100);
pPlayer->moto_do_bump = 0;
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed = 0;
pPlayer->tilt_status = 0;
pPlayer->moto_drink = 0;
pPlayer->moto_bump_target = 0;
@ -5699,7 +5699,7 @@ static void P_ProcessWeapon(int playerNum)
if (!RRRA) break;
if (*weaponFrame == 3)
{
pPlayer->moto_speed -= 20;
pPlayer->MotoSpeed -= 20;
pPlayer->ammo_amount[BOAT_WEAPON]--;
A_Shoot(pPlayer->i, TILE_RRTILE1790);
}
@ -6806,8 +6806,8 @@ void P_ProcessInput(int playerNum)
{
int var64, var68, var6c, var74, var7c;
int16_t var84;
if (pPlayer->moto_speed < 0)
pPlayer->moto_speed = 0;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH))
{
var64 = 1;
@ -6822,18 +6822,18 @@ void P_ProcessInput(int playerNum)
playerBits &= ~(1<< SK_JUMP);
if (pPlayer->on_ground)
{
if (pPlayer->moto_speed == 0 && var64)
if (pPlayer->MotoSpeed == 0 && var64)
{
if (!A_CheckSoundPlaying(pPlayer->i, 187))
A_PlaySound(187,pPlayer->i);
}
else if (pPlayer->moto_speed == 0 && !A_CheckSoundPlaying(pPlayer->i, 214))
else if (pPlayer->MotoSpeed == 0 && !A_CheckSoundPlaying(pPlayer->i, 214))
{
if (A_CheckSoundPlaying(pPlayer->i, 187))
S_StopEnvSound(187, pPlayer->i);
A_PlaySound(214,pPlayer->i);
}
else if (pPlayer->moto_speed >= 50 && !A_CheckSoundPlaying(pPlayer->i, 188))
else if (pPlayer->MotoSpeed >= 50 && !A_CheckSoundPlaying(pPlayer->i, 188))
{
A_PlaySound(188,pPlayer->i);
}
@ -6904,52 +6904,52 @@ void P_ProcessInput(int playerNum)
}
if (pPlayer->on_ground == 1)
{
if (var64 && pPlayer->moto_speed > 0)
if (var64 && pPlayer->MotoSpeed > 0)
{
if (pPlayer->moto_on_oil)
pPlayer->moto_speed -= 2;
pPlayer->MotoSpeed -= 2;
else
pPlayer->moto_speed -= 4;
if (pPlayer->moto_speed < 0)
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed -= 4;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
pPlayer->moto_bump_target = -30;
pPlayer->moto_do_bump = 1;
}
else if (var68 && !var64)
{
if (pPlayer->moto_speed < 40)
if (pPlayer->MotoSpeed < 40)
{
pPlayer->moto_bump_target = 70;
pPlayer->moto_bump_fast = 1;
}
pPlayer->moto_speed += 2;
if (pPlayer->moto_speed > 120)
pPlayer->moto_speed = 120;
pPlayer->MotoSpeed += 2;
if (pPlayer->MotoSpeed > 120)
pPlayer->MotoSpeed = 120;
if (!pPlayer->not_on_water)
if (pPlayer->moto_speed > 80)
pPlayer->moto_speed = 80;
if (pPlayer->MotoSpeed > 80)
pPlayer->MotoSpeed = 80;
}
else if (pPlayer->moto_speed > 0)
pPlayer->moto_speed--;
if (pPlayer->moto_do_bump && (!var64 || pPlayer->moto_speed == 0))
else if (pPlayer->MotoSpeed > 0)
pPlayer->MotoSpeed--;
if (pPlayer->moto_do_bump && (!var64 || pPlayer->MotoSpeed == 0))
{
pPlayer->moto_bump_target = 0;
pPlayer->moto_do_bump = 0;
}
if (var6c && pPlayer->moto_speed <= 0 && !var64)
if (var6c && pPlayer->MotoSpeed <= 0 && !var64)
{
int var88;
pPlayer->moto_speed = -15;
pPlayer->MotoSpeed = -15;
var88 = var7c;
var7c = var74;
var74 = var88;
}
}
if (pPlayer->moto_speed != 0 && pPlayer->on_ground == 1)
if (pPlayer->MotoSpeed != 0 && pPlayer->on_ground == 1)
{
if (!pPlayer->moto_bump)
if ((krand2() & 3) == 2)
pPlayer->moto_bump_target = (pPlayer->moto_speed>>4)*((krand2()&7)-4);
pPlayer->moto_bump_target = (pPlayer->MotoSpeed>>4)*((krand2()&7)-4);
if (var74 || pPlayer->moto_drink < 0)
{
if (pPlayer->moto_drink < 0)
@ -7002,10 +7002,10 @@ void P_ProcessInput(int playerNum)
pPlayer->moto_bump_target = 0;
pPlayer->moto_bump_fast = 0;
}
if (pPlayer->moto_speed >= 20 && pPlayer->on_ground == 1 && (var74 || var7c))
if (pPlayer->MotoSpeed >= 20 && pPlayer->on_ground == 1 && (var74 || var7c))
{
short var8c, var90, var94, var98;
var8c = pPlayer->moto_speed;
var8c = pPlayer->MotoSpeed;
var90 = fix16_to_int(pPlayer->q16ang);
if (var74)
var94 = -10;
@ -7054,10 +7054,10 @@ void P_ProcessInput(int playerNum)
}
}
}
else if (pPlayer->moto_speed >= 20 && pPlayer->on_ground == 1 && (pPlayer->moto_on_mud || pPlayer->moto_on_oil))
else if (pPlayer->MotoSpeed >= 20 && pPlayer->on_ground == 1 && (pPlayer->moto_on_mud || pPlayer->moto_on_oil))
{
short var9c, vara0, vara4 = 0;
var9c = pPlayer->moto_speed;
var9c = pPlayer->MotoSpeed;
vara0 = fix16_to_int(pPlayer->q16ang);
var84 = krand2()&1;
if (var84 == 0)
@ -7080,7 +7080,7 @@ void P_ProcessInput(int playerNum)
int16_t varcc;
if (pPlayer->not_on_water)
{
if (pPlayer->moto_speed > 0)
if (pPlayer->MotoSpeed > 0)
{
if (!A_CheckSoundPlaying(pPlayer->i, 88))
A_PlaySound(88,pPlayer->i);
@ -7091,8 +7091,8 @@ void P_ProcessInput(int playerNum)
A_PlaySound(87,pPlayer->i);
}
}
if (pPlayer->moto_speed < 0)
pPlayer->moto_speed = 0;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) && TEST_SYNC_KEY(playerBits, SK_JUMP))
{
vara8 = 1;
@ -7107,13 +7107,13 @@ void P_ProcessInput(int playerNum)
{
varac = 1;
playerBits &= ~(1<<SK_JUMP);
if (pPlayer->moto_speed == 0 && !A_CheckSoundPlaying(pPlayer->i, 89))
if (pPlayer->MotoSpeed == 0 && !A_CheckSoundPlaying(pPlayer->i, 89))
{
if (A_CheckSoundPlaying(pPlayer->i, 87))
S_StopEnvSound(pPlayer->i, 87);
A_PlaySound(89,pPlayer->i);
}
else if (pPlayer->moto_speed >= 50 && !A_CheckSoundPlaying(pPlayer->i, 88))
else if (pPlayer->MotoSpeed >= 50 && !A_CheckSoundPlaying(pPlayer->i, 88))
A_PlaySound(88,pPlayer->i);
else if (!A_CheckSoundPlaying(pPlayer->i, 88) && !A_CheckSoundPlaying(pPlayer->i, 89))
A_PlaySound(88,pPlayer->i);
@ -7153,7 +7153,7 @@ void P_ProcessInput(int playerNum)
{
varbc = 1;
playerBits &= ~(1<<SK_AIM_DOWN);
if (!A_CheckSoundPlaying(pPlayer->i, 91) && pPlayer->moto_speed > 30 && !pPlayer->not_on_water)
if (!A_CheckSoundPlaying(pPlayer->i, 91) && pPlayer->MotoSpeed > 30 && !pPlayer->not_on_water)
A_PlaySound(91,pPlayer->i);
}
else
@ -7164,7 +7164,7 @@ void P_ProcessInput(int playerNum)
{
varc4 = 1;
playerBits &= ~(1<< SK_LOOK_LEFT);
if (!A_CheckSoundPlaying(pPlayer->i, 91) && pPlayer->moto_speed > 30 && !pPlayer->not_on_water)
if (!A_CheckSoundPlaying(pPlayer->i, 91) && pPlayer->MotoSpeed > 30 && !pPlayer->not_on_water)
A_PlaySound(91,pPlayer->i);
}
else
@ -7194,65 +7194,65 @@ void P_ProcessInput(int playerNum)
{
if (vara8)
{
if (pPlayer->moto_speed <= 25)
if (pPlayer->MotoSpeed <= 25)
{
pPlayer->moto_speed++;
pPlayer->MotoSpeed++;
if (!A_CheckSoundPlaying(pPlayer->i, 182))
A_PlaySound(182, pPlayer->i);
}
else
{
pPlayer->moto_speed -= 2;
if (pPlayer->moto_speed < 0)
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed -= 2;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
pPlayer->moto_bump_target = 30;
pPlayer->moto_do_bump = 1;
}
}
else if (varb0 && pPlayer->moto_speed > 0)
else if (varb0 && pPlayer->MotoSpeed > 0)
{
pPlayer->moto_speed -= 2;
if (pPlayer->moto_speed < 0)
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed -= 2;
if (pPlayer->MotoSpeed < 0)
pPlayer->MotoSpeed = 0;
pPlayer->moto_bump_target = 30;
pPlayer->moto_do_bump = 1;
}
else if (varac)
{
if (pPlayer->moto_speed < 40)
if (pPlayer->MotoSpeed < 40)
if (!pPlayer->not_on_water)
{
pPlayer->moto_bump_target = -30;
pPlayer->moto_bump_fast = 1;
}
pPlayer->moto_speed++;
if (pPlayer->moto_speed > 120)
pPlayer->moto_speed = 120;
pPlayer->MotoSpeed++;
if (pPlayer->MotoSpeed > 120)
pPlayer->MotoSpeed = 120;
}
else if (pPlayer->moto_speed > 0)
pPlayer->moto_speed--;
if (pPlayer->moto_do_bump && (!varb0 || pPlayer->moto_speed == 0))
else if (pPlayer->MotoSpeed > 0)
pPlayer->MotoSpeed--;
if (pPlayer->moto_do_bump && (!varb0 || pPlayer->MotoSpeed == 0))
{
pPlayer->moto_bump_target = 0;
pPlayer->moto_do_bump = 0;
}
if (varb4 && pPlayer->moto_speed == 0 && !varb0)
if (varb4 && pPlayer->MotoSpeed == 0 && !varb0)
{
int vard0;
if (!pPlayer->not_on_water)
pPlayer->moto_speed = -25;
pPlayer->MotoSpeed = -25;
else
pPlayer->moto_speed = -20;
pPlayer->MotoSpeed = -20;
vard0 = varc4;
varc4 = varbc;
varbc = vard0;
}
}
if (pPlayer->moto_speed != 0 && pPlayer->on_ground == 1)
if (pPlayer->MotoSpeed != 0 && pPlayer->on_ground == 1)
{
if (!pPlayer->moto_bump)
if ((krand2() & 15) == 14)
pPlayer->moto_bump_target = (pPlayer->moto_speed>>4)*((krand2()&3)-2);
pPlayer->moto_bump_target = (pPlayer->MotoSpeed>>4)*((krand2()&3)-2);
if (varbc || pPlayer->moto_drink < 0)
{
if (pPlayer->moto_drink < 0)
@ -7305,10 +7305,10 @@ void P_ProcessInput(int playerNum)
pPlayer->moto_bump_target = 0;
pPlayer->moto_bump_fast = 0;
}
if (pPlayer->moto_speed > 0 && pPlayer->on_ground == 1 && (varbc || varc4))
if (pPlayer->MotoSpeed > 0 && pPlayer->on_ground == 1 && (varbc || varc4))
{
short vard4, vard8, vardc, vare0;
vard4 = pPlayer->moto_speed;
vard4 = pPlayer->MotoSpeed;
vard8 = fix16_to_int(pPlayer->q16ang);
if (varbc)
vardc = -10;
@ -7333,8 +7333,8 @@ void P_ProcessInput(int playerNum)
}
}
if (pPlayer->not_on_water)
if (pPlayer->moto_speed > 50)
pPlayer->moto_speed -= (pPlayer->moto_speed>>1);
if (pPlayer->MotoSpeed > 50)
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>1);
}
}
@ -7450,8 +7450,8 @@ void P_ProcessInput(int playerNum)
if (A_CheckEnemySprite(&sprite[spriteNum]))
{
actor[spriteNum].picnum = TILE_MOTOHIT;
actor[spriteNum].extra = 2+(pPlayer->moto_speed>>1);
pPlayer->moto_speed -= pPlayer->moto_speed >> 4;
actor[spriteNum].extra = 2+(pPlayer->MotoSpeed>>1);
pPlayer->MotoSpeed -= pPlayer->MotoSpeed >> 4;
}
}
if (pPlayer->OnBoat)
@ -7459,8 +7459,8 @@ void P_ProcessInput(int playerNum)
if (A_CheckEnemySprite(&sprite[spriteNum]))
{
actor[spriteNum].picnum = TILE_MOTOHIT;
actor[spriteNum].extra = 2+(pPlayer->moto_speed>>1);
pPlayer->moto_speed -= pPlayer->moto_speed >> 4;
actor[spriteNum].extra = 2+(pPlayer->MotoSpeed>>1);
pPlayer->MotoSpeed -= pPlayer->MotoSpeed >> 4;
}
}
else
@ -7812,7 +7812,7 @@ check_enemy_sprite:
{
pPlayer->moto_bump_target = 80;
pPlayer->moto_bump_fast = 1;
pPlayer->vel.z -= g_spriteGravity*(pPlayer->moto_speed>>4);
pPlayer->vel.z -= g_spriteGravity*(pPlayer->MotoSpeed>>4);
pPlayer->moto_on_ground = 0;
if (A_CheckSoundPlaying(pPlayer->i, 188))
S_StopEnvSound(188, pPlayer->i);
@ -7820,7 +7820,7 @@ check_enemy_sprite:
}
else
{
pPlayer->vel.z += g_spriteGravity-80+(120-pPlayer->moto_speed);
pPlayer->vel.z += g_spriteGravity-80+(120-pPlayer->MotoSpeed);
if (!A_CheckSoundPlaying(pPlayer->i, 189) && !A_CheckSoundPlaying(pPlayer->i, 190))
A_PlaySound(190, pPlayer->i);
}
@ -8251,37 +8251,37 @@ HORIZONLY:;
switch (krand2()&1)
{
case 0:
pPlayer->q16ang += F16(pPlayer->moto_speed>>1);
pPlayer->q16ang += F16(pPlayer->MotoSpeed>>1);
break;
case 1:
pPlayer->q16ang -= F16(pPlayer->moto_speed>>1);
pPlayer->q16ang -= F16(pPlayer->MotoSpeed>>1);
break;
}
if (var10c >= 441 && var10c <= 581)
{
var104 = (pPlayer->moto_speed*pPlayer->moto_speed)>>8;
pPlayer->moto_speed = 0;
var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>8;
pPlayer->MotoSpeed = 0;
if (A_CheckSoundPlaying(pPlayer->i, 238) == 0)
A_PlaySound(238,pPlayer->i);
}
else if (var10c >= 311 && var10c <= 711)
{
var104 = (pPlayer->moto_speed*pPlayer->moto_speed)>>11;
pPlayer->moto_speed -= (pPlayer->moto_speed>>1)+(pPlayer->moto_speed>>2);
var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>11;
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>1)+(pPlayer->MotoSpeed>>2);
if (A_CheckSoundPlaying(pPlayer->i, 238) == 0)
A_PlaySound(238,pPlayer->i);
}
else if (var10c >= 111 && var10c <= 911)
{
var104 = (pPlayer->moto_speed*pPlayer->moto_speed)>>14;
pPlayer->moto_speed -= (pPlayer->moto_speed>>1);
var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>14;
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>1);
if (A_CheckSoundPlaying(pPlayer->i, 239) == 0)
A_PlaySound(239,pPlayer->i);
}
else
{
var104 = (pPlayer->moto_speed*pPlayer->moto_speed)>>15;
pPlayer->moto_speed -= (pPlayer->moto_speed>>3);
var104 = (pPlayer->MotoSpeed*pPlayer->MotoSpeed)>>15;
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>3);
if (A_CheckSoundPlaying(pPlayer->i, 240) == 0)
A_PlaySound(240,pPlayer->i);
}
@ -8302,36 +8302,36 @@ HORIZONLY:;
switch (krand2()&1)
{
case 0:
pPlayer->q16ang += F16(pPlayer->moto_speed>>2);
pPlayer->q16ang += F16(pPlayer->MotoSpeed>>2);
break;
case 1:
pPlayer->q16ang -= F16(pPlayer->moto_speed>>2);
pPlayer->q16ang -= F16(pPlayer->MotoSpeed>>2);
break;
}
if (var118 >= 441 && var118 <= 581)
{
pPlayer->moto_speed = ((pPlayer->moto_speed>>1)+(pPlayer->moto_speed>>2))>>2;
pPlayer->MotoSpeed = ((pPlayer->MotoSpeed>>1)+(pPlayer->MotoSpeed>>2))>>2;
if (sectorLotag == 1)
if (A_CheckSoundPlaying(pPlayer->i, 178) == 0)
A_PlaySound(178,pPlayer->i);
}
else if (var118 >= 311 && var118 <= 711)
{
pPlayer->moto_speed -= ((pPlayer->moto_speed>>1)+(pPlayer->moto_speed>>2))>>3;
pPlayer->MotoSpeed -= ((pPlayer->MotoSpeed>>1)+(pPlayer->MotoSpeed>>2))>>3;
if (sectorLotag == 1)
if (A_CheckSoundPlaying(pPlayer->i, 179) == 0)
A_PlaySound(179,pPlayer->i);
}
else if (var118 >= 111 && var118 <= 911)
{
pPlayer->moto_speed -= (pPlayer->moto_speed>>4);
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>4);
if (sectorLotag == 1)
if (A_CheckSoundPlaying(pPlayer->i, 180) == 0)
A_PlaySound(180,pPlayer->i);
}
else
{
pPlayer->moto_speed -= (pPlayer->moto_speed>>6);
pPlayer->MotoSpeed -= (pPlayer->MotoSpeed>>6);
if (sectorLotag == 1)
if (A_CheckSoundPlaying(pPlayer->i, 181) == 0)
A_PlaySound(181,pPlayer->i);
@ -8342,7 +8342,7 @@ HORIZONLY:;
if (wall[wallNum].lotag >= 40 && wall[wallNum].lotag <= 44)
{
if (wall[wallNum].lotag < 44)
G_DoFurniture(wallNum,pPlayer->cursectnum,playerNum);
dofurniture(wallNum,pPlayer->cursectnum,playerNum);
pushmove(&pPlayer->pos,&pPlayer->cursectnum,172L,(4L<<8),(4L<<8),CLIPMASK0);
}
}
@ -8370,12 +8370,12 @@ HORIZONLY:;
else
actor[spriteNum].owner = pPlayer->i;
actor[spriteNum].picnum = TILE_MOTOHIT;
actor[spriteNum].extra = pPlayer->moto_speed>>1;
pPlayer->moto_speed -= pPlayer->moto_speed>>2;
actor[spriteNum].extra = pPlayer->MotoSpeed>>1;
pPlayer->MotoSpeed -= pPlayer->MotoSpeed>>2;
pPlayer->moto_turb = 6;
}
else if ((sprite[spriteNum].picnum == TILE_RRTILE2431 || sprite[spriteNum].picnum == TILE_RRTILE2443 || sprite[spriteNum].picnum == TILE_RRTILE2451 || sprite[spriteNum].picnum == TILE_RRTILE2455)
&& sprite[spriteNum].picnum != TILE_ACTIVATORLOCKED && pPlayer->moto_speed > 45)
&& sprite[spriteNum].picnum != TILE_ACTIVATORLOCKED && pPlayer->MotoSpeed > 45)
{
A_PlaySound(SQUISHED,spriteNum);
if (sprite[spriteNum].picnum == TILE_RRTILE2431 || sprite[spriteNum].picnum == TILE_RRTILE2451)
@ -8423,8 +8423,8 @@ HORIZONLY:;
else
actor[spriteNum].owner = pPlayer->i;
actor[spriteNum].picnum = TILE_MOTOHIT;
actor[spriteNum].extra = pPlayer->moto_speed>>2;
pPlayer->moto_speed -= pPlayer->moto_speed>>2;
actor[spriteNum].extra = pPlayer->MotoSpeed>>2;
pPlayer->MotoSpeed -= pPlayer->MotoSpeed>>2;
pPlayer->moto_turb = 6;
}
}

View file

@ -984,7 +984,7 @@ void P_ResetStatus(int playerNum)
pPlayer->moto_do_bump = 0;
pPlayer->moto_on_ground = 1;
pPlayer->moto_underwater = 0;
pPlayer->moto_speed = 0;
pPlayer->MotoSpeed = 0;
pPlayer->tilt_status = 0;
pPlayer->moto_drink = 0;
pPlayer->moto_bump_target = 0;
@ -1166,7 +1166,7 @@ static void resetprestat(int playerNum, int gameMode)
g_windTime = 0;
g_windDir = 0;
g_fakeBubbaCnt = 0;
g_RAendLevel = 0;
RRRA_ExitedLevel = 0;
g_bellTime = 0;
g_bellSprite = 0;
}
@ -1281,7 +1281,7 @@ static void prelevel(char g)
g_player[myconnectindex].ps->level_end_timer = 0;
g_mamaSpawnCnt = 15;
g_banjoSong = 0;
g_RAendLevel = 0;
RRRA_ExitedLevel = 0;
if (!DEER)
{
for (bssize_t TRAVERSE_CONNECT(playerNum))
@ -1325,7 +1325,7 @@ static void prelevel(char g)
g_windTime = 0;
g_windDir = 0;
g_fakeBubbaCnt = 0;
g_RAendLevel = 0;
RRRA_ExitedLevel = 0;
g_mamaSpawnCnt = 15; // ???
g_bellTime = 0;
g_bellSprite = 0;

View file

@ -933,8 +933,8 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &ufospawnsminion, sizeof(ufospawnsminion), 1 },
{ 0, &pistonsound, sizeof(pistonsound), 1 },
{ 0, &g_chickenWeaponTimer, sizeof(g_chickenWeaponTimer), 1 },
{ 0, &g_RAendLevel, sizeof(g_RAendLevel), 1 },
{ 0, &g_RAendEpisode, sizeof(g_RAendEpisode), 1 },
{ 0, &RRRA_ExitedLevel, sizeof(RRRA_ExitedLevel), 1 },
{ 0, &RRRA_EndEpisode, sizeof(RRRA_EndEpisode), 1 },
{ 0, &g_fogType, sizeof(g_fogType), 1 },
{ DS_LOADFN, (void *)sv_rrrafog, 0, 1 },

View file

@ -2834,9 +2834,9 @@ void G_BonusScreenRRRA(int32_t bonusonly)
}
}
}
if (g_RAendEpisode)
if (RRRA_EndEpisode)
{
g_RAendEpisode = 0;
RRRA_EndEpisode = 0;
ud.m_volume_number = ud.volume_number = 1;
m_level_number = ud.level_number = 0;
ud.eog = 0;

View file

@ -830,7 +830,7 @@ int A_CheckHitSprite(int spriteNum, int16_t *hitSprite)
return FindDistance2D(hitData.pos.x-SX(spriteNum),hitData.pos.y-SY(spriteNum));
}
static int P_FindWall(DukePlayer_t *pPlayer, int *hitWall)
int hitawall(DukePlayer_t *pPlayer, int *hitWall)
{
hitdata_t hitData;
@ -845,630 +845,5 @@ static int P_FindWall(DukePlayer_t *pPlayer, int *hitWall)
return FindDistance2D(hitData.pos.x - pPlayer->pos.x, hitData.pos.y - pPlayer->pos.y);
}
// returns 1 if sprite i should not be considered by neartag
static int32_t our_neartag_blacklist(int32_t UNUSED(spriteNum))
{
return 0;
}
static void G_ClearCameras(DukePlayer_t *p)
{
G_ClearCameraView(p);
}
void P_CheckSectors(int playerNum)
{
DukePlayer_t *const pPlayer = g_player[playerNum].ps;
if (pPlayer->cursectnum > -1)
{
sectortype *const pSector = &sector[pPlayer->cursectnum];
switch ((uint16_t)pSector->lotag)
{
case 32767:
pSector->lotag = 0;
if (RR && !RRRA)
g_canSeePlayer = 0;
P_DoQuote(QUOTE_FOUND_SECRET, pPlayer);
SECRET_Trigger(pPlayer->cursectnum);
pPlayer->secret_rooms++;
return;
case UINT16_MAX:
pSector->lotag = 0;
for (bssize_t TRAVERSE_CONNECT(playerNum))
g_player[playerNum].ps->gm = MODE_EOL;
if (!RRRA || !g_RAendLevel)
{
if (ud.from_bonus)
{
ud.level_number = ud.from_bonus;
m_level_number = ud.level_number;
ud.from_bonus = 0;
}
else
{
if (RRRA && ud.level_number == 6 && ud.volume_number == 0)
g_RAendEpisode = 1;
ud.level_number = (++ud.level_number < MAXLEVELS) ? ud.level_number : 0;
m_level_number = ud.level_number;
}
g_RAendLevel = 1;
}
return;
case UINT16_MAX-1:
pSector->lotag = 0;
pPlayer->timebeforeexit = GAMETICSPERSEC * 8;
pPlayer->customexitsound = pSector->hitag;
return;
default:
if (pSector->lotag >= 10000 && (RR || pSector->lotag < 16383))
{
if (playerNum == screenpeek || (g_gametypeFlags[ud.coop] & GAMETYPE_COOPSOUND))
{
if (RR && !RRRA)
g_canSeePlayer = -1;
A_PlaySound(pSector->lotag - 10000, pPlayer->i);
}
pSector->lotag = 0;
}
break;
}
}
//After this point the the player effects the map with space
if (pPlayer->gm &MODE_TYPE || sprite[pPlayer->i].extra <= 0)
return;
if (ud.cashman && TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_OPEN))
{
if (RR && !RRRA)
g_canSeePlayer = -1;
A_SpawnMultiple(pPlayer->i, TILE_MONEY, 2);
}
if (!RR && pPlayer->newowner >= 0)
{
if (klabs(g_player[playerNum].input->svel) > 768 || klabs(g_player[playerNum].input->fvel) > 768)
{
G_ClearCameras(pPlayer);
return;
}
}
if (!TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_OPEN) && !TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_ESCAPE))
pPlayer->toggle_key_flag = 0;
else if (!pPlayer->toggle_key_flag)
{
int foundWall;
int16_t nearSector, nearWall, nearSprite;
int32_t nearDist;
if (!RR && TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_ESCAPE))
{
if (pPlayer->newowner >= 0)
G_ClearCameras(pPlayer);
return;
}
nearSprite = -1;
pPlayer->toggle_key_flag = 1;
foundWall = -1;
if (RR && !RRRA)
{
hitdata_t hitData;
hitscan((const vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047],
sintable[fix16_to_int(pPlayer->q16ang) & 2047], 0, &hitData, CLIPMASK0);
g_canSeePlayer &= ~0xffff;
g_canSeePlayer |= hitData.sect;
}
int wallDist = P_FindWall(pPlayer, &foundWall);
if (RRRA)
{
if (foundWall >= 0 && wall[foundWall].overpicnum == TILE_MIRROR && playerNum == screenpeek)
if (!g_netServer && numplayers == 1)
{
if (A_CheckSoundPlaying(pPlayer->i,27) == 0 && A_CheckSoundPlaying(pPlayer->i,28) == 0 && A_CheckSoundPlaying(pPlayer->i,29) == 0
&& A_CheckSoundPlaying(pPlayer->i,257) == 0 && A_CheckSoundPlaying(pPlayer->i,258) == 0)
{
int snd = krand2() % 5;
if (snd == 0)
A_PlaySound(27, pPlayer->i);
else if (snd == 1)
A_PlaySound(28, pPlayer->i);
else if (snd == 2)
A_PlaySound(29, pPlayer->i);
else if (snd == 3)
A_PlaySound(257, pPlayer->i);
else if (snd == 4)
A_PlaySound(258, pPlayer->i);
}
return;
}
}
else if (foundWall >= 0 && (RR || wallDist < 1280) && wall[foundWall].overpicnum == TILE_MIRROR)
if (wall[foundWall].lotag > 0 && !A_CheckSoundPlaying(pPlayer->i,wall[foundWall].lotag) && playerNum == screenpeek)
{
if (RR)
g_canSeePlayer = -1;
A_PlaySound(wall[foundWall].lotag,pPlayer->i);
return;
}
if (foundWall >= 0 && (wall[foundWall].cstat&16))
{
if (RRRA)
g_canSeePlayer = foundWall*32;
if (wall[foundWall].lotag)
return;
}
int const intang = fix16_to_int(pPlayer->oq16ang);
if (RRRA)
{
if (pPlayer->OnMotorcycle)
{
if (pPlayer->moto_speed < 20)
G_OffMotorcycle(pPlayer);
return;
}
if (pPlayer->OnBoat)
{
if (pPlayer->moto_speed < 20)
G_OffBoat(pPlayer);
return;
}
neartag(pPlayer->opos.x, pPlayer->opos.y, pPlayer->opos.z, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
}
if (RR && !RRRA)
g_canSeePlayer = -1;
if (pPlayer->newowner >= 0)
neartag(pPlayer->opos.x, pPlayer->opos.y, pPlayer->opos.z, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
else
{
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
if (nearSprite == -1 && nearWall == -1 && nearSector == -1)
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET3, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
if (nearSprite == -1 && nearWall == -1 && nearSector == -1)
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET2, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 1, our_neartag_blacklist);
if (nearSprite == -1 && nearWall == -1 && nearSector == -1)
{
neartag(pPlayer->pos.x, pPlayer->pos.y, pPlayer->pos.z+ZOFFSET2, sprite[pPlayer->i].sectnum, intang, &nearSector,
&nearWall, &nearSprite, &nearDist, 1280, 3, our_neartag_blacklist);
if (nearSprite >= 0)
{
switch (DYNAMICTILEMAP(sprite[nearSprite].picnum))
{
case PODFEM1__STATIC:
case FEM1__STATIC:
case FEM2__STATIC:
case FEM3__STATIC:
case FEM4__STATIC:
case FEM5__STATIC:
case FEM6__STATIC:
case FEM7__STATIC:
case FEM8__STATIC:
case FEM9__STATIC:
if (RR) break;
fallthrough__;
case FEM10__STATIC:
case NAKED1__STATIC:
case STATUE__STATIC:
case TOUGHGAL__STATIC: return;
case COW__STATICRR:
g_spriteExtra[nearSprite] = 1;
return;
}
}
nearSprite = -1;
nearWall = -1;
nearSector = -1;
}
}
if (pPlayer->newowner == -1 && nearSprite == -1 && nearSector == -1 && nearWall == -1)
{
if (isanunderoperator(sector[sprite[pPlayer->i].sectnum].lotag))
nearSector = sprite[pPlayer->i].sectnum;
}
if (nearSector >= 0 && (sector[nearSector].lotag&16384))
return;
if (nearSprite == -1 && nearWall == -1)
{
if (pPlayer->cursectnum >= 0 && sector[pPlayer->cursectnum].lotag == 2)
{
if (A_CheckHitSprite(pPlayer->i, &nearSprite) > 1280)
nearSprite = -1;
}
}
if (nearSprite >= 0)
{
if (RR && !RRRA)
g_canSeePlayer = playerNum;
if (checkhitswitch(playerNum, nearSprite, 1))
return;
switch (DYNAMICTILEMAP(sprite[nearSprite].picnum))
{
case RRTILE8448__STATICRR:
if (!RRRA) break;
if (!A_CheckSoundPlaying(nearSprite, 340))
A_PlaySound(340, nearSprite);
return;
case RRTILE8704__STATICRR:
if (!RRRA) break;
if (!g_netServer && numplayers == 1)
{
static int soundPlayed = 0;
if (S_CheckSoundPlaying(nearSprite, 445) == 0 && soundPlayed == 0)
{
A_PlaySound(445, nearSprite);
soundPlayed = 1;
}
else if (S_CheckSoundPlaying(nearSprite, 445) == 0 && S_CheckSoundPlaying(nearSprite, 446) == 0
&& S_CheckSoundPlaying(nearSprite, 447) == 0 && soundPlayed == 0)
{
if ((krand2()%2) == 1)
A_PlaySound(446, nearSprite);
else
A_PlaySound(447, nearSprite);
}
}
return;
case EMPTYBIKE__STATICRR:
if (!RRRA) break;
G_OnMotorcycle(pPlayer, nearSprite);
return;
case EMPTYBOAT__STATICRR:
if (!RRRA) break;
G_OnBoat(pPlayer, nearSprite);
return;
case RRTILE8164__STATICRR:
case RRTILE8165__STATICRR:
case RRTILE8166__STATICRR:
case RRTILE8167__STATICRR:
case RRTILE8168__STATICRR:
case RRTILE8591__STATICRR:
case RRTILE8592__STATICRR:
case RRTILE8593__STATICRR:
case RRTILE8594__STATICRR:
case RRTILE8595__STATICRR:
if (!RRRA) break;
sprite[nearSprite].extra = 60;
A_PlaySound(235, nearSprite);
return;
case TOILET__STATIC:
case STALL__STATIC:
case RRTILE2121__STATICRR:
case RRTILE2122__STATICRR:
if (pPlayer->last_pissed_time == 0)
{
if (adult_lockout == 0)
A_PlaySound(RR ? 435 : DUKE_URINATE, pPlayer->i);
pPlayer->last_pissed_time = GAMETICSPERSEC * 220;
pPlayer->transporter_hold = 29 * 2;
if (pPlayer->holster_weapon == 0)
{
pPlayer->holster_weapon = 1;
pPlayer->weapon_pos = -1;
}
if (sprite[pPlayer->i].extra <= (pPlayer->max_player_health - (pPlayer->max_player_health / 10)))
{
sprite[pPlayer->i].extra += pPlayer->max_player_health / 10;
pPlayer->last_extra = sprite[pPlayer->i].extra;
}
else if (sprite[pPlayer->i].extra < pPlayer->max_player_health)
sprite[pPlayer->i].extra = pPlayer->max_player_health;
}
else if (!A_CheckSoundPlaying(nearSprite,RR ? DUKE_GRUNT : FLUSH_TOILET))
{
if (RR && !RRRA)
g_canSeePlayer = -1;
A_PlaySound(RR ? DUKE_GRUNT : FLUSH_TOILET,nearSprite);
}
return;
case NUKEBUTTON__STATIC:
{
if (RR) break;
int wallNum;
P_FindWall(pPlayer, &wallNum);
if (wallNum >= 0 && wall[wallNum].overpicnum == 0)
{
if (actor[nearSprite].t_data[0] == 0)
{
if (ud.noexits && (g_netServer || ud.multimode > 1))
{
// TILE_NUKEBUTTON frags the player
actor[pPlayer->i].picnum = TILE_NUKEBUTTON;
actor[pPlayer->i].extra = 250;
}
else
{
actor[nearSprite].t_data[0] = 1;
sprite[nearSprite].owner = pPlayer->i;
// assignment of buttonpalette here is not a bug
ud.secretlevel =
(pPlayer->buttonpalette = sprite[nearSprite].pal) ? sprite[nearSprite].lotag : 0;
}
}
}
return;
}
case WATERFOUNTAIN__STATIC:
if (actor[nearSprite].t_data[0] != 1)
{
actor[nearSprite].t_data[0] = 1;
sprite[nearSprite].owner = pPlayer->i;
if (sprite[pPlayer->i].extra < pPlayer->max_player_health)
{
sprite[pPlayer->i].extra++;
if (RR && !RRRA)
g_canSeePlayer = -1;
A_PlaySound(DUKE_DRINKING,pPlayer->i);
}
}
return;
case PLUG__STATIC:
if (RR && !RRRA)
g_canSeePlayer = -1;
A_PlaySound(SHORT_CIRCUIT, pPlayer->i);
sprite[pPlayer->i].extra -= 2+(krand2()&3);
P_PalFrom(pPlayer, 32, 48,48,64);
break;
case VIEWSCREEN__STATIC:
case VIEWSCREEN2__STATIC:
if (RR) break;
// Try to find a camera sprite for the viewscreen.
for (bssize_t SPRITES_OF(STAT_ACTOR, spriteNum))
{
if (PN(spriteNum) == TILE_CAMERA1 && SP(spriteNum) == 0 && sprite[nearSprite].hitag == SLT(spriteNum))
{
sprite[spriteNum].yvel = 1; // Using this camera
A_PlaySound(MONITOR_ACTIVE, pPlayer->i);
sprite[nearSprite].owner = spriteNum;
sprite[nearSprite].yvel = 1; // VIEWSCREEN_YVEL
g_curViewscreen = nearSprite;
int const playerSectnum = pPlayer->cursectnum;
pPlayer->cursectnum = SECT(spriteNum);
P_UpdateScreenPal(pPlayer);
pPlayer->cursectnum = playerSectnum;
pPlayer->newowner = spriteNum;
//P_UpdatePosWhenViewingCam(pPlayer);
return;
}
}
G_ClearCameras(pPlayer);
return;
} // switch
}
if (TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_OPEN) == 0)
return;
if (!RR && pPlayer->newowner >= 0)
{
G_ClearCameras(pPlayer);
return;
}
if (RR && !RRRA && nearWall == -1 && nearSector == -1 && nearSprite == -1)
g_canSeePlayer = playerNum;
if (nearWall == -1 && nearSector == -1 && nearSprite == -1)
{
if (klabs(A_GetHitscanRange(pPlayer->i)) < 512)
{
if (RR && !RRRA)
g_canSeePlayer = -1;
A_PlaySound(((krand2()&255) < 16) ? DUKE_SEARCH2 : DUKE_SEARCH, pPlayer->i);
return;
}
}
if (nearWall >= 0)
{
if (wall[nearWall].lotag > 0 && isadoorwall(wall[nearWall].picnum))
{
if (foundWall == nearWall || foundWall == -1)
{
if (RR && !RRRA)
g_canSeePlayer = playerNum;
checkhitswitch(playerNum,nearWall,0);
}
return;
}
else if (!RR && pPlayer->newowner >= 0)
{
G_ClearCameras(pPlayer);
return;
}
}
if (nearSector >= 0 && (sector[nearSector].lotag&16384) == 0 &&
isanearoperator(sector[nearSector].lotag))
{
for (bssize_t SPRITES_OF_SECT(nearSector, spriteNum))
{
if (PN(spriteNum) == TILE_ACTIVATOR || PN(spriteNum) == TILE_MASTERSWITCH)
return;
}
if (!RR || P_HasKey(nearSector, playerNum))
{
if (RR && !RRRA)
g_canSeePlayer = -1;
operatesectors(nearSector,pPlayer->i);
}
else if (RR)
{
if (g_sectorExtra[nearSector] > 3)
A_PlaySound(99,pPlayer->i);
else
A_PlaySound(419,pPlayer->i);
if (RR && !RRRA)
g_canSeePlayer = -1;
P_DoQuote(41,pPlayer);
}
}
else if ((sector[sprite[pPlayer->i].sectnum].lotag&16384) == 0)
{
if (isanunderoperator(sector[sprite[pPlayer->i].sectnum].lotag))
{
for (bssize_t SPRITES_OF_SECT(sprite[pPlayer->i].sectnum, spriteNum))
{
if (PN(spriteNum) == TILE_ACTIVATOR || PN(spriteNum) == TILE_MASTERSWITCH)
return;
}
if (!RR || P_HasKey(sprite[pPlayer->i].sectnum, playerNum))
{
if (RR && !RRRA)
g_canSeePlayer = -1;
operatesectors(sprite[pPlayer->i].sectnum,pPlayer->i);
}
else if (RR)
{
if (g_sectorExtra[sprite[pPlayer->i].sectnum] > 3)
A_PlaySound(99,pPlayer->i);
else
A_PlaySound(419,pPlayer->i);
if (RR && !RRRA)
g_canSeePlayer = -1;
P_DoQuote(41,pPlayer);
}
}
else checkhitswitch(playerNum,nearWall,0);
}
}
}
void G_DoFurniture(int wallNum, int sectNum, int playerNum)
{
int startwall, endwall;
int insideCheck, i;
int32_t max_x, min_x, max_y, min_y, speed;
startwall = sector[wall[wallNum].nextsector].wallptr;
endwall = startwall+sector[wall[wallNum].nextsector].wallnum;
insideCheck = 1;
max_x = max_y = -(2<<16);
min_x = min_y = 2<<16;
speed = sector[sectNum].hitag;
if (speed > 16)
speed = 16;
else if (speed == 0)
speed = 4;
for (i = startwall; i < endwall; i++)
{
if (max_x < wall[i].x)
max_x = wall[i].x;
if (max_y < wall[i].y)
max_y = wall[i].y;
if (min_x > wall[i].x)
min_x = wall[i].x;
if (min_y > wall[i].y)
min_y = wall[i].y;
}
max_x += speed+1;
max_y += speed+1;
min_x -= speed+1;
min_y -= speed+1;
if (!inside(max_x, max_y, sectNum))
insideCheck = 0;
if (!inside(max_x, min_y, sectNum))
insideCheck = 0;
if (!inside(min_x, min_y, sectNum))
insideCheck = 0;
if (!inside(min_x, max_y, sectNum))
insideCheck = 0;
if (insideCheck)
{
if (!S_CheckSoundPlaying(g_player[playerNum].ps->i, 389))
A_PlaySound(389, g_player[playerNum].ps->i);
for (i = startwall; i < endwall; i++)
{
int32_t x, y;
x = wall[i].x;
y = wall[i].y;
switch (wall[wallNum].lotag)
{
case 42:
dragpoint(i,x,y+speed,0);
break;
case 41:
dragpoint(i,x-speed,y,0);
break;
case 40:
dragpoint(i,x,y-speed,0);
break;
case 43:
dragpoint(i,x+speed,y,0);
break;
}
}
}
else
{
speed -= 2;
for (i = startwall; i < endwall; i++)
{
int32_t x, y;
x = wall[i].x;
y = wall[i].y;
switch (wall[wallNum].lotag)
{
case 42:
dragpoint(i,x,y-speed,0);
break;
case 41:
dragpoint(i,x+speed,y,0);
break;
case 40:
dragpoint(i,x,y+speed,0);
break;
case 43:
dragpoint(i,x-speed,y,0);
break;
}
}
}
}
END_DUKE_NS