Merge branch 'next' of https://git.magicalgirl.moe/STJr/SRB2 into playerthink-hook

This commit is contained in:
Zachary McAlpin 2020-01-01 13:31:07 -06:00
commit 7123abd493
14 changed files with 89 additions and 36 deletions

View File

@ -335,27 +335,6 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
jump_last = jump; jump_last = jump;
spin_last = spin; spin_last = spin;
// ********
// Thinkfly overlay
if (thinkfly)
{
if (!tails->hnext)
{
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
if (tails->hnext)
{
P_SetTarget(&tails->hnext->target, tails);
P_SetTarget(&tails->hnext->hprev, tails);
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
}
}
}
else if (tails->hnext && tails->hnext->type == MT_OVERLAY && tails->hnext->state == states+S_FLIGHTINDICATOR)
{
P_RemoveMobj(tails->hnext);
P_SetTarget(&tails->hnext, NULL);
}
// Turn the virtual keypresses into ticcmd_t. // Turn the virtual keypresses into ticcmd_t.
B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin); B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin);
@ -565,3 +544,30 @@ void B_RespawnBot(INT32 playernum)
P_SetScale(tails, sonic->scale); P_SetScale(tails, sonic->scale);
tails->destscale = sonic->destscale; tails->destscale = sonic->destscale;
} }
void B_HandleFlightIndicator(player_t *player)
{
mobj_t *tails = player->mo;
if (!tails)
return;
if (thinkfly && player->bot == 1 && tails->health)
{
if (!tails->hnext)
{
P_SetTarget(&tails->hnext, P_SpawnMobjFromMobj(tails, 0, 0, 0, MT_OVERLAY));
if (tails->hnext)
{
P_SetTarget(&tails->hnext->target, tails);
P_SetTarget(&tails->hnext->hprev, tails);
P_SetMobjState(tails->hnext, S_FLIGHTINDICATOR);
}
}
}
else if (tails->hnext && tails->hnext->type == MT_OVERLAY && tails->hnext->state == states+S_FLIGHTINDICATOR)
{
P_RemoveMobj(tails->hnext);
P_SetTarget(&tails->hnext, NULL);
}
}

View File

@ -15,3 +15,4 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
boolean B_CheckRespawn(player_t *player); boolean B_CheckRespawn(player_t *player);
void B_MoveBlocked(player_t *player); void B_MoveBlocked(player_t *player);
void B_RespawnBot(INT32 playernum); void B_RespawnBot(INT32 playernum);
void B_HandleFlightIndicator(player_t *player);

View File

@ -1718,6 +1718,7 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); // empty, or external driver G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); // empty, or external driver
B_BuildTiccmd(player, cmd); B_BuildTiccmd(player, cmd);
} }
B_HandleFlightIndicator(player);
} }
if (cv_analog2.value) { if (cv_analog2.value) {
@ -1854,8 +1855,7 @@ void G_DoLoadLevel(boolean resetplayer)
return; return;
} }
if (!resetplayer) P_FindEmerald();
P_FindEmerald();
displayplayer = consoleplayer; // view the guy you are playing displayplayer = consoleplayer; // view the guy you are playing
if (!splitscreen && !botingame) if (!splitscreen && !botingame)
@ -3398,7 +3398,7 @@ INT32 G_GetGametypeByName(const char *gametypestr)
{ {
INT32 i; INT32 i;
for (i = 0; i < NUMGAMETYPES; i++) for (i = 0; i < gametypecount; i++)
if (!stricmp(gametypestr, Gametype_Names[i])) if (!stricmp(gametypestr, Gametype_Names[i]))
return i; return i;

View File

@ -374,7 +374,6 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_ADST &lspr[NOLIGHT], // SPR_ADST
&lspr[NOLIGHT], // SPR_MCRT &lspr[NOLIGHT], // SPR_MCRT
&lspr[NOLIGHT], // SPR_MCSP &lspr[NOLIGHT], // SPR_MCSP
&lspr[NOLIGHT], // SPR_NON2
&lspr[NOLIGHT], // SPR_SALD &lspr[NOLIGHT], // SPR_SALD
&lspr[NOLIGHT], // SPR_TRAE &lspr[NOLIGHT], // SPR_TRAE
&lspr[NOLIGHT], // SPR_TRAI &lspr[NOLIGHT], // SPR_TRAI

View File

@ -1807,7 +1807,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return; return;
case MT_MINECARTSPAWNER: case MT_MINECARTSPAWNER:
if (!player->bot && (special->fuse < TICRATE || player->powers[pw_carry] != CR_MINECART)) if (!player->bot && special->fuse <= TICRATE && player->powers[pw_carry] != CR_MINECART)
{ {
mobj_t *mcart = P_SpawnMobj(special->x, special->y, special->z, MT_MINECART); mobj_t *mcart = P_SpawnMobj(special->x, special->y, special->z, MT_MINECART);
P_SetTarget(&mcart->target, toucher); P_SetTarget(&mcart->target, toucher);
@ -2481,9 +2481,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
P_SetMobjState(scoremobj, scorestate); P_SetMobjState(scoremobj, scorestate);
// On ground? No chain starts. source->player->scoreadd = locscoreadd;
if (source->player->powers[pw_invulnerability] || !P_IsObjectOnGround(source))
source->player->scoreadd = locscoreadd;
} }
} }

View File

@ -829,13 +829,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext) for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext)
if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale)) if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale))
P_KillMobj(iter, tmthing, tmthing, 0); P_KillMobj(iter, tmthing, tmthing, 0);
return true;
} }
else else
{ {
thing->health = 0; if (P_DamageMobj(thing, tmthing, tmthing, 1, 0))
P_KillMobj(thing, tmthing, tmthing, 0); return true;
} }
return true;
} }
// vectorise metal - done in a special case as at this point neither has the right flags for touching // vectorise metal - done in a special case as at this point neither has the right flags for touching

View File

@ -1825,6 +1825,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
if (po->thinker == NULL) if (po->thinker == NULL)
po->thinker = &th->thinker; po->thinker = &th->thinker;
/*
// Find out target first. // Find out target first.
// We redo this each tic to make savegame compatibility easier. // We redo this each tic to make savegame compatibility easier.
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next) for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
@ -1843,6 +1844,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
break; break;
} }
} }
*/
target = th->target;
if (!target) if (!target)
{ {
@ -2025,6 +2029,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
target = waypoint; target = waypoint;
th->pointnum = target->health; th->pointnum = target->health;
// Set the mobj as your target! -- Monster Iestyn 27/12/19
P_SetTarget(&th->target, target);
// calculate MOMX/MOMY/MOMZ for next waypoint // calculate MOMX/MOMY/MOMZ for next waypoint
// change slope // change slope
@ -2651,6 +2657,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
// Set pointnum // Set pointnum
th->pointnum = target->health; th->pointnum = target->health;
th->target = NULL; // set to NULL first so the below doesn't go wrong
// Set the mobj as your target! -- Monster Iestyn 27/12/19
P_SetTarget(&th->target, target);
// We don't deal with the mirror crap here, we'll // We don't deal with the mirror crap here, we'll
// handle that in the T_Thinker function. // handle that in the T_Thinker function.

View File

@ -161,6 +161,8 @@ typedef struct polywaypoint_s
fixed_t diffx; fixed_t diffx;
fixed_t diffy; fixed_t diffy;
fixed_t diffz; fixed_t diffz;
mobj_t *target; // next waypoint mobj
} polywaypoint_t; } polywaypoint_t;
typedef struct polyslidedoor_s typedef struct polyslidedoor_s

View File

@ -2055,6 +2055,7 @@ static void SavePolywaypointThinker(const thinker_t *th, UINT8 type)
WRITEFIXED(save_p, ht->diffx); WRITEFIXED(save_p, ht->diffx);
WRITEFIXED(save_p, ht->diffy); WRITEFIXED(save_p, ht->diffy);
WRITEFIXED(save_p, ht->diffz); WRITEFIXED(save_p, ht->diffz);
WRITEUINT32(save_p, SaveMobjnum(ht->target));
} }
// //
@ -3244,6 +3245,7 @@ static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker)
ht->diffx = READFIXED(save_p); ht->diffx = READFIXED(save_p);
ht->diffy = READFIXED(save_p); ht->diffy = READFIXED(save_p);
ht->diffz = READFIXED(save_p); ht->diffz = READFIXED(save_p);
ht->target = LoadMobj(READUINT32(save_p));
return &ht->thinker; return &ht->thinker;
} }
@ -3538,6 +3540,7 @@ static void P_NetUnArchiveThinkers(void)
case tc_polywaypoint: case tc_polywaypoint:
th = LoadPolywaypointThinker((actionf_p1)T_PolyObjWaypoint); th = LoadPolywaypointThinker((actionf_p1)T_PolyObjWaypoint);
restoreNum = true;
break; break;
case tc_polyslidedoor: case tc_polyslidedoor:
@ -3599,9 +3602,9 @@ static void P_NetUnArchiveThinkers(void)
if (restoreNum) if (restoreNum)
{ {
executor_t *delay = NULL; executor_t *delay = NULL;
polywaypoint_t *polywp = NULL;
UINT32 mobjnum; UINT32 mobjnum;
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN]; for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN]; currentthinker = currentthinker->next)
currentthinker = currentthinker->next)
{ {
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay) if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
continue; continue;
@ -3610,6 +3613,15 @@ static void P_NetUnArchiveThinkers(void)
continue; continue;
delay->caller = P_FindNewPosition(mobjnum); delay->caller = P_FindNewPosition(mobjnum);
} }
for (currentthinker = thlist[THINK_POLYOBJ].next; currentthinker != &thlist[THINK_POLYOBJ]; currentthinker = currentthinker->next)
{
if (currentthinker->function.acp1 != (actionf_p1)T_PolyObjWaypoint)
continue;
polywp = (void *)currentthinker;
if (!(mobjnum = (UINT32)(size_t)polywp->target))
continue;
polywp->target = P_FindNewPosition(mobjnum);
}
} }
} }

View File

@ -4631,6 +4631,12 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
break; break;
} }
if (player->dashspeed < player->mindash)
player->dashspeed = player->mindash;
if (player->dashspeed > player->maxdash)
player->dashspeed = player->maxdash;
if (player->dashspeed < player->maxdash && player->mindash != player->maxdash) if (player->dashspeed < player->maxdash && player->mindash != player->maxdash)
{ {
#define chargecalculation (6*(player->dashspeed - player->mindash))/(player->maxdash - player->mindash) #define chargecalculation (6*(player->dashspeed - player->mindash))/(player->maxdash - player->mindash)
@ -7780,6 +7786,7 @@ void P_ElementalFire(player_t *player, boolean cropcircle)
flame->fuse = TICRATE*7; // takes about an extra second to hit the ground flame->fuse = TICRATE*7; // takes about an extra second to hit the ground
flame->destscale = player->mo->scale; flame->destscale = player->mo->scale;
P_SetScale(flame, player->mo->scale); P_SetScale(flame, player->mo->scale);
flame->flags2 = (flame->flags2 & ~MF2_OBJECTFLIP)|(player->mo->flags2 & MF2_OBJECTFLIP);
flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP);
P_InstaThrust(flame, flame->angle, FixedMul(3*FRACUNIT, flame->scale)); P_InstaThrust(flame, flame->angle, FixedMul(3*FRACUNIT, flame->scale));
P_SetObjectMomZ(flame, 3*FRACUNIT, false); P_SetObjectMomZ(flame, 3*FRACUNIT, false);
@ -11244,7 +11251,10 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
if (panim == PA_WALK) if (panim == PA_WALK)
{ {
if (stat != fume->info->spawnstate) if (stat != fume->info->spawnstate)
{
fume->threshold = 0;
P_SetMobjState(fume, fume->info->spawnstate); P_SetMobjState(fume, fume->info->spawnstate);
}
return; return;
} }
} }
@ -11275,6 +11285,12 @@ static void P_DoMetalJetFume(player_t *player, mobj_t *fume)
if (underwater) if (underwater)
{ {
fume->frame = (fume->frame & FF_FRAMEMASK) | FF_ANIMATE | (P_RandomRange(0, 9) * FF_TRANS10); fume->frame = (fume->frame & FF_FRAMEMASK) | FF_ANIMATE | (P_RandomRange(0, 9) * FF_TRANS10);
fume->threshold = 1;
}
else if (fume->threshold)
{
fume->frame = (fume->frame & FF_FRAMEMASK) | fume->state->frame;
fume->threshold = 0;
} }
} }

View File

@ -729,9 +729,11 @@ typedef struct
{ {
patch_t *patch[8][ROTANGLES]; patch_t *patch[8][ROTANGLES];
boolean cached[8]; boolean cached[8];
#ifdef HWRENDER
aatree_t *hardware_patch[8]; aatree_t *hardware_patch[8];
#endif/*HWRENDER*/
} rotsprite_t; } rotsprite_t;
#endif #endif/*ROTSPRITE*/
typedef enum typedef enum
{ {

View File

@ -125,9 +125,11 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
sprtemp[frame].rotsprite.cached[r] = false; sprtemp[frame].rotsprite.cached[r] = false;
for (ang = 0; ang < ROTANGLES; ang++) for (ang = 0; ang < ROTANGLES; ang++)
sprtemp[frame].rotsprite.patch[r][ang] = NULL; sprtemp[frame].rotsprite.patch[r][ang] = NULL;
#ifdef HWRENDER
sprtemp[frame].rotsprite.hardware_patch[r] = M_AATreeAlloc(AATREE_ZUSER); sprtemp[frame].rotsprite.hardware_patch[r] = M_AATreeAlloc(AATREE_ZUSER);
#endif/*HWRENDER*/
} }
#endif #endif/*ROTSPRITE*/
if (rotation == 0) if (rotation == 0)
{ {

View File

@ -61,7 +61,9 @@ static void GameMIDIMusic_OnChange(void);
static void GameSounds_OnChange(void); static void GameSounds_OnChange(void);
static void GameDigiMusic_OnChange(void); static void GameDigiMusic_OnChange(void);
#ifdef HAVE_OPENMPT
static void ModFilter_OnChange(void); static void ModFilter_OnChange(void);
#endif
static lumpnum_t S_GetMusicLumpNum(const char *mname); static lumpnum_t S_GetMusicLumpNum(const char *mname);

View File

@ -1432,6 +1432,8 @@ static void I_ResumeGME(void)
boolean I_LoadSong(char *data, size_t len) boolean I_LoadSong(char *data, size_t len)
{ {
(void)data;
(void)len;
return false; return false;
} }
@ -1493,6 +1495,7 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
(void)target_volume; (void)target_volume;
(void)source_volume; (void)source_volume;
(void)ms; (void)ms;
(void)callback;
return false; return false;
} }
@ -1500,6 +1503,7 @@ boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
{ {
(void)target_volume; (void)target_volume;
(void)ms; (void)ms;
(void)callback;
return false; return false;
} }