mirror of https://github.com/PrimeDecomp/prime.git
Add WeaponTypes.cpp
This commit is contained in:
parent
dd8dd94f36
commit
b506df2778
|
@ -3706,7 +3706,7 @@ lbl_8002C704:
|
|||
/* 8002C708 00029668 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 8002C70C 0002966C 41 82 00 0C */ beq lbl_8002C718
|
||||
/* 8002C710 00029670 38 61 00 54 */ addi r3, r1, 0x54
|
||||
/* 8002C714 00029674 48 00 4B 95 */ bl sub_800312a8
|
||||
/* 8002C714 00029674 48 00 4B 95 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_8002C718:
|
||||
/* 8002C718 00029678 38 00 00 00 */ li r0, 0
|
||||
/* 8002C71C 0002967C 38 61 00 1C */ addi r3, r1, 0x1c
|
||||
|
@ -5992,7 +5992,7 @@ lbl_8002E7C0:
|
|||
/* 8002E7C4 0002B724 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 8002E7C8 0002B728 41 82 00 0C */ beq lbl_8002E7D4
|
||||
/* 8002E7CC 0002B72C 38 61 00 54 */ addi r3, r1, 0x54
|
||||
/* 8002E7D0 0002B730 48 00 2A D9 */ bl sub_800312a8
|
||||
/* 8002E7D0 0002B730 48 00 2A D9 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_8002E7D4:
|
||||
/* 8002E7D4 0002B734 38 00 00 00 */ li r0, 0
|
||||
/* 8002E7D8 0002B738 38 61 00 14 */ addi r3, r1, 0x14
|
||||
|
@ -9096,8 +9096,8 @@ lbl_80031284:
|
|||
/* 800312A0 0002E200 38 21 00 30 */ addi r1, r1, 0x30
|
||||
/* 800312A4 0002E204 4E 80 00 20 */ blr
|
||||
|
||||
.global sub_800312a8
|
||||
sub_800312a8:
|
||||
.global "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
"free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node":
|
||||
/* 800312A8 0002E208 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 800312AC 0002E20C 7C 08 02 A6 */ mflr r0
|
||||
/* 800312B0 0002E210 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
@ -9108,13 +9108,13 @@ sub_800312a8:
|
|||
/* 800312C4 0002E224 80 84 00 00 */ lwz r4, 0(r4)
|
||||
/* 800312C8 0002E228 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 800312CC 0002E22C 41 82 00 08 */ beq lbl_800312D4
|
||||
/* 800312D0 0002E230 4B FF FF D9 */ bl sub_800312a8
|
||||
/* 800312D0 0002E230 4B FF FF D9 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_800312D4:
|
||||
/* 800312D4 0002E234 80 9F 00 04 */ lwz r4, 4(r31)
|
||||
/* 800312D8 0002E238 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 800312DC 0002E23C 41 82 00 0C */ beq lbl_800312E8
|
||||
/* 800312E0 0002E240 7F C3 F3 78 */ mr r3, r30
|
||||
/* 800312E4 0002E244 4B FF FF C5 */ bl sub_800312a8
|
||||
/* 800312E4 0002E244 4B FF FF C5 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_800312E8:
|
||||
/* 800312E8 0002E248 28 1F 00 00 */ cmplwi r31, 0
|
||||
/* 800312EC 0002E24C 41 82 00 18 */ beq lbl_80031304
|
||||
|
|
|
@ -86,7 +86,7 @@ lbl_8006D884:
|
|||
/* 8006D8F8 0006A858 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 8006D8FC 0006A85C 41 82 00 0C */ beq lbl_8006D908
|
||||
/* 8006D900 0006A860 38 61 00 38 */ addi r3, r1, 0x38
|
||||
/* 8006D904 0006A864 4B FC 39 A5 */ bl sub_800312a8
|
||||
/* 8006D904 0006A864 4B FC 39 A5 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_8006D908:
|
||||
/* 8006D908 0006A868 38 00 00 00 */ li r0, 0
|
||||
/* 8006D90C 0006A86C 90 01 00 48 */ stw r0, 0x48(r1)
|
||||
|
|
|
@ -1317,7 +1317,7 @@ lbl_8011E430:
|
|||
/* 8011E460 0011B3C0 80 FC 00 34 */ lwz r7, 0x34(r28)
|
||||
/* 8011E464 0011B3C4 C0 5C 00 3C */ lfs f2, 0x3c(r28)
|
||||
/* 8011E468 0011B3C8 C0 7C 00 40 */ lfs f3, 0x40(r28)
|
||||
/* 8011E46C 0011B3CC 48 16 C7 1D */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcRC9CVector3fRC9CVector3f7TAreaId"
|
||||
/* 8011E46C 0011B3CC 48 16 C7 1D */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcUcRC9CVector3fRC9CVector3f7TAreaIdR13CStateManager"
|
||||
lbl_8011E470:
|
||||
/* 8011E470 0011B3D0 3B 9C 00 44 */ addi r28, r28, 0x44
|
||||
/* 8011E474 0011B3D4 3B 5A 00 01 */ addi r26, r26, 1
|
||||
|
@ -1375,7 +1375,7 @@ lbl_8011E4FC:
|
|||
/* 8011E52C 0011B48C 80 DC 00 38 */ lwz r6, 0x38(r28)
|
||||
/* 8011E530 0011B490 C0 3C 00 2C */ lfs f1, 0x2c(r28)
|
||||
/* 8011E534 0011B494 80 FC 00 34 */ lwz r7, 0x34(r28)
|
||||
/* 8011E538 0011B498 48 16 C6 51 */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcRC9CVector3fRC9CVector3f7TAreaId"
|
||||
/* 8011E538 0011B498 48 16 C6 51 */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcUcRC9CVector3fRC9CVector3f7TAreaIdR13CStateManager"
|
||||
lbl_8011E53C:
|
||||
/* 8011E53C 0011B49C 3B 9C 00 4C */ addi r28, r28, 0x4c
|
||||
/* 8011E540 0011B4A0 3B 7B 00 01 */ addi r27, r27, 1
|
||||
|
|
|
@ -1379,7 +1379,7 @@ lbl_8003B3D8:
|
|||
/* 8003B430 00038390 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 8003B434 00038394 41 82 00 0C */ beq lbl_8003B440
|
||||
/* 8003B438 00038398 38 61 00 10 */ addi r3, r1, 0x10
|
||||
/* 8003B43C 0003839C 4B FF 5E 6D */ bl sub_800312a8
|
||||
/* 8003B43C 0003839C 4B FF 5E 6D */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_8003B440:
|
||||
/* 8003B440 000383A0 38 00 00 00 */ li r0, 0
|
||||
/* 8003B444 000383A4 90 01 00 20 */ stw r0, 0x20(r1)
|
||||
|
@ -2345,7 +2345,7 @@ lbl_8003C1BC:
|
|||
/* 8003C1EC 0003914C 80 FB 00 34 */ lwz r7, 0x34(r27)
|
||||
/* 8003C1F0 00039150 C0 5B 00 3C */ lfs f2, 0x3c(r27)
|
||||
/* 8003C1F4 00039154 C0 7B 00 40 */ lfs f3, 0x40(r27)
|
||||
/* 8003C1F8 00039158 48 24 E9 91 */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcRC9CVector3fRC9CVector3f7TAreaId"
|
||||
/* 8003C1F8 00039158 48 24 E9 91 */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcUcRC9CVector3fRC9CVector3f7TAreaIdR13CStateManager"
|
||||
lbl_8003C1FC:
|
||||
/* 8003C1FC 0003915C 3B 7B 00 44 */ addi r27, r27, 0x44
|
||||
/* 8003C200 00039160 3B 39 00 01 */ addi r25, r25, 1
|
||||
|
@ -2402,7 +2402,7 @@ lbl_8003C284:
|
|||
/* 8003C2B4 00039214 80 DB 00 38 */ lwz r6, 0x38(r27)
|
||||
/* 8003C2B8 00039218 C0 3B 00 2C */ lfs f1, 0x2c(r27)
|
||||
/* 8003C2BC 0003921C 80 FB 00 34 */ lwz r7, 0x34(r27)
|
||||
/* 8003C2C0 00039220 48 24 E8 C9 */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcRC9CVector3fRC9CVector3f7TAreaId"
|
||||
/* 8003C2C0 00039220 48 24 E8 C9 */ bl "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcUcRC9CVector3fRC9CVector3f7TAreaIdR13CStateManager"
|
||||
lbl_8003C2C4:
|
||||
/* 8003C2C4 00039224 3B 7B 00 4C */ addi r27, r27, 0x4c
|
||||
/* 8003C2C8 00039228 3B 5A 00 01 */ addi r26, r26, 1
|
||||
|
|
|
@ -320,8 +320,8 @@ GetIsFusionEnabled__12CPlayerStateCFv:
|
|||
/* 800914D4 0008E434 54 03 0F FE */ srwi r3, r0, 0x1f
|
||||
/* 800914D8 0008E438 4E 80 00 20 */ blr
|
||||
|
||||
.global GetCurrentSuit__12CPlayerStateFv
|
||||
GetCurrentSuit__12CPlayerStateFv:
|
||||
.global GetCurrentSuit__12CPlayerStateCFv
|
||||
GetCurrentSuit__12CPlayerStateCFv:
|
||||
/* 800914DC 0008E43C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 800914E0 0008E440 7C 08 02 A6 */ mflr r0
|
||||
/* 800914E4 0008E444 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
|
|
@ -11,7 +11,7 @@ get_current_suit__12NWeaponTypesFRC13CStateManager:
|
|||
/* 8028A9DC 0028793C 80 63 08 B8 */ lwz r3, 0x8b8(r3)
|
||||
/* 8028A9E0 00287940 83 E3 00 00 */ lwz r31, 0(r3)
|
||||
/* 8028A9E4 00287944 7F E3 FB 78 */ mr r3, r31
|
||||
/* 8028A9E8 00287948 4B E0 6A F5 */ bl GetCurrentSuit__12CPlayerStateFv
|
||||
/* 8028A9E8 00287948 4B E0 6A F5 */ bl GetCurrentSuit__12CPlayerStateCFv
|
||||
/* 8028A9EC 0028794C 2C 03 00 00 */ cmpwi r3, 0
|
||||
/* 8028A9F0 00287950 41 80 00 0C */ blt lbl_8028A9FC
|
||||
/* 8028A9F4 00287954 2C 03 00 05 */ cmpwi r3, 5
|
||||
|
@ -127,8 +127,8 @@ lbl_8028AB68:
|
|||
/* 8028AB80 00287AE0 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 8028AB84 00287AE4 4E 80 00 20 */ blr
|
||||
|
||||
.global "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcRC9CVector3fRC9CVector3f7TAreaId"
|
||||
"do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcRC9CVector3fRC9CVector3f7TAreaId":
|
||||
.global "do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcUcRC9CVector3fRC9CVector3f7TAreaIdR13CStateManager"
|
||||
"do_sound_event__12NWeaponTypesFRQ24rstl21pair<Us,10CSfxHandle>RibUifUiffUcUcRC9CVector3fRC9CVector3f7TAreaIdR13CStateManager":
|
||||
/* 8028AB88 00287AE8 94 21 FF 20 */ stwu r1, -0xe0(r1)
|
||||
/* 8028AB8C 00287AEC 7C 08 02 A6 */ mflr r0
|
||||
/* 8028AB90 00287AF0 90 01 00 E4 */ stw r0, 0xe4(r1)
|
||||
|
@ -674,7 +674,7 @@ lbl_8028B308:
|
|||
/* 8028B328 00288288 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 8028B32C 0028828C 41 82 00 0C */ beq lbl_8028B338
|
||||
/* 8028B330 00288290 38 61 00 10 */ addi r3, r1, 0x10
|
||||
/* 8028B334 00288294 4B DA 5F 75 */ bl sub_800312a8
|
||||
/* 8028B334 00288294 4B DA 5F 75 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_8028B338:
|
||||
/* 8028B338 00288298 38 00 00 00 */ li r0, 0
|
||||
/* 8028B33C 0028829C 90 01 00 20 */ stw r0, 0x20(r1)
|
||||
|
@ -734,7 +734,7 @@ lbl_8028B338:
|
|||
/* 8028B408 00288368 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 8028B40C 0028836C 41 82 00 0C */ beq lbl_8028B418
|
||||
/* 8028B410 00288370 38 61 00 10 */ addi r3, r1, 0x10
|
||||
/* 8028B414 00288374 4B DA 5E 95 */ bl sub_800312a8
|
||||
/* 8028B414 00288374 4B DA 5E 95 */ bl "free_node_and_sub_nodes__Q24rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>FPQ34rstl130red_black_tree<10CPrimitive,10CPrimitive,0,Q24rstl22identity<10CPrimitive>,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>4node"
|
||||
lbl_8028B418:
|
||||
/* 8028B418 00288378 38 00 00 00 */ li r0, 0
|
||||
/* 8028B41C 0028837C 90 01 00 20 */ stw r0, 0x20(r1)
|
||||
|
|
|
@ -352,7 +352,7 @@ LIBS = [
|
|||
"MetroidPrime/Enemies/CMetroidPrimeRelay",
|
||||
"MetroidPrime/Player/CPlayerDynamics",
|
||||
["MetroidPrime/ScriptObjects/CScriptMazeNode", False],
|
||||
"MetroidPrime/Weapons/WeaponTypes",
|
||||
["MetroidPrime/Weapons/WeaponTypes", False],
|
||||
"MetroidPrime/Enemies/COmegaPirate",
|
||||
"MetroidPrime/Enemies/CPhazonPool",
|
||||
"MetroidPrime/CNESEmulator",
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include "rstl/string.hpp"
|
||||
|
||||
class CPrimitive {
|
||||
public:
|
||||
CAssetId GetAnimResId() const { return x0_animId; }
|
||||
|
||||
private:
|
||||
CAssetId x0_animId;
|
||||
int x4_animIdx;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
|
||||
enum ETRKSampleRate {
|
||||
kTSR_Zero,
|
||||
kTSR_One,
|
||||
|
@ -17,6 +19,33 @@ class CAudioSys {
|
|||
public:
|
||||
enum ESurroundModes { kSM_Mono, kSM_Stereo, kSM_Surround };
|
||||
|
||||
struct C3DEmitterParmData {
|
||||
C3DEmitterParmData(const CVector3f& pos, const CVector3f& dir, float maxDist, float distComp,
|
||||
uint flags, ushort sfxId, float maxVol, float minVol, bool important,
|
||||
uchar prio)
|
||||
: x0_pos(pos)
|
||||
, xc_dir(dir)
|
||||
, x18_maxDist(maxDist)
|
||||
, x1c_distComp(distComp)
|
||||
, x20_flags(flags)
|
||||
, x24_sfxId(sfxId)
|
||||
, x26_maxVol(maxVol)
|
||||
, x27_minVol(minVol)
|
||||
, x28_important(important)
|
||||
, x29_prio(prio) {}
|
||||
|
||||
CVector3f x0_pos;
|
||||
CVector3f xc_dir;
|
||||
float x18_maxDist;
|
||||
float x1c_distComp;
|
||||
uint x20_flags;
|
||||
ushort x24_sfxId;
|
||||
float x26_maxVol;
|
||||
float x27_minVol;
|
||||
bool x28_important; // Can't be allocated over, regardless of priority
|
||||
uchar x29_prio;
|
||||
};
|
||||
|
||||
CAudioSys(uchar, uchar, uchar, uchar, uint);
|
||||
~CAudioSys();
|
||||
|
||||
|
|
|
@ -74,7 +74,8 @@ public:
|
|||
static void RemoveEmitter(CSfxHandle handle);
|
||||
static void UpdateEmitter(CSfxHandle handle, const CVector3f& pos, const CVector3f& dir,
|
||||
uchar maxVol);
|
||||
static void UpdateListener(const CVector3f& pos, const CVector3f& dir, const CVector3f&, const CVector3f&, const uchar);
|
||||
static void UpdateListener(const CVector3f& pos, const CVector3f& dir, const CVector3f&,
|
||||
const CVector3f&, const uchar);
|
||||
|
||||
static const short kMaxPriority; // 0xFF
|
||||
static const short kMedPriority; // 0x7F
|
||||
|
@ -86,6 +87,8 @@ public:
|
|||
static CSfxHandle AddEmitter(ushort id, const CVector3f& pos, const CVector3f& dir, uchar vol,
|
||||
bool useAcoustics, bool looped, short prio = kMedPriority,
|
||||
int areaId = kAllAreas);
|
||||
static CSfxHandle AddEmitter(CAudioSys::C3DEmitterParmData& parmData, bool useAcoustics,
|
||||
short prio, bool looped, int areaId = kAllAreas);
|
||||
|
||||
static void AddListener(ESfxChannels channel, const CVector3f& pos, const CVector3f& dir,
|
||||
const CVector3f& vec1, const CVector3f& vec2, float f1, float f2,
|
||||
|
@ -95,8 +98,10 @@ public:
|
|||
|
||||
static void PitchBend(CSfxHandle handle, int pitch);
|
||||
|
||||
static CSfxHandle SfxStart(ushort id, short vol, short pan, bool useAcoustics, short prio = kMaxPriority,
|
||||
bool looped = false, int areaId = kAllAreas);
|
||||
static CSfxHandle SfxStart(ushort id, short vol, short pan, bool useAcoustics,
|
||||
short prio = kMaxPriority, bool looped = false,
|
||||
int areaId = kAllAreas);
|
||||
static void SfxSpan(CSfxHandle, uchar);
|
||||
static bool IsPlaying(const CSfxHandle& handle);
|
||||
|
||||
static void SetChannel(ESfxChannels);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "Kyoto/TToken.hpp"
|
||||
|
||||
#include "rstl/reserved_vector.hpp"
|
||||
#include "rstl/set.hpp"
|
||||
|
||||
class CAnimationManager;
|
||||
class CAnimSysContext;
|
||||
|
@ -28,6 +29,7 @@ class CSkinnedModelWithAvgNormals;
|
|||
class CTransitionManager;
|
||||
class CVertexMorphEffect;
|
||||
class CModelFlags;
|
||||
class CPrimitive;
|
||||
|
||||
class CAnimData {
|
||||
public:
|
||||
|
@ -89,7 +91,8 @@ public:
|
|||
// Advance__9CAnimDataFfRC9CVector3fR13CStateManagerb
|
||||
// DoAdvance__9CAnimDataFfRbR9CRandom16b
|
||||
void SetAnimation(const CAnimPlaybackParms& parms, bool noTrans);
|
||||
// GetAnimationPrimitives__9CAnimDataCFRC18CAnimPlaybackParmsRQ24rstl72set<10CPrimitive,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>
|
||||
void GetAnimationPrimitives(const CAnimPlaybackParms& parms,
|
||||
rstl::set< CPrimitive >& primsOut) const;
|
||||
// PrimitiveSetToTokenVector__9CAnimDataFRCQ24rstl72set<10CPrimitive,Q24rstl18less<10CPrimitive>,Q24rstl17rmemory_allocator>RQ24rstl42vector<6CToken,Q24rstl17rmemory_allocator>b
|
||||
// BuildPose__9CAnimDataFv
|
||||
// PreRender__9CAnimDataFv
|
||||
|
@ -125,7 +128,7 @@ public:
|
|||
// UpdateAdditiveAnims__9CAnimDataFf
|
||||
// AdvanceAdditiveAnims__9CAnimDataFf
|
||||
// AddAdditiveSegData__9CAnimDataCFRC10CSegIdListR16CSegStatementSet
|
||||
// GetEventResourceIdForAnimResourceId__9CAnimDataCFi
|
||||
int GetEventResourceIdForAnimResourceId(int id) const;
|
||||
// GetAnimationManager__9CAnimDataFv
|
||||
// SetPoseValid__9CAnimDataFb
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
, x24_objectScale(nullptr) {}
|
||||
|
||||
CAnimPlaybackParms(int anim, const CQuaternion* deltaOrient, const CVector3f* targetPos,
|
||||
const CTransform4f* xf, const CVector3f* scale, bool useLocator)
|
||||
const CTransform4f* xf, const CVector3f* scale, bool useLocator)
|
||||
: x0_animA(anim)
|
||||
, x4_animB(-1)
|
||||
, x8_blendWeight(1.f)
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
void SetFileIdx(u32 idx) { x20c_saveIdx = idx; }
|
||||
void SetCardSerial(u64 serial) { x210_cardSerial = serial; }
|
||||
u64 GetCardSerial() const { return x210_cardSerial; }
|
||||
bool GetHardMode() const { return x228_24_hardMode; }
|
||||
float GetHardModeWeaponMultiplier() const;
|
||||
rstl::rc_ptr< CWorldTransManager >& WorldTransitionManager(); // { return x9c_transManager.GetPtr(); }
|
||||
|
||||
struct GameFileStateInfo {
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
void SetIsFusionEnabled(bool v);
|
||||
bool GetIsFusionEnabled() const;
|
||||
|
||||
EPlayerSuit GetCurrentSuit();
|
||||
EPlayerSuit GetCurrentSuit() const;
|
||||
EPlayerSuit GetCurrentSuitRaw() const { return x20_currentSuit; }
|
||||
EBeamId GetCurrentBeam() const { return x8_currentBeam; }
|
||||
void SetCurrentBeam(EBeamId beam) { x8_currentBeam = beam; }
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#ifndef _WEAPONCOMMON
|
||||
#define _WEAPONCOMMON
|
||||
|
||||
#include "Kyoto/SObjectTag.hpp"
|
||||
|
||||
#include "rstl/set.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CToken;
|
||||
class CSfxHandle;
|
||||
class CAnimData;
|
||||
class CStateManager;
|
||||
class CPrimitive;
|
||||
|
||||
namespace NWeaponTypes {
|
||||
|
||||
|
@ -24,8 +29,11 @@ enum EGunAnimType {
|
|||
};
|
||||
|
||||
CSfxHandle play_sfx(ushort sfx, bool underwater, bool looped, short pan);
|
||||
void get_token_vector(CAnimData& animData, int, rstl::vector< CToken >& tokensOut,
|
||||
bool preLock);
|
||||
|
||||
void primitive_set_to_token_vector(const CAnimData& animData,
|
||||
const rstl::set< CPrimitive >& primSet,
|
||||
rstl::vector< CToken >& tokensOut, bool preLock);
|
||||
void get_token_vector(CAnimData& animData, int, rstl::vector< CToken >& tokensOut, bool preLock);
|
||||
void get_token_vector(const CAnimData& animData, int begin, int end,
|
||||
rstl::vector< CToken >& tokensOut, bool preLock);
|
||||
bool are_tokens_ready(const rstl::vector< CToken >&);
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
, x4_24_charged(charged)
|
||||
, x4_25_comboed(comboed)
|
||||
, x4_26_instantKill(instaKill) {}
|
||||
|
||||
CWeaponMode(int type, int flags)
|
||||
: x0_weaponType(EWeaponType(type)) {}
|
||||
|
||||
EWeaponType GetType() const { return x0_weaponType; }
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
|
||||
void erase(iterator it) { inner.erase(it); }
|
||||
int size() const { return inner.size(); }
|
||||
|
||||
private:
|
||||
rep_type inner;
|
||||
};
|
||||
|
|
|
@ -406,7 +406,7 @@ bool CPlayerState::CanVisorSeeFog(const CStateManager& stateMgr) const {
|
|||
return (activeVisor == kPV_Combat || activeVisor == kPV_Scan);
|
||||
}
|
||||
|
||||
CPlayerState::EPlayerSuit CPlayerState::GetCurrentSuit() {
|
||||
CPlayerState::EPlayerSuit CPlayerState::GetCurrentSuit() const {
|
||||
if (GetIsFusionEnabled())
|
||||
return kPS_FusionPower;
|
||||
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
|
||||
#include "MetroidPrime/Weapons/WeaponCommon.hpp"
|
||||
|
||||
#include "MetroidPrime/CAnimData.hpp"
|
||||
#include "MetroidPrime/CAnimPlaybackParms.hpp"
|
||||
#include "MetroidPrime/CStateManager.hpp"
|
||||
#include "MetroidPrime/Player/CPlayerState.hpp"
|
||||
#include "MetroidPrime/Player/CGameState.hpp"
|
||||
#include "MetroidPrime/Weapons/CGunWeapon.hpp"
|
||||
#include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp"
|
||||
|
||||
#include "Kyoto/Animation/CPrimitive.hpp"
|
||||
#include "Kyoto/Audio/CSfxManager.hpp"
|
||||
#include "Kyoto/CResFactory.hpp"
|
||||
#include "Kyoto/CToken.hpp"
|
||||
|
||||
#include "rstl/set.hpp"
|
||||
|
||||
namespace NWeaponTypes {
|
||||
|
||||
CAssetId get_asset_id_from_name(const char* name) {
|
||||
const SObjectTag* tag = gpResourceFactory->GetResourceIdByName(name);
|
||||
if (!tag) {
|
||||
return kInvalidAssetId;
|
||||
}
|
||||
return tag->id;
|
||||
}
|
||||
|
||||
void get_token_vector(CAnimData& animData, int animIdx, rstl::vector< CToken >& tokensOut,
|
||||
bool preLock) {
|
||||
rstl::set< CPrimitive > prims;
|
||||
CAnimPlaybackParms parms(animIdx, -1, 1.f, true);
|
||||
animData.GetAnimationPrimitives(parms, prims);
|
||||
primitive_set_to_token_vector(animData, prims, tokensOut, preLock);
|
||||
}
|
||||
|
||||
void get_token_vector(const CAnimData& animData, int begin, int end,
|
||||
rstl::vector< CToken >& tokensOut, bool preLock) {
|
||||
rstl::set< CPrimitive > prims;
|
||||
for (int i = begin; i < end; ++i) {
|
||||
CAnimPlaybackParms parms(i, -1, 1.f, true);
|
||||
animData.GetAnimationPrimitives(parms, prims);
|
||||
}
|
||||
primitive_set_to_token_vector(animData, prims, tokensOut, preLock);
|
||||
}
|
||||
|
||||
bool are_tokens_ready(const rstl::vector< CToken >& anims) {
|
||||
for (rstl::vector< CToken >::const_iterator it = anims.begin(); it != anims.end(); ++it)
|
||||
if (!it->IsLoaded())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void lock_tokens(rstl::vector< CToken >& anims) {
|
||||
for (rstl::vector< CToken >::iterator it = anims.begin(); it != anims.end(); ++it)
|
||||
it->Lock();
|
||||
}
|
||||
|
||||
void unlock_tokens(rstl::vector< CToken >& anims) {
|
||||
for (rstl::vector< CToken >::iterator it = anims.begin(); it != anims.end(); ++it)
|
||||
it->Unlock();
|
||||
}
|
||||
|
||||
void primitive_set_to_token_vector(const CAnimData& animData,
|
||||
const rstl::set< CPrimitive >& primSet,
|
||||
rstl::vector< CToken >& tokensOut, bool preLock) {
|
||||
|
||||
int eventCount = 0;
|
||||
|
||||
rstl::set< CPrimitive >::const_iterator it = primSet.begin();
|
||||
for (; it != primSet.end(); ++it) {
|
||||
if (animData.GetEventResourceIdForAnimResourceId(it->GetAnimResId()) != -1)
|
||||
++eventCount;
|
||||
}
|
||||
|
||||
tokensOut = rstl::vector< CToken >();
|
||||
tokensOut.reserve(primSet.size() + eventCount);
|
||||
|
||||
for (it = primSet.begin(); it != primSet.end(); ++it) {
|
||||
int aId = it->GetAnimResId();
|
||||
int eId = animData.GetEventResourceIdForAnimResourceId(aId);
|
||||
|
||||
if (eId != -1) {
|
||||
CToken token = gpSimplePool->GetObj(SObjectTag('EVNT', eId));
|
||||
if (preLock)
|
||||
token.Lock();
|
||||
tokensOut.push_back(token);
|
||||
}
|
||||
|
||||
CToken token = gpSimplePool->GetObj(SObjectTag('ANIM', aId));
|
||||
if (preLock)
|
||||
token.Lock();
|
||||
tokensOut.push_back(token);
|
||||
}
|
||||
}
|
||||
|
||||
void do_sound_event(rstl::pair< u16, CSfxHandle >& sfxHandle, int& pitch, bool doPitchBend,
|
||||
uint soundId, float weight, uint flags, float falloff, float maxDist,
|
||||
uchar minVol, uchar maxVol, const CVector3f& posToCam, const CVector3f& pos,
|
||||
TAreaId aid, CStateManager& mgr) {
|
||||
if (posToCam.MagSquared() >= maxDist * maxDist)
|
||||
return;
|
||||
|
||||
u16 useSfxId = CSfxManager::TranslateSFXID(u16(soundId));
|
||||
uint useFlags = 0x1; // Continuous parameter update
|
||||
if ((flags & 0x8) != 0)
|
||||
useFlags |= 0x8; // Doppler effect
|
||||
bool useAcoustics = (flags & 0x80) == 0;
|
||||
|
||||
CAudioSys::C3DEmitterParmData parms(pos, CVector3f::Up(), maxDist, falloff, useFlags, useSfxId,
|
||||
maxVol, minVol, false, 0x7f);
|
||||
|
||||
if (mgr.Random()->Float() <= weight) {
|
||||
if ((soundId & 0x80000000) != 0) {
|
||||
if (!sfxHandle.second) {
|
||||
CSfxHandle hnd;
|
||||
if ((soundId & 0x40000000) != 0)
|
||||
hnd = CSfxManager::SfxStart(useSfxId, 0x7f, 0x40, true, CSfxManager::kMedPriority, true,
|
||||
aid.Value());
|
||||
else
|
||||
hnd = CSfxManager::AddEmitter(parms, useAcoustics, CSfxManager::kMedPriority, true,
|
||||
aid.Value());
|
||||
if (hnd) {
|
||||
sfxHandle.first = useSfxId;
|
||||
sfxHandle.second = hnd;
|
||||
if (doPitchBend)
|
||||
CSfxManager::PitchBend(hnd, pitch);
|
||||
}
|
||||
} else {
|
||||
if (sfxHandle.first == useSfxId) {
|
||||
CSfxManager::UpdateEmitter(sfxHandle.second, parms.x0_pos, parms.xc_dir, maxVol);
|
||||
} else if ((flags & 0x4) != 0) // Pausable
|
||||
{
|
||||
CSfxManager::RemoveEmitter(sfxHandle.second);
|
||||
CSfxHandle hnd = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, true, aid.Value());
|
||||
if (hnd) {
|
||||
sfxHandle.first = useSfxId;
|
||||
sfxHandle.second = hnd;
|
||||
if (doPitchBend && hnd)
|
||||
CSfxManager::PitchBend(hnd, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CSfxHandle hnd;
|
||||
if ((soundId & 0x40000000) != 0)
|
||||
hnd = CSfxManager::SfxStart(useSfxId, 1.f, 0.f, true, 0x7f, false, aid.Value());
|
||||
else
|
||||
hnd = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, false, aid.Value());
|
||||
if (doPitchBend)
|
||||
CSfxManager::PitchBend(hnd, pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CSfxHandle play_sfx(u16 sfx, bool underwater, bool looped, short pan) {
|
||||
CSfxHandle hnd = CSfxManager::SfxStart(sfx, 0x7f, pan, true, CSfxManager::kMaxPriority, looped);
|
||||
CSfxManager::SfxSpan(hnd, 0);
|
||||
if (underwater)
|
||||
CSfxManager::PitchBend(hnd, 0);
|
||||
return hnd;
|
||||
}
|
||||
|
||||
CDamageInfo CGunWeapon::GetShotDamageInfo(const SShotParam& shotParam, CStateManager& mgr) const {
|
||||
// CWeaponMode mode(shotParam.x0_weaponType, 0);
|
||||
// float damage = shotParam.x8_damage;
|
||||
// float radiusDamage = shotParam.xc_radiusDamage;
|
||||
// float radius = shotParam.x10_radius;
|
||||
// float knockback = shotParam.x14_knockback;
|
||||
// bool noImmunity = shotParam.x18_24_noImmunity;
|
||||
|
||||
CDamageInfo result(
|
||||
CWeaponMode(shotParam.x0_weaponType, 0),
|
||||
shotParam.x8_damage,
|
||||
shotParam.xc_radiusDamage,
|
||||
shotParam.x10_radius,
|
||||
shotParam.x14_knockback,
|
||||
shotParam.x18_24_noImmunity);
|
||||
|
||||
if (gpGameState->GetHardMode()) {
|
||||
result.MultiplyDamage(gpGameState->GetHardModeWeaponMultiplier());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int get_current_suit(const CStateManager& mgr) {
|
||||
const CPlayerState* state = mgr.GetPlayerState();
|
||||
CPlayerState::EPlayerSuit suit = state->GetCurrentSuit();
|
||||
if (suit < CPlayerState::kPS_Power || suit > CPlayerState::kPS_FusionGravity)
|
||||
suit = CPlayerState::kPS_Power;
|
||||
if (suit == CPlayerState::kPS_FusionPower)
|
||||
suit = CPlayerState::EPlayerSuit(int(suit) + int(state->GetCurrentSuitRaw()));
|
||||
return suit;
|
||||
}
|
||||
|
||||
} // namespace NWeaponTypes
|
|
@ -30,6 +30,7 @@ _LITERAL_REPLACEMENTS = [
|
|||
|
||||
("g_SimplePool", "gpSimplePool"),
|
||||
("g_Renderer", "gpRender"),
|
||||
("g_ResFactory", "gpResourceFactory"),
|
||||
|
||||
# Vector
|
||||
(".magnitude()", ".Magnitude()"),
|
||||
|
|
Loading…
Reference in New Issue