diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 3324bd0ab..a5cc43258 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +January 10, 2009 (Changes by Graf Zahl) +- fixed: Identification of Doom1 Freedoom IWAD did not work. +- fixed: UDMF did not initialize a sector's light colors. +- fixed implementation of DF2_NOAUTOAIM flag. + January 7, 2009 (Changes by Graf Zahl) - copied some 3D floor fixes from GZDoom. - fixed: Crushing polyobject did incomplete checks for blocked moves. diff --git a/src/d_main.cpp b/src/d_main.cpp index fd6a22085..98cb0cd80 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -479,19 +479,6 @@ CUSTOM_CVAR (Int, dmflags2, 0, CVAR_SERVERINFO) if (p->cheats & CF_CHASECAM) cht_DoCheat (p, CHT_CHASECAM); } - - // Change our autoaim settings if need be. - if (dmflags2 & DF2_NOAUTOAIM) - { - // Save our aimdist and set aimdist to 0. - p->userinfo.savedaimdist = p->userinfo.aimdist; - p->userinfo.aimdist = 0; - } - else - { - // Restore our aimdist. - p->userinfo.aimdist = p->userinfo.savedaimdist; - } } } @@ -1634,18 +1621,15 @@ static EIWADType ScanIWAD (const char *iwad) } else { + if (lumpsfound[Check_FreeDoom]) + { + return IWAD_FreeDoom1; + } for (i = Check_e2m1; i < NUM_CHECKLUMPS; i++) { if (!lumpsfound[i]) { - if (lumpsfound[Check_FreeDoom]) - { - return IWAD_FreeDoom1; - } - else - { - return IWAD_DoomShareware; - } + return IWAD_DoomShareware; } } if (i == NUM_CHECKLUMPS) diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 6f5b331c3..cb097d593 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -370,17 +370,11 @@ void D_SetupUserInfo () } if (autoaim > 35.f || autoaim < 0.f) { - if (dmflags & DF2_NOAUTOAIM) - coninfo->savedaimdist = ANGLE_1*35; - else - coninfo->aimdist = ANGLE_1*35; + coninfo->aimdist = ANGLE_1*35; } else { - if (dmflags & DF2_NOAUTOAIM) - coninfo->savedaimdist = abs ((int)(autoaim * (float)ANGLE_1)); - else - coninfo->aimdist = abs ((int)(autoaim * (float)ANGLE_1)); + coninfo->aimdist = abs ((int)(autoaim * (float)ANGLE_1)); } coninfo->color = color; coninfo->skin = R_FindSkin (skin, 0); @@ -690,16 +684,10 @@ void D_ReadUserInfoStrings (int i, BYTE **stream, bool update) angles = atof (value); if (angles > 35.f || angles < 0.f) { - if (dmflags & DF2_NOAUTOAIM) - info->savedaimdist = ANGLE_1*35; - else info->aimdist = ANGLE_1*35; } else { - if (dmflags & DF2_NOAUTOAIM) - info->savedaimdist = abs ((int)(angles * (float)ANGLE_1)); - else info->aimdist = abs ((int)(angles * (float)ANGLE_1)); } } @@ -816,8 +804,11 @@ FArchive &operator<< (FArchive &arc, userinfo_t &info) arc.Read (&info.netname, sizeof(info.netname)); } arc << info.team << info.aimdist << info.color << info.skin << info.gender << info.neverswitch; - if (SaveVersion >= 1333) arc << info.savedaimdist; - else info.savedaimdist = info.aimdist; + if (SaveVersion >= 1333 && SaveVersion <= 1355) + { + int savedaimdist; + arc << savedaimdist; + } return arc; } diff --git a/src/d_player.h b/src/d_player.h index e58eb9f3f..b8fec8173 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -27,6 +27,7 @@ // is buffered within the player data struct, // as commands per game tick. #include "d_ticcmd.h" +#include "doomstat.h" #include "a_artifacts.h" @@ -195,7 +196,6 @@ struct userinfo_t { char netname[MAXPLAYERNAME+1]; BYTE team; - int savedaimdist; int aimdist; int color; int skin; @@ -203,6 +203,8 @@ struct userinfo_t bool neverswitch; fixed_t MoveBob, StillBob; int PlayerClass; + + int GetAimDist() const { return (dmflags2 & DF2_NOAUTOAIM)? aimdist : 0; } }; FArchive &operator<< (FArchive &arc, userinfo_t &info); diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index ac4e0a0e3..39128fdfe 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -452,9 +452,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG) { return; } - // [RH] bfg can be forced to not use freeaim - angle_t storedpitch = self->pitch; - int storedaimdist = player->userinfo.aimdist; AWeapon *weapon = self->player->ReadyWeapon; if (weapon != NULL) @@ -463,14 +460,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG) return; } - if (dmflags2 & DF2_NO_FREEAIMBFG) - { - self->pitch = 0; - player->userinfo.aimdist = ANGLE_1*35; - } - P_SpawnPlayerMissile (self, PClass::FindClass("BFGBall")); - self->pitch = storedpitch; - player->userinfo.aimdist = storedaimdist; + P_SpawnPlayerMissile (self, 0, 0, 0, PClass::FindClass("BFGBall"), self->angle, NULL, NULL, !!(dmflags2 & DF2_NO_FREEAIMBFG)); } // diff --git a/src/p_acs.cpp b/src/p_acs.cpp index f744809a8..3769328f4 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5372,7 +5372,7 @@ int DLevelScript::RunScript () switch (STACK(1)) { case PLAYERINFO_TEAM: STACK(2) = userinfo->team; break; - case PLAYERINFO_AIMDIST: STACK(2) = userinfo->aimdist; break; + case PLAYERINFO_AIMDIST: STACK(2) = userinfo->GetAimDist(); break; case PLAYERINFO_COLOR: STACK(2) = userinfo->color; break; case PLAYERINFO_GENDER: STACK(2) = userinfo->gender; break; case PLAYERINFO_NEVERSWITCH: STACK(2) = userinfo->neverswitch; break; diff --git a/src/p_local.h b/src/p_local.h index 4624fd012..5030634c0 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -122,7 +122,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PCl AActor *P_SpawnPlayerMissile (AActor* source, const PClass *type); AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type, angle_t angle); AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, const PClass *type, angle_t angle, - AActor **pLineTarget = NULL, AActor **MissileActor = NULL); + AActor **pLineTarget = NULL, AActor **MissileActor = NULL, bool nofreeaim = false); void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheight=false); diff --git a/src/p_map.cpp b/src/p_map.cpp index 9db494b6f..6935022c9 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1779,11 +1779,6 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) { FCheckPosition tm; fixed_t newz = thing->z; - int side; - int oldside; - line_t* ld; - sector_t* oldsec = thing->Sector; // [RH] for sector actions - sector_t* newsec; if (!P_CheckPosition (thing, x, y, tm)) { @@ -2925,7 +2920,7 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p // vrange of 0 degrees, because then toppitch and bottompitch will // be equal, and PTR_AimTraverse will never find anything to shoot at // if it crosses a line. - vrange = clamp (t1->player->userinfo.aimdist, ANGLE_1/2, ANGLE_1*35); + vrange = clamp (t1->player->userinfo.GetAimDist(), ANGLE_1/2, ANGLE_1*35); } } aim.toppitch = t1->pitch - vrange; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f908bf2ce..666c70b60 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4796,24 +4796,27 @@ AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type, angle_t angle) } AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, - const PClass *type, angle_t angle, AActor **pLineTarget, AActor **pMissileActor) + const PClass *type, angle_t angle, AActor **pLineTarget, AActor **pMissileActor, + bool nofreeaim) { static const int angdiff[3] = { -1<<26, 1<<26, 0 }; int i; angle_t an; angle_t pitch; AActor *linetarget; + int vrange = nofreeaim? ANGLE_1*35 : 0; // see which target is to be aimed at i = 2; do { an = angle + angdiff[i]; - pitch = P_AimLineAttack (source, an, 16*64*FRACUNIT, &linetarget); + pitch = P_AimLineAttack (source, an, 16*64*FRACUNIT, &linetarget, vrange); if (source->player != NULL && + !nofreeaim && level.IsFreelookAllowed() && - source->player->userinfo.aimdist <= ANGLE_1/2) + source->player->userinfo.GetAimDist() <= ANGLE_1/2) { break; } diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 1e1bdf2d6..70ee7bcb8 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -648,7 +648,7 @@ angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget) if (mo->player != NULL && level.IsFreelookAllowed() && - mo->player->userinfo.aimdist <= ANGLE_1/2) + mo->player->userinfo.GetAimDist() <= ANGLE_1/2) { break; } diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index b3521e14c..94bfdc77f 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -950,19 +950,36 @@ struct UDMFParser sec->ceilingplane.c = -FRACUNIT; sec->ceilingplane.ic = -FRACUNIT; - // [RH] Sectors default to white light with the default fade. - // If they are outside (have a sky ceiling), they use the outside fog. - if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) + if (lightcolor == -1 && fadecolor == -1 && desaturation == -1) { - if (fogMap == NULL) - fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); - sec->ColorMap = fogMap; + // [RH] Sectors default to white light with the default fade. + // If they are outside (have a sky ceiling), they use the outside fog. + if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) + { + if (fogMap == NULL) + fogMap = GetSpecialLights (PalEntry (255,255,255), level.outsidefog, 0); + sec->ColorMap = fogMap; + } + else + { + if (normMap == NULL) + normMap = GetSpecialLights (PalEntry (255,255,255), level.fadeto, NormalLight.Desaturate); + sec->ColorMap = normMap; + } } else { - if (normMap == NULL) - normMap = GetSpecialLights (PalEntry (255,255,255), level.fadeto, NormalLight.Desaturate); - sec->ColorMap = normMap; + if (lightcolor == -1) lightcolor = PalEntry(255,255,255); + if (fadecolor == -1) + { + if (level.outsidefog != 0xff000000 && (sec->GetTexture(sector_t::ceiling) == skyflatnum || (sec->special&0xff) == Sector_Outside)) + fadecolor = level.outsidefog; + else + fadecolor = level.fadeto; + } + if (desaturation == -1) desaturation = NormalLight.Desaturate; + + sec->ColorMap = GetSpecialLights (lightcolor, fadecolor, desaturation); } }