This commit is contained in:
Christoph Oelckers 2014-03-15 12:24:16 +01:00
commit f96f4cb0a2
8 changed files with 78 additions and 64 deletions

View file

@ -434,6 +434,7 @@ public:
TObjPtr<AWeapon> PremorphWeapon; // ready weapon before morphing TObjPtr<AWeapon> PremorphWeapon; // ready weapon before morphing
int chickenPeck; // chicken peck countdown int chickenPeck; // chicken peck countdown
int jumpTics; // delay the next jump for a moment int jumpTics; // delay the next jump for a moment
bool onground; // Identifies if this player is on the ground or other object
int respawn_time; // [RH] delay respawning until this tic int respawn_time; // [RH] delay respawning until this tic
TObjPtr<AActor> camera; // [RH] Whose eyes this player sees through TObjPtr<AActor> camera; // [RH] Whose eyes this player sees through

View file

@ -387,7 +387,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
StatusBar->NewGame (); StatusBar->NewGame ();
setsizeneeded = true; setsizeneeded = true;
if (gameinfo.gametype == GAME_Strife || (SBarInfoScript != NULL && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife)) if (gameinfo.gametype == GAME_Strife || (SBarInfoScript[SCRIPT_CUSTOM] != NULL && SBarInfoScript[SCRIPT_CUSTOM]->GetGameType() == GAME_Strife))
{ {
// Set the initial quest log text for Strife. // Set the initial quest log text for Strife.
for (i = 0; i < MAXPLAYERS; ++i) for (i = 0; i < MAXPLAYERS; ++i)
@ -1084,6 +1084,7 @@ void G_StartTravel ()
{ {
AActor *pawn = players[i].mo; AActor *pawn = players[i].mo;
AInventory *inv; AInventory *inv;
players[i].camera = NULL;
// Only living players travel. Dead ones get a new body on the new level. // Only living players travel. Dead ones get a new body on the new level.
if (players[i].health > 0) if (players[i].health > 0)

View file

@ -724,9 +724,10 @@ static bool DoLoadGLNodes(FileReader ** lumps)
static bool MatchHeader(const char * label, const char * hdata) static bool MatchHeader(const char * label, const char * hdata)
{ {
if (!memcmp(hdata, "LEVEL=", 6) == 0) if (memcmp(hdata, "LEVEL=", 6) == 0)
{ {
size_t labellen = strlen(label); size_t labellen = strlen(label);
labellen = MIN(size_t(8), labellen);
if (strnicmp(hdata+6, label, labellen)==0 && if (strnicmp(hdata+6, label, labellen)==0 &&
(hdata[6+labellen]==0xa || hdata[6+labellen]==0xd)) (hdata[6+labellen]==0xa || hdata[6+labellen]==0xd))
@ -771,7 +772,7 @@ static int FindGLNodesInWAD(int labellump)
if (Wads.GetLumpFile(lump)==wadfile) if (Wads.GetLumpFile(lump)==wadfile)
{ {
FMemLump mem = Wads.ReadLump(lump); FMemLump mem = Wads.ReadLump(lump);
if (MatchHeader(Wads.GetLumpFullName(labellump), (const char *)mem.GetMem())) return true; if (MatchHeader(Wads.GetLumpFullName(labellump), (const char *)mem.GetMem())) return lump;
} }
} }
} }
@ -781,7 +782,7 @@ static int FindGLNodesInWAD(int labellump)
//=========================================================================== //===========================================================================
// //
// FindGLNodesInWAD // FindGLNodesInFile
// //
// Looks for GL nodes in the same WAD as the level itself // Looks for GL nodes in the same WAD as the level itself
// Function returns the lump number within the file. Returns -1 if the input // Function returns the lump number within the file. Returns -1 if the input
@ -929,13 +930,13 @@ bool P_LoadGLNodes(MapData * map)
result=true; result=true;
for(unsigned i=0; i<4;i++) for(unsigned i=0; i<4;i++)
{ {
if (strnicmp(f_gwa->GetLump(i)->Name, check[i], 8)) if (strnicmp(f_gwa->GetLump(i+1)->Name, check[i], 8))
{ {
result=false; result=false;
break; break;
} }
else else
gwalumps[i] = f_gwa->GetLump(i)->NewReader(); gwalumps[i] = f_gwa->GetLump(i+1)->NewReader();
} }
if (result) result = DoLoadGLNodes(gwalumps); if (result) result = DoLoadGLNodes(gwalumps);
} }

View file

@ -914,6 +914,8 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
} }
} }
if (tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING))
{
// touchy object is alive, toucher is solid // touchy object is alive, toucher is solid
if (thing->flags6 & MF6_TOUCHY && tm.thing->flags & MF_SOLID && thing->health > 0 && if (thing->flags6 & MF6_TOUCHY && tm.thing->flags & MF_SOLID && thing->health > 0 &&
// Thing is an armed mine or a sentient thing // Thing is an armed mine or a sentient thing
@ -930,7 +932,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
// but different classes trigger the touchiness, but that seems less straightforwards. // but different classes trigger the touchiness, but that seems less straightforwards.
{ {
thing->flags6 &= ~MF6_ARMED; // Disarm thing->flags6 &= ~MF6_ARMED; // Disarm
P_DamageMobj (thing, NULL, NULL, thing->health, NAME_None, DMG_FORCED); // kill object P_DamageMobj(thing, NULL, NULL, thing->health, NAME_None, DMG_FORCED); // kill object
return true; return true;
} }
@ -940,8 +942,6 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
|| ((thing->activationtype & THINGSPEC_MonsterTrigger) && (tm.thing->flags3 & MF3_ISMONSTER)) || ((thing->activationtype & THINGSPEC_MonsterTrigger) && (tm.thing->flags3 & MF3_ISMONSTER))
|| ((thing->activationtype & THINGSPEC_MissileTrigger) && (tm.thing->flags & MF_MISSILE)) || ((thing->activationtype & THINGSPEC_MissileTrigger) && (tm.thing->flags & MF_MISSILE))
) && (level.maptime > thing->lastbump)) // Leave the bumper enough time to go away ) && (level.maptime > thing->lastbump)) // Leave the bumper enough time to go away
{
if (tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING))
{ {
if (P_ActivateThingSpecial(thing, tm.thing)) if (P_ActivateThingSpecial(thing, tm.thing))
thing->lastbump = level.maptime + TICRATE; thing->lastbump = level.maptime + TICRATE;
@ -955,6 +955,17 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
tm.thing->BlockingMobj = NULL; tm.thing->BlockingMobj = NULL;
return res; return res;
} }
// [ED850] Player Prediction ends here. There is nothing else they could/should do.
if (tm.thing->player != NULL && (tm.thing->player->cheats & CF_PREDICTING))
{
solid = (thing->flags & MF_SOLID) &&
!(thing->flags & MF_NOCLIP) &&
((tm.thing->flags & MF_SOLID) || (tm.thing->flags6 & MF6_BLOCKEDBYSOLIDACTORS));
return !solid || unblocking;
}
// Check for blasted thing running into another // Check for blasted thing running into another
if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE)) if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE))
{ {
@ -1203,8 +1214,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
} }
return false; // don't traverse any more return false; // don't traverse any more
} }
if (thing->flags2 & MF2_PUSHABLE && !(tm.thing->flags2 & MF2_CANNOTPUSH) && if (thing->flags2 & MF2_PUSHABLE && !(tm.thing->flags2 & MF2_CANNOTPUSH))
(tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING)))
{ // Push thing { // Push thing
if (thing->lastpush != tm.PushTime) if (thing->lastpush != tm.PushTime)
{ {

View file

@ -2726,16 +2726,15 @@ int P_FindUniqueTID(int start_tid, int limit)
if (start_tid != 0) if (start_tid != 0)
{ // Do a linear search. { // Do a linear search.
int end_tid = start_tid; if (start_tid > INT_MAX-limit+1)
if (start_tid > 0 && limit > INT_MAX - start_tid + 1) { // If 'limit+start_tid-1' overflows, clamp 'limit' to INT_MAX
{ // If 'limit+start_tid-1' overflows, clamp 'end_tid' to INT_MAX limit = INT_MAX;
end_tid = INT_MAX;
} }
else else
{ {
end_tid += limit-1; limit += start_tid-1;
} }
for (tid = start_tid; tid <= end_tid; ++tid) for (tid = start_tid; tid <= limit; ++tid)
{ {
if (tid != 0 && !P_IsTIDUsed(tid)) if (tid != 0 && !P_IsTIDUsed(tid))
{ {

View file

@ -210,8 +210,6 @@ CCMD (playerclasses)
// 16 pixels of bob // 16 pixels of bob
#define MAXBOB 0x100000 #define MAXBOB 0x100000
bool onground;
FArchive &operator<< (FArchive &arc, player_t *&p) FArchive &operator<< (FArchive &arc, player_t *&p)
{ {
return arc.SerializePointer (players, (BYTE **)&p, sizeof(*players)); return arc.SerializePointer (players, (BYTE **)&p, sizeof(*players));
@ -268,6 +266,7 @@ player_t::player_t()
PremorphWeapon(0), PremorphWeapon(0),
chickenPeck(0), chickenPeck(0),
jumpTics(0), jumpTics(0),
onground(0),
respawn_time(0), respawn_time(0),
camera(0), camera(0),
air_finished(0), air_finished(0),
@ -375,6 +374,7 @@ player_t &player_t::operator=(const player_t &p)
PremorphWeapon = p.PremorphWeapon; PremorphWeapon = p.PremorphWeapon;
chickenPeck = p.chickenPeck; chickenPeck = p.chickenPeck;
jumpTics = p.jumpTics; jumpTics = p.jumpTics;
onground = p.onground;
respawn_time = p.respawn_time; respawn_time = p.respawn_time;
camera = p.camera; camera = p.camera;
air_finished = p.air_finished; air_finished = p.air_finished;
@ -1747,7 +1747,7 @@ void P_CalcHeight (player_t *player)
{ {
player->bob = 0; player->bob = 0;
} }
else if ((player->mo->flags & MF_NOGRAVITY) && !onground) else if ((player->mo->flags & MF_NOGRAVITY) && !player->onground)
{ {
player->bob = FRACUNIT / 2; player->bob = FRACUNIT / 2;
} }
@ -1872,7 +1872,7 @@ void P_MovePlayer (player_t *player)
mo->angle += cmd->ucmd.yaw << 16; mo->angle += cmd->ucmd.yaw << 16;
} }
onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2); player->onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
// killough 10/98: // killough 10/98:
// //
@ -1890,7 +1890,7 @@ void P_MovePlayer (player_t *player)
movefactor = P_GetMoveFactor (mo, &friction); movefactor = P_GetMoveFactor (mo, &friction);
bobfactor = friction < ORIG_FRICTION ? movefactor : ORIG_FRICTION_FACTOR; bobfactor = friction < ORIG_FRICTION ? movefactor : ORIG_FRICTION_FACTOR;
if (!onground && !(player->mo->flags & MF_NOGRAVITY) && !player->mo->waterlevel) if (!player->onground && !(player->mo->flags & MF_NOGRAVITY) && !player->mo->waterlevel)
{ {
// [RH] allow very limited movement if not on ground. // [RH] allow very limited movement if not on ground.
movefactor = FixedMul (movefactor, level.aircontrol); movefactor = FixedMul (movefactor, level.aircontrol);
@ -2061,12 +2061,12 @@ void P_DeathThink (player_t *player)
P_MovePsprites (player); P_MovePsprites (player);
onground = (player->mo->z <= player->mo->floorz); player->onground = (player->mo->z <= player->mo->floorz);
if (player->mo->IsKindOf (RUNTIME_CLASS(APlayerChunk))) if (player->mo->IsKindOf (RUNTIME_CLASS(APlayerChunk)))
{ // Flying bloody skull or flying ice chunk { // Flying bloody skull or flying ice chunk
player->viewheight = 6 * FRACUNIT; player->viewheight = 6 * FRACUNIT;
player->deltaviewheight = 0; player->deltaviewheight = 0;
if (onground) if (player->onground)
{ {
if (player->mo->pitch > -(int)ANGLE_1*19) if (player->mo->pitch > -(int)ANGLE_1*19)
{ {
@ -2365,7 +2365,7 @@ void P_PlayerThink (player_t *player)
if (player->jumpTics != 0) if (player->jumpTics != 0)
{ {
player->jumpTics--; player->jumpTics--;
if (onground && player->jumpTics < -18) if (player->onground && player->jumpTics < -18)
{ {
player->jumpTics = 0; player->jumpTics = 0;
} }
@ -2465,7 +2465,7 @@ void P_PlayerThink (player_t *player)
{ {
player->mo->velz = 3*FRACUNIT; player->mo->velz = 3*FRACUNIT;
} }
else if (level.IsJumpingAllowed() && onground && player->jumpTics == 0) else if (level.IsJumpingAllowed() && player->onground && player->jumpTics == 0)
{ {
fixed_t jumpvelz = player->mo->JumpZ * 35 / TICRATE; fixed_t jumpvelz = player->mo->JumpZ * 35 / TICRATE;
@ -2877,6 +2877,14 @@ void player_t::Serialize (FArchive &arc)
{ {
settings_controller = (this - players == Net_Arbitrator); settings_controller = (this - players == Net_Arbitrator);
} }
if (SaveVersion >= 4505)
{
arc << onground;
}
else
{
onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
}
if (isbot) if (isbot)
{ {

View file

@ -2009,18 +2009,13 @@ void FSpecialFont::LoadTranslations()
} }
// exclude the non-translated colors from the translation calculation // exclude the non-translated colors from the translation calculation
if (notranslate != NULL)
{
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
if (notranslate[i]) if (notranslate[i])
usedcolors[i] = false; usedcolors[i] = false;
}
TotalColors = ActiveColors = SimpleTranslation (usedcolors, PatchRemap, identity, &luminosity); TotalColors = ActiveColors = SimpleTranslation (usedcolors, PatchRemap, identity, &luminosity);
// Map all untranslated colors into the table of used colors // Map all untranslated colors into the table of used colors
if (notranslate != NULL)
{
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
if (notranslate[i]) if (notranslate[i])
@ -2030,7 +2025,6 @@ void FSpecialFont::LoadTranslations()
TotalColors++; TotalColors++;
} }
} }
}
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {

View file

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4504 #define SAVEVER 4505
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)