mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-09-03 18:03:34 -04:00
Refactor MP chr/config structs to allow a one config to many chrs relationship
This commit is contained in:
+1
-3
@@ -273,15 +273,13 @@ extern struct textureconfig *g_TexGeneralConfigs;
|
||||
extern struct textureconfig *g_TexRadarConfigs;
|
||||
extern struct scenariodata g_ScenarioData;
|
||||
extern u32 var800ac4cc;
|
||||
extern struct chrdata *g_MpAllChrPtrs[MAX_MPCHRS];
|
||||
extern struct mpchrconfig *g_MpAllChrConfigPtrs[MAX_MPCHRS];
|
||||
extern s32 g_MpNumChrs;
|
||||
extern struct mpchr *g_MpChrs;
|
||||
extern struct mpbotconfig g_BotConfigsArray[MAX_BOTS];
|
||||
extern u8 g_MpSimulantDifficultiesPerNumPlayers[8][4];
|
||||
extern struct mpplayerconfig g_PlayerConfigsArray[6];
|
||||
extern u8 g_AmBotCommands[16];
|
||||
extern struct mpsetup g_MpSetup;
|
||||
extern struct bossfile g_BossFile;
|
||||
extern struct chrdata *g_MpBotChrPtrs[MAX_BOTS];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
#define IS8MB() (g_Is4Mb != true)
|
||||
#define LINEHEIGHT (VERSION == VERSION_JPN_FINAL ? 14 : 11)
|
||||
#define MIXCOLOUR(dialog, property) dialog->transitionfrac < 0.0f ? g_MenuColourPalettes[dialog->type].property : colourBlend(g_MenuColourPalettes[dialog->type2].property, g_MenuColourPalettes[dialog->type].property, dialog->colourweight)
|
||||
#define MPCHR(index) ((index) < 4 ? &g_PlayerConfigsArray[index].base : &g_BotConfigsArray[(index) - 4].base)
|
||||
#define MPCHR(index) &g_MpChrs[index]
|
||||
#define MPCHRCONFIG(index) ((index) < 4 ? &g_PlayerConfigsArray[index].base : &g_BotConfigsArray[index - 4].base)
|
||||
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0) + (g_Vars.players[3] ? 1 : 0))
|
||||
#define RANDOMFRAC() (random() * (1.0f / U32_MAX))
|
||||
#define SECSTOTIME240(secs) (secs * 240)
|
||||
|
||||
@@ -497,6 +497,7 @@ extern struct mpbody g_MpBodies[NUM_MPBODIES];
|
||||
extern struct mppreset g_MpPresets[NUM_MPPRESETS];
|
||||
extern u32 g_TeamColours[];
|
||||
extern u32 var80087ce4[];
|
||||
extern s32 g_NumBots;
|
||||
extern u8 g_BotCount;
|
||||
extern struct aibotweaponpreference g_AibotWeaponPreferences[];
|
||||
extern u32 var80087eb4;
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
#include "types.h"
|
||||
|
||||
void botmgrRemoveAll(void);
|
||||
void botmgrAllocateBot(s32 chrnum, s32 aibotnum);
|
||||
void botmgrAllocateBot(s32 chrnum, s32 botcfgnum, s32 botnum);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "types.h"
|
||||
|
||||
f32 mpHandicapToDamageScale(u8 value);
|
||||
void func0f187838(struct mpchrconfig *mpchr);
|
||||
void func0f187838(struct mpchr *mpchr);
|
||||
void mpStartMatch(void);
|
||||
void mpReset(void);
|
||||
void mpCalculateTeamIsOnlyAi(void);
|
||||
@@ -82,6 +82,7 @@ s32 mpGetCurrentTrackSlotNum(void);
|
||||
s32 mpChooseTrack(void);
|
||||
struct mpchrconfig *mpGetChrConfigBySlotNum(s32 slot);
|
||||
s32 mpGetChrIndexBySlotNum(s32 slot);
|
||||
s32 mpGetNumConfigs(void);
|
||||
s32 mpGetNumChrs(void);
|
||||
u8 mpFindUnusedTeamNum(void);
|
||||
void mpCreateBotFromProfile(s32 botnum, u8 difficulty);
|
||||
@@ -93,10 +94,7 @@ bool mpHasUnusedBotSlots(void);
|
||||
bool mpIsSimSlotEnabled(s32 slot);
|
||||
s32 mpFindBotProfile(s32 type, s32 difficulty);
|
||||
void mpGenerateBotNames(void);
|
||||
s32 mpPlayerGetIndex(struct chrdata *chr);
|
||||
struct chrdata *mpGetChrFromPlayerIndex(s32 index);
|
||||
s32 func0f18d074(s32 index);
|
||||
s32 func0f18d0e8(s32 arg0);
|
||||
void mpplayerfileLoadGunFuncs(struct savebuffer *buffer, s32 playernum);
|
||||
void mpplayerfileSaveGunFuncs(struct savebuffer *buffer, s32 playernum);
|
||||
void mpplayerfileLoadWad(s32 playernum, struct savebuffer *buffer, s32 arg2);
|
||||
|
||||
@@ -106,7 +106,7 @@ char *mpMenuTextScenarioName(struct menuitem *item);
|
||||
s32 scenarioScenarioMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data);
|
||||
void scenarioCreateMatchStartHudmsgs(void);
|
||||
Gfx *scenarioRenderHud(Gfx *gdl);
|
||||
void scenarioCalculatePlayerScore(struct mpchrconfig *mpchr, s32 chrnum, s32 *arg2, s32 *arg3);
|
||||
void scenarioCalculatePlayerScore(struct mpchr *mpchr, s32 chrnum, s32 *arg2, s32 *arg3);
|
||||
bool scenarioHighlightProp(struct prop *prop, s32 *colour);
|
||||
void scenarioReset(void);
|
||||
struct prop *scenarioCreateObj(s32 modelnum, s16 padnum, f32 arg2, u32 flags, u32 flags2, u32 flags3);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "types.h"
|
||||
|
||||
Gfx *radarRenderBackground(Gfx *gdl, struct textureconfig *tconfig, s32 arg2, s32 arg3, s32 arg4);
|
||||
s32 radarGetTeamIndex(s32 team);
|
||||
Gfx *radarDrawDot(Gfx *gdl, struct prop *prop, struct coord *dist, u32 colour1, u32 colour2, bool swapcolours);
|
||||
Gfx *radarRender(Gfx *gdl);
|
||||
Gfx *radarRenderRTrackedProps(Gfx *gdl);
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
void varsInit(void);
|
||||
|
||||
void varsReset(void);
|
||||
void varsResetRoomProps(void);
|
||||
|
||||
#endif
|
||||
|
||||
+58
-51
@@ -2705,7 +2705,7 @@ struct player {
|
||||
/*0x1be0*/ f32 cachedlookahead;
|
||||
/*0x1be4*/ u16 lookaheadframe;
|
||||
/*0x1be6*/ u8 numaibuddies;
|
||||
/*0x1be7*/ u8 aibuddynums[MAX_BOTS];
|
||||
/*0x1be7*/ u16 *aibuddynums;
|
||||
/*0x1bf0*/ bool bondexploding;
|
||||
/*0x1bf4*/ s32 bondnextexplode; // lvframe60 of next explosion
|
||||
/*0x1bf8*/ s32 bondcurexplode; // Increases by 1 on each tick even when not exploding
|
||||
@@ -4146,62 +4146,69 @@ struct gamefile {
|
||||
/*0xb5*/ u8 weaponsfound[6];
|
||||
};
|
||||
|
||||
// Allocated during setup - contains configuration common to both players and bots
|
||||
struct mpchrconfig {
|
||||
/*0x00*/ char name[12]; // up to 10 visible chars plus line break plus null byte
|
||||
/*0x0c*/ u8 unk0c;
|
||||
/*0x0d*/ u8 unk0d;
|
||||
/*0x0e*/ u8 unk0e;
|
||||
/*0x0f*/ u8 mpheadnum;
|
||||
/*0x10*/ u8 mpbodynum;
|
||||
/*0x11*/ u8 team;
|
||||
/*0x14*/ u32 displayoptions;
|
||||
/*0x18*/ u16 unk18;
|
||||
/*0x1a*/ u16 unk1a;
|
||||
/*0x1c*/ u16 unk1c;
|
||||
/*0x1e*/ s8 placement; // 0 = winner, 1 = second place etc
|
||||
/*0x20*/ s32 rankablescore;
|
||||
/*0x24*/ s16 killcounts[MAX_MPCHRS]; // per player - each index is a chrslot
|
||||
/*0x3c*/ s16 numdeaths;
|
||||
/*0x3e*/ s16 numpoints;
|
||||
/*0x40*/ s16 unk40;
|
||||
char name[15]; // up to 10 visible chars plus line break plus null byte
|
||||
u8 mpheadnum;
|
||||
u8 mpbodynum;
|
||||
u8 team;
|
||||
};
|
||||
|
||||
// Allocated during setup - extension of mpchrconfig
|
||||
struct mpplayerconfig {
|
||||
/*0x00*/ struct mpchrconfig base;
|
||||
/*0x44*/ u8 controlmode;
|
||||
/*0x45*/ s8 contpad1;
|
||||
/*0x46*/ s8 contpad2;
|
||||
/*0x48*/ u16 options;
|
||||
/*0x4c*/ struct fileguid fileguid;
|
||||
/*0x54*/ u32 kills;
|
||||
/*0x58*/ u32 deaths;
|
||||
/*0x5c*/ u32 gamesplayed;
|
||||
/*0x60*/ u32 gameswon;
|
||||
/*0x64*/ u32 gameslost;
|
||||
/*0x68*/ u32 time;
|
||||
/*0x6c*/ u32 distance; // 1 unit = 100 metres
|
||||
/*0x70*/ u32 accuracy;
|
||||
/*0x74*/ u32 damagedealt;
|
||||
/*0x78*/ u32 painreceived;
|
||||
/*0x7c*/ u32 headshots;
|
||||
/*0x80*/ u32 ammoused;
|
||||
/*0x84*/ u32 accuracymedals;
|
||||
/*0x88*/ u32 headshotmedals;
|
||||
/*0x8c*/ u32 killmastermedals;
|
||||
/*0x90*/ u32 survivormedals;
|
||||
/*0x94*/ u8 medals;
|
||||
/*0x95*/ u8 title;
|
||||
/*0x96*/ u8 newtitle;
|
||||
/*0x97*/ u8 gunfuncs[6];
|
||||
/*0x9d*/ u8 handicap;
|
||||
struct mpchrconfig base;
|
||||
u32 displayoptions;
|
||||
u16 unk1c;
|
||||
u8 controlmode;
|
||||
s8 contpad1;
|
||||
s8 contpad2;
|
||||
u16 options;
|
||||
struct fileguid fileguid;
|
||||
u32 kills;
|
||||
u32 deaths;
|
||||
u32 gamesplayed;
|
||||
u32 gameswon;
|
||||
u32 gameslost;
|
||||
u32 time;
|
||||
u32 distance; // 1 unit = 100 metres
|
||||
u32 accuracy;
|
||||
u32 damagedealt;
|
||||
u32 painreceived;
|
||||
u32 headshots;
|
||||
u32 ammoused;
|
||||
u32 accuracymedals;
|
||||
u32 headshotmedals;
|
||||
u32 killmastermedals;
|
||||
u32 survivormedals;
|
||||
u8 medals;
|
||||
u8 title;
|
||||
u8 newtitle;
|
||||
u8 gunfuncs[6];
|
||||
u8 handicap;
|
||||
};
|
||||
|
||||
struct mpbotconfig {
|
||||
/*0x00*/ struct mpchrconfig base;
|
||||
/*0x44*/ u8 unk44[3];
|
||||
/*0x47*/ u8 type;
|
||||
/*0x48*/ u8 difficulty;
|
||||
/*0x4a*/ u16 quantity;
|
||||
struct mpchrconfig base;
|
||||
u8 type;
|
||||
u8 difficulty;
|
||||
u16 quantity;
|
||||
};
|
||||
|
||||
// Allocated at match start - one per chr
|
||||
struct mpchr {
|
||||
u8 isbot;
|
||||
u8 team;
|
||||
u16 placement; // 0 = winner, 1 = second place etc
|
||||
union {
|
||||
struct mpchrconfig *config;
|
||||
struct mpplayerconfig *playerconfig;
|
||||
struct mpbotconfig *botconfig;
|
||||
};
|
||||
struct chrdata *chr;
|
||||
s32 rankablescore;
|
||||
s16 *killcounts;
|
||||
s16 numdeaths;
|
||||
s16 numpoints;
|
||||
};
|
||||
|
||||
struct missionconfig {
|
||||
@@ -4788,7 +4795,7 @@ struct chrbio {
|
||||
};
|
||||
|
||||
struct ranking {
|
||||
struct mpchrconfig *mpchr;
|
||||
struct mpchr *mpchr;
|
||||
union {
|
||||
u32 teamnum;
|
||||
u32 chrnum;
|
||||
|
||||
Reference in New Issue
Block a user