mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-02 16:23:57 +03:00
Added even more events
Some checks are pending
Some checks are pending
This commit is contained in:
parent
fd0cd322f8
commit
dbf9b0378f
@ -2824,28 +2824,38 @@ void Actor_Update(Actor* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (this->obj.status) {
|
switch (this->obj.status) {
|
||||||
case OBJ_INIT:
|
case OBJ_INIT: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectInitEvent, OBJECT_TYPE_ACTOR, this) {
|
||||||
this->obj.status = OBJ_ACTIVE;
|
this->obj.status = OBJ_ACTIVE;
|
||||||
Object_Init(this->index, this->obj.id);
|
Object_Init(this->index, this->obj.id);
|
||||||
if (this->obj.id != OBJ_ACTOR_ZO_RADARBUOY) {
|
if (this->obj.id != OBJ_ACTOR_ZO_RADARBUOY) {
|
||||||
Actor_Move(this);
|
Actor_Move(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_ACTIVE:
|
case OBJ_ACTIVE: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectUpdateEvent, OBJECT_TYPE_ACTOR, this) {
|
||||||
Actor_Move(this);
|
Actor_Move(this);
|
||||||
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
||||||
this->info.action(&this->obj);
|
this->info.action(&this->obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_DYING:
|
case OBJ_DYING: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectDestroyEvent, OBJECT_TYPE_ACTOR, this) {
|
||||||
Actor_Move(this);
|
Actor_Move(this);
|
||||||
if (this->obj.status != OBJ_FREE) {
|
if (this->obj.status != OBJ_FREE) {
|
||||||
Object_Dying(this->index, this->obj.id);
|
Object_Dying(this->index, this->obj.id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Boss_Update(Boss* this) {
|
void Boss_Update(Boss* this) {
|
||||||
@ -2872,27 +2882,36 @@ void Boss_Update(Boss* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (this->obj.status) {
|
switch (this->obj.status) {
|
||||||
case OBJ_INIT:
|
case OBJ_INIT: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectInitEvent, OBJECT_TYPE_BOSS, this) {
|
||||||
this->obj.status = OBJ_ACTIVE;
|
this->obj.status = OBJ_ACTIVE;
|
||||||
Object_Init(this->index, this->obj.id);
|
Object_Init(this->index, this->obj.id);
|
||||||
Boss_Move(this);
|
Boss_Move(this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_ACTIVE:
|
case OBJ_ACTIVE: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectUpdateEvent, OBJECT_TYPE_BOSS, this) {
|
||||||
Boss_Move(this);
|
Boss_Move(this);
|
||||||
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
||||||
this->info.action(&this->obj);
|
this->info.action(&this->obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_DYING:
|
case OBJ_DYING: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectDestroyEvent, OBJECT_TYPE_BOSS, this) {
|
||||||
Boss_Move(this);
|
Boss_Move(this);
|
||||||
if (this->obj.status != OBJ_FREE) {
|
if (this->obj.status != OBJ_FREE) {
|
||||||
Object_Dying(this->index, this->obj.id);
|
Object_Dying(this->index, this->obj.id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Scenery_Update(Scenery* this) {
|
void Scenery_Update(Scenery* this) {
|
||||||
if (this->timer_4C != 0) {
|
if (this->timer_4C != 0) {
|
||||||
@ -2900,42 +2919,56 @@ void Scenery_Update(Scenery* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (this->obj.status) {
|
switch (this->obj.status) {
|
||||||
case OBJ_INIT:
|
case OBJ_INIT: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectInitEvent, OBJECT_TYPE_SCENERY, this) {
|
||||||
this->obj.status = OBJ_ACTIVE;
|
this->obj.status = OBJ_ACTIVE;
|
||||||
Object_Init(this->index, this->obj.id);
|
Object_Init(this->index, this->obj.id);
|
||||||
Scenery_Move(this);
|
Scenery_Move(this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_ACTIVE:
|
case OBJ_ACTIVE: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectUpdateEvent, OBJECT_TYPE_SCENERY, this) {
|
||||||
Scenery_Move(this);
|
Scenery_Move(this);
|
||||||
if (this->info.action != NULL) {
|
if (this->info.action != NULL) {
|
||||||
this->info.action(&this->obj);
|
this->info.action(&this->obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Sprite_Update(Sprite* this) {
|
void Sprite_Update(Sprite* this) {
|
||||||
switch (this->obj.status) {
|
switch (this->obj.status) {
|
||||||
case OBJ_INIT:
|
case OBJ_INIT: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectInitEvent, OBJECT_TYPE_SPRITE, this) {
|
||||||
this->obj.status = OBJ_ACTIVE;
|
this->obj.status = OBJ_ACTIVE;
|
||||||
Object_Init(this->index, this->obj.id);
|
Object_Init(this->index, this->obj.id);
|
||||||
Sprite_Move(this);
|
Sprite_Move(this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case OBJ_ACTIVE:
|
case OBJ_ACTIVE: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectUpdateEvent, OBJECT_TYPE_SPRITE, this) {
|
||||||
Sprite_Move(this);
|
Sprite_Move(this);
|
||||||
if (this->info.action != NULL) {
|
if (this->info.action != NULL) {
|
||||||
this->info.action(&this->obj);
|
this->info.action(&this->obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_DYING:
|
case OBJ_DYING: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectDestroyEvent, OBJECT_TYPE_SPRITE, this) {
|
||||||
Sprite_Move(this);
|
Sprite_Move(this);
|
||||||
Object_Dying(this->index, this->obj.id);
|
Object_Dying(this->index, this->obj.id);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Item_Update(Item* this) {
|
void Item_Update(Item* this) {
|
||||||
if (this->timer_48 != 0) {
|
if (this->timer_48 != 0) {
|
||||||
@ -2946,20 +2979,26 @@ void Item_Update(Item* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (this->obj.status) {
|
switch (this->obj.status) {
|
||||||
case OBJ_INIT:
|
case OBJ_INIT: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectInitEvent, OBJECT_TYPE_ITEM, this) {
|
||||||
this->obj.status = OBJ_ACTIVE;
|
this->obj.status = OBJ_ACTIVE;
|
||||||
Object_Init(this->index, this->obj.id);
|
Object_Init(this->index, this->obj.id);
|
||||||
Item_Move(this);
|
Item_Move(this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OBJ_ACTIVE:
|
case OBJ_ACTIVE: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectUpdateEvent, OBJECT_TYPE_ITEM, this) {
|
||||||
Item_Move(this);
|
Item_Move(this);
|
||||||
if (this->info.action != NULL) {
|
if (this->info.action != NULL) {
|
||||||
this->info.action(&this->obj);
|
this->info.action(&this->obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Effect_Update(Effect* this) {
|
void Effect_Update(Effect* this) {
|
||||||
if (this->timer_50 != 0) {
|
if (this->timer_50 != 0) {
|
||||||
@ -2967,18 +3006,25 @@ void Effect_Update(Effect* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (this->obj.status) {
|
switch (this->obj.status) {
|
||||||
case OBJ_INIT:
|
case OBJ_INIT: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectInitEvent, OBJECT_TYPE_EFFECT, this) {
|
||||||
this->obj.status = OBJ_ACTIVE;
|
this->obj.status = OBJ_ACTIVE;
|
||||||
Object_Init(this->index, this->obj.id);
|
Object_Init(this->index, this->obj.id);
|
||||||
|
Effect_Move(this);
|
||||||
|
}
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case OBJ_ACTIVE:
|
}
|
||||||
|
case OBJ_ACTIVE: {
|
||||||
|
CALL_CANCELLABLE_EVENT(ObjectUpdateEvent, OBJECT_TYPE_EFFECT, this) {
|
||||||
Effect_Move(this);
|
Effect_Move(this);
|
||||||
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
||||||
this->info.action(&this->obj);
|
this->info.action(&this->obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TexturedLine_Update(TexturedLine* this) {
|
void TexturedLine_Update(TexturedLine* this) {
|
||||||
Vec3f sp44;
|
Vec3f sp44;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "list/EngineEvent.h"
|
#include "list/EngineEvent.h"
|
||||||
|
#include "list/ActorEvent.h"
|
||||||
#include "list/ItemEvent.h"
|
#include "list/ItemEvent.h"
|
34
src/port/hooks/list/ActorEvent.h
Normal file
34
src/port/hooks/list/ActorEvent.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "gfx.h"
|
||||||
|
#include "sf64object.h"
|
||||||
|
#include "port/hooks/impl/EventSystem.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
OBJECT_TYPE_ACTOR,
|
||||||
|
OBJECT_TYPE_BOSS,
|
||||||
|
OBJECT_TYPE_SCENERY,
|
||||||
|
OBJECT_TYPE_SPRITE,
|
||||||
|
OBJECT_TYPE_ITEM,
|
||||||
|
OBJECT_TYPE_EFFECT,
|
||||||
|
} ObjectEventType;
|
||||||
|
|
||||||
|
DEFINE_EVENT(ObjectInitEvent,
|
||||||
|
ObjectEventType type;
|
||||||
|
void* object;
|
||||||
|
);
|
||||||
|
|
||||||
|
DEFINE_EVENT(ObjectUpdateEvent,
|
||||||
|
ObjectEventType type;
|
||||||
|
void* object;
|
||||||
|
);
|
||||||
|
|
||||||
|
DEFINE_EVENT(ObjectDrawEvent,
|
||||||
|
ObjectEventType type;
|
||||||
|
void* object;
|
||||||
|
);
|
||||||
|
|
||||||
|
DEFINE_EVENT(ObjectDestroyEvent,
|
||||||
|
ObjectEventType type;
|
||||||
|
void* object;
|
||||||
|
);
|
@ -158,7 +158,15 @@ void OnGameUpdatePost(IEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PortEnhancements_Init() {
|
void PortEnhancements_Init() {
|
||||||
|
PortEnhancements_Register();
|
||||||
|
|
||||||
// Register event listeners
|
// Register event listeners
|
||||||
|
REGISTER_LISTENER(DisplayPreUpdateEvent, OnDisplayUpdatePre, EVENT_PRIORITY_NORMAL);
|
||||||
|
REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PortEnhancements_Register() {
|
||||||
|
// Register engine events
|
||||||
REGISTER_EVENT(DisplayPreUpdateEvent);
|
REGISTER_EVENT(DisplayPreUpdateEvent);
|
||||||
REGISTER_EVENT(DisplayPostUpdateEvent);
|
REGISTER_EVENT(DisplayPostUpdateEvent);
|
||||||
|
|
||||||
@ -177,10 +185,14 @@ void PortEnhancements_Init() {
|
|||||||
REGISTER_EVENT(DrawGlobalHUDPreEvent);
|
REGISTER_EVENT(DrawGlobalHUDPreEvent);
|
||||||
REGISTER_EVENT(DrawGlobalHUDPostEvent);
|
REGISTER_EVENT(DrawGlobalHUDPostEvent);
|
||||||
|
|
||||||
|
// Register item events
|
||||||
REGISTER_EVENT(ItemDropEvent);
|
REGISTER_EVENT(ItemDropEvent);
|
||||||
|
|
||||||
REGISTER_LISTENER(DisplayPreUpdateEvent, OnDisplayUpdatePre, EVENT_PRIORITY_NORMAL);
|
// Register actor events
|
||||||
REGISTER_LISTENER(GamePostUpdateEvent, OnGameUpdatePost, EVENT_PRIORITY_NORMAL);
|
REGISTER_EVENT(ObjectInitEvent);
|
||||||
|
REGISTER_EVENT(ObjectUpdateEvent);
|
||||||
|
REGISTER_EVENT(ObjectDrawEvent);
|
||||||
|
REGISTER_EVENT(ObjectDestroyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortEnhancements_Exit() {
|
void PortEnhancements_Exit() {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void PortEnhancements_Register();
|
||||||
void PortEnhancements_Init();
|
void PortEnhancements_Init();
|
||||||
void PortEnhancements_Exit();
|
void PortEnhancements_Exit();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user