Advertisement
Gamestabled

z3Dactor.h

Dec 14th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.70 KB | None | 0 0
  1. #ifndef _Z3DACTOR_H_
  2. #define _Z3DACTOR_H_
  3.  
  4. #include <z3Dvec.h>
  5.  
  6. struct Actor;
  7. struct GlobalContext;
  8.  
  9. struct LightMapper;
  10.  
  11. typedef struct {
  12. Vec3f pos;
  13. Vec3s rot;
  14. } PosRot; // size = 0x14
  15.  
  16. typedef struct {
  17. /* 0x00 */ char unk_00[0x8];
  18. /* 0x08 */ Vec3s norm; // Normal vector
  19. /* 0x0E */ s16 dist; // Plane distance from origin
  20. } CollisionPoly; // size = 0x10
  21.  
  22. typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*);
  23.  
  24. typedef struct {
  25. /* 0x00 */ s16 id;
  26. /* 0x02 */ u8 type; // Classifies actor and determines when actor will execute
  27. /* 0x03 */ u8 room; // Room instance was spawned in. If value set to FF in rom, instance does not despawn when swapping rooms
  28. /* 0x04 */ u32 flags;
  29. /* 0x08 */ s16 objectId;
  30. /* 0x0C */ u32 instanceSize;
  31. /* 0x10 */ ActorFunc init; // Constructor
  32. /* 0x14 */ ActorFunc destroy; // Destructor
  33. /* 0x18 */ ActorFunc update; // Main Update Function
  34. /* 0x1C */ ActorFunc draw; // Draw function
  35. } ActorInit; // size = 0x20
  36.  
  37. typedef enum {
  38. ALLOCTYPE_NORMAL,
  39. ALLOCTYPE_ABSOLUTE,
  40. ALLOCTYPE_PERMANENT
  41. } AllocType;
  42.  
  43. typedef struct {
  44. /* 0x00 */ u32 vromStart; // unused?
  45. /* 0x04 */ u32 vromEnd; // unused?
  46. /* 0x08 */ void* vramStart; // unused?
  47. /* 0x0C */ void* vramEnd; // unused?
  48. /* 0x10 */ void* loadedRamAddr; // unused?
  49. /* 0x14 */ ActorInit* initInfo;
  50. /* 0x18 */ char* name; // unused?
  51. /* 0x1C */ u16 allocType; // unused?
  52. /* 0x1E */ s8 nbLoaded; // unused?
  53. } ActorOverlay; // size = 0x20
  54.  
  55. typedef struct {
  56. struct {
  57. char damage : 4;
  58. char effect : 4;
  59. } attack[32];
  60. } ActorDamageChart;
  61.  
  62. typedef struct {
  63. /* 0x00 */ ActorDamageChart* damageChart; // For actors which contain a damage chart (example: Stalfos)...
  64. /* 0x04 */ Vec3f displacement; // Amount to correct velocity (0x5C) by when colliding into a body
  65. /* 0x10 */ s16 unk_10;
  66. /* 0x12 */ s16 unk_12;
  67. /* 0x14 */ u16 unk_14;
  68. /* 0x16 */ u8 mass; // Used to compute displacement, 50 is common value, 0xFF for infinite mass/unmoveable
  69. /* 0x17 */ u8 health;
  70. /* 0x18 */ u8 damage; // Amount to decrement health by
  71. /* 0x19 */ u8 damageEffect; // Stores what effect should occur when hit by a weapon
  72. /* 0x1A */ u8 impactEffect; // Maybe? set on deku nut when deku nut collides with gossip stone
  73. /* 0x1B */ u8 unk_1B;
  74. } SubActorStructA0; // size = 0x1C
  75.  
  76. typedef struct {
  77. /* 0x00 */ Vec3s rot; // Current actor shape rotation
  78. /* 0x06 */ u8 unk_06;
  79. /* 0x08 */ f32 unk_08; // Model y axis offset. Represents model space units. collision mesh related
  80. /* 0x0C */ void (*shadowDrawFunc)(struct Actor*, struct LightMapper*, struct GlobalContext*);
  81. /* 0x10 */ f32 unk_10;
  82. /* 0x14 */ u8 unk_14;
  83. /* 0x15 */ u8 unk_15;
  84. } ActorShape; // size = 0x18
  85.  
  86. typedef struct Actor {
  87. /* 0x000 */ s16 id; // Actor Id
  88. /* 0x002 */ u8 type; // Actor Type. Refer to the corresponding enum for values
  89. /* 0x003 */ s8 room; // Room number the actor is part of. FF denotes that the actor won't despawn on a room change
  90. /* 0x004 */ u32 flags; // Flags used for various purposes
  91. /* 0x008 */ PosRot initPosRot; // Contains Initial Rotation when Object is Spawned
  92. /* 0x01C */ s16 params; // original name: "args_data"; Configurable variable set by an actor's spawn data
  93. /* 0x01E */ char unk_1E[0xA];
  94. /* 0x028 */ PosRot posRot; // Current coordinates
  95. /* 0x03C */ PosRot posRot2; // Related to camera
  96. /* 0x050 */ f32 unk_4C;
  97. /* 0x054 */ Vec3f scale; // Sets x,y,z scaling factor. Typically, a factor of 0.01 is used for each axis
  98. /* 0x060 */ Vec3f velocity;
  99. /* 0x06C */ f32 speedXZ; // Always positive, stores how fast the actor is traveling along the XZ plane
  100. /* 0x070 */ f32 gravity; // Acceleration due to gravity; value is added to Y velocity every frame
  101. /* 0x074 */ f32 minVelocityY; // Sets the lower bounds cap on velocity along the Y axis
  102. /* 0x078 */ CollisionPoly* wallPoly; // Wall polygon an actor is touching
  103. /* 0x07C */ CollisionPoly* floorPoly; // Floor polygon an actor is over/touching
  104. /* 0x080 */ u8 wallPolySource; // Complex Poly Surface Source. 0x32 = Scene
  105. /* 0x081 */ u8 floorPolySource; // Complex Poly Surface Source. 0x32 = Scene. related to 0x80/88
  106. /* 0x082 */ char unk_82[0x12];
  107. /* 0x094 */ f32 xzDistanceFromLink;
  108. /* 0x098 */ f32 yDistanceFromLink;
  109. /* 0x09C */ f32 unk_9C;
  110. /* 0x0A0 */ SubActorStructA0 sub_A0;
  111. /* 0x0BC */ ActorShape shape;
  112. /* 0x0D4 */ Vec3f unk_D4[2];
  113. /* 0x0EC */ Vec3f unk_EC; // Stores result of some vector transformation involving actor xyz vector, and a matrix at Global Context + 11D60
  114. /* 0x0F8 */ f32 unk_F8; // Related to above
  115. /* 0x0FC */ f32 unk_FC;
  116. /* 0x100 */ f32 unk_100;
  117. /* 0x104 */ f32 unk_104;
  118. /* 0x108 */ Vec3f pos4; // Final Coordinates last frame
  119. /* 0x114 */ u8 unk_114; // Z-Target related
  120. /* 0x115 */ u8 unk_115; // Z-Target related
  121. /* 0x116 */ u16 textId; // Text id to pass to link/display when interacting with an actor (navi text, probably others)
  122. /* 0x118 */ char unk_118[0x9];
  123. /* 0x121 */ u8 activelyDrawn; // Indicates whether the actor is currently being drawn (but not through lens). 01 for yes, 00 for no
  124. /* 0x122 */ u8 unk_122; // Set within a routine that deals with collision
  125. /* 0x123 */ u8 naviEnemyId; // Sets what 0600 dialog to display when talking to navi. Default 0xFF
  126.  
  127. /* 0x124 */ struct Actor* attachedA; // Interfacing Actor?
  128. // e.g. Link holding chu, Chu instance stores ptr to Link instance here;
  129. // Anju having Link's ptr when giving an item
  130. // Volvagia Hole stores Volvagia Flying here
  131.  
  132. /* 0x128 */ struct Actor* attachedB; // Attached to Actor
  133. // e.g. Link holding chu, Link instance stores ptr to Bombchu instance here
  134.  
  135. /* 0x12C */ struct Actor* next; // Next Actor of this type
  136. /* 0x130 */ struct Actor* prev; // Previous Actor of this type
  137.  
  138. /* 0x134 */ ActorFunc init; // Initialization Routine. Mandatory
  139. /* 0x138 */ ActorFunc destroy; // Destruction Routine
  140. /* 0x13C */ ActorFunc update; // Main Update Routine, called every frame the actor is to be updated
  141. /* 0x140 */ ActorFunc draw; // Draw Routine, writes necessary display lists
  142.  
  143. /* 0x144 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor
  144. /* From here on, the structure and size varies for each actor */
  145. } Actor; // size = 0x148
  146.  
  147. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement