NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
d_wm_enemy.hpp
1#pragma once
2
3#include <game/bases/d_wm_demo_actor.hpp>
4#include <game/bases/d_wm_en_path.hpp>
5#include <game/bases/d_wm_bgm_sync.hpp>
6
7/// @ingroup bases
8/// @paramtable
9class dWmEnemy_c : public dWmDemoActor_c {
10public:
11 /// @unofficial
12 struct JumpData_s {
13 int m_00;
14 float mJumpSpeed;
15 short mFrames;
16 float mStartScale;
17 float mEndScale;
18 };
19
20 dWmEnemy_c() {}
22
23 virtual int create() { return SUCCEEDED; }
24 virtual int execute();
25 virtual int draw() { return SUCCEEDED; }
26 virtual int doDelete() { return SUCCEEDED; }
27 virtual int GetActorType() { return ACTOR_MAP_ENEMY; }
28
29 virtual int GetIndex() { return isDead() ? -1 : mPath.mpCurrentPoint->mPointIndex; }
30 virtual int GetNextIndex() { return mPath.GetNextPointIdx(); }
31 virtual float GetTerritory() { return 0.0f; }
32 virtual void initWalk() {}
33 virtual bool doWalk();
34 virtual void initDemoAnger();
35 virtual bool procDemoAnger();
36 virtual void initDemoLose();
37 virtual bool procDemoLose();
38 virtual void procDemoLoseEnd();
39 virtual void initDemoStarLose();
40 virtual bool procDemoStarLose();
41 virtual void initDemoBgmDance();
42 virtual bool procDemoBgmDance();
43 virtual mVec3_c calcBlowOffPos(float offsetX) { return mVec3_c(mPos.x + offsetX, mPos.y, mPos.z); }
44 virtual mVec3_c getPointOffset(int index);
45 virtual short getWaitAngle() { return 0; }
46 virtual float getWalkAnmRate() { return 1.0f; }
47 virtual void setWalkAnm(float anmRate) {}
48 virtual bool IsHitToWaitPlayer();
49 virtual int getStartPoint();
50 virtual int vfc4(int pointNo) { return pointNo; } ///< @unofficial
51 virtual void calc();
52 virtual void calculateEffect();
53 virtual int getEnemyWalkSeID();
54 virtual bool IsPlayerComing() { return IsPlayerComingCore(); }
55 virtual bool IsRandomWalk();
56 virtual bool IsRandomMove() { return true; }
57 virtual short GetChangeDirRate() { return 50; }
58 virtual int GetMoveRate() { return 100; }
59 virtual short GetWalkWaitFrame() { return 20; }
60 virtual void PostWaitWalk() {}
61 virtual void updateBgmAnimRate();
62 virtual int isWaitWalkEnd() { return mCurrProc != PROC_TYPE_WAIT_WALK; }
63
64 void initializeBase(const char **names, int count, bool cyclic);
65 void initShapeAngle();
66 bool IsExecEnable();
67 bool IsNeedChasePlayer();
68 mVec3_c getNextPointInfo();
69 mVec3_c getCurrentPointInfo();
70 void initWalk(float);
71 bool isNextThroughPoint();
72 bool CheckIsHitToPlayer();
73 void updatePathInfo(bool);
74 void deleteSound();
75 void deleteEffect();
76 bool csCommand(int id, bool b); ///< @unofficial
77 bool FUN_800f88d0(); ///< @unofficial (`isMainCast`?)
78 void demoJump(const mVec3_c &pos, JumpData_s &jumpData, float scale); ///< @unofficial
79 bool isThroughPoint(int);
80 bool isDead();
81 void ModelCalc(m3d::mdl_c *mdl, float yOffset, float shadowYOffset, float shadowScale);
82 bool IsPlayerComingCore();
83 bool IsHitToMovePlayer();
84 bool isAllEnemyMoveEnd();
85 bool procDemoLoseBase(short angle);
86
87 void init_exec();
88 void mode_exec();
89 void init_DemoContinue();
90 void mode_DemoContinue();
91 void init_bgmDance();
92 void mode_bgmDance();
93 void init_lose();
94 void mode_lose();
95 void init_waitWalk();
96 void mode_waitWalk();
97
98 typedef void (dWmEnemy_c::*ProcFunc)();
99
100private:
101 struct unk_s {
102 float m_00, m_04, m_08, m_0c;
103 u8 mPad[0x42];
104 mAng3_c mAngle1;
105 mAng3_c mAngle2;
106 };
107
108 enum PROC_TYPE_e {
109 PROC_TYPE_EXEC,
110 PROC_TYPE_DEMO_CONTINUE,
111 PROC_TYPE_BGM_DANCE,
112 PROC_TYPE_LOSE,
113 PROC_TYPE_WAIT_WALK,
114 PROC_COUNT
115 };
116
117 enum POINT_TYPE_e {
118 POINT_TYPE_STOP,
119 POINT_TYPE_THROUGH
120 };
121
122 dWmEnPath_c mPath;
123 mVec3_c mNextPoint;
124 mVec3_c mPrevPoint;
125 mAng3_c mDemoAngle;
126 bool mArrivedAtTarget;
127 bool mEnWalk;
128 POINT_TYPE_e mNextPointType; ///< 0 = stop point, 1 = through point
129 int mRotateTimer;
130 unk_s *mpUnkData;
131 PROC_TYPE_e mCurrProc;
132 int mWalkWaitTimer;
133 int mDemoContinueRelated;
134 dWmBgmSync_c *mpBgmSync;
135 int mBgmDanceRelated;
136 bool mNotAnger;
137 int mSeID;
138 int mEfID;
139 bool mHitPlayer;
140
141 ACTOR_PARAM_CONFIG(enemyNo, 0, 4);
142 ACTOR_PARAM_CONFIG(startPoint, 4, 4);
143
144public:
145 static const char *smc_PathPointA[];
146 static const char *smc_PathPointB[];
147 static const char *smc_PathPointC[];
148};
mVec3_c mPos
The actor's position.
@ ACTOR_MAP_ENEMY
A map enemy (dWmEnemy_c).
virtual int execute()
do method for the execute operation.
bool FUN_800f88d0()
virtual int vfc4(int pointNo)
virtual int doDelete()
do method for the delete operation.
POINT_TYPE_e mNextPointType
0 = stop point, 1 = through point
virtual int GetActorType()
Gets the actor kind. See ACTOR_KIND_e.
virtual int draw()
do method for the draw operation.
bool csCommand(int id, bool b)
void demoJump(const mVec3_c &pos, JumpData_s &jumpData, float scale)
virtual int create()
do method for the create operation.
@ SUCCEEDED
The step was completed successfully.
Definition f_base.hpp:43
A three-dimensional short angle vector.
Definition m_angle.hpp:60