Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
117 results
Select Git revision
Show changes
...@@ -130,6 +130,10 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam); ...@@ -130,6 +130,10 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
void P_SlideCameraMove(camera_t *thiscam); void P_SlideCameraMove(camera_t *thiscam);
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled); boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
pflags_t P_GetJumpFlags(player_t *player); pflags_t P_GetJumpFlags(player_t *player);
statenum_t P_GetCanonicalPlayerState(player_t *player, statenum_t state);
boolean P_IsPlayerInState(player_t *player, statenum_t state);
boolean P_IsPlayerInSuperTransformationState(player_t *player);
boolean P_IsPlayerInNightsTransformationState(player_t *player);
boolean P_PlayerInPain(player_t *player); boolean P_PlayerInPain(player_t *player);
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor); void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
void P_ResetPlayer(player_t *player); void P_ResetPlayer(player_t *player);
...@@ -553,5 +557,6 @@ void P_DoSuperDetransformation(player_t *player); ...@@ -553,5 +557,6 @@ void P_DoSuperDetransformation(player_t *player);
void P_ExplodeMissile(mobj_t *mo); void P_ExplodeMissile(mobj_t *mo);
void P_CheckGravity(mobj_t *mo, boolean affect); void P_CheckGravity(mobj_t *mo, boolean affect);
void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope); void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope);
boolean P_IsMobjInPainState(mobj_t *mobj);
#endif // __P_LOCAL__ #endif // __P_LOCAL__
...@@ -508,7 +508,7 @@ static void P_DoFan(mobj_t *fan, mobj_t *object) ...@@ -508,7 +508,7 @@ static void P_DoFan(mobj_t *fan, mobj_t *object)
fixed_t speed = fan->info->mass; // fans use this for the vertical thrust fixed_t speed = fan->info->mass; // fans use this for the vertical thrust
SINT8 flipval = P_MobjFlip(fan); // virtually everything here centers around the thruster's gravity, not the object's! SINT8 flipval = P_MobjFlip(fan); // virtually everything here centers around the thruster's gravity, not the object's!
if (p && object->state == &states[object->info->painstate]) // can't use fans when player is in pain! if (p && P_IsPlayerInState(p, S_PLAY_PAIN)) // can't use fans when player is in pain!
return; return;
// is object's top below thruster's position? if not, calculate distance between their bottoms // is object's top below thruster's position? if not, calculate distance between their bottoms
...@@ -3033,7 +3033,7 @@ static boolean P_ThingHeightClip(mobj_t *thing) ...@@ -3033,7 +3033,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
if (tmfloorz > oldfloorz+thing->height) if (tmfloorz > oldfloorz+thing->height)
return true; return true;
bouncing = thing->player && thing->state-states == S_PLAY_BOUNCE_LANDING && P_IsObjectOnGround(thing); bouncing = thing->player && P_IsPlayerInState(thing->player, S_PLAY_BOUNCE_LANDING) && P_IsObjectOnGround(thing);
if ((onfloor || bouncing) && !(thing->flags & MF_NOGRAVITY) && floormoved) if ((onfloor || bouncing) && !(thing->flags & MF_NOGRAVITY) && floormoved)
{ {
......
...@@ -1056,7 +1056,7 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *), mobj_ ...@@ -1056,7 +1056,7 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *), mobj_
boolean checkthing = false; boolean checkthing = false;
if (thing) if (thing)
checkthing = true; checkthing = true;
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
return true; return true;
...@@ -1434,7 +1434,7 @@ static boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac) ...@@ -1434,7 +1434,7 @@ static boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac)
if (dist > maxfrac) if (dist > maxfrac)
return true; // Checked everything in range. return true; // Checked everything in range.
if (!func(in)) if (!func(in))
return false; // Don't bother going farther. return false; // Don't bother going farther.
...@@ -1462,7 +1462,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, ...@@ -1462,7 +1462,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
validcount++; validcount++;
intercept_p = intercepts; intercept_p = intercepts;
if (((px1 - bmaporgx) & (MAPBLOCKSIZE-1)) == 0) if (((px1 - bmaporgx) & (MAPBLOCKSIZE-1)) == 0)
px1 += FRACUNIT; // Don't side exactly on a line. px1 += FRACUNIT; // Don't side exactly on a line.
...@@ -1475,7 +1475,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, ...@@ -1475,7 +1475,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
trace.dy = py2 - py1; trace.dy = py2 - py1;
xt1 = px1>>MAPBLOCKSHIFT; xt1 = px1>>MAPBLOCKSHIFT;
yt1 = py2>>MAPBLOCKSHIFT; yt1 = py1>>MAPBLOCKSHIFT;
px1 = (unsigned)(px1 - bmaporgx); px1 = (unsigned)(px1 - bmaporgx);
py1 = (unsigned)(py1 - bmaporgy); py1 = (unsigned)(py1 - bmaporgy);
...@@ -1624,6 +1624,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, ...@@ -1624,6 +1624,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
break; break;
} }
} }
// Go through the sorted list // Go through the sorted list
return P_TraverseIntercepts(trav, FRACUNIT); return P_TraverseIntercepts(trav, FRACUNIT);
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "p_slopes.h" #include "p_slopes.h"
#include "f_finale.h" #include "f_finale.h"
#include "m_cond.h" #include "m_cond.h"
#include "simple_hashmap.h"
#include "netcode/net_command.h" #include "netcode/net_command.h"
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}}; static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
...@@ -178,6 +179,61 @@ static void P_CycleMobjState(mobj_t *mobj) ...@@ -178,6 +179,61 @@ static void P_CycleMobjState(mobj_t *mobj)
} }
} }
static panim_t GetPlayerAnimationFromState(player_t *player, statenum_t state)
{
switch(P_GetCanonicalPlayerState(player, state))
{
case S_PLAY_STND:
case S_PLAY_WAIT:
case S_PLAY_NIGHTS_STAND:
return PA_IDLE;
case S_PLAY_EDGE:
return PA_EDGE;
case S_PLAY_WALK:
case S_PLAY_SKID:
case S_PLAY_FLOAT:
return PA_WALK;
case S_PLAY_RUN:
case S_PLAY_FLOAT_RUN:
return PA_RUN;
case S_PLAY_DASH:
return PA_DASH;
case S_PLAY_PAIN:
case S_PLAY_STUN:
return PA_PAIN;
case S_PLAY_ROLL:
//case S_PLAY_SPINDASH: -- everyone can ROLL thanks to zoom tubes...
case S_PLAY_NIGHTS_ATTACK:
return PA_ROLL;
case S_PLAY_JUMP:
return PA_JUMP;
case S_PLAY_SPRING:
return PA_SPRING;
case S_PLAY_FALL:
case S_PLAY_NIGHTS_FLOAT:
return PA_FALL;
case S_PLAY_FLY:
case S_PLAY_FLY_TIRED:
case S_PLAY_SWIM:
case S_PLAY_GLIDE:
case S_PLAY_BOUNCE:
case S_PLAY_BOUNCE_LANDING:
case S_PLAY_TWINSPIN:
return PA_ABILITY;
case S_PLAY_SPINDASH: // ...but the act of SPINDASHING is charability2 specific.
case S_PLAY_FIRE:
case S_PLAY_FIRE_FINISH:
case S_PLAY_MELEE:
case S_PLAY_MELEE_FINISH:
case S_PLAY_MELEE_LANDING:
return PA_ABILITY2;
case S_PLAY_RIDE:
return PA_RIDE;
default:
return PA_ETC;
}
}
// //
// P_SetPlayerMobjState // P_SetPlayerMobjState
// Returns true if the mobj is still present. // Returns true if the mobj is still present.
...@@ -201,6 +257,12 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) ...@@ -201,6 +257,12 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
I_Error("P_SetPlayerMobjState used for non-player mobj. Use P_SetMobjState instead!\n(Mobj type: %d, State: %d)", mobj->type, state); I_Error("P_SetPlayerMobjState used for non-player mobj. Use P_SetMobjState instead!\n(Mobj type: %d, State: %d)", mobj->type, state);
#endif #endif
// If the state has been overriden for this skin, use the replacement instead
statenum_t customskinstate;
SIMPLEHASH_FIND_INT(skins[player->skin]->defaulttocustomstate, hashentry_int32_int32_t, state, S_NULL, customskinstate)
if (customskinstate)
state = customskinstate;
// Catch falling for nojumpspin // Catch falling for nojumpspin
if ((state == S_PLAY_JUMP) && (player->charflags & SF_NOJUMPSPIN) && (P_MobjFlip(mobj)*mobj->momz < 0)) if ((state == S_PLAY_JUMP) && (player->charflags & SF_NOJUMPSPIN) && (P_MobjFlip(mobj)*mobj->momz < 0))
return P_SetPlayerMobjState(mobj, S_PLAY_FALL); return P_SetPlayerMobjState(mobj, S_PLAY_FALL);
...@@ -222,88 +284,24 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) ...@@ -222,88 +284,24 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{ {
if (state == S_PLAY_JUMP) if (state == S_PLAY_JUMP)
{ {
if (player->mo->state-states == S_PLAY_WALK) if (P_IsPlayerInState(player, S_PLAY_WALK))
return P_SetPlayerMobjState(mobj, S_PLAY_FLOAT); return P_SetPlayerMobjState(mobj, S_PLAY_FLOAT);
return true; return true;
} }
else if (player->mo->state-states == S_PLAY_FLOAT && state == S_PLAY_STND) else if (P_IsPlayerInState(player, S_PLAY_FLOAT) && state == S_PLAY_STND)
return true; return true;
} }
// You were in pain state after taking a hit, and you're moving out of pain state now? // You were in pain state after taking a hit, and you're moving out of pain state now?
else if (mobj->state == &states[mobj->info->painstate] && player->powers[pw_flashing] == flashingtics && state != mobj->info->painstate) else if (P_IsPlayerInState(player, S_PLAY_PAIN)
&& player->powers[pw_flashing] == flashingtics
&& P_GetCanonicalPlayerState(player, state) != S_PLAY_PAIN)
{ {
// Start flashing, since you've landed. // Start flashing, since you've landed.
player->powers[pw_flashing] = flashingtics-1; player->powers[pw_flashing] = flashingtics-1;
P_DoPityCheck(player); P_DoPityCheck(player);
} }
// Set animation state player->panim = GetPlayerAnimationFromState(player, state);
// The pflags version of this was just as convoluted.
switch(state)
{
case S_PLAY_STND:
case S_PLAY_WAIT:
case S_PLAY_NIGHTS_STAND:
player->panim = PA_IDLE;
break;
case S_PLAY_EDGE:
player->panim = PA_EDGE;
break;
case S_PLAY_WALK:
case S_PLAY_SKID:
case S_PLAY_FLOAT:
player->panim = PA_WALK;
break;
case S_PLAY_RUN:
case S_PLAY_FLOAT_RUN:
player->panim = PA_RUN;
break;
case S_PLAY_DASH:
player->panim = PA_DASH;
break;
case S_PLAY_PAIN:
case S_PLAY_STUN:
player->panim = PA_PAIN;
break;
case S_PLAY_ROLL:
//case S_PLAY_SPINDASH: -- everyone can ROLL thanks to zoom tubes...
case S_PLAY_NIGHTS_ATTACK:
player->panim = PA_ROLL;
break;
case S_PLAY_JUMP:
player->panim = PA_JUMP;
break;
case S_PLAY_SPRING:
player->panim = PA_SPRING;
break;
case S_PLAY_FALL:
case S_PLAY_NIGHTS_FLOAT:
player->panim = PA_FALL;
break;
case S_PLAY_FLY:
case S_PLAY_FLY_TIRED:
case S_PLAY_SWIM:
case S_PLAY_GLIDE:
case S_PLAY_BOUNCE:
case S_PLAY_BOUNCE_LANDING:
case S_PLAY_TWINSPIN:
player->panim = PA_ABILITY;
break;
case S_PLAY_SPINDASH: // ...but the act of SPINDASHING is charability2 specific.
case S_PLAY_FIRE:
case S_PLAY_FIRE_FINISH:
case S_PLAY_MELEE:
case S_PLAY_MELEE_FINISH:
case S_PLAY_MELEE_LANDING:
player->panim = PA_ABILITY2;
break;
case S_PLAY_RIDE:
player->panim = PA_RIDE;
break;
default:
player->panim = PA_ETC;
break;
}
if (recursion++) // if recursion detected, if (recursion++) // if recursion detected,
memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table
...@@ -3717,7 +3715,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) ...@@ -3717,7 +3715,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
// momentum movement // momentum movement
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN; mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
if (mobj->state-states == S_PLAY_BOUNCE_LANDING) if (P_IsPlayerInState(mobj->player, S_PLAY_BOUNCE_LANDING))
goto animonly; // no need for checkposition - doesn't move at ALL goto animonly; // no need for checkposition - doesn't move at ALL
// Zoom tube // Zoom tube
...@@ -7013,14 +7011,6 @@ static void P_MobjScaleThink(mobj_t *mobj) ...@@ -7013,14 +7011,6 @@ static void P_MobjScaleThink(mobj_t *mobj)
mobj->z -= (mobj->height - oldheight)/2; mobj->z -= (mobj->height - oldheight)/2;
else if (correctionType == 2) else if (correctionType == 2)
mobj->z -= mobj->height - oldheight; mobj->z -= mobj->height - oldheight;
if (mobj->scale == mobj->destscale)
/// \todo Lua hook for "reached destscale"?
switch (mobj->type)
{
default:
break;
}
} }
static void P_MaceSceneryThink(mobj_t *mobj) static void P_MaceSceneryThink(mobj_t *mobj)
...@@ -10139,6 +10129,7 @@ static boolean P_FuseThink(mobj_t *mobj) ...@@ -10139,6 +10129,7 @@ static boolean P_FuseThink(mobj_t *mobj)
// //
void P_MobjThinker(mobj_t *mobj) void P_MobjThinker(mobj_t *mobj)
{ {
boolean ispushable;
I_Assert(mobj != NULL); I_Assert(mobj != NULL);
I_Assert(!P_MobjWasRemoved(mobj)); I_Assert(!P_MobjWasRemoved(mobj));
...@@ -10164,8 +10155,10 @@ void P_MobjThinker(mobj_t *mobj) ...@@ -10164,8 +10155,10 @@ void P_MobjThinker(mobj_t *mobj)
tmfloorthing = tmhitthing = NULL; tmfloorthing = tmhitthing = NULL;
ispushable = mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse);
// Sector flag MSF_TRIGGERLINE_MOBJ allows ANY mobj to trigger a linedef exec // Sector flag MSF_TRIGGERLINE_MOBJ allows ANY mobj to trigger a linedef exec
P_CheckMobjTrigger(mobj, false); P_CheckMobjTrigger(mobj, ispushable);
if (mobj->scale != mobj->destscale) if (mobj->scale != mobj->destscale)
P_MobjScaleThink(mobj); // Slowly scale up/down to reach your destscale. P_MobjScaleThink(mobj); // Slowly scale up/down to reach your destscale.
...@@ -10209,7 +10202,7 @@ void P_MobjThinker(mobj_t *mobj) ...@@ -10209,7 +10202,7 @@ void P_MobjThinker(mobj_t *mobj)
// if it's pushable, or if it would be pushable other than temporary disablement, use the // if it's pushable, or if it would be pushable other than temporary disablement, use the
// separate thinker // separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse)) if (ispushable)
{ {
if (!P_MobjPushableThink(mobj)) if (!P_MobjPushableThink(mobj))
return; return;
...@@ -10385,8 +10378,6 @@ void P_PushableThinker(mobj_t *mobj) ...@@ -10385,8 +10378,6 @@ void P_PushableThinker(mobj_t *mobj)
I_Assert(mobj != NULL); I_Assert(mobj != NULL);
I_Assert(!P_MobjWasRemoved(mobj)); I_Assert(!P_MobjWasRemoved(mobj));
P_CheckMobjTrigger(mobj, true);
// it has to be pushable RIGHT NOW for this part to happen // it has to be pushable RIGHT NOW for this part to happen
if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy)) if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy))
P_TryMove(mobj, mobj->x, mobj->y, true); P_TryMove(mobj, mobj->x, mobj->y, true);
...@@ -14372,3 +14363,11 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo ...@@ -14372,3 +14363,11 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
return newmobj; return newmobj;
} }
boolean P_IsMobjInPainState(mobj_t *mobj)
{
if (mobj->player)
return P_IsPlayerInState(mobj->player, S_PLAY_PAIN);
else
return (mobj->state == &states[mobj->info->painstate]);
}
...@@ -302,6 +302,18 @@ typedef enum ...@@ -302,6 +302,18 @@ typedef enum
DRONE = 0x80, DRONE = 0x80,
} player_saveflags; } player_saveflags;
static inline UINT32 SavePlayer(const player_t *player)
{
if (player) return (UINT32)(player - players);
return 0xFFFFFFFF;
}
static inline player_t *LoadPlayer(UINT32 player)
{
if (player >= MAXPLAYERS) return NULL;
return &players[player];
}
static inline void P_ArchivePlayer(save_t *save_p) static inline void P_ArchivePlayer(save_t *save_p)
{ {
const player_t *player = &players[consoleplayer]; const player_t *player = &players[consoleplayer];
...@@ -441,6 +453,7 @@ static void P_NetArchivePlayers(save_t *save_p) ...@@ -441,6 +453,7 @@ static void P_NetArchivePlayers(save_t *save_p)
// Bots // // Bots //
////////// //////////
P_WriteUINT8(save_p, players[i].bot); P_WriteUINT8(save_p, players[i].bot);
P_WriteUINT32(save_p, SavePlayer(players[i].botleader));
P_WriteUINT8(save_p, players[i].botmem.lastForward); P_WriteUINT8(save_p, players[i].botmem.lastForward);
P_WriteUINT8(save_p, players[i].botmem.lastBlocked); P_WriteUINT8(save_p, players[i].botmem.lastBlocked);
P_WriteUINT8(save_p, players[i].botmem.catchup_tics); P_WriteUINT8(save_p, players[i].botmem.catchup_tics);
...@@ -672,6 +685,7 @@ static void P_NetUnArchivePlayers(save_t *save_p) ...@@ -672,6 +685,7 @@ static void P_NetUnArchivePlayers(save_t *save_p)
// Bots // // Bots //
////////// //////////
players[i].bot = P_ReadUINT8(save_p); players[i].bot = P_ReadUINT8(save_p);
players[i].botleader = LoadPlayer(P_ReadUINT32(save_p));
players[i].botmem.lastForward = P_ReadUINT8(save_p); players[i].botmem.lastForward = P_ReadUINT8(save_p);
players[i].botmem.lastBlocked = P_ReadUINT8(save_p); players[i].botmem.lastBlocked = P_ReadUINT8(save_p);
...@@ -2106,12 +2120,6 @@ static UINT32 SaveLine(const line_t *line) ...@@ -2106,12 +2120,6 @@ static UINT32 SaveLine(const line_t *line)
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
static inline UINT32 SavePlayer(const player_t *player)
{
if (player) return (UINT32)(player - players);
return 0xFFFFFFFF;
}
static UINT32 SaveSlope(const pslope_t *slope) static UINT32 SaveSlope(const pslope_t *slope)
{ {
if (slope) return (UINT32)(slope->id); if (slope) return (UINT32)(slope->id);
...@@ -3237,12 +3245,6 @@ static line_t *LoadLine(UINT32 line) ...@@ -3237,12 +3245,6 @@ static line_t *LoadLine(UINT32 line)
return &lines[line]; return &lines[line];
} }
static inline player_t *LoadPlayer(UINT32 player)
{
if (player >= MAXPLAYERS) return NULL;
return &players[player];
}
static inline pslope_t *LoadSlope(UINT32 slopeid) static inline pslope_t *LoadSlope(UINT32 slopeid)
{ {
pslope_t *p = slopelist; pslope_t *p = slopelist;
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
/// \file p_setup.c /// \file p_setup.c
/// \brief Do all the WAD I/O, get map description, set up initial state and misc. LUTs /// \brief Do all the WAD I/O, get map description, set up initial state and misc. LUTs
#include <errno.h>
#include "doomdef.h" #include "doomdef.h"
#include "d_main.h" #include "d_main.h"
#include "byteptr.h" #include "byteptr.h"
...@@ -1077,6 +1080,7 @@ static void P_LoadSectors(UINT8 *data) ...@@ -1077,6 +1080,7 @@ static void P_LoadSectors(UINT8 *data)
ss->triggerer = TO_PLAYER; ss->triggerer = TO_PLAYER;
ss->friction = ORIG_FRICTION; ss->friction = ORIG_FRICTION;
ss->customargs = NULL;
P_InitializeSector(ss); P_InitializeSector(ss);
} }
...@@ -1199,6 +1203,8 @@ static void P_LoadLinedefs(UINT8 *data) ...@@ -1199,6 +1203,8 @@ static void P_LoadLinedefs(UINT8 *data)
if (ld->sidenum[1] == 0xffff) if (ld->sidenum[1] == 0xffff)
ld->sidenum[1] = NO_SIDEDEF; ld->sidenum[1] = NO_SIDEDEF;
ld->customargs = NULL;
P_InitializeLinedef(ld); P_InitializeLinedef(ld);
} }
} }
...@@ -1370,6 +1376,8 @@ static void P_LoadSidedefs(UINT8 *data) ...@@ -1370,6 +1376,8 @@ static void P_LoadSidedefs(UINT8 *data)
sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0; sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0;
sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false; sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false;
sd->customargs = NULL;
P_SetSidedefSector(i, (UINT16)SHORT(msd->sector)); P_SetSidedefSector(i, (UINT16)SHORT(msd->sector));
// Special info stored in texture fields! // Special info stored in texture fields!
...@@ -1553,6 +1561,7 @@ static void P_LoadThings(UINT8 *data) ...@@ -1553,6 +1561,7 @@ static void P_LoadThings(UINT8 *data)
mt->z = mt->options >> ZSHIFT; mt->z = mt->options >> ZSHIFT;
mt->mobj = NULL; mt->mobj = NULL;
mt->customargs = NULL;
} }
} }
...@@ -1657,6 +1666,89 @@ static boolean TextmapCount(size_t size) ...@@ -1657,6 +1666,89 @@ static boolean TextmapCount(size_t size)
return true; return true;
} }
static void ParseTextmapCustomFields(const char* param, const char* val, customargs_t** headptr)
{
if (val[0] == '\0')
return;
//
// GET latest node
//
customargs_t* newnode = Z_Malloc(sizeof(customargs_t), PU_LEVEL, NULL);
if (!newnode)
return;
newnode->next = NULL;
if (*headptr == NULL) {
*headptr = newnode;
}
else {
customargs_t* curr = *headptr;
while (curr->next != NULL) {
curr = curr->next;
}
curr->next = newnode;
}
//
// Setup
//
newnode->name = Z_Malloc(strlen(param + 5) + 1, PU_LEVEL, NULL);
M_Memcpy(newnode->name, param + 5, strlen(param + 5) + 1);
if (fastcmp(val, "true"))
{
newnode->type = UDMF_TYPE_BOOLEAN;
newnode->value.vbool = true;
}
else if (fastcmp(val, "false"))
{
newnode->type = UDMF_TYPE_BOOLEAN;
newnode->value.vbool = false;
}
else
{
char* endptr;
long lval;
float fval;
// Eval integer
errno = 0;
lval = strtol(val, &endptr, 10);
if (*endptr == '\0' && endptr != val && errno == 0) {
newnode->type = UDMF_TYPE_NUMERIC;
newnode->value.vint = lval;
return;
}
// Eval float
errno = 0;
fval = strtof(val, &endptr);
if (*endptr == '\0' && endptr != val && errno == 0) {
newnode->type = UDMF_TYPE_FIXED;
newnode->value.vfloat = FLOAT_TO_FIXED(fval);
return;
}
// Just string
newnode->type = UDMF_TYPE_STRING;
newnode->value.vstring = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL);
M_Memcpy(newnode->value.vstring, val, strlen(val) + 1);
}
}
static void ParseTextmapVertexParameter(UINT32 i, const char *param, const char *val) static void ParseTextmapVertexParameter(UINT32 i, const char *param, const char *val)
{ {
if (fastcmp(param, "x")) if (fastcmp(param, "x"))
...@@ -1756,6 +1848,8 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char ...@@ -1756,6 +1848,8 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char
sectors[i].floorangle = FixedAngle(FLOAT_TO_FIXED(atof(val))); sectors[i].floorangle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
else if (fastcmp(param, "rotationceiling")) else if (fastcmp(param, "rotationceiling"))
sectors[i].ceilingangle = FixedAngle(FLOAT_TO_FIXED(atof(val))); sectors[i].ceilingangle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
else if (fastncmp(param, "user_", 5) && strlen(param) > 5)
ParseTextmapCustomFields(param, val, &sectors[i].customargs);
else if (fastcmp(param, "floorplane_a")) else if (fastcmp(param, "floorplane_a"))
{ {
textmap_planefloor.defined |= PD_A; textmap_planefloor.defined |= PD_A;
...@@ -1996,6 +2090,8 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char ...@@ -1996,6 +2090,8 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char
sides[i].lightabsolute_mid = true; sides[i].lightabsolute_mid = true;
else if (fastcmp(param, "lightabsolute_bottom") && fastcmp("true", val)) else if (fastcmp(param, "lightabsolute_bottom") && fastcmp("true", val))
sides[i].lightabsolute_bottom = true; sides[i].lightabsolute_bottom = true;
else if (fastncmp(param, "user_", 5) && strlen(param) > 5)
ParseTextmapCustomFields(param, val, &sides[i].customargs);
} }
static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val) static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val)
...@@ -2090,6 +2186,9 @@ static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char ...@@ -2090,6 +2186,9 @@ static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char
lines[i].flags |= ML_BOUNCY; lines[i].flags |= ML_BOUNCY;
else if (fastcmp(param, "transfer") && fastcmp("true", val)) else if (fastcmp(param, "transfer") && fastcmp("true", val))
lines[i].flags |= ML_TFERLINE; lines[i].flags |= ML_TFERLINE;
else if (fastncmp(param, "user_", 5) && strlen(param) > 5)
ParseTextmapCustomFields(param, val, &lines[i].customargs);
} }
static void ParseTextmapThingParameter(UINT32 i, const char *param, const char *val) static void ParseTextmapThingParameter(UINT32 i, const char *param, const char *val)
...@@ -2149,6 +2248,8 @@ static void ParseTextmapThingParameter(UINT32 i, const char *param, const char * ...@@ -2149,6 +2248,8 @@ static void ParseTextmapThingParameter(UINT32 i, const char *param, const char *
return; return;
mapthings[i].args[argnum] = atol(val); mapthings[i].args[argnum] = atol(val);
} }
else if (fastncmp(param, "user_", 5) && strlen(param) > 5)
ParseTextmapCustomFields(param, val, &mapthings[i].customargs);
} }
/** From a given position table, run a specified parser function through a {}-encapsuled text. /** From a given position table, run a specified parser function through a {}-encapsuled text.
...@@ -3053,6 +3154,7 @@ static void P_LoadTextmap(void) ...@@ -3053,6 +3154,7 @@ static void P_LoadTextmap(void)
sc->triggerer = TO_PLAYER; sc->triggerer = TO_PLAYER;
sc->friction = ORIG_FRICTION; sc->friction = ORIG_FRICTION;
sc->customargs = NULL;
textmap_colormap.used = false; textmap_colormap.used = false;
textmap_colormap.lightcolor = 0; textmap_colormap.lightcolor = 0;
...@@ -3114,6 +3216,7 @@ static void P_LoadTextmap(void) ...@@ -3114,6 +3216,7 @@ static void P_LoadTextmap(void)
ld->executordelay = 0; ld->executordelay = 0;
ld->sidenum[0] = NO_SIDEDEF; ld->sidenum[0] = NO_SIDEDEF;
ld->sidenum[1] = NO_SIDEDEF; ld->sidenum[1] = NO_SIDEDEF;
ld->customargs = NULL;
TextmapParse(linedefBlocks.pos[i], i, ParseTextmapLinedefParameter); TextmapParse(linedefBlocks.pos[i], i, ParseTextmapLinedefParameter);
...@@ -3143,6 +3246,7 @@ static void P_LoadTextmap(void) ...@@ -3143,6 +3246,7 @@ static void P_LoadTextmap(void)
sd->repeatcnt = 0; sd->repeatcnt = 0;
sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0; sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0;
sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false; sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false;
sd->customargs = NULL;
TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter); TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter);
...@@ -3167,6 +3271,7 @@ static void P_LoadTextmap(void) ...@@ -3167,6 +3271,7 @@ static void P_LoadTextmap(void)
memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args)); memset(mt->args, 0, NUMMAPTHINGARGS*sizeof(*mt->args));
memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs)); memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs));
mt->mobj = NULL; mt->mobj = NULL;
mt->customargs = NULL;
TextmapParse(mapthingBlocks.pos[i], i, ParseTextmapThingParameter); TextmapParse(mapthingBlocks.pos[i], i, ParseTextmapThingParameter);
} }
......
...@@ -4677,7 +4677,7 @@ static void P_ProcessZoomTube(player_t *player, mtag_t sectag, boolean end) ...@@ -4677,7 +4677,7 @@ static void P_ProcessZoomTube(player_t *player, mtag_t sectag, boolean end)
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY); player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY);
player->climbing = 0; player->climbing = 0;
if (player->mo->state-states != S_PLAY_ROLL) if (!P_IsPlayerInState(player, S_PLAY_ROLL))
{ {
P_SetMobjState(player->mo, S_PLAY_ROLL); P_SetMobjState(player->mo, S_PLAY_ROLL);
S_StartSound(player->mo, sfx_spin); S_StartSound(player->mo, sfx_spin);
...@@ -4758,7 +4758,7 @@ static void P_ProcessRopeHang(player_t *player, mtag_t sectag) ...@@ -4758,7 +4758,7 @@ static void P_ProcessRopeHang(player_t *player, mtag_t sectag)
if (player->cmd.buttons & BT_SPIN) if (player->cmd.buttons & BT_SPIN)
return; return;
if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate]) if (!(player->pflags & PF_SLIDING) && P_IsPlayerInState(player, S_PLAY_PAIN))
return; return;
if (player->exiting) if (player->exiting)
...@@ -8805,7 +8805,7 @@ void T_Pusher(pusher_t *p) ...@@ -8805,7 +8805,7 @@ void T_Pusher(pusher_t *p)
if (thing->player && thing->player->powers[pw_carry] == CR_ROPEHANG) if (thing->player && thing->player->powers[pw_carry] == CR_ROPEHANG)
continue; continue;
if (thing->player && (thing->state == &states[thing->info->painstate]) && (thing->player->powers[pw_flashing] > (flashingtics/4)*3 && thing->player->powers[pw_flashing] <= flashingtics)) if (thing->player && P_IsPlayerInState(thing->player, S_PLAY_PAIN) && (thing->player->powers[pw_flashing] > (flashingtics/4)*3 && thing->player->powers[pw_flashing] <= flashingtics))
continue; continue;
inFOF = touching = moved = false; inFOF = touching = moved = false;
......
This diff is collapsed.
...@@ -556,6 +556,8 @@ typedef struct sector_s ...@@ -556,6 +556,8 @@ typedef struct sector_s
// portals // portals
UINT32 portal_floor; UINT32 portal_floor;
UINT32 portal_ceiling; UINT32 portal_ceiling;
struct customargs_s* customargs;
} sector_t; } sector_t;
// //
...@@ -618,6 +620,7 @@ typedef struct line_s ...@@ -618,6 +620,7 @@ typedef struct line_s
UINT32 secportal; // transferred sector portal UINT32 secportal; // transferred sector portal
struct pslope_s *midtexslope; struct pslope_s *midtexslope;
struct customargs_s *customargs;
} line_t; } line_t;
typedef struct typedef struct
...@@ -654,6 +657,7 @@ typedef struct ...@@ -654,6 +657,7 @@ typedef struct
INT16 repeatcnt; // # of times to repeat midtexture INT16 repeatcnt; // # of times to repeat midtexture
extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors. extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors.
struct customargs_s* customargs;
} side_t; } side_t;
// //
......
...@@ -54,12 +54,26 @@ INT32 R_GetRollAngle(angle_t rollangle) ...@@ -54,12 +54,26 @@ INT32 R_GetRollAngle(angle_t rollangle)
patch_t *Patch_GetRotated(patch_t *patch, INT32 angle, boolean flip) patch_t *Patch_GetRotated(patch_t *patch, INT32 angle, boolean flip)
{ {
rotsprite_t *rotsprite = patch->rotated; rotsprite_t *rotsprite = patch->rotated;
if (rotsprite == NULL || angle < 1 || angle >= ROTANGLES) if (angle < 1 || angle >= ROTANGLES)
return NULL; return NULL;
if (rotsprite == NULL)
{
rotsprite = RotatedPatch_Create(ROTANGLES);
patch->rotated = rotsprite;
}
if (flip) if (flip)
angle += rotsprite->angles; angle += rotsprite->angles;
if (rotsprite->patches[angle] == NULL)
{
INT32 xpivot = 0, ypivot = 0;
xpivot = patch->leftoffset;
ypivot = patch->topoffset;
RotatedPatch_DoRotation(rotsprite, patch, angle, xpivot, ypivot, flip);
}
return rotsprite->patches[angle]; return rotsprite->patches[angle];
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "p_local.h" #include "p_local.h"
#include "dehacked.h" // get_number (for thok) #include "dehacked.h" // get_number (for thok)
#include "m_cond.h" #include "m_cond.h"
#include "deh_tables.h"
#ifdef HWRENDER #ifdef HWRENDER
#include "hardware/hw_md2.h" #include "hardware/hw_md2.h"
#endif #endif
...@@ -791,6 +792,88 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) ...@@ -791,6 +792,88 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
return true; return true;
} }
// e.g. "RUN" => S_PLAY_RUN, "RUN1" => S_PLAY_RUN, "RUN8" => S_PLAY_RUN
static statenum_t GetCanonicalPlayerStateNumByName(const char *name)
{
if (startswith(name, "STAND")) return S_PLAY_STND;
else if (startswith(name, "STND")) return S_PLAY_STND;
else if (startswith(name, "WAIT")) return S_PLAY_WAIT;
else if (startswith(name, "WALK")) return S_PLAY_WALK;
else if (startswith(name, "SKID")) return S_PLAY_SKID;
else if (startswith(name, "RUN")) return S_PLAY_RUN;
else if (startswith(name, "DASH")) return S_PLAY_DASH;
else if (startswith(name, "PAIN")) return S_PLAY_PAIN;
else if (startswith(name, "STUN")) return S_PLAY_STUN;
else if (startswith(name, "DEAD")) return S_PLAY_DEAD;
else if (startswith(name, "DRWN")) return S_PLAY_DRWN;
else if (startswith(name, "ROLL")) return S_PLAY_ROLL;
else if (startswith(name, "GASP")) return S_PLAY_GASP;
else if (startswith(name, "JUMP")) return S_PLAY_JUMP;
else if (startswith(name, "SPRING")) return S_PLAY_SPRING;
else if (startswith(name, "FALL")) return S_PLAY_FALL;
else if (startswith(name, "EDGE")) return S_PLAY_EDGE;
else if (startswith(name, "RIDE")) return S_PLAY_RIDE;
else if (startswith(name, "SPINDASH")) return S_PLAY_SPINDASH;
else if (startswith(name, "FLY")) return S_PLAY_FLY;
else if (startswith(name, "SWIM")) return S_PLAY_SWIM;
else if (startswith(name, "FLY_TIRED")) return S_PLAY_FLY_TIRED;
else if (startswith(name, "GLIDE")) return S_PLAY_GLIDE;
else if (startswith(name, "GLIDE_LANDING")) return S_PLAY_GLIDE_LANDING;
else if (startswith(name, "CLING")) return S_PLAY_CLING;
else if (startswith(name, "CLIMB")) return S_PLAY_CLIMB;
else if (startswith(name, "FLOAT")) return S_PLAY_FLOAT;
else if (startswith(name, "FLOAT_RUN")) return S_PLAY_FLOAT_RUN;
else if (startswith(name, "BOUNCE")) return S_PLAY_BOUNCE;
else if (startswith(name, "BOUNCE_LANDING")) return S_PLAY_BOUNCE_LANDING;
else if (startswith(name, "FIRE")) return S_PLAY_FIRE;
else if (startswith(name, "FIRE_FINISH")) return S_PLAY_FIRE_FINISH;
else if (startswith(name, "TWINSPIN")) return S_PLAY_TWINSPIN;
else if (startswith(name, "MELEE")) return S_PLAY_MELEE;
else if (startswith(name, "MELEE_FINISH")) return S_PLAY_MELEE_FINISH;
else if (startswith(name, "MELEE_LANDING")) return S_PLAY_MELEE_LANDING;
else if (startswith(name, "NIGHTS_STAND")) return S_PLAY_NIGHTS_STAND;
else if (startswith(name, "NIGHTS_FLOAT")) return S_PLAY_NIGHTS_FLOAT;
else if (startswith(name, "NIGHTS_FLY")) return S_PLAY_NIGHTS_FLY;
else if (startswith(name, "NIGHTS_DRILL")) return S_PLAY_NIGHTS_DRILL;
else if (startswith(name, "NIGHTS_STUN")) return S_PLAY_NIGHTS_STUN;
else if (startswith(name, "NIGHTS_PULL")) return S_PLAY_NIGHTS_PULL;
else if (startswith(name, "NIGHTS_ATTACK")) return S_PLAY_NIGHTS_ATTACK;
else return S_NULL;
}
static void CacheCustomSkinStates(skin_t *skin)
{
SIMPLEHASH_CLEAR(skin->defaulttocustomstate, hashentry_int32_int32_t)
SIMPLEHASH_CLEAR(skin->customtodefaultstate, hashentry_int32_int32_t)
char *skinstateprefix = va("SKIN_%s_", skin->name);
strupr(skinstateprefix);
size_t skinstateprefixlen = strlen(skinstateprefix);
for (INT32 state = S_FIRSTFREESLOT; state <= S_LASTFREESLOT; state++)
{
const char *statename = FREE_STATES[state - S_FIRSTFREESLOT];
if (!statename)
continue;
if (strncmp(statename, skinstateprefix, skinstateprefixlen))
continue;
statenum_t defaultstate = GetCanonicalPlayerStateNumByName(&statename[skinstateprefixlen]);
if (defaultstate)
{
// If a default state is overriden by multiple custom states, use the first one as reference
// e.g. WALK+WALK2+WALK3+WALK4 instead of just WALK
statenum_t alreadyoverriden;
SIMPLEHASH_FIND_INT(skin->defaulttocustomstate, hashentry_int32_int32_t, defaultstate, S_NULL, alreadyoverriden)
if (!alreadyoverriden)
SIMPLEHASH_REPLACE_INT(skin->defaulttocustomstate, hashentry_int32_int32_t, defaultstate, state)
SIMPLEHASH_REPLACE_INT(skin->customtodefaultstate, hashentry_int32_int32_t, state, defaultstate)
}
}
}
// //
// Find skin sprites, sounds & optional status bar face, & add them // Find skin sprites, sounds & optional status bar face, & add them
// //
...@@ -945,6 +1028,8 @@ next_token: ...@@ -945,6 +1028,8 @@ next_token:
R_FlushTranslationColormapCache(); R_FlushTranslationColormapCache();
CacheCustomSkinStates(skin);
if (mainfile == false) if (mainfile == false)
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name); CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
...@@ -1082,6 +1167,8 @@ next_token: ...@@ -1082,6 +1167,8 @@ next_token:
R_FlushTranslationColormapCache(); R_FlushTranslationColormapCache();
CacheCustomSkinStates(skin);
if (mainfile == false) if (mainfile == false)
CONS_Printf(M_GetText("Patched skin '%s'\n"), skin->name); CONS_Printf(M_GetText("Patched skin '%s'\n"), skin->name);
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "r_patch.h" #include "r_patch.h"
#include "r_picformats.h" // spriteinfo_t #include "r_picformats.h" // spriteinfo_t
#include "r_defs.h" // spritedef_t #include "r_defs.h" // spritedef_t
#include "simple_hashmap.h"
/// Defaults /// Defaults
#define SKINNAMESIZE 16 #define SKINNAMESIZE 16
...@@ -89,6 +90,9 @@ typedef struct ...@@ -89,6 +90,9 @@ typedef struct
spriteinfo_t sprinfo[NUMPLAYERSPRITES]; spriteinfo_t sprinfo[NUMPLAYERSPRITES];
} super; } super;
hashentry_int32_int32_t *defaulttocustomstate; // e.g. S_PLAY_WALK => S_SKIN_BIGTHECAT_WALK
hashentry_int32_int32_t *customtodefaultstate; // e.g. S_SKIN_BIGTHECAT_WALK => S_PLAY_WALK
// TODO: 2.3: Delete // TODO: 2.3: Delete
spritedef_t sprites_compat[NUMPLAYERSPRITES * 2]; spritedef_t sprites_compat[NUMPLAYERSPRITES * 2];
} skin_t; } skin_t;
......
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<PreprocessorDefinitions>HAVE_CURL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>HAVE_CURL;HAVE_THREADS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\libs\curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\libs\curl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<CustomBuild> <CustomBuild>
...@@ -513,6 +513,7 @@ ...@@ -513,6 +513,7 @@
<ClCompile Include="..\lua_hudlib_drawlist.c" /> <ClCompile Include="..\lua_hudlib_drawlist.c" />
<ClCompile Include="..\lua_infolib.c" /> <ClCompile Include="..\lua_infolib.c" />
<ClCompile Include="..\lua_inputlib.c" /> <ClCompile Include="..\lua_inputlib.c" />
<ClCompile Include="..\lua_interceptlib.c" />
<ClCompile Include="..\lua_maplib.c" /> <ClCompile Include="..\lua_maplib.c" />
<ClCompile Include="..\lua_mathlib.c" /> <ClCompile Include="..\lua_mathlib.c" />
<ClCompile Include="..\lua_mobjlib.c" /> <ClCompile Include="..\lua_mobjlib.c" />
...@@ -629,6 +630,7 @@ ...@@ -629,6 +630,7 @@
<ClCompile Include="i_main.c" /> <ClCompile Include="i_main.c" />
<ClCompile Include="i_net.c" /> <ClCompile Include="i_net.c" />
<ClCompile Include="i_system.c" /> <ClCompile Include="i_system.c" />
<ClCompile Include="i_threads.c" />
<ClCompile Include="i_ttf.c" /> <ClCompile Include="i_ttf.c" />
<ClCompile Include="i_video.c" /> <ClCompile Include="i_video.c" />
<ClCompile Include="mixer_sound.c" /> <ClCompile Include="mixer_sound.c" />
...@@ -642,4 +644,4 @@ ...@@ -642,4 +644,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>
\ No newline at end of file
...@@ -757,9 +757,6 @@ ...@@ -757,9 +757,6 @@
<ClCompile Include="..\hardware\hw_shaders.c"> <ClCompile Include="..\hardware\hw_shaders.c">
<Filter>Hw_Hardware</Filter> <Filter>Hw_Hardware</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\hardware\u_list.c">
<Filter>Hw_Hardware</Filter>
</ClCompile>
<ClCompile Include="..\filesrch.c"> <ClCompile Include="..\filesrch.c">
<Filter>I_Interface</Filter> <Filter>I_Interface</Filter>
</ClCompile> </ClCompile>
...@@ -783,6 +780,9 @@ ...@@ -783,6 +780,9 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\lua_inputlib.c"> <ClCompile Include="..\lua_inputlib.c">
<Filter>LUA</Filter> <Filter>LUA</Filter>
</ClCompile>
<ClCompile Include="..\lua_interceptlib.c">
<Filter>LUA</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\lua_maplib.c"> <ClCompile Include="..\lua_maplib.c">
<Filter>LUA</Filter> <Filter>LUA</Filter>
...@@ -1122,10 +1122,13 @@ ...@@ -1122,10 +1122,13 @@
<ClCompile Include="..\r_bbox.c"> <ClCompile Include="..\r_bbox.c">
<Filter>R_Rend</Filter> <Filter>R_Rend</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="i_threads.c">
<Filter>SDLApp</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="Srb2SDL.ico"> <Image Include="Srb2SDL.ico">
<Filter>SDLApp</Filter> <Filter>SDLApp</Filter>
</Image> </Image>
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
...@@ -186,9 +186,6 @@ int main(int argc, char **argv) ...@@ -186,9 +186,6 @@ int main(int argc, char **argv)
#endif #endif
#endif #endif
// disable text input right off the bat, since we don't need it at the start.
I_SetTextInputMode(false);
#ifdef LOGMESSAGES #ifdef LOGMESSAGES
if (!M_CheckParm("-nolog")) if (!M_CheckParm("-nolog"))
InitLogging(); InitLogging();
......
...@@ -1857,6 +1857,9 @@ void I_StartupGraphics(void) ...@@ -1857,6 +1857,9 @@ void I_StartupGraphics(void)
if (mousegrabok && !disable_mouse) if (mousegrabok && !disable_mouse)
SDLdoGrabMouse(); SDLdoGrabMouse();
// disable text input right off the bat, since we don't need it at the start.
I_SetTextInputMode(textinputmodeenabledbylua);
graphics_started = true; graphics_started = true;
} }
......
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file simplehash.h
/// \brief Macros for handling basic hashmap types
#ifndef __SIMPLEHASH__
#define __SIMPLEHASH__
#include "uthash.h"
typedef struct
{
INT32 k;
INT32 v;
UT_hash_handle hh;
} hashentry_int32_int32_t;
// hashmap<type>[key] = value;
#define SIMPLEHASH_REPLACE_INT(hashmap, type, key, value) \
{ \
type *entry = malloc(sizeof(type)); \
if (!entry) \
I_Error("%s:%d: Out of memory\n", __func__, __LINE__); \
entry->k = (key); \
entry->v = (value); \
\
type *oldentry; \
HASH_REPLACE_INT((hashmap), k, entry, oldentry); \
if (oldentry) \
free(oldentry); \
}
#define SIMPLEHASH_CLEAR(hashmap, type) \
{ \
type *entry, *tmpentry; \
HASH_ITER(hh, (hashmap), entry, tmpentry) \
{ \
HASH_DEL((hashmap), entry); \
free(entry); \
} \
}
// value = hashmap<type>[key] or fallback;
#define SIMPLEHASH_FIND_INT(hashmap, type, key, fallback, value) \
{ \
int tmpkey = (key); \
type *entry; \
HASH_FIND_INT((hashmap), &tmpkey, entry); \
(value) = entry ? entry->v : (int)(fallback); \
}
#endif //__SIMPLEHASH__
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define SPEED 5 #define SPEED 5
#define NUM_BLOCKS_X 20 #define NUM_BLOCKS_X 20
#define NUM_BLOCKS_Y 10 #define NUM_BLOCKS_Y 8
#define BLOCK_SIZE 12 #define BLOCK_SIZE 12
#define BORDER_SIZE 12 #define BORDER_SIZE 12
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define LEFT_X ((BASEVIDWIDTH - MAP_WIDTH) / 2 - BORDER_SIZE) #define LEFT_X ((BASEVIDWIDTH - MAP_WIDTH) / 2 - BORDER_SIZE)
#define RIGHT_X (LEFT_X + MAP_WIDTH + BORDER_SIZE * 2 - 1) #define RIGHT_X (LEFT_X + MAP_WIDTH + BORDER_SIZE * 2 - 1)
#define BOTTOM_Y (BASEVIDHEIGHT - 48) #define BOTTOM_Y (BASEVIDHEIGHT - 76)
#define TOP_Y (BOTTOM_Y - MAP_HEIGHT - BORDER_SIZE * 2 + 1) #define TOP_Y (BOTTOM_Y - MAP_HEIGHT - BORDER_SIZE * 2 + 1)
enum bonustype_s { enum bonustype_s {
......
This diff is collapsed.
#define SRB2VERSION "2.2.15"/* this must be the first line, for cmake !! */ #define SRB2VERSION "2.2.16"/* this must be the first line, for cmake !! */
// The Modification ID; must be obtained from a Master Server Admin ( https://mb.srb2.org/members/?key=ms_admin ). // The Modification ID; must be obtained from a Master Server Admin ( https://mb.srb2.org/members/?key=ms_admin ).
// DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server. // DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// it's only for detection of the version the player is using so the MS can alert them of an update. // it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously. // Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1". // Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1".
#define MODVERSION 56 #define MODVERSION 57
// Define this as a prerelease version suffix (pre#, RC#) // Define this as a prerelease version suffix (pre#, RC#)
//#define BETAVERSION "pre4" #define BETAVERSION "nightly"