mirror of https://github.com/zeldaret/mm.git
Document Light-Based Actor Flags (#1754)
* light flags template * first attempt * typo * improve names * improve comments
This commit is contained in:
parent
33e4afd4d5
commit
3c16f534de
|
|
@ -544,8 +544,11 @@ typedef enum DoorLockType {
|
|||
#define ACTOR_FLAG_100000 (1 << 20)
|
||||
//
|
||||
#define ACTOR_FLAG_200000 (1 << 21)
|
||||
//
|
||||
#define ACTOR_FLAG_400000 (1 << 22)
|
||||
|
||||
// Specifies whether the actor can (not) use fake point lights, in the event that ucode point lights are not compatible with its display lists.
|
||||
// In F3DZEX2 versions that predate MM, microcode point lights didn't exist so `PointLight_t` could not be used.
|
||||
// Instead, fake point lights by using a directional light that constantly changes to face a reference position.
|
||||
#define ACTOR_FLAG_IGNORE_LEGACY_POINT_LIGHTS (1 << 22)
|
||||
|
||||
// When Player is carrying this actor, it can only be thrown, not dropped/placed.
|
||||
// Typically an actor can only be thrown when moving, but this allows an actor to be thrown when standing still.
|
||||
|
|
@ -567,8 +570,9 @@ typedef enum DoorLockType {
|
|||
// Tatl will still be able to hover over the actor, assuming `ACTOR_FLAG_ATTENTION_ENABLED` is set.
|
||||
#define ACTOR_FLAG_LOCK_ON_DISABLED (1 << 27)
|
||||
|
||||
//
|
||||
#define ACTOR_FLAG_10000000 (1 << 28)
|
||||
// Specifies whether subsequent geometry is compatible with ucode point lights.
|
||||
// The current room must also enable point lights for point lights to take effect.
|
||||
#define ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED (1 << 28)
|
||||
|
||||
// Signals that player has accepted an offer to use the ocarina to interact with an actor
|
||||
// An exception is made for EN_ZOT, see `Player_ActionHandler_13`.
|
||||
|
|
|
|||
|
|
@ -2770,12 +2770,16 @@ void Actor_Draw(PlayState* play, Actor* actor) {
|
|||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
light = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx);
|
||||
if ((actor->flags & ACTOR_FLAG_10000000) && (play->roomCtx.curRoom.enablePosLights || (MREG(93) != 0))) {
|
||||
if ((actor->flags & ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED) &&
|
||||
(play->roomCtx.curRoom.enablePosLights || (MREG(93) != 0))) {
|
||||
light->enablePosLights = true;
|
||||
}
|
||||
|
||||
Lights_BindAll(light, play->lightCtx.listHead,
|
||||
(actor->flags & (ACTOR_FLAG_10000000 | ACTOR_FLAG_400000)) ? NULL : &actor->world.pos, play);
|
||||
(actor->flags & (ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED | ACTOR_FLAG_IGNORE_LEGACY_POINT_LIGHTS))
|
||||
? NULL
|
||||
: &actor->world.pos,
|
||||
play);
|
||||
Lights_Draw(light, play->state.gfxCtx);
|
||||
|
||||
if (actor->flags & ACTOR_FLAG_IGNORE_QUAKE) {
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused) {
|
|||
}
|
||||
}
|
||||
|
||||
typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec);
|
||||
typedef void (*LightsPosBindFunc)(Lights* lights, LightParams* params, struct PlayState* play);
|
||||
typedef void (*LightsBindFuncLegacy)(Lights* lights, LightParams* params, Vec3f* vec);
|
||||
typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, struct PlayState* play);
|
||||
|
||||
/**
|
||||
* For every light in a provided list, try to find a free slot in the provided Lights group and bind
|
||||
|
|
@ -201,28 +201,32 @@ typedef void (*LightsPosBindFunc)(Lights* lights, LightParams* params, struct Pl
|
|||
*
|
||||
* Note: Lights in a given list can only be binded to however many free slots are
|
||||
* available in the Lights group. This is at most 7 slots for a new group, but could be less.
|
||||
*
|
||||
* Note: In F3DZEX2 versions that predate MM, microcode point lights didn't exist so `PointLight_t` could not be used.
|
||||
* Instead, fake point lights by using a directional light that constantly changes to face a reference position.
|
||||
* `sBindFuncs` maps to the new microcode point lights, and `sBindFuncsLegacy` maps to the old fake point lights.
|
||||
*/
|
||||
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play) {
|
||||
static LightsPosBindFunc sPosBindFuncs[] = {
|
||||
static LightsBindFunc sBindFuncs[] = {
|
||||
Lights_BindPoint,
|
||||
(LightsPosBindFunc)Lights_BindDirectional,
|
||||
(LightsBindFunc)Lights_BindDirectional,
|
||||
Lights_BindPoint,
|
||||
};
|
||||
static LightsBindFunc sDirBindFuncs[] = {
|
||||
static LightsBindFuncLegacy sBindFuncsLegacy[] = {
|
||||
Lights_BindPointWithReference,
|
||||
(LightsBindFunc)Lights_BindDirectional,
|
||||
(LightsBindFuncLegacy)Lights_BindDirectional,
|
||||
Lights_BindPointWithReference,
|
||||
};
|
||||
|
||||
if (listHead != NULL) {
|
||||
if ((refPos == NULL) && (lights->enablePosLights == 1)) {
|
||||
do {
|
||||
sPosBindFuncs[listHead->info->type](lights, &listHead->info->params, play);
|
||||
sBindFuncs[listHead->info->type](lights, &listHead->info->params, play);
|
||||
listHead = listHead->next;
|
||||
} while (listHead != NULL);
|
||||
} else {
|
||||
do {
|
||||
sDirBindFuncs[listHead->info->type](lights, &listHead->info->params, refPos);
|
||||
sBindFuncsLegacy[listHead->info->type](lights, &listHead->info->params, refPos);
|
||||
listHead = listHead->next;
|
||||
} while (listHead != NULL);
|
||||
}
|
||||
|
|
@ -400,7 +404,7 @@ void Lights_GlowCheck(PlayState* play) {
|
|||
worldPos.z = params->z;
|
||||
Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW);
|
||||
|
||||
params->drawGlow = 0;
|
||||
params->drawGlow = false;
|
||||
|
||||
if ((projectedPos.z > 1) && (fabsf(projectedPos.x * invW) < 1) && (fabsf(projectedPos.y * invW) < 1)) {
|
||||
s32 screenPosX = PROJECTED_TO_SCREEN_X(projectedPos, invW);
|
||||
|
|
@ -409,7 +413,7 @@ void Lights_GlowCheck(PlayState* play) {
|
|||
s32 zBuf = SysCfb_GetZBufferInt(screenPosX, screenPosY);
|
||||
|
||||
if (wZ < zBuf) {
|
||||
params->drawGlow = 1;
|
||||
params->drawGlow = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void BgAstrBombwall_Init(Actor* thisx, PlayState* play) {
|
|||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10000000;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED;
|
||||
if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements)) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void BgCraceMovebg_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.world.rot.z = 0;
|
||||
this->dyna.actor.home.rot.x = 0;
|
||||
this->dyna.actor.home.rot.z = 0;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10000000;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED;
|
||||
|
||||
switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) {
|
||||
case BG_CRACE_MOVEBG_TYPE_CLOSING:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "z_bg_ikana_bombwall.h"
|
||||
#include "assets/objects/object_ikana_obj/object_ikana_obj.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10000000)
|
||||
#define FLAGS (ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED)
|
||||
|
||||
#define THIS ((BgIkanaBombwall*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "z_bg_kin2_bombwall.h"
|
||||
#include "assets/objects/object_kin2_obj/object_kin2_obj.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_10000000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED)
|
||||
|
||||
#define THIS ((BgKin2Bombwall*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void BgKin2Shelf_Init(Actor* thisx, PlayState* play) {
|
|||
this->dyna.actor.uncullZoneScale = 250.0f;
|
||||
this->dyna.actor.uncullZoneDownward = 300.0f;
|
||||
Actor_SetScale(&this->dyna.actor, 1.0f);
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10000000;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED;
|
||||
}
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "z_bg_market_step.h"
|
||||
#include "assets/objects/object_market_obj/object_market_obj.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_20 | ACTOR_FLAG_10000000)
|
||||
#define FLAGS (ACTOR_FLAG_20 | ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED)
|
||||
|
||||
#define THIS ((BgMarketStep*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) {
|
|||
|
||||
sp24 = shutterSceneInfo->index;
|
||||
if (sp24 == 6) {
|
||||
this->slidingDoor.dyna.actor.flags |= ACTOR_FLAG_10000000;
|
||||
this->slidingDoor.dyna.actor.flags |= ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED;
|
||||
}
|
||||
} else if (sp24 == 0) {
|
||||
BossDoorInfo* bossDoorInfo = &D_808A22A0[0];
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ s32 func_809A2B70(DoorSpiral* this, PlayState* play) {
|
|||
if (this->unk148 == 2) {
|
||||
this->unk148 = 3;
|
||||
}
|
||||
this->actor.flags |= ACTOR_FLAG_10000000;
|
||||
this->actor.flags |= ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED;
|
||||
}
|
||||
DoorSpiral_SetupAction(this, func_809A2FF8);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ s32 func_808F8AA0(EnHorseGameCheck* this, PlayState* play) {
|
|||
MtxF sp38;
|
||||
|
||||
this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = this->unk_160 * 0.001f;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_400000;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_IGNORE_LEGACY_POINT_LIGHTS;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "assets/objects/object_mamenoki/object_mamenoki.h"
|
||||
#include "assets/objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_400000)
|
||||
#define FLAGS (ACTOR_FLAG_IGNORE_LEGACY_POINT_LIGHTS)
|
||||
|
||||
#define THIS ((ObjBean*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "z64quake.h"
|
||||
#include "assets/objects/object_dhouse/object_dhouse.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_400000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_LEGACY_POINT_LIGHTS)
|
||||
|
||||
#define THIS ((ObjDhouse*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "z_obj_spidertent.h"
|
||||
#include "assets/objects/object_spidertent/object_spidertent.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10000000)
|
||||
#define FLAGS (ACTOR_FLAG_UCODE_POINT_LIGHT_ENABLED)
|
||||
|
||||
#define THIS ((ObjSpidertent*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "z64rumble.h"
|
||||
#include "assets/objects/object_tokei_step/object_tokei_step.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_400000)
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_LEGACY_POINT_LIGHTS)
|
||||
|
||||
#define THIS ((ObjTokeiStep*)thisx)
|
||||
|
||||
|
|
|
|||
|
|
@ -977,8 +977,8 @@
|
|||
0x801BEA1C:("sHeartsDDEnvFactors","s16","[3][3]",0x12),
|
||||
0x801BEA30:("sHeartTextures","UNK_TYPE1","",0x1),
|
||||
0x801BEA70:("sHeartDDTextures","UNK_TYPE1","",0x1),
|
||||
0x801BEAB0:("sPosBindFuncs","LightsPosBindFunc","[3]",0xc),
|
||||
0x801BEABC:("sDirBindFuncs","LightsBindFunc","[3]",0xc),
|
||||
0x801BEAB0:("sBindFuncs","LightsBindFunc","[3]",0xc),
|
||||
0x801BEABC:("sBindFuncsLegacy","LightsBindFuncLegacy","[3]",0xc),
|
||||
0x801BEAD0:("D_801BEAD0","s32","[4]",0x10),
|
||||
0x801BEAE0:("D_801BEAE0","s32","[4]",0x10),
|
||||
0x801BEAF0:("D_801BEAF0","u32","[4]",0x10),
|
||||
|
|
|
|||
Loading…
Reference in New Issue