More dedupes (#1555)

This commit is contained in:
sozud 2024-08-20 16:02:21 -07:00 committed by GitHub
parent 3cf5c09682
commit 88024b24ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 307 additions and 1835 deletions

View File

@ -5,6 +5,7 @@ unk14_yVel = 0x80181148;
unk14_startFrame = 0x80181160;
unk14_lifetime = 0x80181164;
g_olroxDroolCollOffsets = 0x8018116C;
g_UnkEntityAnimData = 0x80181174;
g_UnkRecursPrimVecOrder = 0x80181184;
g_UnkRecursPrim2Inds = 0x801811A4;
g_ESoulStealOrbAngles = 0x801811C8;

View File

@ -23,6 +23,7 @@ unk14_yVel = 0x8018130C;
unk14_startFrame = 0x80181324;
unk14_lifetime = 0x80181328;
g_olroxDroolCollOffsets = 0x80181330;
g_UnkEntityAnimData = 0x80181338;
g_UnkRecursPrimVecOrder = 0x80181348;
g_UnkRecursPrim2Inds = 0x80181368;
g_ESoulStealOrbAngles = 0x8018138C;

View File

@ -23,6 +23,7 @@ unk14_yVel = 0x80182650;
unk14_startFrame = 0x80182668;
unk14_lifetime = 0x8018266C;
g_olroxDroolCollOffsets = 0x80182674;
g_UnkEntityAnimData = 0x8018267C;
g_UnkRecursPrimVecOrder = 0x8018268C;
g_UnkRecursPrim2Inds = 0x801826AC;
g_ESoulStealOrbAngles = 0x801826D0;

View File

@ -8,6 +8,7 @@ unk14_yVel = 0x80181FDC;
unk14_startFrame = 0x80181FF4;
unk14_lifetime = 0x80181FF8;
g_olroxDroolCollOffsets = 0x80182000;
g_UnkEntityAnimData = 0x80182008;
g_UnkRecursPrimVecOrder = 0x80182018;
g_UnkRecursPrim2Inds = 0x80182038;
g_ESoulStealOrbAngles = 0x8018205C;

View File

@ -10,6 +10,7 @@ unk14_yVel = 0x80181F04;
unk14_startFrame = 0x80181F1C;
unk14_lifetime = 0x80181F20;
g_olroxDroolCollOffsets = 0x80181F28;
g_UnkEntityAnimData = 0x80181F30;
g_UnkRecursPrimVecOrder = 0x80181F40;
g_UnkRecursPrim2Inds = 0x80181F60;
g_eBlueDoorUV = 0x801826B8;

View File

@ -20,6 +20,7 @@ unk14_yVel = 0x80181ED8;
unk14_startFrame = 0x80181EF0;
unk14_lifetime = 0x80181EF4;
g_olroxDroolCollOffsets = 0x80181EFC;
g_UnkEntityAnimData = 0x80181F04;
g_UnkRecursPrimVecOrder = 0x80181F14;
g_UnkRecursPrim2Inds = 0x80181F34;
g_ESoulStealOrbAngles = 0x80181F54;

View File

@ -14,270 +14,18 @@
#include "../entity_olrox_drool.h"
bool func_801988B0(Point16* unk) {
Collider collider;
#include "../unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_801989AC(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "../unk_collision_func4.h"
// ID 06
#include "../entity_intense_explosion.h"
extern u8 D_80181174[];
#include "../initialize_unk_entity.h"
void func_8019902C(Entity* entity) {
if (!entity->step) {
InitializeEntity(g_InitializeEntityData0);
entity->unk6C = 0xF0;
entity->rotX = 0x1A0;
entity->rotY = 0x1A0;
entity->animSet = ANIMSET_DRA(8);
entity->animCurFrame = 1;
entity->zPriority += 0x10;
#include "../make_entity_from_id.h"
if (entity->params != 0) {
entity->palette = entity->params;
} else {
entity->palette = 0x8160;
}
entity->step++;
return;
}
MoveEntity();
if (!AnimateEntity(D_80181174, entity)) {
DestroyEntity(entity);
}
}
void func_801990F8(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_801991C0(void) {
Entity* entity;
s8 temp_s4 = Random() & 3;
s16 temp_s3 = ((Random() & 0xF) << 8) - 0x800;
s32 i;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(2, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -14,271 +14,17 @@
#include "../entity_olrox_drool.h"
bool func_8019E9F4(Point16* arg0) {
Collider collider;
#include "../unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += arg0->x;
posY += arg0->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_8019EAF0(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "../unk_collision_func4.h"
#include "../entity_intense_explosion.h"
void func_8019F170(Entity* entity) {
if (!entity->step) {
InitializeEntity(g_InitializeEntityData0);
entity->unk6C = 0xF0;
entity->rotX = 0x1A0;
entity->rotY = 0x1A0;
entity->animSet = ANIMSET_DRA(8);
entity->animCurFrame = 1;
entity->zPriority += 0x10;
#include "../initialize_unk_entity.h"
if (entity->params != 0) {
entity->palette = entity->params;
} else {
entity->palette = 0x8160;
}
#include "../make_entity_from_id.h"
entity->step++;
return;
}
MoveEntity();
if (!AnimateEntity(D_80181338, entity)) {
DestroyEntity(entity);
}
}
void func_8019F23C(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_8019F304(void) {
Entity* entity;
s8 temp_s4 = Random() & 3;
s16 temp_s3 = ((Random() & 0xF) << 8) - 0x800;
s32 i;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(2, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -117,272 +117,21 @@ u32 g_olroxDroolCollOffsets[] = {
};
#include "entity_olrox_drool.h"
bool func_8018FC4C(Point16* unk) {
Collider collider;
#include "unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_8018FD48(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "unk_collision_func4.h"
#include "entity_intense_explosion.h"
u8 D_8018104C[] = {
u8 g_UnkEntityAnimData[] = {
2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 4, 6, -1,
};
void func_801903C8(Entity* self) {
if (!self->step) {
InitializeEntity(g_InitializeEntityData0);
self->unk6C = 0xF0;
self->rotX = 0x01A0;
self->rotY = 0x01A0;
self->animSet = ANIMSET_DRA(8);
self->animCurFrame = 1;
self->zPriority += 16;
if (self->params) {
self->palette = self->params;
} else {
self->palette = PAL_OVL(0x160);
}
#include "initialize_unk_entity.h"
self->step++;
} else {
MoveEntity();
if (!AnimateEntity(D_8018104C, self)) {
DestroyEntity(self);
}
}
}
#include "make_entity_from_id.h"
extern PfnEntityUpdate PfnEntityUpdates[];
void func_80190494(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & PAL_OVL_FLAG) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_8019055C(void) {
s32 temp_s3;
s8 temp_s4;
Entity* entity;
s32 i;
temp_s4 = Random() & 3;
temp_s3 = ((Random() & 0xF) << 8) - 0x800;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(E_EXPLOSION, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "make_explosions.h"
extern u8 g_bigRedFireballAnim[];
u16 g_UnkRecursPrimVecOrder[] = {

View File

@ -0,0 +1,25 @@
extern u8 g_UnkEntityAnimData[];
void InitializeUnkEntity(Entity* self) {
if (!self->step) {
InitializeEntity(g_InitializeEntityData0);
self->unk6C = 0xF0;
self->rotX = 0x01A0;
self->rotY = 0x01A0;
self->animSet = ANIMSET_DRA(8);
self->animCurFrame = 1;
self->zPriority += 16;
if (self->params) {
self->palette = self->params;
} else {
self->palette = PAL_OVL(0x160);
}
self->step++;
} else {
MoveEntity();
if (!AnimateEntity(g_UnkEntityAnimData, self)) {
DestroyEntity(self);
}
}
}

View File

@ -312,45 +312,9 @@ void func_801966B0(u16* sensors) {
}
}
void func_8019686C(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
#include "../make_entity_from_id.h"
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_80196934(void) {
Entity* entity;
s16 temp_s3;
s32 i;
u8 temp_s4;
temp_s4 = Random() & 3;
temp_s3 = ((Random() & 0xF) << 8) - 0x800;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(2, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -0,0 +1,20 @@
extern PfnEntityUpdate PfnEntityUpdates[];
void MakeEntityFromId(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & PAL_OVL_FLAG) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}

19
src/st/make_explosions.h Normal file
View File

@ -0,0 +1,19 @@
void MakeExplosions(void) {
s32 temp_s3;
s8 temp_s4;
Entity* entity;
s32 i;
temp_s4 = Random() & 3;
temp_s3 = ((Random() & 0xF) << 8) - 0x800;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(E_EXPLOSION, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}

View File

@ -14,264 +14,17 @@
#include "../entity_olrox_drool.h"
bool func_801C92B0(Point16* unk) {
Collider collider;
#include "../unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_801C93AC(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "../unk_collision_func4.h"
#include "../entity_intense_explosion.h"
void func_801903C8(Entity* entity) {
if (entity->step == 0) {
InitializeEntity(g_InitializeEntityData0);
entity->unk6C = 0xF0;
entity->rotX = 0x01A0;
entity->rotY = 0x01A0;
entity->animSet = ANIMSET_DRA(8);
entity->animCurFrame = 1;
entity->zPriority += 16;
if (entity->params) {
entity->palette = entity->params;
} else {
entity->palette = 0x8160;
}
#include "../initialize_unk_entity.h"
entity->step++;
} else {
MoveEntity();
if (!AnimateEntity(D_8018267C, entity)) {
DestroyEntity(entity);
}
}
}
#include "../make_entity_from_id.h"
void func_801C9AF8(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_801C9BC0(void) {
Entity* entity;
s8 temp_s4 = Random() & 3;
s16 temp_s3 = ((Random() & 0xF) << 8) - 0x800;
s32 i;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(2, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -289,7 +289,7 @@ void EntityMerman(Entity* self) {
if (collider.effects & EFFECT_SOLID) {
self->velocityX = 0;
}
func_801C92B0(&D_80183A5C);
UnkCollisionFunc5(&D_80183A5C);
if (self->facingLeft != 0) {
self->velocityX -= FIX(0.03125);
} else {

View File

@ -280,7 +280,7 @@ void EntityMerman(Entity* self) {
if (collider.effects & EFFECT_SOLID) {
self->velocityX = 0;
}
func_8018FC4C(&D_8018236C);
UnkCollisionFunc5(&D_8018236C);
if (self->facingLeft != 0) {
self->velocityX -= FIX(0.03125);
} else {

View File

@ -53,268 +53,17 @@ void EntityHeartDrop(Entity* self) {
#include "../entity_olrox_drool.h"
bool func_8018FC4C(Point16* unk) {
Collider collider;
#include "../unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_8018FD48(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "../unk_collision_func4.h"
#include "../entity_intense_explosion.h"
void func_801903C8(Entity* entity) {
if (entity->step == 0) {
InitializeEntity(g_InitializeEntityData0);
entity->unk6C = 0xF0;
entity->rotX = 0x1A0;
entity->rotY = 0x1A0;
entity->animSet = ANIMSET_DRA(8);
entity->animCurFrame = 1;
entity->zPriority += 0x10;
#include "../initialize_unk_entity.h"
if (entity->params != 0) {
entity->palette = entity->params;
} else {
entity->palette = 0x8160;
}
#include "../make_entity_from_id.h"
entity->step++;
} else {
MoveEntity();
if (!AnimateEntity(D_80182008, entity)) {
DestroyEntity(entity);
}
}
}
void func_80190494(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_8019055C(void) {
s32 temp_s3;
s8 temp_s4;
Entity* entity;
s32 i;
temp_s4 = Random() & 3;
temp_s3 = ((Random() & 0xF) << 8) - 0x800;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(E_EXPLOSION, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -14,268 +14,17 @@
#include "../entity_olrox_drool.h"
bool func_801C0F38(Point16* unk) {
Collider collider;
#include "../unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_801C1034(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "../unk_collision_func4.h"
#include "../entity_intense_explosion.h"
void func_801C16B4(Entity* entity) {
if (entity->step == 0) {
InitializeEntity(g_InitializeEntityData0);
entity->unk6C = 0xF0;
entity->rotX = 0x1A0;
entity->rotY = 0x1A0;
entity->animSet = ANIMSET_DRA(8);
entity->animCurFrame = 1;
entity->zPriority += 0x10;
#include "../initialize_unk_entity.h"
if (entity->params != 0) {
entity->palette = entity->params;
} else {
entity->palette = 0x8160;
}
#include "../make_entity_from_id.h"
entity->step++;
} else {
MoveEntity();
if (!AnimateEntity(D_80181F30, entity)) {
DestroyEntity(entity);
}
}
}
void func_801C1780(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_8019055C(void) {
s32 temp_s3;
s8 temp_s4;
Entity* entity;
s32 i;
temp_s4 = Random() & 3;
temp_s3 = ((Random() & 0xF) << 8) - 0x800;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(E_EXPLOSION, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -46,7 +46,7 @@ void EntitySpittleBone(Entity* self) {
case 2:
AnimateEntity(D_80182524, self);
self->ext.spittleBone.unk7C =
func_801C1034(self->ext.spittleBone.unk7C);
UnkCollisionFunc4(self->ext.spittleBone.unk7C);
if (self->ext.spittleBone.unk82 != 0) {
self->rotZ += self->ext.spittleBone.unk80;
self->ext.spittleBone.unk82--;
@ -71,7 +71,7 @@ void EntitySpittleBone(Entity* self) {
for (i = 0; i < 6; i++) {
newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (newEntity != NULL) {
func_801C1780(E_SPITTLEBONE, self, newEntity);
MakeEntityFromId(E_SPITTLEBONE, self, newEntity);
newEntity->facingLeft = self->facingLeft;
newEntity->flags = FLAG_UNK_2000 | FLAG_UNK_08000000 |
FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
@ -131,7 +131,7 @@ void EntityRotateSpittlebone(Entity* self) {
case 1:
temp1 = self->ext.spittleBone.unk7C & 0x3F;
prevEntity = &self[-1];
temp4 = func_801C1034(self->ext.spittleBone.unk7C);
temp4 = UnkCollisionFunc4(self->ext.spittleBone.unk7C);
self->ext.spittleBone.unk7C = temp4;
if ((temp4 & 0x3F) != temp1) {
temp2 = temp4 & 0x3C;

View File

@ -18,267 +18,17 @@ INCLUDE_ASM("st/st0/nonmatchings/37308", func_801B7308);
#include "../entity_olrox_drool.h"
bool func_801B8338(Point16* unk) {
Collider collider;
#include "../unk_collision_func5.h"
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}
u8 func_801B8434(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}
#include "../unk_collision_func4.h"
#include "../entity_intense_explosion.h"
void func_801B8AB4(Entity* entity) {
if (entity->step == 0) {
InitializeEntity(g_InitializeEntityData0);
entity->unk6C = 0xF0;
entity->rotX = 0x01A0;
entity->rotY = 0x01A0;
entity->animSet = ANIMSET_DRA(8);
entity->animCurFrame = 1;
entity->zPriority += 16;
if (entity->params) {
entity->palette = entity->params;
} else {
entity->palette = 0x8160;
}
#include "../initialize_unk_entity.h"
entity->step++;
} else {
MoveEntity();
if (!AnimateEntity(D_80181F04, entity)) {
DestroyEntity(entity);
}
}
}
#include "../make_entity_from_id.h"
void func_801B8B80(u16 entityId, Entity* src, Entity* dst) {
DestroyEntity(dst);
dst->entityId = entityId;
dst->pfnUpdate = PfnEntityUpdates[entityId - 1];
dst->posX.i.hi = src->posX.i.hi;
dst->posY.i.hi = src->posY.i.hi;
dst->unk5A = src->unk5A;
dst->zPriority = src->zPriority;
dst->animSet = src->animSet;
dst->flags = FLAG_UNK_2000 | FLAG_UNK_01000000 | FLAG_UNK_04000000 |
FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA |
FLAG_DESTROY_IF_OUT_OF_CAMERA;
if (src->palette & 0x8000) {
dst->palette = src->hitEffect;
} else {
dst->palette = src->palette;
}
}
void func_801B8C48(void) {
s32 temp_s3;
s8 temp_s4;
Entity* entity;
s32 i;
temp_s4 = Random() & 3;
temp_s3 = ((Random() & 0xF) << 8) - 0x800;
for (i = 0; i < 6; i++) {
entity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (entity != NULL) {
CreateEntityFromEntity(E_EXPLOSION, g_CurrentEntity, entity);
entity->ext.generic.unk84.U8.unk1 = 6 - i;
entity->ext.generic.unk80.modeS16.unk0 = temp_s3;
entity->ext.generic.unk84.U8.unk0 = temp_s4;
}
}
}
#include "../make_explosions.h"
#include "../entity_big_red_fireball.h"

View File

@ -0,0 +1,171 @@
u8 UnkCollisionFunc4(s32 arg0) {
Collider collider;
u32 bits_67;
u32 bits_45;
u32 bits_23;
u8 bits_01;
u16 collEff;
MoveEntity();
bits_67 = 0;
bits_23 = 0;
bits_45 = 0;
bits_01 = arg0 & 3;
collEff = 0;
switch (bits_01) {
case 0:
g_CurrentEntity->posY.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk18;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi - 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 1:
g_CurrentEntity->posY.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posY.i.hi += collider.unk20;
g_api.CheckCollision(
g_CurrentEntity->posX.i.hi,
(s16)(g_CurrentEntity->posY.i.hi + 4), &collider, 0);
if (collider.effects & EFFECT_UNK_0002) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 2;
} else {
bits_01 = 3;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posX.val -= g_CurrentEntity->velocityX;
if (g_CurrentEntity->velocityX > 0) {
bits_01 = 3;
} else {
bits_01 = 2;
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityX;
}
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityX;
g_CurrentEntity->velocityX = 0;
}
break;
case 2:
g_CurrentEntity->posX.i.hi += 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk14;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi - 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
break;
case 3:
g_CurrentEntity->posX.i.hi -= 3;
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects != 0) {
collEff = collider.effects;
g_CurrentEntity->posX.i.hi += collider.unk1C;
g_api.CheckCollision((s16)(g_CurrentEntity->posX.i.hi + 4),
g_CurrentEntity->posY.i.hi, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
bits_67 = 0x40;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 0;
} else {
bits_01 = 1;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
} else {
bits_67 = 0x80;
g_CurrentEntity->posY.val -= g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY > 0) {
bits_01 = 1;
} else {
bits_01 = 0;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY;
}
g_CurrentEntity->velocityX = -g_CurrentEntity->velocityY;
g_CurrentEntity->velocityY = 0;
}
}
if (collEff & EFFECT_UNK_8000) {
bits_23 = 4;
}
if (collEff & EFFECT_UNK_1000) {
bits_23 = 8;
}
if (collEff & EFFECT_UNK_2000) {
bits_23 = 0xC;
}
if (collEff & EFFECT_UNK_0800) {
bits_45 = 0x20;
}
if (collEff & EFFECT_UNK_4000) {
bits_45 = 0x10;
}
bits_01 = (bits_45 + (bits_23 + (bits_67 + bits_01)));
return bits_01;
}

View File

@ -0,0 +1,23 @@
bool UnkCollisionFunc5(Point16* unk) {
Collider collider;
FallEntity();
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
if (g_CurrentEntity->velocityY >= 0) {
s16 posX = g_CurrentEntity->posX.i.hi;
s16 posY = g_CurrentEntity->posY.i.hi;
posX += unk->x;
posY += unk->y;
g_api.CheckCollision(posX, posY, &collider, 0);
if (collider.effects & EFFECT_SOLID) {
g_CurrentEntity->posY.i.hi += collider.unk18;
g_CurrentEntity->velocityY = -g_CurrentEntity->velocityY / 2;
if (g_CurrentEntity->velocityY > FIX(-1.0)) {
return true;
}
}
}
return false;
}