port: measure nbomb age based on timestamps

makes them last the same amount of time regardless of fps
This commit is contained in:
fgsfds committed 2023-11-26 21:15:47 +01:00
1 parent 523e6ba9d9
commit 4a3c3a29b7
2 files changed
+12 -1

No files matched your search

+9 -1
View File
@@ -281,6 +281,9 @@ void nbombReset(struct nbomb *nbomb)
#if VERSION >= VERSION_PAL_BETA
nbomb->radius = 0;
#endif
#ifndef PLATFORM_N64
nbomb->spawnframe240 = g_Vars.lvframe240;
#endif
}
/**
@@ -523,9 +526,14 @@ void nbombTick(struct nbomb *nbomb)
{
if (nbomb->age240 >= 0) {
s32 age60;
#ifdef PLATFORM_N64
s32 increment = (g_Vars.lvupdate240 + 2) >> 2;
nbomb->age240 += increment;
#else
s32 oldage240 = nbomb->age240;
nbomb->age240 = (g_Vars.lvframe240 - nbomb->spawnframe240) >> 2;
s32 increment = nbomb->age240 - oldage240;
#endif
if (nbomb->age240 < TICKS(80)) {
nbomb->radius = nbomb->age240 / (PAL ? 66.0f : 80.0f);
+3
View File
@@ -5510,6 +5510,9 @@ struct nbomb {
struct prop *ownerprop;
struct sndstate *audiohandle20;
struct sndstate *audiohandle24;
#ifndef PLATFORM_N64
s32 spawnframe240; // spawned on this frame
#endif
};
struct roomacousticdata {