diff --git a/src/dehacked.c b/src/dehacked.c index cfe76cb0..829acbc0 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9811,6 +9811,9 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"spbplace")) { lua_pushinteger(L, spbplace); return 1; + } else if (fastcmp(word,"mapobjectscale")) { + lua_pushinteger(L, mapobjectscale); + return 1; } return 0; } diff --git a/src/doomstat.h b/src/doomstat.h index 0a724b40..6d710e28 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -444,6 +444,7 @@ extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations extern UINT32 countdown, countdown2; extern fixed_t gravity; +extern fixed_t mapobjectscale; //for CTF balancing extern INT16 autobalance; diff --git a/src/g_game.c b/src/g_game.c index 43de5bdb..97203b68 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -237,6 +237,7 @@ mobj_t *hunt3; UINT32 countdown, countdown2; // for racing fixed_t gravity; +fixed_t mapobjectscale; INT16 autobalance; //for CTF team balance INT16 teamscramble; //for CTF team scramble diff --git a/src/k_kart.c b/src/k_kart.c index 9de1343c..44c490ed 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -648,7 +648,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed) { secondist = P_AproxDistance(P_AproxDistance(players[first].mo->x - players[second].mo->x, players[first].mo->y - players[second].mo->y), - players[first].mo->z - players[second].mo->z) / mapheaderinfo[gamemap-1]->mobj_scale; + players[first].mo->z - players[second].mo->z) / mapobjectscale; if (franticitems) secondist = (15*secondist/14); if (pingame < 8 && !G_BattleGametype()) @@ -809,7 +809,7 @@ static INT32 K_FindUseodds(player_t *player, fixed_t mashed, INT32 pingame, INT3 && players[i].kartstuff[k_position] < player->kartstuff[k_position]) pdis += P_AproxDistance(P_AproxDistance(players[i].mo->x - player->mo->x, players[i].mo->y - player->mo->y), - players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale + players[i].mo->z - player->mo->z) / mapobjectscale * (pingame - players[i].kartstuff[k_position]) / max(1, ((pingame - 1) * (pingame + 1) / 3)); } @@ -1121,13 +1121,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) momdify = mobj1->momy - mobj2->momy; // if the speed difference is less than this let's assume they're going proportionately faster from each other - if (P_AproxDistance(momdifx, momdify) < (25*mapheaderinfo[gamemap-1]->mobj_scale)) + if (P_AproxDistance(momdifx, momdify) < (25*mapobjectscale)) { fixed_t momdiflength = P_AproxDistance(momdifx, momdify); fixed_t normalisedx = FixedDiv(momdifx, momdiflength); fixed_t normalisedy = FixedDiv(momdify, momdiflength); - momdifx = FixedMul((25*mapheaderinfo[gamemap-1]->mobj_scale), normalisedx); - momdify = FixedMul((25*mapheaderinfo[gamemap-1]->mobj_scale), normalisedy); + momdifx = FixedMul((25*mapobjectscale), normalisedx); + momdify = FixedMul((25*mapobjectscale), normalisedy); } // Adds the OTHER player's momentum, so that it reduces the chance of you being "inside" the other object @@ -1433,10 +1433,10 @@ void K_RespawnChecker(player_t *player) { if (player->kartstuff[k_growshrinktimer] < 0) { - player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE; - player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8; + player->mo->scalespeed = mapobjectscale/TICRATE; + player->mo->destscale = (6*mapobjectscale)/8; if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = 6*player->mo->destscale/8; + player->mo->destscale = (6*player->mo->destscale)/8; } if (!P_IsObjectOnGround(player->mo) && !mapreset) @@ -1728,7 +1728,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) fixed_t finalspeed; if (doboostpower && !player->kartstuff[k_pogospring] && !P_IsObjectOnGround(player->mo)) - return (75*mapheaderinfo[gamemap-1]->mobj_scale); // air speed cap + return (75*mapobjectscale); // air speed cap switch (gamespeed) { @@ -1793,7 +1793,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove if (player->kartstuff[k_pogospring]) // Pogo Spring minimum/maximum thrust { - const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale /*+ (mapheaderinfo[gamemap-1]->mobj_scale - player->mo->scale)*/; + const fixed_t hscale = mapobjectscale /*+ (mapobjectscale - player->mo->scale)*/; const fixed_t minspeed = 24*hscale; const fixed_t maxspeed = 28*hscale; @@ -1994,10 +1994,10 @@ static void K_RemoveGrowShrink(player_t *player) player->kartstuff[k_growshrinktimer] = 0; if (player->kartstuff[k_invincibilitytimer] == 0) player->mo->color = player->skincolor; - player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE; - player->mo->destscale = mapheaderinfo[gamemap-1]->mobj_scale; + player->mo->scalespeed = mapobjectscale/TICRATE; + player->mo->destscale = mapobjectscale; if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = 6*player->mo->destscale/8; + player->mo->destscale = (6*player->mo->destscale)/8; P_RestoreMusic(player); } @@ -2161,7 +2161,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b if (source && source != player->mo && source->player) K_PlayHitEmSound(source); - player->mo->momz = 18*(mapheaderinfo[gamemap-1]->mobj_scale); + player->mo->momz = 18*mapobjectscale; player->mo->momx = player->mo->momy = 0; player->kartstuff[k_sneakertimer] = 0; @@ -2899,20 +2899,20 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map PROJSPEED = FixedMul(PROJSPEED, FRACUNIT-FRACUNIT/4); else if (gamespeed == 2) PROJSPEED = FixedMul(PROJSPEED, FRACUNIT+FRACUNIT/4); - PROJSPEED = FixedMul(PROJSPEED, mapheaderinfo[gamemap-1]->mobj_scale); + PROJSPEED = FixedMul(PROJSPEED, mapobjectscale); } else { switch (gamespeed) { case 0: - PROJSPEED = 68*(mapheaderinfo[gamemap-1]->mobj_scale); // Avg Speed is 34 + PROJSPEED = 68*mapobjectscale; // Avg Speed is 34 break; case 2: - PROJSPEED = 96*(mapheaderinfo[gamemap-1]->mobj_scale); // Avg Speed is 48 + PROJSPEED = 96*mapobjectscale; // Avg Speed is 48 break; default: - PROJSPEED = 82*(mapheaderinfo[gamemap-1]->mobj_scale); // Avg Speed is 41 + PROJSPEED = 82*mapobjectscale; // Avg Speed is 41 break; } } @@ -3000,7 +3000,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map if (mo) { angle_t fa = player->mo->angle>>ANGLETOFINESHIFT; - INT32 HEIGHT = (20 + (dir*10))*(mapheaderinfo[gamemap-1]->mobj_scale) + player->mo->momz; + INT32 HEIGHT = (20 + (dir*10))*mapobjectscale + player->mo->momz; mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED)); mo->momy = player->mo->momy + FixedMul(FINESINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED)); @@ -3290,10 +3290,10 @@ static void K_DoShrink(player_t *user) { // Start shrinking! K_DropItems(&players[i]); - players[i].mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE; - players[i].mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8; + players[i].mo->scalespeed = mapobjectscale/TICRATE; + players[i].mo->destscale = (6*mapobjectscale)/8; if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot) - players[i].mo->destscale = 6*players[i].mo->destscale/8; + players[i].mo->destscale = (6*players[i].mo->destscale)/8; players[i].kartstuff[k_growshrinktimer] = -(200+(40*(MAXPLAYERS-players[i].kartstuff[k_position]))); } @@ -3310,7 +3310,7 @@ static void K_DoShrink(player_t *user) void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) { - const fixed_t vscale = mapheaderinfo[gamemap-1]->mobj_scale + (mo->scale - mapheaderinfo[gamemap-1]->mobj_scale); + const fixed_t vscale = mapobjectscale + (mo->scale - mapobjectscale); if (mo->player && mo->player->spectator) return; @@ -3508,8 +3508,8 @@ void K_DropHnextList(player_t *player) dropwork->z += flip; dropwork->momx = player->mo->momx>>1; dropwork->momy = player->mo->momy>>1; - dropwork->momz = 3*flip*mapheaderinfo[gamemap-1]->mobj_scale; - P_Thrust(dropwork, work->angle - ANGLE_90, 6*(mapheaderinfo[gamemap-1]->mobj_scale)); + dropwork->momz = 3*flip*mapobjectscale; + P_Thrust(dropwork, work->angle - ANGLE_90, 6*mapobjectscale); dropwork->movecount = 2; dropwork->movedir = work->angle - ANGLE_90; P_SetMobjState(dropwork, dropwork->info->deathstate); @@ -3565,8 +3565,8 @@ void K_DropItems(player_t *player) drop->angle = player->mo->angle + ANGLE_90; P_Thrust(drop, FixedAngle(P_RandomFixed()*180) + player->mo->angle + ANGLE_90, - 16*(mapheaderinfo[gamemap-1]->mobj_scale)); - drop->momz = P_MobjFlip(player->mo)*3*(mapheaderinfo[gamemap-1]->mobj_scale); + 16*mapobjectscale); + drop->momz = P_MobjFlip(player->mo)*3*mapobjectscale; drop->threshold = (thunderhack ? KITEM_THUNDERSHIELD : player->kartstuff[k_itemtype]); drop->movecount = player->kartstuff[k_itemamount]; @@ -4023,7 +4023,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->kartstuff[k_respawn] == 1)) // Startup boosts targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0); else - targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapheaderinfo[gamemap-1]->mobj_scale)/5))/2; + targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2; if (targetsnd < 0) targetsnd = 0; @@ -4060,7 +4060,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) dist = P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x, player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2; - dist = FixedDiv(dist, mapheaderinfo[gamemap-1]->mobj_scale); + dist = FixedDiv(dist, mapobjectscale); if (dist > 1536<kartstuff[k_growshrinktimer] <= 0) // Grow holds the item box hostage { K_PlayPowerGloatSound(player->mo); - player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/TICRATE; - player->mo->destscale = 3*(mapheaderinfo[gamemap-1]->mobj_scale)/2; + player->mo->scalespeed = mapobjectscale/TICRATE; + player->mo->destscale = (3*mapobjectscale)/2; if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = 6*player->mo->destscale/8; + player->mo->destscale = (6*player->mo->destscale)/8; player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds P_RestoreMusic(player); if (!P_IsLocalPlayer(player)) @@ -5495,10 +5495,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // Increase your size while charging your engine. if (leveltime < starttime+10) { - player->mo->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12; - player->mo->destscale = (mapheaderinfo[gamemap-1]->mobj_scale) + (player->kartstuff[k_boostcharge]*131); + player->mo->scalespeed = mapobjectscale/12; + player->mo->destscale = mapobjectscale + (player->kartstuff[k_boostcharge]*131); if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = 6*player->mo->destscale/8; + player->mo->destscale = (6*player->mo->destscale)/8; } // Determine the outcome of your charge. @@ -7083,17 +7083,17 @@ static void K_drawKartSpeedometer(void) if (cv_kartspeedometer.value == 1) // Kilometers { - convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; // 2.172409058 + convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058 V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed)); } else if (cv_kartspeedometer.value == 2) // Miles { - convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; // 1.349868774 + convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774 V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed)); } else if (cv_kartspeedometer.value == 3) // Fracunits { - convSpeed = FixedDiv(stplyr->speed, mapheaderinfo[gamemap-1]->mobj_scale)/FRACUNIT; + convSpeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT; V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed)); } } diff --git a/src/p_enemy.c b/src/p_enemy.c index 3fb3aca6..fc3ae9d9 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3971,7 +3971,7 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) void A_GrenadeRing(mobj_t *actor) { INT32 bx, by, xl, xh, yl, yh; - explodedist = FixedMul(actor->info->painchance, mapheaderinfo[gamemap-1]->mobj_scale); + explodedist = FixedMul(actor->info->painchance, mapobjectscale); #ifdef HAVE_BLUA if (LUA_CallAction("A_GrenadeRing", actor)) return; @@ -4039,7 +4039,7 @@ void A_MineExplode(mobj_t *actor) INT32 d; INT32 locvar1 = var1; mobjtype_t type; - explodedist = FixedMul((3*actor->info->painchance)/2, mapheaderinfo[gamemap-1]->mobj_scale); + explodedist = FixedMul((3*actor->info->painchance)/2, mapobjectscale); #ifdef HAVE_BLUA if (LUA_CallAction("A_MineExplode", actor)) return; @@ -4060,7 +4060,7 @@ void A_MineExplode(mobj_t *actor) P_BlockThingsIterator(bx, by, PIT_MineExplode); for (d = 0; d < 16; d++) - K_SpawnKartExplosion(actor->x, actor->y, actor->z, explodedist + 32*mapheaderinfo[gamemap-1]->mobj_scale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 + K_SpawnKartExplosion(actor->x, actor->y, actor->z, explodedist + 32*mapobjectscale, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64 if (actor->target && actor->target->player) K_SpawnMineExplosion(actor, actor->target->player->skincolor); @@ -10382,7 +10382,7 @@ void A_SetScale(mobj_t *actor) return; } - locvar1 = FixedMul(locvar1, mapheaderinfo[gamemap-1]->mobj_scale); // SRB2Kart + locvar1 = FixedMul(locvar1, mapobjectscale); // SRB2Kart target->destscale = locvar1; // destination scale if (!(locvar2 & 65535)) diff --git a/src/p_floor.c b/src/p_floor.c index 752a66b7..e11fe403 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -3009,7 +3009,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) fixed_t topz; fixed_t a, b, c; mobjtype_t type = MT_ROCKCRUMBLE1; - const fixed_t spacing = 48*mapheaderinfo[gamemap-1]->mobj_scale; + const fixed_t spacing = 48*mapobjectscale; // If the control sector has a special // of Section3:7-15, use the custom debris. diff --git a/src/p_inter.c b/src/p_inter.c index fce8ccd5..4fedcea8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -366,7 +366,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_SetTarget(&special->tracer, toucher); special->flags2 |= MF2_NIGHTSPULL; - special->destscale = mapheaderinfo[gamemap-1]->mobj_scale>>4; + special->destscale = mapobjectscale>>4; special->scalespeed <<= 1; special->flags &= ~MF_SPECIAL; diff --git a/src/p_map.c b/src/p_map.c index 1e77dd81..c307e572 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -116,8 +116,8 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) boolean P_DoSpring(mobj_t *spring, mobj_t *object) { //INT32 pflags; - const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - object->scale); - const fixed_t vscale = mapheaderinfo[gamemap-1]->mobj_scale + (object->scale - mapheaderinfo[gamemap-1]->mobj_scale); + const fixed_t hscale = mapobjectscale + (mapobjectscale - object->scale); + const fixed_t vscale = mapobjectscale + (object->scale - mapobjectscale); fixed_t offx, offy; fixed_t vertispeed = spring->info->mass; fixed_t horizspeed = spring->info->damage; @@ -1424,9 +1424,9 @@ static boolean PIT_CheckThing(mobj_t *thing) && !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height)) { - if (tmthing->scale > thing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8)) // SRB2kart - Handle squishes first! + if (tmthing->scale > thing->scale + (mapobjectscale/8)) // SRB2kart - Handle squishes first! K_SquishPlayer(thing->player, tmthing, tmthing); - else if (thing->scale > tmthing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8)) + else if (thing->scale > tmthing->scale + (mapobjectscale/8)) K_SquishPlayer(tmthing->player, thing, tmthing); else if (tmthing->player->kartstuff[k_invincibilitytimer] && !thing->player->kartstuff[k_invincibilitytimer]) // SRB2kart - Then invincibility! P_DamageMobj(thing, tmthing, tmthing, 1); @@ -1523,9 +1523,9 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // underneath if (thing->player->kartstuff[k_squishedtimer] || thing->player->kartstuff[k_hyudorotimer] - || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8) + || thing->player->kartstuff[k_justbumped] || thing->scale > tmthing->scale + (mapobjectscale/8) || tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->kartstuff[k_hyudorotimer] - || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapheaderinfo[gamemap-1]->mobj_scale/8)) + || tmthing->player->kartstuff[k_justbumped] || tmthing->scale > thing->scale + (mapobjectscale/8)) { return true; } @@ -2706,7 +2706,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (!(thing->flags & MF_NOCLIP)) { //All things are affected by their scale. - fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale); + fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); if (thing->player) { @@ -2909,7 +2909,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) if (!(thing->flags & MF_NOCLIP)) { - const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale); + const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); if (tmceilingz - tmfloorz < thing->height) return false; // doesn't fit @@ -3133,8 +3133,8 @@ static void P_PlayerHitBounceLine(line_t *ld) movelen = P_AproxDistance(tmxmove, tmymove); - if (slidemo->player && movelen < (15*mapheaderinfo[gamemap-1]->mobj_scale)) - movelen = (15*mapheaderinfo[gamemap-1]->mobj_scale); + if (slidemo->player && movelen < (15*mapobjectscale)) + movelen = (15*mapobjectscale); tmxmove += FixedMul(movelen, FINECOSINE(lineangle)); tmymove += FixedMul(movelen, FINESINE(lineangle)); @@ -3392,7 +3392,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (opentop - slidemo->z < slidemo->height) goto isblocking; // mobj is too high - if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale)) + if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, mapobjectscale)) goto isblocking; // too big a step up // this line doesn't block movement diff --git a/src/p_mobj.c b/src/p_mobj.c index 8832da56..4379b958 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1744,7 +1744,7 @@ void P_XYMovement(mobj_t *mo) } else { - if (mo->scale < mapheaderinfo[gamemap-1]->mobj_scale/16) + if (mo->scale < mapobjectscale/16) { P_RemoveMobj(mo); return; @@ -7223,7 +7223,7 @@ void P_MobjThinker(mobj_t *mobj) { x = mobj->target->x; y = mobj->target->y; - z = mobj->target->z + 80*(mapheaderinfo[gamemap-1]->mobj_scale); + z = mobj->target->z + (80*mapobjectscale); } P_TeleportMove(mobj, x, y, z); } @@ -7890,7 +7890,7 @@ void P_MobjThinker(mobj_t *mobj) else { mobj->flags &= ~MF_NOGRAVITY; - if (mobj->z > mobj->watertop && mobj->z - mobj->watertop < FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale)) + if (mobj->z > mobj->watertop && mobj->z - mobj->watertop < FixedMul(MAXSTEPMOVE, mapobjectscale)) mobj->z = mobj->watertop; } break; @@ -7959,7 +7959,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->flags2 & MF2_NIGHTSPULL) { if (!mobj->tracer || !mobj->tracer->health - || mobj->scale <= mapheaderinfo[gamemap-1]->mobj_scale>>4) + || mobj->scale <= mapobjectscale>>4) { P_RemoveMobj(mobj); return; @@ -7968,7 +7968,7 @@ void P_MobjThinker(mobj_t *mobj) } else { - fixed_t adj = FixedMul(FRACUNIT - FINECOSINE((mobj->movedir>>ANGLETOFINESHIFT) & FINEMASK), (mapheaderinfo[gamemap-1]->mobj_scale<<3)); + fixed_t adj = FixedMul(FRACUNIT - FINECOSINE((mobj->movedir>>ANGLETOFINESHIFT) & FINEMASK), (mapobjectscale<<3)); mobj->movedir += 2*ANG2; if (mobj->eflags & MFE_VERTICALFLIP) mobj->z = mobj->ceilingz - mobj->height - adj; @@ -8036,6 +8036,7 @@ void P_MobjThinker(mobj_t *mobj) for (i = 5; i >= mobj->health; i--) finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); } + P_InstaThrust(mobj, mobj->angle, finalspeed); if (grounded) @@ -8059,7 +8060,7 @@ void P_MobjThinker(mobj_t *mobj) { sector_t *sec2; fixed_t topspeed = mobj->movefactor; - fixed_t distbarrier = 512*FRACUNIT; + fixed_t distbarrier = 512*mapobjectscale; fixed_t distaway; P_SpawnGhostMobj(mobj); @@ -8073,7 +8074,6 @@ void P_MobjThinker(mobj_t *mobj) distbarrier = FixedMul(distbarrier, FRACUNIT-FRACUNIT/4); else if (gamespeed == 2) distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4); - distbarrier = FixedMul(distbarrier, mapheaderinfo[gamemap-1]->mobj_scale); if (G_RaceGametype() && mobj->tracer) { @@ -8832,7 +8832,7 @@ void P_MobjThinker(mobj_t *mobj) mobj_t *head = P_SpawnMobj(mobj->x, mobj->y, mobj->z, (blue ? MT_BLUEROBRA_HEAD : MT_ROBRA_HEAD)); P_SetTarget(&mobj->tracer, head); - mobj->destscale = mapheaderinfo[gamemap-1]->mobj_scale; + mobj->destscale = mapobjectscale; P_SetTarget(&mobj->tracer->target, mobj->target); P_SetTarget(&mobj->tracer->tracer, mobj); mobj->tracer->extravalue2 = mobj->extravalue2; @@ -9762,10 +9762,13 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // All mobjs are created at 100% scale. mobj->scale = FRACUNIT; mobj->destscale = mobj->scale; - mobj->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12; + mobj->scalespeed = FRACUNIT/12; - if (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->mobj_scale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN) - mobj->destscale = mapheaderinfo[gamemap-1]->mobj_scale; + if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN) + { + mobj->destscale = mapobjectscale; + mobj->scalespeed = mapobjectscale/12; + } // set subsector and/or block links P_SetThingPosition(mobj); @@ -10209,10 +10212,13 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster) // All mobjs are created at 100% scale. mobj->scale = FRACUNIT; mobj->destscale = mobj->scale; - mobj->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12; + mobj->scalespeed = FRACUNIT/12; - if (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->mobj_scale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN) - mobj->destscale = mapheaderinfo[gamemap-1]->mobj_scale; + if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN) + { + mobj->destscale = mapobjectscale; + mobj->scalespeed = mapobjectscale/12; + } P_SetScale(mobj, mobj->destscale); @@ -11118,7 +11124,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); if (p->kartstuff[k_respawn]) - z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapheaderinfo[gamemap-1]->mobj_scale; + z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; } else { @@ -11126,7 +11132,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); if (p->kartstuff[k_respawn]) - z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapheaderinfo[gamemap-1]->mobj_scale; + z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; } if (mthing->options & MTF_OBJECTFLIP) // flip the player! diff --git a/src/p_saveg.c b/src/p_saveg.c index 02f77457..555a2614 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1132,7 +1132,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff |= MD_SCALE; if (mobj->destscale != mobj->scale) diff |= MD_DSCALE; - if (mobj->scalespeed != mapheaderinfo[gamemap-1]->mobj_scale/12) + if (mobj->scalespeed != mapobjectscale/12) diff2 |= MD2_SCALESPEED; if (mobj == redflag) @@ -2139,7 +2139,7 @@ static void LoadMobjThinker(actionf_p1 thinker) if (diff2 & MD2_SCALESPEED) mobj->scalespeed = READFIXED(save_p); else - mobj->scalespeed = mapheaderinfo[gamemap-1]->mobj_scale/12; + mobj->scalespeed = mapobjectscale/12; if (diff2 & MD2_CUSVAL) mobj->cusval = READINT32(save_p); if (diff2 & MD2_CVMEM) @@ -3282,6 +3282,7 @@ static void P_NetArchiveMisc(void) WRITEUINT32(save_p, countdown2); WRITEFIXED(save_p, gravity); + WRITEFIXED(save_p, mapobjectscale); WRITEUINT32(save_p, countdowntimer); WRITEUINT8(save_p, countdowntimeup); @@ -3389,6 +3390,7 @@ static inline boolean P_NetUnArchiveMisc(void) countdown2 = READUINT32(save_p); gravity = READFIXED(save_p); + mapobjectscale = READFIXED(save_p); countdowntimer = (tic_t)READUINT32(save_p); countdowntimeup = (boolean)READUINT8(save_p); diff --git a/src/p_slopes.c b/src/p_slopes.c index ab558c53..c6416b75 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -801,8 +801,8 @@ void P_SlopeLaunch(mobj_t *mo) #ifdef GROWNEVERMISSES { - const fixed_t xyscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - mo->scale); - const fixed_t zscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - mo->scale); + const fixed_t xyscale = mapobjectscale + (mapobjectscale - mo->scale); + const fixed_t zscale = mapobjectscale + (mapobjectscale - mo->scale); mo->momx = FixedMul(slopemom.x, xyscale); mo->momy = FixedMul(slopemom.y, xyscale); mo->momz = FixedMul(slopemom.z, zscale); diff --git a/src/p_spec.c b/src/p_spec.c index ea7b0c4d..35d26c6c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3262,7 +3262,7 @@ void P_SetupSignExit(player_t *player) // SRB2Kart: FINALLY, add in an alternative if no place is found if (player->mo) { - mobj_t *sign = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (768*mapheaderinfo[gamemap-1]->mobj_scale), MT_SIGN); + mobj_t *sign = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + (768*mapobjectscale), MT_SIGN); P_SetTarget(&sign->target, player->mo); P_SetMobjState(sign, S_SIGN1); @@ -3770,7 +3770,7 @@ DoneSection2: case 1: // SRB2kart: Spring Panel if (roversector || P_MobjReadyToTrigger(player->mo, sector)) { - const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - player->mo->scale); + const fixed_t hscale = mapobjectscale + (mapobjectscale - player->mo->scale); const fixed_t minspeed = 24*hscale; if (player->mo->eflags & MFE_SPRUNG) @@ -3790,7 +3790,7 @@ DoneSection2: case 3: // SRB2kart: Spring Panel (capped speed) if (roversector || P_MobjReadyToTrigger(player->mo, sector)) { - const fixed_t hscale = mapheaderinfo[gamemap-1]->mobj_scale + (mapheaderinfo[gamemap-1]->mobj_scale - player->mo->scale); + const fixed_t hscale = mapobjectscale + (mapobjectscale - player->mo->scale); const fixed_t minspeed = 24*hscale; const fixed_t maxspeed = 28*hscale; @@ -3829,8 +3829,8 @@ DoneSection2: // SRB2Kart: Scale the speed you get from them! // This is scaled differently from other horizontal speed boosts from stuff like springs, because of how this is used for some ramp jumps. - if (player->mo->scale > mapheaderinfo[gamemap-1]->mobj_scale) - linespeed = FixedMul(linespeed, mapheaderinfo[gamemap-1]->mobj_scale + (player->mo->scale - mapheaderinfo[gamemap-1]->mobj_scale)); + if (player->mo->scale > mapobjectscale) + linespeed = FixedMul(linespeed, mapobjectscale + (player->mo->scale - mapobjectscale)); if (!demoplayback || P_AnalogMove(player)) { @@ -5717,6 +5717,8 @@ void P_SpawnSpecials(INT32 fromnetsave) else curWeather = PRECIP_NONE; + mapobjectscale = mapheaderinfo[gamemap-1]->mobj_scale; + P_InitTagLists(); // Create xref tables for tags P_SearchForDisableLinedefs(); // Disable linedefs are now allowed to disable *any* line diff --git a/src/p_user.c b/src/p_user.c index 5f12a3ce..ab6c61dc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3033,7 +3033,7 @@ static fixed_t teeteryl, teeteryh; static boolean PIT_CheckSolidsTeeter(mobj_t *thing) // SRB2kart - unused. { fixed_t blockdist; - fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale); + fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapobjectscale); fixed_t thingtop = thing->z + thing->height; fixed_t teeterertop = teeterer->z + teeterer->height; @@ -3150,7 +3150,7 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused. boolean roverfloor; // solid 3d floors? fixed_t floorheight, ceilingheight; fixed_t topheight, bottomheight; // for 3d floor usage - const fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale); // Distance you have to be above the ground in order to teeter. + const fixed_t tiptop = FixedMul(MAXSTEPMOVE, mapobjectscale); // Distance you have to be above the ground in order to teeter. if (player->mo->standingslope && player->mo->standingslope->zdelta >= (FRACUNIT/2)) // Always teeter if the slope is too steep. teeter = true; @@ -5023,9 +5023,9 @@ static void P_SpectatorMovement(player_t *player) player->mo->z = player->mo->floorz; if (cmd->buttons & BT_ACCELERATE) - player->mo->z += 32*mapheaderinfo[gamemap-1]->mobj_scale; + player->mo->z += 32*mapobjectscale; else if (cmd->buttons & BT_BRAKE) - player->mo->z -= 32*mapheaderinfo[gamemap-1]->mobj_scale; + player->mo->z -= 32*mapobjectscale; // Aiming needed for SEENAMES, etc. // We may not need to fire as a spectator, but this is still handy! @@ -5034,14 +5034,14 @@ static void P_SpectatorMovement(player_t *player) player->mo->momx = player->mo->momy = player->mo->momz = 0; if (cmd->forwardmove != 0) { - P_Thrust(player->mo, player->mo->angle, cmd->forwardmove*(mapheaderinfo[gamemap-1]->mobj_scale)); + P_Thrust(player->mo, player->mo->angle, cmd->forwardmove*mapobjectscale); // Quake-style flying spectators :D - player->mo->momz += FixedMul(cmd->forwardmove*(mapheaderinfo[gamemap-1]->mobj_scale), AIMINGTOSLOPE(player->aiming)); + player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming)); } if (cmd->sidemove != 0) { - P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*(mapheaderinfo[gamemap-1]->mobj_scale)); + P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale); } } @@ -7811,8 +7811,8 @@ boolean P_LookForEnemies(player_t *player) if (mo->type == MT_DETON) // Don't be STUPID, Sonic! continue; - if (((mo->z > player->mo->z+FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale)) && !(player->mo->eflags & MFE_VERTICALFLIP)) - || ((mo->z+mo->height < player->mo->z+player->mo->height-FixedMul(MAXSTEPMOVE, mapheaderinfo[gamemap-1]->mobj_scale)) && (player->mo->eflags & MFE_VERTICALFLIP))) // Reverse gravity check - Flame. + if (((mo->z > player->mo->z+FixedMul(MAXSTEPMOVE, mapobjectscale)) && !(player->mo->eflags & MFE_VERTICALFLIP)) + || ((mo->z+mo->height < player->mo->z+player->mo->height-FixedMul(MAXSTEPMOVE, mapobjectscale)) && (player->mo->eflags & MFE_VERTICALFLIP))) // Reverse gravity check - Flame. continue; // Don't home upwards! if (P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y), @@ -8217,8 +8217,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall return true; } - thiscam->radius = FixedMul(20*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale); - thiscam->height = FixedMul(16*FRACUNIT, mapheaderinfo[gamemap-1]->mobj_scale); + thiscam->radius = 20*mapobjectscale; + thiscam->height = 16*mapobjectscale; // Don't run while respawning from a starpost // Inu 4/8/13 Why not?! @@ -8264,8 +8264,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam_speed.value; camstill = cv_cam_still.value; camrotate = cv_cam_rotate.value; - camdist = FixedMul(cv_cam_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); - camheight = FixedMul(cv_cam_height.value, mapheaderinfo[gamemap-1]->mobj_scale); + camdist = FixedMul(cv_cam_dist.value, mapobjectscale); + camheight = FixedMul(cv_cam_height.value, mapobjectscale); lookback = camspin; } else if (thiscam == &camera2) // Camera 2 @@ -8273,8 +8273,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam2_speed.value; camstill = cv_cam2_still.value; camrotate = cv_cam2_rotate.value; - camdist = FixedMul(cv_cam2_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); - camheight = FixedMul(cv_cam2_height.value, mapheaderinfo[gamemap-1]->mobj_scale); + camdist = FixedMul(cv_cam2_dist.value, mapobjectscale); + camheight = FixedMul(cv_cam2_height.value, mapobjectscale); lookback = camspin2; } else if (thiscam == &camera3) // Camera 3 @@ -8282,8 +8282,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam3_speed.value; camstill = cv_cam3_still.value; camrotate = cv_cam3_rotate.value; - camdist = FixedMul(cv_cam3_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); - camheight = FixedMul(cv_cam3_height.value, mapheaderinfo[gamemap-1]->mobj_scale); + camdist = FixedMul(cv_cam3_dist.value, mapobjectscale); + camheight = FixedMul(cv_cam3_height.value, mapobjectscale); lookback = camspin3; } else // Camera 4 @@ -8291,8 +8291,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camspeed = cv_cam4_speed.value; camstill = cv_cam4_still.value; camrotate = cv_cam4_rotate.value; - camdist = FixedMul(cv_cam4_dist.value, mapheaderinfo[gamemap-1]->mobj_scale); - camheight = FixedMul(cv_cam4_height.value, mapheaderinfo[gamemap-1]->mobj_scale); + camdist = FixedMul(cv_cam4_dist.value, mapobjectscale); + camheight = FixedMul(cv_cam4_height.value, mapobjectscale); lookback = camspin4; } @@ -8305,8 +8305,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall { const INT32 introcam = (introtime - leveltime); camrotate += introcam*5; - camdist += (introcam * mapheaderinfo[gamemap-1]->mobj_scale)*3; - camheight += (introcam * mapheaderinfo[gamemap-1]->mobj_scale)*2; + camdist += (introcam * mapobjectscale)*3; + camheight += (introcam * mapobjectscale)*2; } else if (player->exiting) // SRB2Kart: Leave the camera behind while exiting, for dramatic effect! camstill = true; @@ -8614,7 +8614,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // point viewed by the camera // this point is just 64 unit forward the player - dist = 64*mapheaderinfo[gamemap-1]->mobj_scale; + dist = 64*mapobjectscale; viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist) + xpan; viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist) + ypan; diff --git a/src/s_sound.c b/src/s_sound.c index 8b5d29ed..34163fd3 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1218,7 +1218,7 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t approx_dist <<= FRACBITS; - return FixedDiv(approx_dist, mapheaderinfo[gamemap-1]->mobj_scale); // approx_dist + return FixedDiv(approx_dist, mapobjectscale); // approx_dist } //