Merge branch 'claw-determination' into 'master'

UFO determination

See merge request KartKrew/Kart!2355
This commit is contained in:
Gunla 2024-05-05 22:14:03 +00:00
commit 254cdc795f
4 changed files with 19 additions and 1 deletions

View file

@ -4977,7 +4977,7 @@ void G_DirtyGameData(void)
// Can be called by the startup code or the menu task.
//
#define SAV_VERSIONMINOR 5
#define SAV_VERSIONMINOR 6
void G_LoadGame(void)
{

View file

@ -39,6 +39,7 @@ extern struct grandprixinfo
boolean initalize; ///< If true, we need to initialize a new session.
boolean wonround; ///< If false, then we retry the map instead of going to the next.
gpEvent_e eventmode; ///< Special event mode, bots are set to spectate and a special gametype is played
UINT32 specialDamage; ///< Accumulated Sealed Star difficulty reduction
gpRank_t rank; ///< Struct containing grading information. (See also: k_rank.h)
} grandprixinfo;

View file

@ -29,6 +29,7 @@
#include "../k_hitlag.h"
#include "../acs/interface.h"
#include "../hu_stuff.h"
#include "../k_grandprix.h"
#define UFO_BASE_SPEED (42 * FRACUNIT) // UFO's slowest speed.
#define UFO_SPEEDUP (FRACUNIT >> 1) // Acceleration
@ -935,6 +936,11 @@ boolean Obj_SpecialUFODamage(mobj_t *ufo, mobj_t *inflictor, mobj_t *source, UIN
ufo->health = max(1, ufo->health - damage);
if (grandprixinfo.gp)
{
grandprixinfo.specialDamage += damage;
}
K_SetHitLagForObjects(ufo, inflictor, source, (damage / 3) + 2, true);
UFOCopyHitlagToPieces(ufo);
@ -1339,6 +1345,11 @@ static mobj_t *InitSpecialUFO(waypoint_t *start)
P_SetTarget(&ufo_piece_prev(piece), prevPiece);
prevPiece = piece;
if (grandprixinfo.gp && grandprixinfo.specialDamage)
{
ufo->health -= min(4*mobjinfo[MT_SPECIAL_UFO].spawnhealth/10, grandprixinfo.specialDamage/6);
}
return ufo;
}

View file

@ -6071,6 +6071,8 @@ static inline void P_ArchiveMisc(savebuffer_t *save)
WRITEUINT8(save->p, (UINT8)grandprixinfo.encore);
WRITEUINT8(save->p, (UINT8)grandprixinfo.masterbots);
WRITEUINT32(save->p, grandprixinfo.specialDamage);
WRITESTRINGL(save->p, grandprixinfo.cup->name, MAXCUPNAME);
// Round Queue information
@ -6218,6 +6220,8 @@ void P_GetBackupCupData(savebuffer_t *save)
cupsavedata.encore = (boolean)READUINT8(save->p);
boolean masterbots = (boolean)READUINT8(save->p);
save->p += 4; // specialDamage
if (masterbots == true)
cupsavedata.difficulty = KARTGP_MASTER;
@ -6267,6 +6271,8 @@ static boolean P_UnArchiveSPGame(savebuffer_t *save)
grandprixinfo.encore = (boolean)READUINT8(save->p);
grandprixinfo.masterbots = (boolean)READUINT8(save->p);
grandprixinfo.specialDamage = READUINT32(save->p);
// Find the relevant cup.
char cupname[MAXCUPNAME];
READSTRINGL(save->p, cupname, sizeof(cupname));