DoorNode complete

This commit is contained in:
intns 2022-05-22 11:53:43 +01:00
parent 458cb4905c
commit 0e353055e1
6 changed files with 102 additions and 194 deletions

View File

@ -121,6 +121,7 @@ pikmin2.usa.dol: `sha1: 90d328bf8f190c90472e8c19e7e53c6ad0fe0d1a`
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BigFootAnimator.cpp">plugProjectNishimuraU/BigFootAnimator.cpp</a>
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BombSaraiAnimator.cpp">plugProjectNishimuraU/BombSaraiAnimator.cpp</a>
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/DamagumoAnimator.cpp">plugProjectNishimuraU/DamagumoAnimator.cpp</a>
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/DoorNode.cpp">plugProjectNishimuraU/DoorNode.cpp</a>
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecBugAnimator.cpp">plugProjectNishimuraU/ElecBugAnimator.cpp</a>
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecHibaAnimator.cpp">plugProjectNishimuraU/ElecHibaAnimator.cpp</a>
- <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/FrogAnimator.cpp">plugProjectNishimuraU/FrogAnimator.cpp</a>

49
include/Game/Cave/Node.h Normal file
View File

@ -0,0 +1,49 @@
#ifndef _GAME_CAVE_NODE_H
#define _GAME_CAVE_NODE_H
#include "types.h"
#include "CNode.h"
namespace Game {
namespace Cave {
struct Adjust {
s32 _00; // _00
s32 _04; // _04
s32 _08; // _08
Adjust();
};
struct AdjustNode : public CNode {
Adjust* m_node; // _18
AdjustNode();
AdjustNode(Adjust*);
};
struct Door {
s32 _00;
s32 _04;
Door();
};
struct DoorNode : public CNode {
Door m_node; // _18
DoorNode();
~DoorNode();
inline void reset()
{
m_node._00 = -1;
m_node._04 = -1;
}
DoorNode(Door&);
bool isDoorAdjust(DoorNode*);
};
} // namespace Cave
} // namespace Game
#endif

View File

@ -25,6 +25,12 @@ struct Obj : public MiniHoudai::Obj {
Obj();
};
} // namespace FixMiniHoudai
namespace NormMiniHoudai {
struct Obj : public MiniHoudai::Obj {
Obj();
};
} // namespace NormMiniHoudai
} // namespace Game
#endif

View File

@ -639,7 +639,7 @@ NISHIMURA:=\
$(BUILD_DIR)/src/plugProjectNishimuraU/RandMapChecker.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/RandMapUnit.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/RandEnemyUnit.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/DoorNode.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/DoorNode.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/MapUnitGenerator.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/MapCreator.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/RandMapScore.o\

View File

@ -1,33 +1,17 @@
#include "types.h"
/*
Generated from dpostproc
.section .data, "wa" # 0x8049E220 - 0x804EFC20
.global __vt__Q34Game4Cave8DoorNode
__vt__Q34Game4Cave8DoorNode:
.4byte 0
.4byte 0
.4byte __dt__Q34Game4Cave8DoorNodeFv
.4byte getChildCount__5CNodeFv
*/
#include "Game/Cave/Node.h"
namespace Game {
namespace Cave {
/*
* --INFO--
* Address: 8024B874
* Size: 000014
*/
Cave::Adjust::Adjust(void)
Adjust::Adjust()
{
/*
li r0, -1
stw r0, 0(r3)
stw r0, 4(r3)
stw r0, 8(r3)
blr
*/
_00 = -1;
_04 = -1;
_08 = -1;
}
/*
@ -35,27 +19,10 @@ Cave::Adjust::Adjust(void)
* Address: 8024B888
* Size: 000044
*/
Cave::AdjustNode::AdjustNode(void)
AdjustNode::AdjustNode()
: CNode()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
bl __ct__5CNodeFv
lis r3, __vt__Q34Game4Cave10AdjustNode@ha
li r0, 0
addi r4, r3, __vt__Q34Game4Cave10AdjustNode@l
mr r3, r31
stw r4, 0(r31)
stw r0, 0x18(r31)
lwz r31, 0xc(r1)
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
m_node = nullptr;
}
/*
@ -63,29 +30,10 @@ Cave::AdjustNode::AdjustNode(void)
* Address: 8024B8CC
* Size: 00004C
*/
Cave::AdjustNode::AdjustNode(Game::Cave::Adjust*)
AdjustNode::AdjustNode(Adjust* node)
: CNode()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
mr r30, r3
bl __ct__5CNodeFv
lis r4, __vt__Q34Game4Cave10AdjustNode@ha
mr r3, r30
addi r0, r4, __vt__Q34Game4Cave10AdjustNode@l
stw r0, 0(r30)
stw r31, 0x18(r30)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
m_node = node;
}
/*
@ -93,14 +41,10 @@ Cave::AdjustNode::AdjustNode(Game::Cave::Adjust*)
* Address: 8024B918
* Size: 000010
*/
Cave::Door::Door(void)
Door::Door()
: _00(-1)
, _04(-1)
{
/*
li r0, -1
stw r0, 0(r3)
stw r0, 4(r3)
blr
*/
}
/*
@ -108,30 +52,10 @@ Cave::Door::Door(void)
* Address: 8024B928
* Size: 000050
*/
Cave::DoorNode::DoorNode(void)
DoorNode::DoorNode()
: CNode()
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r3
bl __ct__5CNodeFv
lis r3, __vt__Q34Game4Cave8DoorNode@ha
li r0, -1
addi r4, r3, __vt__Q34Game4Cave8DoorNode@l
mr r3, r31
stw r4, 0(r31)
stw r0, 0x18(r31)
stw r0, 0x1c(r31)
stw r0, 0x18(r31)
stw r0, 0x1c(r31)
lwz r31, 0xc(r1)
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
reset();
}
/*
@ -139,35 +63,10 @@ Cave::DoorNode::DoorNode(void)
* Address: 8024B978
* Size: 000064
*/
Cave::DoorNode::DoorNode(Game::Cave::Door&)
DoorNode::DoorNode(Door& door)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
mr r30, r3
bl __ct__5CNodeFv
lis r3, __vt__Q34Game4Cave8DoorNode@ha
li r0, -1
addi r4, r3, __vt__Q34Game4Cave8DoorNode@l
mr r3, r30
stw r4, 0(r30)
stw r0, 0x18(r30)
stw r0, 0x1c(r30)
lwz r0, 0(r31)
stw r0, 0x18(r30)
lwz r0, 4(r31)
stw r0, 0x1c(r30)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
m_node._00 = door._00;
m_node._04 = door._04;
}
/*
@ -175,46 +74,28 @@ Cave::DoorNode::DoorNode(Game::Cave::Door&)
* Address: 8024B9DC
* Size: 000070
*/
void Cave::DoorNode::isDoorAdjust(Game::Cave::DoorNode*)
bool DoorNode::isDoorAdjust(DoorNode* other)
{
/*
lwz r0, 0x18(r3)
lwz r3, 0x18(r4)
cmpwi r0, 0
bne lbl_8024B9FC
cmpwi r3, 2
bne lbl_8024B9FC
li r3, 1
blr
s32 x = m_node._00;
s32 y = other->m_node._00;
lbl_8024B9FC:
cmpwi r0, 2
bne lbl_8024BA14
cmpwi r3, 0
bne lbl_8024BA14
li r3, 1
blr
if (!x && y == 2) {
return true;
}
lbl_8024BA14:
cmpwi r0, 3
bne lbl_8024BA2C
cmpwi r3, 1
bne lbl_8024BA2C
li r3, 1
blr
if (x == 2 && !y) {
return true;
}
lbl_8024BA2C:
cmpwi r0, 1
bne lbl_8024BA44
cmpwi r3, 3
bne lbl_8024BA44
li r3, 1
blr
if (x == 3 && y == 1) {
return true;
}
lbl_8024BA44:
li r3, 0
blr
*/
if (x == 1 && y == 3) {
return true;
}
return false;
}
/*
@ -222,35 +103,6 @@ lbl_8024BA44:
* Address: 8024BA4C
* Size: 000060
*/
Cave::DoorNode::~DoorNode(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
stw r31, 0xc(r1)
mr r31, r4
stw r30, 8(r1)
or. r30, r3, r3
beq lbl_8024BA90
lis r5, __vt__Q34Game4Cave8DoorNode@ha
li r4, 0
addi r0, r5, __vt__Q34Game4Cave8DoorNode@l
stw r0, 0(r30)
bl __dt__5CNodeFv
extsh. r0, r31
ble lbl_8024BA90
mr r3, r30
bl __dl__FPv
lbl_8024BA90:
lwz r0, 0x14(r1)
mr r3, r30
lwz r31, 0xc(r1)
lwz r30, 8(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
} // namespace Game
DoorNode::~DoorNode() { }
} // namespace Cave
} // namespace Game

View File

@ -1,8 +1,5 @@
#include "types.h"
/*
Generated from dpostproc
*/
#include "Game/Entities/MiniHoudai.h"
namespace Game {
@ -12,7 +9,10 @@ namespace Game {
* Size: 000090
*/
NormMiniHoudai::Obj::Obj()
: MiniHoudai::Obj()
{
// _308[something] ??? WTF is going on here
// m_creature =
/*
stwu r1, -0x10(r1)
mflr r0