mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 13:09:44 +00:00
EntityRelicOrb duplicates (#529)
As I finished importing the data in WRP, I came with a possible new pattern when de-duplicating functions. I kept using a header file (easily indexable from VS Code) in `src/st`. But this time it gets included by `entity_relic_orb.c`. All the sections `.data`, `.rodata` and `.text` are migrated into `entity_relic_orb.c` but the file itself just includes `src/st/entity_relic_orb.h`. Thinking forward, once we will be able to fix the problem present in #464 it will just be a matter of renaming `entity_relic_orb.h` into `entity_relic_orb.c` and remove each individual `entity_relic_orb.c` that currently acts as a proxy. ~~This PR is a draft. If you agree this is a good pattern I will proceed to do the same with the remaining overlays after #528 is good to be merged.~~
This commit is contained in:
parent
4bd8ada889
commit
4adf1da469
@ -28,14 +28,20 @@ segments:
|
||||
subalign: 2
|
||||
subsegments:
|
||||
- [0x0, data]
|
||||
- [0x10AC, .data, entity_relic_orb]
|
||||
- [0x1110, data]
|
||||
- [0x12D4, roomdef, g_Rooms]
|
||||
- [0x1300, data]
|
||||
- [0xD42C, rodata]
|
||||
- [0xD4B0, .rodata, D600]
|
||||
- [0xD4D8, rodata]
|
||||
- [0xD578, .rodata, entity_relic_orb]
|
||||
- [0xD5B0, rodata]
|
||||
- [0xD600, c]
|
||||
- [0x10E4C, c]
|
||||
- [0x11280, c]
|
||||
- [0x16F30, c, entity_relic_orb]
|
||||
- [0x17A00, c]
|
||||
- [0x1B274, c]
|
||||
- [0x1C704, rodata]
|
||||
- [0x1C764, rodata]
|
||||
|
@ -27,17 +27,19 @@ segments:
|
||||
vram: 0x80180000
|
||||
subalign: 4
|
||||
subsegments:
|
||||
- [0x0, rodata]
|
||||
- [0x590, rodata]
|
||||
- [0x610, rodata]
|
||||
- [0x630, rodata]
|
||||
- [0x640, rodata]
|
||||
- [0x650, rodata]
|
||||
- [0x660, rodata]
|
||||
- [0x770, rodata]
|
||||
- [0x0, data]
|
||||
- [0x590, data]
|
||||
- [0x610, data]
|
||||
- [0x630, data]
|
||||
- [0x640, data]
|
||||
- [0x650, data]
|
||||
- [0x660, data]
|
||||
- [0x770, data]
|
||||
- [0x1270, .data, entity_relic_orb]
|
||||
- [0x12D4, data]
|
||||
- [0x1498, roomdef, g_Rooms]
|
||||
- [0x14AC, rodata]
|
||||
- [0x16C0, rodata]
|
||||
- [0x14AC, data]
|
||||
- [0x16C0, data]
|
||||
- [0x1171C, .rodata, 11A64]
|
||||
- [0x11728, .rodata, succubus] # EntitySuccubus
|
||||
- [0x117F0, .rodata, 13B3C]
|
||||
@ -47,14 +49,17 @@ segments:
|
||||
- [0x11910, .rodata, 1697C] # EntityFadeToWhite
|
||||
- [0x1193C, rodata]
|
||||
- [0x119C4, .rodata, 1C7DC]
|
||||
- [0x119DC, rodata]
|
||||
- [0x11A64, c, 11A64]
|
||||
- [0x119DC, .rodata, entity_relic_orb]
|
||||
- [0x11A14, rodata]
|
||||
- [0x11A64, c]
|
||||
- [0x11A64, c, succubus]
|
||||
- [0x13B3C, c, 13B3C]
|
||||
- [0x14774, c, 14774]
|
||||
- [0x1697C, c, 1697C]
|
||||
- [0x13B3C, c]
|
||||
- [0x14774, c]
|
||||
- [0x1697C, c]
|
||||
- [0x16F90, c]
|
||||
- [0x173C4, c]
|
||||
- [0x1C7DC, c, 1C7DC]
|
||||
- [0x23260, data]
|
||||
- [0x1C7DC, c]
|
||||
- [0x1D074, c, entity_relic_orb]
|
||||
- [0x1DC6C, c]
|
||||
- [0x23260, sbss]
|
||||
- [0x23FCC]
|
||||
|
@ -27,28 +27,29 @@ segments:
|
||||
vram: 0x80180000
|
||||
subalign: 4
|
||||
subsegments:
|
||||
- [0x0, rodata]
|
||||
- [0x920, rodata]
|
||||
- [0xAAC, rodata]
|
||||
- [0xDC0, rodata]
|
||||
- [0xDD0, rodata]
|
||||
- [0xE50, rodata]
|
||||
- [0xE70, rodata]
|
||||
- [0xE80, rodata]
|
||||
- [0xE90, rodata]
|
||||
- [0xEA0, rodata]
|
||||
- [0x11F0, rodata]
|
||||
- [0x1B40, rodata]
|
||||
- [0x26D0, rodata]
|
||||
- [0x3180, rodata]
|
||||
- [0x39A0, rodata]
|
||||
- [0x3AC0, rodata]
|
||||
- [0x3AF0, rodata]
|
||||
- [0x3B30, rodata]
|
||||
- [0x0, data]
|
||||
- [0x920, data]
|
||||
- [0xAAC, data]
|
||||
- [0xDC0, data]
|
||||
- [0xDD0, data]
|
||||
- [0xE50, data]
|
||||
- [0xE70, data]
|
||||
- [0xE80, data]
|
||||
- [0xE90, data]
|
||||
- [0xEA0, data]
|
||||
- [0x11F0, data]
|
||||
- [0x1B40, data]
|
||||
- [0x25B4, .data, entity_relic_orb]
|
||||
- [0x2618, data]
|
||||
- [0x3180, data]
|
||||
- [0x39A0, data]
|
||||
- [0x3AC0, data]
|
||||
- [0x3AF0, data]
|
||||
- [0x3B30, data]
|
||||
- [0x3CC4, roomdef, g_Rooms]
|
||||
- [0x3DC8, rodata]
|
||||
- [0x4CE0, rodata]
|
||||
- [0x373E0, rodata]
|
||||
- [0x3DC8, data]
|
||||
- [0x4CE0, data]
|
||||
- [0x373E0, data]
|
||||
- [0x373E8, .rodata, 377D4] # EntityCastleDoor
|
||||
- [0x37400, .rodata, 377D4] # EntityStairwayPiece
|
||||
- [0x37414, .rodata, 3C4EC]
|
||||
@ -62,8 +63,8 @@ segments:
|
||||
- [0x37578, rodata]
|
||||
- [0x375E0, .rodata, 46684] # EntityPrizeDrop
|
||||
- [0x37600, .rodata, 46684] # EntityEquipItemDrop
|
||||
- [0x37618, rodata]
|
||||
- [0x37628, rodata]
|
||||
- [0x37618, .rodata, entity_relic_orb]
|
||||
- [0x37650, rodata]
|
||||
- [0x376E8, rodata]
|
||||
- [0x377A4, .rodata, 56264] # EntityBat
|
||||
- [0x377B8, .rodata, 564B0] # EntityZombie
|
||||
@ -74,7 +75,9 @@ segments:
|
||||
- [0x4184C, c]
|
||||
- [0x41C80, c]
|
||||
- [0x46684, c]
|
||||
- [0x47930, c, entity_relic_orb]
|
||||
- [0x48400, c]
|
||||
- [0x56264, c]
|
||||
- [0x564B0, c]
|
||||
- [0x570B0, data]
|
||||
- [0x570B0, sbss]
|
||||
- [0x57E18]
|
||||
|
@ -27,37 +27,39 @@ segments:
|
||||
vram: 0x80180000
|
||||
subalign: 4
|
||||
subsegments:
|
||||
- [0x0, rodata]
|
||||
- [0xE50, rodata]
|
||||
- [0x10C0, rodata]
|
||||
- [0x1300, rodata]
|
||||
- [0x1520, rodata]
|
||||
- [0x22B0, rodata]
|
||||
- [0x23D0, rodata]
|
||||
- [0x2400, rodata]
|
||||
- [0x2440, rodata]
|
||||
- [0x2720, rodata]
|
||||
- [0x2740, rodata]
|
||||
- [0x2A20, rodata]
|
||||
- [0x2B00, rodata]
|
||||
- [0x3010, rodata]
|
||||
- [0x33A0, rodata]
|
||||
- [0x3530, rodata]
|
||||
- [0x3570, rodata]
|
||||
- [0x3580, rodata]
|
||||
- [0x3720, rodata]
|
||||
- [0x3760, rodata]
|
||||
- [0x0, data]
|
||||
- [0xE50, data]
|
||||
- [0x10C0, data]
|
||||
- [0x1300, data]
|
||||
- [0x1520, data]
|
||||
- [0x1F40, .data, entity_relic_orb]
|
||||
- [0x1FA4, data]
|
||||
- [0x22B0, data]
|
||||
- [0x23D0, data]
|
||||
- [0x2400, data]
|
||||
- [0x2440, data]
|
||||
- [0x2720, data]
|
||||
- [0x2740, data]
|
||||
- [0x2A20, data]
|
||||
- [0x2B00, data]
|
||||
- [0x3010, data]
|
||||
- [0x33A0, data]
|
||||
- [0x3530, data]
|
||||
- [0x3570, data]
|
||||
- [0x3580, data]
|
||||
- [0x3720, data]
|
||||
- [0x3760, data]
|
||||
- [0x3A7C, roomdef, g_Rooms]
|
||||
- [0x3B68, rodata]
|
||||
- [0x31EA0, rodata]
|
||||
- [0x3B68, data]
|
||||
- [0x31EA0, data]
|
||||
- [0x31EA8, .rodata, 3246C] # EntityStairwayPiece
|
||||
- [0x31EBC, .rodata, 365FC] # func_801B65FC
|
||||
- [0x31ED0, .rodata, 36990] # EntitySlogra .rodata, 36990
|
||||
- [0x31EDC, rodata] # EntityGaibon .rodata, 36990
|
||||
- [0x31F00, rodata]
|
||||
- [0x31F68, .rodata, 3DEF4]
|
||||
- [0x31FA0, rodata]
|
||||
- [0x31FB0, rodata]
|
||||
- [0x31FA0, .rodata, entity_relic_orb]
|
||||
- [0x31FD8, rodata]
|
||||
- [0x3200C, rodata] # EntityStageNamePopup .rodata,
|
||||
- [0x32020, .rodata, 44DCC] # EntityMerman2
|
||||
- [0x32044, .rodata, 48238] # EntityMerman
|
||||
@ -78,6 +80,8 @@ segments:
|
||||
- [0x390BC, c]
|
||||
- [0x394F0, c]
|
||||
- [0x3DEF4, c]
|
||||
- [0x3F1A0, c, entity_relic_orb]
|
||||
- [0x3FC70, c]
|
||||
- [0x44DCC, c] # Merman Entities
|
||||
- [0x48238, c] # Merman Entities (2)
|
||||
- [0x490E8, c] # EntityBoneScimitar
|
||||
@ -86,5 +90,5 @@ segments:
|
||||
- [0x49F98, c] # EntityBloodyZombie
|
||||
- [0x4B018, c]
|
||||
- [0x4E69C, c]
|
||||
- [0x52768, data]
|
||||
- [0x52768, sbss]
|
||||
- [0x53434]
|
||||
|
@ -33,6 +33,8 @@ segments:
|
||||
- [0x47C, data]
|
||||
- [0x18C0, data]
|
||||
- [0x1DD0, data]
|
||||
- [0x1E68, .data, entity_relic_orb]
|
||||
- [0x1ECC, data]
|
||||
- [0x20A0, data]
|
||||
- [0x20B0, data]
|
||||
- [0x2220, data]
|
||||
@ -84,7 +86,8 @@ segments:
|
||||
- [0x3064C, rodata]
|
||||
- [0x30790, .rodata, 3E30C]
|
||||
- [0x307B0, .rodata, 3E30C]
|
||||
- [0x307C8, rodata]
|
||||
- [0x307C8, .rodata, entity_relic_orb]
|
||||
- [0x30800, rodata]
|
||||
- [0x30814, .rodata, 43708] # EntityBoneScimitar
|
||||
- [0x30834, .rodata, 43F9C] # EntityAxeKnight
|
||||
- [0x30858, .rodata, 44EAC] # EntityBloodyZombie
|
||||
@ -99,6 +102,8 @@ segments:
|
||||
- [0x394D4, c]
|
||||
- [0x39908, c]
|
||||
- [0x3E30C, c]
|
||||
- [0x3F5B8, c, entity_relic_orb]
|
||||
- [0x40088, c]
|
||||
- [0x43708, c] # EntityBoneScimitar
|
||||
- [0x43F9C, c] # EntityAxeKnight
|
||||
- [0x44EAC, c] # EntityBloodyZombie
|
||||
|
@ -27,17 +27,22 @@ segments:
|
||||
vram: 0x80180000
|
||||
subalign: 4
|
||||
subsegments:
|
||||
- [0x0, rodata]
|
||||
- [0x4E0, rodata]
|
||||
- [0x5E0, rodata]
|
||||
- [0x10A0, rodata]
|
||||
- [0x0, data]
|
||||
- [0x4E0, data]
|
||||
- [0x5E0, data]
|
||||
- [0xF84, .data, entity_relic_orb]
|
||||
- [0xFE8, data]
|
||||
- [0x10A0, data]
|
||||
- [0x11AC, roomdef, g_Rooms]
|
||||
- [0x1228, rodata]
|
||||
- [0x1228, data]
|
||||
- [0x8C88, rodata]
|
||||
- [0x8D78, rodata]
|
||||
- [0x8D68, .rodata, entity_relic_orb]
|
||||
- [0x8DA0, rodata]
|
||||
- [0x8DF0, c]
|
||||
- [0xA168, c]
|
||||
- [0xA59C, c]
|
||||
- [0x1024C, c, entity_relic_orb]
|
||||
- [0x10D1C, c]
|
||||
- [0x14590, c]
|
||||
- [0x15A20, data]
|
||||
- [0x15A20, sbss]
|
||||
- [0x166E8]
|
||||
|
@ -43,7 +43,9 @@ CollectGold = 0x80195974;
|
||||
CollectSubweapon = 0x80195A50;
|
||||
EntityPrizeDrop = 0x80195C84;
|
||||
EntityExplosion = 0x801964F8;
|
||||
BlinkItem = 0x801965F4;
|
||||
EntityEquipItemDrop = 0x80196698;
|
||||
BlitChar = 0x80196C80;
|
||||
EntityRelicOrb = 0x80196F30;
|
||||
EntityHeartDrop = 0x80197A00;
|
||||
EntityUnkId0E = 0x80197B28;
|
||||
|
@ -61,7 +61,9 @@ CollectLifeVessel = 0x8019BD50;
|
||||
DestroyCurrentEntity = 0x8019BDA0;
|
||||
EntityPrizeDrop = 0x8019BDC8;
|
||||
EntityExplosion = 0x8019C63C;
|
||||
BlinkItem = 0x8019C738;
|
||||
EntityEquipItemDrop = 0x8019C7DC;
|
||||
BlitChar = 0x8019CDC4;
|
||||
EntityRelicOrb = 0x8019D074;
|
||||
EntityHeartDrop = 0x8019DB44;
|
||||
EntityUnkId0E = 0x8019DC6C;
|
||||
|
@ -95,7 +95,9 @@ CollectLifeVessel = 0x801C660C;
|
||||
DestroyCurrentEntity = 0x801C665C;
|
||||
EntityPrizeDrop = 0x801C6684;
|
||||
EntityExplosion = 0x801C6EF8;
|
||||
BlinkItem = 0x801C6FF4;
|
||||
EntityEquipItemDrop = 0x801C7098;
|
||||
BlitChar = 0x801C7680;
|
||||
EntityRelicOrb = 0x801C7930;
|
||||
EntityHeartDrop = 0x801C8400;
|
||||
EntityUnkId0E = 0x801C8528;
|
||||
|
@ -74,7 +74,9 @@ CollectLifeVessel = 0x801BDE7C;
|
||||
DestroyCurrentEntity = 0x801BDECC;
|
||||
EntityPrizeDrop = 0x801BDEF4;
|
||||
EntityExplosion = 0x801BE768;
|
||||
BlinkItem = 0x801BE864;
|
||||
EntityEquipItemDrop = 0x801BE908;
|
||||
BlitChar = 0x801BEEF0;
|
||||
EntityRelicOrb = 0x801BF1A0;
|
||||
EntityHeartDrop = 0x801BFC70;
|
||||
EntityUnkId0E = 0x801BFD98;
|
||||
|
@ -108,7 +108,9 @@ CollectLifeVessel = 0x801BE294;
|
||||
DestroyCurrentEntity = 0x801BE2E4;
|
||||
EntityPrizeDrop = 0x801BE30C;
|
||||
EntityExplosion = 0x801BEB80;
|
||||
BlinkItem = 0x801BEC7C;
|
||||
EntityEquipItemDrop = 0x801BED20;
|
||||
BlitChar = 0x801BF308;
|
||||
EntityRelicOrb = 0x801BF5B8;
|
||||
EntityHeartDrop = 0x801C0088;
|
||||
EntityUnkId0E = 0x801C01B0;
|
||||
|
@ -31,7 +31,10 @@ CollectSubweapon = 0x8018ED6C;
|
||||
CollectLifeVessel = 0x8018EF28;
|
||||
DestroyCurrentEntity = 0x8018EF78;
|
||||
EntityPrizeDrop = 0x8018EFA0;
|
||||
BlinkItem = 0x8018F910;
|
||||
EntityEquipItemDrop = 0x8018F9B4;
|
||||
BlitChar = 0x8018FF9C;
|
||||
EntityRelicOrb = 0x8019024C;
|
||||
EntityIntenseExplosion = 0x80192248;
|
||||
ClutLerp = 0x8019344C;
|
||||
EntitySoulStealOrb = 0x80194590;
|
||||
|
@ -102,6 +102,7 @@ CollectLifeVessel = 0x8018CFA8;
|
||||
DestroyCurrentEntity = 0x8018CFF8;
|
||||
EntityPrizeDrop = 0x8018D020;
|
||||
EntityExplosion = 0x8018D894;
|
||||
BlinkItem = 0x8018D990;
|
||||
EntityEquipItemDrop = 0x8018DA34;
|
||||
BlitChar = 0x8018E01C;
|
||||
EntityRelicOrb = 0x8018E2CC;
|
||||
|
@ -835,403 +835,8 @@ INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityPrizeDrop);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityExplosion);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_801965F4);
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", BlinkItem);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityEquipItemDrop);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80196C80);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityRelicOrb);
|
||||
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 0xC0;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 0xC0;
|
||||
var_a0 = D_801805D8[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityUnkId0E);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80198084);
|
||||
|
||||
extern u16 D_80180440[];
|
||||
void EntityUnkId13(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180440);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80198284);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_801983B4);
|
||||
|
||||
// ID 14
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityExplosion14);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityUnkId15);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80198680);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_801988B0);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ID 06
|
||||
#include "../entity_intense_explosion.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_8019902C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_801990F8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_801991C0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80199278);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80199450);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80199A30);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8019A328(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8019A420(Primitive* prim) {
|
||||
u8 xPos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
switch (prim->p3) {
|
||||
case 0:
|
||||
if (prim->p1 < 0x80) {
|
||||
if (--prim->p1 == 0) {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
} else {
|
||||
if (++prim->p1 == 0) {
|
||||
prim->p3 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
u8* dst = prim->p3 == 1 ? &prim->r1 : &prim->r0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
dst[j] = 0x50;
|
||||
}
|
||||
dst += 0x18;
|
||||
}
|
||||
prim->p2 = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 + xPos;
|
||||
prim->x1 = prim->x1 + xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 - xPos;
|
||||
prim->x1 = prim->x1 - xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", EntityStageNamePopup);
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", BlitChar);
|
||||
|
394
src/st/cen/17A00.c
Normal file
394
src/st/cen/17A00.c
Normal file
@ -0,0 +1,394 @@
|
||||
#include "cen.h"
|
||||
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 0xC0;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 0xC0;
|
||||
var_a0 = D_801805D8[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", EntityUnkId0E);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_80198084);
|
||||
|
||||
extern u16 D_80180440[];
|
||||
void EntityUnkId13(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180440);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_80198284);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_801983B4);
|
||||
|
||||
// ID 14
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", EntityExplosion14);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", EntityUnkId15);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_80198680);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_801988B0);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ID 06
|
||||
#include "../entity_intense_explosion.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_8019902C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_801990F8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_801991C0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_80199278);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_80199450);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", func_80199A30);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8019A328(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8019A420(Primitive* prim) {
|
||||
u8 xPos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
switch (prim->p3) {
|
||||
case 0:
|
||||
if (prim->p1 < 0x80) {
|
||||
if (--prim->p1 == 0) {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
} else {
|
||||
if (++prim->p1 == 0) {
|
||||
prim->p3 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
u8* dst = prim->p3 == 1 ? &prim->r1 : &prim->r0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
dst[j] = 0x50;
|
||||
}
|
||||
dst += 0x18;
|
||||
}
|
||||
prim->p2 = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 + xPos;
|
||||
prim->x1 = prim->x1 + xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 - xPos;
|
||||
prim->x1 = prim->x1 - xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/cen/nonmatchings/17A00", EntityStageNamePopup);
|
@ -91,7 +91,7 @@ extern s32 D_8019D424;
|
||||
extern u8 D_8019C76C;
|
||||
extern u8 D_8019C770;
|
||||
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
extern u16 UNK_Invincibility0[];
|
||||
extern u16 g_InitializeEntityData0[];
|
||||
|
||||
|
3
src/st/cen/entity_relic_orb.c
Normal file
3
src/st/cen/entity_relic_orb.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "cen.h"
|
||||
|
||||
#include "../entity_relic_orb.h"
|
@ -937,7 +937,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_8019C738(Entity* entity, s32 renderFlags) {
|
||||
void BlinkItem(Entity* entity, s32 renderFlags) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
|
@ -184,895 +184,8 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
if (self->ext.generic.unk7C.u != 0) {
|
||||
self->ext.generic.unk7C.u--;
|
||||
}
|
||||
func_8019C738(self, self->ext.generic.unk7C.u);
|
||||
BlinkItem(self, self->ext.generic.unk7C.u);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019CDC4);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", EntityRelicOrb);
|
||||
|
||||
extern u16 D_80180660[];
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 0x118;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 0x118;
|
||||
var_a0 = D_80180660[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", EntityUnkId0E);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019E1C8);
|
||||
|
||||
void EntityUnkId13(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180494);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// DECOMP_ME_WIP func_8019E3C8 https://decomp.me/scratch/lcx4I
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019E3C8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019E4F8);
|
||||
|
||||
// an explosion animation ID 0x14
|
||||
void EntityExplosion14(Entity* entity) {
|
||||
u8 new_var2;
|
||||
u32 new_var;
|
||||
|
||||
if (!entity->step) {
|
||||
new_var = D_8018130C[entity->ext.generic.unk94];
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(2);
|
||||
entity->velocityY = new_var;
|
||||
new_var2 = D_80181324[entity->params];
|
||||
entity->blendMode = 0x10;
|
||||
entity->step++;
|
||||
entity->animCurFrame = new_var2;
|
||||
return;
|
||||
}
|
||||
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (D_80181328[entity->params] < entity->animFrameDuration) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
// looks like a particle of dust fading away
|
||||
void EntityUnkId15(Entity* entity) {
|
||||
u16 temp_v0;
|
||||
u32 temp2;
|
||||
|
||||
if (!entity->step) {
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x10;
|
||||
entity->unk19 = 3;
|
||||
temp_v0 = D_801812E4[entity->params];
|
||||
entity->unk1A = temp_v0;
|
||||
entity->unk1C = temp_v0;
|
||||
temp2 = D_801812F4[entity->params];
|
||||
entity->step += 1;
|
||||
entity->velocityY = temp2;
|
||||
return;
|
||||
}
|
||||
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019E7C4);
|
||||
|
||||
bool func_8019E9F4(Point16* arg0) {
|
||||
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 += 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 "../entity_intense_explosion.h"
|
||||
|
||||
void func_8019F170(Entity* entity) {
|
||||
if (!entity->step) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->unk6C = 0xF0;
|
||||
entity->unk1A = 0x1A0;
|
||||
entity->unk1C = 0x1A0;
|
||||
entity->animSet = ANIMSET_DRA(8);
|
||||
entity->animCurFrame = 1;
|
||||
entity->zPriority += 0x10;
|
||||
|
||||
if (entity->params != 0) {
|
||||
entity->palette = entity->params;
|
||||
} else {
|
||||
entity->palette = 0x8160;
|
||||
}
|
||||
|
||||
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(D_8007D858, &D_8007D858[32]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DECOMP_ME_WIP func_8019F3BC https://decomp.me/scratch/Hfk9n
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019F3BC);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019F594);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_8019FB74);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801A046C(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801A0564(Primitive* prim) {
|
||||
u8 xPos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
switch (prim->p3) {
|
||||
case 0:
|
||||
if (prim->p1 < 0x80) {
|
||||
if (--prim->p1 == 0) {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
} else {
|
||||
if (++prim->p1 == 0) {
|
||||
prim->p3 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
u8* dst = prim->p3 == 1 ? &prim->r1 : &prim->r0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
dst[j] = 0x50;
|
||||
}
|
||||
dst += 0x18;
|
||||
}
|
||||
prim->p2 = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 + xPos;
|
||||
prim->x1 = prim->x1 + xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 - xPos;
|
||||
prim->x1 = prim->x1 - xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", EntityStageNamePopup);
|
||||
|
||||
// The white flying orbs of energy that Alucard summons as part of the Soul
|
||||
// Steal spell
|
||||
void EntitySoulStealOrb(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
u16 *temp_d, temp_e;
|
||||
s32 temp_a, temp_b;
|
||||
u16 angle;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
InitializeEntity(g_InitializeData0);
|
||||
D_8008701E[primIndex * 0x1a] = 8;
|
||||
self->primIndex = primIndex;
|
||||
self->animSet = ANIMSET_DRA(0);
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
angle = func_8019AF08(self, &PLAYER);
|
||||
temp_a = self->posY.i.hi < 113;
|
||||
temp_b = temp_a ^ 1;
|
||||
if (self->posX.i.hi < PLAYER.posX.i.hi) {
|
||||
temp_b = temp_a;
|
||||
}
|
||||
if (temp_b & 0xFFFF) {
|
||||
self->ext.soulStealOrb.angle = angle - D_8018138C[Random() & 7];
|
||||
} else {
|
||||
angle += D_8018138C[Random() & 7];
|
||||
self->ext.soulStealOrb.angle = angle;
|
||||
}
|
||||
self->ext.soulStealOrb.unk80 = 0x400;
|
||||
self->ext.soulStealOrb.unk7E = 0;
|
||||
self->hitboxState = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
self->ext.soulStealOrb.unk82++;
|
||||
if (self->ext.soulStealOrb.unk82 == 16) {
|
||||
self->hitboxState = 1;
|
||||
}
|
||||
if (self->hitFlags != 0) {
|
||||
if (g_Player.unk56 == 0) {
|
||||
g_Player.unk56 = 1;
|
||||
g_Player.unk58 = 8;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->unk1A < 0x100) {
|
||||
self->unk1A = self->unk1C += 0x10;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk7E < 0x200) {
|
||||
self->ext.soulStealOrb.unk7E += 2;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk80 < 0x800) {
|
||||
self->ext.soulStealOrb.unk80 += 4;
|
||||
}
|
||||
self->ext.soulStealOrb.angle = func_8019AF88(
|
||||
self->ext.soulStealOrb.unk7E, (u16)self->ext.soulStealOrb.angle,
|
||||
0xffff & func_8019AF08(self, &PLAYER));
|
||||
UnkEntityFunc0(self->ext.soulStealOrb.angle & 0xFFFF,
|
||||
self->ext.soulStealOrb.unk80);
|
||||
MoveEntity(self); // argument pass necessary to match
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
AnimateEntity(&D_801813FC, self);
|
||||
angle = (float)(u32)self; // !FAKE
|
||||
prim->tpage = 0x18;
|
||||
prim->clut = 0x194;
|
||||
temp_d = &D_8018139C[(u16)((8 * (u16)self->animCurFrame) - 8)];
|
||||
prim->x0 = prim->x2 = self->posX.i.hi + *(temp_d++);
|
||||
prim->y0 = prim->y1 = self->posY.i.hi + *(temp_d++);
|
||||
prim->x1 = prim->x3 = prim->x0 + *(temp_d++);
|
||||
prim->y2 = prim->y3 = prim->y0 + *(temp_d++);
|
||||
prim->u0 = prim->u2 = *(temp_d++);
|
||||
prim->v0 = prim->v1 = *(temp_d++);
|
||||
prim->u1 = prim->u3 = *(temp_d++);
|
||||
prim->v2 = prim->v3 = *(temp_d++);
|
||||
prim->priority = self->zPriority;
|
||||
prim->blendMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ID 0x0D
|
||||
#include "../entity_enemy_blood.h"
|
||||
|
||||
extern ObjInit2 D_80181420[];
|
||||
void EntityRoomForeground(Entity* entity) {
|
||||
ObjInit2* objInit = &D_80181420[entity->params];
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(D_801804AC);
|
||||
entity->animSet = objInit->animSet;
|
||||
entity->zPriority = objInit->zPriority;
|
||||
entity->unk5A = objInit->unk4.s;
|
||||
entity->palette = objInit->palette;
|
||||
entity->unk19 = objInit->unk8;
|
||||
entity->blendMode = objInit->blendMode;
|
||||
if (objInit->unkC != 0) {
|
||||
entity->flags = objInit->unkC;
|
||||
}
|
||||
if (entity->params >= 5) {
|
||||
entity->rotAngle = 0x800;
|
||||
entity->unk19 |= 4;
|
||||
}
|
||||
}
|
||||
AnimateEntity(objInit->unk10, entity);
|
||||
}
|
||||
|
||||
void BottomCornerText(u8* str, u8 lower_left) {
|
||||
u8 toPrint[64];
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
u32 ch;
|
||||
u8* chIdx = &toPrint;
|
||||
|
||||
u16 textWidth = 0;
|
||||
// serves two purposes, use #define for dual names
|
||||
u16 dualVar = 0;
|
||||
#define charcount dualVar
|
||||
|
||||
// Clear out the toPrint array
|
||||
for (i = 0; i < 64; i++) {
|
||||
*chIdx++ = 0;
|
||||
}
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
|
||||
while (1) {
|
||||
i = 0;
|
||||
// Copy values from the incoming arg0 array to the local array, until we
|
||||
// get a 0xFF followed by a 0
|
||||
ch = *str++;
|
||||
if (ch == 0xFF) {
|
||||
ch = *str++;
|
||||
if (ch == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*chIdx = ch;
|
||||
chIdx++;
|
||||
if (ch != 0) {
|
||||
charcount += 1;
|
||||
textWidth += 8;
|
||||
} else {
|
||||
textWidth += 4;
|
||||
}
|
||||
}
|
||||
|
||||
g_BottomCornerTextPrims = g_api_AllocPrimitives(PRIM_SPRT, charcount + 4);
|
||||
if (g_BottomCornerTextPrims == -1) {
|
||||
return;
|
||||
}
|
||||
#undef charcount
|
||||
|
||||
prim = &g_PrimBuf[g_BottomCornerTextPrims];
|
||||
prim->type = 3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
|
||||
if (lower_left) {
|
||||
prim->b0 = prim->b1 = 0xAF;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = 0x5F;
|
||||
}
|
||||
|
||||
#define xpos dualVar
|
||||
if (lower_left) {
|
||||
xpos = 7;
|
||||
textWidth += 4;
|
||||
} else {
|
||||
xpos = 0xD4 - textWidth;
|
||||
}
|
||||
|
||||
prim->x0 = prim->x2 = xpos;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x20;
|
||||
prim->y0 = prim->y1 = 0xD0;
|
||||
prim->y2 = prim->y3 = 0xDF;
|
||||
prim->priority = 0x1EE;
|
||||
prim->blendMode = 0x11;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos - 6;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0x80;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos + textWidth + 0x16;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0xA8;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->type = 4;
|
||||
prim->y0 = prim->y1 = 0xCD;
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->y2 = prim->y3 = 0xE1;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
prim->u1 = prim->u3 = 0x9C;
|
||||
prim->v0 = prim->v1 = 2;
|
||||
prim->x0 = prim->x2 = xpos + 0xA;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x18;
|
||||
prim->v2 = prim->v3 = 0x16;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
|
||||
xpos += 0x10;
|
||||
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
for (prim = prim->next; prim != NULL;) {
|
||||
ch = *chIdx++;
|
||||
if (ch != 0) {
|
||||
prim->x0 = xpos;
|
||||
prim->u0 = (ch & 0xF) * 8;
|
||||
prim->tpage = 0x1E;
|
||||
prim->clut = 0x196;
|
||||
prim->v0 = (ch & 0xF0) >> 1;
|
||||
prim->v1 = 8;
|
||||
prim->u1 = 8;
|
||||
prim->priority = 0x1F0;
|
||||
prim->blendMode = 0;
|
||||
prim->y0 = 0xD4;
|
||||
prim = prim->next;
|
||||
xpos += 8;
|
||||
} else {
|
||||
xpos += 4;
|
||||
}
|
||||
}
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A2018);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A2400);
|
||||
|
||||
POLY_GT4* func_801A2550(POLY_GT4* poly) {
|
||||
while (poly != NULL) {
|
||||
if (poly->p3 != 0) {
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
} else {
|
||||
return poly;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A2580);
|
||||
|
||||
// DECOMP_ME_WIP func_801A25FC https://decomp.me/scratch/IIvQX a0 -> v0 register
|
||||
// swap
|
||||
#ifndef NON_MATCHING
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A25FC);
|
||||
#else
|
||||
POLY_GT4* func_801A25FC(POLY_GT4* poly, s32 arg1) {
|
||||
s32 i;
|
||||
s8 var_a2;
|
||||
|
||||
if (poly->p3 != 0) {
|
||||
poly->p3 = 0;
|
||||
} else {
|
||||
poly->p3 = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < arg1; i++) {
|
||||
if (poly->p3 != 0) {
|
||||
var_a2 = 0;
|
||||
poly->pad3 &= ~8;
|
||||
} else {
|
||||
var_a2 = 1;
|
||||
poly->pad3 |= 8;
|
||||
}
|
||||
|
||||
if (poly->tag != NULL) {
|
||||
poly->p3 = var_a2;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return poly;
|
||||
}
|
||||
#endif
|
||||
|
||||
void func_801A2684(POLY_GT4* poly) {
|
||||
poly->p1 = 0;
|
||||
poly->p2 = 0;
|
||||
poly->p3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y0 = 0;
|
||||
((POLY_GT4*)poly->tag)->x0 = 0;
|
||||
((POLY_GT4*)poly->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u1 = 0;
|
||||
((POLY_GT4*)poly->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b2 = 0;
|
||||
((POLY_GT4*)poly->tag)->u2 = 0;
|
||||
((POLY_GT4*)poly->tag)->v2 = 0;
|
||||
((POLY_GT4*)poly->tag)->r3 = 0;
|
||||
((POLY_GT4*)poly->tag)->b3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x2 = 0;
|
||||
((POLY_GT4*)poly->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801A2764(POLY_GT4* poly) {
|
||||
func_801A2684(poly);
|
||||
poly->p3 = 8;
|
||||
((POLY_GT4*)poly->tag)->p3 = 1;
|
||||
((POLY_GT4*)poly->tag)->code = 2;
|
||||
((POLY_GT4*)poly->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A2848);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A2A58);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", func_801A2C9C);
|
||||
|
||||
// DECOMP_ME_WIP EntityUnkId17 https://decomp.me/scratch/nNfXk 95.28%
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", EntityUnkId17);
|
||||
|
||||
// 3D house object in background ID 0x16
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", Entity3DBackgroundHouse);
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1C7DC", BlitChar);
|
||||
|
886
src/st/dre/1DC6C.c
Normal file
886
src/st/dre/1DC6C.c
Normal file
@ -0,0 +1,886 @@
|
||||
#include "dre.h"
|
||||
|
||||
extern u16 D_80180660[];
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 0x118;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 0x118;
|
||||
var_a0 = D_80180660[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", EntityUnkId0E);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019E1C8);
|
||||
|
||||
void EntityUnkId13(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180494);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// DECOMP_ME_WIP func_8019E3C8 https://decomp.me/scratch/lcx4I
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019E3C8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019E4F8);
|
||||
|
||||
// an explosion animation ID 0x14
|
||||
void EntityExplosion14(Entity* entity) {
|
||||
u8 new_var2;
|
||||
u32 new_var;
|
||||
|
||||
if (!entity->step) {
|
||||
new_var = D_8018130C[entity->ext.generic.unk94];
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(2);
|
||||
entity->velocityY = new_var;
|
||||
new_var2 = D_80181324[entity->params];
|
||||
entity->blendMode = 0x10;
|
||||
entity->step++;
|
||||
entity->animCurFrame = new_var2;
|
||||
return;
|
||||
}
|
||||
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (D_80181328[entity->params] < entity->animFrameDuration) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
// looks like a particle of dust fading away
|
||||
void EntityUnkId15(Entity* entity) {
|
||||
u16 temp_v0;
|
||||
u32 temp2;
|
||||
|
||||
if (!entity->step) {
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x10;
|
||||
entity->unk19 = 3;
|
||||
temp_v0 = D_801812E4[entity->params];
|
||||
entity->unk1A = temp_v0;
|
||||
entity->unk1C = temp_v0;
|
||||
temp2 = D_801812F4[entity->params];
|
||||
entity->step += 1;
|
||||
entity->velocityY = temp2;
|
||||
return;
|
||||
}
|
||||
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019E7C4);
|
||||
|
||||
bool func_8019E9F4(Point16* arg0) {
|
||||
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 += 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 "../entity_intense_explosion.h"
|
||||
|
||||
void func_8019F170(Entity* entity) {
|
||||
if (!entity->step) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->unk6C = 0xF0;
|
||||
entity->unk1A = 0x1A0;
|
||||
entity->unk1C = 0x1A0;
|
||||
entity->animSet = ANIMSET_DRA(8);
|
||||
entity->animCurFrame = 1;
|
||||
entity->zPriority += 0x10;
|
||||
|
||||
if (entity->params != 0) {
|
||||
entity->palette = entity->params;
|
||||
} else {
|
||||
entity->palette = 0x8160;
|
||||
}
|
||||
|
||||
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(D_8007D858, &D_8007D858[32]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DECOMP_ME_WIP func_8019F3BC https://decomp.me/scratch/Hfk9n
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019F3BC);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019F594);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_8019FB74);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801A046C(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801A0564(Primitive* prim) {
|
||||
u8 xPos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
switch (prim->p3) {
|
||||
case 0:
|
||||
if (prim->p1 < 0x80) {
|
||||
if (--prim->p1 == 0) {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
} else {
|
||||
if (++prim->p1 == 0) {
|
||||
prim->p3 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
u8* dst = prim->p3 == 1 ? &prim->r1 : &prim->r0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
dst[j] = 0x50;
|
||||
}
|
||||
dst += 0x18;
|
||||
}
|
||||
prim->p2 = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 + xPos;
|
||||
prim->x1 = prim->x1 + xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 - xPos;
|
||||
prim->x1 = prim->x1 - xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", EntityStageNamePopup);
|
||||
|
||||
// The white flying orbs of energy that Alucard summons as part of the Soul
|
||||
// Steal spell
|
||||
void EntitySoulStealOrb(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
u16 *temp_d, temp_e;
|
||||
s32 temp_a, temp_b;
|
||||
u16 angle;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
InitializeEntity(g_InitializeData0);
|
||||
D_8008701E[primIndex * 0x1a] = 8;
|
||||
self->primIndex = primIndex;
|
||||
self->animSet = ANIMSET_DRA(0);
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
angle = func_8019AF08(self, &PLAYER);
|
||||
temp_a = self->posY.i.hi < 113;
|
||||
temp_b = temp_a ^ 1;
|
||||
if (self->posX.i.hi < PLAYER.posX.i.hi) {
|
||||
temp_b = temp_a;
|
||||
}
|
||||
if (temp_b & 0xFFFF) {
|
||||
self->ext.soulStealOrb.angle = angle - D_8018138C[Random() & 7];
|
||||
} else {
|
||||
angle += D_8018138C[Random() & 7];
|
||||
self->ext.soulStealOrb.angle = angle;
|
||||
}
|
||||
self->ext.soulStealOrb.unk80 = 0x400;
|
||||
self->ext.soulStealOrb.unk7E = 0;
|
||||
self->hitboxState = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
self->ext.soulStealOrb.unk82++;
|
||||
if (self->ext.soulStealOrb.unk82 == 16) {
|
||||
self->hitboxState = 1;
|
||||
}
|
||||
if (self->hitFlags != 0) {
|
||||
if (g_Player.unk56 == 0) {
|
||||
g_Player.unk56 = 1;
|
||||
g_Player.unk58 = 8;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->unk1A < 0x100) {
|
||||
self->unk1A = self->unk1C += 0x10;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk7E < 0x200) {
|
||||
self->ext.soulStealOrb.unk7E += 2;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk80 < 0x800) {
|
||||
self->ext.soulStealOrb.unk80 += 4;
|
||||
}
|
||||
self->ext.soulStealOrb.angle = func_8019AF88(
|
||||
self->ext.soulStealOrb.unk7E, (u16)self->ext.soulStealOrb.angle,
|
||||
0xffff & func_8019AF08(self, &PLAYER));
|
||||
UnkEntityFunc0(self->ext.soulStealOrb.angle & 0xFFFF,
|
||||
self->ext.soulStealOrb.unk80);
|
||||
MoveEntity(self); // argument pass necessary to match
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
AnimateEntity(&D_801813FC, self);
|
||||
angle = (float)(u32)self; // !FAKE
|
||||
prim->tpage = 0x18;
|
||||
prim->clut = 0x194;
|
||||
temp_d = &D_8018139C[(u16)((8 * (u16)self->animCurFrame) - 8)];
|
||||
prim->x0 = prim->x2 = self->posX.i.hi + *(temp_d++);
|
||||
prim->y0 = prim->y1 = self->posY.i.hi + *(temp_d++);
|
||||
prim->x1 = prim->x3 = prim->x0 + *(temp_d++);
|
||||
prim->y2 = prim->y3 = prim->y0 + *(temp_d++);
|
||||
prim->u0 = prim->u2 = *(temp_d++);
|
||||
prim->v0 = prim->v1 = *(temp_d++);
|
||||
prim->u1 = prim->u3 = *(temp_d++);
|
||||
prim->v2 = prim->v3 = *(temp_d++);
|
||||
prim->priority = self->zPriority;
|
||||
prim->blendMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ID 0x0D
|
||||
#include "../entity_enemy_blood.h"
|
||||
|
||||
extern ObjInit2 D_80181420[];
|
||||
void EntityRoomForeground(Entity* entity) {
|
||||
ObjInit2* objInit = &D_80181420[entity->params];
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(D_801804AC);
|
||||
entity->animSet = objInit->animSet;
|
||||
entity->zPriority = objInit->zPriority;
|
||||
entity->unk5A = objInit->unk4.s;
|
||||
entity->palette = objInit->palette;
|
||||
entity->unk19 = objInit->unk8;
|
||||
entity->blendMode = objInit->blendMode;
|
||||
if (objInit->unkC != 0) {
|
||||
entity->flags = objInit->unkC;
|
||||
}
|
||||
if (entity->params >= 5) {
|
||||
entity->rotAngle = 0x800;
|
||||
entity->unk19 |= 4;
|
||||
}
|
||||
}
|
||||
AnimateEntity(objInit->unk10, entity);
|
||||
}
|
||||
|
||||
void BottomCornerText(u8* str, u8 lower_left) {
|
||||
u8 toPrint[64];
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
u32 ch;
|
||||
u8* chIdx = &toPrint;
|
||||
|
||||
u16 textWidth = 0;
|
||||
// serves two purposes, use #define for dual names
|
||||
u16 dualVar = 0;
|
||||
#define charcount dualVar
|
||||
|
||||
// Clear out the toPrint array
|
||||
for (i = 0; i < 64; i++) {
|
||||
*chIdx++ = 0;
|
||||
}
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
|
||||
while (1) {
|
||||
i = 0;
|
||||
// Copy values from the incoming arg0 array to the local array, until we
|
||||
// get a 0xFF followed by a 0
|
||||
ch = *str++;
|
||||
if (ch == 0xFF) {
|
||||
ch = *str++;
|
||||
if (ch == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*chIdx = ch;
|
||||
chIdx++;
|
||||
if (ch != 0) {
|
||||
charcount += 1;
|
||||
textWidth += 8;
|
||||
} else {
|
||||
textWidth += 4;
|
||||
}
|
||||
}
|
||||
|
||||
g_BottomCornerTextPrims = g_api_AllocPrimitives(PRIM_SPRT, charcount + 4);
|
||||
if (g_BottomCornerTextPrims == -1) {
|
||||
return;
|
||||
}
|
||||
#undef charcount
|
||||
|
||||
prim = &g_PrimBuf[g_BottomCornerTextPrims];
|
||||
prim->type = 3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
|
||||
if (lower_left) {
|
||||
prim->b0 = prim->b1 = 0xAF;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = 0x5F;
|
||||
}
|
||||
|
||||
#define xpos dualVar
|
||||
if (lower_left) {
|
||||
xpos = 7;
|
||||
textWidth += 4;
|
||||
} else {
|
||||
xpos = 0xD4 - textWidth;
|
||||
}
|
||||
|
||||
prim->x0 = prim->x2 = xpos;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x20;
|
||||
prim->y0 = prim->y1 = 0xD0;
|
||||
prim->y2 = prim->y3 = 0xDF;
|
||||
prim->priority = 0x1EE;
|
||||
prim->blendMode = 0x11;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos - 6;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0x80;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos + textWidth + 0x16;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0xA8;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->type = 4;
|
||||
prim->y0 = prim->y1 = 0xCD;
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->y2 = prim->y3 = 0xE1;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
prim->u1 = prim->u3 = 0x9C;
|
||||
prim->v0 = prim->v1 = 2;
|
||||
prim->x0 = prim->x2 = xpos + 0xA;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x18;
|
||||
prim->v2 = prim->v3 = 0x16;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
|
||||
xpos += 0x10;
|
||||
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
for (prim = prim->next; prim != NULL;) {
|
||||
ch = *chIdx++;
|
||||
if (ch != 0) {
|
||||
prim->x0 = xpos;
|
||||
prim->u0 = (ch & 0xF) * 8;
|
||||
prim->tpage = 0x1E;
|
||||
prim->clut = 0x196;
|
||||
prim->v0 = (ch & 0xF0) >> 1;
|
||||
prim->v1 = 8;
|
||||
prim->u1 = 8;
|
||||
prim->priority = 0x1F0;
|
||||
prim->blendMode = 0;
|
||||
prim->y0 = 0xD4;
|
||||
prim = prim->next;
|
||||
xpos += 8;
|
||||
} else {
|
||||
xpos += 4;
|
||||
}
|
||||
}
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A2018);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A2400);
|
||||
|
||||
POLY_GT4* func_801A2550(POLY_GT4* poly) {
|
||||
while (poly != NULL) {
|
||||
if (poly->p3 != 0) {
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
} else {
|
||||
return poly;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A2580);
|
||||
|
||||
// DECOMP_ME_WIP func_801A25FC https://decomp.me/scratch/IIvQX a0 -> v0 register
|
||||
// swap
|
||||
#ifndef NON_MATCHING
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A25FC);
|
||||
#else
|
||||
POLY_GT4* func_801A25FC(POLY_GT4* poly, s32 arg1) {
|
||||
s32 i;
|
||||
s8 var_a2;
|
||||
|
||||
if (poly->p3 != 0) {
|
||||
poly->p3 = 0;
|
||||
} else {
|
||||
poly->p3 = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < arg1; i++) {
|
||||
if (poly->p3 != 0) {
|
||||
var_a2 = 0;
|
||||
poly->pad3 &= ~8;
|
||||
} else {
|
||||
var_a2 = 1;
|
||||
poly->pad3 |= 8;
|
||||
}
|
||||
|
||||
if (poly->tag != NULL) {
|
||||
poly->p3 = var_a2;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return poly;
|
||||
}
|
||||
#endif
|
||||
|
||||
void func_801A2684(POLY_GT4* poly) {
|
||||
poly->p1 = 0;
|
||||
poly->p2 = 0;
|
||||
poly->p3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y1 = 0;
|
||||
((POLY_GT4*)poly->tag)->y0 = 0;
|
||||
((POLY_GT4*)poly->tag)->x0 = 0;
|
||||
((POLY_GT4*)poly->tag)->clut = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u0 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r1 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->u1 = 0;
|
||||
((POLY_GT4*)poly->tag)->tpage = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->r2 = 0;
|
||||
*(u16*)&((POLY_GT4*)poly->tag)->b2 = 0;
|
||||
((POLY_GT4*)poly->tag)->u2 = 0;
|
||||
((POLY_GT4*)poly->tag)->v2 = 0;
|
||||
((POLY_GT4*)poly->tag)->r3 = 0;
|
||||
((POLY_GT4*)poly->tag)->b3 = 0;
|
||||
((POLY_GT4*)poly->tag)->x2 = 0;
|
||||
((POLY_GT4*)poly->tag)->y2 = 0;
|
||||
}
|
||||
|
||||
void func_801A2764(POLY_GT4* poly) {
|
||||
func_801A2684(poly);
|
||||
poly->p3 = 8;
|
||||
((POLY_GT4*)poly->tag)->p3 = 1;
|
||||
((POLY_GT4*)poly->tag)->code = 2;
|
||||
((POLY_GT4*)poly->tag)->pad3 = 0xA;
|
||||
}
|
||||
|
||||
#include "../unk_poly_func_0.h"
|
||||
|
||||
#include "../unk_loop_func.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A2848);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A2A58);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", func_801A2C9C);
|
||||
|
||||
// DECOMP_ME_WIP EntityUnkId17 https://decomp.me/scratch/nNfXk 95.28%
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", EntityUnkId17);
|
||||
|
||||
// 3D house object in background ID 0x16
|
||||
INCLUDE_ASM("asm/us/st/dre/nonmatchings/1DC6C", Entity3DBackgroundHouse);
|
@ -151,4 +151,4 @@ extern s32 D_801A3F84;
|
||||
extern s16 D_801A3F14;
|
||||
extern s16 D_801A3F16;
|
||||
extern s32 D_801A3F18;
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
|
3
src/st/dre/entity_relic_orb.c
Normal file
3
src/st/dre/entity_relic_orb.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "dre.h"
|
||||
|
||||
#include "../entity_relic_orb.h"
|
345
src/st/entity_relic_orb.h
Normal file
345
src/st/entity_relic_orb.h
Normal file
@ -0,0 +1,345 @@
|
||||
const char* g_RelicOrbTexts[] = {
|
||||
"Obtained ",
|
||||
};
|
||||
u16 g_RelicOrbTextBg1EY[] = {16, 12, 8, 4, 0, -4, -8, -12};
|
||||
u16 g_RelicOrbTextBg1SY[] = {-32, -26, -20, -13, -7, -1, 5, 12};
|
||||
u16 g_RelicOrbTextBg2SY[] = {-16, -12, -8, -4, 0, 4, 8, 12};
|
||||
u16 g_RelicOrbTextBg2EY[] = {32, 26, 20, 13, 7, 1, -5, -12};
|
||||
u16 g_RelicOrbSparkleX[] = {-8, 4, -2, 8, 0, 4, -4, 2};
|
||||
u16 g_RelicOrbSparkleY[] = {-2, 2, 4, -3, 0, 2, -4, 3};
|
||||
void EntityRelicOrb(Entity* self) {
|
||||
// prim 0: green rectangle for Obtained text bg
|
||||
// prim 1: blue rectangle for Obtained text bg
|
||||
|
||||
const int MaxItemSlots = LEN(g_ItemIconSlots) - 1;
|
||||
RECT rect;
|
||||
u16 sp28;
|
||||
u8* var_v0_5;
|
||||
Primitive* prim;
|
||||
RelicOrb* relic;
|
||||
s16 primIndex;
|
||||
s16 temp_v0_6;
|
||||
s16 iconSlot;
|
||||
u16 relicId;
|
||||
s32 xCoord;
|
||||
u16 yCoord;
|
||||
s32 texSrcX;
|
||||
s32 texSrcY;
|
||||
s16 temp_v1_6;
|
||||
s32 i;
|
||||
s32 var_s0_2;
|
||||
char* msg;
|
||||
u16 temp_a1_2;
|
||||
s16 new_var7;
|
||||
s16 new_var10;
|
||||
s16 new_var6;
|
||||
PixPattern* new_var2;
|
||||
s8 new_var3;
|
||||
|
||||
relicId = self->params & 0x7FFF;
|
||||
if (self->step > 0 && self->step < 5 && self->hitFlags != 0) {
|
||||
self->step = 5;
|
||||
}
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
// If the relic was previously obtained, do not spawn it.
|
||||
if (g_Status.relics[relicId & 0xFFFF] & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeEntity(g_InitializeData0);
|
||||
for (iconSlot = 0; iconSlot < MaxItemSlots; iconSlot++) {
|
||||
if (g_ItemIconSlots[iconSlot] == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iconSlot >= MaxItemSlots) {
|
||||
self->step = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 7);
|
||||
if (primIndex == -1) {
|
||||
self->step = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
self->primIndex = primIndex;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
self->ext.relicOrb.iconSlot = iconSlot;
|
||||
g_ItemIconSlots[iconSlot] = 0x10;
|
||||
relic = &g_api.D_800A8720[relicId];
|
||||
g_api.LoadEquipIcon(relic->icon, relic->palette, iconSlot);
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
if (prim != NULL) {
|
||||
new_var3 = iconSlot;
|
||||
texSrcX = (new_var3 & 0x07) * 0x10;
|
||||
texSrcY = (new_var3 & 0x18) * 0x02;
|
||||
for (i = 0; prim != NULL; i++) {
|
||||
if (i != 0) {
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
} else {
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = iconSlot + 0x1D0;
|
||||
prim->u0 = prim->u2 = texSrcX | 1;
|
||||
prim->u1 = prim->u3 = texSrcX | 0xF;
|
||||
prim->v0 = prim->v1 = texSrcY | 0x81;
|
||||
prim->v2 = prim->v3 = texSrcY | 0x8F;
|
||||
prim->blendMode = 6;
|
||||
}
|
||||
prim->priority = 0x7E;
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
self->posY.i.lo = 0x8000;
|
||||
self->velocityY = FIX(0.25);
|
||||
self->ext.relicOrb.floatTimer = 64;
|
||||
self->ext.relicOrb.yFloatSpeed = -FIX(0.0078125);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// The relic floats in the air
|
||||
self->velocityY += self->ext.relicOrb.yFloatSpeed;
|
||||
if (--self->ext.relicOrb.floatTimer == 0) {
|
||||
self->ext.relicOrb.floatTimer = 64;
|
||||
self->ext.relicOrb.yFloatSpeed = -self->ext.relicOrb.yFloatSpeed;
|
||||
}
|
||||
MoveEntity();
|
||||
g_ItemIconSlots[self->ext.relicOrb.iconSlot] = 0x10;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
g_api.func_800FE044(relicId, 0x2000);
|
||||
if (relicId > RELIC_DEMON_CARD && relicId < RELIC_FAERIE_CARD) {
|
||||
g_Status.relics[relicId] = g_Status.relics[relicId] ^ 2;
|
||||
}
|
||||
self->flags |= FLAG_UNK_10000;
|
||||
|
||||
// Reserve space in the VRAM to store the pre-render texture with the
|
||||
// "obtained" relic message
|
||||
rect.x = 0;
|
||||
rect.y = 256;
|
||||
rect.w = 64;
|
||||
rect.h = 16;
|
||||
ClearImage(&rect, 0, 0, 0);
|
||||
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (i == 0) {
|
||||
prim->type = PRIM_SPRT;
|
||||
prim->y0 = 0xA0;
|
||||
prim->u1 = 0xF0;
|
||||
prim->clut = 0x1A1;
|
||||
prim->priority = 0x1FE;
|
||||
prim->tpage = 0x10;
|
||||
prim->x0 = 0x10;
|
||||
prim->u0 = 0;
|
||||
prim->v0 = 0;
|
||||
prim->v1 = 0x10;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
} else {
|
||||
prim->type = PRIM_G4;
|
||||
prim->x0 = prim->x1 = prim->x2 = prim->x3 = 0x80;
|
||||
prim->y0 = prim->y1 = prim->y2 = prim->y3 = 0xA7;
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0;
|
||||
|
||||
if (i == 1) {
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0x80;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0x80;
|
||||
}
|
||||
prim->priority = 0x1FD;
|
||||
prim->blendMode = 0x11;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
self->step++;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// This case creates the texture "Obtained RELIC_NAME" and stores it
|
||||
// in the VRAM
|
||||
var_s0_2 = 0;
|
||||
sp28 = 0;
|
||||
msg = g_RelicOrbTexts[0];
|
||||
new_var2 = &D_8007EFE4;
|
||||
var_v0_5 = (u8*)new_var2;
|
||||
for (i = 0; i < 0xC00; i++) {
|
||||
*var_v0_5++ = 0;
|
||||
}
|
||||
|
||||
sp28 = 0;
|
||||
while (true) {
|
||||
if (*msg == 0) {
|
||||
if (var_s0_2 != 0) {
|
||||
break;
|
||||
}
|
||||
msg = g_api.D_800A8720[relicId].name;
|
||||
var_s0_2 = 1;
|
||||
} else {
|
||||
msg = BlitChar(msg, &sp28, new_var2, 0xC0);
|
||||
}
|
||||
}
|
||||
|
||||
LoadTPage(new_var2, 0, 0, 0, 0x100, 0x180, 0x10);
|
||||
self->ext.relicOrb.unk7C = 0;
|
||||
self->ext.relicOrb.unk7E = sp28;
|
||||
self->step++;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// Animates the blue/green rectangle for the Obtain text bg
|
||||
prim = g_PrimBuf[self->primIndex].next;
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (i == 0) {
|
||||
prim->x2 = prim->x2 - 3;
|
||||
prim->x3 = prim->x3 + 3;
|
||||
prim->y0 = prim->y1 = prim->y1 - 4;
|
||||
prim->y2 = prim->y3 = prim->y3 + 2;
|
||||
} else {
|
||||
prim->x0 = prim->x0 - 3;
|
||||
prim->x1 = prim->x1 + 3;
|
||||
prim->y0 = prim->y1 = prim->y1 - 2;
|
||||
prim->y2 = prim->y3 = prim->y3 + 4;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (++self->ext.relicOrb.unk7C == 8) {
|
||||
self->ext.relicOrb.unk7C = 0;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
temp_a1_2 = self->ext.relicOrb.unk7C;
|
||||
prim = g_PrimBuf[self->primIndex].next;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (i == 0) {
|
||||
prim->x1 = 0x80 - (temp_a1_2 + 1) * 0xC;
|
||||
prim->x0 = 0x80 + (temp_a1_2 + 1) * 0xC;
|
||||
prim->x2 = 0x68 + (temp_a1_2 * 0x78) / 7;
|
||||
prim->x3 = 0x98 - (temp_a1_2 * 0x78) / 7;
|
||||
prim->y0 = prim->y1 = g_RelicOrbTextBg1SY[temp_a1_2] + 0xA7;
|
||||
prim->y2 = prim->y3 = g_RelicOrbTextBg1EY[temp_a1_2] + 0xA7;
|
||||
prim->b2 = prim->b3 = prim->b3 - 0x10;
|
||||
} else {
|
||||
prim->x0 = 0x68 + (temp_a1_2 * 0x78) / 7;
|
||||
prim->x1 = 0x98 - (temp_a1_2 * 0x78) / 7;
|
||||
prim->x3 = 0x80 - (temp_a1_2 + 1) * 0xC;
|
||||
prim->x2 = 0x80 + (temp_a1_2 + 1) * 0xC;
|
||||
prim->y0 = prim->y1 = g_RelicOrbTextBg2SY[temp_a1_2] + 0xA7;
|
||||
prim->y2 = prim->y3 = g_RelicOrbTextBg2EY[temp_a1_2] + 0xA7;
|
||||
prim->g0 = prim->g1 = prim->g1 - 0x10;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (++self->ext.relicOrb.unk7C == 8) {
|
||||
self->ext.relicOrb.unk7C = 0;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
prim->x0 = 0x80 - self->ext.relicOrb.unk7E;
|
||||
prim->blendMode = 0;
|
||||
self->ext.relicOrb.unk7C++;
|
||||
if (self->ext.relicOrb.unk7C > 0x60) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (self->step < 2) {
|
||||
// Animates the four sparkles while the relic is floating
|
||||
BlinkItem(self, (u16)g_blinkTimer);
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 3; i++) { // Skip the first three primitives
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (self->ext.relicOrb.sparkleCycle == 0) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (prim->blendMode == BLEND_VISIBLE) {
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x1B1;
|
||||
prim->u3 = 0x10;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x50;
|
||||
prim->v0 = 0x50;
|
||||
prim->u2 = 0;
|
||||
prim->u0 = 0;
|
||||
prim->v3 = 0x60;
|
||||
prim->v2 = 0x60;
|
||||
|
||||
temp_v1_6 = self->ext.relicOrb.sparkleAnim & 7;
|
||||
var_s0_2 = (u16)self->posX.i.hi;
|
||||
xCoord = var_s0_2 + g_RelicOrbSparkleX[temp_v1_6];
|
||||
prim->x0 = prim->x2 = xCoord - 6;
|
||||
prim->x1 = prim->x3 = xCoord + 6;
|
||||
|
||||
var_s0_2 = (u16)self->posY.i.hi;
|
||||
yCoord = var_s0_2 + g_RelicOrbSparkleY[temp_v1_6];
|
||||
prim->y0 = prim->y1 = yCoord - 6;
|
||||
prim->y2 = prim->y3 = yCoord + 6;
|
||||
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0x80;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0x80;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0x80;
|
||||
prim->p1 = 0;
|
||||
prim->priority = 0x7F;
|
||||
prim->blendMode = 0x37;
|
||||
break;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
self->ext.relicOrb.sparkleCycle = 4;
|
||||
self->ext.relicOrb.sparkleAnim++;
|
||||
} else {
|
||||
self->ext.relicOrb.sparkleCycle--;
|
||||
}
|
||||
}
|
||||
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 3; i++) {
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
for (; prim != NULL; prim = prim->next) {
|
||||
if (prim->blendMode != BLEND_VISIBLE) {
|
||||
if (prim->p1 & 3) {
|
||||
new_var10 = prim->y1;
|
||||
temp_v1_6 = prim->y3;
|
||||
prim->y1 = new_var10 - 1;
|
||||
prim->y0 = new_var10;
|
||||
prim->y3 = temp_v1_6 - 1;
|
||||
prim->y2 = temp_v1_6;
|
||||
} else {
|
||||
new_var6 = prim->x2;
|
||||
new_var7 = prim->x3;
|
||||
prim->y2 = prim->y3 = prim->y3 - 2;
|
||||
prim->x2 = new_var6 + 1;
|
||||
prim->x0 = new_var6;
|
||||
prim->x3 = new_var7 - 1;
|
||||
prim->x1 = new_var7;
|
||||
}
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->r3 - 6;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = prim->g3 - 6;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->b3 - 6;
|
||||
prim->p1++;
|
||||
if (prim->p1 > 0x10) {
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -79,7 +79,7 @@ extern LayoutEntity* D_801997D8;
|
||||
extern u16* D_801997DC;
|
||||
extern u8 D_801997E0;
|
||||
extern s8 D_801997E4;
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
|
||||
extern u16 g_eBreakableInit[];
|
||||
extern u8* g_eBreakableAnimations[8];
|
||||
|
1988
src/st/no3/46684.c
1988
src/st/no3/46684.c
File diff suppressed because it is too large
Load Diff
1981
src/st/no3/48400.c
Normal file
1981
src/st/no3/48400.c
Normal file
File diff suppressed because it is too large
Load Diff
3
src/st/no3/entity_relic_orb.c
Normal file
3
src/st/no3/entity_relic_orb.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "no3.h"
|
||||
|
||||
#include "../entity_relic_orb.h"
|
@ -200,7 +200,7 @@ extern s16 D_801D7D60;
|
||||
extern s16 D_801D7D62;
|
||||
extern s32 D_801D7D64;
|
||||
extern s32 D_801D7DD0;
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
|
||||
extern LayoutEntity* g_pStObjLayout[];
|
||||
extern PfnEntityUpdate PfnEntityUpdates[];
|
||||
|
@ -249,7 +249,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_801BE864(Entity* self, s32 arg1) {
|
||||
void BlinkItem(Entity* self, s32 arg1) {
|
||||
POLY_GT4* poly = &g_PrimBuf[self->primIndex];
|
||||
s16 right, left, bottom, top;
|
||||
|
||||
@ -460,915 +460,8 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
if (self->ext.generic.unk7C.u != 0) {
|
||||
self->ext.generic.unk7C.u--;
|
||||
}
|
||||
func_801BE864(self, self->ext.generic.unk7C.u);
|
||||
BlinkItem(self, self->ext.generic.unk7C.u);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801BEEF0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", EntityRelicOrb);
|
||||
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 0x30;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 0x30;
|
||||
var_a0 = D_80181618[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", EntityUnkId0E);
|
||||
|
||||
u8 func_801C02F4(s16* arg0, u8 facing) {
|
||||
u8 ret = 0;
|
||||
Collider collider;
|
||||
s16 posX, posY;
|
||||
|
||||
while (*arg0 != 0xFF) {
|
||||
ret <<= 1;
|
||||
|
||||
posX = facing ? (g_CurrentEntity->posX.i.hi + *arg0++)
|
||||
: (g_CurrentEntity->posX.i.hi - *arg0++);
|
||||
posY = g_CurrentEntity->posY.i.hi + *arg0++;
|
||||
|
||||
g_api.CheckCollision(posX, posY, &collider, 0);
|
||||
|
||||
if (collider.effects & EFFECT_SOLID) {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void func_801C03E4(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180A78);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801C04F4);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801C0624);
|
||||
|
||||
void func_801C070C(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
entity->velocityY = D_80181FDC[entity->ext.generic.unk94];
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(2);
|
||||
entity->animCurFrame = D_80181FF4[entity->params];
|
||||
entity->blendMode = 0x10;
|
||||
entity->step++;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (D_80181FF8[entity->params] < (s32)entity->animFrameDuration) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C07FC(Entity* entity) {
|
||||
u16 temp_v0;
|
||||
u32 temp2;
|
||||
|
||||
if (entity->step == 0) {
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x10;
|
||||
entity->unk19 = 3;
|
||||
temp_v0 = D_80181FB4[entity->params];
|
||||
entity->unk1A = temp_v0;
|
||||
entity->unk1C = temp_v0;
|
||||
temp2 = D_80181FC4[entity->params];
|
||||
entity->step += 1;
|
||||
entity->velocityY = temp2;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C08F0(Entity* self) {
|
||||
s16 primIndex;
|
||||
Primitive* prim;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, 1);
|
||||
if (primIndex != -1) {
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
self->primIndex = primIndex;
|
||||
self->hitboxState = 0;
|
||||
*(s32*)&self->ext.generic.unk7C = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
while (prim != NULL) {
|
||||
prim->x0 = prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = prim->y1 = self->posY.i.hi;
|
||||
prim->r0 = 64;
|
||||
prim->r1 = 0;
|
||||
prim->g0 = 64;
|
||||
prim->g1 = 0;
|
||||
prim->b0 = 255;
|
||||
prim->b1 = 16;
|
||||
prim->priority = self->zPriority + 1;
|
||||
prim->blendMode |= 0x37;
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
prim = (Primitive*)*(s32*)&self->ext.generic.unk7C.s;
|
||||
if (func_801C02F4(&D_80182000, 0) & 255) {
|
||||
prim->y1 += 2;
|
||||
if (self->step_s == 0) {
|
||||
func_801C04F4(self, 1, 2, 0, 0, 3, 0);
|
||||
self->step_s = 1;
|
||||
}
|
||||
} else {
|
||||
self->velocityY += 0x400;
|
||||
self->posY.val += self->velocityY;
|
||||
if ((prim->y0 - prim->y1) >= 9) {
|
||||
prim->y1 = prim->y0 - 8;
|
||||
}
|
||||
}
|
||||
|
||||
prim->x0 = self->posX.i.hi;
|
||||
prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = self->posY.i.hi;
|
||||
|
||||
if (prim->y0 < prim->y1) {
|
||||
g_api.FreePrimitives(self->primIndex);
|
||||
DestroyEntity(self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool func_801C0B20(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;
|
||||
}
|
||||
|
||||
u8 func_801C0C1C(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 "../entity_intense_explosion.h"
|
||||
|
||||
void func_801C129C(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->unk6C = 0xF0;
|
||||
entity->unk1A = 0x1A0;
|
||||
entity->unk1C = 0x1A0;
|
||||
entity->animSet = ANIMSET_DRA(8);
|
||||
entity->animCurFrame = 1;
|
||||
entity->zPriority += 0x10;
|
||||
|
||||
if (entity->params != 0) {
|
||||
entity->palette = entity->params;
|
||||
} else {
|
||||
entity->palette = 0x8160;
|
||||
}
|
||||
|
||||
entity->step++;
|
||||
} else {
|
||||
MoveEntity();
|
||||
if (!AnimateEntity(D_80182008, entity)) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C1368(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_801C1848(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(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C14E8(Entity* self) {
|
||||
s32 velocityX;
|
||||
s32 velocityY;
|
||||
s32 temp;
|
||||
|
||||
if (self->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
self->animSet = ANIMSET_DRA(2);
|
||||
self->palette = 0x81B6;
|
||||
self->unk6C = 0x70;
|
||||
self->zPriority = 192;
|
||||
self->unk19 |= 0xC;
|
||||
self->blendMode |= 0x30;
|
||||
|
||||
switch (self->ext.generic.unk84.U8.unk0) {
|
||||
case 1:
|
||||
if (self->ext.generic.unk84.U8.unk1 >= 4) {
|
||||
self->ext.generic.unk84.U8.unk1 += 253;
|
||||
self->ext.generic.unk80.modeS16.unk0 -= 0x800;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
self->ext.generic.unk80.modeS16.unk0 +=
|
||||
self->ext.generic.unk84.U8.unk1 * 192;
|
||||
break;
|
||||
}
|
||||
|
||||
self->rotAngle = self->ext.generic.unk80.modeS16.unk0 &= 0xFFF;
|
||||
temp = (self->ext.generic.unk84.U8.unk1 * 320) / 24;
|
||||
self->velocityX = temp * rsin(self->ext.generic.unk80.modeS16.unk0);
|
||||
self->velocityY = -(temp * rcos(self->ext.generic.unk80.modeS16.unk0));
|
||||
}
|
||||
|
||||
if (self->animFrameIdx >= 13) {
|
||||
velocityX = self->velocityX;
|
||||
if (velocityX < 0) {
|
||||
velocityX += 3;
|
||||
}
|
||||
|
||||
velocityY = self->velocityY;
|
||||
self->velocityX = (velocityX >> 2) * 3;
|
||||
if (velocityY < 0) {
|
||||
velocityY += 3;
|
||||
}
|
||||
self->velocityY = (velocityY >> 2) * 3;
|
||||
}
|
||||
|
||||
MoveEntity();
|
||||
|
||||
if (AnimateEntity(D_80181EA8, self) == 0) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801C16C0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801C1CA0);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C2598(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C2690(Primitive* prim) {
|
||||
u8 xPos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
switch (prim->p3) {
|
||||
case 0:
|
||||
if (prim->p1 < 0x80) {
|
||||
if (--prim->p1 == 0) {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
} else {
|
||||
if (++prim->p1 == 0) {
|
||||
prim->p3 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
u8* dst = prim->p3 == 1 ? &prim->r1 : &prim->r0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
dst[j] = 0x50;
|
||||
}
|
||||
dst += 0x18;
|
||||
}
|
||||
prim->p2 = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 + xPos;
|
||||
prim->x1 = prim->x1 + xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 - xPos;
|
||||
prim->x1 = prim->x1 - xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", EntityStageNamePopup);
|
||||
|
||||
// The white flying orbs of energy that Alucard summons as part of the Soul
|
||||
// Steal spell
|
||||
void EntitySoulStealOrb(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
u16* temp_d;
|
||||
u16 temp_e;
|
||||
s32 temp_a;
|
||||
s32 temp_b;
|
||||
u16 angle;
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
InitializeEntity(g_InitializeData0);
|
||||
D_8008701E[primIndex * 0x1a] = 8;
|
||||
self->primIndex = primIndex;
|
||||
self->animSet = ANIMSET_DRA(0);
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
angle = func_801BD034(self, &g_Entities[PLAYER_CHARACTER]);
|
||||
temp_a = self->posY.i.hi < 113;
|
||||
temp_b = temp_a ^ 1;
|
||||
if (self->posX.i.hi < g_Entities[PLAYER_CHARACTER].posX.i.hi) {
|
||||
temp_b = temp_a;
|
||||
}
|
||||
if (temp_b & 0xFFFF) {
|
||||
self->ext.soulStealOrb.angle = angle - D_8018205C[Random() & 7];
|
||||
} else {
|
||||
angle += D_8018205C[Random() & 7];
|
||||
self->ext.soulStealOrb.angle = angle;
|
||||
}
|
||||
self->ext.soulStealOrb.unk80 = 0x400;
|
||||
self->ext.soulStealOrb.unk7E = 0;
|
||||
self->hitboxState = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
self->ext.soulStealOrb.unk82++;
|
||||
if (self->ext.soulStealOrb.unk82 == 16) {
|
||||
self->hitboxState = 1;
|
||||
}
|
||||
if (self->hitFlags != 0) {
|
||||
if (g_Player.unk56 == 0) {
|
||||
g_Player.unk56 = 1;
|
||||
g_Player.unk58 = 8;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->unk1A < 0x100) {
|
||||
self->unk1A = (self->unk1C += 0x10);
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk7E < 0x200) {
|
||||
self->ext.soulStealOrb.unk7E += 2;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk80 < 0x800) {
|
||||
self->ext.soulStealOrb.unk80 += 4;
|
||||
}
|
||||
self->ext.soulStealOrb.angle = func_801BD0B4(
|
||||
self->ext.soulStealOrb.unk7E, (u16)self->ext.soulStealOrb.angle,
|
||||
0xffff & func_801BD034(self, &g_Entities[PLAYER_CHARACTER]));
|
||||
UnkEntityFunc0(self->ext.soulStealOrb.angle & 0xFFFF,
|
||||
self->ext.soulStealOrb.unk80);
|
||||
MoveEntity(self);
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
AnimateEntity(&D_801820CC, self);
|
||||
angle = (float)((u32)self);
|
||||
prim->tpage = 0x18;
|
||||
prim->clut = 0x194;
|
||||
temp_d = &D_8018206C[(u16)((8 * ((u16)self->animCurFrame)) - 8)];
|
||||
prim->x0 = (prim->x2 = self->posX.i.hi + (*(temp_d++)));
|
||||
prim->y0 = (prim->y1 = self->posY.i.hi + (*(temp_d++)));
|
||||
prim->x1 = (prim->x3 = prim->x0 + (*(temp_d++)));
|
||||
prim->y2 = (prim->y3 = prim->y0 + (*(temp_d++)));
|
||||
prim->u0 = (prim->u2 = *(temp_d++));
|
||||
prim->v0 = (prim->v1 = *(temp_d++));
|
||||
prim->u1 = (prim->u3 = *(temp_d++));
|
||||
prim->v2 = (prim->v3 = *(temp_d++));
|
||||
prim->priority = self->zPriority;
|
||||
prim->blendMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../entity_enemy_blood.h"
|
||||
|
||||
extern ObjInit2 D_801820F0[];
|
||||
void EntityRoomForeground(Entity* entity) {
|
||||
ObjInit2* objInit = &D_801820F0[entity->params];
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(D_80180A90);
|
||||
entity->animSet = objInit->animSet;
|
||||
entity->zPriority = objInit->zPriority;
|
||||
entity->unk5A = objInit->unk4.s;
|
||||
entity->palette = objInit->palette;
|
||||
entity->unk19 = objInit->unk8;
|
||||
entity->blendMode = objInit->blendMode;
|
||||
if (objInit->unkC != 0) {
|
||||
entity->flags = objInit->unkC;
|
||||
}
|
||||
if (entity->params >= 5) {
|
||||
entity->rotAngle = 0x800;
|
||||
entity->unk19 |= 4;
|
||||
}
|
||||
}
|
||||
AnimateEntity(objInit->unk10, entity);
|
||||
}
|
||||
|
||||
void BottomCornerText(u8* str, u8 lower_left) {
|
||||
u8 toPrint[64];
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
u32 ch;
|
||||
u8* chIdx = &toPrint;
|
||||
|
||||
u16 textWidth = 0;
|
||||
// serves two purposes, use #define for dual names
|
||||
u16 dualVar = 0;
|
||||
#define charcount dualVar
|
||||
|
||||
// Clear out the toPrint array
|
||||
for (i = 0; i < 64; i++) {
|
||||
*chIdx++ = 0;
|
||||
}
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
|
||||
while (1) {
|
||||
i = 0;
|
||||
// Copy values from the incoming arg0 array to the local array, until we
|
||||
// get a 0xFF followed by a 0
|
||||
ch = *str++;
|
||||
if (ch == 0xFF) {
|
||||
ch = *str++;
|
||||
if (ch == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*chIdx = ch;
|
||||
chIdx++;
|
||||
if (ch != 0) {
|
||||
charcount += 1;
|
||||
textWidth += 8;
|
||||
} else {
|
||||
textWidth += 4;
|
||||
}
|
||||
}
|
||||
|
||||
g_BottomCornerTextPrims = g_api_AllocPrimitives(PRIM_SPRT, charcount + 4);
|
||||
if (g_BottomCornerTextPrims == -1) {
|
||||
return;
|
||||
}
|
||||
#undef charcount
|
||||
|
||||
prim = &g_PrimBuf[g_BottomCornerTextPrims];
|
||||
prim->type = 3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
|
||||
if (lower_left) {
|
||||
prim->b0 = prim->b1 = 0xAF;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = 0x5F;
|
||||
}
|
||||
|
||||
#define xpos dualVar
|
||||
if (lower_left) {
|
||||
xpos = 7;
|
||||
textWidth += 4;
|
||||
} else {
|
||||
xpos = 0xD4 - textWidth;
|
||||
}
|
||||
|
||||
prim->x0 = prim->x2 = xpos;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x20;
|
||||
prim->y0 = prim->y1 = 0xD0;
|
||||
prim->y2 = prim->y3 = 0xDF;
|
||||
prim->priority = 0x1EE;
|
||||
prim->blendMode = 0x11;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos - 6;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0x80;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos + textWidth + 0x16;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0xA8;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->type = 4;
|
||||
prim->y0 = prim->y1 = 0xCD;
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->y2 = prim->y3 = 0xE1;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
prim->u1 = prim->u3 = 0x9C;
|
||||
prim->v0 = prim->v1 = 2;
|
||||
prim->x0 = prim->x2 = xpos + 0xA;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x18;
|
||||
prim->v2 = prim->v3 = 0x16;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
|
||||
xpos += 0x10;
|
||||
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
for (prim = prim->next; prim != NULL;) {
|
||||
ch = *chIdx++;
|
||||
if (ch != 0) {
|
||||
prim->x0 = xpos;
|
||||
prim->u0 = (ch & 0xF) * 8;
|
||||
prim->tpage = 0x1E;
|
||||
prim->clut = 0x196;
|
||||
prim->v0 = (ch & 0xF0) >> 1;
|
||||
prim->v1 = 8;
|
||||
prim->u1 = 8;
|
||||
prim->priority = 0x1F0;
|
||||
prim->blendMode = 0;
|
||||
prim->y0 = 0xD4;
|
||||
prim = prim->next;
|
||||
xpos += 8;
|
||||
} else {
|
||||
xpos += 4;
|
||||
}
|
||||
}
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801C4144);
|
||||
|
||||
// ID 0x2C
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", func_801C424C);
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3DEF4", BlitChar);
|
||||
|
905
src/st/np3/3FC70.c
Normal file
905
src/st/np3/3FC70.c
Normal file
@ -0,0 +1,905 @@
|
||||
#include "np3.h"
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 0x30;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 0x30;
|
||||
var_a0 = D_80181618[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", EntityUnkId0E);
|
||||
|
||||
u8 func_801C02F4(s16* arg0, u8 facing) {
|
||||
u8 ret = 0;
|
||||
Collider collider;
|
||||
s16 posX, posY;
|
||||
|
||||
while (*arg0 != 0xFF) {
|
||||
ret <<= 1;
|
||||
|
||||
posX = facing ? (g_CurrentEntity->posX.i.hi + *arg0++)
|
||||
: (g_CurrentEntity->posX.i.hi - *arg0++);
|
||||
posY = g_CurrentEntity->posY.i.hi + *arg0++;
|
||||
|
||||
g_api.CheckCollision(posX, posY, &collider, 0);
|
||||
|
||||
if (collider.effects & EFFECT_SOLID) {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void func_801C03E4(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180A78);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", func_801C04F4);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", func_801C0624);
|
||||
|
||||
void func_801C070C(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
entity->velocityY = D_80181FDC[entity->ext.generic.unk94];
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(2);
|
||||
entity->animCurFrame = D_80181FF4[entity->params];
|
||||
entity->blendMode = 0x10;
|
||||
entity->step++;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (D_80181FF8[entity->params] < (s32)entity->animFrameDuration) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C07FC(Entity* entity) {
|
||||
u16 temp_v0;
|
||||
u32 temp2;
|
||||
|
||||
if (entity->step == 0) {
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x10;
|
||||
entity->unk19 = 3;
|
||||
temp_v0 = D_80181FB4[entity->params];
|
||||
entity->unk1A = temp_v0;
|
||||
entity->unk1C = temp_v0;
|
||||
temp2 = D_80181FC4[entity->params];
|
||||
entity->step += 1;
|
||||
entity->velocityY = temp2;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C08F0(Entity* self) {
|
||||
s16 primIndex;
|
||||
Primitive* prim;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, 1);
|
||||
if (primIndex != -1) {
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
self->primIndex = primIndex;
|
||||
self->hitboxState = 0;
|
||||
*(s32*)&self->ext.generic.unk7C = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
while (prim != NULL) {
|
||||
prim->x0 = prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = prim->y1 = self->posY.i.hi;
|
||||
prim->r0 = 64;
|
||||
prim->r1 = 0;
|
||||
prim->g0 = 64;
|
||||
prim->g1 = 0;
|
||||
prim->b0 = 255;
|
||||
prim->b1 = 16;
|
||||
prim->priority = self->zPriority + 1;
|
||||
prim->blendMode |= 0x37;
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
prim = (Primitive*)*(s32*)&self->ext.generic.unk7C.s;
|
||||
if (func_801C02F4(&D_80182000, 0) & 255) {
|
||||
prim->y1 += 2;
|
||||
if (self->step_s == 0) {
|
||||
func_801C04F4(self, 1, 2, 0, 0, 3, 0);
|
||||
self->step_s = 1;
|
||||
}
|
||||
} else {
|
||||
self->velocityY += 0x400;
|
||||
self->posY.val += self->velocityY;
|
||||
if ((prim->y0 - prim->y1) >= 9) {
|
||||
prim->y1 = prim->y0 - 8;
|
||||
}
|
||||
}
|
||||
|
||||
prim->x0 = self->posX.i.hi;
|
||||
prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = self->posY.i.hi;
|
||||
|
||||
if (prim->y0 < prim->y1) {
|
||||
g_api.FreePrimitives(self->primIndex);
|
||||
DestroyEntity(self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool func_801C0B20(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;
|
||||
}
|
||||
|
||||
u8 func_801C0C1C(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 "../entity_intense_explosion.h"
|
||||
|
||||
void func_801C129C(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->unk6C = 0xF0;
|
||||
entity->unk1A = 0x1A0;
|
||||
entity->unk1C = 0x1A0;
|
||||
entity->animSet = ANIMSET_DRA(8);
|
||||
entity->animCurFrame = 1;
|
||||
entity->zPriority += 0x10;
|
||||
|
||||
if (entity->params != 0) {
|
||||
entity->palette = entity->params;
|
||||
} else {
|
||||
entity->palette = 0x8160;
|
||||
}
|
||||
|
||||
entity->step++;
|
||||
} else {
|
||||
MoveEntity();
|
||||
if (!AnimateEntity(D_80182008, entity)) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C1368(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_801C1848(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(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C14E8(Entity* self) {
|
||||
s32 velocityX;
|
||||
s32 velocityY;
|
||||
s32 temp;
|
||||
|
||||
if (self->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
self->animSet = ANIMSET_DRA(2);
|
||||
self->palette = 0x81B6;
|
||||
self->unk6C = 0x70;
|
||||
self->zPriority = 192;
|
||||
self->unk19 |= 0xC;
|
||||
self->blendMode |= 0x30;
|
||||
|
||||
switch (self->ext.generic.unk84.U8.unk0) {
|
||||
case 1:
|
||||
if (self->ext.generic.unk84.U8.unk1 >= 4) {
|
||||
self->ext.generic.unk84.U8.unk1 += 253;
|
||||
self->ext.generic.unk80.modeS16.unk0 -= 0x800;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
self->ext.generic.unk80.modeS16.unk0 +=
|
||||
self->ext.generic.unk84.U8.unk1 * 192;
|
||||
break;
|
||||
}
|
||||
|
||||
self->rotAngle = self->ext.generic.unk80.modeS16.unk0 &= 0xFFF;
|
||||
temp = (self->ext.generic.unk84.U8.unk1 * 320) / 24;
|
||||
self->velocityX = temp * rsin(self->ext.generic.unk80.modeS16.unk0);
|
||||
self->velocityY = -(temp * rcos(self->ext.generic.unk80.modeS16.unk0));
|
||||
}
|
||||
|
||||
if (self->animFrameIdx >= 13) {
|
||||
velocityX = self->velocityX;
|
||||
if (velocityX < 0) {
|
||||
velocityX += 3;
|
||||
}
|
||||
|
||||
velocityY = self->velocityY;
|
||||
self->velocityX = (velocityX >> 2) * 3;
|
||||
if (velocityY < 0) {
|
||||
velocityY += 3;
|
||||
}
|
||||
self->velocityY = (velocityY >> 2) * 3;
|
||||
}
|
||||
|
||||
MoveEntity();
|
||||
|
||||
if (AnimateEntity(D_80181EA8, self) == 0) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", func_801C16C0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", func_801C1CA0);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C2598(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C2690(Primitive* prim) {
|
||||
u8 xPos;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
switch (prim->p3) {
|
||||
case 0:
|
||||
if (prim->p1 < 0x80) {
|
||||
if (--prim->p1 == 0) {
|
||||
prim->p3 = 1;
|
||||
}
|
||||
} else {
|
||||
if (++prim->p1 == 0) {
|
||||
prim->p3 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 != 0) {
|
||||
u8* dst = prim->p3 == 1 ? &prim->r1 : &prim->r0;
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
dst[j] = 0x50;
|
||||
}
|
||||
dst += 0x18;
|
||||
}
|
||||
prim->p2 = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 + xPos;
|
||||
prim->x1 = prim->x1 + xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
case 2:
|
||||
if (prim->p2 < 0x14) {
|
||||
prim->p2++;
|
||||
}
|
||||
xPos = prim->p2 / 5;
|
||||
prim->x2 = prim->x0 = prim->x0 - xPos;
|
||||
prim->x1 = prim->x1 - xPos;
|
||||
prim->x3 = prim->x0;
|
||||
UnkLoopFunc(prim, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", EntityStageNamePopup);
|
||||
|
||||
// The white flying orbs of energy that Alucard summons as part of the Soul
|
||||
// Steal spell
|
||||
void EntitySoulStealOrb(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
u16* temp_d;
|
||||
u16 temp_e;
|
||||
s32 temp_a;
|
||||
s32 temp_b;
|
||||
u16 angle;
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
InitializeEntity(g_InitializeData0);
|
||||
D_8008701E[primIndex * 0x1a] = 8;
|
||||
self->primIndex = primIndex;
|
||||
self->animSet = ANIMSET_DRA(0);
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
angle = func_801BD034(self, &g_Entities[PLAYER_CHARACTER]);
|
||||
temp_a = self->posY.i.hi < 113;
|
||||
temp_b = temp_a ^ 1;
|
||||
if (self->posX.i.hi < g_Entities[PLAYER_CHARACTER].posX.i.hi) {
|
||||
temp_b = temp_a;
|
||||
}
|
||||
if (temp_b & 0xFFFF) {
|
||||
self->ext.soulStealOrb.angle = angle - D_8018205C[Random() & 7];
|
||||
} else {
|
||||
angle += D_8018205C[Random() & 7];
|
||||
self->ext.soulStealOrb.angle = angle;
|
||||
}
|
||||
self->ext.soulStealOrb.unk80 = 0x400;
|
||||
self->ext.soulStealOrb.unk7E = 0;
|
||||
self->hitboxState = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
self->ext.soulStealOrb.unk82++;
|
||||
if (self->ext.soulStealOrb.unk82 == 16) {
|
||||
self->hitboxState = 1;
|
||||
}
|
||||
if (self->hitFlags != 0) {
|
||||
if (g_Player.unk56 == 0) {
|
||||
g_Player.unk56 = 1;
|
||||
g_Player.unk58 = 8;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->unk1A < 0x100) {
|
||||
self->unk1A = (self->unk1C += 0x10);
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk7E < 0x200) {
|
||||
self->ext.soulStealOrb.unk7E += 2;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk80 < 0x800) {
|
||||
self->ext.soulStealOrb.unk80 += 4;
|
||||
}
|
||||
self->ext.soulStealOrb.angle = func_801BD0B4(
|
||||
self->ext.soulStealOrb.unk7E, (u16)self->ext.soulStealOrb.angle,
|
||||
0xffff & func_801BD034(self, &g_Entities[PLAYER_CHARACTER]));
|
||||
UnkEntityFunc0(self->ext.soulStealOrb.angle & 0xFFFF,
|
||||
self->ext.soulStealOrb.unk80);
|
||||
MoveEntity(self);
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
AnimateEntity(&D_801820CC, self);
|
||||
angle = (float)((u32)self);
|
||||
prim->tpage = 0x18;
|
||||
prim->clut = 0x194;
|
||||
temp_d = &D_8018206C[(u16)((8 * ((u16)self->animCurFrame)) - 8)];
|
||||
prim->x0 = (prim->x2 = self->posX.i.hi + (*(temp_d++)));
|
||||
prim->y0 = (prim->y1 = self->posY.i.hi + (*(temp_d++)));
|
||||
prim->x1 = (prim->x3 = prim->x0 + (*(temp_d++)));
|
||||
prim->y2 = (prim->y3 = prim->y0 + (*(temp_d++)));
|
||||
prim->u0 = (prim->u2 = *(temp_d++));
|
||||
prim->v0 = (prim->v1 = *(temp_d++));
|
||||
prim->u1 = (prim->u3 = *(temp_d++));
|
||||
prim->v2 = (prim->v3 = *(temp_d++));
|
||||
prim->priority = self->zPriority;
|
||||
prim->blendMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../entity_enemy_blood.h"
|
||||
|
||||
extern ObjInit2 D_801820F0[];
|
||||
void EntityRoomForeground(Entity* entity) {
|
||||
ObjInit2* objInit = &D_801820F0[entity->params];
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(D_80180A90);
|
||||
entity->animSet = objInit->animSet;
|
||||
entity->zPriority = objInit->zPriority;
|
||||
entity->unk5A = objInit->unk4.s;
|
||||
entity->palette = objInit->palette;
|
||||
entity->unk19 = objInit->unk8;
|
||||
entity->blendMode = objInit->blendMode;
|
||||
if (objInit->unkC != 0) {
|
||||
entity->flags = objInit->unkC;
|
||||
}
|
||||
if (entity->params >= 5) {
|
||||
entity->rotAngle = 0x800;
|
||||
entity->unk19 |= 4;
|
||||
}
|
||||
}
|
||||
AnimateEntity(objInit->unk10, entity);
|
||||
}
|
||||
|
||||
void BottomCornerText(u8* str, u8 lower_left) {
|
||||
u8 toPrint[64];
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
u32 ch;
|
||||
u8* chIdx = &toPrint;
|
||||
|
||||
u16 textWidth = 0;
|
||||
// serves two purposes, use #define for dual names
|
||||
u16 dualVar = 0;
|
||||
#define charcount dualVar
|
||||
|
||||
// Clear out the toPrint array
|
||||
for (i = 0; i < 64; i++) {
|
||||
*chIdx++ = 0;
|
||||
}
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
|
||||
while (1) {
|
||||
i = 0;
|
||||
// Copy values from the incoming arg0 array to the local array, until we
|
||||
// get a 0xFF followed by a 0
|
||||
ch = *str++;
|
||||
if (ch == 0xFF) {
|
||||
ch = *str++;
|
||||
if (ch == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*chIdx = ch;
|
||||
chIdx++;
|
||||
if (ch != 0) {
|
||||
charcount += 1;
|
||||
textWidth += 8;
|
||||
} else {
|
||||
textWidth += 4;
|
||||
}
|
||||
}
|
||||
|
||||
g_BottomCornerTextPrims = g_api_AllocPrimitives(PRIM_SPRT, charcount + 4);
|
||||
if (g_BottomCornerTextPrims == -1) {
|
||||
return;
|
||||
}
|
||||
#undef charcount
|
||||
|
||||
prim = &g_PrimBuf[g_BottomCornerTextPrims];
|
||||
prim->type = 3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
|
||||
if (lower_left) {
|
||||
prim->b0 = prim->b1 = 0xAF;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = 0x5F;
|
||||
}
|
||||
|
||||
#define xpos dualVar
|
||||
if (lower_left) {
|
||||
xpos = 7;
|
||||
textWidth += 4;
|
||||
} else {
|
||||
xpos = 0xD4 - textWidth;
|
||||
}
|
||||
|
||||
prim->x0 = prim->x2 = xpos;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x20;
|
||||
prim->y0 = prim->y1 = 0xD0;
|
||||
prim->y2 = prim->y3 = 0xDF;
|
||||
prim->priority = 0x1EE;
|
||||
prim->blendMode = 0x11;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos - 6;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0x80;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos + textWidth + 0x16;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0xA8;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->type = 4;
|
||||
prim->y0 = prim->y1 = 0xCD;
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->y2 = prim->y3 = 0xE1;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
prim->u1 = prim->u3 = 0x9C;
|
||||
prim->v0 = prim->v1 = 2;
|
||||
prim->x0 = prim->x2 = xpos + 0xA;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x18;
|
||||
prim->v2 = prim->v3 = 0x16;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
|
||||
xpos += 0x10;
|
||||
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
for (prim = prim->next; prim != NULL;) {
|
||||
ch = *chIdx++;
|
||||
if (ch != 0) {
|
||||
prim->x0 = xpos;
|
||||
prim->u0 = (ch & 0xF) * 8;
|
||||
prim->tpage = 0x1E;
|
||||
prim->clut = 0x196;
|
||||
prim->v0 = (ch & 0xF0) >> 1;
|
||||
prim->v1 = 8;
|
||||
prim->u1 = 8;
|
||||
prim->priority = 0x1F0;
|
||||
prim->blendMode = 0;
|
||||
prim->y0 = 0xD4;
|
||||
prim = prim->next;
|
||||
xpos += 8;
|
||||
} else {
|
||||
xpos += 4;
|
||||
}
|
||||
}
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", func_801C4144);
|
||||
|
||||
// ID 0x2C
|
||||
INCLUDE_ASM("asm/us/st/np3/nonmatchings/3FC70", func_801C424C);
|
3
src/st/np3/entity_relic_orb.c
Normal file
3
src/st/np3/entity_relic_orb.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "np3.h"
|
||||
|
||||
#include "../entity_relic_orb.h"
|
@ -292,7 +292,7 @@ extern s32 D_801D337C;
|
||||
extern s32 D_801D3380;
|
||||
extern s32 D_801D3384;
|
||||
extern s32 D_801D3388;
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
extern s32 D_801825D4;
|
||||
extern u16 D_801825E4[];
|
||||
extern u8 D_801825EC[]; // Animation: Walking
|
||||
|
@ -247,7 +247,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_801BEC7C(Entity* entity, s32 arg1) {
|
||||
void BlinkItem(Entity* entity, s32 arg1) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
@ -462,915 +462,8 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
if (self->ext.generic.unk7C.u != 0) {
|
||||
self->ext.generic.unk7C.u--;
|
||||
}
|
||||
func_801BEC7C(self, self->ext.generic.unk7C.u);
|
||||
BlinkItem(self, self->ext.generic.unk7C.u);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", func_801BF308);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", EntityRelicOrb);
|
||||
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 248;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 248;
|
||||
var_a0 = D_801813B0[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", EntityUnkId0E);
|
||||
|
||||
u8 func_801C070C(s16* arg0, u8 facing) {
|
||||
u8 ret = 0;
|
||||
Collider collider;
|
||||
s16 posX, posY;
|
||||
|
||||
while (*arg0 != 0xFF) {
|
||||
ret <<= 1;
|
||||
|
||||
posX = facing ? (g_CurrentEntity->posX.i.hi + *arg0++)
|
||||
: (g_CurrentEntity->posX.i.hi - *arg0++);
|
||||
posY = g_CurrentEntity->posY.i.hi + *arg0++;
|
||||
|
||||
g_api.CheckCollision(posX, posY, &collider, 0);
|
||||
|
||||
if (collider.effects & EFFECT_SOLID) {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void func_801C07FC(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180C04);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C090C(
|
||||
Entity* self, u8 count, u8 params, s32 x, s32 y, u8 arg5, s16 xGap) {
|
||||
Entity* newEntity;
|
||||
s32 i;
|
||||
s16 newX = self->posX.i.hi + x;
|
||||
s16 newY = self->posY.i.hi + y;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]);
|
||||
if (newEntity != NULL) {
|
||||
newEntity->posX.i.hi = newX + xGap * i;
|
||||
newEntity->posY.i.hi = newY;
|
||||
newEntity->entityId = E_ID14;
|
||||
newEntity->pfnUpdate = func_801C0B24;
|
||||
newEntity->params = params;
|
||||
newEntity->ext.generic.unk94 = arg5 + i;
|
||||
newEntity->unk1C = newEntity->unk1A = D_80181ECC[arg5 + i];
|
||||
newEntity->unk19 = 3;
|
||||
newEntity->zPriority = self->zPriority + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", func_801C0A3C);
|
||||
|
||||
void func_801C0B24(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
entity->velocityY = D_80181F04[entity->ext.generic.unk94];
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(2);
|
||||
entity->animCurFrame = D_80181F1C[entity->params];
|
||||
entity->blendMode = 0x10;
|
||||
entity->step++;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (D_80181F20[entity->params] < (s32)entity->animFrameDuration) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C0C14(Entity* entity) {
|
||||
u16 temp_v0;
|
||||
u32 temp2;
|
||||
|
||||
if (entity->step == 0) {
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x10;
|
||||
entity->unk19 = 3;
|
||||
temp_v0 = D_80181EDC[entity->params];
|
||||
entity->unk1A = temp_v0;
|
||||
entity->unk1C = temp_v0;
|
||||
temp2 = D_80181EEC[entity->params];
|
||||
entity->step++;
|
||||
entity->velocityY = temp2;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C0D08(Entity* self) {
|
||||
s16 primIndex;
|
||||
Primitive* prim;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, 1);
|
||||
if (primIndex == -1) {
|
||||
return;
|
||||
}
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
self->primIndex = primIndex;
|
||||
self->hitboxState = 0;
|
||||
*(s32*)&self->ext.generic.unk7C = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
while (prim != NULL) {
|
||||
prim->x0 = prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = prim->y1 = self->posY.i.hi;
|
||||
prim->r0 = 64;
|
||||
prim->r1 = 0;
|
||||
prim->g0 = 64;
|
||||
prim->g1 = 0;
|
||||
prim->b0 = 255;
|
||||
prim->b1 = 16;
|
||||
prim->priority = self->zPriority + 1;
|
||||
prim->blendMode |= 0x37;
|
||||
prim = prim->next;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
prim = (Primitive*)*(s32*)&self->ext.generic.unk7C.s;
|
||||
if (func_801C070C(&D_80181F28, 0) & 255) {
|
||||
prim->y1 += 2;
|
||||
if (self->step_s == 0) {
|
||||
func_801C090C(self, 1, 2, 0, 0, 3, 0);
|
||||
self->step_s = 1;
|
||||
}
|
||||
} else {
|
||||
self->velocityY += 0x400;
|
||||
self->posY.val += self->velocityY;
|
||||
if ((prim->y0 - prim->y1) >= 9) {
|
||||
prim->y1 = prim->y0 - 8;
|
||||
}
|
||||
}
|
||||
|
||||
prim->x0 = self->posX.i.hi;
|
||||
prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = self->posY.i.hi;
|
||||
|
||||
if (prim->y0 < prim->y1) {
|
||||
g_api.FreePrimitives(self->primIndex);
|
||||
DestroyEntity(self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool func_801C0F38(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void EntityIntenseExplosion(Entity* entity) {
|
||||
u32 temp_v0;
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->palette = 0x8170;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x30;
|
||||
|
||||
if (entity->params & 0xF0) {
|
||||
entity->palette = 0x8195;
|
||||
entity->blendMode = 0x10;
|
||||
}
|
||||
|
||||
temp_v0 = entity->params & 0xFF00;
|
||||
if (temp_v0 != 0) {
|
||||
entity->zPriority = temp_v0 >> 8;
|
||||
}
|
||||
|
||||
entity->zPriority += 8;
|
||||
return;
|
||||
}
|
||||
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= FIX(0.25);
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C16B4(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->unk6C = 0xF0;
|
||||
entity->unk1A = 0x1A0;
|
||||
entity->unk1C = 0x1A0;
|
||||
entity->animSet = ANIMSET_DRA(8);
|
||||
entity->animCurFrame = 1;
|
||||
entity->zPriority += 0x10;
|
||||
|
||||
if (entity->params != 0) {
|
||||
entity->palette = entity->params;
|
||||
} else {
|
||||
entity->palette = 0x8160;
|
||||
}
|
||||
|
||||
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_801C1848(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(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C1900(Entity* self) {
|
||||
s32 velocityX;
|
||||
s32 velocityY;
|
||||
s32 temp;
|
||||
|
||||
if (self->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
self->animSet = ANIMSET_DRA(2);
|
||||
self->palette = 0x81B6;
|
||||
self->unk6C = 0x70;
|
||||
self->zPriority = 192;
|
||||
self->unk19 |= 0xC;
|
||||
self->blendMode |= 0x30;
|
||||
|
||||
switch (self->ext.generic.unk84.U8.unk0) {
|
||||
case 1:
|
||||
if (self->ext.generic.unk84.U8.unk1 >= 4) {
|
||||
self->ext.generic.unk84.U8.unk1 += 253;
|
||||
self->ext.generic.unk80.modeS16.unk0 -= 0x800;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
self->ext.generic.unk80.modeS16.unk0 +=
|
||||
self->ext.generic.unk84.U8.unk1 * 192;
|
||||
break;
|
||||
}
|
||||
|
||||
self->rotAngle = self->ext.generic.unk80.modeS16.unk0 &= 0xFFF;
|
||||
temp = (self->ext.generic.unk84.U8.unk1 * 320) / 24;
|
||||
self->velocityX = temp * rsin(self->ext.generic.unk80.modeS16.unk0);
|
||||
self->velocityY = -(temp * rcos(self->ext.generic.unk80.modeS16.unk0));
|
||||
}
|
||||
|
||||
if (self->animFrameIdx >= 13) {
|
||||
velocityX = self->velocityX;
|
||||
if (velocityX < 0) {
|
||||
velocityX += 3;
|
||||
}
|
||||
|
||||
velocityY = self->velocityY;
|
||||
self->velocityX = (velocityX >> 2) * 3;
|
||||
if (velocityY < 0) {
|
||||
velocityY += 3;
|
||||
}
|
||||
self->velocityY = (velocityY >> 2) * 3;
|
||||
}
|
||||
|
||||
MoveEntity();
|
||||
|
||||
if (AnimateEntity(D_80181DD0, self) == 0) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", func_801C1AD8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", func_801C20B8);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C29B0(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
// The white flying orbs of energy that Alucard summons as part of the Soul
|
||||
// Steal spell
|
||||
// TODO(sestren): Reconcile this func_801BD4CC with the one in 36DE4.c
|
||||
s16 func_801BD4CC(u16, u16, s32); /* extern */
|
||||
void EntitySoulStealOrb(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
u16 *temp_d, temp_e;
|
||||
s32 temp_a, temp_b;
|
||||
u16 angle;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
InitializeEntity(g_InitializeData0);
|
||||
D_8008701E[primIndex * 0x1a] = 8;
|
||||
self->primIndex = primIndex;
|
||||
self->animSet = ANIMSET_DRA(0);
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
angle = func_801BD44C(self, &PLAYER);
|
||||
temp_a = self->posY.i.hi < 113;
|
||||
temp_b = temp_a ^ 1;
|
||||
if (self->posX.i.hi < PLAYER.posX.i.hi) {
|
||||
temp_b = temp_a;
|
||||
}
|
||||
if (temp_b & 0xFFFF) {
|
||||
self->ext.soulStealOrb.angle = angle - D_80181F80[Random() & 7];
|
||||
} else {
|
||||
angle += D_80181F80[Random() & 7];
|
||||
self->ext.soulStealOrb.angle = angle;
|
||||
}
|
||||
self->ext.soulStealOrb.unk80 = 0x400;
|
||||
self->ext.soulStealOrb.unk7E = 0;
|
||||
self->hitboxState = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
self->ext.soulStealOrb.unk82++;
|
||||
if (self->ext.soulStealOrb.unk82 == 16) {
|
||||
self->hitboxState = 1;
|
||||
}
|
||||
if (self->hitFlags != 0) {
|
||||
if (g_Player.unk56 == 0) {
|
||||
g_Player.unk56 = 1;
|
||||
g_Player.unk58 = 8;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->unk1A < 0x100) {
|
||||
self->unk1A = self->unk1C += 0x10;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk7E < 0x200) {
|
||||
self->ext.soulStealOrb.unk7E += 2;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk80 < 0x800) {
|
||||
self->ext.soulStealOrb.unk80 += 4;
|
||||
}
|
||||
self->ext.soulStealOrb.angle = func_801BD4CC(
|
||||
self->ext.soulStealOrb.unk7E, self->ext.soulStealOrb.angle,
|
||||
0xffff & func_801BD44C(self, &PLAYER));
|
||||
UnkEntityFunc0(self->ext.soulStealOrb.angle & 0xFFFF,
|
||||
self->ext.soulStealOrb.unk80);
|
||||
MoveEntity(self); // argument pass necessary to match
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
AnimateEntity(&D_80181FF0, self);
|
||||
angle = (float)(u32)self; // !FAKE
|
||||
prim->tpage = 0x18;
|
||||
prim->clut = 0x194;
|
||||
temp_d = &D_80181F90[(u16)((8 * (u16)self->animCurFrame) - 8)];
|
||||
prim->x0 = prim->x2 = self->posX.i.hi + *(temp_d++);
|
||||
prim->y0 = prim->y1 = self->posY.i.hi + *(temp_d++);
|
||||
prim->x1 = prim->x3 = prim->x0 + *(temp_d++);
|
||||
prim->y2 = prim->y3 = prim->y0 + *(temp_d++);
|
||||
prim->u0 = prim->u2 = *(temp_d++);
|
||||
prim->v0 = prim->v1 = *(temp_d++);
|
||||
prim->u1 = prim->u3 = *(temp_d++);
|
||||
prim->v2 = prim->v3 = *(temp_d++);
|
||||
prim->priority = self->zPriority;
|
||||
prim->blendMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../entity_enemy_blood.h"
|
||||
|
||||
void EntityRoomForeground(Entity* entity) {
|
||||
ObjInit2* objInit = &D_80182014[entity->params];
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(D_80180C1C);
|
||||
entity->animSet = objInit->animSet;
|
||||
entity->zPriority = objInit->zPriority;
|
||||
entity->unk5A = objInit->unk4.s;
|
||||
entity->palette = objInit->palette;
|
||||
entity->unk19 = objInit->unk8;
|
||||
entity->blendMode = objInit->blendMode;
|
||||
|
||||
if (objInit->unkC != 0) {
|
||||
entity->flags = objInit->unkC;
|
||||
}
|
||||
|
||||
if (entity->params >= 5) {
|
||||
entity->rotAngle = 0x800;
|
||||
entity->unk19 |= 4;
|
||||
}
|
||||
}
|
||||
AnimateEntity(objInit->unk10, entity);
|
||||
}
|
||||
|
||||
void BottomCornerText(u8* str, u8 lower_left) {
|
||||
u8 toPrint[64];
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
u32 ch;
|
||||
u8* chIdx = &toPrint;
|
||||
|
||||
u16 textWidth = 0;
|
||||
// serves two purposes, use #define for dual names
|
||||
u16 dualVar = 0;
|
||||
#define charcount dualVar
|
||||
|
||||
// Clear out the toPrint array
|
||||
for (i = 0; i < 64; i++) {
|
||||
*chIdx++ = 0;
|
||||
}
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
|
||||
while (1) {
|
||||
i = 0;
|
||||
// Copy values from the incoming arg0 array to the local array, until we
|
||||
// get a 0xFF followed by a 0
|
||||
ch = *str++;
|
||||
if (ch == 0xFF) {
|
||||
ch = *str++;
|
||||
if (ch == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*chIdx = ch;
|
||||
chIdx++;
|
||||
if (ch != 0) {
|
||||
charcount += 1;
|
||||
textWidth += 8;
|
||||
} else {
|
||||
textWidth += 4;
|
||||
}
|
||||
}
|
||||
|
||||
g_BottomCornerTextPrims = g_api_AllocPrimitives(PRIM_SPRT, charcount + 4);
|
||||
if (g_BottomCornerTextPrims == -1) {
|
||||
return;
|
||||
}
|
||||
#undef charcount
|
||||
|
||||
prim = &g_PrimBuf[g_BottomCornerTextPrims];
|
||||
prim->type = 3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
|
||||
if (lower_left) {
|
||||
prim->b0 = prim->b1 = 0xAF;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = 0x5F;
|
||||
}
|
||||
|
||||
#define xpos dualVar
|
||||
if (lower_left) {
|
||||
xpos = 7;
|
||||
textWidth += 4;
|
||||
} else {
|
||||
xpos = 0xD4 - textWidth;
|
||||
}
|
||||
|
||||
prim->x0 = prim->x2 = xpos;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x20;
|
||||
prim->y0 = prim->y1 = 0xD0;
|
||||
prim->y2 = prim->y3 = 0xDF;
|
||||
prim->priority = 0x1EE;
|
||||
prim->blendMode = 0x11;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos - 6;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0x80;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos + textWidth + 0x16;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0xA8;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->type = 4;
|
||||
prim->y0 = prim->y1 = 0xCD;
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->y2 = prim->y3 = 0xE1;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
prim->u1 = prim->u3 = 0x9C;
|
||||
prim->v0 = prim->v1 = 2;
|
||||
prim->x0 = prim->x2 = xpos + 0xA;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x18;
|
||||
prim->v2 = prim->v3 = 0x16;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
|
||||
xpos += 0x10;
|
||||
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
for (prim = prim->next; prim != NULL;) {
|
||||
ch = *chIdx++;
|
||||
if (ch != 0) {
|
||||
prim->x0 = xpos;
|
||||
prim->u0 = (ch & 0xF) * 8;
|
||||
prim->tpage = 0x1E;
|
||||
prim->clut = 0x196;
|
||||
prim->v0 = (ch & 0xF0) >> 1;
|
||||
prim->v1 = 8;
|
||||
prim->u1 = 8;
|
||||
prim->priority = 0x1F0;
|
||||
prim->blendMode = 0;
|
||||
prim->y0 = 0xD4;
|
||||
prim = prim->next;
|
||||
xpos += 8;
|
||||
} else {
|
||||
xpos += 4;
|
||||
}
|
||||
}
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/3E30C", BlitChar);
|
||||
|
906
src/st/nz0/40088.c
Normal file
906
src/st/nz0/40088.c
Normal file
@ -0,0 +1,906 @@
|
||||
#include "nz0.h"
|
||||
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
u16 temp_a0_2;
|
||||
u16 var_a0;
|
||||
|
||||
if (self->step == 0) {
|
||||
temp_a0 = self->params + 248;
|
||||
self->ext.generic.unkB4 = temp_a0;
|
||||
if ((D_8003BEEC[temp_a0 >> 3] >> (temp_a0 & 7)) & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
temp_a0_2 = temp_a0 - 248;
|
||||
var_a0 = D_801813B0[temp_a0_2];
|
||||
if (var_a0 < 128) {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityPrizeDrop;
|
||||
} else {
|
||||
self->ext.generic.unkB8.unkFuncB8 = EntityEquipItemDrop;
|
||||
var_a0 -= 128;
|
||||
}
|
||||
self->params = var_a0 + 0x8000;
|
||||
} else {
|
||||
temp_a0_2 = self->ext.generic.unkB4;
|
||||
if (self->step < 5) {
|
||||
if (self->hitFlags != 0) {
|
||||
var_a0 = self->ext.generic.unkB4;
|
||||
D_8003BEEC[temp_a0_2 >> 3] |= 1 << (var_a0 & 7);
|
||||
self->step = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->ext.generic.unkB8.unkFuncB8(self);
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/40088", EntityUnkId0E);
|
||||
|
||||
u8 func_801C070C(s16* arg0, u8 facing) {
|
||||
u8 ret = 0;
|
||||
Collider collider;
|
||||
s16 posX, posY;
|
||||
|
||||
while (*arg0 != 0xFF) {
|
||||
ret <<= 1;
|
||||
|
||||
posX = facing ? (g_CurrentEntity->posX.i.hi + *arg0++)
|
||||
: (g_CurrentEntity->posX.i.hi - *arg0++);
|
||||
posY = g_CurrentEntity->posY.i.hi + *arg0++;
|
||||
|
||||
g_api.CheckCollision(posX, posY, &collider, 0);
|
||||
|
||||
if (collider.effects & EFFECT_SOLID) {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void func_801C07FC(Entity* entity) {
|
||||
switch (entity->step) {
|
||||
case 0:
|
||||
InitializeEntity(D_80180C04);
|
||||
entity->ext.generic.unk8C.modeU16.unk0 =
|
||||
entity->ext.generic.unk80.entityPtr->entityId;
|
||||
case 1:
|
||||
if (entity->ext.generic.unk7C.U8.unk0++ >= 5) {
|
||||
Entity* newEntity =
|
||||
AllocEntity(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, entity, newEntity);
|
||||
newEntity->entityId = E_EXPLOSION;
|
||||
newEntity->pfnUpdate = EntityExplosion;
|
||||
newEntity->params = entity->params;
|
||||
}
|
||||
entity->ext.generic.unk7C.U8.unk0 = 0;
|
||||
}
|
||||
entity->posX.i.hi = entity->ext.generic.unk80.entityPtr->posX.i.hi;
|
||||
entity->posY.i.hi = entity->ext.generic.unk80.entityPtr->posY.i.hi;
|
||||
if (entity->ext.generic.unk80.entityPtr->entityId !=
|
||||
entity->ext.generic.unk8C.modeU16.unk0) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C090C(
|
||||
Entity* self, u8 count, u8 params, s32 x, s32 y, u8 arg5, s16 xGap) {
|
||||
Entity* newEntity;
|
||||
s32 i;
|
||||
s16 newX = self->posX.i.hi + x;
|
||||
s16 newY = self->posY.i.hi + y;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]);
|
||||
if (newEntity != NULL) {
|
||||
newEntity->posX.i.hi = newX + xGap * i;
|
||||
newEntity->posY.i.hi = newY;
|
||||
newEntity->entityId = E_ID14;
|
||||
newEntity->pfnUpdate = func_801C0B24;
|
||||
newEntity->params = params;
|
||||
newEntity->ext.generic.unk94 = arg5 + i;
|
||||
newEntity->unk1C = newEntity->unk1A = D_80181ECC[arg5 + i];
|
||||
newEntity->unk19 = 3;
|
||||
newEntity->zPriority = self->zPriority + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/40088", func_801C0A3C);
|
||||
|
||||
void func_801C0B24(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
entity->velocityY = D_80181F04[entity->ext.generic.unk94];
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(2);
|
||||
entity->animCurFrame = D_80181F1C[entity->params];
|
||||
entity->blendMode = 0x10;
|
||||
entity->step++;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (D_80181F20[entity->params] < (s32)entity->animFrameDuration) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C0C14(Entity* entity) {
|
||||
u16 temp_v0;
|
||||
u32 temp2;
|
||||
|
||||
if (entity->step == 0) {
|
||||
entity->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
|
||||
entity->palette = 0x8195;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x10;
|
||||
entity->unk19 = 3;
|
||||
temp_v0 = D_80181EDC[entity->params];
|
||||
entity->unk1A = temp_v0;
|
||||
entity->unk1C = temp_v0;
|
||||
temp2 = D_80181EEC[entity->params];
|
||||
entity->step++;
|
||||
entity->velocityY = temp2;
|
||||
} else {
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= entity->velocityY;
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C0D08(Entity* self) {
|
||||
s16 primIndex;
|
||||
Primitive* prim;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, 1);
|
||||
if (primIndex == -1) {
|
||||
return;
|
||||
}
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
self->primIndex = primIndex;
|
||||
self->hitboxState = 0;
|
||||
*(s32*)&self->ext.generic.unk7C = prim;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
while (prim != NULL) {
|
||||
prim->x0 = prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = prim->y1 = self->posY.i.hi;
|
||||
prim->r0 = 64;
|
||||
prim->r1 = 0;
|
||||
prim->g0 = 64;
|
||||
prim->g1 = 0;
|
||||
prim->b0 = 255;
|
||||
prim->b1 = 16;
|
||||
prim->priority = self->zPriority + 1;
|
||||
prim->blendMode |= 0x37;
|
||||
prim = prim->next;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
prim = (Primitive*)*(s32*)&self->ext.generic.unk7C.s;
|
||||
if (func_801C070C(&D_80181F28, 0) & 255) {
|
||||
prim->y1 += 2;
|
||||
if (self->step_s == 0) {
|
||||
func_801C090C(self, 1, 2, 0, 0, 3, 0);
|
||||
self->step_s = 1;
|
||||
}
|
||||
} else {
|
||||
self->velocityY += 0x400;
|
||||
self->posY.val += self->velocityY;
|
||||
if ((prim->y0 - prim->y1) >= 9) {
|
||||
prim->y1 = prim->y0 - 8;
|
||||
}
|
||||
}
|
||||
|
||||
prim->x0 = self->posX.i.hi;
|
||||
prim->x1 = self->posX.i.hi;
|
||||
prim->y0 = self->posY.i.hi;
|
||||
|
||||
if (prim->y0 < prim->y1) {
|
||||
g_api.FreePrimitives(self->primIndex);
|
||||
DestroyEntity(self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool func_801C0F38(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void EntityIntenseExplosion(Entity* entity) {
|
||||
u32 temp_v0;
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->palette = 0x8170;
|
||||
entity->animSet = ANIMSET_DRA(5);
|
||||
entity->animCurFrame = 1;
|
||||
entity->blendMode = 0x30;
|
||||
|
||||
if (entity->params & 0xF0) {
|
||||
entity->palette = 0x8195;
|
||||
entity->blendMode = 0x10;
|
||||
}
|
||||
|
||||
temp_v0 = entity->params & 0xFF00;
|
||||
if (temp_v0 != 0) {
|
||||
entity->zPriority = temp_v0 >> 8;
|
||||
}
|
||||
|
||||
entity->zPriority += 8;
|
||||
return;
|
||||
}
|
||||
|
||||
entity->animFrameDuration++;
|
||||
entity->posY.val -= FIX(0.25);
|
||||
|
||||
if (!(entity->animFrameDuration & 1)) {
|
||||
entity->animCurFrame++;
|
||||
}
|
||||
|
||||
if (entity->animFrameDuration >= 0x25) {
|
||||
DestroyEntity(entity);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C16B4(Entity* entity) {
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
entity->unk6C = 0xF0;
|
||||
entity->unk1A = 0x1A0;
|
||||
entity->unk1C = 0x1A0;
|
||||
entity->animSet = ANIMSET_DRA(8);
|
||||
entity->animCurFrame = 1;
|
||||
entity->zPriority += 0x10;
|
||||
|
||||
if (entity->params != 0) {
|
||||
entity->palette = entity->params;
|
||||
} else {
|
||||
entity->palette = 0x8160;
|
||||
}
|
||||
|
||||
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_801C1848(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(D_8007D858, &D_8007D858[MaxEntityCount]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C1900(Entity* self) {
|
||||
s32 velocityX;
|
||||
s32 velocityY;
|
||||
s32 temp;
|
||||
|
||||
if (self->step == 0) {
|
||||
InitializeEntity(g_InitializeEntityData0);
|
||||
self->animSet = ANIMSET_DRA(2);
|
||||
self->palette = 0x81B6;
|
||||
self->unk6C = 0x70;
|
||||
self->zPriority = 192;
|
||||
self->unk19 |= 0xC;
|
||||
self->blendMode |= 0x30;
|
||||
|
||||
switch (self->ext.generic.unk84.U8.unk0) {
|
||||
case 1:
|
||||
if (self->ext.generic.unk84.U8.unk1 >= 4) {
|
||||
self->ext.generic.unk84.U8.unk1 += 253;
|
||||
self->ext.generic.unk80.modeS16.unk0 -= 0x800;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
self->ext.generic.unk80.modeS16.unk0 +=
|
||||
self->ext.generic.unk84.U8.unk1 * 192;
|
||||
break;
|
||||
}
|
||||
|
||||
self->rotAngle = self->ext.generic.unk80.modeS16.unk0 &= 0xFFF;
|
||||
temp = (self->ext.generic.unk84.U8.unk1 * 320) / 24;
|
||||
self->velocityX = temp * rsin(self->ext.generic.unk80.modeS16.unk0);
|
||||
self->velocityY = -(temp * rcos(self->ext.generic.unk80.modeS16.unk0));
|
||||
}
|
||||
|
||||
if (self->animFrameIdx >= 13) {
|
||||
velocityX = self->velocityX;
|
||||
if (velocityX < 0) {
|
||||
velocityX += 3;
|
||||
}
|
||||
|
||||
velocityY = self->velocityY;
|
||||
self->velocityX = (velocityX >> 2) * 3;
|
||||
if (velocityY < 0) {
|
||||
velocityY += 3;
|
||||
}
|
||||
self->velocityY = (velocityY >> 2) * 3;
|
||||
}
|
||||
|
||||
MoveEntity();
|
||||
|
||||
if (AnimateEntity(D_80181DD0, self) == 0) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/40088", func_801C1AD8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/nz0/nonmatchings/40088", func_801C20B8);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void func_801C29B0(s16 sfxId) {
|
||||
s32 var_a3;
|
||||
s32 temp_v0_2;
|
||||
s16 var_a2;
|
||||
s32 y;
|
||||
s16 var_v0_4;
|
||||
s16 var_v1;
|
||||
|
||||
var_a3 = g_CurrentEntity->posX.i.hi - 128;
|
||||
var_a2 = (ABS(var_a3) - 32) >> 5;
|
||||
if (var_a2 > 8) {
|
||||
var_a2 = 8;
|
||||
} else if (var_a2 < 0) {
|
||||
var_a2 = 0;
|
||||
}
|
||||
if (var_a3 < 0) {
|
||||
var_a2 = -var_a2;
|
||||
}
|
||||
var_a3 = ABS(var_a3) - 96;
|
||||
y = g_CurrentEntity->posY.i.hi - 128;
|
||||
temp_v0_2 = ABS(y) - 112;
|
||||
var_v1 = var_a3;
|
||||
if (temp_v0_2 > 0) {
|
||||
var_v1 += temp_v0_2;
|
||||
}
|
||||
if (var_v1 < 0) {
|
||||
var_v0_4 = 0;
|
||||
} else {
|
||||
var_v0_4 = var_v1;
|
||||
}
|
||||
var_a3 = 127 - (var_v0_4 >> 1);
|
||||
if (var_a3 > 0) {
|
||||
g_api.func_80134714(sfxId, var_a3, var_a2);
|
||||
}
|
||||
}
|
||||
|
||||
// The white flying orbs of energy that Alucard summons as part of the Soul
|
||||
// Steal spell
|
||||
// TODO(sestren): Reconcile this func_801BD4CC with the one in 36DE4.c
|
||||
s16 func_801BD4CC(u16, u16, s32); /* extern */
|
||||
void EntitySoulStealOrb(Entity* self) {
|
||||
Primitive* prim;
|
||||
s32 primIndex;
|
||||
u16 *temp_d, temp_e;
|
||||
s32 temp_a, temp_b;
|
||||
u16 angle;
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
InitializeEntity(g_InitializeData0);
|
||||
D_8008701E[primIndex * 0x1a] = 8;
|
||||
self->primIndex = primIndex;
|
||||
self->animSet = ANIMSET_DRA(0);
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
angle = func_801BD44C(self, &PLAYER);
|
||||
temp_a = self->posY.i.hi < 113;
|
||||
temp_b = temp_a ^ 1;
|
||||
if (self->posX.i.hi < PLAYER.posX.i.hi) {
|
||||
temp_b = temp_a;
|
||||
}
|
||||
if (temp_b & 0xFFFF) {
|
||||
self->ext.soulStealOrb.angle = angle - D_80181F80[Random() & 7];
|
||||
} else {
|
||||
angle += D_80181F80[Random() & 7];
|
||||
self->ext.soulStealOrb.angle = angle;
|
||||
}
|
||||
self->ext.soulStealOrb.unk80 = 0x400;
|
||||
self->ext.soulStealOrb.unk7E = 0;
|
||||
self->hitboxState = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
self->ext.soulStealOrb.unk82++;
|
||||
if (self->ext.soulStealOrb.unk82 == 16) {
|
||||
self->hitboxState = 1;
|
||||
}
|
||||
if (self->hitFlags != 0) {
|
||||
if (g_Player.unk56 == 0) {
|
||||
g_Player.unk56 = 1;
|
||||
g_Player.unk58 = 8;
|
||||
}
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->unk1A < 0x100) {
|
||||
self->unk1A = self->unk1C += 0x10;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk7E < 0x200) {
|
||||
self->ext.soulStealOrb.unk7E += 2;
|
||||
}
|
||||
if (self->ext.soulStealOrb.unk80 < 0x800) {
|
||||
self->ext.soulStealOrb.unk80 += 4;
|
||||
}
|
||||
self->ext.soulStealOrb.angle = func_801BD4CC(
|
||||
self->ext.soulStealOrb.unk7E, self->ext.soulStealOrb.angle,
|
||||
0xffff & func_801BD44C(self, &PLAYER));
|
||||
UnkEntityFunc0(self->ext.soulStealOrb.angle & 0xFFFF,
|
||||
self->ext.soulStealOrb.unk80);
|
||||
MoveEntity(self); // argument pass necessary to match
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
AnimateEntity(&D_80181FF0, self);
|
||||
angle = (float)(u32)self; // !FAKE
|
||||
prim->tpage = 0x18;
|
||||
prim->clut = 0x194;
|
||||
temp_d = &D_80181F90[(u16)((8 * (u16)self->animCurFrame) - 8)];
|
||||
prim->x0 = prim->x2 = self->posX.i.hi + *(temp_d++);
|
||||
prim->y0 = prim->y1 = self->posY.i.hi + *(temp_d++);
|
||||
prim->x1 = prim->x3 = prim->x0 + *(temp_d++);
|
||||
prim->y2 = prim->y3 = prim->y0 + *(temp_d++);
|
||||
prim->u0 = prim->u2 = *(temp_d++);
|
||||
prim->v0 = prim->v1 = *(temp_d++);
|
||||
prim->u1 = prim->u3 = *(temp_d++);
|
||||
prim->v2 = prim->v3 = *(temp_d++);
|
||||
prim->priority = self->zPriority;
|
||||
prim->blendMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../entity_enemy_blood.h"
|
||||
|
||||
void EntityRoomForeground(Entity* entity) {
|
||||
ObjInit2* objInit = &D_80182014[entity->params];
|
||||
|
||||
if (entity->step == 0) {
|
||||
InitializeEntity(D_80180C1C);
|
||||
entity->animSet = objInit->animSet;
|
||||
entity->zPriority = objInit->zPriority;
|
||||
entity->unk5A = objInit->unk4.s;
|
||||
entity->palette = objInit->palette;
|
||||
entity->unk19 = objInit->unk8;
|
||||
entity->blendMode = objInit->blendMode;
|
||||
|
||||
if (objInit->unkC != 0) {
|
||||
entity->flags = objInit->unkC;
|
||||
}
|
||||
|
||||
if (entity->params >= 5) {
|
||||
entity->rotAngle = 0x800;
|
||||
entity->unk19 |= 4;
|
||||
}
|
||||
}
|
||||
AnimateEntity(objInit->unk10, entity);
|
||||
}
|
||||
|
||||
void BottomCornerText(u8* str, u8 lower_left) {
|
||||
u8 toPrint[64];
|
||||
Primitive* prim;
|
||||
s32 i;
|
||||
u32 ch;
|
||||
u8* chIdx = &toPrint;
|
||||
|
||||
u16 textWidth = 0;
|
||||
// serves two purposes, use #define for dual names
|
||||
u16 dualVar = 0;
|
||||
#define charcount dualVar
|
||||
|
||||
// Clear out the toPrint array
|
||||
for (i = 0; i < 64; i++) {
|
||||
*chIdx++ = 0;
|
||||
}
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
|
||||
while (1) {
|
||||
i = 0;
|
||||
// Copy values from the incoming arg0 array to the local array, until we
|
||||
// get a 0xFF followed by a 0
|
||||
ch = *str++;
|
||||
if (ch == 0xFF) {
|
||||
ch = *str++;
|
||||
if (ch == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*chIdx = ch;
|
||||
chIdx++;
|
||||
if (ch != 0) {
|
||||
charcount += 1;
|
||||
textWidth += 8;
|
||||
} else {
|
||||
textWidth += 4;
|
||||
}
|
||||
}
|
||||
|
||||
g_BottomCornerTextPrims = g_api_AllocPrimitives(PRIM_SPRT, charcount + 4);
|
||||
if (g_BottomCornerTextPrims == -1) {
|
||||
return;
|
||||
}
|
||||
#undef charcount
|
||||
|
||||
prim = &g_PrimBuf[g_BottomCornerTextPrims];
|
||||
prim->type = 3;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 =
|
||||
prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
|
||||
if (lower_left) {
|
||||
prim->b0 = prim->b1 = 0xAF;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = 0x5F;
|
||||
}
|
||||
|
||||
#define xpos dualVar
|
||||
if (lower_left) {
|
||||
xpos = 7;
|
||||
textWidth += 4;
|
||||
} else {
|
||||
xpos = 0xD4 - textWidth;
|
||||
}
|
||||
|
||||
prim->x0 = prim->x2 = xpos;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x20;
|
||||
prim->y0 = prim->y1 = 0xD0;
|
||||
prim->y2 = prim->y3 = 0xDF;
|
||||
prim->priority = 0x1EE;
|
||||
prim->blendMode = 0x11;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos - 6;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0x80;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->x0 = xpos + textWidth + 0x16;
|
||||
prim->y0 = 0xCB;
|
||||
prim->u0 = 0xA8;
|
||||
prim->v0 = 0;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x18;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
prim = prim->next;
|
||||
|
||||
prim->type = 4;
|
||||
prim->y0 = prim->y1 = 0xCD;
|
||||
prim->tpage = 0x1F;
|
||||
prim->clut = 0x197;
|
||||
prim->y2 = prim->y3 = 0xE1;
|
||||
prim->u0 = prim->u2 = 0x98;
|
||||
prim->u1 = prim->u3 = 0x9C;
|
||||
prim->v0 = prim->v1 = 2;
|
||||
prim->x0 = prim->x2 = xpos + 0xA;
|
||||
prim->x1 = prim->x3 = xpos + textWidth + 0x18;
|
||||
prim->v2 = prim->v3 = 0x16;
|
||||
prim->priority = 0x1EF;
|
||||
prim->blendMode = 0;
|
||||
|
||||
xpos += 0x10;
|
||||
|
||||
// Reset array pointer
|
||||
chIdx = &toPrint;
|
||||
for (prim = prim->next; prim != NULL;) {
|
||||
ch = *chIdx++;
|
||||
if (ch != 0) {
|
||||
prim->x0 = xpos;
|
||||
prim->u0 = (ch & 0xF) * 8;
|
||||
prim->tpage = 0x1E;
|
||||
prim->clut = 0x196;
|
||||
prim->v0 = (ch & 0xF0) >> 1;
|
||||
prim->v1 = 8;
|
||||
prim->u1 = 8;
|
||||
prim->priority = 0x1F0;
|
||||
prim->blendMode = 0;
|
||||
prim->y0 = 0xD4;
|
||||
prim = prim->next;
|
||||
xpos += 8;
|
||||
} else {
|
||||
xpos += 4;
|
||||
}
|
||||
}
|
||||
#undef xpos
|
||||
g_BottomCornerTextTimer = 0x130;
|
||||
}
|
3
src/st/nz0/entity_relic_orb.c
Normal file
3
src/st/nz0/entity_relic_orb.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "nz0.h"
|
||||
|
||||
#include "../entity_relic_orb.h"
|
@ -365,7 +365,7 @@ extern s16 D_801CB6C6;
|
||||
extern s32 D_801CB6C8;
|
||||
extern s32 D_801CB734;
|
||||
extern u16 D_801CB736[];
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
|
||||
// *** EntitySoulStealOrb properties START ***
|
||||
|
||||
|
250
src/st/rwrp/10D1C.c
Normal file
250
src/st/rwrp/10D1C.c
Normal file
@ -0,0 +1,250 @@
|
||||
#include "rwrp.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80190D1C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80190E44);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_801913A0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80191490);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_801915A0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_801916D0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_801917B8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_801918A8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_8019199C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80191BCC);
|
||||
|
||||
u8 func_80191CC8(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 "../entity_intense_explosion.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80192348);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80192414);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_801924DC);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80192594);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_8019276C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80192D4C);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_80193644);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_8019373C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/10D1C", func_8019390C);
|
@ -478,259 +478,8 @@ INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", EntityPrizeDrop);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018F814);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018F910);
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", BlinkItem);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", EntityEquipItemDrop);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018FF9C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8019024C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80190D1C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80190E44);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_801913A0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80191490);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_801915A0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_801916D0);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_801917B8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_801918A8);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8019199C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80191BCC);
|
||||
|
||||
u8 func_80191CC8(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 "../entity_intense_explosion.h"
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80192348);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80192414);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_801924DC);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80192594);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8019276C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80192D4C);
|
||||
|
||||
void ClutLerp(RECT* rect, u16 palIdxA, u16 palIdxB, s32 steps, u16 offset) {
|
||||
u16 buf[COLORS_PER_PAL];
|
||||
RECT bufRect;
|
||||
s32 factor;
|
||||
u32 t;
|
||||
u32 r, g, b;
|
||||
s32 i, j;
|
||||
u16 *palA, *palB;
|
||||
|
||||
bufRect.x = rect->x;
|
||||
bufRect.w = COLORS_PER_PAL;
|
||||
bufRect.h = 1;
|
||||
|
||||
palA = g_Clut + palIdxA * COLORS_PER_PAL;
|
||||
palB = g_Clut + palIdxB * COLORS_PER_PAL;
|
||||
|
||||
for (i = 0; i < steps; i++) {
|
||||
factor = i * 4096 / steps;
|
||||
for (j = 0; j < COLORS_PER_PAL; j++) {
|
||||
r = (palA[j] & 0x1F) * (4096 - factor) + (palB[j] & 0x1F) * factor;
|
||||
g = ((palA[j] >> 5) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 5) & 0x1F) * factor;
|
||||
b = ((palA[j] >> 10) & 0x1F) * (4096 - factor) +
|
||||
((palB[j] >> 10) & 0x1F) * factor;
|
||||
|
||||
t = palA[j] & 0x8000;
|
||||
t |= palB[j] & 0x8000;
|
||||
|
||||
buf[j] = t | (r >> 12) | ((g >> 12) << 5) | ((b >> 12) << 10);
|
||||
}
|
||||
|
||||
bufRect.y = rect->y + i;
|
||||
LoadImage(&bufRect, buf);
|
||||
D_8003C104[offset + i] = GetClut(bufRect.x, bufRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_80193644);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8019373C);
|
||||
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8019390C);
|
||||
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", BlitChar);
|
||||
|
3
src/st/rwrp/entity_relic_orb.c
Normal file
3
src/st/rwrp/entity_relic_orb.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include "rwrp.h"
|
||||
|
||||
#include "../entity_relic_orb.h"
|
@ -25,7 +25,7 @@ extern u16 D_80180DC4[];
|
||||
extern u16 D_80180DF4[];
|
||||
extern u8* D_80180E08[];
|
||||
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
extern u16 UNK_Invincibility0[];
|
||||
extern u16 g_InitializeEntityData0[];
|
||||
|
||||
|
@ -169,7 +169,7 @@ extern u8 D_801824CC[];
|
||||
extern u16* D_801C00A4;
|
||||
extern s32 D_801C24C8;
|
||||
extern s32 D_801C2580;
|
||||
extern u16 g_ItemIconSlots[];
|
||||
extern u16 g_ItemIconSlots[0x20];
|
||||
|
||||
// *** EntitySoulStealOrb properties START ***
|
||||
|
||||
|
@ -254,7 +254,7 @@ void EntityExplosion(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_8018D990(Entity* arg0, s32 renderFlags) {
|
||||
void BlinkItem(Entity* arg0, s32 renderFlags) {
|
||||
POLY_GT4* poly;
|
||||
s16 left, top, right, bottom;
|
||||
|
||||
@ -471,7 +471,7 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
if (self->ext.equipItemDrop.timer != 0) {
|
||||
self->ext.equipItemDrop.timer--;
|
||||
}
|
||||
func_8018D990(self, self->ext.equipItemDrop.timer);
|
||||
BlinkItem(self, self->ext.equipItemDrop.timer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -585,352 +585,7 @@ char* BlitChar(char* str, u16* xOffset, u8* pix, u16 stride) {
|
||||
return str;
|
||||
}
|
||||
|
||||
const char* g_RelicOrbTexts[] = {
|
||||
"Obtained ",
|
||||
};
|
||||
|
||||
u16 g_RelicOrbTextBg1EY[] = {16, 12, 8, 4, 0, -4, -8, -12};
|
||||
u16 g_RelicOrbTextBg1SY[] = {-32, -26, -20, -13, -7, -1, 5, 12};
|
||||
u16 g_RelicOrbTextBg2SY[] = {-16, -12, -8, -4, 0, 4, 8, 12};
|
||||
u16 g_RelicOrbTextBg2EY[] = {32, 26, 20, 13, 7, 1, -5, -12};
|
||||
u16 g_RelicOrbSparkleX[] = {-8, 4, -2, 8, 0, 4, -4, 2};
|
||||
u16 g_RelicOrbSparkleY[] = {-2, 2, 4, -3, 0, 2, -4, 3};
|
||||
void EntityRelicOrb(Entity* self) {
|
||||
// prim 0: green rectangle for Obtained text bg
|
||||
// prim 1: blue rectangle for Obtained text bg
|
||||
|
||||
const int MaxItemSlots = LEN(g_ItemIconSlots) - 1;
|
||||
RECT rect;
|
||||
u16 xOffset;
|
||||
u8* var_v0_5;
|
||||
Primitive* prim;
|
||||
RelicOrb* relic;
|
||||
s16 primIndex;
|
||||
s16 temp_v0_6;
|
||||
s16 iconSlot;
|
||||
u16 relicId;
|
||||
s32 xCoord;
|
||||
u16 yCoord;
|
||||
s32 texSrcX;
|
||||
s32 texSrcY;
|
||||
s16 temp_v1_6;
|
||||
s32 i;
|
||||
s32 var_s0_2;
|
||||
char* msg;
|
||||
u16 temp_a1_2;
|
||||
s16 new_var7;
|
||||
s16 new_var10;
|
||||
s16 new_var6;
|
||||
PixPattern* dstPix;
|
||||
s8 new_var3;
|
||||
|
||||
relicId = self->params & 0x7FFF;
|
||||
if (self->step > 0 && self->step < 5 && self->hitFlags != 0) {
|
||||
self->step = 5;
|
||||
}
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
// If the relic was previously obtained, do not spawn it.
|
||||
if (g_Status.relics[relicId & 0xFFFF] & 1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeEntity(g_InitializeData0);
|
||||
for (iconSlot = 0; iconSlot < MaxItemSlots; iconSlot++) {
|
||||
if (g_ItemIconSlots[iconSlot] == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iconSlot >= MaxItemSlots) {
|
||||
self->step = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 7);
|
||||
if (primIndex == -1) {
|
||||
self->step = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
self->primIndex = primIndex;
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
self->ext.relicOrb.iconSlot = iconSlot;
|
||||
g_ItemIconSlots[iconSlot] = 0x10;
|
||||
relic = &g_api.D_800A8720[relicId];
|
||||
g_api.LoadEquipIcon(relic->icon, relic->palette, iconSlot);
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
if (prim != NULL) {
|
||||
new_var3 = iconSlot;
|
||||
texSrcX = (new_var3 & 0x07) * 0x10;
|
||||
texSrcY = (new_var3 & 0x18) * 0x02;
|
||||
for (i = 0; prim != NULL; i++) {
|
||||
if (i != 0) {
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
} else {
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = iconSlot + 0x1D0;
|
||||
prim->u0 = prim->u2 = texSrcX | 1;
|
||||
prim->u1 = prim->u3 = texSrcX | 0xF;
|
||||
prim->v0 = prim->v1 = texSrcY | 0x81;
|
||||
prim->v2 = prim->v3 = texSrcY | 0x8F;
|
||||
prim->blendMode = 6;
|
||||
}
|
||||
prim->priority = 0x7E;
|
||||
prim = prim->next;
|
||||
}
|
||||
}
|
||||
self->posY.i.lo = 0x8000;
|
||||
self->velocityY = FIX(0.25);
|
||||
self->ext.relicOrb.floatTimer = 64;
|
||||
self->ext.relicOrb.yFloatSpeed = -FIX(0.0078125);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// The relic floats in the air
|
||||
self->velocityY += self->ext.relicOrb.yFloatSpeed;
|
||||
if (--self->ext.relicOrb.floatTimer == 0) {
|
||||
self->ext.relicOrb.floatTimer = 64;
|
||||
self->ext.relicOrb.yFloatSpeed = -self->ext.relicOrb.yFloatSpeed;
|
||||
}
|
||||
MoveEntity();
|
||||
g_ItemIconSlots[self->ext.relicOrb.iconSlot] = 0x10;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
g_api.func_800FE044(relicId, 0x2000);
|
||||
if (relicId > RELIC_DEMON_CARD && relicId < RELIC_FAERIE_CARD) {
|
||||
g_Status.relics[relicId] = g_Status.relics[relicId] ^ 2;
|
||||
}
|
||||
self->flags |= FLAG_UNK_10000;
|
||||
|
||||
// Reserve space in the VRAM to store the pre-render texture with the
|
||||
// "obtained" relic message
|
||||
rect.x = 0;
|
||||
rect.y = 256;
|
||||
rect.w = 64;
|
||||
rect.h = 16;
|
||||
ClearImage(&rect, 0, 0, 0);
|
||||
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (i == 0) {
|
||||
prim->type = PRIM_SPRT;
|
||||
prim->y0 = 0xA0;
|
||||
prim->u1 = 0xF0;
|
||||
prim->clut = 0x1A1;
|
||||
prim->priority = 0x1FE;
|
||||
prim->tpage = 0x10;
|
||||
prim->x0 = 0x10;
|
||||
prim->u0 = 0;
|
||||
prim->v0 = 0;
|
||||
prim->v1 = 0x10;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
} else {
|
||||
prim->type = PRIM_G4;
|
||||
prim->x0 = prim->x1 = prim->x2 = prim->x3 = 0x80;
|
||||
prim->y0 = prim->y1 = prim->y2 = prim->y3 = 0xA7;
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0;
|
||||
|
||||
if (i == 1) {
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0x80;
|
||||
} else {
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0x80;
|
||||
}
|
||||
prim->priority = 0x1FD;
|
||||
prim->blendMode = 0x11;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
self->step++;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// This case creates the texture "Obtained RELIC_NAME" and stores it
|
||||
// in the VRAM
|
||||
var_s0_2 = 0;
|
||||
xOffset = 0;
|
||||
msg = g_RelicOrbTexts[0];
|
||||
dstPix = &D_8007EFE4;
|
||||
var_v0_5 = (u8*)dstPix;
|
||||
for (i = 0; i < 0xC00; i++) {
|
||||
*var_v0_5++ = 0;
|
||||
}
|
||||
|
||||
xOffset = 0;
|
||||
while (true) {
|
||||
if (*msg == 0) {
|
||||
if (var_s0_2 != 0) {
|
||||
break;
|
||||
}
|
||||
msg = g_api.D_800A8720[relicId].name;
|
||||
var_s0_2 = 1;
|
||||
} else {
|
||||
msg = BlitChar(msg, &xOffset, dstPix, 0xC0);
|
||||
}
|
||||
}
|
||||
|
||||
LoadTPage(dstPix, 0, 0, 0, 0x100, 0x180, 0x10);
|
||||
self->ext.relicOrb.unk7C = 0;
|
||||
self->ext.relicOrb.unk7E = xOffset;
|
||||
self->step++;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// Animates the blue/green rectangle for the Obtain text bg
|
||||
prim = g_PrimBuf[self->primIndex].next;
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (i == 0) {
|
||||
prim->x2 = prim->x2 - 3;
|
||||
prim->x3 = prim->x3 + 3;
|
||||
prim->y0 = prim->y1 = prim->y1 - 4;
|
||||
prim->y2 = prim->y3 = prim->y3 + 2;
|
||||
} else {
|
||||
prim->x0 = prim->x0 - 3;
|
||||
prim->x1 = prim->x1 + 3;
|
||||
prim->y0 = prim->y1 = prim->y1 - 2;
|
||||
prim->y2 = prim->y3 = prim->y3 + 4;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (++self->ext.relicOrb.unk7C == 8) {
|
||||
self->ext.relicOrb.unk7C = 0;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
temp_a1_2 = self->ext.relicOrb.unk7C;
|
||||
prim = g_PrimBuf[self->primIndex].next;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (i == 0) {
|
||||
prim->x1 = 0x80 - (temp_a1_2 + 1) * 0xC;
|
||||
prim->x0 = 0x80 + (temp_a1_2 + 1) * 0xC;
|
||||
prim->x2 = 0x68 + (temp_a1_2 * 0x78) / 7;
|
||||
prim->x3 = 0x98 - (temp_a1_2 * 0x78) / 7;
|
||||
prim->y0 = prim->y1 = g_RelicOrbTextBg1SY[temp_a1_2] + 0xA7;
|
||||
prim->y2 = prim->y3 = g_RelicOrbTextBg1EY[temp_a1_2] + 0xA7;
|
||||
prim->b2 = prim->b3 = prim->b3 - 0x10;
|
||||
} else {
|
||||
prim->x0 = 0x68 + (temp_a1_2 * 0x78) / 7;
|
||||
prim->x1 = 0x98 - (temp_a1_2 * 0x78) / 7;
|
||||
prim->x3 = 0x80 - (temp_a1_2 + 1) * 0xC;
|
||||
prim->x2 = 0x80 + (temp_a1_2 + 1) * 0xC;
|
||||
prim->y0 = prim->y1 = g_RelicOrbTextBg2SY[temp_a1_2] + 0xA7;
|
||||
prim->y2 = prim->y3 = g_RelicOrbTextBg2EY[temp_a1_2] + 0xA7;
|
||||
prim->g0 = prim->g1 = prim->g1 - 0x10;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (++self->ext.relicOrb.unk7C == 8) {
|
||||
self->ext.relicOrb.unk7C = 0;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
prim->x0 = 0x80 - self->ext.relicOrb.unk7E;
|
||||
prim->blendMode = 0;
|
||||
self->ext.relicOrb.unk7C++;
|
||||
if (self->ext.relicOrb.unk7C > 0x60) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (self->step < 2) {
|
||||
// Animates the four sparkles while the relic is floating
|
||||
func_8018D990(self, (u16)g_blinkTimer);
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 3; i++) { // Skip the first three primitives
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (self->ext.relicOrb.sparkleCycle == 0) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (prim->blendMode == BLEND_VISIBLE) {
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = 0x1B1;
|
||||
prim->u3 = 0x10;
|
||||
prim->u1 = 0x10;
|
||||
prim->v1 = 0x50;
|
||||
prim->v0 = 0x50;
|
||||
prim->u2 = 0;
|
||||
prim->u0 = 0;
|
||||
prim->v3 = 0x60;
|
||||
prim->v2 = 0x60;
|
||||
|
||||
temp_v1_6 = self->ext.relicOrb.sparkleAnim & 7;
|
||||
var_s0_2 = (u16)self->posX.i.hi;
|
||||
xCoord = var_s0_2 + g_RelicOrbSparkleX[temp_v1_6];
|
||||
prim->x0 = prim->x2 = xCoord - 6;
|
||||
prim->x1 = prim->x3 = xCoord + 6;
|
||||
|
||||
var_s0_2 = (u16)self->posY.i.hi;
|
||||
yCoord = var_s0_2 + g_RelicOrbSparkleY[temp_v1_6];
|
||||
prim->y0 = prim->y1 = yCoord - 6;
|
||||
prim->y2 = prim->y3 = yCoord + 6;
|
||||
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0x80;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0x80;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0x80;
|
||||
prim->p1 = 0;
|
||||
prim->priority = 0x7F;
|
||||
prim->blendMode = 0x37;
|
||||
break;
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
self->ext.relicOrb.sparkleCycle = 4;
|
||||
self->ext.relicOrb.sparkleAnim++;
|
||||
} else {
|
||||
self->ext.relicOrb.sparkleCycle--;
|
||||
}
|
||||
}
|
||||
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 3; i++) {
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
for (; prim != NULL; prim = prim->next) {
|
||||
if (prim->blendMode != BLEND_VISIBLE) {
|
||||
if (prim->p1 & 3) {
|
||||
new_var10 = prim->y1;
|
||||
temp_v1_6 = prim->y3;
|
||||
prim->y1 = new_var10 - 1;
|
||||
prim->y0 = new_var10;
|
||||
prim->y3 = temp_v1_6 - 1;
|
||||
prim->y2 = temp_v1_6;
|
||||
} else {
|
||||
new_var6 = prim->x2;
|
||||
new_var7 = prim->x3;
|
||||
prim->y2 = prim->y3 = prim->y3 - 2;
|
||||
prim->x2 = new_var6 + 1;
|
||||
prim->x0 = new_var6;
|
||||
prim->x3 = new_var7 - 1;
|
||||
prim->x1 = new_var7;
|
||||
}
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->r3 - 6;
|
||||
prim->g0 = prim->g1 = prim->g2 = prim->g3 = prim->g3 - 6;
|
||||
prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->b3 - 6;
|
||||
prim->p1++;
|
||||
if (prim->p1 > 0x10) {
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "../entity_relic_orb.h"
|
||||
|
||||
void EntityHeartDrop(Entity* self) {
|
||||
u16 temp_a0;
|
||||
|
Loading…
Reference in New Issue
Block a user