Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion include/lib/BrawlHeaders
Submodule BrawlHeaders deleted from 29c4ff
139 changes: 139 additions & 0 deletions include/lib/BrawlHeaders/Brawl/Include/ac/ac_anim_cmd_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#pragma once

#include <StaticAssert.h>
#include <so/so_array.h>
#include <so/so_null.h>
#include <types.h>

// TODO: confirm class name
struct acCmdArgConv {
s32 argType;
// IntData, StringData, ValueIndexData, FloatData, AddressData, BoolData
s32 data;
};

class acCmdArg {
const acCmdArgConv* m_dataPtr;
u8 m_isNull;
public:
acCmdArg() : m_dataPtr(0), m_isNull(false) { }

bool isNull() const { return m_isNull; }
void setNull(bool val) { m_isNull = val; }
void setDataPtr(const acCmdArgConv* ptr) { m_dataPtr = ptr; }

// 0: getIntData
// 1: getFloatData
// 2: getAddressData
// 3: getBoolData?
// 4: getStringData?
// 5: getValueIndexData?
s32 getArgType() const {
if (m_isNull == 1) {
return -1;
}
return m_dataPtr->argType;
}

s32 getIntData() const {
if (m_isNull == 1) {
return 0;
}
return m_dataPtr->data;
}

float getFloatData() const {
if (m_isNull == 1) {
return 0.0f;
}
return m_dataPtr->data / 60000.0f;
}

void* getAddressData() {
if (m_isNull == 1) {
return 0;
}
return (void*) m_dataPtr->data;
}
};

// TODO: confirm class name
struct acAnimCmdConv
{
s8 group; // group 0 refers to systemCmds, >= 1 notSystemCmds
s8 type; // when group == 0, selects one of the 25 systemCmds to interpret
s8 argNum;
u8 option;
const acCmdArgConv* args;
};

// Currently, no real functions use this wrapper class.
// TODO: Confirm that this is really acCmdArgList, and
// use it in a legitimate way
struct acCmdArgList {
soArrayContractibleTable<const acCmdArgConv> argList;

acCmdArgList() : argList() { }
acCmdArgList(const acCmdArgConv* p1, s32 p2) : argList(p1, p2) { }

~acCmdArgList() { }
bool isEmpty() const { return argList.isEmpty(); }
};

class acAnimCmd : public soNullable {
public:
acAnimCmd() : soNullable(false) { }
acAnimCmd(bool isNull) : soNullable(isNull) { }

virtual s8 getGroup() const = 0;
virtual s8 getType() const = 0;
virtual s32 getArgNum() const = 0;
virtual u8 getOption() const = 0;
virtual soArrayContractibleTable<const acCmdArgConv> getArgList() = 0;
virtual bool getArg(acCmdArg* arg, s32 index) const = 0;
virtual const acAnimCmdConv* getCmdAddress() const = 0;
virtual bool isArgEmpty() const = 0;
virtual bool isValid() const = 0;
virtual ~acAnimCmd() { }
};

class acAnimCmdImpl : public acAnimCmd {
public:
const acAnimCmdConv* cmdAddr;

acAnimCmdImpl() : acAnimCmd(false), cmdAddr(0) { }
virtual s8 getGroup() const;
virtual s8 getType() const;
virtual s32 getArgNum() const;
virtual u8 getOption() const;
virtual soArrayContractibleTable<const acCmdArgConv> getArgList();
virtual bool getArg(acCmdArg* arg, s32 index) const;
virtual const acAnimCmdConv* getCmdAddress() const { return cmdAddr; }
virtual bool isArgEmpty() const;
virtual bool isValid() const;
virtual ~acAnimCmdImpl() { }

// TODO: made up deadstripped function to make soArrayFixed::isEmpty
// get emitted earlier
acCmdArgList getEmptyArgList();
};
static_assert(sizeof(acAnimCmdImpl) == 0xC, "Class is the wrong size!");

class acAnimCmdNull : public acAnimCmd {
public:
acAnimCmdNull() : acAnimCmd(true) { }

virtual s8 getGroup() const;
virtual s8 getType() const;
virtual s32 getArgNum() const;
virtual u8 getOption() const;
virtual soArrayContractibleTable<const acCmdArgConv> getArgList();
virtual bool getArg(acCmdArg* arg, s32 index) const;
virtual const acAnimCmdConv* getCmdAddress() const;
virtual bool isArgEmpty() const;
virtual bool isValid() const;
virtual ~acAnimCmdNull();
};

extern acCmdArg g_acCmdArg;
extern acAnimCmdNull g_acAnimCmdNull;
120 changes: 120 additions & 0 deletions include/lib/BrawlHeaders/Brawl/Include/ac/ac_cmd_interpreter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#pragma once

#include <StaticAssert.h>
#include <ac/ac_anim_cmd_impl.h>
#include <so/so_array.h>
#include <so/so_null.h>
#include <types.h>

// TODO: confirm whether this class is really needed
class acCmdInterpreterBase {
public:
virtual bool dispatchCmdIf(const acAnimCmd* cmd);
virtual s32 dispatchCmdSwitch(const acAnimCmd* cmd) const;
virtual void interpretNotSystemCmd();
virtual bool isBreakInterpret();
virtual bool isSleepStackData(s32 kind) const;
virtual bool isSkipEnd() const;
};

struct acCmdInterpreterStackData {
// TODO: identify exact meaning of knd0 and knd7:
// knd0: used for isBreakInterpret, Wait
// knd7: if unk30Field2 = 2, used for Wait to determine how much to wait, if at all
enum Kind {
Invalid = -1,
knd0 = 0,
Frame = 1,
Loop = 2,
ReturnAddress = 3,
IfCondition = 4,
Switch = 5,
While = 6,
knd7 = 7,
};

acCmdInterpreterStackData(Kind knd = Invalid, s32 id = 0, bool bd = false,
const acAnimCmdConv* ad = nullptr, float fd = 0.0f) :
kind(knd), intData(id), boolData(bd), addressData(ad), floatData(fd) { }

Kind kind;
s32 intData; // Loop count, or result of dispatchCmdSwitch
bool boolData; // If condition result, "found Case" flag for Switch
const acAnimCmdConv* addressData; // target address for jumps
float floatData; // some data for wait time calculations
};

class acCmdInterpreter : private acCmdInterpreterBase {
float m_fixedTimeStep;
float m_lastTimeStep;
const acAnimCmdConv* m_currentCmd;
const acAnimCmdConv* m_copyCurrentCmd; // purpose unclear
acAnimCmdImpl m_animCmd; // usually kept in sync with m_currentCmd
soArrayVector<acCmdInterpreterStackData, 8>* m_stack;
float m_currentFrame;
float unk28;
float m_overshoot;
const s32 m_interpretMode:2; // -2 or -1 -> skip all commands, 0 -> use m_fixedTimeStep
s32 unk30Field2:3; // related to isSkipEnd
u8 m_dontAdvance;
u8 unk32; // appears to be unused
u8 m_reset;

public:
acCmdInterpreter(soArrayVector<acCmdInterpreterStackData, 8>* stk,
s32 mode, acAnimCmdConv* initCmd, const u8* resetMode, float fixedTimeStep);
~acCmdInterpreter();

virtual bool dispatchCmdIf(const acAnimCmd* cmd) { return true; }
virtual s32 dispatchCmdSwitch(const acAnimCmd* cmd) const;
virtual void interpretNotSystemCmd();
virtual bool isBreakInterpret();
virtual bool isSleepStackData(s32 kind) const;
virtual bool isSkipEnd() const;

void interpretCmd(float timeStep);
void resetInterpreter(float frame, const acAnimCmdConv *initCmd);
void skipCmd();
acCmdInterpreterStackData* getLastSystemStackData();
void popSystemStack();
void pushSystemStack(const acCmdInterpreterStackData& stackData);
void skipNextIfGroup(bool skippingIfBlock);
void skipNextSwitchGroup(bool doNotSkipCases);
void skipNextNotSwitchGroup();
void skipNextLoopGroup();
void skipNextWhileGroup();
const acAnimCmd* getCurrentCmd();
bool testCurrentCmd() const;
void advanceCurrentCmd();
const acAnimCmd* updateCurrentCmd();
s32 getIdxOfStackData(acCmdInterpreterStackData::Kind kind) const;
void interpretOneCmd();
void popStackToSize(s32 i);
void systemCmdFuncWaitSub(float waitTime);
void systemCmdFuncEnd();
void systemCmdFuncWait();
void systemCmdFuncFrame();
void systemCmdFuncFrameClr();
void systemCmdFuncLoop();
void systemCmdFuncPool();
void systemCmdFuncBreak();
void systemCmdFuncCall();
void systemCmdFuncReturn();
void systemCmdFuncJump();
void systemCmdFuncIf();
void systemCmdFuncIfAnd();
void systemCmdFuncIfOr();
void systemCmdFuncElsIf();
void systemCmdFuncElse();
void systemCmdFuncEndIf();
void systemCmdFuncSwitch();
void systemCmdFuncCase();
void systemCmdFuncDefault();
void systemCmdFuncEndSwitch();
void systemCmdFuncWhile();
void systemCmdFuncWhileAnd();
void systemCmdFuncWhileOr();
void systemCmdFuncEndWhile();
void systemCmdFuncBreakSwitch();
};
static_assert(sizeof(acCmdInterpreter) == 0x34, "Class is the wrong size!");
17 changes: 17 additions & 0 deletions include/lib/BrawlHeaders/Brawl/Include/ad/ad_autosave.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include <StaticAssert.h>
#include <gf/gf_task.h>
#include <types.h>

class adAutoSave : public gfTask {
u8 unk0[0x10];
public:
virtual void processDefault();
virtual void init();
virtual ~adAutoSave();

static adAutoSave* create(bool p1);
static bool isAlive();
};
static_assert(sizeof(adAutoSave) == 0x50, "Class is the wrong size!");
51 changes: 51 additions & 0 deletions include/lib/BrawlHeaders/Brawl/Include/ad/ad_list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#pragma once

#include <StaticAssert.h>
#include <sr/sr_common.h>
#include <types.h>

template<typename T>
struct adListNode {
adListNode* m_prev;
adListNode* m_next;
T m_val;
};

template<typename T>
class adListInterface {
public:
virtual u32 count() const = 0;
virtual void reset() = 0;
virtual T* current() = 0;
virtual T* end() = 0;
virtual T get() const = 0;
virtual void set(T val) = 0;
virtual void next() = 0;
virtual void prev() = 0;
virtual void pushBack(T val) = 0;
virtual void remove() = 0;
virtual void eraseCurrentNode() = 0;
};

template<typename T, Heaps::HeapType H>
class adList : public adListInterface<T> {
adListNode<T>* m_start;
adListNode<T>* m_end;
adListNode<T>* m_current;
u32 m_count;
public:
virtual u32 count() const;
virtual void reset();
virtual T* current();
virtual T* end();
virtual T get() const;
virtual void set(T val);
virtual void next();
virtual void prev();
virtual void pushBack(T val);
virtual void remove();
virtual void eraseCurrentNode();

adList() : m_start(nullptr), m_end(nullptr), m_current(nullptr),
m_count(0) { }
};
16 changes: 16 additions & 0 deletions include/lib/BrawlHeaders/Brawl/Include/ad/ad_static_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <StaticAssert.h>
#include <types.h>

struct adventureStaticData {
u32 unk0;
u8 unk4;

static const u32 AllStepNum = 0x101;
static adventureStaticData s_adventureStaticData[AllStepNum];
public:
static s32 getStepIndex(u32 p1);
static u32 getAllStepNum();
};
static_assert(sizeof(adventureStaticData) == 8, "Class is the wrong size!");
27 changes: 27 additions & 0 deletions include/lib/BrawlHeaders/Brawl/Include/ai/ai_mgr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include <StaticAssert.h>
#include <ft/ft_manager.h>
#include <gf/gf_task.h>
#include <mt/mt_vector.h>
#include <types.h>

class aiMgr : public gfTask, public ftOutsideEventObserver {
char _76[828];

public:
virtual void processBegin();
virtual void renderDebug();
virtual ~aiMgr();

virtual void notifyEventOnDamage(int entryId, u32 hp, soDamage* damage);
virtual void notifyEventDead(int entryId, int deadCount, Fighter::Dead::Reason deadReason, int respawnFrames);
virtual void notifyEventChangeStart(int entryId, int playerNo, int activeInstanceIndex, ftKind);
virtual void notifyEventChangeEnd(int entryId, int playerNo, int activeInstanceIndex, ftKind);

int setDangerZone(Vec2f* p1, Vec2f* p2, int index, bool, bool);
void delDangerZone(int);
};
static_assert(sizeof(aiMgr) == 0x388, "Class is wrong size!");

extern aiMgr* g_aiMgr;
Loading
Loading