Merge branch 'camheight-mapheader' into 'master'

Add CameraHeight level header option

See merge request kart-krew-dev/ring-racers-internal!2550
This commit is contained in:
Oni VelocitOni 2025-05-18 20:04:52 +00:00
commit 3fd8d10630
6 changed files with 28 additions and 1 deletions

View file

@ -1494,6 +1494,18 @@ void readlevelheader(MYFILE *f, char * name)
deh_warning("Level header %d: invalid lobby size '%s'", num, word2); deh_warning("Level header %d: invalid lobby size '%s'", num, word2);
} }
} }
else if (fastcmp(word, "CAMHEIGHT") || fastcmp(word, "CAMERAHEIGHT"))
{
fixed_t camheight = FloatToFixed(atof(word2));
if (camheight < 0)
{
deh_warning("Level header %d: invalid camera height %s", num, word2);
continue;
}
mapheaderinfo[num]->cameraHeight = camheight;;
}
else else
deh_warning("Level header %d: unknown word '%s'", num, word); deh_warning("Level header %d: unknown word '%s'", num, word);
} }

View file

@ -558,6 +558,8 @@ struct mapheader_t
mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode
boolean use_encore_lighting; ///< Whether to use separate Encore lighting boolean use_encore_lighting; ///< Whether to use separate Encore lighting
fixed_t cameraHeight; ///< Player camera height to use on this map
// Audience information // Audience information
UINT8 numFollowers; ///< Internal. For audience support. UINT8 numFollowers; ///< Internal. For audience support.
INT16 *followers; ///< List of audience followers in this level. Allocated dynamically for space reasons. Be careful. INT16 *followers; ///< List of audience followers in this level. Allocated dynamically for space reasons. Be careful.

View file

@ -2572,6 +2572,8 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushfixed(L, header->mobj_scale); lua_pushfixed(L, header->mobj_scale);
else if (fastcmp(field, "gravity")) else if (fastcmp(field, "gravity"))
lua_pushfixed(L, header->gravity); lua_pushfixed(L, header->gravity);
else if (fastcmp(field, "cameraheight"))
lua_pushfixed(L, header->cameraHeight);
else { else {
// Read custom vars now // Read custom vars now
// (note: don't include the "LUA." in your lua scripts!) // (note: don't include the "LUA." in your lua scripts!)

View file

@ -526,6 +526,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 num)
mapheaderinfo[num]->automedaltime[1] = 2; mapheaderinfo[num]->automedaltime[1] = 2;
mapheaderinfo[num]->automedaltime[2] = 3; mapheaderinfo[num]->automedaltime[2] = 3;
mapheaderinfo[num]->automedaltime[3] = 4; mapheaderinfo[num]->automedaltime[3] = 4;
mapheaderinfo[num]->cameraHeight = INT32_MIN;
} }
/** Allocates a new map-header structure. /** Allocates a new map-header structure.

View file

@ -9601,6 +9601,11 @@ void P_DoQuakeOffset(UINT8 view, mappoint_t *viewPos, mappoint_t *offset)
fixed_t maxShake = FixedMul(cv_cam_height[view].value, mapobjectscale) * 3 / 4; fixed_t maxShake = FixedMul(cv_cam_height[view].value, mapobjectscale) * 3 / 4;
if (mapheaderinfo[gamemap-1]->cameraHeight >= 0)
{
maxShake = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, mapobjectscale) * 3 / 4;
}
if (battle) if (battle)
{ {
addZ /= 2; addZ /= 2;

View file

@ -3361,6 +3361,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camdist = FixedMul(cv_cam_dist[num].value, cameraScale); camdist = FixedMul(cv_cam_dist[num].value, cameraScale);
camheight = FixedMul(cv_cam_height[num].value, cameraScale); camheight = FixedMul(cv_cam_height[num].value, cameraScale);
if (mapheaderinfo[gamemap-1]->cameraHeight >= 0)
{
camheight = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, cameraScale);
}
if (loop_in < loop->zoom_in_speed) if (loop_in < loop->zoom_in_speed)
{ {
fixed_t f = loop_out < loop->zoom_out_speed fixed_t f = loop_out < loop->zoom_out_speed
@ -4543,7 +4548,7 @@ void P_PlayerThink(player_t *player)
player->mo->renderflags &= ~RF_DONTDRAW; player->mo->renderflags &= ~RF_DONTDRAW;
player->mo->flags &= ~MF_NOCLIPTHING; player->mo->flags &= ~MF_NOCLIPTHING;
} }
boolean deathcontrolled = (player->respawn.state != RESPAWNST_NONE && player->respawn.truedeath == true) boolean deathcontrolled = (player->respawn.state != RESPAWNST_NONE && player->respawn.truedeath == true)
|| (player->pflags & PF_NOCONTEST) || (player->karmadelay); || (player->pflags & PF_NOCONTEST) || (player->karmadelay);
boolean powercontrolled = (player->hyudorotimer) || (player->growshrinktimer > 0); boolean powercontrolled = (player->hyudorotimer) || (player->growshrinktimer > 0);