diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 19020c6c5..73c3db8a3 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -2984,7 +2984,7 @@ void UpdateDacs(int nPalette, bool bNoTint) nGreen = ClipRange(nGreen, -255, 255); nBlue = ClipRange(nBlue, -255, 255); - videoSetPalette(0, nPalette, 0); + videoSetPalette(nPalette, 0); videoTintBlood(nRed, nGreen, nBlue); } } diff --git a/source/build/include/build.h b/source/build/include/build.h index 487b1ed36..6873e72b2 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -175,8 +175,8 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t,int32_ # define yax_drawrooms(SpriteAnimFunc, sectnum, didmirror, smoothr) #endif -#define CLIPMASK0 (((1L)<<16)+1L) -#define CLIPMASK1 (((256L)<<16)+64L) +#define CLIPMASK0 (((1)<<16)+1) +#define CLIPMASK1 (((256)<<16)+64) #define NEXTWALL(i) (wall[wall[i].nextwall]) #define POINT2(i) (wall[wall[i].point2]) diff --git a/source/core/palette.h b/source/core/palette.h index bb176ef65..56d47c9a2 100644 --- a/source/core/palette.h +++ b/source/core/palette.h @@ -149,7 +149,7 @@ inline void videoSetBrightness(int brightness) typedef TFlags ESetPalFlags; DEFINE_TFLAGS_OPERATORS(ESetPalFlags) -void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags); +void videoSetPalette(int dapalid, ESetPalFlags flags); inline void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset) { palfadergb.r = r; @@ -157,6 +157,10 @@ inline void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset) palfadergb.b = b; palfadergb.a = offset; } +inline void videoclearFade() +{ + palfadergb.d = 0; +} void videoTintBlood(int32_t r, int32_t g, int32_t b); diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index 469cdf843..3be113d86 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -74,7 +74,7 @@ void MyLoadPalette() // //kread(hFile, kenpal, sizeof(kenpal)); //kclose(hFile); - videoSetPalette(0, BASEPAL, 0); + videoSetPalette(BASEPAL, 0); SetOverscan(BASEPAL); } @@ -165,7 +165,7 @@ void GrabPalette() { SetOverscan(BASEPAL); - videoSetPalette(0, BASEPAL, 0); + videoSetPalette(BASEPAL, 0); nPalDiff = 0; nPalDelay = 0; @@ -183,7 +183,7 @@ void BlackOut() void RestorePalette() { - videoSetPalette(0, BASEPAL, 0); + videoSetPalette(BASEPAL, 0); videoTintBlood(0, 0, 0); } diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index e4b46914a..ead2cf4d3 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -1043,8 +1043,6 @@ void CinemaFadeIn() { BlackOut(); - //videoSetPalette(0, ANIMPAL, Pal_Fullscreen); - #ifdef USE_OPENGL if (videoGetRenderMode() >= REND_POLYMOST) { diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 38c805fe2..d1e5ea227 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1667,7 +1667,7 @@ void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int a = s->ang; s->ang = hittype[i].tempang; if (attacksnd >= 0) spritesound(attacksnd, i); - shoot(i, firelaser); + fi.shoot(i, firelaser); s->ang = a; } if (t[2] > (26 * 3) || !cansee(s->x, s->y, s->z - (16 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum)) @@ -1701,7 +1701,7 @@ void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int else if ((t[2] & 15) == 0 && attacksnd >= 0) { spritesound(attacksnd, i); - shoot(i, firelaser); + fi.shoot(i, firelaser); } } s->ang += getincangle(s->ang, getangle(ps[p].posx - s->x, ps[p].posy - s->y)) >> 2; @@ -2785,7 +2785,7 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6) { j = s->ang; s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy); - shoot(i, RPG); + fi.shoot(i, RPG); s->ang = j; } } @@ -3325,7 +3325,7 @@ void handle_se05(int i, int FIRELASER) { j = s->ang; s->ang = getangle(s->x - ps[p].posx, s->y - ps[p].posy); - shoot(i, FIRELASER); + fi.shoot(i, FIRELASER); s->ang = j; } diff --git a/source/games/duke/src/actors.h b/source/games/duke/src/actors.h index 001c55692..da9ddf491 100644 --- a/source/games/duke/src/actors.h +++ b/source/games/duke/src/actors.h @@ -190,6 +190,7 @@ struct ActorInfo { uint32_t scriptaddress; uint32_t flags; + int aimoffset; }; @@ -200,8 +201,10 @@ enum sflags_t SFLAG_NVG = 0x00000002, SFLAG_INVENTORY = 0x00000004, SFLAG_ADULT = 0x00000008, + SFLAG_SHRINKAUTOAIM = 0x00000010, SFLAG_BADGUY = 0x00000020, SFLAG_NOPAL = 0x00000040, + SFLAG_FORCEAUTOAIM = 0x00000080, SFLAG_USEACTIVATOR = 0x00000200, SFLAG_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked SFLAG_BADGUYSTAYPUT = 0x00008000, diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 1b9757c58..811daacbb 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3992,7 +3992,7 @@ void moveeffectors_d(void) //STATNUM 3 if (t[0]) { if (t[0] == 1) - shoot(i, sc->extra); + fi.shoot(i, sc->extra); else if (t[0] == 26 * 5) t[0] = 0; t[0]++; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 9a8e881f9..4d64fc6d0 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -4020,7 +4020,7 @@ void moveeffectors_r(void) //STATNUM 3 if (t[0]) { if (t[0] == 1) - shoot(i, sc->extra); + fi.shoot(i, sc->extra); else if (t[0] == 26 * 5) t[0] = 0; t[0]++; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index e3c427a91..350f7ef03 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -93,6 +93,10 @@ int spawn_d(int j, int pn); int spawn_r(int j, int pn); void check_fta_sounds_d(int i); void check_fta_sounds_r(int i); +void incur_damage_d(struct player_struct* p); +void incur_damage_r(struct player_struct* p); +void shoot_d(int i, int atwith); +void shoot_r(int i, int atwith); Dispatcher fi; @@ -133,7 +137,10 @@ void SetDispatcher() checktimetosleep_d, move_d, spawn_d, - check_fta_sounds_d + check_fta_sounds_d, + + incur_damage_d, + shoot_d }; } else @@ -171,6 +178,9 @@ void SetDispatcher() move_r, spawn_r, check_fta_sounds_r, + + incur_damage_r, + shoot_r }; } } diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index d8176abb3..f12298f66 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -201,6 +201,20 @@ void initactorflags_d() 4562, 4498, 4957 }); + + setflag(SFLAG_SHRINKAUTOAIM, { + GREENSLIME, + GREENSLIME + 1, + GREENSLIME + 2, + GREENSLIME + 3, + GREENSLIME + 4, + GREENSLIME + 5, + GREENSLIME + 6, + GREENSLIME + 7, + }); + + actorinfo[ORGANTIC].aimoffset = 32 << 8; + actorinfo[ROTATEGUN].aimoffset = 32 << 8; } diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 35b181720..1234d942e 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -184,6 +184,7 @@ void initactorflags_r() DOLPHIN2, TOUGHGAL }); + actorinfo[RPG2].flags |= SFLAG_FORCEAUTOAIM; } END_DUKE_NS \ No newline at end of file diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index a2ec94fa8..7431b5675 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -214,7 +214,7 @@ extern int32_t g_crosshairSum; extern int32_t g_doQuickSave; extern int32_t g_levelTextTime; extern int32_t g_quitDeadline; -extern int32_t g_restorePalette; +extern int32_t restorepalette; extern int32_t tempwallptr; extern int32_t ticrandomseed; extern int32_t vote_map; @@ -524,6 +524,10 @@ struct Dispatcher int (*spawn)(int j, int pn); void (*check_fta_sounds)(int i); + // player + void (*incur_damage)(struct player_struct* p); + void (*shoot)(int, int); + }; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index ecfba53da..8e3eea414 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -469,7 +469,7 @@ int parse(void) break; case concmd_shoot: insptr++; - shoot(g_i, (short)*insptr); + fi.shoot(g_i, (short)*insptr); insptr++; break; case concmd_ifsoundid: diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index bc934f4b5..b6294da13 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -252,7 +252,7 @@ G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; #pragma pack(pop) G_EXTERN int32_t g_noEnemies; -G_EXTERN int32_t g_restorePalette; +G_EXTERN int32_t restorepalette; G_EXTERN uint32_t everyothertime; G_EXTERN uint32_t g_moveThingsCount; G_EXTERN double g_gameUpdateTime; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 68b23c24d..15faa77d9 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -37,4 +37,256 @@ source as it is released. BEGIN_DUKE_NS +//--------------------------------------------------------------------------- +// +// setpal +// +//--------------------------------------------------------------------------- + +void setpal_(struct player_struct* p) // cannot be activated yet. +{ + int palette;; + if (p->DrugMode) palette = DRUGPAL; + else if (p->heat_on || (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME+2)) palette = SLIMEPAL; + else if (sector[p->cursectnum].lotag == 2) palette = WATERPAL; + else palette = BASEPAL; + videoSetPalette(palette, 0); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void quickkill(struct player_struct* p) +{ + SetPlayerPal(p, PalEntry(48, 48, 48, 48)); + + sprite[p->i].extra = 0; + sprite[p->i].cstat |= 32768; + if (ud.god == 0) fi.guts(&sprite[p->i], TILE_JIBS6, 8, myconnectindex); + return; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void forceplayerangle(struct player_struct* p) +{ + int n; + + n = 128 - (krand() & 255); + + p->q16horiz += 64 << FRACBITS; + p->return_to_center = 9; + p->look_ang = n >> 1; + p->rotscrnang = n >> 1; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n) +{ + int i, xv, yv, zv; + short sect = -1; + + i = n + 1; + xv = (x2 - x1) / i; + yv = (y2 - y1) / i; + zv = (z2 - z1) / i; + + if ((abs(x1 - x2) + abs(y1 - y2)) < 3084) + return; + + for (i = n; i > 0; i--) + { + x1 += xv; + y1 += yv; + z1 += zv; + updatesector(x1, y1, §); + if (sect >= 0) + { + if (sector[sect].lotag == 2) + EGS(sect, x1, y1, z1, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].i, 5); + else + EGS(sect, x1, y1, z1, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].i, 5); + } + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int hits(int i) +{ + auto sp = &sprite[i]; + int sx, sy, sz; + short sect; + short hw, hs; + int zoff; + + if (sp->picnum == TILE_APLAYER) zoff = (40 << 8); + else zoff = 0; + + hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &hs, &sx, &sy, &sz, CLIPMASK1); + + return (FindDistance2D(sx - sp->x, sy - sp->y)); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int hitasprite(int i, short* hitsp) +{ + auto sp = &sprite[i]; + int sx, sy, sz, zoff; + short sect, hw; + + if (badguy(&sprite[i])) + zoff = (42 << 8); + else if (sp->picnum == TILE_APLAYER) zoff = (39 << 8); + else zoff = 0; + + hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, hitsp, &sx, &sy, &sz, CLIPMASK1); + + if (hw >= 0 && (wall[hw].cstat & 16) && badguy(&sprite[i])) + return((1 << 30)); + + return (FindDistance2D(sx - sp->x, sy - sp->y)); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int hitawall(struct player_struct* p, int* hitw) +{ + int sx, sy, sz; + short sect, hs, hitw1; + + hitscan(p->posx, p->posy, p->posz, p->cursectnum, + sintable[(p->getang() + 512) & 2047], sintable[p->getang() & 2047], 0, §, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0); + *hitw = hitw1; + + return (FindDistance2D(sx - p->posx, sy - p->posy)); +} + + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int aim(spritetype* s, int aang) +{ + char gotshrinker, gotfreezer; + int i, j, a, k, cans; + int aimstats[] = { 10,13,1,2 }; + int dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist; + int xv, yv; + + a = s->ang; + + // Autoaim from DukeGDX. + if (s->picnum == TILE_APLAYER && ps[s->yvel].auto_aim == 0) + return -1; + + j = -1; + // if(s->picnum == TILE_APLAYER && ps[s->yvel].aim_mode) return -1; + + if (isRR()) + { + gotshrinker = 0; + gotfreezer = 0; + } + else if (isWW2GI()) + { + gotshrinker = s->picnum == TILE_APLAYER && aplWeaponWorksLike[ps[s->yvel].curr_weapon][s->yvel] == SHRINKER_WEAPON; + gotfreezer = s->picnum == TILE_APLAYER && aplWeaponWorksLike[ps[s->yvel].curr_weapon][s->yvel] == FREEZE_WEAPON; + } + else + { + gotshrinker = s->picnum == TILE_APLAYER && ps[s->yvel].curr_weapon == SHRINKER_WEAPON; + gotfreezer = s->picnum == TILE_APLAYER && ps[s->yvel].curr_weapon == FREEZE_WEAPON; + } + + smax = 0x7fffffff; + + dx1 = sintable[(a + 512 - aang) & 2047]; + dy1 = sintable[(a - aang) & 2047]; + dx2 = sintable[(a + 512 + aang) & 2047]; + dy2 = sintable[(a + aang) & 2047]; + + dx3 = sintable[(a + 512) & 2047]; + dy3 = sintable[a & 2047]; + + for (k = 0; k < 4; k++) + { + if (j >= 0) + break; + for (i = headspritestat[aimstats[k]]; i >= 0; i = nextspritestat[i]) + if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat & (257 + 32768)) == 257) + if (badguy(&sprite[i]) || k < 2) + { + auto sp = &sprite[i]; + if (badguy(&sprite[i]) || sp->picnum == TILE_APLAYER) + { + if (sp->picnum == TILE_APLAYER && + (isRR() && ud.ffire == 0) && + ud.coop == 1 && + s->picnum == TILE_APLAYER && + s != &sprite[i]) + continue; + + if (gotshrinker && sprite[i].xrepeat < 30 && !(actorinfo[sp->picnum].flags & SFLAG_SHRINKAUTOAIM)) continue; + if (gotfreezer && sprite[i].pal == 1) continue; + } + + xv = (sp->x - s->x); + yv = (sp->y - s->y); + + if ((dy1 * xv) <= (dx1 * yv)) + if ((dy2 * xv) >= (dx2 * yv)) + { + sdist = mulscale(dx3, xv, 14) + mulscale(dy3, yv, 14); + if (sdist > 512 && sdist < smax) + { + if (s->picnum == TILE_APLAYER) + a = (abs(scale(sp->z - s->z, 10, sdist) - (ps[s->yvel].gethorizdiff() - 100)) < 100); + else a = 1; + + cans = cansee(sp->x, sp->y, sp->z - (32 << 8) + actorinfo[sp->picnum].aimoffset, sp->sectnum, s->x, s->y, s->z - (32 << 8), s->sectnum); + + if (a && cans) + { + smax = sdist; + j = i; + } + } + } + } + } + + return j; +} + + + END_DUKE_NS diff --git a/source/games/duke/src/player.h b/source/games/duke/src/player.h index 9923951a2..5f2337b9e 100644 --- a/source/games/duke/src/player.h +++ b/source/games/duke/src/player.h @@ -180,6 +180,7 @@ typedef struct player_struct { void setoang(int v) { oq16ang = v << FRACBITS; } void addhoriz(int v) { q16horiz += (v << FRACBITS); } int gethoriz() { return q16horiz >> FRACBITS; } + int gethorizdiff() { return (q16horiz + q16horizoff) >> FRACBITS; } int32_t truefz, truecz, player_par; int32_t randomflamex, exitx, exity; @@ -257,7 +258,7 @@ typedef struct player_struct { int16_t moto_bump, moto_bump_target, moto_turb; int16_t drug_stat[3]; int32_t drug_aspect; - uint8_t drug_mode, lotag800kill, sea_sick_stat; + uint8_t DrugMode, lotag800kill, sea_sick_stat; int32_t drug_timer; int32_t sea_sick; uint8_t hurt_delay2, nocheat; @@ -356,12 +357,6 @@ extern int32_t ticrandomseed; #define SHOOT_HARDCODED_ZVEL INT32_MIN -int A_Shoot(int spriteNum, int projecTile); -inline int shoot(int s, int p) -{ - return A_Shoot(s, p); -} - static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_t g, uint8_t b) { pPlayer->pals.f = f; @@ -380,8 +375,7 @@ inline void SetPlayerPal(DukePlayer_t* pPlayer, PalEntry pe) 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); } +int hits(int spriteNum); void P_GetInput(int playerNum); void P_GetInputMotorcycle(int playerNum); void P_GetInputBoat(int playerNum); @@ -405,11 +399,7 @@ void getzsofslope_player(int sectNum, int playerX, int playerY, int32_t *pCeilZ, void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer); void P_ProcessInput(int playerNum); void P_DHProcessInput(int playerNum); -void P_QuickKill(DukePlayer_t *pPlayer); -inline void quickkill(DukePlayer_t* pPlayer) -{ - P_QuickKill(pPlayer); -} +void quickkill(DukePlayer_t* pPlayer); void P_SelectNextInvItem(DukePlayer_t *pPlayer); void P_UpdateScreenPal(DukePlayer_t *pPlayer); inline void setpal(DukePlayer_t* pPlayer) @@ -455,6 +445,11 @@ extern int16_t max_ammo_amount[MAX_WEAPONS]; void P_SetWeaponGamevars(int playerNum, const DukePlayer_t* const pPlayer); +void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n); +int hits(int i); +int hitasprite(int i, short* hitsp); +int aim(spritetype* s, int aang); + END_DUKE_NS #endif diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 68b23c24d..a419c2f55 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -34,7 +34,1062 @@ source as it is released. #include "ns.h" #include "global.h" +#include "game.h" +#include "gamevar.h" +#include "player.h" +#include "names.h" BEGIN_DUKE_NS +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void incur_damage_d(struct player_struct* p) +{ + int damage = 0L, shield_damage = 0L; + + sprite[p->i].extra -= p->extra_extra8 >> 8; + + damage = sprite[p->i].extra - p->last_extra; + + if (damage < 0) + { + p->extra_extra8 = 0; + + if (p->shield_amount > 0) + { + shield_damage = damage * (20 + (rand() % 30)) / 100; + damage -= shield_damage; + + p->shield_amount += shield_damage; + + if (p->shield_amount < 0) + { + damage += p->shield_amount; + p->shield_amount = 0; + } + } + + sprite[p->i].extra = p->last_extra + damage; + } +} + + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void shoot_d(int i, int atwith) +{ + short sect, hitsect, hitspr, hitwall, l, sa, p, j, k, scount; + int sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal; + unsigned char sizx, sizy; + spritetype* const s = &sprite[i]; + if (s->picnum == TILE_APLAYER) + { + p = s->yvel; + } + else + { + p = -1; + } + + + sect = s->sectnum; + zvel = 0; + + if (s->picnum == TILE_APLAYER) + { + sx = ps[p].posx; + sy = ps[p].posy; + sz = ps[p].posz + ps[p].pyoff + (4 << 8); + sa = ps[p].getang(); + + ps[p].crack_time = 777; + + } + else + { + sa = s->ang; + sx = s->x; + sy = s->y; + sz = s->z - ((s->yrepeat * tilesiz[s->picnum].y) << 1) + (4 << 8); + if (s->picnum != ROTATEGUN) + { + sz -= (7 << 8); + if (badguy(s) && s->picnum != COMMANDER) + { + sx += (sintable[(sa + 1024 + 96) & 2047] >> 7); + sy += (sintable[(sa + 512 + 96) & 2047] >> 7); + } + } + } + + if (isWorldTour()) + { // Twentieth Anniversary World Tour + switch (atwith) + { + case FIREBALL: + { + if (s->extra >= 0) + s->shade = -96; + + sz -= (4 << 7); + if (sprite[i].picnum != BOSS5) + vel = 840; + else { + vel = 968; + sz += 6144; + } + + if (p < 0) + { + sa += 16 - (krand() & 31); + int scratch; + j = findplayer(s, &scratch); + zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s); + } + else + { + zvel = 98 * (100 + ps[p].gethorizdiff()); + sx += sintable[(sa + 860) & 0x7FF] / 448; + sy += sintable[(sa + 348) & 0x7FF] / 448; + sz += (3 << 8); + } + + sizx = 18; + sizy = 18; + if (p >= 0) + { + sizx = 7; + sizy = 7; + } + + j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, (short)4); + auto spr = &sprite[j]; + spr->extra += (krand() & 7); + if (sprite[i].picnum == BOSS5 || p >= 0) + { + spr->xrepeat = 40; + spr->yrepeat = 40; + } + spr->yvel = p; + spr->cstat = 128; + spr->clipdist = 4; + return; + } + case FLAMETHROWERFLAME: + if (s->extra >= 0) + s->shade = -96; + vel = 400; + + k = -1; + if (p < 0) + { + j = findplayer(s, &x); + sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy); + + if (sprite[i].picnum == BOSS5) + { + vel = 528; + sz += 6144; + } + else if (sprite[i].picnum == BOSS3) + sz -= 8192; + + l = ldist(&sprite[ps[j].i], s); + if (l != 0) + zvel = ((ps[j].oposz - sz) * vel) / l; + + if (badguy(s) && (s->hitag & face_player_smart) != 0) + sa = (short)(s->ang + (krand() & 31) - 16); + + if (sector[s->sectnum].lotag == 2 && (krand() % 5) == 0) + k = fi.spawn(i, WATERBUBBLE); + } + else + { + zvel = (int)(100 - ps[p].gethorizdiff()) * 81; + if (sprite[ps[p].i].xvel != 0) + vel = (int)((((512 - (1024 + - abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024))) + * 0.001953125f) * sprite[ps[p].i].xvel) + 400); + if (sector[s->sectnum].lotag == 2 && (krand() % 5) == 0) + k = fi.spawn(i, WATERBUBBLE); + } + + if (k == -1) + { + k = fi.spawn(i, atwith); + sprite[k].xvel = (short)vel; + sprite[k].zvel = (short)zvel; + } + + sprite[k].x = sx + sintable[(sa + 630) & 0x7FF] / 448; + sprite[k].y = sy + sintable[(sa + 112) & 0x7FF] / 448; + sprite[k].z = sz - 256; + sprite[k].sectnum = sect; + sprite[k].cstat = 0x80; + sprite[k].ang = sa; + sprite[k].xrepeat = 2; + sprite[k].yrepeat = 2; + sprite[k].clipdist = 40; + sprite[k].yvel = p; + sprite[k].owner = (short)i; + + if (p == -1) + { + if (sprite[i].picnum == BOSS5) + { + sprite[k].x -= sintable[sa & 2047] / 56; + sprite[k].y -= sintable[(sa + 1024 + 512) & 2047] / 56; + sprite[k].xrepeat = 10; + sprite[k].yrepeat = 10; + } + } + return; + case FIREFLY: // BOSS5 shot + k = fi.spawn(i, atwith); + sprite[k].sectnum = sect; + sprite[k].x = sx; + sprite[k].y = sy; + sprite[k].z = sz; + sprite[k].ang = sa; + sprite[k].xvel = 500; + sprite[k].zvel = 0; + return; + } + } + + switch (atwith) + { + case BLOODSPLAT1: + case BLOODSPLAT2: + case BLOODSPLAT3: + case BLOODSPLAT4: + + if (p >= 0) + sa += 64 - (krand() & 127); + else sa += 1024 + 64 - (krand() & 127); + zvel = 1024 - (krand() & 2047); + case KNEE: + if (atwith == KNEE) + { + if (p >= 0) + { + zvel = (100 - ps[p].gethorizdiff()) << 5; + sz += (6 << 8); + sa += 15; + } + else + { + j = ps[findplayer(s, &x)].i; + zvel = ((sprite[j].z - sz) << 8) / (x + 1); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + } + + // writestring(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047],zvel<<6); + + hitscan(sx, sy, sz, sect, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], zvel << 6, + &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + + if (atwith == BLOODSPLAT1 || + atwith == BLOODSPLAT2 || + atwith == BLOODSPLAT3 || + atwith == BLOODSPLAT4) + { + if (FindDistance2D(sx - hitx, sy - hity) < 1024) + if (hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE) + if ((wall[hitwall].nextsector >= 0 && hitsect >= 0 && + sector[wall[hitwall].nextsector].lotag == 0 && + sector[hitsect].lotag == 0 && + sector[wall[hitwall].nextsector].lotag == 0 && + (sector[hitsect].floorz - sector[wall[hitwall].nextsector].floorz) > (16 << 8)) || + (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) + if ((wall[hitwall].cstat & 16) == 0) + { + if (wall[hitwall].nextsector >= 0) + { + k = headspritesect[wall[hitwall].nextsector]; + while (k >= 0) + { + if (sprite[k].statnum == 3 && sprite[k].lotag == 13) + return; + k = nextspritesect[k]; + } + } + + if (wall[hitwall].nextwall >= 0 && + wall[wall[hitwall].nextwall].hitag != 0) + return; + + if (wall[hitwall].hitag == 0) + { + k = fi.spawn(i, atwith); + sprite[k].xvel = -12; + sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, + wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + sprite[k].x = hitx; + sprite[k].y = hity; + sprite[k].z = hitz; + sprite[k].cstat |= (krand() & 4); + ssp(k, CLIPMASK0); + setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z); + if (s->picnum == OOZFILTER || s->picnum == NEWBEAST) + sprite[k].pal = 6; + } + } + return; + } + + if (hitsect < 0) break; + + if ((abs(sx - hitx) + abs(sy - hity)) < 1024) + { + if (hitwall >= 0 || hitspr >= 0) + { + j = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, i, 4); + sprite[j].extra += (krand() & 7); + if (p >= 0) + { + k = fi.spawn(j, SMALLSMOKE); + sprite[k].z -= (8 << 8); + spritesound(KICK_HIT, j); + } + + if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400) + sprite[j].extra += (max_player_health >> 2); + + if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2) + { + fi.checkhitsprite(hitspr, j); + if (p >= 0) fi.checkhitswitch(p, hitspr, 1); + } + + else if (hitwall >= 0) + { + if (wall[hitwall].cstat & 2) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + hitwall = wall[hitwall].nextwall; + + if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2) + { + fi.checkhitwall(j, hitwall, hitx, hity, hitz, atwith); + if (p >= 0) fi.checkhitswitch(p, hitwall, 0); + } + } + } + else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) + { + j = fi.spawn(ps[p].i, WATERSPLASH2); + sprite[j].x = hitx; + sprite[j].y = hity; + sprite[j].ang = ps[p].getang(); // Total tweek + sprite[j].xvel = 32; + ssp(i, CLIPMASK0); + sprite[j].xvel = 0; + + } + } + + break; + + case SHOTSPARK1: + case SHOTGUN: + case CHAINGUN: + + if (s->extra >= 0) s->shade = -96; + + if (p >= 0) + { + if (isWW2GI()) + { + SetGameVarID(g_iAimAngleVarID, AUTO_AIM_ANGLE, i, p); + OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); + j = -1; + if (GetGameVarID(g_iAimAngleVarID, i, p) > 0) + { + j = aim(s, GetGameVarID(g_iAimAngleVarID, i, p)); + } + } + else + j = aim(s, AUTO_AIM_ANGLE); + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (5 << 8); + switch (sprite[j].picnum) + { + case GREENSLIME: + case GREENSLIME + 1: + case GREENSLIME + 2: + case GREENSLIME + 3: + case GREENSLIME + 4: + case GREENSLIME + 5: + case GREENSLIME + 6: + case GREENSLIME + 7: + case ROTATEGUN: + dal -= (8 << 8); + break; + } + zvel = ((sprite[j].z - sz - dal) << 8) / ldist(&sprite[ps[p].i], &sprite[j]); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + + if (isWW2GI()) + { + int angRange = 32; + int zRange = 256; + SetGameVarID(g_iAngRangeVarID, 32, i, p); + SetGameVarID(g_iZRangeVarID, 256, i, p); + OnEvent(EVENT_GETSHOTRANGE, i, p, -1); + angRange = GetGameVarID(g_iAngRangeVarID, i, p); + zRange = GetGameVarID(g_iZRangeVarID, i, p); + + sa += (angRange / 2) - (krand() & (angRange - 1)); + if (j == -1) + { + // no target + zvel = (100 - ps[p].gethorizdiff()) << 5; + } + zvel += (zRange / 2) - (krand() & (zRange - 1)); + } + else if (j == -1 || atwith != SHOTSPARK1) + { + sa += 16 - (krand() & 31); + zvel = (100 - ps[p].gethorizdiff()) << 5; + zvel += 128 - (krand() & 255); + } + + sz -= (2 << 8); + } + else + { + j = findplayer(s, &x); + sz -= (4 << 8); + zvel = ((ps[j].posz - sz) << 8) / (ldist(&sprite[ps[j].i], s)); + if (s->picnum != BOSS1) + { + zvel += 128 - (krand() & 255); + sa += 32 - (krand() & 63); + } + else + { + zvel += 128 - (krand() & 255); + sa = getangle(ps[j].posx - sx, ps[j].posy - sy) + 64 - (krand() & 127); + } + } + + s->cstat &= ~257; + hitscan(sx, sy, sz, sect, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], + zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + s->cstat |= 257; + + if (hitsect < 0) return; + + if ((krand() & 15) == 0 && sector[hitsect].lotag == 2) + tracers(hitx, hity, hitz, sx, sy, sz, 8 - (ud.multimode >> 1)); + + if (p >= 0) + { + k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, i, 4); + sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress]; + sprite[k].extra += (krand() % 6); + + if (hitwall == -1 && hitspr == -1) + { + if (zvel < 0) + { + if (sector[hitsect].ceilingstat & 1) + { + sprite[k].xrepeat = 0; + sprite[k].yrepeat = 0; + return; + } + else + fi.checkhitceiling(hitsect); + } + fi.spawn(k, SMALLSMOKE); + } + + if (hitspr >= 0) + { + fi.checkhitsprite(hitspr, k); + if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) + { + l = fi.spawn(k, JIBS6); + sprite[k].xrepeat = sprite[k].yrepeat = 0; + sprite[l].z += (4 << 8); + sprite[l].xvel = 16; + sprite[l].xrepeat = sprite[l].yrepeat = 24; + sprite[l].ang += 64 - (krand() & 127); + } + else fi.spawn(k, SMALLSMOKE); + + if (p >= 0 && ( + sprite[hitspr].picnum == DIPSWITCH || + sprite[hitspr].picnum == DIPSWITCH + 1 || + sprite[hitspr].picnum == DIPSWITCH2 || + sprite[hitspr].picnum == DIPSWITCH2 + 1 || + sprite[hitspr].picnum == DIPSWITCH3 || + sprite[hitspr].picnum == DIPSWITCH3 + 1 || + sprite[hitspr].picnum == HANDSWITCH || + sprite[hitspr].picnum == HANDSWITCH + 1)) + { + fi.checkhitswitch(p, hitspr, 1); + return; + } + } + else if (hitwall >= 0) + { + fi.spawn(k, SMALLSMOKE); + + if (fi.isadoorwall(wall[hitwall].picnum) == 1) + goto SKIPBULLETHOLE; + if (p >= 0 && ( + wall[hitwall].picnum == DIPSWITCH || + wall[hitwall].picnum == DIPSWITCH + 1 || + wall[hitwall].picnum == DIPSWITCH2 || + wall[hitwall].picnum == DIPSWITCH2 + 1 || + wall[hitwall].picnum == DIPSWITCH3 || + wall[hitwall].picnum == DIPSWITCH3 + 1 || + wall[hitwall].picnum == HANDSWITCH || + wall[hitwall].picnum == HANDSWITCH + 1)) + { + fi.checkhitswitch(p, hitwall, 0); + return; + } + + if (wall[hitwall].hitag != 0 || (wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0)) + goto SKIPBULLETHOLE; + + if (hitsect >= 0 && sector[hitsect].lotag == 0) + if (wall[hitwall].overpicnum != BIGFORCE) + if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) || + (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) + if ((wall[hitwall].cstat & 16) == 0) + { + if (wall[hitwall].nextsector >= 0) + { + l = headspritesect[wall[hitwall].nextsector]; + while (l >= 0) + { + if (sprite[l].statnum == 3 && sprite[l].lotag == 13) + goto SKIPBULLETHOLE; + l = nextspritesect[l]; + } + } + + l = headspritestat[5]; + while (l >= 0) + { + if (sprite[l].picnum == BULLETHOLE) + if (dist(&sprite[l], &sprite[k]) < (12 + (krand() & 7))) + goto SKIPBULLETHOLE; + l = nextspritestat[l]; + } + l = fi.spawn(k, BULLETHOLE); + sprite[l].xvel = -1; + sprite[l].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, + wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + ssp(l, CLIPMASK0); + } + + SKIPBULLETHOLE: + + if (wall[hitwall].cstat & 2) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + hitwall = wall[hitwall].nextwall; + + fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1); + } + } + else + { + k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, i, 4); + sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress]; + + if (hitspr >= 0) + { + fi.checkhitsprite(hitspr, k); + if (sprite[hitspr].picnum != TILE_APLAYER) + fi.spawn(k, SMALLSMOKE); + else sprite[k].xrepeat = sprite[k].yrepeat = 0; + } + else if (hitwall >= 0) { + + fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1); + } + } + + if ((krand() & 255) < 4) + { + vec3_t v{ hitx, hity, hitz }; + S_PlaySound3D(PISTOL_RICOCHET, k, &v); + } + + return; + + case FIRELASER: + case SPIT: + case COOLEXPLOSION1: + + if (s->extra >= 0) s->shade = -96; + + scount = 1; + if (atwith == SPIT) vel = 292; + else + { + if (atwith == COOLEXPLOSION1) + { + if (s->picnum == BOSS2) vel = 644; + else vel = 348; + sz -= (4 << 7); + } + else + { + vel = 840; + sz -= (4 << 7); + } + } + + if (p >= 0) + { + j = aim(s, AUTO_AIM_ANGLE); + + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8); + zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else + zvel = (100 - ps[p].gethorizdiff()) * 98; + } + else + { + j = findplayer(s, &x); + // sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + sa += 16 - (krand() & 31); + zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s); + } + + oldzvel = zvel; + + if (atwith == SPIT) { sizx = 18; sizy = 18, sz -= (10 << 8); } + else + { + if (atwith == FIRELASER) + { + if (p >= 0) + { + + sizx = 34; + sizy = 34; + } + else + { + sizx = 18; + sizy = 18; + } + } + else + { + sizx = 18; + sizy = 18; + } + } + + if (p >= 0) sizx = 7, sizy = 7; + + while (scount > 0) + { + j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4); + sprite[j].extra += (krand() & 7); + + if (atwith == COOLEXPLOSION1) + { + sprite[j].shade = 0; + if (s->picnum == BOSS2) + { + l = sprite[j].xvel; + sprite[j].xvel = 1024; + ssp(j, CLIPMASK0); + sprite[j].xvel = l; + sprite[j].ang += 128 - (krand() & 255); + } + } + + sprite[j].cstat = 128; + sprite[j].clipdist = 4; + + sa = s->ang + 32 - (krand() & 63); + zvel = oldzvel + 512 - (krand() & 1023); + + scount--; + } + + return; + + case FREEZEBLAST: + sz += (3 << 8); + case RPG: + + if (s->extra >= 0) s->shade = -96; + + scount = 1; + vel = 644; + + j = -1; + + if (p >= 0) + { + j = aim(s, 48); + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (8 << 8); + zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]); + if (sprite[j].picnum != RECON) + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else zvel = (100 - ps[p].gethorizdiff()) * 81; + if (atwith == RPG) + spritesound(RPG_SHOOT, i); + + } + else + { + j = findplayer(s, &x); + sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy); + if (s->picnum == BOSS3) + { + int zoffs = (32 << 8); + if (isWorldTour()) // Twentieth Anniversary World Tour + zoffs = (int)((sprite[i].yrepeat / 80.0f) * zoffs); + sz -= zoffs; + } + else if (s->picnum == BOSS2) + { + vel += 128; + int zoffs = 24 << 8; + if (isWorldTour()) // Twentieth Anniversary World Tour + zoffs = (int)((sprite[i].yrepeat / 80.0f) * zoffs); + sz += zoffs; + } + + l = ldist(&sprite[ps[j].i], s); + zvel = ((ps[j].oposz - sz) * vel) / l; + + if (badguy(s) && (s->hitag & face_player_smart)) + sa = s->ang + (krand() & 31) - 16; + } + + if (p >= 0 && j >= 0) + l = j; + else l = -1; + + j = EGS(sect, + sx + (sintable[(348 + sa + 512) & 2047] / 448), + sy + (sintable[(sa + 348) & 2047] / 448), + sz - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, i, 4); + + sprite[j].extra += (krand() & 7); + if (atwith != FREEZEBLAST) + sprite[j].yvel = l; + else + { + sprite[j].yvel = numfreezebounces; + sprite[j].xrepeat >>= 1; + sprite[j].yrepeat >>= 1; + sprite[j].zvel -= (2 << 4); + } + + if (p == -1) + { + if (s->picnum == BOSS3) + { + int xoffs = sintable[sa & 2047] >> 6; + int yoffs = sintable[(sa + 1024 + 512) & 2047] >> 6; + int aoffs = 4; + + if ((krand() & 1) != 0) + { + xoffs = -xoffs; + yoffs = -yoffs; + aoffs = -8; + } + + if (isWorldTour()) // Twentieth Anniversary World Tour + { + float siz = sprite[i].yrepeat / 80.0f; + xoffs *= siz; + yoffs *= siz; + aoffs *= siz; + } + + sprite[j].x += xoffs; + sprite[j].y += yoffs; + sprite[j].ang += aoffs; + + sprite[j].xrepeat = 42; + sprite[j].yrepeat = 42; + } + else if (s->picnum == BOSS2) + { + sprite[j].x -= sintable[sa & 2047] / 56; + sprite[j].y -= sintable[(sa + 1024 + 512) & 2047] / 56; + sprite[j].ang -= 8 + (krand() & 255) - 128; + sprite[j].xrepeat = 24; + sprite[j].yrepeat = 24; + } + else if (atwith != FREEZEBLAST) + { + sprite[j].xrepeat = 30; + sprite[j].yrepeat = 30; + sprite[j].extra >>= 2; + } + } + else if ((isWW2GI() && aplWeaponWorksLike[ps[p].curr_weapon][p] == DEVISTATOR_WEAPON) || (!isWW2GI() && ps[p].curr_weapon == DEVISTATOR_WEAPON)) + { + sprite[j].extra >>= 2; + sprite[j].ang += 16 - (krand() & 31); + sprite[j].zvel += 256 - (krand() & 511); + + if (ps[p].hbomb_hold_delay) + { + sprite[j].x -= sintable[sa & 2047] / 644; + sprite[j].y -= sintable[(sa + 1024 + 512) & 2047] / 644; + } + else + { + sprite[j].x += sintable[sa & 2047] >> 8; + sprite[j].y += sintable[(sa + 1024 + 512) & 2047] >> 8; + } + sprite[j].xrepeat >>= 1; + sprite[j].yrepeat >>= 1; + } + + sprite[j].cstat = 128; + if (atwith == RPG) + sprite[j].clipdist = 4; + else + sprite[j].clipdist = 40; + + break; + + case HANDHOLDINGLASER: + + if (p >= 0) + zvel = (100 - ps[p].gethorizdiff()) * 32; + else zvel = 0; + + hitscan(sx, sy, sz - ps[p].pyoff, sect, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], + zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + + j = 0; + if (hitspr >= 0) break; + + if (hitwall >= 0 && hitsect >= 0) + if (((hitx - sx) * (hitx - sx) + (hity - sy) * (hity - sy)) < (290 * 290)) + { + if (wall[hitwall].nextsector >= 0) + { + if (sector[wall[hitwall].nextsector].lotag <= 2 && sector[hitsect].lotag <= 2) + j = 1; + } + else if (sector[hitsect].lotag <= 2) + j = 1; + } + + if (j == 1) + { + k = EGS(hitsect, hitx, hity, hitz, TRIPBOMB, -16, 4, 5, sa, 0, 0, i, 6); + if (isWW2GI()) + { + int lTripBombControl = GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, -1, -1); + if (lTripBombControl & TRIPBOMB_TIMER) + { + int lLifetime = GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, -1, p); + int lLifetimeVar = GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, p); + // set timer. blows up when at zero.... + sprite[k].extra = lLifetime + + mulscale(krand(), lLifetimeVar, 14) + - lLifetimeVar; + } + } + + sprite[k].hitag = k; + spritesound(LASERTRIP_ONWALL, k); + sprite[k].xvel = -20; + ssp(k, CLIPMASK0); + sprite[k].cstat = 16; + hittype[k].temp_data[5] = sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) - 512; + + if (isWW2GI() && p >= 0) + ps[p].ammo_amount[TRIPBOMB_WEAPON]--; + + } + return; + + case BOUNCEMINE: + case MORTER: + + if (s->extra >= 0) s->shade = -96; + + j = ps[findplayer(s, &x)].i; + x = ldist(&sprite[j], s); + + zvel = -x >> 1; + + if (zvel < -4096) + zvel = -2048; + vel = x >> 4; + + EGS(sect, + sx + (sintable[(512 + sa + 512) & 2047] >> 8), + sy + (sintable[(sa + 512) & 2047] >> 8), + sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, i, 1); + break; + + case GROWSPARK: + + if (p >= 0) + { + j = aim(s, AUTO_AIM_ANGLE); + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (5 << 8); + switch (sprite[j].picnum) + { + case GREENSLIME: + case GREENSLIME + 1: + case GREENSLIME + 2: + case GREENSLIME + 3: + case GREENSLIME + 4: + case GREENSLIME + 5: + case GREENSLIME + 6: + case GREENSLIME + 7: + case ROTATEGUN: + dal -= (8 << 8); + break; + } + zvel = ((sprite[j].z - sz - dal) << 8) / (ldist(&sprite[ps[p].i], &sprite[j])); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else + { + sa += 16 - (krand() & 31); + zvel = (100 - ps[p].gethorizdiff()) << 5; + zvel += 128 - (krand() & 255); + } + + sz -= (2 << 8); + } + else + { + j = findplayer(s, &x); + sz -= (4 << 8); + zvel = ((ps[j].posz - sz) << 8) / (ldist(&sprite[ps[j].i], s)); + zvel += 128 - (krand() & 255); + sa += 32 - (krand() & 63); + } + + k = 0; + + // RESHOOTGROW: + + s->cstat &= ~257; + hitscan(sx, sy, sz, sect, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], + zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + + s->cstat |= 257; + + j = EGS(sect, hitx, hity, hitz, GROWSPARK, -16, 28, 28, sa, 0, 0, i, 1); + + sprite[j].pal = 2; + sprite[j].cstat |= 130; + sprite[j].xrepeat = sprite[j].yrepeat = 1; + + if (hitwall == -1 && hitspr == -1 && hitsect >= 0) + { + if (zvel < 0 && (sector[hitsect].ceilingstat & 1) == 0) + fi.checkhitceiling(hitsect); + } + else if (hitspr >= 0) fi.checkhitsprite(hitspr, j); + else if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2) + { + /* if(wall[hitwall].overpicnum == MIRROR && k == 0) + { + l = getangle( + wall[wall[hitwall].point2].x-wall[hitwall].x, + wall[wall[hitwall].point2].y-wall[hitwall].y); + + sx = hitx; + sy = hity; + sz = hitz; + sect = hitsect; + sa = ((l<<1) - sa)&2047; + sx += sintable[(sa+512)&2047]>>12; + sy += sintable[sa&2047]>>12; + + k++; + goto RESHOOTGROW; + } + else */ + fi.checkhitwall(j, hitwall, hitx, hity, hitz, atwith); + } + + break; + + case SHRINKER: + if (s->extra >= 0) s->shade = -96; + if (p >= 0) + { + j = isNamWW2GI()? -1 : aim(s, AUTO_AIM_ANGLE); + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1); + zvel = ((sprite[j].z - sz - dal - (4 << 8)) * 768) / (ldist(&sprite[ps[p].i], &sprite[j])); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else zvel = (100 - ps[p].gethorizdiff()) * 98; + } + else if (s->statnum != 3) + { + j = findplayer(s, &x); + l = ldist(&sprite[ps[j].i], s); + zvel = ((ps[j].oposz - sz) * 512) / l; + } + else zvel = 0; + + j = EGS(sect, + sx + (sintable[(512 + sa + 512) & 2047] >> 12), + sy + (sintable[(sa + 512) & 2047] >> 12), + sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, i, 4); + + sprite[j].cstat = 128; + sprite[j].clipdist = 32; + + + return; + } + return; +} + + END_DUKE_NS diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 28c050b00..67959f11a 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -27,7 +27,917 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "ns.h" #include "global.h" +#include "game.h" +#include "names_rr.h" BEGIN_DUKE_NS +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void incur_damage_r(struct player_struct* p) +{ + long damage = 0L, unk = 0L, shield_damage = 0L; + short gut = 0; + + sprite[p->i].extra -= p->extra_extra8 >> 8; + + damage = sprite[p->i].extra - p->last_extra; + if (damage < 0) + { + p->extra_extra8 = 0; + + if (p->steroids_amount > 0 && p->steroids_amount < 400) + { + shield_damage = damage * (20 + (krand() % 30)) / 100; + damage -= shield_damage; + } + if (p->drink_amt > 31 && p->drink_amt < 65) + gut++; + if (p->eat > 31 && p->eat < 65) + gut++; + + switch (gut) + { + double ddamage; + case 1: + ddamage = damage; + ddamage *= 0.75; + damage = ddamage; + break; + case 2: + ddamage = damage; + ddamage *= 0.25; + damage = ddamage; + break; + } + + sprite[p->i].extra = p->last_extra + damage; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void shoot_r(int i, int atwith) +{ + short sect, hitsect, hitspr, hitwall, l, sa, p, j, k, scount; + int sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal; + uint8_t sizx, sizy; + spritetype* s; + + s = &sprite[i]; + sect = s->sectnum; + zvel = 0; + + if (s->picnum == TILE_APLAYER) + { + p = s->yvel; + + sx = ps[p].posx; + sy = ps[p].posy; + sz = ps[p].posz + ps[p].pyoff + (4 << 8); + sa = ps[p].getang(); + + if (isRRRA()) ps[p].crack_time = 777; + } + else + { + p = -1; + sa = s->ang; + sx = s->x; + sy = s->y; + sz = s->z - ((s->yrepeat * tilesiz[s->picnum].y) << 1) + (4 << 8); + sz -= (7 << 8); + if (badguy(s)) + { + sx += (sintable[(sa + 1024 + 96) & 2047] >> 7); + sy += (sintable[(sa + 512 + 96) & 2047] >> 7); + } + } + + switch (atwith) + { + case SLINGBLADE: + if (!isRRRA()) break; + goto rrra_slingblade; + + case BLOODSPLAT1: + case BLOODSPLAT2: + case BLOODSPLAT3: + case BLOODSPLAT4: + + if (p >= 0) + sa += 64 - (krand() & 127); + else sa += 1024 + 64 - (krand() & 127); + zvel = 1024 - (krand() & 2047); + case KNEE: + case GROWSPARK: + rrra_slingblade: + if (atwith == KNEE || atwith == GROWSPARK || atwith == SLINGBLADE) + { + if (p >= 0) + { + zvel = (100 - ps[p].gethorizdiff()) << 5; + sz += (6 << 8); + sa += 15; + } + else + { + j = ps[findplayer(s, &x)].i; + zvel = ((sprite[j].z - sz) << 8) / (x + 1); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + } + + hitscan(sx, sy, sz, sect, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], zvel << 6, + &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + + if (isRRRA() && ((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0)) + && hitspr == -1 && hitwall == -1) + { + short ii; + for (ii = 0; ii < MAXSPRITES; ii++) + { + if (sprite[ii].sectnum == hitsect && sprite[ii].picnum == SECTOREFFECTOR + && sprite[ii].lotag == 7) + { + int nx, ny, nz; + nx = hitx + (sprite[sprite[ii].owner].x - sprite[ii].x); + ny = hity + (sprite[sprite[ii].owner].y - sprite[ii].y); + if (sector[hitsect].lotag == 161) + { + nz = sector[sprite[sprite[ii].owner].sectnum].floorz; + } + else + { + nz = sector[sprite[sprite[ii].owner].sectnum].ceilingz; + } + hitscan(nx, ny, nz, sprite[sprite[ii].owner].sectnum, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], zvel << 6, + &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + break; + } + } + } + + if (atwith == BLOODSPLAT1 || + atwith == BLOODSPLAT2 || + atwith == BLOODSPLAT3 || + atwith == BLOODSPLAT4) + { + if (FindDistance2D(sx - hitx, sy - hity) < 1024) + if (hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE) + if ((wall[hitwall].nextsector >= 0 && hitsect >= 0 && + sector[wall[hitwall].nextsector].lotag == 0 && + sector[hitsect].lotag == 0 && + sector[wall[hitwall].nextsector].lotag == 0 && + (sector[hitsect].floorz - sector[wall[hitwall].nextsector].floorz) > (16 << 8)) || + (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) + if ((wall[hitwall].cstat & 16) == 0) + { + if (wall[hitwall].nextsector >= 0) + { + k = headspritesect[wall[hitwall].nextsector]; + while (k >= 0) + { + if (sprite[k].statnum == 3 && sprite[k].lotag == 13) + return; + k = nextspritesect[k]; + } + } + + if (wall[hitwall].nextwall >= 0 && + wall[wall[hitwall].nextwall].hitag != 0) + return; + + if (wall[hitwall].hitag == 0) + { + k = fi.spawn(i, atwith); + sprite[k].xvel = -12; + sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, + wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + sprite[k].x = hitx; + sprite[k].y = hity; + sprite[k].z = hitz; + sprite[k].cstat |= (krand() & 4); + ssp(k, CLIPMASK0); + setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z); + if (s->picnum == OOZFILTER) + sprite[k].pal = 6; + } + } + return; + } + + if (hitsect < 0) break; + + if ((abs(sx - hitx) + abs(sy - hity)) < 1024) + { + if (hitwall >= 0 || hitspr >= 0) + { + if (isRRRA() && atwith == SLINGBLADE) + { + j = EGS(hitsect, hitx, hity, hitz, SLINGBLADE, -15, 0, 0, sa, 32, 0, i, 4); + sprite[j].extra += 50; + } + else + { + j = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, i, 4); + sprite[j].extra += (krand() & 7); + } + if (p >= 0) + { + k = fi.spawn(j, SMALLSMOKE); + sprite[k].z -= (8 << 8); + if (atwith == KNEE) + spritesound(KICK_HIT, j); + else if (isRRRA() && atwith == SLINGBLADE) + spritesound(260, j); + } + + if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400) + sprite[j].extra += (max_player_health >> 2); + + if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2) + { + fi.checkhitsprite(hitspr, j); + if (p >= 0) fi.checkhitswitch(p, hitspr, 1); + } + else if (hitwall >= 0) + { + if (wall[hitwall].cstat & 2) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + hitwall = wall[hitwall].nextwall; + + if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2) + { + fi.checkhitwall(j, hitwall, hitx, hity, hitz, atwith); + if (p >= 0) fi.checkhitswitch(p, hitwall, 0); + } + } + } + else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) + { + j = fi.spawn(ps[p].i, WATERSPLASH2); + sprite[j].x = hitx; + sprite[j].y = hity; + sprite[j].ang = ps[p].getang(); // Total tweek + sprite[j].xvel = 32; + ssp(i, 0); + sprite[j].xvel = 0; + + } + } + + break; + + case SHOTSPARK1: + case SHOTGUN: + case CHAINGUN: + + if (s->extra >= 0) s->shade = -96; + + if (p >= 0) + { + j = aim(s, AUTO_AIM_ANGLE); + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (5 << 8); + zvel = ((sprite[j].z - sz - dal) << 8) / ldist(&sprite[ps[p].i], &sprite[j]); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + + if (atwith == SHOTSPARK1) + { + if (j == -1) + { + sa += 16 - (krand() & 31); + zvel = (100 - ps[p].gethorizdiff()) << 5; + zvel += 128 - (krand() & 255); + } + } + else + { + if (atwith == SHOTGUN) + sa += 64 - (krand() & 127); + else + sa += 16 - (krand() & 31); + if (j == -1) zvel = (100 - ps[p].gethorizdiff()) << 5; + zvel += 128 - (krand() & 255); + } + sz -= (2 << 8); + } + else + { + j = findplayer(s, &x); + sz -= (4 << 8); + zvel = ((ps[j].posz - sz) << 8) / (ldist(&sprite[ps[j].i], s)); + if (s->picnum != BOSS1) + { + zvel += 128 - (krand() & 255); + sa += 32 - (krand() & 63); + } + else + { + zvel += 128 - (krand() & 255); + sa = getangle(ps[j].posx - sx, ps[j].posy - sy) + 64 - (krand() & 127); + } + } + + s->cstat &= ~257; + hitscan(sx, sy, sz, sect, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], + zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + + if (isRRRA() && (((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0)) + && hitspr == -1 && hitwall == -1)) + { + short ii; + for (ii = 0; ii < MAXSPRITES; ii++) + { + if (sprite[ii].sectnum == hitsect && sprite[ii].picnum == SECTOREFFECTOR + && sprite[ii].lotag == 7) + { + int nx, ny, nz; + nx = hitx + (sprite[sprite[ii].owner].x - sprite[ii].x); + ny = hity + (sprite[sprite[ii].owner].y - sprite[ii].y); + if (sector[hitsect].lotag == 161) + { + nz = sector[sprite[sprite[ii].owner].sectnum].floorz; + } + else + { + nz = sector[sprite[sprite[ii].owner].sectnum].ceilingz; + } + hitscan(nx, ny, nz, sprite[sprite[ii].owner].sectnum, + sintable[(sa + 512) & 2047], + sintable[sa & 2047], zvel << 6, + &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1); + break; + } + } + } + + s->cstat |= 257; + + if (hitsect < 0) return; + + if (atwith == SHOTGUN) + if (sector[hitsect].lotag == 1) + if (krand() & 1) + return; + + if ((krand() & 15) == 0 && sector[hitsect].lotag == 2) + tracers(hitx, hity, hitz, sx, sy, sz, 8 - (ud.multimode >> 1)); + + if (p >= 0) + { + k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, i, 4); + sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress]; + sprite[k].extra += (krand() % 6); + + if (hitwall == -1 && hitspr == -1) + { + if (zvel < 0) + { + if (sector[hitsect].ceilingstat & 1) + { + sprite[k].xrepeat = 0; + sprite[k].yrepeat = 0; + return; + } + else + fi.checkhitceiling(hitsect); + } + if (sector[hitsect].lotag != 1) + fi.spawn(k, SMALLSMOKE); + } + + if (hitspr >= 0) + { + if (sprite[hitspr].picnum == 1930) + return; + fi.checkhitsprite(hitspr, k); + if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) + { + l = fi.spawn(k, JIBS6); + sprite[k].xrepeat = sprite[k].yrepeat = 0; + sprite[l].z += (4 << 8); + sprite[l].xvel = 16; + sprite[l].xrepeat = sprite[l].yrepeat = 24; + sprite[l].ang += 64 - (krand() & 127); + } + else fi.spawn(k, SMALLSMOKE); + + if (p >= 0 && ( + sprite[hitspr].picnum == DIPSWITCH || + sprite[hitspr].picnum == DIPSWITCH + 1 || + sprite[hitspr].picnum == DIPSWITCH2 || + sprite[hitspr].picnum == DIPSWITCH2 + 1 || + sprite[hitspr].picnum == DIPSWITCH3 || + sprite[hitspr].picnum == DIPSWITCH3 + 1 || + (isRRRA() && sprite[hitspr].picnum == RRTILE8660) || + sprite[hitspr].picnum == HANDSWITCH || + sprite[hitspr].picnum == HANDSWITCH + 1)) + { + fi.checkhitswitch(p, hitspr, 1); + return; + } + } + else if (hitwall >= 0) + { + fi.spawn(k, SMALLSMOKE); + + if (fi.isadoorwall(wall[hitwall].picnum) == 1) + goto SKIPBULLETHOLE; + if (isablockdoor(wall[hitwall].picnum) == 1) + goto SKIPBULLETHOLE; + if (p >= 0 && ( + wall[hitwall].picnum == DIPSWITCH || + wall[hitwall].picnum == DIPSWITCH + 1 || + wall[hitwall].picnum == DIPSWITCH2 || + wall[hitwall].picnum == DIPSWITCH2 + 1 || + wall[hitwall].picnum == DIPSWITCH3 || + wall[hitwall].picnum == DIPSWITCH3 + 1 || + (isRRRA() && wall[hitwall].picnum == RRTILE8660) || + wall[hitwall].picnum == HANDSWITCH || + wall[hitwall].picnum == HANDSWITCH + 1)) + { + fi.checkhitswitch(p, hitwall, 0); + return; + } + + if (wall[hitwall].hitag != 0 || (wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0)) + goto SKIPBULLETHOLE; + + if (hitsect >= 0 && sector[hitsect].lotag == 0) + if (wall[hitwall].overpicnum != BIGFORCE) + if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) || + (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) + if ((wall[hitwall].cstat & 16) == 0) + { + if (wall[hitwall].nextsector >= 0) + { + l = headspritesect[wall[hitwall].nextsector]; + while (l >= 0) + { + if (sprite[l].statnum == 3 && sprite[l].lotag == 13) + goto SKIPBULLETHOLE; + l = nextspritesect[l]; + } + } + + l = headspritestat[5]; + while (l >= 0) + { + if (sprite[l].picnum == BULLETHOLE) + if (dist(&sprite[l], &sprite[k]) < (12 + (krand() & 7))) + goto SKIPBULLETHOLE; + l = nextspritestat[l]; + } + l = fi.spawn(k, BULLETHOLE); + sprite[l].xvel = -1; + sprite[l].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, + wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + ssp(l, CLIPMASK0); + } + + SKIPBULLETHOLE: + + if (wall[hitwall].cstat & 2) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + hitwall = wall[hitwall].nextwall; + + fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1); + } + } + else + { + k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, i, 4); + sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress]; + + if (hitspr >= 0) + { + fi.checkhitsprite(hitspr, k); + if (sprite[hitspr].picnum != TILE_APLAYER) + fi.spawn(k, SMALLSMOKE); + else sprite[k].xrepeat = sprite[k].yrepeat = 0; + } + else if (hitwall >= 0) + fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1); + } + + if ((krand() & 255) < 10) + { + vec3_t v{ hitx, hity, hitz }; + S_PlaySound3D(PISTOL_RICOCHET, k, &v); + } + + return; + + case TRIPBOMBSPRITE: + j = fi.spawn(i, atwith); + sprite[j].xvel = 32; + sprite[j].ang = sprite[i].ang; + sprite[j].z -= (5 << 8); + break; + + case BOWLINGBALL: + j = fi.spawn(i, atwith); + sprite[j].xvel = 250; + sprite[j].ang = sprite[i].ang; + sprite[j].z -= (15 << 8); + break; + + case OWHIP: + case UWHIP: + + if (s->extra >= 0) s->shade = -96; + + scount = 1; + if (atwith == 3471) + { + vel = 300; + sz -= (15 << 8); + scount = 1; + } + else if (atwith == 3475) + { + vel = 300; + sz += (4 << 8); + scount = 1; + } + + if (p >= 0) + { + j = aim(s, AUTO_AIM_ANGLE); + + if (j >= 0) + { + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8); + zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else + zvel = (100 - ps[p].gethorizdiff()) * 98; + } + else + { + j = findplayer(s, &x); + // sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + if (s->picnum == VIXEN) + sa -= (krand() & 16); + else + sa += 16 - (krand() & 31); + zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s); + } + + oldzvel = zvel; + sizx = 18; sizy = 18; + + if (p >= 0) sizx = 7, sizy = 7; + else sizx = 8, sizy = 8; + + while (scount > 0) + { + j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4); + sprite[j].extra += (krand() & 7); + + sprite[j].cstat = 128; + sprite[j].clipdist = 4; + + sa = s->ang + 32 - (krand() & 63); + zvel = oldzvel + 512 - (krand() & 1023); + + scount--; + } + + return; + + case FIRELASER: + case SPIT: + case COOLEXPLOSION1: + + if (isRRRA()) + { + if (atwith != SPIT && s->extra >= 0) s->shade = -96; + + scount = 1; + if (atwith == SPIT) + { + if (s->picnum == 8705) + vel = 600; + else + vel = 400; + } + } + else + { + if (s->extra >= 0) s->shade = -96; + + scount = 1; + if (atwith == SPIT) vel = 400; + } + if (atwith != SPIT) + { + vel = 840; + sz -= (4 << 7); + if (s->picnum == 4649) + { + sx += sintable[(s->ang + 512 + 256) & 2047] >> 6; + sy += sintable[(s->ang + 256) & 2047] >> 6; + sz += (12 << 8); + } + if (s->picnum == VIXEN) + { + sz -= (12 << 8); + } + } + + if (p >= 0) + { + j = aim(s, AUTO_AIM_ANGLE); + + if (j >= 0) + { + sx += sintable[(s->ang + 512 + 160) & 2047] >> 7; + sy += sintable[(s->ang + 160) & 2047] >> 7; + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8); + zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]); + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else + { + sx += sintable[(s->ang + 512 + 160) & 2047] >> 7; + sy += sintable[(s->ang + 160) & 2047] >> 7; + zvel = (100 - ps[p].gethorizdiff()) * 98; + } + } + else + { + j = findplayer(s, &x); + // sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + if (s->picnum == HULK) + sa -= (krand() & 31); + else if (s->picnum == VIXEN) + sa -= (krand() & 16); + else if (s->picnum != UFOBEAM) + sa += 16 - (krand() & 31); + + zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s); + } + + oldzvel = zvel; + + if (atwith == SPIT) + { + sizx = 18; sizy = 18; + if (!isRRRA() || s->picnum != MAMA) sz -= (10 << 8); else sz -= (20 << 8); + } + else + { + if (atwith == COOLEXPLOSION1) + { + sizx = 8; + sizy = 8; + } + else if (atwith == FIRELASER) + { + if (p >= 0) + { + + sizx = 34; + sizy = 34; + } + else + { + sizx = 18; + sizy = 18; + } + } + else + { + sizx = 18; + sizy = 18; + } + } + + if (p >= 0) sizx = 7, sizy = 7; + + while (scount > 0) + { + j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4); + sprite[j].extra += (krand() & 7); + sprite[j].cstat = 128; + sprite[j].clipdist = 4; + + sa = s->ang + 32 - (krand() & 63); + zvel = oldzvel + 512 - (krand() & 1023); + + if (atwith == FIRELASER) + { + sprite[j].xrepeat = 8; + sprite[j].yrepeat = 8; + } + + scount--; + } + + return; + + case RPG2: + case RRTILE1790: + if (isRRRA()) goto rrra_rpg2; + else break; + + case FREEZEBLAST: + sz += (3 << 8); + case RPG: + case SHRINKSPARK: + rrra_rpg2: + { + short var90 = 0; + if (s->extra >= 0) s->shade = -96; + + scount = 1; + vel = 644; + + j = -1; + + if (p >= 0) + { + j = aim(s, 48); + if (j >= 0) + { + if (isRRRA() && atwith == RPG2) + { + if (sprite[j].picnum == HEN || sprite[j].picnum == HENSTAYPUT) + var90 = ps[screenpeek].i; + else + var90 = j; + } + dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (8 << 8); + zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]); + if (sprite[j].picnum != RECON) + sa = getangle(sprite[j].x - sx, sprite[j].y - sy); + } + else zvel = (100 - ps[p].gethorizdiff()) * 81; + if (atwith == RPG) + spritesound(RPG_SHOOT, i); + else if (isRRRA()) + { + if (atwith == RPG2) + spritesound(244, i); + else if (atwith == RRTILE1790) + spritesound(94, i); + } + + } + else + { + j = findplayer(s, &x); + sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy); + if (s->picnum == BOSS3) + sz -= (32 << 8); + else if (s->picnum == BOSS2) + { + vel += 128; + sz += 24 << 8; + } + + l = ldist(&sprite[ps[j].i], s); + zvel = ((ps[j].oposz - sz) * vel) / l; + + if (badguy(s) && (s->hitag & face_player_smart)) + sa = s->ang + (krand() & 31) - 16; + } + + if (p >= 0 && j >= 0) + l = j; + else l = -1; + + if (isRRRA() && atwith == RRTILE1790) + { + zvel = -(10 << 8); + vel <<= 1; + } + + j = EGS(sect, + sx + (sintable[(348 + sa + 512) & 2047] / 448), + sy + (sintable[(sa + 348) & 2047] / 448), + sz - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, i, 4); + + if (isRRRA()) + { + if (atwith == RRTILE1790) + { + sprite[j].extra = 10; + sprite[j].zvel = -(10 << 8); + } + else if (atwith == RPG2) + { + sprite[j].lotag = var90; + sprite[j].hitag = 0; + fi.lotsofmoney(&sprite[j], (krand() & 3) + 1); + } + } + + sprite[j].extra += (krand() & 7); + if (atwith != FREEZEBLAST) + sprite[j].yvel = l; + else + { + sprite[j].yvel = numfreezebounces; + sprite[j].xrepeat >>= 1; + sprite[j].yrepeat >>= 1; + sprite[j].zvel -= (2 << 4); + } + + if (p == -1) + { + if (s->picnum == HULK) + { + sprite[j].xrepeat = 8; + sprite[j].yrepeat = 8; + } + else if (atwith != FREEZEBLAST) + { + sprite[j].xrepeat = 30; + sprite[j].yrepeat = 30; + sprite[j].extra >>= 2; + } + } + else if (ps[p].curr_weapon == DEVISTATOR_WEAPON) + { + sprite[j].extra >>= 2; + sprite[j].ang += 16 - (krand() & 31); + sprite[j].zvel += 256 - (krand() & 511); + + if (ps[p].hbomb_hold_delay) + { + sprite[j].x -= sintable[sa & 2047] / 644; + sprite[j].y -= sintable[(sa + 1024 + 512) & 2047] / 644; + } + else + { + sprite[j].x += sintable[sa & 2047] >> 8; + sprite[j].y += sintable[(sa + 1024 + 512) & 2047] >> 8; + } + sprite[j].xrepeat >>= 1; + sprite[j].yrepeat >>= 1; + } + + sprite[j].cstat = 128; + if (atwith == RPG || (atwith == RPG2 && isRRRA())) + sprite[j].clipdist = 4; + else + sprite[j].clipdist = 40; + + } + break; + + case CHEERBOMB: + if (!isRRRA()) break; + case MORTER: + + if (s->extra >= 0) s->shade = -96; + + j = ps[findplayer(s, &x)].i; + x = ldist(&sprite[j], s); + + zvel = -x >> 1; + + if (zvel < -4096) + zvel = -2048; + vel = x >> 4; + + if (atwith == CHEERBOMB) + EGS(sect, + sx + (sintable[(512 + sa + 512) & 2047] >> 8), + sy + (sintable[(sa + 512) & 2047] >> 8), + sz + (6 << 8), atwith, -64, 16, 16, sa, vel, zvel, i, 1); + else + EGS(sect, + sx + (sintable[(512 + sa + 512) & 2047] >> 8), + sy + (sintable[(sa + 512) & 2047] >> 8), + sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, i, 1); + break; + } + return; +} + + END_DUKE_NS diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index e458dbfc3..98f244771 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1215,7 +1215,7 @@ void checkhitsprite_d(int i, int sn) case FETUSBROKE: for (j = 0; j < 48; j++) { - shoot(i, BLOODSPLAT1); + fi.shoot(i, BLOODSPLAT1); sprite[i].ang += 333; } spritesound(GLASS_HEAVYBREAK, i); @@ -1329,21 +1329,21 @@ void checkhitsprite_d(int i, int sn) sprite[i].extra -= sprite[sn].extra; if (sprite[i].extra > 0) break; sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT1); + fi.shoot(i, BLOODSPLAT1); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT2); + fi.shoot(i, BLOODSPLAT2); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT3); + fi.shoot(i, BLOODSPLAT3); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT4); + fi.shoot(i, BLOODSPLAT4); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT1); + fi.shoot(i, BLOODSPLAT1); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT2); + fi.shoot(i, BLOODSPLAT2); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT3); + fi.shoot(i, BLOODSPLAT3); sprite[i].ang = krand() & 2047; - shoot(i, BLOODSPLAT4); + fi.shoot(i, BLOODSPLAT4); fi.guts(&sprite[i], JIBS1, 1, myconnectindex); fi.guts(&sprite[i], JIBS2, 2, myconnectindex); fi.guts(&sprite[i], JIBS3, 3, myconnectindex); @@ -1403,10 +1403,10 @@ void checkhitsprite_d(int i, int sn) if (j >= 0 && sprite[j].picnum == APLAYER && sprite[i].picnum != ROTATEGUN && sprite[i].picnum != DRONE) if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) { - shoot(i, BLOODSPLAT3); - shoot(i, BLOODSPLAT1); - shoot(i, BLOODSPLAT2); - shoot(i, BLOODSPLAT4); + fi.shoot(i, BLOODSPLAT3); + fi.shoot(i, BLOODSPLAT1); + fi.shoot(i, BLOODSPLAT2); + fi.shoot(i, BLOODSPLAT4); } if (sprite[i].picnum != TANK && sprite[i].picnum != BOSS1 && sprite[i].picnum != BOSS4 && sprite[i].picnum != BOSS2 && sprite[i].picnum != BOSS3 && sprite[i].picnum != RECON && sprite[i].picnum != ROTATEGUN) diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index afb42f91f..7178b9c4c 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2384,10 +2384,10 @@ void checkhitsprite_r(int i, int sn) if (j >= 0 && sprite[j].picnum == APLAYER && sprite[i].picnum != DRONE) if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) { - shoot(i, BLOODSPLAT3); - shoot(i, BLOODSPLAT1); - shoot(i, BLOODSPLAT2); - shoot(i, BLOODSPLAT4); + fi.shoot(i, BLOODSPLAT3); + fi.shoot(i, BLOODSPLAT1); + fi.shoot(i, BLOODSPLAT2); + fi.shoot(i, BLOODSPLAT4); } if (sprite[i].statnum == 2) diff --git a/source/games/duke/src/zz_anim.cpp b/source/games/duke/src/zz_anim.cpp index 0cbc03462..d8399cb16 100644 --- a/source/games/duke/src/zz_anim.cpp +++ b/source/games/duke/src/zz_anim.cpp @@ -503,10 +503,10 @@ int32_t Anim_Play(const char *fn) goto end_anim_restore_gl; } - if (g_restorePalette == 1) + if (restorepalette == 1) { - P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 0); - g_restorePalette = 0; + P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); + restorepalette = 0; } frametime = (int32_t)totalclock; diff --git a/source/games/duke/src/zz_cheats.cpp b/source/games/duke/src/zz_cheats.cpp index 66ee36b5d..eafddaa76 100644 --- a/source/games/duke/src/zz_cheats.cpp +++ b/source/games/duke/src/zz_cheats.cpp @@ -767,7 +767,7 @@ void G_DoCheats(void) return; case CHEAT_RAMRBILL: - P_QuickKill(pPlayer); + quickkill(pPlayer); P_DoQuote(127, pPlayer); end_cheat(pPlayer); inputState.keyFlushChars(); @@ -796,7 +796,7 @@ void G_DoCheats(void) return; case CHEAT_RAAARON: - pPlayer->drug_mode = pPlayer->drug_mode ? 0 : 5; + pPlayer->DrugMode = pPlayer->DrugMode ? 0 : 5; pPlayer->drug_timer = (int32_t) totalclock; end_cheat(pPlayer); inputState.keyFlushChars(); diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 2de21e375..5a99aa5a9 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -882,7 +882,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) viewingRange = Blrintf(float(vr) * tanf(r_fov * (PI/360.f))); - if (!RRRA || !pPlayer->drug_mode) + if (!RRRA || !pPlayer->DrugMode) { if (!r_usenewaspect) renderSetAspect(viewingRange, yxaspect); @@ -906,7 +906,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) pPlayer->orotscrnang = pPlayer->rotscrnang; } - if (RRRA && pPlayer->drug_mode > 0) + if (RRRA && pPlayer->DrugMode > 0) { while (pPlayer->drug_timer < totalclock && !(pPlayer->gm & MODE_MENU) && !ud.pause_on && !System_WantGuiCapture()) { @@ -932,7 +932,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) aspect = viewingRange + pPlayer->drug_stat[1] * 5000; if (aspect < viewingRange) { - pPlayer->drug_mode = 0; + pPlayer->DrugMode = 0; pPlayer->drug_stat[0] = 0; pPlayer->drug_stat[2] = 0; pPlayer->drug_stat[1] = 0; @@ -963,8 +963,8 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (pPlayer->drug_stat[2] < 1) { pPlayer->drug_stat[0] = 2; - pPlayer->drug_mode--; - if (pPlayer->drug_mode == 1) + pPlayer->DrugMode--; + if (pPlayer->DrugMode == 1) pPlayer->drug_stat[0] = 3; } else @@ -2483,7 +2483,7 @@ rrcoolexplosion1: if (t->picnum == TILE_EXPLOSION2) { g_player[screenpeek].ps->visibility = -127; - //g_restorePalette = 1; // JBF 20040101: why? + //restorepalette = 1; // JBF 20040101: why? if (RR) t->pal = 0; } @@ -2853,7 +2853,7 @@ void G_HandleLocalKeys(void) buttonMap.ClearButton(gamefunc_See_Coop_View); screenpeek = connectpoint2[screenpeek]; if (screenpeek == -1) screenpeek = 0; - g_restorePalette = -1; + restorepalette = -1; } if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_Show_Opponents_Weapon)) @@ -3066,7 +3066,7 @@ void G_HandleLocalKeys(void) ud.fola = g_player[screenpeek].ps->oang; } #endif - g_restorePalette = 1; + restorepalette = 1; G_UpdateScreenArea(); } } @@ -4015,7 +4015,7 @@ int GameInterface::app_main() videoInit(); InitFonts(); V_LoadTranslations(); - videoSetPalette(0, g_player[myconnectindex].ps->palette, 0); + videoSetPalette(BASEPAL, 0); // check if the minifont will support lowercase letters (3136-3161) // there is room for them in tiles012.art between "[\]^_." and "{|}~" @@ -4384,7 +4384,7 @@ int G_DoMoveThings(void) if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) { actor[g_player[i].ps->i].picnum = TILE_APLAYERTOP; - P_QuickKill(g_player[i].ps); + quickkill(g_player[i].ps); } } if (g_gametypeFlags[ud.coop] & GAMETYPE_TDM) diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 0a6d383f1..ad7f1fdc6 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -60,7 +60,7 @@ void P_UpdateScreenPal(DukePlayer_t * const pPlayer) int inWater = 0; int const playerSectnum = pPlayer->cursectnum; - if (pPlayer->drug_mode) + if (pPlayer->DrugMode) pPlayer->palette = DRUGPAL; else if (pPlayer->heat_on) pPlayer->palette = SLIMEPAL; @@ -77,7 +77,7 @@ void P_UpdateScreenPal(DukePlayer_t * const pPlayer) inWater = 1; } - g_restorePalette = 1+inWater; + restorepalette = 1+inWater; } static void P_IncurDamage(DukePlayer_t * const pPlayer) @@ -130,17 +130,6 @@ static void P_IncurDamage(DukePlayer_t * const pPlayer) sprite[pPlayer->i].extra = pPlayer->last_extra + playerDamage; } -void P_QuickKill(DukePlayer_t * const pPlayer) -{ - P_PalFrom(pPlayer, 48, 48,48,48); - - sprite[pPlayer->i].extra = 0; - sprite[pPlayer->i].cstat |= 32768; - - if (ud.god == 0) - A_DoGuts(pPlayer->i,TILE_JIBS6,8); -} - static void Proj_DoWaterTracers(vec3_t startPos, vec3_t const *endPos, int n, int16_t sectNum) { if ((klabs(startPos.x - endPos->x) + klabs(startPos.y - endPos->y)) < 3084) @@ -165,19 +154,6 @@ static void Proj_DoWaterTracers(vec3_t startPos, vec3_t const *endPos, int n, in } } -int32_t A_GetHitscanRange(int spriteNum) -{ - int const zOffset = (PN(spriteNum) == TILE_APLAYER) ? (40<<8) : 0; - hitdata_t hitData; - - SZ(spriteNum) -= zOffset; - hitscan((const vec3_t *)&sprite[spriteNum], SECT(spriteNum), sintable[(SA(spriteNum) + 512) & 2047], - sintable[SA(spriteNum) & 2047], 0, &hitData, CLIPMASK1); - SZ(spriteNum) += zOffset; - - return (FindDistance2D(hitData.pos.x - SX(spriteNum), hitData.pos.y - SY(spriteNum))); -} - static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projecTile) { static int const aimstats[] = { @@ -1667,11 +1643,11 @@ static void P_FireWeapon(int playerNum) P_SetWeaponGamevars(playerNum, pPlayer); // Printf("doing %d %d %d\n",PWEAPON(snum, p->curr_weapon, Shoots),p->curr_weapon,snum); - A_Shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); + fi.shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); for (bssize_t burstFire = PWEAPON(playerNum, pPlayer->curr_weapon, ShotsPerBurst) - 1; burstFire > 0; --burstFire) { - A_Shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); + fi.shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_AMMOPERSHOT) { @@ -4425,7 +4401,7 @@ static int32_t P_DoCounters(int playerNum) pPlayer->last_quick_kick = pPlayer->quick_kick + 1; if (--pPlayer->quick_kick == 8) - A_Shoot(pPlayer->i, TILE_KNEE); + fi.shoot(pPlayer->i, TILE_KNEE); } else if (pPlayer->last_quick_kick > 0) --pPlayer->last_quick_kick; @@ -4961,7 +4937,7 @@ static void P_ProcessWeapon(int playerNum) else if (pPlayer->hbomb_time <= 0 && (*weaponFrame) < 5) { S_PlaySound(PIPEBOMB_EXPLODE); - P_QuickKill(pPlayer); + quickkill(pPlayer); } } } @@ -5323,7 +5299,7 @@ static void P_ProcessWeapon(int playerNum) sprite[pipeSpriteNum].z += ZOFFSET3; } - if (A_GetHitscanRange(pPlayer->i) < 512) + if (hits(pPlayer->i) < 512) { sprite[pipeSpriteNum].ang += 1024; sprite[pipeSpriteNum].zvel /= 3; @@ -5356,7 +5332,7 @@ static void P_ProcessWeapon(int playerNum) case PISTOL_WEAPON__STATIC: if ((*weaponFrame) == 1) { - A_Shoot(pPlayer->i, TILE_SHOTSPARK1); + fi.shoot(pPlayer->i, TILE_SHOTSPARK1); A_PlaySound(PISTOL_FIRE, pPlayer->i); pPlayer->noise_radius = 8192; P_MadeNoise(playerNum); @@ -5413,16 +5389,16 @@ static void P_ProcessWeapon(int playerNum) pPlayer->shotgun_state[1] = 1; if ((*weaponFrame) == 4) { - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); pPlayer->ammo_amount[SHOTGUN_WEAPON]--; @@ -5440,16 +5416,16 @@ static void P_ProcessWeapon(int playerNum) { if (pPlayer->shotgun_state[1]) { - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); pPlayer->ammo_amount[SHOTGUN_WEAPON]--; @@ -5536,7 +5512,7 @@ static void P_ProcessWeapon(int playerNum) } A_PlaySound(CHAINGUN_FIRE, pPlayer->i); - A_Shoot(pPlayer->i, TILE_CHAINGUN); + fi.shoot(pPlayer->i, TILE_CHAINGUN); pPlayer->noise_radius = 8192; P_MadeNoise(playerNum); lastvisinc = (int32_t) totalclock + 32; @@ -5579,7 +5555,7 @@ static void P_ProcessWeapon(int playerNum) pus = 1; } - A_Shoot(pPlayer->i, TILE_GROWSPARK); + fi.shoot(pPlayer->i, TILE_GROWSPARK); pPlayer->noise_radius = 1024; P_MadeNoise(playerNum); @@ -5596,7 +5572,7 @@ static void P_ProcessWeapon(int playerNum) { pPlayer->ammo_amount[SHRINKER_WEAPON]--; - A_Shoot(pPlayer->i, TILE_SHRINKSPARK); + fi.shoot(pPlayer->i, TILE_SHRINKSPARK); P_CheckWeapon(pPlayer); } if (++(*weaponFrame) > 20) @@ -5611,7 +5587,7 @@ static void P_ProcessWeapon(int playerNum) flashColor = 255 + (95 << 8); lastvisinc = (int32_t) totalclock + 32; A_PlaySound(CHAINGUN_FIRE, pPlayer->i); - A_Shoot(pPlayer->i, TILE_SHOTSPARK1); + fi.shoot(pPlayer->i, TILE_SHOTSPARK1); pPlayer->noise_radius = 16384; P_MadeNoise(playerNum); pPlayer->ammo_amount[DEVISTATOR_WEAPON]--; @@ -5640,7 +5616,7 @@ static void P_ProcessWeapon(int playerNum) flashColor = 255 + (95 << 8); lastvisinc = (int32_t) totalclock + 32; A_PlaySound(CHAINGUN_FIRE, pPlayer->i); - A_Shoot(pPlayer->i, TILE_CHAINGUN); + fi.shoot(pPlayer->i, TILE_CHAINGUN); pPlayer->noise_radius = 16384; P_MadeNoise(playerNum); pPlayer->ammo_amount[MOTORCYCLE_WEAPON]--; @@ -5669,7 +5645,7 @@ static void P_ProcessWeapon(int playerNum) { pPlayer->MotoSpeed -= 20; pPlayer->ammo_amount[BOAT_WEAPON]--; - A_Shoot(pPlayer->i, TILE_RRTILE1790); + fi.shoot(pPlayer->i, TILE_RRTILE1790); } (*weaponFrame)++; if ((*weaponFrame) > 20) @@ -5686,7 +5662,7 @@ static void P_ProcessWeapon(int playerNum) case FREEZE_WEAPON__STATIC: (*weaponFrame)++; if ((*weaponFrame) >= 7 && (*weaponFrame) <= 11) - A_Shoot(pPlayer->i, TILE_FIRELASER); + fi.shoot(pPlayer->i, TILE_FIRELASER); if ((*weaponFrame) == 5) { @@ -5753,7 +5729,7 @@ static void P_ProcessWeapon(int playerNum) { pPlayer->ammo_amount[BOWLING_WEAPON]--; A_PlaySound(354, pPlayer->i); - A_Shoot(pPlayer->i, TILE_BOWLINGBALL); + fi.shoot(pPlayer->i, TILE_BOWLINGBALL); pPlayer->noise_radius = 1024; P_MadeNoise(playerNum); } @@ -5774,7 +5750,7 @@ static void P_ProcessWeapon(int playerNum) if ((*weaponFrame) == 12) { - A_Shoot(pPlayer->i, TILE_KNEE); + fi.shoot(pPlayer->i, TILE_KNEE); pPlayer->noise_radius = 1024; P_MadeNoise(playerNum); } @@ -5792,7 +5768,7 @@ static void P_ProcessWeapon(int playerNum) if ((*weaponFrame) == 8) { - A_Shoot(pPlayer->i, TILE_SLINGBLADE); + fi.shoot(pPlayer->i, TILE_SLINGBLADE); pPlayer->noise_radius = 1024; P_MadeNoise(playerNum); } @@ -5812,7 +5788,7 @@ static void P_ProcessWeapon(int playerNum) lastvisinc = (int32_t) totalclock + 32; pPlayer->visibility = 0; flashColor = 255+(95<<8); - A_Shoot(pPlayer->i, TILE_RPG); + fi.shoot(pPlayer->i, TILE_RPG); pPlayer->noise_radius = 32768; P_MadeNoise(playerNum); P_CheckWeapon(pPlayer); @@ -5831,7 +5807,7 @@ static void P_ProcessWeapon(int playerNum) lastvisinc = (int32_t) totalclock + 32; pPlayer->visibility = 0; flashColor = 255+(95<<8); - A_Shoot(pPlayer->i, TILE_RPG2); + fi.shoot(pPlayer->i, TILE_RPG2); pPlayer->noise_radius = 32768; P_MadeNoise(playerNum); P_CheckWeapon(pPlayer); @@ -5890,7 +5866,7 @@ static void P_ProcessWeapon(int playerNum) sprite[pipeSpriteNum].z += ZOFFSET3; } - if (A_GetHitscanRange(pPlayer->i) < 512) + if (hits(pPlayer->i) < 512) { sprite[pipeSpriteNum].ang += 1024; sprite[pipeSpriteNum].zvel /= 3; @@ -5923,7 +5899,7 @@ static void P_ProcessWeapon(int playerNum) } P_SetWeaponGamevars(playerNum, pPlayer); - A_Shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); + fi.shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); } } @@ -6069,7 +6045,7 @@ static void P_ProcessWeapon(int playerNum) sprite[pipeSpriteNum].z += ZOFFSET3; } - if (A_GetHitscanRange(pPlayer->i) < 512) + if (hits(pPlayer->i) < 512) { sprite[pipeSpriteNum].ang += 1024; sprite[pipeSpriteNum].zvel /= 3; @@ -6123,7 +6099,7 @@ static void P_ProcessWeapon(int playerNum) case PISTOL_WEAPON__STATIC: if ((*weaponFrame) == 1) { - A_Shoot(pPlayer->i, TILE_SHOTSPARK1); + fi.shoot(pPlayer->i, TILE_SHOTSPARK1); A_PlaySound(PISTOL_FIRE, pPlayer->i); lastvisinc = (int32_t) totalclock+32; pPlayer->visibility = 0; @@ -6165,13 +6141,13 @@ static void P_ProcessWeapon(int playerNum) case SHOTGUN_WEAPON__STATIC: if (++(*weaponFrame) == 4) { - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); - A_Shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); + fi.shoot(pPlayer->i, TILE_SHOTGUN); pPlayer->ammo_amount[SHOTGUN_WEAPON]--; @@ -6226,7 +6202,7 @@ static void P_ProcessWeapon(int playerNum) } A_PlaySound(CHAINGUN_FIRE, pPlayer->i); - A_Shoot(pPlayer->i, TILE_CHAINGUN); + fi.shoot(pPlayer->i, TILE_CHAINGUN); lastvisinc = (int32_t) totalclock + 32; pPlayer->visibility = 0; flashColor = 255+(95<<8); @@ -6271,7 +6247,7 @@ static void P_ProcessWeapon(int playerNum) pPlayer->ammo_amount[GROW_WEAPON]--; - A_Shoot(pPlayer->i, TILE_GROWSPARK); + fi.shoot(pPlayer->i, TILE_GROWSPARK); pPlayer->visibility = 0; flashColor = 216+(52<<8)+(20<<16); @@ -6308,7 +6284,7 @@ static void P_ProcessWeapon(int playerNum) pPlayer->ammo_amount[SHRINKER_WEAPON]--; - A_Shoot(pPlayer->i, TILE_SHRINKER); + fi.shoot(pPlayer->i, TILE_SHRINKER); if (!NAM) { @@ -6340,7 +6316,7 @@ static void P_ProcessWeapon(int playerNum) pPlayer->visibility = 0; flashColor = 255+(95<<8); lastvisinc = (int32_t) totalclock + 32; - A_Shoot(pPlayer->i, TILE_RPG); + fi.shoot(pPlayer->i, TILE_RPG); pPlayer->ammo_amount[DEVISTATOR_WEAPON]--; P_CheckWeapon(pPlayer); } @@ -6360,7 +6336,7 @@ static void P_ProcessWeapon(int playerNum) pPlayer->visibility = 0; flashColor = 72+(88<<8)+(140<<16); lastvisinc = (int32_t) totalclock + 32; - A_Shoot(pPlayer->i, TILE_FREEZEBLAST); + fi.shoot(pPlayer->i, TILE_FREEZEBLAST); P_CheckWeapon(pPlayer); } if (sprite[pPlayer->i].xrepeat < 32) @@ -6389,7 +6365,7 @@ static void P_ProcessWeapon(int playerNum) pPlayer->vel.z = 0; if ((*weaponFrame) == 3) { - A_Shoot(pPlayer->i, TILE_HANDHOLDINGLASER); + fi.shoot(pPlayer->i, TILE_HANDHOLDINGLASER); } } if ((*weaponFrame) == 16) @@ -6407,7 +6383,7 @@ static void P_ProcessWeapon(int playerNum) case KNEE_WEAPON__STATIC: if (++(*weaponFrame) == 7) { - A_Shoot(pPlayer->i, TILE_KNEE); + fi.shoot(pPlayer->i, TILE_KNEE); } else if ((*weaponFrame) == 14) { @@ -6434,7 +6410,7 @@ static void P_ProcessWeapon(int playerNum) lastvisinc = (int32_t) totalclock + 32; pPlayer->visibility = 0; flashColor = 255+(95<<8); - A_Shoot(pPlayer->i, TILE_RPG); + fi.shoot(pPlayer->i, TILE_RPG); P_CheckWeapon(pPlayer); } else if ((*weaponFrame) == 20) @@ -7310,7 +7286,7 @@ void P_ProcessInput(int playerNum) { if (pSprite->extra > 0 && ud.clipping == 0) { - P_QuickKill(pPlayer); + quickkill(pPlayer); A_PlaySound(SQUISHED, pPlayer->i); } @@ -7815,7 +7791,7 @@ check_enemy_sprite: if (RRRA) pPlayer->moto_on_ground = 1; if (pPlayer->falling_counter > 62 || (RRRA && pPlayer->falling_counter > 2 && sector[pPlayer->cursectnum].lotag == 802)) - P_QuickKill(pPlayer); + quickkill(pPlayer); else if (pPlayer->falling_counter > 9) { // Falling damage. @@ -8410,13 +8386,13 @@ HORIZONLY:; } if (sprite[spriteNum].picnum == TILE_RRTILE3410) { - P_QuickKill(pPlayer); + quickkill(pPlayer); A_PlaySound(446, pPlayer->i); } else if (RRRA && sprite[spriteNum].picnum == TILE_RRTILE2443 && sprite[spriteNum].pal == 19) { sprite[spriteNum].pal = 0; - pPlayer->drug_mode = 5; + pPlayer->DrugMode = 5; pPlayer->drug_timer = (int32_t) totalclock; sprite[pPlayer->i].extra = max_player_health; } @@ -8449,7 +8425,7 @@ HORIZONLY:; { if (RRRA) pPlayer->lotag800kill = 1; - P_QuickKill(pPlayer); + quickkill(pPlayer); return; } } @@ -8463,7 +8439,7 @@ HORIZONLY:; if ((!ud.clipping && pSector->lotag == ST_31_TWO_WAY_TRAIN) && ((unsigned)pSector->hitag < MAXSPRITES && sprite[pSector->hitag].xvel && actor[pSector->hitag].t_data[0] == 0)) { - P_QuickKill(pPlayer); + quickkill(pPlayer); return; } } @@ -8489,7 +8465,7 @@ HORIZONLY:; if (squishPlayer) { - P_QuickKill(pPlayer); + quickkill(pPlayer); return; } } @@ -8498,7 +8474,7 @@ HORIZONLY:; if (RR && sector[pPlayer->cursectnum].ceilingz > (sector[pPlayer->cursectnum].floorz-ZOFFSET4)) { - P_QuickKill(pPlayer); + quickkill(pPlayer); return; } } @@ -8625,7 +8601,7 @@ HORIZONLY:; case APLAYER__STATIC: { int playerSquished = P_Get(pPlayer->actorsqu); - P_QuickKill(g_player[playerSquished].ps); + quickkill(g_player[playerSquished].ps); g_player[playerSquished].ps->frag_ps = playerNum; break; } @@ -9220,15 +9196,5 @@ int P_HasKey(int sectNum, int playerNum) int16_t max_ammo_amount[MAX_WEAPONS]; -void forceplayerangle(DukePlayer_t* pPlayer) -{ - int const nAngle = 128 - (krand2() & 255); - - pPlayer->q16horiz += F16(64); - pPlayer->return_to_center = 9; - pPlayer->rotscrnang = nAngle >> 1; - pPlayer->look_ang = pPlayer->rotscrnang; -} - END_DUKE_NS diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 462274b6f..b8ec7a1ae 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -990,7 +990,7 @@ void P_ResetStatus(int playerNum) pPlayer->not_on_water = 0; pPlayer->sea_sick = 0; pPlayer->nocheat = 0; - pPlayer->drug_mode = 0; + pPlayer->DrugMode = 0; pPlayer->drug_stat[0] = 0; pPlayer->drug_stat[1] = 0; pPlayer->drug_stat[2] = 0; @@ -1833,7 +1833,7 @@ static void prelevel(char g) if (RR && !g_thunderOn) { - videoSetPalette(0,BASEPAL,0); + videoSetPalette(BASEPAL,0); g_visibility = g_player[screenpeek].ps->visibility; } if (RR) @@ -2449,7 +2449,7 @@ int G_EnterLevel(int gameMode) mapList[mii].DisplayName()); } - g_restorePalette = -1; + restorepalette = -1; G_UpdateScreenArea(); videoClearViewableArea(0L); diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 0e6485bb6..5c034e75f 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -1439,7 +1439,7 @@ static void postloadplayer(int32_t savegamep) //3 P_UpdateScreenPal(g_player[myconnectindex].ps); - g_restorePalette = -1; + restorepalette = -1; //3.5 if (savegamep) diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 35212af61..364e4c562 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -90,7 +90,7 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set) if (player != g_player[screenpeek].ps) return; - videoSetPalette(0, palid, set); + videoSetPalette(palid, set); } @@ -695,18 +695,18 @@ void G_DisplayRest(int32_t smoothratio) palaccum_add(&tint, &loogiepal, pp->loogcnt>>1); } - if (g_restorePalette) + if (restorepalette) { // reset a normal palette static uint32_t omovethingscnt; - if (g_restorePalette < 2 || omovethingscnt+1 == g_moveThingsCount) + if (restorepalette < 2 || omovethingscnt+1 == g_moveThingsCount) { int32_t pal = pp->palette; - // g_restorePalette < 0: reset tinting, too (e.g. when loading new game) - P_SetGamePalette(pp, pal, (g_restorePalette > 0) ? Pal_DontResetFade : ESetPalFlags::FromInt(0)); - g_restorePalette = 0; + // restorepalette < 0: reset tinting, too (e.g. when loading new game) + P_SetGamePalette(pp, pal, (restorepalette > 0) ? Pal_DontResetFade : ESetPalFlags::FromInt(0)); + restorepalette = 0; } else { @@ -1118,10 +1118,10 @@ void G_DisplayLogo(void) rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7106, 0, 0, 2 + 8 + 64 + BGSTRETCH); G_HandleAsync(); - if (g_restorePalette) + if (restorepalette) { P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0); - g_restorePalette = 0; + restorepalette = 0; } videoNextPage(); } @@ -1163,10 +1163,10 @@ void G_DisplayLogo(void) rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, 7107, 0, 0, 2 + 8 + 64 + BGSTRETCH); G_HandleAsync(); - if (g_restorePalette) + if (restorepalette) { P_SetGamePalette(g_player[myconnectindex].ps, g_player[myconnectindex].ps->palette, 0); - g_restorePalette = 0; + restorepalette = 0; } videoNextPage(); } diff --git a/source/games/duke/src/zz_sector.cpp b/source/games/duke/src/zz_sector.cpp index f9a619bce..587ff96f9 100644 --- a/source/games/duke/src/zz_sector.cpp +++ b/source/games/duke/src/zz_sector.cpp @@ -806,44 +806,5 @@ rrtripbomb_case: } } -int hitasprite(int spriteNum, int16_t *hitSprite) -{ - hitdata_t hitData; - int32_t zOffset = 0; - - if (A_CheckEnemySprite(&sprite[spriteNum])) - zOffset = (42 << 8); - else if (PN(spriteNum) == TILE_APLAYER) - zOffset = (39 << 8); - - SZ(spriteNum) -= zOffset; - hitscan((const vec3_t *)&sprite[spriteNum], SECT(spriteNum), sintable[(SA(spriteNum) + 512) & 2047], - sintable[SA(spriteNum) & 2047], 0, &hitData, CLIPMASK1); - SZ(spriteNum) += zOffset; - - if (hitSprite) - *hitSprite = hitData.sprite; - - if (hitData.wall >= 0 && (wall[hitData.wall].cstat&16) && A_CheckEnemySprite( &sprite[spriteNum])) - return 1<<30; - - return FindDistance2D(hitData.pos.x-SX(spriteNum),hitData.pos.y-SY(spriteNum)); -} - -int hitawall(DukePlayer_t *pPlayer, int *hitWall) -{ - 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); - - *hitWall = hitData.wall; - - if (hitData.wall < 0) - return INT32_MAX; - - return FindDistance2D(hitData.pos.x - pPlayer->pos.x, hitData.pos.y - pPlayer->pos.y); -} - END_DUKE_NS diff --git a/source/rr/src/anim.cpp b/source/rr/src/anim.cpp index 59743cfeb..c35654d77 100644 --- a/source/rr/src/anim.cpp +++ b/source/rr/src/anim.cpp @@ -505,7 +505,7 @@ int32_t Anim_Play(const char *fn) if (g_restorePalette == 1) { - P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 0); + P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0); g_restorePalette = 0; } diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 3cbf3d3b5..fa71f062d 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7166,7 +7166,7 @@ int GameInterface::app_main() #endif videoInit(); - videoSetPalette(0, g_player[myconnectindex].ps->palette, 0); + videoSetPalette(BASEPAL, 0); // check if the minifont will support lowercase letters (3136-3161) // there is room for them in tiles012.art between "[\]^_." and "{|}~" diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 2e36a8bfb..18b9cdb08 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -1874,7 +1874,7 @@ static void prelevel(char g) if (RR && !g_thunderOn) { - videoSetPalette(0,BASEPAL,0); + videoSetPalette(BASEPAL,0); g_visibility = g_player[screenpeek].ps->visibility; } if (RR) diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index d08ae07c9..d7a55f40f 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -90,7 +90,7 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set) if (player != g_player[screenpeek].ps) return; - videoSetPalette(0, palid, set); + videoSetPalette(palid, set); } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 2c15a42bc..17fc6f60f 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -1421,7 +1421,7 @@ void LogoLevel(void) twod->ClearScreen(); videoNextPage(); - videoSetPalette(0, BASEPAL, 0); + videoSetPalette(BASEPAL, 0); // put up a blank screen while loading