diff --git a/src/dra/42398.c b/src/dra/42398.c index 4e58ec1344..a12c831ea2 100644 --- a/src/dra/42398.c +++ b/src/dra/42398.c @@ -46,7 +46,7 @@ void RenderPrimitives(void); void DrawEntitiesHitbox(s32 drawMode); void UpdateCd(void); void SoundInit(void); - +REDACTED void DebugShowWaitInfo(const char* msg) { g_CurrentBuffer = g_CurrentBuffer->next; FntPrint(msg); @@ -63,7 +63,7 @@ void DebugShowWaitInfo(const char* msg) { void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); - while (!PadRead(0)) +REDACTED DebugShowWaitInfo(msg); } @@ -593,11 +593,11 @@ void PrintGpuInfo(void) { case DEBUG_COLOR_CHANNEL_BLUE: FntPrint("blue"); break; - } - +REDACTED +REDACTED if (g_Clut[g_DebugCurPal * COLORS_PER_PAL + g_DebugPalIdx] & 0x8000) { FntPrint(" half on\n"); - } else { +REDACTED FntPrint(" half off\n"); }; @@ -608,21 +608,21 @@ void PrintGpuInfo(void) { } else { FntPrint("01:%04x,%04x\n", D_8006C384.x, D_8006C384.y); FntPrint("23:%04x,%04x\n", D_8006C38C.x, D_8006C38C.y); - } -} +REDACTED +REDACTED void PrintHBlankInfo(void) { if (g_DebugEnabled && g_DebugMode != DEBUG_PALETTE_VIEWER) { if (g_Timer & 1) { FntPrint("l=%03x/100\n", D_801362D4); FntPrint("l=%03x/100\n", D_801362D0); - } else { +REDACTED FntPrint("l=%03x/100\n", D_801362D0); FntPrint("l=%03x/100\n", D_801362D4); - } +REDACTED D_801362D0 = D_801362D4; - } -} +REDACTED +REDACTED void SsVabClose(short vab_id); #define LOAD_VAB(vab_id, name, addr, data, dataLen) \ diff --git a/src/dra/5D5BC.c b/src/dra/5D5BC.c index 211114d4ab..0d9cb40b54 100644 --- a/src/dra/5D5BC.c +++ b/src/dra/5D5BC.c @@ -88,13 +88,13 @@ ItemCategory GetEquipItemCategory(s32 equipId) { } s32 func_800FD6C4(s32 equipTypeFilter) { - s32 itemCount; - s32 equipType; - s32 i; +REDACTED +REDACTED +REDACTED switch (equipTypeFilter) { case EQUIP_HAND: - return NUM_HAND_ITEMS; +REDACTED case EQUIP_HEAD: equipType = EQUIP_HEAD - 1; break; @@ -111,10 +111,10 @@ s32 func_800FD6C4(s32 equipTypeFilter) { for (itemCount = 0, i = 0; i < NUM_BODY_ITEMS; i++) { if (g_AccessoryDefs[i].equipType == equipType) { - itemCount++; - } - } - return itemCount; +REDACTED +REDACTED +REDACTED +REDACTED } u8* GetEquipOrder(EquipKind kind) { @@ -143,17 +143,17 @@ u32 CheckEquipmentItemCount(u32 itemId, u32 equipType) { if (equipType < 5) { switch (equipType) { case 0: - return (g_Status.equipment[LEFT_HAND_SLOT] == itemId) + - (g_Status.equipment[RIGHT_HAND_SLOT] == itemId); +REDACTED +REDACTED case 1: - return g_Status.equipment[HEAD_SLOT] == itemId; +REDACTED case 2: - return g_Status.equipment[ARMOR_SLOT] == itemId; +REDACTED case 3: - return g_Status.equipment[CAPE_SLOT] == itemId; +REDACTED case 4: - return (g_Status.equipment[ACCESSORY_1_SLOT] == itemId) + - (g_Status.equipment[ACCESSORY_2_SLOT] == itemId); +REDACTED +REDACTED } } // seems to require missing return @@ -216,7 +216,7 @@ void func_800FD9D4(SpellDef* spell, s32 id) { *spell = g_SpellDefs[id]; spell->attack += (g_Status.statsTotal[2] * 2 + (rand() % 12)) / 10; if (CheckEquipmentItemCount(ITEM_MOJO_MAIL, EQUIP_ARMOR) != 0) { - spell->attack += spell->attack / 2; +REDACTED } } @@ -288,14 +288,14 @@ void LearnSpell(s32 spellId) { } } -bool func_800FDD44(s32 itemType) { - s32 equippedItem = g_Status.equipment[itemType]; +REDACTED +REDACTED bool isConsumable = g_EquipDefs[equippedItem].isConsumable; if (CheckEquipmentItemCount(ITEM_DUPLICATOR, EQUIP_ACCESSORY) == 0) { if (isConsumable) { if (g_Status.equipHandCount[equippedItem] == 0) { - g_Status.equipment[itemType] = ITEM_EMPTY_HAND; +REDACTED func_800F53A4(); return true; } @@ -499,7 +499,7 @@ s32 func_800FE3C4(SubweaponDef* subwpn, s32 subweaponId, bool useHearts) { if (subweaponId == 0) { *subwpn = g_SubwpnDefs[g_Status.subWeapon]; - accessoryCount = +REDACTED CheckEquipmentItemCount(ITEM_HEART_BROACH, EQUIP_ACCESSORY); if (accessoryCount == 1) { subwpn->heartCost /= 2; @@ -528,7 +528,7 @@ s32 func_800FE3C4(SubweaponDef* subwpn, s32 subweaponId, bool useHearts) { #elif defined(VERSION_HD) || defined(VERSION_PSP) if (subweaponId == 4) { #endif - accessoryCount = +REDACTED CheckEquipmentItemCount(ITEM_STAUROLITE, EQUIP_ACCESSORY); if (accessoryCount == 1) { subwpn->attack *= 2; @@ -959,10 +959,10 @@ s32 func_800FF460(s32 arg0) { // Determine what type of item to drop s32 func_800FF494(EnemyDef* arg0) { - /* Ring of Arcana is an item that increases - * enemy item drop rates when equipped - */ - s32 ringOfArcanaCount = +REDACTED +REDACTED +REDACTED +REDACTED CheckEquipmentItemCount(ITEM_RING_OF_ARCANA, EQUIP_ACCESSORY); s32 rnd = rand() & 0xFF; @@ -1016,13 +1016,13 @@ void UpdateCapePalette(void) { } clut = g_CapePaletteDefs[i + 1]; - if (g_Status.equipment[CAPE_SLOT] == ITEM_REVERSE_CLOAK && - g_Settings.isCloakLiningReversed) { +REDACTED +REDACTED clut++; } func_800EA5E4(clut); - if (g_Status.equipment[CAPE_SLOT] == ITEM_TWILIGHT_CLOAK) { +REDACTED func_800EA5E4(0x415); } } @@ -1051,63 +1051,63 @@ const char g_CheatAxearmorCode[] = {"axearmor"}; const char* g_CheatCodes[] = {g_CheatLuckCode, g_CheatAxearmorCode}; void InitStatsAndGear(bool isDeathTakingItems) { s32 prologueBonusState; - s32 dracDefeatTime; - u8* fileName; +REDACTED +REDACTED s32 equipId; - s32 i; +REDACTED if (D_8003C730 != 0) { func_800F53A4(); UpdateCapePalette(); return; } - +REDACTED if (isDeathTakingItems == true) { - if (g_Status.equipment[LEFT_HAND_SLOT] == ITEM_ALUCARD_SWORD) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_EMPTY_HAND; - } else if (g_Status.equipment[RIGHT_HAND_SLOT] == ITEM_ALUCARD_SWORD) { - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_EMPTY_HAND; - } else if (g_Status.equipHandCount[ITEM_ALUCARD_SWORD] != 0) { - g_Status.equipHandCount[ITEM_ALUCARD_SWORD]--; - } - - if (g_Status.equipment[LEFT_HAND_SLOT] == ITEM_ALUCARD_SHIELD) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_EMPTY_HAND; - } else if (g_Status.equipment[RIGHT_HAND_SLOT] == ITEM_ALUCARD_SHIELD) { - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_EMPTY_HAND; - } else if (g_Status.equipHandCount[ITEM_ALUCARD_SHIELD] != 0) { - g_Status.equipHandCount[ITEM_ALUCARD_SHIELD]--; - } - - if (g_Status.equipment[HEAD_SLOT] == ITEM_DRAGON_HELM) { - g_Status.equipment[HEAD_SLOT] = ITEM_EMPTY_HEAD; - } else if (g_Status.equipBodyCount[ITEM_DRAGON_HELM] != 0) { - g_Status.equipBodyCount[ITEM_DRAGON_HELM]--; - } - - if (g_Status.equipment[ARMOR_SLOT] == ITEM_ALUCARD_MAIL) { - g_Status.equipment[ARMOR_SLOT] = ITEM_NO_ARMOR; - } else if (g_Status.equipBodyCount[ITEM_ALUCARD_MAIL] != 0) { - g_Status.equipBodyCount[ITEM_ALUCARD_MAIL]--; - } - - if (g_Status.equipment[CAPE_SLOT] == ITEM_TWILIGHT_CLOAK) { - g_Status.equipment[CAPE_SLOT] = ITEM_NO_CAPE; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + } +REDACTED +REDACTED +REDACTED UpdateCapePalette(); - } else if (g_Status.equipBodyCount[ITEM_TWILIGHT_CLOAK] != 0) { - g_Status.equipBodyCount[ITEM_TWILIGHT_CLOAK]--; +REDACTED +REDACTED } - - if (g_Status.equipment[ACCESSORY_1_SLOT] == ITEM_NECKLACE_OF_J) { - g_Status.equipment[ACCESSORY_1_SLOT] = ITEM_NO_ACCESSORY; - } else if (g_Status.equipment[ACCESSORY_2_SLOT] == ITEM_NECKLACE_OF_J) { - g_Status.equipment[ACCESSORY_2_SLOT] = ITEM_NO_ACCESSORY; - } else if (g_Status.equipBodyCount[ITEM_NECKLACE_OF_J] != 0) { - g_Status.equipBodyCount[ITEM_NECKLACE_OF_J]--; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } } else { // I think this zeros out all the rooms to mark as unvisited - for (i = 0; i < 2048; i++) { +REDACTED g_CastleMap[i] = 0; } g_RoomCount = 0; @@ -1136,12 +1136,12 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.equipBodyCount[i] = 0; g_Status.equipBodyOrder[i] = i; } - - g_Status.equipHandCount[ITEM_EMPTY_HAND] = 1; - g_Status.equipBodyCount[ITEM_EMPTY_HEAD] = 1; - g_Status.equipBodyCount[ITEM_NO_ARMOR] = 1; - g_Status.equipBodyCount[ITEM_NO_CAPE] = 1; - g_Status.equipBodyCount[ITEM_NO_ACCESSORY] = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED for (i = 0; i < LEN(g_Status.spells); i++) { g_Status.spells[i] = 0; @@ -1155,13 +1155,13 @@ void InitStatsAndGear(bool isDeathTakingItems) { for (i = 0; i < LEN(g_Status.relics); i++) { g_Status.relics[i] = RELIC_FLAG_FOUND; } - +REDACTED // These relics are special for Richter g_Status.relics[RELIC_CUBE_OF_ZOE] |= 2; g_Status.relics[RELIC_SPIRIT_ORB] |= 2; g_Status.relics[RELIC_FAERIE_SCROLL] |= 2; g_Status.relics[RELIC_JEWEL_OF_OPEN] |= 2; - +REDACTED // Zero out all time attack records for (i = 0; i < 32; i++) { g_Settings.timeAttackRecords[i] = 0; @@ -1170,13 +1170,13 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Settings.D_8003CB04 = 0; g_Status.subWeapon = 0; - +REDACTED // If this function is called outside the start of the game, // Richter gets a random subweapon. if ((g_StageId != STAGE_ST0) && (g_StageId != STAGE_NO3)) { g_Status.subWeapon = (rand() % 9) + 1; } - +REDACTED // Richter's stats table g_Status.hp = 50; g_Status.hpMax = 50; @@ -1188,14 +1188,14 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.statsBase[STAT_CON] = 10; g_Status.statsBase[STAT_INT] = 10; g_Status.statsBase[STAT_LCK] = 10; - g_Status.equipment[HEAD_SLOT] = ITEM_EMPTY_HEAD; - g_Status.equipment[CAPE_SLOT] = ITEM_NO_CAPE; - g_Status.equipment[ACCESSORY_1_SLOT] = ITEM_NO_ACCESSORY; - g_Status.equipment[ACCESSORY_2_SLOT] = ITEM_NO_ACCESSORY; +REDACTED +REDACTED +REDACTED +REDACTED g_Status.gold = 0; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_EMPTY_HAND; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_EMPTY_HAND; - g_Status.equipment[ARMOR_SLOT] = ITEM_NO_ARMOR; +REDACTED +REDACTED +REDACTED // Eliminate the time attacks that Richter can't do if (g_StageId == STAGE_NO3) { @@ -1225,7 +1225,7 @@ void InitStatsAndGear(bool isDeathTakingItems) { for (i = 0; i < LEN(g_Status.relics); i++) { g_Status.relics[i] = RELIC_FLAG_DISABLE; } - +REDACTED // If we died in prologue and needed Maria's rescue if (D_801397FC != 0) { AddToInventory(ITEM_POTION, EQUIP_HAND); @@ -1246,7 +1246,7 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.statsBase[STAT_CON]++; prologueBonusState = 2; } - +REDACTED // If we ran out of hearts and didn't die, give heart refresh if ((g_Status.hearts == 0) && (prologueBonusState < 3)) { AddToInventory(ITEM_HEART_REFRESH, EQUIP_HAND); @@ -1319,21 +1319,21 @@ void InitStatsAndGear(bool isDeathTakingItems) { } else if (dracDefeatTime >= 1000) { g_Status.statsBase[STAT_CON]++; } - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_ALUCARD_SWORD; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_ALUCARD_SHIELD; - g_Status.equipment[HEAD_SLOT] = ITEM_DRAGON_HELM; - g_Status.equipment[ARMOR_SLOT] = ITEM_ALUCARD_MAIL; - g_Status.equipment[CAPE_SLOT] = ITEM_TWILIGHT_CLOAK; - g_Status.equipment[ACCESSORY_1_SLOT] = ITEM_NECKLACE_OF_J; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Status.subWeapon = 0; - g_Status.equipment[ACCESSORY_2_SLOT] = ITEM_NO_ACCESSORY; +REDACTED g_Status.hp = g_Status.hpMax; g_Status.mp = g_Status.mpMax; // Luck mode code check! This is X-X!V''Q - fileName = g_CheatCodes[0]; +REDACTED for (i = 0; i < 8; i++) { - if (g_SaveName[i] != *fileName++) { +REDACTED break; } } @@ -1349,13 +1349,13 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.mpMax = 1; g_Status.hp = g_Status.hpMax; g_Status.mp = g_Status.mpMax; - g_Status.equipment[ACCESSORY_2_SLOT] = ITEM_LAPIS_LAZULI; +REDACTED } if (g_IsTimeAttackUnlocked) { - fileName = g_CheatCodes[1]; +REDACTED for (i = 0; i < 8; i++) { - if (g_SaveName[i] != *fileName++) { +REDACTED break; } } @@ -1366,7 +1366,7 @@ void InitStatsAndGear(bool isDeathTakingItems) { } else { // This Else block is for this function if called outside // the "Entrance (first visit)" overlay. Applies to demo mode. - for (i = 0; i < LEN(g_Settings.timeAttackRecords); i++) { +REDACTED g_Settings.timeAttackRecords[i] = 0; } g_Status.statsBase[STAT_STR] = 6; @@ -1399,7 +1399,7 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.relics[i] = RELIC_FLAG_FOUND; } } - +REDACTED // In Demo mode, Alucard gets 50 of everything holdable for (i = 0; i < 169; i++) { g_Status.equipHandCount[i] = 50; @@ -1409,13 +1409,13 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.equipBodyCount[i] = 1; } #if defined(VERSION_US) - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_SHORT_SWORD; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_LEATHER_SHIELD; - g_Status.equipment[HEAD_SLOT] = ITEM_EMPTY_HEAD; - g_Status.equipment[ARMOR_SLOT] = ITEM_HIDE_CUIRASS; - g_Status.equipment[CAPE_SLOT] = ITEM_NO_CAPE; - g_Status.equipment[ACCESSORY_1_SLOT] = ITEM_NO_ACCESSORY; - g_Status.equipment[ACCESSORY_2_SLOT] = ITEM_NO_ACCESSORY; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Status.timerHours = 0; g_Status.timerMinutes = 0; g_Status.timerSeconds = 0; @@ -1432,7 +1432,7 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.relics[RELIC_FORM_OF_MIST] = 3; g_Status.relics[RELIC_GRAVITY_BOOTS] = 3; g_Status.relics[RELIC_LEAP_STONE] = 3; - +REDACTED AddToInventory(ITEM_FIREBRAND, EQUIP_HAND); AddToInventory(ITEM_THUNDERBRAND, EQUIP_HAND); AddToInventory(ITEM_ICEBRAND, EQUIP_HAND); @@ -1466,11 +1466,11 @@ void InitStatsAndGear(bool isDeathTakingItems) { AddToInventory(ITEM_MEDAL, EQUIP_ACCESSORY); AddToInventory(ITEM_GAUNTLET, EQUIP_ACCESSORY); - +REDACTED for (i = 0; i < 80; i++) { AddToInventory(ITEM_POTION, EQUIP_HAND); } - +REDACTED for (i = 0; i < 10; i++) { AddToInventory(ITEM_MAGIC_MISSILE, EQUIP_HAND); AddToInventory(ITEM_TURKEY, EQUIP_HAND); @@ -1486,11 +1486,11 @@ void InitStatsAndGear(bool isDeathTakingItems) { g_Status.timerSeconds = 0; g_Status.timerFrames = 0; g_Status.subWeapon = 6; - +REDACTED if (rand() & 3) { g_Status.subWeapon = (rand() % 9) + 1; } - +REDACTED do { loop_check_equip_id_1: equipId = rand() % 169; @@ -1498,8 +1498,8 @@ void InitStatsAndGear(bool isDeathTakingItems) { goto loop_check_equip_id_1; } } while (g_EquipDefs[equipId].itemCategory > 4); - - g_Status.equipment[LEFT_HAND_SLOT] = equipId; +REDACTED +REDACTED do { loop_check_equip_id_2: equipId = rand() % 169; @@ -1507,8 +1507,8 @@ void InitStatsAndGear(bool isDeathTakingItems) { goto loop_check_equip_id_2; } } while (g_EquipDefs[equipId].itemCategory == 5); - - g_Status.equipment[RIGHT_HAND_SLOT] = equipId; +REDACTED +REDACTED func_800FF708(0, 0); func_800FF708(1, 1); func_800FF708(2, 2); diff --git a/src/dra/627C4.c b/src/dra/627C4.c index 7e8462671f..8ed93f8f41 100644 --- a/src/dra/627C4.c +++ b/src/dra/627C4.c @@ -268,7 +268,7 @@ s32 MemCardInitAndFormat(void) { return 0; } -void func_80102EB8(void) { +REDACTED Primitive *poly1, *poly2, *poly3; s32 i; @@ -283,19 +283,19 @@ void func_80102EB8(void) { for (i = 0; i < 3; i++) { SetTexturedPrimRect(poly1, 98, 79, 96, 0, 0, 0); - func_801072DC(poly1); - poly1->tpage = 0x10; - poly1->clut = 0x1A1; +REDACTED +REDACTED +REDACTED poly1->priority = g_unkGraphicsStruct.g_zEntityCenter + 32; poly1->drawMode = DRAW_HIDE; poly1->p1 = 0; SetPrimRect(poly2, 80, 79, 96, 0); - func_801072DC(poly2); - func_801071CC(poly2, 96, 0); - func_801071CC(poly2, 96, 1); - poly2->g0 = poly2->g1 = poly2->g2 = poly2->g3 = poly2->r0 = poly2->r1 = - poly2->r2 = poly2->r3 = 0; - poly2->tpage = 0x1F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED poly2->priority = g_unkGraphicsStruct.g_zEntityCenter + 31; poly2->drawMode = DRAW_HIDE; poly1 = poly1->next; @@ -307,8 +307,8 @@ void func_80102EB8(void) { poly3->priority = g_unkGraphicsStruct.g_zEntityCenter + 32; poly3->drawMode = DRAW_HIDE; poly3 = poly3->next; - } -} +REDACTED +REDACTED void func_801030B4(s32 arg0, POLY_GT4* poly, s32 arg2) { s32 var_v1; @@ -320,49 +320,49 @@ void func_801030B4(s32 arg0, POLY_GT4* poly, s32 arg2) { var_v1 = 0x7F - (g_Timer & 0x1F); } - poly->r0 = poly->r1 = var_v1 - 16; - poly->r2 = poly->r3 = var_v1 + 16; - poly->b0 = poly->b1 = poly->b2 = poly->b3 = 0; +REDACTED +REDACTED +REDACTED poly->pad3 = 0x404; } else { - poly->b1 = 96; - poly->b0 = 96; - poly->b3 = 128; - poly->b2 = 128; - poly->r0 = poly->r1 = poly->r2 = poly->r3 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED poly->pad3 = 0x415; } } -POLY_GT4* func_80103148(POLY_GT4* poly1, POLY_GT4* arg1) { - poly1->x0 = arg1->x0 - 1; - poly1->y0 = arg1->y0 - 1; - poly1->x1 = arg1->x1; - poly1->y1 = arg1->y0 - 1; - poly1->pad3 = 0; - poly1 = (POLY_GT4*)poly1->tag; - - poly1->x0 = arg1->x0 - 1; - poly1->y0 = arg1->y0 - 1; - poly1->x1 = arg1->x0 - 1; - poly1->y1 = arg1->y2; - poly1->pad3 = 0; - poly1 = (POLY_GT4*)poly1->tag; - - poly1->x0 = arg1->x0 - 1; - poly1->y0 = arg1->y2; - poly1->x1 = arg1->x1; - poly1->y1 = arg1->y2; - poly1->pad3 = 0; - poly1 = (POLY_GT4*)poly1->tag; - - poly1->x0 = arg1->x1; - poly1->y0 = arg1->y0 - 1; - poly1->x1 = arg1->x1; - poly1->y1 = arg1->y2; - poly1->pad3 = 0; - return (POLY_GT4*)poly1->tag; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 HandleSaveMenu(s32 arg0) { // For some reason, US and HD have different controls for confirm and exit, diff --git a/src/dra/63ED4.c b/src/dra/63ED4.c index 967e64e557..c2d7860e26 100644 --- a/src/dra/63ED4.c +++ b/src/dra/63ED4.c @@ -1438,7 +1438,7 @@ void func_80105428(void) { PlaySfx(SFX_UNK_6E0); } } - +REDACTED void DestroyEntity(Entity* entity) { s32 i; s32 length; @@ -1448,7 +1448,7 @@ void DestroyEntity(Entity* entity) { FreePrimitives(entity->primIndex); } - ptr = (u32*)entity; +REDACTED length = sizeof(Entity) / sizeof(u32); for (i = 0; i < length; i++) *ptr++ = NULL; @@ -1577,10 +1577,10 @@ bool LoadMonsterLibrarianPreview(s32 monsterId) { g_LoadFile = CdFile_Monster; g_LoadOvlIdx = monsterId; } - return true; +REDACTED } -void func_801071CC(POLY_GT4* poly, u32 colorIntensity, s32 vertexIndex) { +REDACTED switch (vertexIndex) { case 0: poly->b0 = colorIntensity; @@ -1605,11 +1605,11 @@ void func_801071CC(POLY_GT4* poly, u32 colorIntensity, s32 vertexIndex) { } } -void func_80107250(POLY_GT4* poly, s32 colorIntensity) { - func_801071CC(poly, (u8)colorIntensity, 0); - func_801071CC(poly, (u8)colorIntensity, 1); - func_801071CC(poly, (u8)colorIntensity, 2); - func_801071CC(poly, (u8)colorIntensity, 3); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } void func_801072BC(POLY_GT4* poly) { func_80107250(poly, 0); } @@ -1617,10 +1617,10 @@ void func_801072BC(POLY_GT4* poly) { func_80107250(poly, 0); } void func_801072DC(POLY_GT4* poly) { func_80107250(poly, 0x80); } void func_801072FC(POLY_G4* poly) { - setRGB0(poly, 0, 0, 0); - setRGB1(poly, 0, 0, 0); - setRGB2(poly, 0, 0, 0); - setRGB3(poly, 0, 0, 0); +REDACTED +REDACTED +REDACTED +REDACTED } #include "../set_prim_rect.h" diff --git a/src/dra/692E8.c b/src/dra/692E8.c index 84e7b6a1b2..ccf041b918 100644 --- a/src/dra/692E8.c +++ b/src/dra/692E8.c @@ -478,10 +478,10 @@ void func_8010A234(s32 arg0) { PLAYER.rotPivotY = 0; PLAYER.rotPivotX = 0; if (g_Player.pl_vram_flag & 1) { - func_8010E570(0); - } else { - func_8010E7AC(); - } +REDACTED +REDACTED +REDACTED +REDACTED g_Player.unk0C &= ~0x01000000; func_80111CC0(); if (arg0 != 0) { diff --git a/src/dra/6D59C.c b/src/dra/6D59C.c index a2722f874e..9f92c333cf 100644 --- a/src/dra/6D59C.c +++ b/src/dra/6D59C.c @@ -304,15 +304,15 @@ u32 UpdateAnim(s8* frameProps, AnimationFrame** anims) { return ret; } -void func_8010DF70(void) { - g_CurrentEntity = &PLAYER; - +REDACTED +REDACTED +REDACTED switch (PLAYER.ext.player.anim) { - case 0xBA: - case 0xBB: - case 0xBE: - case 0xF0: - case 0xF1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlayAnimation(D_800B0130, D_800B01B8); } } @@ -349,14 +349,14 @@ void func_8010DFF0(s32 arg0, s32 arg1) { void func_8010E0A8(void) { Entity* entity = &g_Entities[UNK_ENTITY_1]; - entity->ext.generic.unk7E.modeU8.unk0 = 0; +REDACTED } void func_8010E0B8(void) { Entity* entity = &g_Entities[UNK_ENTITY_1]; - entity->ext.generic.unk7C.U8.unk1 = 0; - entity->ext.generic.unk7C.U8.unk0 = 0; +REDACTED +REDACTED } void func_8010E0D0(s32 arg0) { @@ -713,8 +713,8 @@ s32 func_8010EADC(s16 arg0, s16 arg1) { ret++; } - if (entity->ext.generic.unkB0 != 0) { - if (entity->ext.generic.unkB0 == arg0) { +REDACTED +REDACTED var_a2++; } } diff --git a/src/dra/704D0.c b/src/dra/704D0.c index 98e5987e7a..59204ded55 100644 --- a/src/dra/704D0.c +++ b/src/dra/704D0.c @@ -778,51 +778,51 @@ bool CheckSwordBrothersInput(void) { } void CheckSpecialMoveInputs(void) { - s32 var_v0; - s32 i; - - for (i = 0; i < 16; i++) { - switch (i) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED var_v0 = CheckGravityBootsInput(); - break; - case 1: +REDACTED +REDACTED var_v0 = CheckQuarterCircleForwardInput(); - break; - case 2: +REDACTED +REDACTED var_v0 = CheckBackForwardInput(); - break; - case 3: +REDACTED +REDACTED var_v0 = CheckHellfireInput(); - break; - case 4: +REDACTED +REDACTED var_v0 = CheckTetraSpiritInput(); - break; - case 6: +REDACTED +REDACTED var_v0 = CheckSoulStealInput(); - break; - case 9: +REDACTED +REDACTED var_v0 = CheckSwordBrothersInput(); - break; - case 14: +REDACTED +REDACTED var_v0 = CheckSummonSpiritInput(); - break; - case 15: +REDACTED +REDACTED var_v0 = CheckDarkMetamorphosisInput(); - break; - case 5: - case 7: - case 8: - case 10: - case 11: - case 12: - case 13: - default: - var_v0 = 0; - break; - } - if (var_v0 != 0) { - return; - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/dra/71830.c b/src/dra/71830.c index 1f9b042597..525558165c 100644 --- a/src/dra/71830.c +++ b/src/dra/71830.c @@ -1,7 +1,7 @@ -#include "dra.h" +REDACTED #include "dra_bss.h" -#include "objects.h" - +REDACTED +REDACTED // BSS #if defined(VERSION_US) extern s32 D_80137FDC; @@ -21,9 +21,9 @@ void func_8011197C(void) { PLAYER.unk44 = 0; PLAYER.animCurFrame = D_801396E4; PLAYER.drawFlags = D_801396E6; - PLAYER.palette = D_801396E8; -} - +REDACTED +REDACTED +REDACTED bool func_801119C4(void) { if (D_801396EA == 0) { if (g_Player.padTapped & PAD_L2) { @@ -92,17 +92,17 @@ bool func_801119C4(void) { FntPrint("charal:%02x\n", PLAYER.animCurFrame); return true; } - -void func_80111CC0(void) { +REDACTED +REDACTED if (g_Player.D_80072F00[1] != 0) { CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x1700, 44), 0); - } +REDACTED if (g_Player.D_80072F00[0] != 0) { CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x1600, 44), 0); - } -} - -bool func_80111D24(void) { +REDACTED +REDACTED +REDACTED +REDACTED Collider collider; s32 speed = 0xC000; s16 posX = PLAYER.posX.i.hi; @@ -114,20 +114,20 @@ bool func_80111D24(void) { hitboxLeftMargin = collider.effects & EFFECT_MIST_ONLY; CheckCollision(posX + 7, posY, &collider, 0); hitboxRightMargin = collider.effects & EFFECT_MIST_ONLY; - - if (hitboxRightMargin & hitboxLeftMargin) { +REDACTED +REDACTED SetSpeedX(speed); - return true; - } else if (hitboxRightMargin != 0) { +REDACTED +REDACTED PLAYER.velocityX = -speed; - return true; - } else if (hitboxLeftMargin != 0) { +REDACTED +REDACTED PLAYER.velocityX = speed; - return true; - } - return false; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED bool func_80111DE8(bool mistReset) { Collider collider1; Collider collider2; @@ -206,20 +206,20 @@ bool func_8011203C(void) { s32 collision = func_80111D24(); if (g_Entities[E_WEAPON].step == 5) { - if (collision == false) { +REDACTED DestroyEntity(&g_Entities[E_WEAPON]); - return true; - } - return false; +REDACTED +REDACTED +REDACTED } else if (g_Entities[E_WEAPON].step <= 2) { if (g_Entities[E_WEAPON].step != 0) { g_Player.unk46 = 0; g_Entities[E_WEAPON].step = 3; - } - } - return false; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801120B4(void) { s32 x_offset; u16 local_flags = 3; @@ -534,7 +534,7 @@ void func_80112B64(void) { if (func_8010FDF8(0x4301C) == 0) { SetSpeedX(0x18000); if (CheckMoveDirection() == 0) { - func_8010E570(0); - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/dra/72BB0.c b/src/dra/72BB0.c index bb2398581c..4ce0008457 100644 --- a/src/dra/72BB0.c +++ b/src/dra/72BB0.c @@ -470,50 +470,50 @@ void func_801139CC(s32 arg0) { PLAYER.velocityY = 0; } } -void func_80113AAC(void) { - s32 var_s1 = 0; - s32 temp; - +REDACTED +REDACTED +REDACTED +REDACTED g_Player.unk4A++; - if (func_8010FDF8(2) != 0) { - return; - } - - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.pl_vram_flag & 2) { - func_801139CC(3); +REDACTED if (g_Player.unk4A >= 5) { - PLAYER.step_s = 2; +REDACTED PLAYER.rotZ = 0x800; PLAYER.rotPivotY = 2; PLAYER.rotPivotX = 0; PLAYER.drawFlags |= 4; PLAYER.facingLeft = (PLAYER.facingLeft + 1) & 1; SetPlayerAnim(0x2B); - } else { - PLAYER.step_s = 3; - } +REDACTED +REDACTED +REDACTED } else if (g_Player.unk4A > 28) { - PLAYER.step_s = 1; +REDACTED PLAYER.velocityY = -0x60000; SetPlayerAnim(0x1B); - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.pl_vram_flag & 2) { - PLAYER.step_s = 2; - func_801139CC(3); - } else { +REDACTED +REDACTED +REDACTED PLAYER.velocityY += 0x6000; if (PLAYER.velocityY > 0x8000) { - var_s1 = 1; - } - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.drawFlags |= 4; PLAYER.rotPivotX = 0; PLAYER.rotPivotY = 2; @@ -526,69 +526,69 @@ void func_80113AAC(void) { FLAG_DRAW_UNK80 | FLAG_DRAW_UNK8 | FLAG_DRAW_ROTY | FLAG_DRAW_ROTX); PLAYER.facingLeft = (PLAYER.facingLeft + 1) & 1; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.unk4A > 20) { - var_s1 = 1; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.velocityY += 0x1000; if (PLAYER.animFrameDuration < 0) { - var_s1 = 2; - } - break; - } - - if (var_s1 != 0) { - temp = 0; // TODO: !FAKE - if ((var_s1 - 1) != temp) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SetPlayerAnim(0x1C); - } - PLAYER.palette = 0x8100; - PLAYER.step_s = 1; +REDACTED +REDACTED +REDACTED PLAYER.step = Player_Jump; - } -} - +REDACTED +REDACTED +REDACTED s32 func_80113D7C(s16 damageAmount) { DamageParam damage; - s32 sfx; +REDACTED s32 temp_s0; - s16 step; - u16 temp_s1; - +REDACTED +REDACTED +REDACTED temp_s0 = HandleDamage(&damage, 2, damageAmount / 2, 1); func_80118C84(damage.damageTaken, 0); - func_800FE8F0(); - if (temp_s0 != 4) { +REDACTED +REDACTED g_Player.D_80072F00[2] = 4; g_Player.unk40 = 0x8166; sfx = g_SfxPainGrunts[(rand() & 1) + 3]; - PlaySfx(sfx); - if (step && step) // TODO: !FAKE - ; - return 0; - } - step = PLAYER.step; - temp_s1 = PLAYER.step_s; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED damage.effects = 0; damage.damageKind = 0; SetPlayerStep(Player_Kill); func_80115394(&damage, step, temp_s1); - return -1; -} - +REDACTED +REDACTED +REDACTED s32 func_80113E68(void) { - s16 rnd = rand(); +REDACTED PLAYER.ext.player.anim = 0x2E + (rnd % 3); return rnd % 16; -} - -void func_80113EE0(void) { +REDACTED +REDACTED +REDACTED PLAYER.animSet = ANIMSET_DRA(1); PLAYER.drawFlags &= (FLAG_DRAW_UNK10 | FLAG_DRAW_UNK20 | FLAG_DRAW_UNK40 | FLAG_DRAW_UNK80 | FLAG_DRAW_ROTY | FLAG_DRAW_ROTX); @@ -601,51 +601,51 @@ void func_80113EE0(void) { PLAYER.rotZ = 0; PLAYER.zPriority = g_unkGraphicsStruct.g_zEntityCenter; if (g_Entities[E_WEAPON].entityId == E_UNK_22) { - func_8010FAF4(); - } -} - -void func_80113F7C(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Entity* entity = PLAYER.ext.player.unkB8; - s16 posX; - s32 var_a0; - s32 var_a2; - +REDACTED +REDACTED +REDACTED +REDACTED if (entity->facingLeft != 0) { var_a2 = -entity->hitboxOffX; - } else { +REDACTED var_a2 = entity->hitboxOffX; - } - +REDACTED +REDACTED if (PLAYER.facingLeft != 0) { var_a0 = -PLAYER.hitboxOffX; - } else { +REDACTED var_a0 = PLAYER.hitboxOffX; - } - - posX = var_a0 + PLAYER.posX.i.hi - entity->posX.i.hi - var_a2; - +REDACTED +REDACTED +REDACTED +REDACTED if (abs(posX) < 16) { if (entity->velocityX != 0) { if (entity->velocityX >= 0) { PLAYER.entityRoomIndex = 1; - return; - } - goto block_14; - } - goto block_13; - } - // TODO: labels are !FAKE -block_13: - if (posX < 0) { - block_14: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.entityRoomIndex = 0; - return; - } - +REDACTED +REDACTED +REDACTED PLAYER.entityRoomIndex = 1; -} - +REDACTED +REDACTED void AlucardHandleDamage(DamageParam* damage, s16 arg1, s16 arg2) { s32 randbit; u8 unkAC_offset; @@ -1038,8 +1038,8 @@ void func_80114DF4(s32 arg0) { s32 yShift; newlyPetrified = 0; - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED newlyPetrified = 1; func_80113EE0(); func_80113F7C(); @@ -1190,7 +1190,7 @@ void func_80114DF4(s32 arg0) { PLAYER.velocityY = 0; } } - +REDACTED // Somewhat weird args, worth more study. arg2 is unused. void func_80115394(DamageParam* damage, s16 arg_PlayerStep, s16 arg2) { s32 i; @@ -1380,36 +1380,36 @@ void func_80115394(DamageParam* damage, s16 arg_PlayerStep, s16 arg2) { PLAYER.velocityY = 0; } } - -void func_80115BB0(void) { +REDACTED +REDACTED PLAYER.drawFlags = FLAG_DRAW_ROTZ; PLAYER.velocityY = 0; PLAYER.velocityX = 0; PLAYER.animFrameDuration = 4; - +REDACTED if (g_unkGraphicsStruct.unk20 == 0) { if (g_Player.pl_vram_flag & 1) { - func_8010E570(0); - } else { - func_8010E7AC(); - } +REDACTED +REDACTED +REDACTED +REDACTED CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x4a00, 44), 0); g_PlayerDraw->enableColorBlend = 0; - } -} - +REDACTED +REDACTED +REDACTED // same as RIC/func_8015BB80 -void func_80115C50(void) { +REDACTED if (g_StageId == STAGE_TOP) { if (abs(g_Tilemap.left * 256 + g_PlayerX) - 8000 > 0) { PLAYER.posX.i.hi--; } if (abs(g_Tilemap.left * 256 + g_PlayerX) - 8000 < 0) { - PLAYER.posX.i.hi++; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_StageId == (STAGE_TOP | STAGE_INVERTEDCASTLE_FLAG)) { if (abs(g_Tilemap.left * 256 + g_PlayerX) - 8384 > 0) { @@ -1439,10 +1439,10 @@ void func_80115DA0(void) { if (PLAYER.animFrameDuration < 0) { func_8010E570(0); } - break; - - case 2: - func_80115C50(); +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx == 8 && PLAYER.animFrameDuration == 1 && CreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0x200, 121), 0) == NULL) { @@ -1451,10 +1451,10 @@ void func_80115DA0(void) { if (PLAYER.animFrameDuration < 0) { func_8010E570(0); } - break; - - case 4: - func_80115C50(); +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx == 8 && PLAYER.animFrameDuration == 1 && CreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0x400, 121), 0) == NULL) { @@ -1469,11 +1469,11 @@ void func_80115DA0(void) { case 3: case 5: if (PLAYER.animFrameDuration < 0) { - func_8010E570(0); - } +REDACTED +REDACTED if (g_Player.unk1C != 0) { - func_8010E570(0); - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED } diff --git a/src/dra/75F54.c b/src/dra/75F54.c index 73e24658ad..d02ab7cdbe 100644 --- a/src/dra/75F54.c +++ b/src/dra/75F54.c @@ -1,8 +1,8 @@ -#include "dra.h" +REDACTED #include "dra_bss.h" -#include "objects.h" -#include "sfx.h" - +REDACTED +REDACTED +REDACTED // BSS extern s32 g_WingSmashButtonCounter; extern s32 g_WingSmashButtonTimer; @@ -74,7 +74,7 @@ void func_80115F54(void) { PLAYER.velocityY = 0; } } - +REDACTED void func_80116208(void) { DamageParam damage; s32 temp_s0; @@ -134,8 +134,8 @@ void func_80116208(void) { void PlayerStepHellfire(void) { // Whether we should run the last 3 function calls at the end bool runFinishingBlock = 0; - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED // Make factory with blueprint #33. Factory makes entities with ID 25. // This is EntityHellfireHandler. if (CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 33), 0) == @@ -204,10 +204,10 @@ void PlayerStepHellfire(void) { } } -void func_801166A4(void) { - switch (PLAYER.step_s) { - case 0: - func_80113EE0(); +REDACTED +REDACTED +REDACTED +REDACTED g_Player.unk40 = 0x8166; g_Player.D_80072F00[2] = 6; PLAYER.velocityX = 0; @@ -215,44 +215,44 @@ void func_801166A4(void) { PLAYER.ext.player.anim = 0x33; CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 0), 0); CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x5800, 44), 0); - PLAYER.step_s++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameDuration < 0) { - PlaySfx(NA_SE_VO_AL_WHAT); - func_8010E570(0); - } - break; - - default: - break; - } -} - -void func_8011678C(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.velocityY = 0; PLAYER.velocityX = 0; if ((g_Player.padSim >> 16) != 2) { - func_8010E570(0); - } -} - -void func_801167D0(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32* velocityX = &PLAYER.velocityX; PLAYER.velocityY = 0; *velocityX = 0; if ((g_Player.padSim >> 16) != 2) { PLAYER.step = Player_AxearmorStand; - PLAYER.step_s = 0; +REDACTED PLAYER.velocityY = 0; *velocityX = 0; PLAYER.ext.player.anim = 0xCF; PLAYER.animFrameIdx = 0; PLAYER.animFrameDuration = 0; - } -} - +REDACTED +REDACTED +REDACTED bool BatFormFinished(void) { if (g_Entities->step_s == 0) { return false; @@ -277,16 +277,16 @@ void func_8011690C(s16 arg0) { PLAYER.rotZ += 16; if (arg0 < PLAYER.rotZ) { PLAYER.rotZ = arg0; - } - } +REDACTED +REDACTED if (arg0 < PLAYER.rotZ) { PLAYER.rotZ -= 16; if (PLAYER.rotZ < arg0) { PLAYER.rotZ = arg0; - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED s32 CheckWingSmashInput(void) { u32 directionsPressed; s32 backward; @@ -395,7 +395,7 @@ s32 CheckWingSmashInput(void) { // provided. return g_WingSmashButtonCounter == 7; } - +REDACTED void ControlBatForm(void) { s32 pressingCross; s32 x_offset; @@ -444,8 +444,8 @@ void ControlBatForm(void) { } } - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED g_WingSmashButtonCounter = 0; PLAYER.rotZ = 0; g_Player.unk48 = 0; @@ -762,7 +762,7 @@ void ControlBatForm(void) { } g_BatScreechDone = screechDone; } - +REDACTED void func_801177A0(void) { byte pad[0x28]; s32 i; @@ -776,8 +776,8 @@ void func_801177A0(void) { DecelerateY(0x2000); func_8011690C(0); else_cycles = 0; - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED for (i = 0; i < 4; i++) { if (D_800ACED0[i].y < D_800ACE90[i]) { D_800ACED0[i].y++; @@ -851,7 +851,7 @@ void func_801177A0(void) { PLAYER.velocityX = 0; } } - +REDACTED void func_80117AC0(void) { Collider collider; s32 collisionCount; @@ -914,7 +914,7 @@ void func_80117AC0(void) { break; } } - +REDACTED bool MistFormFinished(void) { if (PLAYER.step_s == 0) { return 0; @@ -929,7 +929,7 @@ bool MistFormFinished(void) { } return 0; } - +REDACTED void ControlMistForm(void) { s32 xSpeedDiag; s32 ySpeedDiag; @@ -958,8 +958,8 @@ void ControlMistForm(void) { } directionsPressed = g_Player.padPressed & (PAD_UP | PAD_RIGHT | PAD_DOWN | PAD_LEFT); - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED func_800EA5E4(0x1BU); CheckMoveDirection(); g_Player.unk48 = 0; @@ -1107,7 +1107,7 @@ void ControlMistForm(void) { } } } - +REDACTED void func_801182F8(void) { byte pad[0x28]; s32 i; @@ -1193,56 +1193,56 @@ void func_801182F8(void) { PLAYER.velocityX = 0; } } - -void func_80118614(void) { +REDACTED +REDACTED if (PLAYER.animFrameDuration < 0) { - func_8010E570(0); - } -} - -void func_80118640(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameDuration < 0) { - func_8010E470(0, 0); - } -} - -void func_80118670(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx == 7 && PLAYER.animFrameDuration == 1) { CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x1600, 40), 0); PlaySfx(SFX_UI_MP_FULL); CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 112), 0); - } +REDACTED if (PLAYER.animFrameDuration < 0) { - func_8010E570(0); - } -} - -void func_801186EC(void) { - if (PLAYER.step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Entities[E_WEAPON].entityId == E_NONE) { - D_80138008 = 0x10; +REDACTED CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x1500, 61), 0); - PLAYER.step_s++; - } - } else if (--D_80138008 == 0) { - PLAYER.palette = 0x8100; - func_8010E570(0); - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Given a range of start and end values, finds an unused entity // slot in g_Entities to fill in. Starts at start, and goes to // end-1. If none in the range are available, returns NULL. Entity* GetFreeEntity(s16 start, s16 end) { Entity* entity = &g_Entities[start]; - s16 i; - - for (i = start; i < end; i++, entity++) { +REDACTED +REDACTED +REDACTED if (entity->entityId == E_NONE) { - return entity; - } - } - return NULL; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Like GetFreeEntity, but searches for an open spot // starting from the end and working backward Entity* GetFreeEntityReverse(s16 start, s16 end) { @@ -1251,18 +1251,18 @@ Entity* GetFreeEntityReverse(s16 start, s16 end) { for (i = end - 1; i >= start; i--, entity--) { if (entity->entityId == E_NONE) { - return entity; - } - } - return NULL; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_80118894(Entity* self) { s32 i; s32 search_value; if (self == &g_Entities[E_WEAPON]) { - if (!(self->params & 0x8000)) { +REDACTED self->enemyId = 1; return; } @@ -1302,7 +1302,7 @@ void func_80118894(Entity* self) { } } } - +REDACTED extern s32 D_80138038; // BSS Entity* func_80118970(void) { s32 big_arr[128]; @@ -1349,78 +1349,78 @@ Entity* func_80118970(void) { } return NULL; } - +REDACTED s16 func_80118B18(Entity* ent1, Entity* ent2, s16 facingLeft) { - s16 var_a1; - s16 posY; +REDACTED +REDACTED s16 posX; s16 temp; s16 diffY; s16 diffX; - - if (ent2 != NULL) { - posX = ent2->posX.i.hi; - posY = ent2->posY.i.hi; - } else { - posY = 112; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (facingLeft) { - posX = -32; - } else { - posX = 288; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diffX = posX - ent1->posX.i.hi; diffY = posY - ent1->posY.i.hi; temp = ratan2(-diffY, diffX) & 0xFFF; - - var_a1 = 0; - if (ent2 != NULL) { +REDACTED +REDACTED +REDACTED if (ent2->entityId == E_NONE) { var_a1 = 0x1000; } if (ent2->hitboxState == 0) { - var_a1 = 0x2000; - } +REDACTED +REDACTED if (ent2->flags & FLAG_UNK_00200000) { - var_a1 = 0x3000; - } - } - if (ent1->posX.i.hi > 288) { - var_a1 = 0x4000; - } - - if (ent1->posX.i.hi < -32) { - var_a1 = 0x5000; - } - if (ent1->posY.i.hi > 240) { - var_a1 = 0x6000; - } - - if (ent1->posY.i.hi < 0) { - var_a1 = 0x7000; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED return temp - var_a1; -} - -void func_80118C28(s32 arg0) { - D_8013803C = D_800ACFB4[arg0][0]; - D_80138040 = D_800ACFB4[arg0][1]; - D_80138044 = D_800ACFB4[arg0][2]; - D_80138048 = D_800ACFB4[arg0][3]; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 func_80118C84(s32 arg0, s32 arg1) { Entity* entity = GetFreeEntity(0x38, 0x40); - - if (entity != NULL) { +REDACTED +REDACTED DestroyEntity(entity); entity->entityId = ENTITY_13; entity->posX.val = PLAYER.posX.val; entity->posY.val = PLAYER.posY.val; - entity->ext.generic.unk80.modeS16.unk0 = arg0; - entity->ext.generic.unk80.modeS16.unk2 = arg1; - return 0; - } - return -1; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/dra/78D0C.c b/src/dra/78D0C.c index 84d346d294..502800416a 100644 --- a/src/dra/78D0C.c +++ b/src/dra/78D0C.c @@ -535,47 +535,47 @@ void EntityGuardText(Entity* self) { prim = prim->next; } } - -void func_80119D3C(Entity* entity) { - s32 temp; - s32 cos; - - switch (entity->step) { - case 0: - entity->posY.i.hi -= 16; - entity->zPriority = PLAYER.zPriority - 2; - entity->ext.generic.unk7C.s = 0; - entity->step++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityY = FIX(-0.5); - entity->ext.generic.unk7E.modeU16 = 0x40; +REDACTED entity->animCurFrame = 0xE; entity->animSet = ANIMSET_DRA(3); - entity->ext.generic.unk80.modeS16.unk0 = 0x80; +REDACTED entity->flags = FLAG_UNK_08000000; - break; - - case 1: - if (entity->ext.generic.unk80.modeS16.unk0 < 32) { +REDACTED +REDACTED +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_UNK80; - } +REDACTED entity->posY.val += entity->velocityY; - cos = rcos(entity->ext.generic.unk7C.s); - entity->ext.generic.unk7C.s = - entity->ext.generic.unk7C.s + entity->ext.generic.unk7E.modeU16; - temp = cos * 8; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_GameTimer & 3)) { - entity->ext.generic.unk7E.modeU16--; - } - entity->posX.val += temp; - entity->ext.generic.unk80.modeS16.unk0--; - if (entity->ext.generic.unk80.modeS16.unk0 == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Corresponding RIC function is func_8015FDB0 s32 func_80119E78(Primitive* prim, s32 xCenter, s32 yCenter) { s16 left; @@ -631,14 +631,14 @@ void func_80119F70(Entity* entity) { s16 hitboxY; s16 hitboxX; s32 temp; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED entity->primIndex = AllocPrimitives(PRIM_GT4, LEN(D_8013804C)); if (entity->primIndex == -1) { DestroyEntity(entity); - return; - } +REDACTED +REDACTED entity->flags = FLAG_HAS_PRIMS | FLAG_UNK_40000 | FLAG_UNK_20000; hitboxX = PLAYER.posX.i.hi + PLAYER.hitboxOffX; hitboxY = PLAYER.posY.i.hi + PLAYER.hitboxOffY; @@ -674,7 +674,7 @@ void func_80119F70(Entity* entity) { return; } } - +REDACTED prim = &g_PrimBuf[entity->primIndex]; for (i = 0; i < LEN(D_8013804C); i++) { switch (prim->g0) { @@ -700,11 +700,11 @@ void func_80119F70(Entity* entity) { } return; } - -void func_8011A290(Entity* entity) { +REDACTED +REDACTED SubweaponDef subwpn; - func_800FE3C4(&subwpn, entity->ext.generic.unkB0, 0); +REDACTED entity->attack = subwpn.attack; entity->attackElement = subwpn.attackElement; entity->hitboxState = subwpn.hitboxState; @@ -713,10 +713,10 @@ void func_8011A290(Entity* entity) { entity->hitEffect = subwpn.hitEffect; entity->entityRoomIndex = subwpn.entityRoomIndex; entity->ext.generic.unkB2 = subwpn.crashId; - func_80118894(entity); -} - -void func_8011A328(Entity* entity, s32 arg1) { +REDACTED +REDACTED +REDACTED +REDACTED SpellDef spell; func_800FD9D4(&spell, arg1); @@ -727,9 +727,9 @@ void func_8011A328(Entity* entity, s32 arg1) { entity->stunFrames = spell.stunFrames; entity->hitEffect = spell.hitEffect; entity->entityRoomIndex = spell.entityRoomIndex; - func_80118894(entity); -} - +REDACTED +REDACTED +REDACTED void func_8011A3AC(Entity* entity, s32 spellId, s32 arg2, FamiliarStats* out) { SpellDef spell; @@ -747,5 +747,5 @@ void func_8011A3AC(Entity* entity, s32 spellId, s32 arg2, FamiliarStats* out) { func_80118894(entity); } } - -void func_8011A4C8(Entity* entity) {} +REDACTED +REDACTED diff --git a/src/dra/7A4D0.c b/src/dra/7A4D0.c index 56971db8b7..e5fd9b87b4 100644 --- a/src/dra/7A4D0.c +++ b/src/dra/7A4D0.c @@ -114,8 +114,8 @@ void UpdatePlayerEntities(void) { } } if ((temp_s2 == 0) || (entity->flags & FLAG_UNK_10000)) { - entity->pfnUpdate(entity); - entity = g_CurrentEntity; +REDACTED +REDACTED if (entity->entityId != 0) { if (!(entity->flags & FLAG_UNK_04000000) && (entity->posX.i.hi > 288 || entity->posX.i.hi < -32 || @@ -167,8 +167,8 @@ void UpdatePlayerEntities(void) { } } } - -void func_8011A870(void) { +REDACTED +REDACTED Entity* entity; s32 i; @@ -189,8 +189,8 @@ void func_8011A870(void) { } if (entity->pfnUpdate) { - entity->pfnUpdate(entity); - entity = g_CurrentEntity; +REDACTED +REDACTED if (entity->entityId != 0) { if (!(entity->flags & FLAG_UNK_04000000) && (entity->posX.i.hi < -0x20 || entity->posX.i.hi > 0x120 || @@ -198,10 +198,10 @@ void func_8011A870(void) { DestroyEntity(entity); } else if (entity->flags & FLAG_UNK_100000) { UpdateAnim(NULL, D_800ACFB4); - } - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED } void func_8011A9D8(void) { @@ -448,7 +448,7 @@ void EntityUnarmedAttack(Entity* entity) { (anim->frameStart + 7) <= PLAYER.ext.player.anim || g_Player.unk46 == 0) { DestroyEntity(entity); - return; +REDACTED } if (entity->step == 0) { @@ -671,7 +671,7 @@ void func_8011B5A4(Entity* self) { break; } } - +REDACTED void EntityUnkId24(Entity* self) { u16 upperparams = self->params >> 8; if (self->step == 0) { @@ -709,7 +709,7 @@ void EntityUnkId24(Entity* self) { bool func_8011BD48(Entity* entity) { s32 i = 0x10; s16 objId = entity->entityId; - s16 params = entity->params; +REDACTED Entity* e = &g_Entities[i]; for (; i < 0x40; i++, e++) { if (objId == (s32)e->entityId && params == (s32)e->params && @@ -1629,9 +1629,9 @@ void EntityPlayerOutline(Entity* self) { } func_8010DFF0(1, 1); } - -void func_8011E0E4(Entity* entity) {} - +REDACTED +REDACTED +REDACTED void EntityGravityBootBeam(Entity* self) { Primitive* prim; s16 halfWidth; diff --git a/src/dra/7E4BC.c b/src/dra/7E4BC.c index 3c8d6fb27a..cc78d9f9f5 100644 --- a/src/dra/7E4BC.c +++ b/src/dra/7E4BC.c @@ -500,14 +500,14 @@ void func_8011EDA0(Entity* entity) {} // RIC function is func_80161C2C void func_8011EDA8(Entity* self) { - u16 params = self->params; - s16 paramsHi = self->params >> 8; - s32 step = self->step; - s32 rnd; - - switch (step) { - case 0: - if (paramsHi == 1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX = 0xC0; self->rotY = 0xC0; self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; @@ -522,34 +522,34 @@ void func_8011EDA8(Entity* self) { self->rotY = 0x120; self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; self->animSet = ANIMSET_DRA(2); - } else { +REDACTED self->animSet = ANIMSET_DRA(5); self->anim = D_800AD57C; - self->palette = 0x8170; - } - } +REDACTED +REDACTED +REDACTED self->flags = FLAG_UNK_20000 | FLAG_UNK_100000 | FLAG_UNK_08000000; - - if (rand() % 4) { - self->zPriority = PLAYER.zPriority + 2; - } else { - self->zPriority = PLAYER.zPriority - 2; - } - - if (paramsHi == 2) { - self->posX.i.hi = PLAYER.posX.i.hi + (rand() % 44) - 22; - } else { - self->posX.i.hi = PLAYER.posX.i.hi + (rand() & 15) - 8; - } - - rnd = rand() & 31; - self->posY.i.hi = PLAYER.posY.i.hi + PLAYER.hitboxOffY + rnd - 16; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-0.5); self->velocityX = PLAYER.velocityX >> 2; - self->step++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED self->rotX -= 4; self->rotY -= 4; self->posY.val += self->velocityY; @@ -571,18 +571,18 @@ void func_8011EDA8(Entity* self) { break; } } - +REDACTED // same as RIC/func_801601DC void func_8011F074(Entity* entity) { s16 posX; s16 posY; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_100000 | FLAG_UNK_20000 | FLAG_UNK_08000000; entity->unk5A = 0x79; entity->animSet = ANIMSET_DRA(14); - entity->zPriority = PLAYER.zPriority + 2; +REDACTED entity->palette = 0x819F; if (D_8013808C & 1) { @@ -594,25 +594,25 @@ void func_8011F074(Entity* entity) { entity->rotX = 0x40; entity->anim = D_800ADC44; D_8013808C++; - entity->unk6C = 0xFF; +REDACTED entity->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY | FLAG_DRAW_UNK10 | FLAG_DRAW_UNK20; - posX = 10; - posY = 15; - entity->posY.i.hi = entity->posY.i.hi - posY + (rand() % 35); - entity->posX.i.hi = entity->posX.i.hi - posX + (rand() % 20); +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityY = -0x6000 - (rand() & 0x3FFF); - entity->step++; - break; - - case 1: - if (entity->unk6C >= 17) { - entity->unk6C += 248; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val += entity->velocityY; entity->rotX += 8; entity->rotY += 8; - if (entity->animFrameDuration < 0) { +REDACTED DestroyEntity(entity); } break; @@ -779,8 +779,8 @@ void EntityHitByIce(Entity* self) { Point16* offset; bool sp18 = false; - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED sp18 = (g_Player.unk0C & 0x10000) == sp18; switch (self->step) { case 0: @@ -960,8 +960,8 @@ void EntityTransparentWhiteCircle(Entity* self) { bScale = loadedParams[4]; gOffset = loadedParams[0]; bOffset = loadedParams[1]; - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED temp_s6 = (upperparams >> 8) & 0x40; func_8010DFF0(1, 1); switch (self->step) { @@ -1627,9 +1627,9 @@ void func_80121F14(s32 arg0, s32 arg1) { for (i = 0; i < LEN(D_80138094); i++, ptr++) { ptr->posX.val = arg0 + ptr->posX.val; ptr->posY.val = arg1 + ptr->posY.val; - } -} - +REDACTED +REDACTED +REDACTED Primitive* func_80121F58(bool arg0, s32 arg1, Primitive* arg2, s16 facingLeft) { Primitive* prim; s16 temp_s4; @@ -2224,42 +2224,42 @@ void UnknownEntId49(Entity* self) { self->posY.i.hi = PLAYER.posY.i.hi + 16 + ((g_GameTimer >> 1) & 1); } } - -void func_80123A60(Entity* entity) { - Entity* player = &PLAYER; - +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Player.unk0C & 0x01000000)) { - DestroyEntity(entity); - return; - } - - entity->posX.i.hi = player->posX.i.hi; - entity->posY.i.hi = player->posY.i.hi; - if (entity->step == 0) { - func_8011A328(entity, 0xB); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000; - entity->step++; - } - - if (player->animCurFrame == 5) { - entity->hitboxWidth = 12; - entity->hitboxHeight = 32; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxOffX = 0x1C; entity->hitboxOffY = -0xC; - return; - } - - if (player->animCurFrame == 6) { - entity->hitboxWidth = 10; - entity->hitboxHeight = 10; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxOffX = 0x1C; entity->hitboxOffY = 0x10; - return; - } - +REDACTED +REDACTED +REDACTED DestroyEntity(entity); -} - +REDACTED +REDACTED void func_80123B40(Entity* self) { Entity copy; Primitive* prim; @@ -2342,8 +2342,8 @@ void func_80123B40(Entity* self) { DRAW_COLORS | DRAW_UNK02 | DRAW_TRANSP; } if (params == 1) { - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = +REDACTED +REDACTED prim->b3 = self->ext.et_80123B40.unk29; prim->clut = 0x100; prim->drawMode = DRAW_UNK_100 | DRAW_TPAGE | DRAW_COLORS | @@ -2352,27 +2352,27 @@ void func_80123B40(Entity* self) { prim = prim->next; } } - -void func_80123F78(Entity* entity) { +REDACTED +REDACTED PlayerDraw* plDraw = &g_PlayerDraw[13]; if (g_unkGraphicsStruct.D_800973FC == 0) { plDraw->enableColorBlend = 0; - DestroyEntity(entity); - return; - } - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_10000 | FLAG_UNK_20000 | FLAG_UNK_04000000 | FLAG_UNK_08000000; if (PLAYER.animSet != 1) { DestroyEntity(entity); - break; - } +REDACTED +REDACTED entity->animSet = ANIMSET_DRA(1); entity->animCurFrame = PLAYER.animCurFrame; - entity->unk5A = 0xD; +REDACTED entity->drawFlags = PLAYER.drawFlags; entity->drawMode = DRAW_TPAGE2 | DRAW_TPAGE; entity->palette = 0x815F; @@ -2424,82 +2424,82 @@ void func_80124164( } if (arg4 == 0) { - colorChannel = colorIntensity * D_800AE270[0]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->r3 = (u32)colorChannel >> 8; - poly->r1 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[1]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->g3 = (u32)colorChannel >> 8; - poly->g1 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[2]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->b3 = (u32)colorChannel >> 8; - poly->b1 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[3]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->r2 = (u32)colorChannel >> 8; - poly->r0 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[4]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->g2 = (u32)colorChannel >> 8; - poly->g0 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[5]; - } else { - colorChannel = colorIntensity * D_800AE270[0]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->r3 = (u32)colorChannel >> 8; - poly->r1 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[1]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->g3 = (u32)colorChannel >> 8; - poly->g1 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[2]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->b3 = (u32)colorChannel >> 8; - poly->b1 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[6]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->r2 = (u32)colorChannel >> 8; - poly->r0 = (u32)colorChannel >> 8; - - colorChannel = colorIntensity * D_800AE270[7]; - if (colorChannel < 0) { - colorChannel += 255; - } - poly->g2 = (u32)colorChannel >> 8; - poly->g0 = (u32)colorChannel >> 8; - colorChannel = colorIntensity * D_800AE270[8]; - } - if (colorChannel < 0) { - colorChannel += 255; - } - poly->b2 = (u32)colorChannel >> 8; - poly->b0 = (u32)colorChannel >> 8; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/dra/843B0.c b/src/dra/843B0.c index b9a4b7f42a..0a34c90089 100644 --- a/src/dra/843B0.c +++ b/src/dra/843B0.c @@ -179,8 +179,8 @@ void EntityTeleport(Entity* self) { } selfUnk7C = self->ext.teleport.unk7C; selfUnk80 = self->ext.teleport.unk80; - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED prim = &g_PrimBuf[self->primIndex]; xVar = PLAYER.posX.i.hi; yVar = PLAYER.posY.i.hi; @@ -230,42 +230,42 @@ void EntityTeleport(Entity* self) { } } -void func_80124A8C(Entity* entity) { -#ifdef PSY_Q_3_5 - if (PLAYER.step != 0 || - PLAYER.step_s != 4) { // REAL: Matches with PSY-Q 3.5 -#else - if (*(s32*)&PLAYER.step != 0x40000) { // !FAKE: Probably ASPSX -#endif +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - return; - } - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->animSet = ANIMSET_DRA(17); entity->velocityY = FIX(-0.375); SetSpeedX(0x4000); - entity->unk5A = 0x50; - entity->palette = 0x819F; +REDACTED +REDACTED entity->anim = D_800AE294; entity->flags = FLAG_UNK_100000; entity->facingLeft = 0; - entity->posY.i.hi -= 16; +REDACTED entity->posX.val += entity->velocityX << 5; - entity->step++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED entity->posX.val += entity->velocityX; entity->posY.val += entity->velocityY; if (entity->animFrameDuration < 0) { DestroyEntity(entity); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // dagger thrown when using subweapon void EntitySubwpnThrownDagger(Entity* self) { Collider collider; @@ -728,11 +728,11 @@ s32 CheckHolyWaterCollision(s32 baseY, s32 baseX) { } return 0; } - -s32 func_80125B6C(s16 arg0, s16 arg1) { +REDACTED +REDACTED Collider collider; - s16 var_a1; - +REDACTED +REDACTED if (g_CurrentEntity->velocityX == 0) { return 0; } @@ -741,94 +741,94 @@ s32 func_80125B6C(s16 arg0, s16 arg1) { g_CurrentEntity->posY.i.hi + arg0, &collider, 0); if (g_CurrentEntity->velocityX > 0) { var_a1 = collider.unk14; - } else { +REDACTED var_a1 = collider.unk1C; - } - +REDACTED +REDACTED if (collider.effects & EFFECT_UNK_0002) { - g_CurrentEntity->posX.i.lo = 0; - g_CurrentEntity->posX.i.hi += var_a1; - return 2; - } - - return 0; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityHolyWater(Entity* entity) { - s16 temp3; - s32 temp; - s32 temp2; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_08000000; entity->animSet = ANIMSET_DRA(9); entity->animCurFrame = 0x1D; - entity->zPriority = PLAYER.zPriority - 2; - entity->posY.i.hi += 8; +REDACTED +REDACTED SetSpeedX(0x14000); entity->velocityY = FIX(-3.125); - func_8011A290(entity); - entity->hitboxHeight = 4; - entity->hitboxWidth = 4; +REDACTED +REDACTED +REDACTED g_Player.D_80072F00[10] = 4; - entity->step++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val += entity->velocityY; if (entity->velocityY <= 0x3FFFF) { entity->velocityY += FIX(0.21875); - } - +REDACTED +REDACTED temp = CheckHolyWaterCollision(0, 0); entity->posX.val += entity->velocityX; - +REDACTED if (entity->velocityX < 0) { - temp3 = -4; - } else { - temp3 = 4; - } - temp |= func_80125B6C(-7, temp3); - - if (temp & 2) { - temp = 1; - } else { - temp2 = 1; - } - - temp2 = temp & 1; - if (temp2 != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfx(SFX_UNK_69A); CreateEntFactoryFromEntity(entity, FACTORY(0, 59), 0); - entity->ext.generic.unk7C.s = 0x10; +REDACTED entity->animSet = ANIMSET_DRA(0); - entity->step = 2; - } - break; - - case 2: - if (!(entity->ext.generic.unk7C.s & 3)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntFactoryFromEntity(entity, FACTORY(D_8013841C << 8, 28), entity->ext.generic.unkB2 << 9); - D_8013841C++; - } - entity->ext.generic.unk7C.s--; - if (entity->ext.generic.unk7C.s == 0) { - entity->ext.generic.unk7C.s = 4; - entity->step++; - } - break; - - case 3: - entity->ext.generic.unk7C.s--; - if (entity->ext.generic.unk7C.s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Glass breaking effect for holy water. Duplicate of RIC func_80167A70. void EntityHolyWaterBreakGlass(Entity* self) { Point16 sp10[8]; @@ -1173,7 +1173,7 @@ void EntitySubwpnCrashCross(Entity* self) { prim->priority = self->zPriority; return; } - +REDACTED // rising blue particles from cross crash void EntitySubwpnCrashCrossParticles(Entity* self) { Primitive* prim; @@ -1408,40 +1408,40 @@ void EntityHellfireNormalFireball(Entity* entity) { entity->flags = FLAG_UNK_100000 | FLAG_UNK_08000000; entity->animSet = ANIMSET_DRA(9); entity->anim = D_800B0798; - entity->zPriority = PLAYER.zPriority + 2; +REDACTED entity->facingLeft = (PLAYER.facingLeft + 1) & 1; SetSpeedX(D_800B0830[entity->params]); entity->velocityY = D_800B083C[entity->params]; - entity->ext.generic.unk7C.s = 0x14; - func_8011A328(entity, 2); - entity->hitboxWidth = 4; - entity->hitboxHeight = 4; +REDACTED +REDACTED +REDACTED +REDACTED entity->step++; break; case 1: if (entity->hitFlags == 0) { - entity->ext.generic.unk7C.s--; - if ((entity->ext.generic.unk7C.s) == 0) { - entity->step++; - } +REDACTED +REDACTED +REDACTED +REDACTED entity->posX.val += entity->velocityX; entity->posY.val += entity->velocityY; - break; - } +REDACTED +REDACTED DestroyEntity(entity); - break; - - case 2: +REDACTED +REDACTED +REDACTED if (entity->hitFlags != 0) { DestroyEntity(entity); - break; - } +REDACTED +REDACTED entity->posX.val += entity->velocityX; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED // Entity ID 45. Created by factory blueprint 81. // That blueprint is used in ControlBatForm, when step_s is 4. // Also, when bat familiar shoots a fireball, the blueprint @@ -1506,26 +1506,26 @@ void EntityHellfireBigFireball(Entity* entity) { case 0: if (entity->params != 0) { PlaySfx(SFX_UNK_683); - } - +REDACTED +REDACTED entity->flags = FLAG_UNK_100000 | FLAG_UNK_08000000; - - if (entity->params != 0) { - entity->posY.i.hi = entity->posY.i.hi + 16; - } else { - entity->posY.i.hi = entity->posY.i.hi - 4; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->animSet = ANIMSET_DRA(9); entity->rotZ = 0; entity->anim = D_800B07C8; entity->drawFlags |= FLAG_DRAW_ROTZ; - entity->zPriority = PLAYER.zPriority + 2; +REDACTED entity->facingLeft = (PLAYER.facingLeft + 1) & 1; SetSpeedX(-0x10); - func_8011A328(entity, 2); - entity->hitboxWidth = 8; - entity->hitboxHeight = 8; +REDACTED +REDACTED +REDACTED entity->step++; break; @@ -1533,32 +1533,32 @@ void EntityHellfireBigFireball(Entity* entity) { if (entity->animFrameIdx >= 23) { if (!(g_GameTimer & 3)) { entity->rotZ += 0x400; - } +REDACTED if (entity->velocityX < 0) { entity->velocityX -= FIX(0.09375); - } else { +REDACTED entity->velocityX += FIX(0.09375); - } +REDACTED if (!(g_GameTimer & 1) && (rand() & 1)) { CreateEntFactoryFromEntity(entity, FACTORY(0x100, 36), 0); - } +REDACTED entity->posX.val += entity->velocityX; entity->posY.val += entity->velocityY; - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // circle expands out of player void EntityExpandingCircle(Entity* entity) { Primitive* prim; s32 primIndex; - +REDACTED if (PLAYER.facingLeft == 0) { entity->posX.i.hi = PLAYER.posX.i.hi - 10; - } else { +REDACTED entity->posX.i.hi = PLAYER.posX.i.hi + 10; - } +REDACTED entity->posY.i.hi = PLAYER.posY.i.hi + 2; switch (entity->step) { @@ -1566,8 +1566,8 @@ void EntityExpandingCircle(Entity* entity) { primIndex = AllocPrimitives(PRIM_GT4, 1); entity->primIndex = primIndex; if (primIndex != -1) { - entity->ext.generic.unk7C.s = 22; - entity->ext.generic.unk7E.modeU16 = 26; +REDACTED +REDACTED prim = &g_PrimBuf[entity->primIndex]; prim->u2 = 64; prim->u3 = 127; @@ -1595,25 +1595,25 @@ void EntityExpandingCircle(Entity* entity) { prim->drawMode = DRAW_TPAGE2 | DRAW_TPAGE | DRAW_COLORS | DRAW_TRANSP; entity->flags = FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS; - entity->step++; - break; - } +REDACTED +REDACTED +REDACTED DestroyEntity(entity); return; - - case 1: - entity->ext.generic.unk7C.s += 2; - entity->ext.generic.unk7E.modeU16 += 2; - if (entity->ext.generic.unk7C.s >= 0x39) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - return; - } - break; - - default: - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[entity->primIndex]; prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s; prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16; @@ -1636,26 +1636,26 @@ void EntityExpandingCircle(Entity* entity) { void func_80127CC8(Entity* entity) { Primitive* prim; - s32 ret; - - if (PLAYER.step != 34) { +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - return; - } - - entity->posX.i.hi = PLAYER.posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED switch (entity->step) { case 0: ret = AllocPrimitives(PRIM_G4, 1); entity->primIndex = ret; - - if (ret == -1) { +REDACTED +REDACTED DestroyEntity(entity); g_Player.unk5C = -1; - return; - } - +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS; prim = &g_PrimBuf[entity->primIndex]; @@ -1670,10 +1670,10 @@ void func_80127CC8(Entity* entity) { break; case 1: - if (entity->ext.generic.unk7C.s++ >= 0xE) { +REDACTED DestroyEntity(entity); - return; - } +REDACTED +REDACTED } prim = &g_PrimBuf[entity->primIndex]; prim->x0 = prim->x2 = entity->posX.i.hi - 3; @@ -2360,9 +2360,9 @@ void EntityAguneaHitEnemy(Entity* self) { prim->y2 = self->posX.i.hi; prim->r0 = prim->g0 = prim->b0 = 0xF0; i += 1; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->priority = self->zPriority; prim->drawMode = DRAW_HIDE; prim = prim->next; @@ -2383,9 +2383,9 @@ void EntityAguneaHitEnemy(Entity* self) { while (prim != NULL) { prim->clut = 0x194; prim->r0 = prim->g0 = prim->b0 = 0x80; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->priority = self->zPriority; prim->drawMode = DRAW_HIDE; prim = prim->next; @@ -2471,11 +2471,11 @@ void EntityAguneaHitEnemy(Entity* self) { while (prim != NULL) { prim->clut = 0x194; prim->r0 = prim->g0 = prim->b0 = 0x60; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - prim = prim->next; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->step_s = 0; self->step += 1; break; @@ -2492,10 +2492,10 @@ void EntityAguneaHitEnemy(Entity* self) { } if (var_s2 != 0) { prim = self->ext.prim; - while (prim != NULL) { +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } +REDACTED +REDACTED DestroyEntity(self); break; } @@ -2735,7 +2735,7 @@ void func_80129864(Entity* self) { self->ext.et_80129864.unk86 += 1; self->ext.et_80129864.unk86 = self->ext.et_80129864.unk86 % 8; } - +REDACTED // opens hole in backround and spirit comes out (ID 0x40) void EntitySummonSpirit(Entity* self) { Primitive* prim; diff --git a/src/dra/8A0A4.c b/src/dra/8A0A4.c index 015b8476c9..e20c6ff71a 100644 --- a/src/dra/8A0A4.c +++ b/src/dra/8A0A4.c @@ -74,7 +74,7 @@ void EntityStopWatchExpandingCircle(Entity* self) { prim->y3 = selfPosY - ((cosine * minus20) >> 0xC); } } - +REDACTED // stopwatch subweapon effect. stops enemies (Dra Entity 0x2A) void EntityStopWatch(Entity* self) { Primitive* prim; @@ -451,34 +451,34 @@ void func_8012B78C(Entity* entity) { prim->priority = entity->zPriority; prim->drawMode = DRAW_UNK_100 | DRAW_TPAGE | DRAW_COLORS | DRAW_TRANSP; - entity->ext.generic.unk7E.modeU16 = 96; - entity->step++; - } else { +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - return; - } - break; - - case 1: - if (++entity->ext.generic.unk7C.s > 5) { - entity->step++; - } - entity->ext.generic.unk7E.modeU16 -= 8; - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - return; - - default: - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[entity->primIndex]; prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 = - entity->ext.generic.unk7E.modeU8.unk0; -} - +REDACTED +REDACTED +REDACTED // book rotates around player void EntitySubwpnBible(Entity* self) { Primitive* prim; @@ -860,7 +860,7 @@ void func_8012C600(void) { } } } - +REDACTED bool WolfFormFinished(void) { if (PLAYER.step_s == 0) { return false; @@ -881,10 +881,10 @@ bool WolfFormFinished(void) { CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x2400, 44), 0); PLAYER.velocityY >>= 1; return true; - } - return false; -} - +REDACTED +REDACTED +REDACTED +REDACTED void func_8012C97C(void) { if (g_Entities[PLAYER_CHARACTER].step_s == 0) { return; @@ -912,7 +912,7 @@ void func_8012C97C(void) { return; } - PLAYER.step_s = 9; +REDACTED D_800B0914 = 0; SetPlayerAnim(0xEC); PLAYER.velocityY = 0; @@ -943,12 +943,12 @@ void func_8012CA64(void) { void func_8012CB0C(void) { PLAYER.ext.player.anim = 0xDE; PLAYER.velocityY = 0; - D_800B0914 = 0; +REDACTED PLAYER.animFrameIdx = 0; PLAYER.animFrameDuration = 0; - PLAYER.step_s = 7; -} - +REDACTED +REDACTED +REDACTED void func_8012CB4C(void) { PLAYER.step_s = 2; if ((PLAYER.facingLeft != 0 && g_Player.padPressed & PAD_RIGHT) || @@ -969,25 +969,25 @@ void func_8012CB4C(void) { } } -void func_8012CC30(s32 arg0) { - if (arg0 == 0) { - D_80138444 = 1; +REDACTED +REDACTED +REDACTED if (g_ButtonCombo[COMBO_QCF].buttonsCorrect == COMBO_COMPLETE && IsRelicActive(RELIC_SKILL_OF_WOLF) && CastSpell(SPELL_WOLF_CHARGE)) { CheckMoveDirection(); - PLAYER.step_s = 2; - D_800B0914 = 4; +REDACTED +REDACTED SetSpeedX(0x50000); g_CurrentEntity->velocityY = 0; SetPlayerAnim(0xED); LearnSpell(4); - } - } else { - D_80138444 = 1; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_8012CCE4(void) { PLAYER.velocityY = FIX(-3.5); if ((PLAYER.step_s == 2) & (D_800B0914 == 2)) { @@ -1028,28 +1028,28 @@ void func_8012CCE4(void) { PLAYER.step_s = 4; D_80138430 += 0x80; } - -void func_8012CED4(void) { +REDACTED +REDACTED if (PLAYER.step_s == 2 && D_800B0914 == PLAYER.step_s) { SetPlayerAnim(0xE7); D_800B0914 = 1; } else { SetPlayerAnim(0xE8); SetSpeedX(0x10000); - D_800B0914 = 0; - if (D_80138438 & 0x40) { +REDACTED +REDACTED PLAYER.animFrameIdx = 4; PLAYER.velocityX = 0; PLAYER.animFrameDuration = 1; - } - } - PLAYER.step_s = 5; +REDACTED +REDACTED +REDACTED g_Player.D_80072F00[5] = 8; PLAYER.velocityY = 0; - D_80138430 -= 0x100; -} - -void func_8012CFA8(void) { +REDACTED +REDACTED +REDACTED +REDACTED SetPlayerAnim(0xEA); PLAYER.step_s = 6; D_800B0914 = 0; @@ -1099,15 +1099,15 @@ void func_8012D024(void) { SetPlayerAnim(0xE9); } } - -void func_8012D178(void) { - s32 var_v0; - +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.padTapped & PAD_CROSS) { - func_8012CCE4(); +REDACTED } else if (!(g_Player.pl_vram_flag & 1)) { - func_8012CFA8(); - } else { +REDACTED +REDACTED #if defined(VERSION_US) if (PLAYER.facingLeft != 0) { var_v0 = g_Player.padPressed & PAD_LEFT; @@ -1124,9 +1124,9 @@ void func_8012D178(void) { } else if (g_GameTimer % 6 == 0) { CreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x100, 69), 0); } - } -} - +REDACTED +REDACTED +REDACTED void func_8012D28C(bool exitEarly) { bool bitNotFound; s32 i; diff --git a/src/dra/8D3E8.c b/src/dra/8D3E8.c index 7646e38303..d4d95d9ca5 100644 --- a/src/dra/8D3E8.c +++ b/src/dra/8D3E8.c @@ -655,10 +655,10 @@ void func_8012EAD0(void) { } } } - +REDACTED void func_8012ED30(void) { if (g_Player.padTapped & PAD_CROSS) { - func_8012CCE4(); +REDACTED D_80138440 = 0x10; return; } @@ -706,7 +706,7 @@ void func_8012ED30(void) { } } } - +REDACTED void func_8012EF2C(void) { s16 var_v1; s32 i; diff --git a/src/dra/91EBC.c b/src/dra/91EBC.c index e48d2eb413..5da5523c68 100644 --- a/src/dra/91EBC.c +++ b/src/dra/91EBC.c @@ -18,17 +18,17 @@ void MuteCd(void) { void UnMuteCd(void) { g_MuteCd = 0; - D_8013B694++; +REDACTED } s32 func_80131F28(void) { return D_80138F7C; } -u16 func_80131F38(void) { +REDACTED if (g_SeqPlayingId == 0) { return 0; } return g_SeqPlayingId | 0x200; -} +REDACTED bool func_80131F68(void) { if (D_8013B61C == 0) { @@ -38,7 +38,7 @@ bool func_80131F68(void) { } s16 GetCdVolume(void) { return g_CdVolume; } - +REDACTED void SetReverbDepth(short depth) { SsUtSetReverbDepth(depth, depth); } void func_80131FCC(void) { @@ -61,30 +61,30 @@ u8 DoCdCommand(u_char com, u_char* param, u_char* result) { CdControl(CdlNop, 0, 0); D_8013B680 = 2; return D_8013B680; - } +REDACTED } else if (*g_CdCommandResult & CdlStatShellOpen || *g_CdCommandResult & CdlStatSeekError) { - CdControl(CdlNop, 0, 0); - D_8013B680 = 2; - return D_8013B680; +REDACTED +REDACTED +REDACTED } if (g_CdCommandStatus == CdlComplete) { - if (CdControl(com, param, result)) { - D_8013B680 = 0; - return D_8013B680; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED D_8013B680 = 1; - return D_8013B680; -} - +REDACTED +REDACTED +REDACTED void SetMaxVolume(void) { - g_volumeL = 127; - g_volumeR = 127; - SsSetMVol(g_volumeL, g_volumeR); -} +REDACTED +REDACTED +REDACTED +REDACTED void InitSoundVars3(void) { s32 i; @@ -180,29 +180,29 @@ void SetCdVolume(s8 s_num, s16 arg1, s16 arg2) { } void SetMonoStereo(u8 soundMode) { - CdlATV audioVolume; - - switch (soundMode) { - case MONO_SOUND: - if (D_801390A8 != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SsSetMono(); - audioVolume.val2 = 128; // CD (R) --> SPU (R) - audioVolume.val0 = 128; // CD (L) --> SPU (L) - audioVolume.val3 = 128; // CD Right sound transferred to left - audioVolume.val1 = 128; // CD Left sound transferred to right - CdMix(&audioVolume); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_SfxVolumeMultiplier = 108; - D_801390A8 = 0; - } - break; - case STEREO_SOUND: - if (D_801390A8 != 1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SsSetStereo(); - audioVolume.val2 = 224; // CD (R) --> SPU (R) - audioVolume.val0 = 224; // CD (L) --> SPU (L) - audioVolume.val3 = 0; - audioVolume.val1 = 0; - CdMix(&audioVolume); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_SfxVolumeMultiplier = 127; D_801390A8 = 1; } @@ -215,8 +215,8 @@ void SoundInit(void) { SsInitHot(); SsSetTickMode(SS_TICK60); SetMonoStereo(STEREO_SOUND); - SsSetReservedVoice(0x10); - SsStart(); +REDACTED +REDACTED SsSetTableSize(g_SeqTable, SEQ_TABLE_S_MAX, SEQ_TABLE_T_MAX); SsUtSetReverbType(SS_REV_TYPE_STUDIO_B); SpuClearReverbWorkArea(SS_REV_TYPE_STUDIO_B); @@ -351,7 +351,7 @@ void func_80132A04(s16 voice, s16 vabId, s16 prog, s16 tone, s16 note, if (distance == 0) { g_VolL = volume; g_VolR = volume; - } else { +REDACTED g_VolR = (volume * g_CdVolumeTable[distance * 2 + 144]) >> 7; g_VolL = (volume * g_CdVolumeTable[distance * 2 + 145]) >> 7; } @@ -360,8 +360,8 @@ void func_80132A04(s16 voice, s16 vabId, s16 prog, s16 tone, s16 note, if (voice >= 0 && voice < 24) { SsUtKeyOnV(voice, vabId, prog, tone, note, 0, g_VolL, g_VolR); SsUtKeyOnV(voice + 1, vabId, prog, 1 - -tone, note, 0, g_VolL, g_VolR); - return; - } +REDACTED +REDACTED // virtual voices 30-33 map to hardware channels 0-4,4-8,8-12,14-18 switch (voice) { diff --git a/src/dra/93BDC.c b/src/dra/93BDC.c index 7aefc94db7..3f55a7844c 100644 --- a/src/dra/93BDC.c +++ b/src/dra/93BDC.c @@ -155,18 +155,18 @@ void CdSoundCommand10(void) { g_XaFadeCounter++; if (g_volumeL > 0) { temp = g_volumeR * g_XaVolumeMultiplier * g_XaFadeCounter; - if (temp < 0) { - temp += 0x1FF; - } - g_volumeL = g_volumeR - (temp >> 9); - if (g_volumeL >> 0x10) { - g_volumeL = 0; - } - } else { - g_volumeL = 0; - } - SsSetMVol(g_volumeL, g_volumeL); - if (g_volumeL == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CdSoundCommandStep++; } break; @@ -339,29 +339,29 @@ void PlaySfx(s16 sfxId) { g_sfxRingBufferWritePos++; if (g_sfxRingBufferWritePos == LEN(g_SfxRingBuffer)) { g_sfxRingBufferWritePos = 0; - } - } else { - switch (sfxId) { - case 0x10: - case 0x11: - D_8013980C = 1; - break; - - case 0x80: - case 0x81: - case 0x82: - case 0x83: - case 0x84: - case 0x90: - case 0x91: - case 0x92: - case 0x93: - case 0x94: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED D_8013B61C = 1; - break; - - default: - break; +REDACTED +REDACTED +REDACTED +REDACTED } g_SoundCommandRingBuffer[g_SoundCommandRingBufferWritePos] = sfxId; diff --git a/src/dra/953A0.c b/src/dra/953A0.c index 4bb10c40d0..048a1baa46 100644 --- a/src/dra/953A0.c +++ b/src/dra/953A0.c @@ -1,8 +1,8 @@ -#include "dra.h" +REDACTED #include "dra_bss.h" -#include "objects.h" -#include "sfx.h" - +REDACTED +REDACTED +REDACTED u8 D_800C097C[] = { 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x01, 0x00, 0x00, 0x38, 0x00, 0x78, 0x08, 0x00, 0x00, 0x3A, 0x00, 0x32, 0x01, 0xFF, @@ -1141,41 +1141,41 @@ u8* g_SfxScripts[] = { void ExecCdSoundCommands(void) { if (g_CdSoundCommandQueuePos == 0) - return; - +REDACTED +REDACTED switch (g_CdSoundCommandQueue[0]) { case CD_SOUND_COMMAND_FADE_OUT_2: CdFadeOut2(); - break; +REDACTED case CD_SOUND_COMMAND_FADE_OUT_1: CdFadeOut1(); - break; +REDACTED case CD_SOUND_COMMAND_START_XA: CdSoundCommand4(); - break; +REDACTED case CD_SOUND_COMMAND_6: CdSoundCommand6(); - break; +REDACTED case CD_SOUND_COMMAND_8: CdSoundCommand8(); - break; +REDACTED case CD_SOUND_COMMAND_10: CdSoundCommand10(); - break; +REDACTED case CD_SOUND_COMMAND_12: CdSoundCommand12(); - break; +REDACTED case CD_SOUND_COMMAND_14: CdSoundCommand14(); - break; +REDACTED case CD_SOUND_COMMAND_16: g_CdSoundCommand16 = 0; - case 0: +REDACTED AdvanceCdSoundCommandQueue(); - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED void PlaySfxScript( s16 arg0, s32 channel_group, bool do_key_off, u16 volume, s16 distance) { u16 volumeMod; @@ -1208,7 +1208,7 @@ void PlaySfxScript( g_CurrentSfxScriptSfxId2[channel_group] = arg0; g_SfxScriptUnk6[channel_group] = g_SfxData[arg0].unk6; } - +REDACTED // channel group is 0-3 so play on one of these pairs: // (12,13),(14,15),(16,17),(18,19) void KeyOn12_19( @@ -1218,14 +1218,14 @@ void KeyOn12_19( // channel_group 0 -> 12, 13 etc. g_KeyOffChannels |= (1 << ((channel_group + 6) * 2)) + (1 << (((channel_group + 6) * 2) + 1)); - } +REDACTED func_80132A04( (channel_group * 2) + 12, g_SfxData[arg0].vabid, g_SfxData[arg0].prog, g_SfxData[arg0].tone, g_SfxData[arg0].note, volume, distance); g_CurrentSfxId12_19[channel_group] = arg0; D_8013AED4[channel_group] = g_SfxData[arg0].unk6; -} - +REDACTED +REDACTED void func_8013572C(s16 arg0, u16 volume, s16 distance) { s32 i; @@ -1342,17 +1342,17 @@ void func_8013572C(s16 arg0, u16 volume, s16 distance) { } } } - +REDACTED s16 IncrementRingBufferPos(s16 arg0) { - arg0++; - +REDACTED +REDACTED if (arg0 == LEN(g_SfxRingBuffer)) { - arg0 = 0; - } - - return arg0; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void ExecSfx(void) { s16 sfxBufPos; s32 isFound; @@ -1380,7 +1380,7 @@ void ExecSfx(void) { g_SfxRingBufferReadPos = IncrementRingBufferPos(g_SfxRingBufferReadPos); } } - +REDACTED void func_80135D8C(void) { s32 i; s8* temp_t2; @@ -1459,7 +1459,7 @@ void func_80135D8C(void) { } } } - +REDACTED void func_80136010(void) { s16* var_t4; s32 i; @@ -1522,25 +1522,25 @@ void func_80136010(void) { g_SfxScriptUnk6[3] = 0; } } - -void func_801361F8(void) { +REDACTED +REDACTED if (g_SoundInitialized != 0) { - func_80136010(); +REDACTED ExecSfx(); - func_80135D8C(); +REDACTED ExecSoundCommands(); - func_80133FCC(); +REDACTED ExecCdSoundCommands(); SpuSetKey(SPU_OFF, g_KeyOffChannels); g_KeyOffChannels = 0; - func_80131FCC(); - +REDACTED +REDACTED if (g_MuteCd) { SetCdVolume(0, 0, 0); - } else { +REDACTED SetCdVolume(0, g_CdVolume, g_CdVolume); - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED void nullsub_10(void) {} diff --git a/src/dra/collider.c b/src/dra/collider.c index 0c89f12895..b2367c43a1 100644 --- a/src/dra/collider.c +++ b/src/dra/collider.c @@ -1,6 +1,6 @@ #include "dra.h" -typedef enum { +REDACTED // most common block type COLLISION_TYPE_SOLID = 0x03, @@ -27,7 +27,7 @@ typedef enum { // water COLLISION_TYPE_WATER = 0xED -} CollisionTypes; +REDACTED void CheckCollision(s32 x, s32 y, Collider* res, s32 unk) { Collider sp10; diff --git a/src/dra/demo.c b/src/dra/demo.c index d0ada88856..52e9ea362f 100644 --- a/src/dra/demo.c +++ b/src/dra/demo.c @@ -55,69 +55,69 @@ void DemoGameInit(s32 arg0) { g_Status.statsBase[1] = 10; g_Status.statsBase[2] = 10; g_Status.statsBase[3] = 10; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_BEKATOWA; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_LEATHER_SHIELD; - g_Status.equipment[HEAD_SLOT] = ITEM_EMPTY_HEAD; - g_Status.equipment[ARMOR_SLOT] = ITEM_HIDE_CUIRASS; - g_Status.equipment[CAPE_SLOT] = ITEM_NO_CAPE; - g_Status.equipment[ACCESSORY_1_SLOT] = ITEM_NO_ACCESSORY; - g_Status.equipment[ACCESSORY_2_SLOT] = ITEM_NO_ACCESSORY; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_StageId == STAGE_NZ0_DEMO) { g_Status.subWeapon = 2; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_SHORT_SWORD; +REDACTED } if (g_StageId == STAGE_BO4) { g_Status.subWeapon = 3; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_SHORT_SWORD; +REDACTED } if (g_StageId == STAGE_BO5) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_GLADIUS; +REDACTED } if (g_StageId == STAGE_BO3) { g_Status.subWeapon = 3; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_GLADIUS; +REDACTED g_Status.relics[RELIC_HOLY_SYMBOL] = 1; g_Status.hearts = 60; } if (g_StageId == STAGE_BO2) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CUTLASS; +REDACTED } if (g_StageId == STAGE_LIB_DEMO) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CUTLASS; +REDACTED g_Status.statsBase[0] = 15; } if (g_StageId == STAGE_BO0) { g_Status.hearts = 60; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CLAYMORE; +REDACTED g_Status.subWeapon = 2; g_Status.mpMax = 50; g_Status.mp = 50; g_Status.statsBase[0] = 20; g_Status.statsBase[2] = 20; - g_Status.equipment[ARMOR_SLOT] = ITEM_FIRE_MAIL; +REDACTED } if (g_StageId == STAGE_BO7) { g_Status.subWeapon = 3; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_DAMASCUS_SWORD; +REDACTED } if (g_StageId == STAGE_BO1) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_ICEBRAND; +REDACTED } if (g_StageId == STAGE_DRE) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CLAYMORE; +REDACTED } if (g_StageId == STAGE_NZ1_DEMO) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_FALCHION; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_IRON_SHIELD; +REDACTED +REDACTED g_Status.statsBase[0] = 20; g_Status.statsBase[2] = 20; g_Status.subWeapon = 8; g_Status.hearts = 30; } if (g_StageId == STAGE_BO6) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_MORMEGIL; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_IRON_SHIELD; +REDACTED +REDACTED g_Status.subWeapon = 9; g_Status.statsBase[0] = 10; } @@ -126,20 +126,20 @@ void DemoGameInit(s32 arg0) { g_Status.mp = 80; } if (g_StageId == STAGE_RBO7) { - g_Status.equipment[ARMOR_SLOT] = ITEM_AXE_LORD_ARMOR; +REDACTED } if (g_StageId == STAGE_RBO1) { g_Status.subWeapon = 2; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CLAYMORE; - g_Status.equipment[HEAD_SLOT] = ITEM_TOPAZ_CIRCLET; +REDACTED +REDACTED g_Status.statsBase[0] = 25; g_Status.statsBase[2] = 35; g_Status.hearts = 70; } if (g_StageId == STAGE_RBO8) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_IRON_CUIRASS; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_SKULL_SHIELD; - g_Status.equipment[HEAD_SLOT] = ITEM_BERYL_CIRCLET; +REDACTED +REDACTED +REDACTED g_Status.statsBase[0] = 60; g_Status.mpMax = 200; g_Status.mp = 200; @@ -151,21 +151,21 @@ void DemoGameInit(s32 arg0) { g_Status.hearts = 70; } if (g_StageId == STAGE_RBO4) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CLAYMORE; +REDACTED g_Status.statsBase[0] = 25; } if (g_StageId == STAGE_RBO2) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_CLAYMORE; +REDACTED g_Status.statsBase[0] = 25; g_Status.statsBase[2] = 40; - g_Status.equipment[ARMOR_SLOT] = ITEM_ALUCARD_MAIL; +REDACTED g_Status.subWeapon = 9; g_Status.hearts = 80; } if (g_StageId == STAGE_RCEN) { g_Status.subWeapon = 2; - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_ALUCARD_SWORD; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_ALUCARD_SHIELD; +REDACTED +REDACTED g_Status.statsBase[0] = 25; g_Status.statsBase[2] = 35; g_Status.hearts = 70; @@ -173,25 +173,25 @@ void DemoGameInit(s32 arg0) { g_Status.mp = 80; } if (g_StageId == STAGE_RBO5) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_SWORD_OF_HADOR; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_IRON_SHIELD; +REDACTED +REDACTED g_Status.subWeapon = 8; g_Status.statsBase[0] = 30; g_Status.statsBase[2] = 35; g_Status.heartsMax = 99; } if (g_StageId == STAGE_RBO3) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_FALCHION; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_IRON_SHIELD; +REDACTED +REDACTED g_Status.subWeapon = 3; g_Status.statsBase[0] = 30; g_Status.statsBase[2] = 30; g_Status.heartsMax = 99; } if (g_StageId == STAGE_RBO0) { - g_Status.equipment[LEFT_HAND_SLOT] = ITEM_BASTARD_SWORD; - g_Status.equipment[RIGHT_HAND_SLOT] = ITEM_IRON_SHIELD; - g_Status.equipment[ARMOR_SLOT] = ITEM_ALUCARD_MAIL; +REDACTED +REDACTED +REDACTED g_Status.subWeapon = 2; g_Status.statsBase[0] = 30; g_Status.statsBase[2] = 35; diff --git a/src/dra/loading.c b/src/dra/loading.c index 72803c916e..178f7e2d89 100644 --- a/src/dra/loading.c +++ b/src/dra/loading.c @@ -377,12 +377,12 @@ void HandleNowLoading(void) { if (g_UseDisk) { g_CdStep = CdStep_LoadInit; g_LoadFile = CdFile_Weapon0; - var_s0 = +REDACTED g_EquipDefs[g_Status.equipment[LEFT_HAND_SLOT]].weaponId; if (var_s0 == 0xFF) { var_s0 = 1; } - if (g_Status.equipment[ARMOR_SLOT] == ITEM_AXE_LORD_ARMOR) { +REDACTED var_s0 = g_EquipDefs[0xD8].weaponId; } g_EquippedWeaponIds[0] = var_s0; @@ -403,7 +403,7 @@ void HandleNowLoading(void) { if (var_s0 == 0xFF) { var_s0 = 1; } - if (g_Status.equipment[ARMOR_SLOT] == ITEM_AXE_LORD_ARMOR) { +REDACTED var_s0 = g_EquipDefs[0xD8].weaponId; } if (LoadFileSim(var_s0, 7) < 0) { @@ -416,7 +416,7 @@ void HandleNowLoading(void) { if (var_s0 == 0xFF) { var_s0 = 1; } - if (g_Status.equipment[ARMOR_SLOT] == ITEM_AXE_LORD_ARMOR) { +REDACTED var_s0 = g_EquipDefs[0xD8].weaponId; } if (LoadFileSim(var_s0, 8) >= 0) { @@ -436,7 +436,7 @@ void HandleNowLoading(void) { if (var_s0 == 0xFF) { var_s0 = 1; } - if (g_Status.equipment[ARMOR_SLOT] == ITEM_AXE_LORD_ARMOR) { +REDACTED var_s0 = g_EquipDefs[0xD8].weaponId; } g_EquippedWeaponIds[1] = var_s0; @@ -504,13 +504,13 @@ void HandleVideoPlayback(void) { Primitive* prim; Primitive* prim2; u8 temp; - +REDACTED if (!(g_pads[0].tapped & PAD_START) || !g_IsTimeAttackUnlocked) { switch (g_GameStep) { - case 0: +REDACTED if (!g_IsUsingCd) { - func_800EA538(0); - func_800EA5E4(0x1A); +REDACTED +REDACTED g_CdStep = CdStep_LoadInit; g_LoadFile = CdFile_24; SetCgiDisplayBuffer(0x140); @@ -527,19 +527,19 @@ void HandleVideoPlayback(void) { prim->tpage = 0x1C; prim->drawMode = DRAW_HIDE; g_GameStep++; - return; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[D_8013640C]; prim->p1--; if (prim->p1 == 0) { g_GameStep++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[D_8013640C]; temp = prim->r0 + 1; func_80107250(prim, temp); @@ -550,38 +550,38 @@ void HandleVideoPlayback(void) { #elif defined(VERSION_HD) prim2->drawMode = DRAW_DEFAULT; #endif - } - if (temp == 128) { +REDACTED +REDACTED prim->p1 = 128; g_GameStep++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[D_8013640C]; prim->p1--; if (prim->p1 == 0) { g_GameStep++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[D_8013640C]; temp = prim->r0 - 1; func_80107250(prim, temp); - if (temp == 64) { +REDACTED prim2 = prim->next; prim2->drawMode = DRAW_HIDE; - } - if (temp == 0) { +REDACTED +REDACTED FreePrimitives(D_8013640C); g_GameStep++; - } - break; - - case 5: +REDACTED +REDACTED +REDACTED +REDACTED if (!g_IsUsingCd) { - D_8003C728 = 1; +REDACTED g_CurrentStream = 1; g_GameStep++; } @@ -589,17 +589,17 @@ void HandleVideoPlayback(void) { case 6: g_api.o.UpdateRoomPosition(); - if (D_8003C728 == 0) { - func_800E4970(); - } - break; - } - - } else { - func_800E4970(); - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void nullsub_9(void) {} void HandlePrologueEnd(void) { diff --git a/src/dra/menu.c b/src/dra/menu.c index 916d28978d..c0959037f7 100644 --- a/src/dra/menu.c +++ b/src/dra/menu.c @@ -11,8 +11,8 @@ typedef struct EquipMenuHelper { // Struct for table of values to intitialize MenuContext structs typedef struct { - /* 0x00 */ s16 cursorX; - /* 0x02 */ s16 cursorY; +REDACTED +REDACTED /* 0x04 */ s16 cursorW; /* 0x06 */ s16 cursorH; /* 0x08 */ s16 otIdx; @@ -180,8 +180,8 @@ MenuContextInit g_MenuInit[NUM_MENU] = { // BSS extern EquipKind D_801375CC; extern s32 D_801375D0; -extern s32 D_801375D4; -extern s32* D_801375D8; +REDACTED +REDACTED extern s32 D_801375DC; extern s32 D_801375E0[NUM_FAMILIARS + 1]; extern s32 g_IsCloakLiningUnlocked; @@ -208,9 +208,9 @@ extern s32 g_NewAttackLeftHand; extern s32 g_NewDefenseEquip; extern s32 g_NewPlayerStatsTotal[]; extern s32 D_80137948; -extern s8* D_8013794C; // Pointer to texture pattern -extern s32 D_80137950; -extern s32 D_80137954; +REDACTED +REDACTED +REDACTED extern s32 D_80137958; extern s32 g_ServantPrevious; @@ -259,34 +259,34 @@ bool IsAlucart(void) { } void func_800F4994(void) { - s32* statsPtr = &g_Status.statsEquip; +REDACTED s32 correctStonesEquipped; - s32 statBonus; +REDACTED u32 hourOfDay; - s32 i, j; +REDACTED for (i = 0; i < 4; i++, statsPtr++) { *statsPtr = 0; } - - // Iterate through each Item Slot +REDACTED +REDACTED for (i = 0; i < 5; i++) { // Iterate through the 4 stats (STR, CON, INT, LCK) for (j = 0; j < 4; j++) { statBonus = g_AccessoryDefs[g_Status.equipment[HEAD_SLOT + i]] .statsBonus[j]; - if (statBonus > 128) { - statBonus -= 256; +REDACTED +REDACTED } g_Status.statsEquip[j] += statBonus; } } hourOfDay = g_Status.timerHours % 24; - +REDACTED // Hours of sunstone effectiveness if (6 <= hourOfDay && hourOfDay < 18) { // Sunstone check - correctStonesEquipped = +REDACTED CheckEquipmentItemCount(ITEM_SUNSTONE, EQUIP_ACCESSORY); statsPtr = &g_Status.statsEquip; for (i = 0; i < 4; i++, statsPtr++) { @@ -294,14 +294,14 @@ void func_800F4994(void) { } } else { // Moonstone check - correctStonesEquipped = +REDACTED CheckEquipmentItemCount(ITEM_MOONSTONE, EQUIP_ACCESSORY); statsPtr = &g_Status.statsEquip; for (i = 0; i < 4; i++, statsPtr++) { *statsPtr += correctStonesEquipped * 5; } } - +REDACTED if (D_80139828[4]) { g_Status.statsEquip[STAT_STR] += 20; } @@ -326,9 +326,9 @@ void func_800F4994(void) { if (IsAlucart() != false) { g_Status.statsEquip[STAT_LCK] += 30; } - +REDACTED for (i = 0; i < 4; i++) { - if (g_Status.statsEquip[i] > 99) { +REDACTED g_Status.statsEquip[i] = 99; } g_Status.statsTotal[i] = g_Status.statsBase[i] + g_Status.statsEquip[i]; @@ -357,13 +357,13 @@ s32 CalcAttack(s32 equipId, s32 otherEquipId) { g_EquipDefs[equipId].attack == 1)) { return 0; } - - if (equipId == ITEM_ALUCARD_SHIELD) { +REDACTED +REDACTED return 0; } - +REDACTED equipmentAttackBonus = 0; - +REDACTED for (i = 0; i < 5; i++) { equipmentAttackBonus += (u16)g_AccessoryDefs[g_Status.equipment[2 + i]].attBonus; @@ -380,16 +380,16 @@ s32 CalcAttack(s32 equipId, s32 otherEquipId) { totalAttack += equipmentAttackBonus; - if (equipId == ITEM_BADELAIRE) { +REDACTED totalAttack += g_Status.timerHours; } - if (equipId == ITEM_MURAMASA) { +REDACTED totalAttack += SquareRoot0(g_Status.D_80097C40); } if (equipId == 4 && g_EquipDefs[otherEquipId].itemCategory == ITEM_SHIELD) { totalAttack += 5; } - if (equipId == ITEM_SWORD_FAMILIAR) { +REDACTED totalAttack += g_Status.statsFamiliars[FAM_STATS_SWORD].level; } if (D_80139828[1]) { @@ -482,13 +482,13 @@ void CalcDefense(void) { } totalDefense += (SquareRoot0(g_Status.statsTotal[STAT_CON]) - 2); - +REDACTED if (CheckEquipmentItemCount(ITEM_WALK_ARMOR, EQUIP_ARMOR) != 0) { totalDefense += g_RoomCount / 60; } if (D_80139828[0]) { - totalDefense += 20; +REDACTED } if (totalDefense < 0) { totalDefense = 0; @@ -1114,14 +1114,14 @@ void MenuJosephsCloakDraw(MenuContext* context) { } void MenuWindowColorsDraw(MenuContext* context) { -#if defined(VERSION_HD) - s32 x = 128; -#else - s32 x = 176; -#endif - s32 y; - s32 i; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED for (i = 0; i < LEN(g_ChRgb); i++) { MenuDrawChar(g_ChRgb[i], x + 32, (i * 12) + 80, context); MenuDrawInt(g_Settings.windowColors[i], x + 72, 80 + i * 12, context); @@ -2776,8 +2776,8 @@ void CheckWeaponCombo(void) { s32 i; s32 oddComboCheck; - weapon0 = g_Status.equipment[LEFT_HAND_SLOT]; - weapon1 = g_Status.equipment[RIGHT_HAND_SLOT]; +REDACTED +REDACTED combo1 = g_EquipDefs[weapon0].comboSub & g_EquipDefs[weapon1].comboMain; oddComboCheck = 0x80000000; @@ -2802,15 +2802,15 @@ bool LoadWeaponPrg(s32 equipIndex) { s32 weaponId; equipId = g_Status.equipment[equipIndex]; - if (g_Status.equipment[ARMOR_SLOT] == ITEM_AXE_LORD_ARMOR) { +REDACTED equipId = 0xD8; } - +REDACTED weaponId = g_EquipDefs[equipId].weaponId; if (weaponId == g_EquippedWeaponIds[equipIndex] || weaponId == 0xFF) { return 1; } - +REDACTED if (g_UseDisk) { if (g_IsUsingCd) { return 0; diff --git a/src/dra/play.c b/src/dra/play.c index af324ce489..30ded88be7 100644 --- a/src/dra/play.c +++ b/src/dra/play.c @@ -50,15 +50,15 @@ RECT D_800A01C0[] = { {64, 0, 128, 0}, // unknown usage }; -void func_800E493C(void) { - if (g_Settings.isSoundMono == false) { - PlaySfx(SET_SOUNDMODE_STEREO); - } else { - PlaySfx(SET_SOUNDMODE_MONO); - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED -void func_800E4970(void) { +REDACTED SetGameState(Game_NowLoading); g_GameStep = NowLoading_2; ClearBackbuffer(); @@ -368,10 +368,10 @@ void func_800E5358(void) { } prim->y2++; prim->y3++; - } -} - -void func_800E5498(void) { +REDACTED +REDACTED +REDACTED +REDACTED POLY_GT4* poly = &g_CurrentBuffer->polyGT4[g_GpuUsage.gt4]; GpuBuffer* buffer = g_CurrentBuffer; @@ -379,8 +379,8 @@ void func_800E5498(void) { setShadeTex(poly, false); SetPrimRect(poly, 0, 0, 256, 256); setUV4(poly, 16, 16, 24, 16, 16, 24, 24, 24); - func_801072BC(poly); - poly->tpage = 0x5A; +REDACTED +REDACTED poly->clut = g_ClutIds[0x15F]; AddPrim(&buffer->ot[0x1FF], poly); g_GpuUsage.gt4++; diff --git a/src/ric/1AC60.c b/src/ric/1AC60.c index 67e65501de..ba0f8a0ed3 100644 --- a/src/ric/1AC60.c +++ b/src/ric/1AC60.c @@ -1,9 +1,9 @@ /* * File: 1AC60.c - * Overlay: RIC - * Description: Overlay for the character Richter. - */ - +REDACTED +REDACTED +REDACTED +REDACTED #include "ric.h" #include "player.h" @@ -708,7 +708,7 @@ static void RicDebugEnter(void) { static void RicDebugExit(void) { g_IsRicDebugEnter = false; - PLAYER.unk44 = 0; +REDACTED PLAYER.animCurFrame = g_RicDebugCurFrame; PLAYER.drawFlags = g_RicDebugDrawFlags; PLAYER.palette = g_RicDebugPalette; diff --git a/src/ric/1CB04.c b/src/ric/1CB04.c index 7d95d2af67..764d57fe8e 100644 --- a/src/ric/1CB04.c +++ b/src/ric/1CB04.c @@ -6,19 +6,19 @@ void func_80158B04(s32 arg0) { s32 var_s0; if (PLAYER.facingLeft) { - var_s0 = -3; - } else { - var_s0 = 3; - } - - PLAYER.posY.i.hi -= 16; - PLAYER.posX.i.hi = var_s0 + PLAYER.posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0x100, 4), 0); - PLAYER.posY.i.hi += 16; - PLAYER.posX.i.hi = PLAYER.posX.i.hi - var_s0; - - if (arg0 & 1) { - g_api.func_80102CD8(3); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); } @@ -29,27 +29,27 @@ void func_80158B04(s32 arg0) { } void RicHandleStand(void) { - s32 var_s0; - - if (PLAYER.step < 64) { - if (D_8015459C != 0) { - D_8015459C--; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } else if (D_80097448[0] >= 49) { if (PLAYER.facingLeft) { - var_s0 = -4; - } else { - var_s0 = 4; - } - PLAYER.posX.i.hi = var_s0 + PLAYER.posX.i.hi; - PLAYER.posY.i.hi -= 16; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED RicCreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0x800, 4), 0); - D_8015459C = 0x60; - PLAYER.posY.i.hi += 16; - PLAYER.posX.i.hi = PLAYER.posX.i.hi - var_s0; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!RicCheckInput(CHECK_FALL | CHECK_FACING | CHECK_JUMP | CHECK_CRASH | CHECK_ATTACK | CHECK_CROUCH | CHECK_SLIDE)) { RicDecelerateX(0x2000); @@ -69,50 +69,50 @@ void RicHandleStand(void) { case 1: if (RicCheckFacing() != 0) { RicSetWalk(0); - break; +REDACTED } else if (g_Player.padPressed & PAD_UP) { - break; - } else { +REDACTED +REDACTED RicSetStand(0); - break; - } - - case 64: - func_8015CB58(1, 1); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx < 3) { RicCheckFacing(); if (g_Player.padPressed & PAD_DOWN) { PLAYER.step = PL_S_CROUCH; PLAYER.anim = D_801555A8; - break; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameDuration < 0) { if (g_Player.padPressed & PAD_SQUARE) { g_Player.unk46 = 2; - PLAYER.step_s++; +REDACTED RicSetAnimation(D_80155730); RicCreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0, 17), 0); - break; - } +REDACTED +REDACTED g_Player.unk46 = 0; RicSetStand(0); - } - break; - - case 65: - func_8015CB58(1, 1); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.padPressed & PAD_SQUARE) { - break; - } +REDACTED +REDACTED g_Player.unk46 = 0; RicSetStand(0); - break; - - case 66: - func_8015CB58(1, 1); +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx < 3) { RicCheckFacing(); } @@ -157,11 +157,11 @@ void RicHandleRun(void) { RicSetAnimation(ric_anim_stop_run); RicCreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0, 0), 0); - } - } else { +REDACTED +REDACTED PLAYER.velocityX = 0; - } - } else if (PLAYER.step_s == 0) { +REDACTED +REDACTED RicSetSpeedX(0x24000); } } @@ -337,8 +337,8 @@ void RicHandleCrouch(void) { RicDecelerateX(0x2000); switch (PLAYER.step_s) { case 0x0: - if (D_8015459C != 0) { - D_8015459C--; +REDACTED +REDACTED } else if ((*D_80097448 >= 0x19) && (g_Player.unk48 == 0)) { if (PLAYER.facingLeft) { xShift = -9; @@ -450,36 +450,36 @@ void func_80159C04(void) { if (entity->facingLeft) { var_a2 = -entity->hitboxOffX; - } else { +REDACTED var_a2 = entity->hitboxOffX; - } - +REDACTED +REDACTED if (PLAYER.facingLeft) { var_a0 = -PLAYER.hitboxOffX; - } else { +REDACTED var_a0 = PLAYER.hitboxOffX; - } - - temp_v0 = var_a0 + PLAYER.posX.i.hi - entity->posX.i.hi - var_a2; - +REDACTED +REDACTED +REDACTED +REDACTED if (abs(temp_v0) < 16) { if (entity->velocityX != 0) { if (entity->velocityX < 0) { PLAYER.entityRoomIndex = 0; - return; - } else { +REDACTED +REDACTED PLAYER.entityRoomIndex = 1; - return; - } - } - } - - if (temp_v0 < 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.entityRoomIndex = 0; - } else { +REDACTED PLAYER.entityRoomIndex = 1; - } -} +REDACTED +REDACTED void RicHandleDead( s32 damageEffects, s32 damageKind, s32 prevStep, s32 prevStepS); @@ -1031,12 +1031,12 @@ void RicHandleDead( } void RicHandleStandInAir(void) { - if (PLAYER.step_s == 0) { +REDACTED PLAYER.velocityY += 0x3800; if (PLAYER.velocityY > 0) { PLAYER.velocityY = 0; - PLAYER.step_s = 1; - } +REDACTED +REDACTED } else if (g_Player.unk4E != 0) { g_Player.unk46 = 0; RicSetStep(PL_S_JUMP); @@ -1123,8 +1123,8 @@ void RicHandleThrowDaggers(void) { // This happens when he dies in prologue and gets saved by Maria. static s32 dead_prologue_timer; void RicHandleDeadPrologue(void) { - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED g_CurrentEntity->flags |= FLAG_UNK_10000; g_unkGraphicsStruct.unk20 = 4; RicDecelerateX(0x2000); @@ -1138,13 +1138,13 @@ void RicHandleDeadPrologue(void) { PLAYER.step_s++; } break; - case 1: +REDACTED PLAYER.drawFlags = FLAG_DRAW_ROTY; - D_801545AA += 64; +REDACTED PLAYER.rotY = (rsin(D_801545AA) >> 0xA) + 256; - if (D_801545AC != 0) { - D_801545AC--; - if ((D_801545AC) == 0) { +REDACTED +REDACTED +REDACTED PLAYER.drawFlags = 0; PLAYER.rotY = 0x100; RicCreateEntFactoryFromEntity( @@ -1154,12 +1154,12 @@ void RicHandleDeadPrologue(void) { } } break; - case 2: +REDACTED // In this step, Richter rises into the air, similar to when he uses the // Cross subweapon crash. if (!--g_DeadPrologueTimer) { RicSetAnimation(D_801558B4); - PLAYER.palette = 0x814E; +REDACTED g_CurrentEntity->velocityY = FIX(-1); RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 22), 0); g_DeadPrologueTimer = 0x30; @@ -1227,7 +1227,7 @@ void RicHandleDeadPrologue(void) { PLAYER.step_s++; } break; - case 7: +REDACTED if (PLAYER.animFrameDuration < 0) { g_CurrentEntity->flags &= ~FLAG_UNK_10000; g_unkGraphicsStruct.unk20 = 0; @@ -1304,19 +1304,19 @@ void RicHandleSlide(void) { } } } - +REDACTED // same as DRA/func_80115C50 -void func_8015BB80(void) { +REDACTED if (g_StageId == STAGE_TOP) { if (abs(g_Tilemap.left * 256 + g_PlayerX) - 8000 > 0) { PLAYER.posX.i.hi--; } if (abs(g_Tilemap.left * 256 + g_PlayerX) - 8000 < 0) { - PLAYER.posX.i.hi++; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_StageId == (STAGE_TOP | STAGE_INVERTEDCASTLE_FLAG)) { if (abs(g_Tilemap.left * 256 + g_PlayerX) - 8384 > 0) { diff --git a/src/ric/1FCD0.c b/src/ric/1FCD0.c index 2a9d4b9933..9867b91c88 100644 --- a/src/ric/1FCD0.c +++ b/src/ric/1FCD0.c @@ -1,60 +1,60 @@ -#include "ric.h" +REDACTED #include "sfx.h" - +REDACTED // Corresponding DRA function is func_80115DA0 -void func_8015BCD0(void) { +REDACTED PLAYER.velocityY = 0; PLAYER.velocityX = 0; g_Player.padSim = 0; g_Player.D_80072EFC = 4; - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED if (PLAYER.animFrameIdx == 5 && PLAYER.animFrameDuration == 1 && RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 77), 0) == NULL) { PLAYER.animFrameDuration = 2; - } +REDACTED if (PLAYER.animFrameDuration < 0) { RicSetStand(0); - } - break; - - case 2: - func_8015BB80(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx == 5 && PLAYER.animFrameDuration == 1 && RicCreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0x200, 77), 0) == NULL) { PLAYER.animFrameDuration = 2; - } +REDACTED if (PLAYER.animFrameDuration < 0) { RicSetStand(0); - } - break; - - case 4: - func_8015BB80(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameIdx == 5 && PLAYER.animFrameDuration == 1 && RicCreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0x400, 77), 0) == NULL) { PLAYER.animFrameDuration = 2; - } +REDACTED if (PLAYER.animFrameDuration < 0) { RicSetStand(0); - } - break; - - case 1: - case 3: - case 5: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.animFrameDuration < 0) { RicSetStand(0); - } +REDACTED if (g_Player.unk1C != 0) { RicSetStand(0); - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED void RicHandleSlideKick(void) { // If we are pressing square while in contact with an enemy // (as detected in g_Player.unk44), we will bounce back. @@ -65,77 +65,77 @@ void RicHandleSlideKick(void) { PLAYER.velocityY = 0; if (!g_Player.unk72) { PLAYER.velocityY = FIX(-4.5); - } - PLAYER.step_s = 2; +REDACTED +REDACTED g_Player.unk44 |= (8 + 2); g_Player.unk44 &= ~4; - return; - } +REDACTED +REDACTED RicDecelerateX(0x1000); PLAYER.velocityY += 0x1000; - +REDACTED if (g_Player.pl_vram_flag & 1) { g_CurrentEntity->velocityX /= 2; RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 0), 0); PLAYER.facingLeft = (PLAYER.facingLeft + 1) & 1; RicSetCrouch(3, PLAYER.velocityX); g_api.PlaySfx(SFX_STOMP_SOFT_A); - return; +REDACTED } if (g_Player.pl_vram_flag & 0xC) { PLAYER.velocityX = 0; - } - +REDACTED +REDACTED if (PLAYER.velocityX < 0) { if (g_Player.padPressed & PAD_RIGHT) { RicDecelerateX(0x2000); - } +REDACTED if ((PLAYER.velocityX > (s32)0xFFFD0000) || (g_Player.pl_vram_flag & 8)) { PLAYER.velocityX /= 2; PLAYER.facingLeft = (PLAYER.facingLeft + 1) & 1; RicSetAnimation(D_80155788); g_Player.unk44 = 0xA; - PLAYER.step_s = 2; +REDACTED PLAYER.step = PL_S_JUMP; - } - } +REDACTED +REDACTED if (PLAYER.velocityX > 0) { if (g_Player.padPressed & PAD_LEFT) { RicDecelerateX(0x2000); - } +REDACTED if ((PLAYER.velocityX <= 0x2FFFF) || (g_Player.pl_vram_flag & 4)) { PLAYER.velocityX /= 2; PLAYER.facingLeft = (PLAYER.facingLeft + 1) & 1; RicSetAnimation(D_80155788); g_Player.unk44 = 0xA; - PLAYER.step_s = 2; +REDACTED PLAYER.step = PL_S_JUMP; - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED void RicHandleBladeDash(void) { RicDecelerateX(0x1C00); - +REDACTED if (PLAYER.animFrameDuration < 0) { g_Player.unk46 = 0; RicSetStand(0); } else if (PLAYER.animFrameIdx >= 0x12 && !(g_Player.pl_vram_flag & 1)) { g_Player.unk46 = 0; RicSetFall(); - } else { +REDACTED if (!(g_GameTimer & 3) && PLAYER.animFrameIdx < 0x12 && g_Player.pl_vram_flag & 1) { RicCreateEntFactoryFromEntity( g_CurrentEntity, FACTORY(0x200, 24), 0); - } - +REDACTED +REDACTED if (PLAYER.animFrameIdx == 18 && PLAYER.animFrameDuration == 1 && (g_Player.pl_vram_flag & 1)) { RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 0), 0); - } - } -} +REDACTED +REDACTED +REDACTED diff --git a/src/ric/202A8.c b/src/ric/202A8.c index 5acd96e96c..ad2ce2b0f0 100644 --- a/src/ric/202A8.c +++ b/src/ric/202A8.c @@ -1,66 +1,66 @@ - -#include "ric.h" - +REDACTED +REDACTED +REDACTED void RicHandleHighJump(void) { - bool loadAnim = 0; - s32 temp; - +REDACTED +REDACTED +REDACTED FntPrint("pl_vram_flag:%04x\n", g_Player.pl_vram_flag); FntPrint("pl_high_jump_timer:%04x\n", g_Player.pl_high_jump_timer); - FntPrint("pl_step_s:%02x\n", PLAYER.step_s); +REDACTED g_Player.pl_high_jump_timer++; - - switch (PLAYER.step_s) { - case 0: +REDACTED +REDACTED +REDACTED if (g_Player.padPressed & (PAD_LEFT | PAD_RIGHT)) { if (!PLAYER.facingLeft) { temp = g_Player.padPressed & PAD_RIGHT; - } else { +REDACTED temp = g_Player.padPressed & PAD_LEFT; - } - if (temp == 0) { +REDACTED +REDACTED RicDecelerateX(0x1000); - } - } else { +REDACTED +REDACTED RicDecelerateX(0x1000); - } - +REDACTED +REDACTED if (g_Player.pl_vram_flag & 2) { - func_80158B04(3); +REDACTED g_Player.pl_high_jump_timer = 0; - PLAYER.step_s = 2; +REDACTED } else if (g_Player.pl_high_jump_timer >= 0x1D) { - PLAYER.step_s = 1; +REDACTED PLAYER.velocityY = -0x60000; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.pl_vram_flag & 2) { - PLAYER.step_s = 2; - func_80158B04(3); +REDACTED +REDACTED g_Player.pl_high_jump_timer = 0; - } else { +REDACTED PLAYER.velocityY += 0x6000; if (PLAYER.velocityY > 0x8000) { - loadAnim = true; - } - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.pl_high_jump_timer >= 5) { - loadAnim = true; - } - break; - } - - if (loadAnim) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED RicSetAnimation(D_80155534); RicSetStep(PL_S_JUMP); - } -} - +REDACTED +REDACTED +REDACTED // Same function in DRA is func_8010D59C void func_8015C4AC(void) { byte stackpad[40]; @@ -113,7 +113,7 @@ void func_8015C4AC(void) { g_Entities[1].entityId = 0; } } - +REDACTED // Extremely similar to func_8010D800 void func_8015C6D4(void) { byte pad[0x28]; @@ -170,8 +170,8 @@ void func_8015C6D4(void) { plDraw++; } } - +REDACTED void RicSetStep(int step) { - PLAYER.step = step; - PLAYER.step_s = 0; +REDACTED +REDACTED } diff --git a/src/ric/20920.c b/src/ric/20920.c index dce001356d..755e738e76 100644 --- a/src/ric/20920.c +++ b/src/ric/20920.c @@ -108,16 +108,16 @@ void func_8015CB58(s32 arg0, s32 arg1) { void func_8015CC28(void) { Entity* entity = &g_Entities[UNK_ENTITY_1]; - entity->ext.generic.unk7E.modeU8.unk1 = 0; - entity->ext.generic.unk7E.modeU8.unk0 = 0; - entity->ext.generic.unk7C.U8.unk1 = 0; - entity->ext.generic.unk7C.U8.unk0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED } void RicSetDebug() { RicSetStep(PL_S_DEBUG); } void func_8015CC70(s16 arg0) { - PLAYER.step_s = arg0; +REDACTED PLAYER.step = PL_S_INIT; PLAYER.animFrameDuration = 0; PLAYER.animFrameIdx = 0; @@ -135,15 +135,15 @@ void RicSetCrouch(s32 kind, s32 velocityX) { PLAYER.velocityY = 0; if (kind == 1) { PLAYER.anim = ric_anim_crouch_from_stand2; - PLAYER.step_s = 4; +REDACTED } if (kind == 2) { PLAYER.anim = ric_anim_crouch_from_stand; - PLAYER.step_s = 1; +REDACTED } if (kind == 3) { PLAYER.anim = ric_anim_land_from_air_run; - PLAYER.step_s = 4; +REDACTED } } @@ -186,24 +186,24 @@ void RicSetRun(void) { } void RicSetFall(void) { - /** - * TODO: labels are !FAKE - */ +REDACTED +REDACTED +REDACTED if (g_Player.prev_step != PL_S_RUN && g_Player.prev_step != PL_S_SLIDE) { PLAYER.velocityX = 0; - } +REDACTED if (g_Player.prev_step != PL_S_WALK) { if (g_Player.prev_step != PL_S_RUN) { RicSetAnimation(D_80155534); - goto block_6; - } - goto block_7; - } -block_6: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.prev_step == PL_S_RUN) { - block_7: +REDACTED g_Player.unk44 = 0x10; - } +REDACTED RicSetStep(PL_S_FALL); PLAYER.velocityY = 0x20000; g_Player.D_80072F00[PL_T_5] = 8; @@ -213,17 +213,17 @@ void RicSetFall(void) { if (g_Player.prev_step == PL_S_SLIDE) { g_Player.D_80072F00[PL_T_6] = 0; g_Player.D_80072F00[PL_T_5] = 0; - PLAYER.animFrameIdx = 2; - PLAYER.animFrameDuration = 0x10; +REDACTED +REDACTED PLAYER.velocityX /= 2; - } -} - +REDACTED +REDACTED +REDACTED void RicSetJump(void) { if (g_Player.unk72) { RicSetFall(); - return; - } +REDACTED +REDACTED if (RicCheckFacing() != 0 || PLAYER.step == Player_Slide) { RicSetAnimation(D_8015550C); if (PLAYER.step == PL_S_RUN) { @@ -232,19 +232,19 @@ void RicSetJump(void) { } else { RicSetSpeedX(FIX(1.25)); g_Player.unk44 = 0; - } - } else { +REDACTED +REDACTED RicSetAnimation(D_801554F0); PLAYER.velocityX = 0; g_Player.unk44 = 4; - } +REDACTED RicSetStep(PL_S_JUMP); if (g_IsPrologueStage) { PLAYER.velocityY = -FIX(4.6875); - } else { +REDACTED PLAYER.velocityY = -FIX(5.4375); - } -} +REDACTED +REDACTED void RicSetHighJump(void) { RicSetStep(PL_S_HIGHJUMP); @@ -253,14 +253,14 @@ void RicSetHighJump(void) { PLAYER.velocityY = FIX(-7.5); g_Player.pl_high_jump_timer = 0; RicSetAnimation(ric_anim_high_jump); - func_8015CC28(); +REDACTED RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 45), 0); g_api.PlaySfx(SFX_GRUNT_C); g_Player.D_80072F00[PL_T_12] = 4; if (g_Player.unk72) { PLAYER.velocityY = 0; - } -} +REDACTED +REDACTED s32 func_8015D1D0(s16 subWpnId, s16 maxParticles) { Entity* entity; diff --git a/src/ric/21250.c b/src/ric/21250.c index 8d0d479d28..f71c524166 100644 --- a/src/ric/21250.c +++ b/src/ric/21250.c @@ -466,22 +466,22 @@ static void DebugShowWaitInfo(const char* msg) { g_CurrentBuffer = g_CurrentBuffer->next; FntPrint(msg); if (debug_wait_info_timer++ & 4) { - FntPrint("\no\n"); - } - DrawSync(0); - VSync(0); +REDACTED +REDACTED +REDACTED +REDACTED PutDrawEnv(&g_CurrentBuffer->draw); PutDispEnv(&g_CurrentBuffer->disp); - FntFlush(-1); -} - +REDACTED +REDACTED +REDACTED static void DebugInputWait(const char* msg) { - while (PadRead(0)) +REDACTED DebugShowWaitInfo(msg); - while (PadRead(0) == 0) +REDACTED DebugShowWaitInfo(msg); -} - +REDACTED +REDACTED void func_8015E484(void) { s32 i; s32 collision = 0; @@ -545,15 +545,15 @@ void func_8015E484(void) { } } -void func_8015E7B4(Unkstruct_8010BF64* arg0) { // !FAKE: +REDACTED s32 temp = D_80154604[0].x; arg0->unk14 = temp; arg0->unk1C = temp = D_80154604[0].y; arg0->unk18 = D_801545F4[1].y - 1; arg0->unk20 = D_801545E4[1].y + 1; -} - +REDACTED +REDACTED void func_8015E800(void) { Collider sp10; s32 temp_a0; @@ -726,7 +726,7 @@ void func_8015E800(void) { } } } - +REDACTED void func_8015EE28(void) { Collider collider; s32 temp_fp; @@ -899,7 +899,7 @@ void func_8015EE28(void) { } } } - +REDACTED void func_8015F414(void) { Collider collider; s32 temp_s0; @@ -972,7 +972,7 @@ void func_8015F414(void) { } } } - +REDACTED void func_8015F680(void) { Collider collider; s32 temp_s0; @@ -1047,19 +1047,19 @@ void func_8015F680(void) { } } } - +REDACTED Entity* RicGetFreeEntity(s16 start, s16 end) { Entity* entity = &g_Entities[start]; - s16 i; - - for (i = start; i < end; i++, entity++) { +REDACTED +REDACTED +REDACTED if (entity->entityId == E_NONE) { return entity; - } - } - return NULL; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Entity* RicGetFreeEntityReverse(s16 start, s16 end) { Entity* entity = &g_Entities[end - 1]; s16 i; @@ -1070,7 +1070,7 @@ Entity* RicGetFreeEntityReverse(s16 start, s16 end) { } return NULL; } - +REDACTED static s32 D_80174F80[11]; static void func_8015F9F0(Entity* entity) { s32 i; @@ -1091,7 +1091,7 @@ static void func_8015F9F0(Entity* entity) { } } } - +REDACTED static u8 D_80174FAC; STATIC_PAD_BSS(3); static u8 D_80174FB0; @@ -1100,23 +1100,23 @@ static u8 D_80174FB4; STATIC_PAD_BSS(3); static u8 D_80174FB8; STATIC_PAD_BSS(3); -void func_8015FA5C(s32 arg0) { - D_80174FAC = D_80154674[arg0][0]; - D_80174FB0 = D_80154674[arg0][1]; - D_80174FB4 = D_80154674[arg0][2]; - D_80174FB8 = D_80154674[arg0][3]; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void RicSetSubweaponParams(Entity* entity) { u16 attack; SubweaponDef* subwpn = &D_80154688[entity->ext.subweapon.subweaponId]; if ((g_Player.D_80072F00[PL_T_INVINCIBLE]) != NULL) { attack = subwpn->attack * 2; - } else { +REDACTED attack = subwpn->attack; - } - +REDACTED +REDACTED entity->attack = attack; entity->attackElement = subwpn->attackElement; entity->hitboxState = subwpn->hitboxState; @@ -1125,9 +1125,9 @@ void RicSetSubweaponParams(Entity* entity) { entity->hitEffect = subwpn->hitEffect; entity->entityRoomIndex = subwpn->entityRoomIndex; entity->attack = g_api.func_800FD664(entity->attack); - func_8015F9F0(entity); -} - +REDACTED +REDACTED +REDACTED // We're playing as Richter and we used a subweapon (normal or crash) s32 func_8015FB84(SubweaponDef* subwpn, s32 isItemCrash, s32 useHearts) { s32 pad[2]; // Needed so stack pointer moves properly @@ -1155,9 +1155,9 @@ s32 func_8015FB84(SubweaponDef* subwpn, s32 isItemCrash, s32 useHearts) { } return -1; } - +REDACTED // Corresponding DRA function is func_80119E78 -u8 D_801548F4[6][8] = { +REDACTED 0x00, 0x50, 0x10, 0x50, 0x00, 0x60, 0x10, 0x60, 0x10, 0x50, 0x20, 0x50, 0x10, 0x60, 0x20, 0x60, 0x70, 0x40, 0x80, 0x40, 0x70, 0x50, 0x80, 0x50, 0x70, 0x30, 0x78, 0x30, 0x70, 0x38, 0x78, 0x38, 0x78, 0x30, 0x80, 0x30, @@ -1209,7 +1209,7 @@ s32 func_8015FDB0(POLY_GT4* poly, s16 posX, s16 posY) { return ret; } - +REDACTED // Corresponding DRA function is func_80119F70 static Point16 D_80174FBC[16]; void func_8015FEA8(Entity* entity) { @@ -1220,15 +1220,15 @@ void func_8015FEA8(Entity* entity) { s16 hitboxY; s16 hitboxX; s32 temp; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED entity->primIndex = (s16)g_api.AllocPrimitives(PRIM_GT4, LEN(D_80174FBC)); if (entity->primIndex == -1) { DestroyEntity(entity); - return; - } +REDACTED +REDACTED entity->flags = FLAG_HAS_PRIMS | FLAG_UNK_40000 | FLAG_UNK_20000; hitboxX = PLAYER.posX.i.hi + PLAYER.hitboxOffX; hitboxY = PLAYER.posY.i.hi + PLAYER.hitboxOffY; @@ -1252,14 +1252,14 @@ void func_8015FEA8(Entity* entity) { } prim = prim->next; } - entity->step++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Player.unk0C & 0x10000)) { DestroyEntity(entity); - return; - } +REDACTED +REDACTED } prim = &g_PrimBuf[entity->primIndex]; @@ -1287,8 +1287,8 @@ void func_8015FEA8(Entity* entity) { } return; } - -// same as DRA/func_8011F074 +REDACTED +REDACTED static AnimationFrame anim_80154924[] = { {2, FRAME(1, 0)}, {2, FRAME(2, 0)}, {2, FRAME(3, 0)}, {2, FRAME(4, 0)}, @@ -1298,19 +1298,19 @@ static AnimationFrame anim_80154924[] = { {2, FRAME(11, 0)}, {2, FRAME(12, 0)}, {2, FRAME(13, 0)}, A_END}; static s32 D_80174FFC; -void func_801601DC(Entity* entity) { - s16 posX; - s16 posY; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_20000 | FLAG_UNK_100000 | FLAG_UNK_08000000; - entity->unk5A = 0x79; +REDACTED entity->animSet = ANIMSET_DRA(14); - entity->zPriority = PLAYER.zPriority + 2; - entity->palette = 0x819F; - - if (D_80174FFC & 1) { +REDACTED +REDACTED +REDACTED +REDACTED entity->drawMode = 0x70; } else { entity->drawMode = DRAW_TPAGE; @@ -1318,32 +1318,32 @@ void func_801601DC(Entity* entity) { entity->rotY = 0x40; entity->rotX = 0x40; entity->anim = anim_80154924; - D_80174FFC++; - entity->unk6C = 0xFF; +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY | FLAG_DRAW_UNK10 | FLAG_DRAW_UNK20; - posX = 10; - posY = 15; - entity->posY.i.hi = entity->posY.i.hi - posY + (rand() % 35); - entity->posX.i.hi = entity->posX.i.hi - posX + (rand() % 20); +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityY = -0x6000 - (rand() & 0x3FFF); - entity->step++; - break; - - case 1: - if (entity->unk6C >= 17) { - entity->unk6C += 248; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val += entity->velocityY; entity->rotX += 8; entity->rotY += 8; - if (entity->animFrameDuration < 0) { +REDACTED DestroyEntity(entity); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static void RicEntityDummy(Entity* self) {} void func_801603BC(void) {} @@ -1558,17 +1558,17 @@ void RicUpdatePlayerEntities(void) { } } } - +REDACTED // Similar to the version in DRA but with some logic removed Entity* RicCreateEntFactoryFromEntity( Entity* source, u32 factoryParams, s32 arg2) { - /** - * arg2 is unused, but needed to match other functions that call - * this function, probably part of the code for a debug build - */ +REDACTED +REDACTED +REDACTED +REDACTED Entity* entity = RicGetFreeEntity(8, 16); - - if (entity != NULL) { +REDACTED +REDACTED DestroyEntity(entity); entity->entityId = E_ENTITYFACTORY; // the parent pointer must align for anything the factory creates @@ -1581,9 +1581,9 @@ Entity* RicCreateEntFactoryFromEntity( entity->ext.factory.unkA0 = (factoryParams >> 8) & 0xFF00; if (source->flags & FLAG_UNK_10000) { entity->flags |= FLAG_UNK_10000; - } - } else { - return NULL; - } - return entity; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/ric/24788.c b/src/ric/24788.c index 628fdf9b19..b327d892f0 100644 --- a/src/ric/24788.c +++ b/src/ric/24788.c @@ -159,104 +159,104 @@ void RicEntityFactory(Entity* self) { void func_80160C38(Entity* entity) { if (PLAYER.step != PL_S_SLIDE) { DestroyEntity(entity); - } else { +REDACTED entity->posX.i.hi = PLAYER.posX.i.hi; entity->posY.i.hi = PLAYER.posY.i.hi; entity->facingLeft = PLAYER.facingLeft; - if (entity->step == 0) { +REDACTED entity->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000; entity->hitboxOffX = 0x14; entity->hitboxOffY = 0xC; - entity->hitboxHeight = 9; - entity->hitboxWidth = 9; +REDACTED +REDACTED entity->ext.subweapon.subweaponId = PL_W_KICK; RicSetSubweaponParams(entity); entity->ext.subweapon.timer = entity->hitboxState; entity->step++; } entity->hitboxState = entity->ext.subweapon.timer; - if (PLAYER.animFrameIdx < 2) { +REDACTED entity->hitboxState = 0; - } - if (PLAYER.animFrameIdx >= 8) { +REDACTED +REDACTED DestroyEntity(entity); - } - } -} - -void func_80160D2C(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.step != PL_S_SLIDE_KICK) { DestroyEntity(self); - return; - } - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = PLAYER.facingLeft; - if (self->step == 0) { +REDACTED self->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000; self->hitboxOffX = 0x14; - self->hitboxHeight = 9; - self->hitboxWidth = 9; +REDACTED +REDACTED self->ext.subweapon.subweaponId = PL_W_23; RicSetSubweaponParams(self); - self->step++; - } - - if (PLAYER.animCurFrame == 140) { +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = 0; - } - - if (PLAYER.animCurFrame == 141) { +REDACTED +REDACTED +REDACTED self->hitboxOffY = 12; - } - +REDACTED +REDACTED if (self->hitFlags) { g_Player.unk44 |= 0x80; - } else { - g_Player.unk44 &= ~0x80; - } +REDACTED +REDACTED +REDACTED self->hitFlags = 0; -} - +REDACTED +REDACTED // created from a blueprint, #24 void RicEntityBladeDash(Entity* self) { if (PLAYER.step != PL_S_BLADEDASH) { DestroyEntity(self); - } else { - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED +REDACTED self->facingLeft = PLAYER.facingLeft; - if (self->step == 0) { +REDACTED self->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000; - self->hitboxHeight = 20; - self->hitboxWidth = 20; +REDACTED +REDACTED self->hitboxOffY = 0; self->hitboxOffX = 0; - self->ext.generic.unkB0 = 0x11; +REDACTED RicSetSubweaponParams(self); - self->step++; - } - if (PLAYER.animFrameIdx >= 19) { +REDACTED +REDACTED +REDACTED DestroyEntity(self); - } - } -} - -void func_80160F0C(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.step != PL_S_HIGHJUMP) { DestroyEntity(self); - return; - } - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = PLAYER.facingLeft; - if (self->step == 0) { +REDACTED self->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000; self->hitboxOffX = 0xC; self->hitboxOffY = -0x1A; - self->hitboxWidth = 12; - self->hitboxHeight = 12; - self->ext.generic.unkB0 = 0x16; +REDACTED +REDACTED +REDACTED RicSetSubweaponParams(self); self->step++; } @@ -418,28 +418,28 @@ void func_80160FC4(Entity* self) { // Corresponding DRA function is func_8011E4BC static unkStr_8011E4BC D_80154D00 = { - 0x08, 0xC0, 0x60, 0x00, 0x01, 0x01, 0x0004, 0x0033, 0x0003, 0x08800000}; +REDACTED static unkStr_8011E4BC D_80154D10 = { - 0x10, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x0002, 0x0033, 0x0001, 0x0C800000}; +REDACTED static unkStr_8011E4BC D_80154D20 = { - 0x08, 0x7F, 0x7F, 0x7F, 0x02, 0x02, 0x0002, 0x0033, 0x0000, 0x08800000}; +REDACTED static unkStr_8011E4BC D_80154D30 = { - 0x06, 0x7F, 0xFF, 0xFF, 0x01, 0x01, 0x0004, 0x0073, 0x0003, 0x08800000}; +REDACTED static unkStr_8011E4BC D_80154D40 = { - 0x0C, 0xC0, 0x60, 0x00, 0x01, 0x01, 0x0004, 0x0033, 0x0003, 0x08800000}; +REDACTED static unkStr_8011E4BC D_80154D50 = { - 0x0C, 0x7F, 0x00, 0x00, 0x03, 0x03, 0x0002, 0x0002, 0x0004, 0x0C800000}; +REDACTED static unkStr_8011E4BC D_80154D60 = { - 0x08, 0x1F, 0x1F, 0x7F, 0x01, 0x01, 0x0004, 0x0033, 0x0006, 0x0C800000}; +REDACTED static unkStr_8011E4BC D_80154D70 = { - 0x14, 0x7F, 0x7F, 0xC0, 0x01, 0x01, 0xFFFE, 0x0033, 0x0007, 0x0C800000}; +REDACTED static unkStr_8011E4BC D_80154D80 = { - 0x06, 0xC0, 0xC0, 0xC0, 0x02, 0x02, 0x0002, 0x007B, 0x0008, 0x08800000}; +REDACTED static unkStr_8011E4BC D_80154D90 = { - 0x10, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x0002, 0x0033, 0x0009, 0x08800000}; +REDACTED static unkStr_8011E4BC* D_80154DA0[] = { - &D_80154D00, &D_80154D10, &D_80154D20, &D_80154D30, &D_80154D40, - &D_80154D50, &D_80154D60, &D_80154D70, &D_80154D80, &D_80154D90}; +REDACTED +REDACTED void func_8016147C(Entity* self) { byte stackpad[0x28]; FakePrim* tilePrim; @@ -701,15 +701,15 @@ static AnimationFrame anim_80154E04[] = { {3, FRAME(19, 0)}, {4, FRAME(20, 0)}, A_END}; -void func_80161C2C(Entity* self) { - u16 params = self->params; - s16 paramsHi = self->params >> 8; - s32 step = self->step; - s32 rnd; - - switch (step) { - case 0: - if (paramsHi == 1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX = 0xC0; self->rotY = 0xC0; self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; @@ -724,34 +724,34 @@ void func_80161C2C(Entity* self) { self->rotY = 0x120; self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; self->animSet = ANIMSET_DRA(2); - } else { +REDACTED self->animSet = ANIMSET_DRA(5); self->anim = anim_80154C80; - self->palette = 0x8170; - } - } +REDACTED +REDACTED +REDACTED self->flags = FLAG_UNK_20000 | FLAG_UNK_100000 | FLAG_UNK_08000000; - - if (rand() % 4) { - self->zPriority = PLAYER.zPriority + 2; - } else { - self->zPriority = PLAYER.zPriority - 2; - } - - if (paramsHi == 2) { - self->posX.i.hi = PLAYER.posX.i.hi + (rand() % 44) - 22; - } else { - self->posX.i.hi = PLAYER.posX.i.hi + (rand() & 15) - 8; - } - - rnd = rand() & 31; - self->posY.i.hi = PLAYER.posY.i.hi + PLAYER.hitboxOffY + rnd - 16; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-0.5); self->velocityX = PLAYER.velocityX >> 2; - self->step++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED self->rotX -= 4; self->rotY -= 4; self->posY.val += self->velocityY; @@ -778,21 +778,21 @@ static AnimationFrame anim_80154E38[] = { {2, FRAME(1, 0)}, {2, FRAME(2, 0)}, {2, FRAME(3, 0)}, {2, FRAME(4, 0)}, {2, FRAME(5, 0)}, {2, FRAME(6, 0)}, {2, FRAME(7, 0)}, {2, FRAME(8, 0)}, A_END}; -void func_80161EF8(Entity* self) { - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED self->animSet = ANIMSET_DRA(2); self->anim = anim_80154E38; self->flags = FLAG_UNK_20000 | FLAG_UNK_100000 | FLAG_UNK_10000 | FLAG_UNK_40000; - self->zPriority = PLAYER.zPriority + 4; +REDACTED self->velocityY = (rand() & 0x3FFF) - 0x10000; - self->step++; - break; - - case 1: - if ((self->animFrameIdx == 6) && - (self->animFrameDuration == self->step) && (rand() & 1)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED RicCreateEntFactoryFromEntity(self, FACTORY(0, 4), 0); } self->posY.val += self->velocityY; @@ -894,17 +894,17 @@ void func_80161FF0(Entity* self) { void func_801623E0(Entity* entity) { Primitive* prim; s16 primIndex; - +REDACTED entity->posX.val = g_Entities->posX.val; - entity->posY.val = PLAYER.posY.val; - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); entity->primIndex = primIndex; if (primIndex == -1) { DestroyEntity(entity); - return; - } +REDACTED +REDACTED entity->ext.et_80161FF0.unk7E = 32; entity->ext.et_80161FF0.unk7C = 32; prim = &g_PrimBuf[entity->primIndex]; @@ -922,10 +922,10 @@ void func_801623E0(Entity* entity) { prim->drawMode = DRAW_DEFAULT; entity->flags = FLAG_UNK_10000 | FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS; - entity->step++; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED entity->ext.et_80161FF0.unk7C++; entity->ext.et_80161FF0.unk7E++; if (entity->ext.et_80161FF0.unk7C >= 45) { @@ -950,11 +950,11 @@ void func_801623E0(Entity* entity) { void func_80162604(Entity* entity) { Primitive* prim; s16 primIndex; - +REDACTED entity->posX.val = g_Entities->posX.val; - entity->posY.val = PLAYER.posY.val; - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); entity->primIndex = primIndex; if (primIndex != -1) { @@ -975,37 +975,37 @@ void func_80162604(Entity* entity) { prim->drawMode = DRAW_DEFAULT; entity->flags = FLAG_UNK_10000 | FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS; - entity->step++; - goto def; - } else { +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - break; - } - - case 1: - entity->ext.generic.unk7C.s += 8; - entity->ext.generic.unk7E.modeU16 += 8; - if (entity->ext.generic.unk7C.s < 0x20) { - goto def; - } - - case 2: - entity->step++; - goto def; - - case 3: - entity->ext.generic.unk7C.s -= 8; - entity->ext.generic.unk7E.modeU16 -= 8; - if (entity->ext.generic.unk7C.s >= 5) { - goto def; - } else { - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - } - break; - - def: - default: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[entity->primIndex]; prim->x0 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C; prim->y0 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E; @@ -1110,7 +1110,7 @@ void func_80162870(Entity* self) { } void func_80162C7C(Entity* self) {} - +REDACTED static AnimationFrame anim_80154ED4[] = { {4, FRAME(1, 0)}, {4, FRAME(2, 0)}, {4, FRAME(3, 0)}, {4, FRAME(4, 0)}, {4, FRAME(5, 0)}, {4, FRAME(6, 0)}, @@ -1127,44 +1127,44 @@ static AnimationFrame anim_80154EF8[] = { {0x08, FRAME(0x11, 0)}, {0x0C, FRAME(0x12, 0)}, {0xB0, FRAME(0x13, 0)}, {0x0A, FRAME(0x14, 0)}, {0x0A, FRAME(0x15, 0)}, {0x0A, FRAME(0x16, 0)}, {0x30, FRAME(0x17, 0)}, {0xD0, FRAME(0x18, 0)}, A_END}; -void func_80162C84(Entity* entity) { +REDACTED switch (entity->step) { case 0: entity->flags = FLAG_UNK_100000 | FLAG_UNK_04000000 | FLAG_UNK_10000 | FLAG_UNK_08000000; entity->facingLeft = 1; - entity->unk5A = 0x66; - entity->zPriority = PLAYER.zPriority - 8; +REDACTED +REDACTED entity->palette = PAL_OVL(0x149); entity->animSet = ANIMSET_OVL(19); RicSetAnimation(anim_80154ED4); entity->velocityX = FIX(-1.75); - entity->posY.i.hi = 0xBB; - entity->posX.i.hi = 0x148; +REDACTED +REDACTED entity->ext.et_80161FF0.unk7E = 0; entity->step++; break; - case 1: +REDACTED if (entity->animFrameIdx == 0 && entity->animFrameDuration == 1) { - g_api.PlaySfx(0x882); - } +REDACTED +REDACTED if (entity->animFrameIdx == 4 && entity->animFrameDuration == 1) { - g_api.PlaySfx(0x883); - } - +REDACTED +REDACTED +REDACTED entity->posX.val += entity->velocityX; if (((s16)entity->ext.et_80161FF0.unk7E == 0) && (entity->posX.i.hi < 256)) { g_api.PlaySfx(0x87D); entity->ext.et_80161FF0.unk7E++; - } - if (entity->posX.i.hi < 0xE0) { +REDACTED +REDACTED RicSetAnimation(anim_80154EF8); entity->velocityX = 0; - entity->step++; +REDACTED RicCreateEntFactoryFromEntity(entity, FACTORY(0x400, 0), 0); - } - break; +REDACTED +REDACTED case 2: if (entity->animFrameIdx == 16) { g_api.PlaySfx(0x87E); @@ -1175,9 +1175,9 @@ void func_80162C84(Entity* entity) { case 3: if (!--entity->ext.et_80161FF0.unk7C) { RicCreateEntFactoryFromEntity(entity, FACTORY(0, 30), 0); - entity->step++; - } - break; +REDACTED +REDACTED +REDACTED case 4: break; } diff --git a/src/ric/26C84.c b/src/ric/26C84.c index 0fcb1a92d7..6b4666014e 100644 --- a/src/ric/26C84.c +++ b/src/ric/26C84.c @@ -1,21 +1,21 @@ -#include "ric.h" - +REDACTED +REDACTED // same as DRA/func_8011BD48 -bool func_80162E9C(Entity* entity) { - s32 i = 16; +REDACTED +REDACTED s16 objId = entity->entityId; - s16 params = entity->params; - Entity* e; - - for (e = &g_Entities[i]; i < 64; i++, e++) { +REDACTED +REDACTED +REDACTED +REDACTED if ((objId == e->entityId) && (params == e->params) && (e != entity)) { - return true; - } - } - - return false; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // EntityPlayerBlinkWhite (Richter's version). // Same general logic flow as in DRA but lots of missing cases. static s32 D_80154F7C[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -368,15 +368,15 @@ void RicEntityPlayerBlinkWhite(Entity* self) { func_8015CAD4(1, 10); } } - -void func_801641A0(Entity* entity) { +REDACTED +REDACTED Primitive* prim; s16 primIndex; - - entity->posX.i.hi = PLAYER.posX.i.hi; - entity->posY.i.hi = PLAYER.posY.i.hi - 8; - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); entity->primIndex = primIndex; if (primIndex != -1) { @@ -395,23 +395,23 @@ void func_801641A0(Entity* entity) { prim->priority = PLAYER.zPriority + 8; prim->drawMode = 0x35; entity->flags = FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS; - entity->step++; - goto def; - } else { +REDACTED +REDACTED +REDACTED DestroyEntity(entity); - break; - } - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED entity->ext.et_80161FF0.unk7C += 2; entity->ext.et_80161FF0.unk7E += 2; if (entity->ext.et_80161FF0.unk7C >= 57) { DestroyEntity(entity); - break; - } - - default: - def: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[entity->primIndex]; prim->x0 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C; prim->y0 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E; @@ -423,12 +423,12 @@ void func_801641A0(Entity* entity) { prim->y3 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E; if (prim->b3 >= 12) { prim->b3 += 244; - } +REDACTED prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 = prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - } -} - +REDACTED +REDACTED +REDACTED // Entity ID # 34. Created by blueprints 36, 37, 38, 39. // Only difference in those blueprints is the "unk5" member of the blueprint. // When the factory is made, unk5 loads into ext.factory.unk9A. This appears @@ -461,18 +461,18 @@ void RicEntityShrinkingPowerUpRing(Entity* self) { s32 i; s32 constE0 = 0xE0; u32 upperparams = self->params & 0x7F00; - s16* loadedParams = &D_8015519C[upperparams >> 8]; +REDACTED rScale = loadedParams[2]; gScale = loadedParams[3]; bScale = loadedParams[4]; - +REDACTED gOffset = loadedParams[0]; bOffset = loadedParams[1]; - - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; - +REDACTED +REDACTED +REDACTED +REDACTED switch (self->step) { case 0: self->primIndex = g_api.AllocPrimitives(PRIM_GT4, 32); @@ -480,14 +480,14 @@ void RicEntityShrinkingPowerUpRing(Entity* self) { DestroyEntity(self); return; } - +REDACTED self->flags = FLAG_UNK_04000000 | FLAG_HAS_PRIMS | FLAG_UNK_40000 | FLAG_UNK_10000; prim2 = prim1 = &g_PrimBuf[self->primIndex]; for (i = 0; i < 16; i++) { prim1 = prim1->next; } - +REDACTED for (i = 0; i < 16; i++) { prim2->u0 = ((rcos((s16)(i << 8)) * 2) >> 8) + 0x20; prim2->v0 = -((rsin((s16)(i << 8)) * 2) >> 8) - 0x21; @@ -510,31 +510,31 @@ void RicEntityShrinkingPowerUpRing(Entity* self) { self->ext.ricPowerRing.unk84 = self->ext.ricPowerRing.unk86 = 0x240; self->ext.ricPowerRing.unk8A = loadedParams[5]; self->ext.ricPowerRing.unk88 = 0xC0; - self->step++; +REDACTED break; - +REDACTED case 1: self->ext.ricPowerRing.unk7E += 0x40; self->ext.ricPowerRing.unk86 -= 10; if (self->ext.ricPowerRing.unk86 < 0) { self->ext.ricPowerRing.unk86 = 0; self->ext.ricPowerRing.unk7C = 0x20; - self->step++; +REDACTED } self->ext.ricPowerRing.unk84 = self->ext.ricPowerRing.unk86; self->ext.ricPowerRing.unk82 -= 5; self->ext.ricPowerRing.unk80 -= 5; break; - +REDACTED case 2: self->ext.ricPowerRing.unk7E += 0x40; self->ext.ricPowerRing.unk82 -= 3; self->ext.ricPowerRing.unk80 -= 6; if (--self->ext.ricPowerRing.unk7C == 0) { - self->step++; +REDACTED } break; - +REDACTED case 3: self->ext.ricPowerRing.unk7E = self->ext.ricPowerRing.unk7E + 0x40; self->ext.ricPowerRing.unk82 = self->ext.ricPowerRing.unk82 - 3; @@ -546,11 +546,11 @@ void RicEntityShrinkingPowerUpRing(Entity* self) { } break; } - +REDACTED sp38 = self->ext.ricPowerRing.unk8A; selfX = self->posX.i.hi; selfY = self->posY.i.hi; - +REDACTED prim2 = prim1 = &g_PrimBuf[self->primIndex]; for (i = 0; i < 16; i++) { prim1 = prim1->next; @@ -634,7 +634,7 @@ void RicEntityShrinkingPowerUpRing(Entity* self) { prim1 = prim1->next; } } - +REDACTED // Entity ID #40. Created by blueprint 47. That factory comes from // RicHandleHit. static Point16 D_801551FC = {0xFFFE, 0xFFE8}; @@ -656,20 +656,20 @@ static Point16 D_80155238 = {0x0006, 0xFFEB}; static Point16 D_8015523C = {0xFFF8, 0x0015}; static Point16 D_80155240 = {0x0007, 0x0016}; static Point16* D_80155244[] = { - &D_801551FC, &D_8015520C, &D_80155200, &D_8015520C, &D_80155210, - &D_80155200, &D_80155210, &D_80155204, &D_80155200, &D_80155210, - &D_80155214, &D_80155204, &D_80155214, &D_80155208, &D_80155204, - &D_80155204, &D_80155208, &D_80155220, &D_80155204, &D_80155220, - &D_8015521C, &D_80155200, &D_80155204, &D_8015521C, &D_80155200, - &D_8015521C, &D_80155218, &D_80155200, &D_80155218, &D_801551FC, - &D_8015520C, &D_8015522C, &D_80155210, &D_8015522C, &D_80155230, - &D_80155210, &D_80155230, &D_80155214, &D_80155210, &D_80155218, - &D_8015521C, &D_80155224, &D_8015521C, &D_80155228, &D_80155224, - &D_8015521C, &D_80155220, &D_80155228, &D_801551FC, &D_80155218, - &D_80155234, &D_801551FC, &D_80155238, &D_8015520C, &D_80155208, - &D_8015523C, &D_80155220, &D_80155214, &D_80155240, &D_80155208, - &D_80155234, &D_80155218, &D_80155224, &D_80155238, &D_8015522C, - &D_8015520C, &D_80155228, &D_80155220, &D_8015523C, &D_80155230, +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED &D_80155240, &D_80155214}; void RicEntityHitByIce(Entity* self) { const int PrimCount = LEN(D_80155244) / 3; @@ -689,8 +689,8 @@ void RicEntityHitByIce(Entity* self) { Point16* offset; bool sp18 = false; - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED // This is badly written but it checks if 0x10000 is unset. sp18 = ((g_Player.unk0C & 0x10000) == sp18); switch (self->step) { @@ -876,7 +876,7 @@ void RicEntityHitByIce(Entity* self) { prim = prim->next; } } - +REDACTED static s16 lightning_clut[] = {0x194, 0x199}; void RicEntityHitByLightning(Entity* self) { Primitive* prevPrim; @@ -1018,24 +1018,24 @@ void RicEntityHitByLightning(Entity* self) { prim->u1 = prim->u3 = (tempAngle << 4) - 0x60; prim->v2 = prim->v3 = 0xCF; } - +REDACTED // Corresponding DRA function is func_80124164 static s32 D_80155368[] = {255, 255, 255, 127, 127, 63, 127, 63, 127}; void func_80165DD8( POLY_GT4* poly, s32 colorIntensity, s32 y, s32 radius, bool arg4) { - s16 top = y - radius; - s16 bottom = y + radius; - s32 colorChannel; - - poly->y0 = poly->y1 = top; - poly->y2 = poly->y3 = bottom; - - if (poly->y0 < 0) { - poly->y0 = poly->y1 = 0; - } - - if (poly->y0 > 240) { - poly->y2 = poly->y3 = 240; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } if (arg4 == 0) { @@ -1043,31 +1043,31 @@ void func_80165DD8( if (colorChannel < 0) { colorChannel += 255; } - poly->r1 = poly->r3 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[1]; if (colorChannel < 0) { colorChannel += 255; } - poly->g1 = poly->g3 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[2]; if (colorChannel < 0) { colorChannel += 255; } - poly->b1 = poly->b3 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[3]; if (colorChannel < 0) { colorChannel += 255; } - poly->r0 = poly->r2 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[4]; if (colorChannel < 0) { colorChannel += 255; } - poly->g0 = poly->g2 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[5]; } else { @@ -1075,45 +1075,45 @@ void func_80165DD8( if (colorChannel < 0) { colorChannel += 255; } - poly->r1 = poly->r3 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[1]; if (colorChannel < 0) { colorChannel += 255; } - poly->g1 = poly->g3 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[2]; if (colorChannel < 0) { colorChannel += 255; } - poly->b1 = poly->b3 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[6]; if (colorChannel < 0) { colorChannel += 255; } - poly->r0 = poly->r2 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[7]; if (colorChannel < 0) { colorChannel += 255; } - poly->g0 = poly->g2 = (u32)colorChannel >> 8; +REDACTED colorChannel = colorIntensity * D_80155368[8]; } if (colorChannel < 0) { colorChannel += 255; } - poly->b0 = poly->b2 = (u32)colorChannel >> 8; -} - -void func_80166024() { - PLAYER.palette = 0x815E; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.drawMode = 0x70; -} - -void func_80166044() { - PLAYER.palette = 0x8120; +REDACTED +REDACTED +REDACTED +REDACTED PLAYER.drawMode = DRAW_DEFAULT; -} +REDACTED diff --git a/src/ric/2A060.c b/src/ric/2A060.c index 91aaeb795e..dac033cd9b 100644 --- a/src/ric/2A060.c +++ b/src/ric/2A060.c @@ -177,8 +177,8 @@ void RicEntityTeleport(Entity* self) { } selfUnk7C = self->ext.teleport.unk7C; selfUnk80 = self->ext.teleport.unk80; - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED prim = &g_PrimBuf[self->primIndex]; xVar = PLAYER.posX.i.hi; yVar = PLAYER.posY.i.hi; @@ -231,44 +231,44 @@ void RicEntityTeleport(Entity* self) { // Entity #10, uses blueprint #10. Appears related to poisoning, due to call in // RicDoAttack static Point16 D_801559AC[] = { - 0x0007, 0xFFFE, 0x0010, 0xFFFE, 0x0005, 0xFFEE, 0xFFF2, +REDACTED 0xFFEE, 0xFFE9, 0xFFFA, 0xFFE8, 0xFFFA, 0xFFE7, 0xFFFA}; static Point16 D_801559C8[] = { - 0x0007, 0x000B, 0x0010, 0x000B, 0x0005, 0xFFFB, 0xFFF2, +REDACTED 0xFFFB, 0xFFE9, 0x000B, 0xFFE8, 0x000B, 0xFFE7, 0x000B}; static Point16 D_801559E4[] = { - 0xFFF1, 0xFFFC, 0xFFF2, 0xFFF2, 0xFFF7, 0xFFFA, 0xFFEE, 0xFFFA, 0xFFF7, +REDACTED 0x0002, 0xFFF5, 0xFFF7, 0xFFF0, 0xFFF6, 0xFFF9, 0x0000, 0xFFF2, 0x0000}; static s16 D_80155A08[] = {0x000F, 0x000E, 0x0012, 0x0009, 0x0009, 0x0010, 0x000B, 0x000E, 0x0007, 0x0000}; static Point16 D_80155A1C[] = { - 0xFFF1, 0x0009, 0xFFF2, 0xFFFF, 0xFFF7, 0x0007, 0xFFEE, 0x0009, 0xFFF7, - 0x000F, 0xFFF5, 0x0004, 0xFFF0, 0x0003, 0xFFF9, 0x000D, 0xFFF2, 0x000D, -}; +REDACTED +REDACTED +REDACTED static s16 D_80155A40[] = {0x000F, 0x000E, 0x0012, 0x0009, 0x0009, 0x0010, 0x000B, 0x000E, 0x0007, 0x0000}; static Point16 D_80155A54[] = { - 0xFFF1, 0xFFFA, 0xFFF2, 0xFFF0, 0xFFF7, 0xFFF8, 0xFFEE, 0xFFFA, 0xFFF7, - 0x0000, 0xFFF5, 0xFFF5, 0xFFF0, 0xFFF4, 0xFFF9, 0xFFFE, 0xFFF2, 0xFFFE}; +REDACTED +REDACTED static s16 D_80155A78[] = { - 0x000F, 0x000E, 0x0012, 0x0009, 0x0009, 0x0010, 0x000B, 0x000E, 0x0007, - 0x0000, 0x0001, 0x0000, 0x0005, 0x0000, 0x0002, 0x0000, 0x0007, 0x0000, - 0x0004, 0x0000, 0x0008, 0x0000, 0x0003, 0x0000, 0x0006, 0x0000}; +REDACTED +REDACTED +REDACTED static Point32 D_80155AAC[] = { - 0x00040000, 0x00020000, 0x00040000, 0xFFFD8000, 0x00100000, - 0x00000000, 0x00100000, 0x00000000, 0xFFEC0000, 0x00000000, - 0xFFE00000, 0x00000000, 0xFFCC0000, 0x00000000}; +REDACTED +REDACTED +REDACTED static Point32 D_80155AE4[] = { - 0x00000000, 0x00000000, 0xFFFD8000, 0x00000000, 0xFFFFE000, 0x00020000, - 0xFFFFE000, 0xFFFE0000, 0x00008000, 0x00000000, 0xFFFE0000, 0x00018000, - 0xFFFE0000, 0xFFFE8000, 0x00008000, 0x00018000, 0x00008000, 0xFFFE8000}; +REDACTED +REDACTED +REDACTED static s32 D_80155B2C[][9] = { {1, 1, 5, 6, 0, 1, 1, 0, 0}, {2, 5, 2, 0, 7, 2, 0, 2, 0}, {3, 6, 0, 3, 8, 0, 3, 0, 3}, {4, 0, 7, 8, 4, 0, 0, 4, 4}, {5, 5, 5, 0, 0, 5, 1, 2, 0}, {6, 6, 0, 6, 0, 1, 6, 0, 3}, {7, 0, 7, 0, 7, 1, 0, 7, 4}, {8, 0, 0, 8, 8, 4, 3, 7, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, -}; +REDACTED static s16 D_80155C70[] = {0x8139, 0x813A, 0x813B, 0x0000}; static s16 D_80155C78[] = { 0x0010, 0x000E, 0x000C, 0x000A, 0x0008, 0x0006, 0x0004, 0x0002, @@ -384,7 +384,7 @@ void RicEntityWhip(Entity* self) { } else { if (PLAYER.step == PL_S_STAND) { if (!PLAYER.facingLeft) { - var_s3 = D_80155A08[var_s4]; +REDACTED } else { var_s3 = D_801559E4[var_s4].x; } @@ -518,7 +518,7 @@ void RicEntityWhip(Entity* self) { self->ext.whip.unk84 = 6; if (var_s4 == 0) { if (!PLAYER.facingLeft) { - xDiff = D_80155A08[0]; +REDACTED } else { xDiff = D_801559E4[0].x; } @@ -747,22 +747,22 @@ static s16 D_80155D08[] = {0x0013, 0x0014, 0x0016, 0x001A, 0x0018, 0x0015, 0x001B, 0x0017, 0x0019, 0x0000}; static s16 D_80155D1C[] = {0x0013, 0x0014, 0x001A, 0x0016, 0x0018, 0x001B, 0x0015, 0x0019, 0x0017, 0x0000}; -void func_8016779C(Entity* entity) { +REDACTED if (g_Player.unk46 == 0) { DestroyEntity(entity); - return; - } - +REDACTED +REDACTED +REDACTED entity->facingLeft = PLAYER.facingLeft; - if (entity->step == 0) { +REDACTED entity->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_UNK_10000; entity->animSet = ANIMSET_OVL(18); - entity->unk5A = 0x46; - entity->palette = 0x8120; - entity->zPriority = PLAYER.zPriority + 2; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PLAYER.step == PL_S_CROUCH) { if (PLAYER.facingLeft) { entity->animCurFrame = D_80155CCC[D_80175080]; @@ -782,38 +782,38 @@ void func_8016779C(Entity* entity) { } entity->posX.val = g_Entities->posX.val; - entity->posY.val = PLAYER.posY.val; -} - +REDACTED +REDACTED +REDACTED static s16 D_80155D30[] = {0x10, 0x18, 0x11, 0x19, 0x12, 0x1A, 0x13, 0x1B, 0x14, 0x1C, 0x15, 0x1D, 0x16, 0x1E, 0x17, 0x00, 0x02, 0x01, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, 0x00, 0x00}; void func_80167964(Entity* entity) { - if (g_Player.unk46 != 0) { - if (entity->step == 0) { +REDACTED +REDACTED entity->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000 | FLAG_UNK_10000; +REDACTED +REDACTED +REDACTED +REDACTED } - if (!(entity->params & 0xFF00)) { - g_Entities[D_80155D30[entity->animFrameDuration]].palette = - PAL_OVL(0x140); - } - g_Entities[D_80155D30[entity->animFrameDuration]].ext.player.unkA4 = 4; +REDACTED entity->animFrameDuration++; if (entity->animFrameDuration == 0xF) { DestroyEntity(entity); - } - } else { +REDACTED +REDACTED DestroyEntity(entity); - } -} - +REDACTED +REDACTED +REDACTED void func_80167A58(Entity* self) {} - +REDACTED void func_80167A60(Entity* self) {} - +REDACTED void func_80167A68(Entity* self) {} - +REDACTED // Entity ID #35. Created by blueprint 40. No known FACTORY calls with // blueprint 40. Duplicate of DRA EntityHolyWaterBreakGlass. static s16 D_80155D64[4][6] = { @@ -840,11 +840,11 @@ void func_80167A70(Entity* self) { DestroyEntity(self); return; } - +REDACTED prim = &g_PrimBuf[self->primIndex]; posX = self->posX.i.hi; posY = self->posY.i.hi; - +REDACTED for (i = 0; prim != NULL; i++, prim = prim->next) { if (i < 8) { fakeprim = (FakePrim*)prim; @@ -888,14 +888,14 @@ void func_80167A70(Entity* self) { self->flags = FLAG_UNK_08000000 | FLAG_HAS_PRIMS; self->ext.timer.t = 20; self->step++; - break; +REDACTED case 1: if (--self->ext.timer.t == 0) { DestroyEntity(self); return; } - +REDACTED prim = &g_PrimBuf[self->primIndex]; for (i = 0; prim != NULL; i++, prim = prim->next) { if (i < 8) { @@ -921,7 +921,7 @@ void func_80167A70(Entity* self) { prim->y3 = prim->y2 = posY + D_80155D64[arrIndex][5]; } } - break; +REDACTED } } @@ -939,7 +939,7 @@ void RicEntityCrashHydroStorm(Entity* self) { } else { primcount = 33 - ((self->params - 32) * 2); } - +REDACTED switch (self->step) { case 0: self->primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, primcount); @@ -992,9 +992,9 @@ void RicEntityCrashHydroStorm(Entity* self) { if ((self->params < 32) && !(self->params & 3)) { g_api.PlaySfx(0x708); } - self->step++; +REDACTED break; - +REDACTED case 1: line = (PrimLineG2*)&g_PrimBuf[self->primIndex]; while (line != NULL) { @@ -1027,7 +1027,7 @@ void RicEntityCrashHydroStorm(Entity* self) { } self->ext.subweapon.timer++; break; - +REDACTED case 2: DestroyEntity(self); break; @@ -1076,26 +1076,26 @@ s32 RicCheckHolyWaterCollision(s32 baseY, s32 baseX) { } return 0; } - -s32 func_8016840C(s16 x, s16 y) { +REDACTED +REDACTED Collider collider; - u16 temp; - +REDACTED +REDACTED if (g_CurrentEntity->velocityX != 0) { - g_api.CheckCollision(g_CurrentEntity->posX.i.hi + y, +REDACTED g_CurrentEntity->posY.i.hi + x, &collider, 0); if (g_CurrentEntity->velocityX > 0) { temp = collider.unk14; - } else { +REDACTED temp = collider.unk1C; - } +REDACTED if (!(collider.effects & EFFECT_UNK_0002)) { - return 0; - } - } else { - return 0; - } - g_CurrentEntity->posX.i.lo = 0; - g_CurrentEntity->posX.i.hi += temp; - return 2; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/ric/2C4C4.c b/src/ric/2C4C4.c index 5136348eac..b9b59e2e9b 100644 --- a/src/ric/2C4C4.c +++ b/src/ric/2C4C4.c @@ -313,12 +313,12 @@ void RicEntitySubwpnHolyWaterFlame(Entity* self) { // Entity 13. Made by blueprint 13. That's from subweapon 12. // That's the crash for subweapon 4. That's the cross. static u16 crash_cross_img_data[] = { - 0x94A5, 0x98C6, 0x9CE7, 0xA108, 0xA529, 0xA94A, 0xAD6B, 0xB18C, - 0xB5AD, 0xB9CE, 0xBDEF, 0xC210, 0xC631, 0xCA52, 0xCE73, 0xD294, - 0xD6B5, 0xDAD6, 0xDEF7, 0xE318, 0xE318, 0xE318, 0xE318, 0xE318, - 0xE318, 0xE318, 0xE318, 0xE318, 0xE318, 0xDEF7, 0xDAD6, 0xD6B5, - 0xD294, 0xCE73, 0xCA52, 0xC631, 0xC210, 0xBDEF, 0xB9CE, 0xB5AD, - 0xB18C, 0xAD6B, 0xA94A, 0xA529, 0xA108, 0x9CE7, 0x98C6, 0x94A5}; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static RECT crash_cross_img_vram = {0x0301, 0x01F8, 0x0030, 0x0001}; void RicEntitySubwpnCrashCross(Entity* self) { Primitive* prim; @@ -659,24 +659,24 @@ void RicEntitySubwpnCross(Entity* self) { self->ext.crossBoomerang.unk80 &= 0x3F; g_Player.D_80072F00[PL_T_3] = 2; } - -void func_80169C10(Entity* entity) { +REDACTED +REDACTED Primitive* prim; s16 primIndex; - s32 PosX = 8; - s32 PosY = 4; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); entity->primIndex = primIndex; if (primIndex != -1) { entity->flags = FLAG_UNK_08000000 | FLAG_HAS_PRIMS; entity->velocityY = FIX(0.5); - entity->posX.i.hi = - ((u16)entity->posX.i.hi - PosX) + (rand() & 0xF); - entity->posY.i.hi = - ((u16)entity->posY.i.hi - PosY) + (rand() & 0xF); +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[entity->primIndex]; prim->clut = 0x1B0; prim->tpage = 0x1A; @@ -686,22 +686,22 @@ void func_80169C10(Entity* entity) { prim->priority = prim->priority + 4; prim->drawMode = 0x31; func_8015FDB0(prim, entity->posX.i.hi, entity->posY.i.hi); - entity->step++; - } else { +REDACTED +REDACTED DestroyEntity(entity); - } - break; - - default: +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val += entity->velocityY; prim = &g_PrimBuf[entity->primIndex]; if (func_8015FDB0(prim, entity->posX.i.hi, entity->posY.i.hi) != 0) { DestroyEntity(entity); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // made by blueprint #5, see step 0 of RicEntitySubwpnCross static s16 D_80155E68[] = {9, 10, 11, 12}; void RicEntitySubwpnCrossTrail(Entity* self) { @@ -1503,23 +1503,23 @@ void RicEntitySubwpnDagger(Entity* self) { } static void ReboundStoneBounce1(s32 arg0) { - g_CurrentEntity->ext.generic.unk7C.s = - (arg0 << 0x10 >> 0xF) - g_CurrentEntity->ext.generic.unk7C.s; - if (g_CurrentEntity->ext.generic.unk80.modeS16.unk2 == 0) { - g_CurrentEntity->ext.generic.unk80.modeS16.unk0++; - g_CurrentEntity->ext.generic.unk80.modeS16.unk2++; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static void ReboundStoneBounce2(s16 arg0) { - if (g_CurrentEntity->ext.generic.unk80.modeS16.unk2 == 0) { - g_CurrentEntity->ext.generic.unk7C.s = - (arg0 * 2) - g_CurrentEntity->ext.generic.unk7C.s; - g_CurrentEntity->ext.generic.unk80.modeS16.unk0++; - g_CurrentEntity->ext.generic.unk80.modeS16.unk2++; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // RIC entity #42. Blueprint 50. Comes from subweapon 7. // Rebound stone! void RicEntitySubwpnReboundStone(Entity* self) { @@ -1575,7 +1575,7 @@ void RicEntitySubwpnReboundStone(Entity* self) { RicSetSubweaponParams(self); self->hitboxWidth = 4; self->hitboxHeight = 4; - g_api.CheckCollision(self->posX.i.hi, self->posY.i.hi, &collider, 0); +REDACTED if (collider.effects & EFFECT_SOLID) { self->ext.reboundStone.unk84 = 4; } @@ -1946,29 +1946,29 @@ void RicEntitySubwpnThrownVibhuti(Entity* self) { break; } } - +REDACTED s32 RicPrimDecreaseBrightness(Primitive* prim, u8 amount) { u8 isEnd; - s32 i; - s32 j; +REDACTED +REDACTED u8* pColor; - +REDACTED isEnd = 0; pColor = &prim->r0; for (i = 0; i < 4; i++, pColor += OFF(Primitive, r1) - OFF(Primitive, r0)) { - for (j = 0; j < 3; j++) { +REDACTED pColor[j] -= amount; - +REDACTED if (pColor[j] < 16) { pColor[j] = 16; - } else { +REDACTED isEnd |= 1; - } - } - } +REDACTED +REDACTED +REDACTED return isEnd; -} - +REDACTED +REDACTED // RIC Entity #44. Blueprint 51. Subweapon 9. Agunea (non-crash). DRA // blueprint 25. DRA entity 21. void RicEntitySubwpnAgunea(Entity* self) { @@ -2161,9 +2161,9 @@ void RicEntityAguneaHitEnemy(Entity* self) { prim->y2 = self->posX.i.hi; prim->r0 = prim->g0 = prim->b0 = 0xF0; i += 1; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->priority = self->zPriority; prim->drawMode = DRAW_HIDE; prim = prim->next; @@ -2184,9 +2184,9 @@ void RicEntityAguneaHitEnemy(Entity* self) { while (prim != NULL) { prim->clut = 0x194; prim->r0 = prim->g0 = prim->b0 = 0x80; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->priority = self->zPriority; prim->drawMode = DRAW_HIDE; prim = prim->next; @@ -2272,11 +2272,11 @@ void RicEntityAguneaHitEnemy(Entity* self) { while (prim != NULL) { prim->clut = 0x194; prim->r0 = prim->g0 = prim->b0 = 0x60; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - prim = prim->next; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->step_s = 0; self->step += 1; break; @@ -2293,10 +2293,10 @@ void RicEntityAguneaHitEnemy(Entity* self) { } if (var_s2 != 0) { prim = self->ext.prim; - while (prim != NULL) { +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } +REDACTED +REDACTED DestroyEntity(self); break; } @@ -2313,14 +2313,14 @@ static AnimationFrame D_80155EA8[] = { void RicEntityVibhutiCrashCloud(Entity* entity) { s16 primIndex; s32 newVelocity; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); entity->primIndex = primIndex; if (primIndex != -1) { entity->flags = FLAG_UNK_08000000 | FLAG_HAS_PRIMS; - entity->posX.val = +REDACTED entity->ext.vibCrashCloud.parent->ext.vibhutiCrash.unk84; entity->posY.val = entity->ext.vibCrashCloud.parent->ext.vibhutiCrash.unk88; @@ -2328,36 +2328,36 @@ void RicEntityVibhutiCrashCloud(Entity* entity) { entity->ext.vibCrashCloud.parent->ext.vibhutiCrash.unk8C; entity->ext.factory.unkB0 = PL_W_CRASH_VIBHUTI; RicSetSubweaponParams(entity); - entity->unk5A = 0x79; +REDACTED entity->animSet = ANIMSET_DRA(14); - entity->palette = 0x819E; +REDACTED entity->anim = D_80155EA8; entity->drawMode = 0x30; entity->drawFlags = FLAG_DRAW_UNK8; - entity->unk6C = 0x60; - entity->hitboxWidth = 8; - entity->hitboxHeight = 8; +REDACTED +REDACTED +REDACTED entity->flags |= FLAG_UNK_100000; newVelocity = (rand() % 512) + 0x300; entity->velocityX = rcos(newVelocity) * 32; entity->velocityY = -(rsin(newVelocity) * 32); - entity->step++; - } else { +REDACTED +REDACTED DestroyEntity(entity); - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (++entity->ext.vibCrashCloud.unk7C >= 39) { DestroyEntity(entity); - } else { +REDACTED entity->posX.val += entity->velocityX; entity->posY.val += entity->velocityY; - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static s32 crash_vibhuti_timer; void RicEntityCrashVibhuti(Entity* self) { FakePrim* prim; @@ -2452,15 +2452,15 @@ void RicEntityCrashVibhuti(Entity* self) { } void RicEntityCrashReboundStoneParticles(Entity* entity) { - switch (entity->step) { - case 0: +REDACTED +REDACTED entity->flags = FLAG_UNK_04000000; entity->ext.subweapon.subweaponId = PL_W_CRASH_REBOUND_STONE; RicSetSubweaponParams(entity); - entity->hitboxWidth = 4; - entity->hitboxHeight = 4; - entity->step++; - break; +REDACTED +REDACTED +REDACTED +REDACTED case 1: if (++entity->ext.subweapon.timer >= 4) { DestroyEntity(entity); diff --git a/src/ric/319C4.c b/src/ric/319C4.c index 742ff3011f..9050c67e2c 100644 --- a/src/ric/319C4.c +++ b/src/ric/319C4.c @@ -607,7 +607,7 @@ void RicEntityCrashBible(Entity* self) { prim = prim->next; } } - +REDACTED void func_8016F198(Entity* self) { Primitive* prim; s16 unk7C; @@ -723,7 +723,7 @@ void func_8016F198(Entity* self) { prim = prim->next; } } - +REDACTED // Entity ID #64, created by blueprint #72. This call is in // RicEntitySubwpnStopwatch. When Richter has the stopwatch weapon, and uses it // as a crash, it makes 4 floating stopwatches. When they are done they @@ -1064,29 +1064,29 @@ void RicEntityCrashStopwatchDoneSparkle(Entity* self) { } } -void func_80170548(Entity* entity) { - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED entity->flags = FLAG_UNK_04000000; - entity->ext.generic.unkB0 = 0x1E; +REDACTED RicSetSubweaponParams(entity); - entity->hitboxWidth = 8; - entity->hitboxHeight = 8; - entity->step++; - break; +REDACTED +REDACTED +REDACTED +REDACTED case 1: if (++entity->ext.timer.t >= 5) { DestroyEntity(entity); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED void func_801705EC(Entity* entity) { u16 temp; - switch (entity->step) { - case 0: +REDACTED +REDACTED entity->flags = FLAG_UNK_04000000; entity->ext.et_80161FF0.unk7E = 0; entity->step++; @@ -1153,7 +1153,7 @@ static void AguneaShuffleParams(s32 bufSize, s32* buf) { buf[idx] = swapTemp; } } - +REDACTED // Agunea item crash lightning, created by RicEntityAguneaCircle, blueprint 68 void RicEntityAguneaLightning(Entity* self) { u16 sp10[4]; @@ -1508,7 +1508,7 @@ void RicEntitySubwpnStopwatchCircle(Entity* self) { } return; } - +REDACTED static u32 D_801758D0; static Entity* D_801758D4[3]; // used by RicEntitySubwpnStopwatch, should never underflow @@ -1939,13 +1939,13 @@ void RicEntitySubwpnStopwatch(Entity* self) { } } } - +REDACTED void RicEntitySubpwnBibleTrail(Entity* entity) { Primitive* prim; s32 ret; - switch (entity->step) { - case 0: +REDACTED +REDACTED ret = g_api.AllocPrimitives(PRIM_GT4, 1); entity->primIndex = ret; if (entity->primIndex == -1) { diff --git a/src/ric/d_18568.c b/src/ric/d_18568.c index f33127c12d..be88836380 100644 --- a/src/ric/d_18568.c +++ b/src/ric/d_18568.c @@ -1,32 +1,32 @@ -#include "ric.h" - -s16 D_80154568[4] = {0, -8, -16, 0}; +REDACTED +REDACTED +REDACTED s32 g_IsPrologueStage = 0; -s16 D_80154574[] = {0x812F, 0x812F, 0x8120, 0x812F, 0x812F, 0x8120, - 0x812F, 0x812F, 0x8120, 0x812F, 0x812E, 0x812F, - 0x812E, 0x812F, 0x8120, 0x0000}; -s16 D_80154594[] = {0x8120, 0x812B, 0x812C, 0x812D}; -s32 D_8015459C = 0; -RECT D_801545A0 = {512, 256, 32, 80}; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 g_DeadPrologueTimer = 0; -s16 D_801545AA = 0; -s16 D_801545AC = 0; -u8 D_801545B0[] = {10, 8, 8, 6, 6, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 255, 255, 0, 0}; -u8 D_801545C4[] = {4, 4, 4, 4, 6, 6, 6, 6, 8, 8, 16, 16, 16, 16, 16, 16}; -u8 D_801545D4[] = {8, 12, 16, 20, 24, 28, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32}; -Point16 D_801545E4[] = {0, -16, 0, -16, 4, -16, -4, -16}; -Point16 D_801545F4[] = {0, 28, 0, 24, 4, 24, -4, 24}; -Point16 D_80154604[] = {7, 23, 7, 16, 7, 8, 7, 0, 7, -8, 7, -8, 7, -15, - -7, 23, -7, 16, -7, 8, -7, 0, -7, -8, -7, -8, -7, -15}; -u16 D_8015463C[] = {-16, -16, -16, -16}; -u16 D_80154644[] = {28, 24, 24, 24}; -u16 D_8015464C[] = {23, 16, 8, 0, -8, -8, -15, 0}; -u16 D_8015465C[] = {0, 0, 0, 0}; -u16 D_80154664[] = {23, 16, 8, 4, 4, 1, 1, 0}; -u8 D_80154674[][4] = {{16, 127, 63, 0}, - {16, 127, 0, 0}, - {16, 63, 63, 127}, - {16, 63, 127, 63}, - {16, 47, 63, 127}}; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/ric/e_giant_spinning_cross.c b/src/ric/e_giant_spinning_cross.c index ad7290d5e6..0cfcd7e98c 100644 --- a/src/ric/e_giant_spinning_cross.c +++ b/src/ric/e_giant_spinning_cross.c @@ -49,43 +49,43 @@ static SVECTOR D_80156064 = {-8, 0, 4, 0}; static SVECTOR D_8015606C = {8, 0, 4, 0}; static SVECTOR D_80156074 = {24, 0, 4, 0}; static SVECTOR* D_8015607C[][4] = { - &D_80155F14, &D_80155F1C, &D_80155F3C, &D_80155F34, &D_8015601C, - &D_80156024, &D_80155FD4, &D_8015603C, &D_8015602C, &D_80156034, - &D_80156044, &D_80155FDC, &D_8015604C, &D_80155FF4, &D_80156064, - &D_8015605C, &D_80155FFC, &D_80156054, &D_80156074, &D_8015606C, - &D_80155FD4, &D_80156024, &D_8015601C, &D_8015603C, &D_80156044, - &D_80156034, &D_8015602C, &D_80155FDC, &D_80156064, &D_80155FF4, - &D_8015604C, &D_8015605C, &D_80156074, &D_80156054, &D_80155FFC, - &D_8015606C, &D_80155FDC, &D_8015602C, &D_80156024, &D_80155FD4, - &D_80155FF4, &D_80155FD4, &D_8015603C, &D_8015604C, &D_80156054, - &D_80156044, &D_80155FDC, &D_80155FFC, &D_8015606C, &D_80155FFC, - &D_80155FF4, &D_80156064, &D_80155FFC, &D_80155FDC, &D_80155FD4, - &D_80155FF4, &D_80155F04, &D_80155FC4, &D_8015602C, &D_80155F6C, - &D_80155F6C, &D_8015602C, &D_80155FDC, &D_80155F1C, &D_80155F3C, - &D_80155FFC, &D_8015606C, &D_80155FAC, &D_80155FAC, &D_8015606C, - &D_80156014, &D_80155F54, &D_8015603C, &D_80155FD4, &D_80155F14, - &D_80155F7C, &D_80155FDC, &D_80156044, &D_80155F84, &D_80155F1C, - &D_8015602C, &D_80155FC4, &D_80155FBC, &D_80156024, &D_8015604C, - &D_8015603C, &D_80155FCC, &D_80155FEC, &D_80156004, &D_80155FE4, - &D_80156044, &D_80156054, &D_80156014, &D_8015606C, &D_80156064, - &D_8015600C, &D_80156024, &D_80155FBC, &D_80155EFC, &D_80155F64, - &D_80155FD4, &D_80156024, &D_80155F64, &D_80155F14, &D_80156064, - &D_80155FF4, &D_80155F34, &D_80155FA4, &D_8015600C, &D_80156064, - &D_80155FA4, &D_80155F4C, &D_80155F34, &D_80155FF4, &D_8015604C, - &D_80155F8C, &D_80155F94, &D_80156054, &D_80155FFC, &D_80155F3C, - &D_80155F34, &D_80155F3C, &D_80155FAC, &D_80155FA4, &D_80155FA4, - &D_80155FAC, &D_80155F54, &D_80155F4C, &D_80155EFC, &D_80155F04, - &D_80155F6C, &D_80155F64, &D_80155F64, &D_80155F6C, &D_80155F1C, - &D_80155F14, &D_80155F24, &D_80155FE4, &D_80156004, &D_80155F44, - &D_80155FBC, &D_80155FC4, &D_80155F04, &D_80155EFC, &D_80155FEC, - &D_80155FCC, &D_80155F0C, &D_80155F2C, &D_80155F54, &D_80156014, - &D_8015600C, &D_80155F4C, &D_80155FCC, &D_8015603C, &D_80155F7C, - &D_80155F0C, &D_80155F8C, &D_8015604C, &D_80155FEC, &D_80155F2C, - &D_80156044, &D_80155FE4, &D_80155F24, &D_80155F84, &D_80155F44, - &D_80156004, &D_80156054, &D_80155F94, &D_80155F7C, &D_80155F14, - &D_80155F34, &D_80155F8C, &D_80155F1C, &D_80155F84, &D_80155F94, - &D_80155F3C, &D_80155F0C, &D_80155F7C, &D_80155F8C, &D_80155F2C, - &D_80155F84, &D_80155F24, &D_80155F44, &D_80155F94}; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static u8 D_8015635C[][5] = { {0x38, 0x08, 0x10, 0x10, 0x0D}, {0x58, 0x08, 0x10, 0x10, 0x0E}, {0x58, 0x08, 0x10, 0x10, 0x1E}, {0x58, 0x08, 0x10, 0x10, 0x2E}, @@ -154,7 +154,7 @@ void RicEntityCrashCrossBeam(Entity* self) { self->ext.giantcross.unk7E = 0x400; g_api.PlaySfx(SFX_FIREBALL_SHOT_B); self->step++; - primUVCoords = &D_8015635C[0]; +REDACTED prim = &g_PrimBuf[self->primIndex]; for (i = 0; i < LEN(D_8015635C); i++, prim = prim->next, primUVCoords += 5) { diff --git a/src/ric/pl_anims.c b/src/ric/pl_anims.c index 3d00754b9b..d3a892a630 100644 --- a/src/ric/pl_anims.c +++ b/src/ric/pl_anims.c @@ -1,5 +1,5 @@ -#include "ric.h" - +REDACTED +REDACTED AnimationFrame* D_8015538C[] = {ric_anim_stand, ric_anim_stand}; AnimationFrame ric_anim_press_up[] = {{64, FRAME(38, 2)}, A_LOOP_AT(0)}; AnimationFrame ric_anim_stop_run[] = { @@ -67,41 +67,41 @@ AnimationFrame ric_anim_crouch[] = {{64, FRAME(18, 6)}, A_END}; AnimationFrame ric_anim_land_from_air_run[] = {{16, FRAME(152, 6)}, A_END}; AnimationFrame ric_anim_crouch_from_stand[] = { 0x0001, 0x0410, 0x0001, 0x0611, 0x0001, 0x0612, A_END}; -AnimationFrame D_801554E0[] = { +REDACTED 0x0001, 0x0612, 0x0001, 0x0611, 0x0001, 0x0410, A_END}; -AnimationFrame D_801554F0[] = { - 0x0008, 0x0813, 0x0003, 0x0415, 0x0005, 0x0416, 0x0003, +REDACTED +REDACTED 0x0415, 0x0006, 0x0417, 0x0050, 0x0418, A_END}; -AnimationFrame D_8015550C[] = { - 0x0008, 0x0814, 0x0003, 0x0415, 0x0005, 0x0416, 0x0003, +REDACTED +REDACTED 0x0415, 0x0006, 0x0417, 0x0050, 0x0418, A_END}; AnimationFrame D_80155528[] = {0x0006, 0x0417, 0x0050, 0x0418, A_END}; -AnimationFrame D_80155534[] = { +REDACTED 0x0002, 0x0813, 0x0006, 0x0417, 0x0050, 0x0418, A_END}; -AnimationFrame D_80155544[] = {0x0004, 0x0820, 0x0003, 0x0C21, 0x0002, 0x0C22, +REDACTED 0x0010, 0x0C22, 0x0001, 0x0C22, A_END}; -AnimationFrame D_8015555C[] = { +REDACTED 0x0004, 0x0820, 0x0003, 0x0C21, 0x0003, 0x0C22, 0x0003, 0x0C23, 0x0002, 0x0C24, 0x0001, 0x0A1C, 0x0001, 0x0A1B, 0x0020, 0x0425, 0x0012, 0x0819, 0x0030, 0x0418, A_END}; -AnimationFrame D_80155588[] = { - 0x0002, 0x0226, 0x0002, 0x0227, 0x0002, 0x0228, 0x0002, 0x0229, +REDACTED +REDACTED 0x0002, 0x022A, 0x0002, 0x022B, 0x0010, 0x022C, A_END}; -AnimationFrame D_801555A8[] = { - 0x0002, 0x062F, 0x0002, 0x0630, 0x0002, 0x0631, 0x0002, 0x0632, +REDACTED +REDACTED 0x0002, 0x0633, 0x0002, 0x0634, 0x0010, 0x0635, A_END}; -AnimationFrame D_801555C8[] = { - 0x0002, 0x0836, 0x0002, 0x0837, 0x0002, 0x0428, 0x0002, 0x0429, +REDACTED +REDACTED 0x0002, 0x042A, 0x0002, 0x042B, 0x0010, 0x042C, A_END}; -AnimationFrame D_801555E8[] = { - 0x0002, 0x0226, 0x0002, 0x0227, 0x0002, 0x0228, 0x0002, 0x0229, +REDACTED +REDACTED 0x0003, 0x022A, 0x0010, 0x022D, 0x0006, 0x022E, A_END}; AnimationFrame ric_anim_throw_daggers[] = { 0x0002, 0x0226, 0x0002, 0x0227, 0x0002, 0x0228, 0x0002, 0x0229, 0x0002, 0x022A, 0x0006, 0x022D, 0x0002, 0x022E, 0x0002, 0x0228, 0x0002, 0x0229, 0x0003, 0x022A, 0x0002, 0x022D, A_LOOP_AT(7)}; -AnimationFrame D_80155638[] = { - 0x0002, 0x0836, 0x0002, 0x0837, 0x0002, 0x0428, 0x0002, 0x0429, +REDACTED +REDACTED 0x0003, 0x042A, 0x0010, 0x042D, 0x0006, 0x042E, A_END}; AnimationFrame ric_ric_anim_stand_in_air[] = { {5, FRAME(19, 0)}, {1, FRAME(26, 0)}, {1, FRAME(25, 0)}, @@ -110,16 +110,16 @@ AnimationFrame ric_anim_run[] = { 0x0003, 0x1281, 0x0003, 0x1282, 0x0003, 0x1283, 0x0003, 0x1284, 0x0003, 0x1285, 0x0003, 0x1286, 0x0003, 0x127F, 0x0003, 0x1280, A_LOOP_AT(0)}; AnimationFrame ric_anim_stun[] = {{64, FRAME(32, 8)}, A_END}; -AnimationFrame D_8015569C[] = { - 0x0001, 0x02CE, 0x0001, 0x02CF, 0x0001, 0x02CE, 0x0003, - 0x02CF, 0x0003, 0x02CE, 0x0005, 0x02CF, 0x0001, 0x0226, +REDACTED +REDACTED +REDACTED 0x0001, 0x022E, 0x0020, 0x0202, A_END}; -AnimationFrame D_801556C4[] = { - 0x0001, 0x08B7, 0x0002, 0x08B8, 0x0001, 0x08B6, 0x0001, 0x08B7, - 0x0001, 0x08B9, 0x0001, 0x08B6, 0x0001, 0x08B7, 0x0001, 0x08BA, - 0x0001, 0x08B6, 0x0001, 0x08B7, 0x0001, 0x08BC, 0x0001, 0x08B7, +REDACTED +REDACTED +REDACTED +REDACTED 0x0001, 0x08BB, 0x0001, 0x08B7, 0x0020, 0x08B6, A_END}; -AnimationFrame D_80155704[] = { +REDACTED 0x0001, 0x06C8, 0x0001, 0x06C9, 0x0001, 0x06C8, 0x0002, 0x06C9, 0x0002, 0x06C8, 0x0003, 0x06C9, 0x0003, 0x06C8, 0x0005, 0x06C9, 0x0001, 0x062F, 0x0001, 0x0611, A_END}; @@ -127,7 +127,7 @@ AnimationFrame D_80155730[] = {0x0080, 0x02D0, A_END}; AnimationFrame D_80155738[] = {0x0080, 0x06D1, A_END}; AnimationFrame D_80155740[] = {0x0080, 0x08D2, A_END}; AnimationFrame D_80155748[] = {0x0080, 0x0011, A_END}; -AnimationFrame D_80155750[] = { +REDACTED 0x0002, 0x0218, 0x0002, 0x0487, 0x0002, 0x0488, 0x0001, 0x0642, 0x0008, 0x1489, 0x0010, 0x148A, 0x0008, 0x1489, 0x0002, 0x0642, 0x0002, 0x0641, 0x0002, 0x0611, A_END}; @@ -141,41 +141,41 @@ AnimationFrame ric_anim_point_finger_up[] = { 0x00A5, 0x000D, 0x00A4, 0x0002, 0x00A6, 0x0003, 0x00A7, 0x0002, 0x00A6, 0x0080, 0x00A6, 0x0002, 0x0026, A_END}; AnimationFrame ric_anim_blade_dash[] = { - 0x0001, 0x0008, 0x0001, 0x0038, 0x0001, 0x0092, 0x0001, 0x0093, 0x0001, - 0x0094, 0x0001, 0x0095, 0x0001, 0x0096, 0x0001, 0x0097, 0x0001, 0x0094, - 0x0001, 0x0095, 0x0001, 0x0096, 0x0001, 0x0097, 0x0001, 0x0093, 0x0001, - 0x0094, 0x0001, 0x0095, 0x0001, 0x0096, 0x0001, 0x0097, 0x0010, 0x0092, - 0x0002, 0x0037, 0x0001, 0x0090, 0x0002, 0x0091, 0x0003, 0x0090, 0x0004, +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED 0x0091, 0x000C, 0x0090, 0x0004, 0x0010, A_END}; AnimationFrame ric_anim_flame_whip[] = { - 0x0004, 0x02A2, 0x0001, 0x02A8, 0x0002, 0x02A9, 0x0018, 0x02A8, 0x0004, - 0x02AC, 0x0001, 0x02AA, 0x0002, 0x02AB, 0x0018, 0x02AA, 0x0008, 0x02AC, - 0x0005, 0x02AD, 0x0004, 0x02AC, 0x0003, 0x02AD, 0x0002, 0x02AE, 0x0002, - 0x02AD, 0x0001, 0x02AE, 0x0001, 0x02AF, 0x0001, 0x02AE, 0x000C, 0x02AF, - 0x0001, 0x02B0, 0x0002, 0x02B1, 0x0001, 0x02B2, 0x0001, 0x02B3, 0x0001, - 0x02B4, 0x0001, 0x02B5, 0x0001, 0x02B4, 0x0001, 0x02B3, 0x0001, 0x02B2, +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED 0x0030, 0x02B0, A_END}; -AnimationFrame D_801558B4[] = { - 0x0005, 0x0013, 0x0001, 0x001A, 0x0001, 0x0019, 0x0006, 0x007D, +REDACTED +REDACTED 0x0083, 0x007E, 0x0080, 0x007E, 0x0080, 0x0019, A_END}; AnimationFrame D_801558D4[] = {0x000C, 0x0019, A_END}; AnimationFrame D_801558DC[] = {0x0006, 0x001A, A_END}; -AnimationFrame D_801558E4[] = { +REDACTED 0x0002, 0x0237, 0x0001, 0x0290, 0x0002, 0x0291, 0x0003, 0x0290, 0x0004, 0x0291, 0x0005, 0x0291, 0x0005, 0x0290, 0x0005, 0x0291, 0x0005, 0x0291, 0x0005, 0x0290, 0x0005, 0x0291, 0x000C, 0x0290, 0x0010, 0x0226, A_END}; -AnimationFrame D_8015591C[] = { - 0x0002, 0x00A4, 0x0002, 0x00A5, 0x0001, 0x00A4, 0x0001, 0x00A5, 0x000D, - 0x00A4, 0x0002, 0x00A6, 0x0003, 0x00A7, 0x0002, 0x00A6, 0x0080, 0x00A6, +REDACTED +REDACTED +REDACTED 0x0080, 0x00A6, 0x0080, 0x00A6, 0x0080, 0x00A6, A_END}; -AnimationFrame D_80155950[] = { +REDACTED 0x0080, 0x00A6, 0x0080, 0x00A6, 0x0080, 0x00A6, 0x0002, 0x0026, A_END}; - -FrameProperty D_80155964[] = { - 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x14, 0x02, 0x05, 0x07, 0x0C, - 0x03, 0x0C, 0x08, 0x0C, 0x00, 0xFF, 0x06, 0x10, 0x00, 0x01, 0x08, 0x08, - 0x00, 0xFB, 0x07, 0x05, 0xC0, 0xA8, 0x00, 0x00, 0xFC, 0x00, 0x06, 0x11, - 0x00, 0x00, 0x09, 0x10, 0xFF, 0x11, 0x0C, 0x07, 0xF9, 0x0A, 0x08, 0x05, - 0xFE, 0x06, 0x08, 0x08, 0xFA, 0x06, 0x07, 0x11, 0x04, 0x06, 0x0A, 0x09, - 0xFD, 0x03, 0x09, 0x14, 0x00, 0x08, 0x08, 0x08, 0xFF, 0x0A, 0x0C, 0x07, -}; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/ric/pl_header.c b/src/ric/pl_header.c index 8a3f226b70..c7ae96d908 100644 --- a/src/ric/pl_header.c +++ b/src/ric/pl_header.c @@ -1,17 +1,17 @@ -#include "ric.h" - +REDACTED +REDACTED void RicMain(void); void RicInit(s16 arg0); void RicUpdatePlayerEntities(void); -void func_8015E7B4(Unkstruct_8010BF64* arg0); - +REDACTED +REDACTED PlayerOvl RIC_player = { RicMain, RicInit, RicUpdatePlayerEntities, func_8015E7B4, -}; - -s32* D_8013C010[4] = { - &D_8013C010[LEN(D_8013C010)], &D_8013C010[LEN(D_8013C010)], - &D_8013C010[LEN(D_8013C010)], &D_8013C010[LEN(D_8013C010)]}; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/saturn/alucard.c b/src/saturn/alucard.c index 9be0ab2591..ac01ad3bcc 100644 --- a/src/saturn/alucard.c +++ b/src/saturn/alucard.c @@ -7,8 +7,8 @@ INCLUDE_ASM("asm/saturn/alucard/f_nonmat", f60A50E0, func_060A50E0); // SAT: func_060A5558 void SetPlayerStep(PlayerSteps step) { - PLAYER.step = step; - PLAYER.step_s = 0; +REDACTED +REDACTED } INCLUDE_ASM("asm/saturn/alucard/f_nonmat", f60A5574, func_060A5574); diff --git a/src/saturn/game.c b/src/saturn/game.c index 58796a9e93..b81ba96a9c 100644 --- a/src/saturn/game.c +++ b/src/saturn/game.c @@ -374,10 +374,10 @@ void func_800FF0A0(s32 context) { D_80139828[context] = 0; } INCLUDE_ASM("asm/saturn/game/f_nonmat", f6070580, func_06070580); // SAT: func_060705A0 -void func_800FF0F4(s32 arg0) { D_80139828[arg0] = 0x1000; } +REDACTED // SAT: func_060705B8 -s32 func_800FF110(s32 arg0) { return D_80139828[arg0]; } +REDACTED // SAT: func_060705CC u16 func_800FF128(Entity* enemyEntity, Entity* attackerEntity) { @@ -692,8 +692,8 @@ void MoveEntity(Entity* entity) { } void func_06079BB4(s32* param_1) { - s32* temp = (s32*)*param_1; - +REDACTED +REDACTED if (temp != 0) { temp[0x14 / 4] = param_1[1]; temp[0x18 / 4] = param_1[2]; @@ -701,7 +701,7 @@ void func_06079BB4(s32* param_1) { } void func_06079BCC(s32* param_1) { - s32* temp = (s32*)*param_1; +REDACTED if (temp != 0) { param_1[1] = temp[0x14 / 4]; param_1[2] = temp[0x18 / 4]; @@ -722,55 +722,55 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A608, func_0607A608); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A88C, func_0607A88C); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607A994, func_0607A994); -// SAT func_0607A9F8 -// Original name: _hkyori_search +REDACTED +REDACTED // Absolute distance from the specified entity to the player in the X Axis s32 GetDistanceToPlayerX(Entity* self) { - s16 xDistance = self->posX.i.hi - PLAYER.posX.i.hi; - - if (xDistance < 0) { - xDistance = -xDistance; +REDACTED +REDACTED +REDACTED +REDACTED } - return xDistance; +REDACTED } -// SAT func_0607AA1C +REDACTED // Absolute distance from the specified entity to the player in the Y Axis s32 GetDistanceToPlayerY(Entity* self) { - s16 yDistance = self->posY.i.hi - PLAYER.posY.i.hi; - - if (yDistance < 0) { - yDistance = -yDistance; +REDACTED +REDACTED +REDACTED +REDACTED } - return yDistance; +REDACTED } INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AA40, func_0607AA40); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AA74, func_0607AA74); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AAA4, func_0607AAA4); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AACC, func_0607AACC); - -// SAT func_0607AAF4 -/* - * Returns the player's side position relative to g_CurrentEntity - * 0 = Player is on the right side - * 1 = Player is on the left side - * 2 = Player is above - */ +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 GetSideToPlayer(Entity* self) { - Entity* player = &PLAYER; - s16 side = 0; - - if (self->posX.val > player->posX.val) { - side = 1; - } - - if (self->posY.val > player->posY.val) { - side |= 2; - } - return side; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/game/f_nonmat", f607AB1C, func_0607AB1C); // _bicyousei_dir_0 @@ -806,9 +806,9 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607B104, func_0607B104); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607B134, func_0607B134); // SAT: func_0607B184 -Entity* AllocEntity(Entity* start, Entity* end) { - Entity* current = start; - +REDACTED +REDACTED +REDACTED while (current < end) { if (current->unk74 == 0) { // not entityId? DestroyEntity(current); @@ -822,16 +822,16 @@ Entity* AllocEntity(Entity* start, Entity* end) { INCLUDE_ASM("asm/saturn/game/f_nonmat", f607B1C8, func_0607B1C8); // SAT: func_0607B218 -void func_801C58A4(s32 step) { - g_CurrentEntity->step = step; - g_CurrentEntity->step_s = 0; +REDACTED +REDACTED +REDACTED g_CurrentEntity->animFrameIdx = 0; g_CurrentEntity->animFrameDuration = 0; } // SAT: func_0607B240 -void func_801C58C4(s32 step_s) { - g_CurrentEntity->step_s = step_s; +REDACTED +REDACTED g_CurrentEntity->animFrameIdx = 0; g_CurrentEntity->animFrameDuration = 0; } @@ -861,7 +861,7 @@ INCLUDE_ASM("asm/saturn/game/f_nonmat", f607B448, func_0607B448); INCLUDE_ASM("asm/saturn/game/f_nonmat", f607B4B8, func_0607B4B8); void func_0607B604(s32* param_1) { - s32* temp = (s32*)*param_1; +REDACTED temp[0x14 / 4] = param_1[1]; temp[0x18 / 4] = param_1[2]; } diff --git a/src/saturn/stage_02.c b/src/saturn/stage_02.c index 3c508b8055..dd7396dae5 100644 --- a/src/saturn/stage_02.c +++ b/src/saturn/stage_02.c @@ -11,7 +11,7 @@ INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DC040, func_060DC040); // SAT: func_060DC460 // bust with red eyes that can have a candle on it -void EntityRedEyeBust(Entity* self) { +REDACTED struct Unk0600B344* result; switch (self->step) { case 0: @@ -33,43 +33,43 @@ void EntityRedEyeBust(Entity* self) { } } -void func_060DC4EC(Entity* self) { - if (self->step == 0) { - DestroyEntity(self); - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DC510, func_060DC510); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DC7B4, func_060DC7B4); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DCA54, func_060DCA54); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DCCD4, func_060DCCD4); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DCFA4, func_060DCFA4); - -// EntityCannonLever +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DD20C, func_060DD20C); - -// EntityCannon +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DD3E8, func_060DD3E8); - -// EntityCannonShot +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DD690, func_060DD690); - -// EntityCannonWall +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DD790, func_060DD790); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DD8D8, func_060DD8D8); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DDB80, func_060DDB80); // SAT: func_060DDE40 // table with globe on it that can be broken -void EntityTableWithGlobe(Entity* self) { +REDACTED switch (self->step) { case 0: func_0607B264(self, 5); self->step++; - self->unk0 = func_0600B344( +REDACTED D_060ED26C.unk8, D_060ED26C.unk10, D_060ED26C.unk0, 7); - self->unk0->zPriority = 0x6A; +REDACTED self->hitboxWidth = 10; self->hitboxHeight = 12; self->hitboxOffX = 0; @@ -81,7 +81,7 @@ void EntityTableWithGlobe(Entity* self) { func_801C29B0(0x61D); self->hitboxState = 0; CreateEntityFromEntity(E_HEART_DROP, self, &self[1]); - self[1].params = D_80180F10[self->params]; +REDACTED SetStep(2); } break; @@ -95,33 +95,33 @@ void EntityTableWithGlobe(Entity* self) { INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DDF64, func_060DDF64); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DE178, func_060DE178); - -// SAT func_060DE2B0 +REDACTED +REDACTED void AxeKnightDeath(void) { - Entity* newEntity; - s8 temp_s4 = Random() & 3; - s16 temp_s3 = ((Random() & 0xF) << 8) - 0x800; - s32 i; - - for (i = 0; i < 6; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FIRE, g_CurrentEntity, newEntity); - newEntity->params = 2; - newEntity->unk85 = 6 - i; - newEntity->unk80 = temp_s3; - newEntity->unk84 = temp_s4; - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DE348, func_060DE348); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DE6CC, func_060DE6CC); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DE970, func_060DE970); - -// EntitySubWeaponContainer +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DEE20, func_060DEE20); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DF264, func_060DF264); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DF3B8, func_060DF3B8); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60DF52C, func_060DF52C); @@ -181,13 +181,13 @@ INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E4908, func_060E4908); s32 func_801BBC3C(Entity* e) { s16 diff; - diff = PLAYER.posX.i.hi - e->posX.i.hi; +REDACTED diff = ABS(diff); if (diff >= 23) { return 0; } else { - diff = PLAYER.posY.i.hi - e->posY.i.hi; +REDACTED diff = ABS(diff); if (diff > 32) { return 0; @@ -228,17 +228,17 @@ void func_060e8330(void) { arr_0605C140[0xF1] = 1; } -void func_060E8350(Entity* self) { - UnkStruct_060e8350* iVar1 = self->unk88; - s32 i; - - for (i = 0; i < 9; i++) { - iVar1->unk18 = 0; - iVar1->unk1E = 8; - iVar1 = iVar1->unk20; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E837C, func_060E837C); void func_060E87D0(s32, s32); @@ -267,11 +267,11 @@ INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E8E1C, func_060E8E1C); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E8EEC, func_060E8EEC); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E9058, func_060E9058); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E9220, func_060E9220); - -void func_060E9270(Entity* self) { - func_06079BB4(self); - func_0600B004(self->unk0, DAT_060f237c[self->unk52]); -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // dupe of func_060e97c4 void func_060E92A8(u16** param_1) { @@ -288,9 +288,9 @@ void func_060E92A8(u16** param_1) { const u16 pad_060e92d4 = 0xAAAA; const u16 pad_060e92d6 = 0xAAAB; -// EntityBloodSkeleton +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E92D8, func_060E92D8); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E9770, func_060E9770); // seems to saturn-only. param_1 is probably a struct? @@ -304,14 +304,14 @@ void func_060e97c4(u16** param_1) { } } -void func_060E97F0(Entity* self) { - func_06079BB4(self); - func_0600B004(self->unk0, DAT_060f2878[self->unk52]); -} - -// EntityBoneScimitar +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60E9828, func_060E9828); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EA058, func_060EA058); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EA1E0, func_060EA1E0); @@ -353,30 +353,30 @@ void EntityAxeKnightRotateAxe(Entity* self) { INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EACC0, func_060EACC0); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EAF2C, func_060EAF2C); - -// EntityBloodyZombie +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EAFAC, func_060EAFAC); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EB5C4, func_060EB5C4); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EB6E4, func_060EB6E4); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EB8D0, func_060EB8D0); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EB950, func_060EB950); - -// EntitySkeleton +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EB9EC, func_060EB9EC); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EBEB0, func_060EBEB0); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EC030, func_060EC030); INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EC1F0, func_060EC1F0); - -void func_060EC240(Entity* self) { - func_06079BB4(self); - func_0600B004(self->unk0, DAT_060f4e6c[self->unk52]); -} - -// EntitySpittleBone +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EC278, func_060EC278); - +REDACTED INCLUDE_ASM("asm/saturn/stage_02/f_nonmat", f60EC730, func_060EC730); INCLUDE_ASM("asm/saturn/stage_02/data", d60ECA94, d_060ECA94); INCLUDE_ASM("asm/saturn/stage_02/data", d60ECC50, d_060ECC50); diff --git a/src/saturn/t_bat.c b/src/saturn/t_bat.c index c2f018b28e..184a1eafbe 100644 --- a/src/saturn/t_bat.c +++ b/src/saturn/t_bat.c @@ -32,7 +32,7 @@ void DestroyEntity(Entity*); // func_0600FFB8h // PSX: func_80173C2C // SAT: func_060D1040 void func_80173C2C(Entity* entity) { - if (entity->params == 0xF) { +REDACTED D_80174D3C = 1; } func_0600FFB8(entity); // DestroyEntity @@ -63,9 +63,9 @@ INCLUDE_ASM("asm/saturn/t_bat/f_nonmat", f60D11DC, func_060D11DC); // PSX: func_80173F30 // SAT: func_060D1224 s32 func_80173F30(Entity* entity, s16 x, s16 y) { - s16 diffx = x - entity->posX.i.hi; +REDACTED // not the same implementation as ratan2 - return func_0600EE88(-(s16)(y - entity->posY.i.hi), diffx) & +REDACTED 0xFFF; // was entity->posY.i.hi } diff --git a/src/servant/tt_000/10E8.c b/src/servant/tt_000/10E8.c index 7c53b4c552..cd1458fa85 100644 --- a/src/servant/tt_000/10E8.c +++ b/src/servant/tt_000/10E8.c @@ -285,7 +285,7 @@ void func_8017160C(s32 amount, s32 entityId) { entity->animSet = ANIMSET_OVL(20); entity->zPriority = g_Entities[0].zPriority - 2; entity->facingLeft = (g_Entities[0].facingLeft + 1) & 1; - entity->params = i + 1; +REDACTED } entity->ext.bat.cameraX = g_Tilemap.scrollX.i.hi; entity->ext.bat.cameraY = g_Tilemap.scrollY.i.hi; @@ -471,12 +471,12 @@ void ProcessEvent(Entity* self, bool resetEvent); extern u16 D_80170448[48]; void func_80171ED4(s32 arg0) { - u16* dst; - u16* src; +REDACTED +REDACTED RECT rect; s32 i; s32 x; - SpriteParts** spriteBanks; +REDACTED Entity* e; #ifdef VERSION_PC @@ -486,43 +486,43 @@ void func_80171ED4(s32 arg0) { const int len = 256; #endif - if ((arg0 == 1) || (arg0 == 3)) { +REDACTED ProcessEvent(NULL, true); - if (arg0 == 3) { - return; - } - } +REDACTED +REDACTED +REDACTED +REDACTED - dst = &g_Clut[0x1400]; +REDACTED src = D_80170448; - +REDACTED for (i = 0; i < len; i++) { *dst++ = *src++; } - dst = &g_Clut[0x1430]; - src = D_80170720; - - for (i = 0; i < 32; i++) { +REDACTED +REDACTED +REDACTED +REDACTED *dst++ = *src++; } - rect.x = 0; +REDACTED rect.w = 0x100; rect.h = 1; rect.y = 0xF4; - dst = &g_Clut[0x1400]; - LoadImage(&rect, (u_long*)dst); - - spriteBanks = g_api.o.spriteBanks; - spriteBanks += 20; - *spriteBanks = (SpriteParts*)D_80170040; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED e = &g_Entities[4]; - +REDACTED DestroyEntity(e); - +REDACTED e->unk5A = 0x6C; e->palette = 0x140; e->animSet = ANIMSET_OVL(20); @@ -530,8 +530,8 @@ void func_80171ED4(s32 arg0) { e->facingLeft = (PLAYER.facingLeft + 1) & 1; e->posX.val = PLAYER.posX.val; e->posY.val = PLAYER.posY.val; - e->params = 0; - +REDACTED +REDACTED if (arg0 == 1) { e->entityId = 0xD1; e->posX.val = 0x800000; @@ -539,17 +539,17 @@ void func_80171ED4(s32 arg0) { } else { e->entityId = 0xD1; if (D_8003C708.flags & 0x20) { - e->posX.val = func_80174864() ? 0xC00000 : 0x400000; +REDACTED e->posY.val = 0xA00000; } else { - e->posX.val = - (PLAYER.facingLeft ? +0x120000 : -0x120000) + PLAYER.posX.val; +REDACTED +REDACTED e->posY.val = PLAYER.posY.val - 0x220000; } } e->ext.bat.cameraX = g_Tilemap.scrollX.i.hi; e->ext.bat.cameraY = g_Tilemap.scrollY.i.hi; - D_80174D3C = 0; +REDACTED } s16 func_80173F74(s16 x1, s16 x2, s16 minDistance); @@ -1060,10 +1060,10 @@ void func_80173C1C(void) {} void func_80173C24(void) {} void func_80173C2C(Entity* entity) { - switch (entity->params) { - case 15: +REDACTED +REDACTED D_80174D3C = 1; - break; +REDACTED } DestroyEntity(entity); } @@ -1136,8 +1136,8 @@ s32 func_80173E78(s32 arg0, s32 arg1) { Entity* func_80173EB0(s32 rangeIndex, s32 entityId) { volatile u32 pad; // fake? - s16 start = D_80171094[rangeIndex].start; - s16 end = D_80171094[rangeIndex].end; +REDACTED +REDACTED Entity* entity = &g_Entities[start]; s32 i; @@ -1147,7 +1147,7 @@ Entity* func_80173EB0(s32 rangeIndex, s32 entityId) { } } - return NULL; +REDACTED } #endif @@ -1214,7 +1214,7 @@ void func_80174038(Entity* entity) { } break; case 2: - g_api.PlaySfx(entity->params); +REDACTED entity->step++; break; diff --git a/src/st/cen/1B274.c b/src/st/cen/1B274.c index 547edc2ecb..57e5d3f194 100644 --- a/src/st/cen/1B274.c +++ b/src/st/cen/1B274.c @@ -18,7 +18,7 @@ void EntityUnkId08(Entity* entity) { if (objInit->unkC != 0) { entity->flags = objInit->unkC; } - if (entity->params >= 5) { +REDACTED entity->rotZ = 0x800; entity->drawFlags = (u8)(entity->drawFlags | FLAG_DRAW_ROTZ); } diff --git a/src/st/cen/D600.c b/src/st/cen/D600.c index c776d2108e..5156e1d815 100644 --- a/src/st/cen/D600.c +++ b/src/st/cen/D600.c @@ -1,10 +1,10 @@ -/* - * File: D600.c - * Overlay: CEN - * Description: Center Cube Area (Final Boss) - */ - -#include "cen.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "game.h" #include "sfx.h" @@ -25,7 +25,7 @@ void EntityBackgroundBlock(Entity* self) { self->flags = obj->unkC; } - if (self->params == 1) { +REDACTED self->rotY = 0x200; self->rotX = 0x200; } @@ -39,180 +39,180 @@ extern u8 g_EntityUnkId12Data[]; extern u8 g_EntityUnkId12Hitbox[]; #include "../entity_unk_id12.h" - -void EntityUnkId01(Entity* self) { - Entity* newEntity; - u16* ptr; - s32 j; - s32 i; - u16 params = self->params >> 0xC; - - if (self->step == 0) { - InitializeEntity(D_80180404); - self->zPriority = 0xB0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawMode = D_801805B4[params]; - newEntity = &self[1]; - self->hitboxHeight = D_80180594[params]; - self->animSet = D_801805A4[params]; - DestroyEntity(newEntity); - CreateEntityFromEntity(E_BACKGROUND_BLOCK, self, newEntity); - if (params != 0) { - self[1].posY.i.hi -= 32; - } else { - self[1].posY.i.hi -= 16; - } - newEntity->params = 1; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80180574[params], self); - - if (self->unk44 != 0) { +REDACTED +REDACTED g_api.PlaySfx(SFX_CANDLE_HIT); newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { - CreateEntityFromCurrentEntity(E_EXPLOSION, newEntity); - newEntity->params = D_8018059C[params] | 0x10; - } - - for (ptr = &D_801805BC, i = 0; i < 4; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { - CreateEntityFromEntity(0x80, self, newEntity); - newEntity->posX.i.hi += *ptr; - ptr++; - newEntity->posY.i.hi = newEntity->posY.i.hi + *ptr; - ptr++; - if (params != 0) { - newEntity->posY.i.hi -= 20; - } - newEntity->params = i; - } - } - - if (params != 0) { - for (j = 0; j < 3; j++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { - CreateEntityFromEntity(0x80, self, newEntity); - newEntity->posX.i.hi += *ptr; - ptr++; - newEntity->posY.i.hi += *ptr; - ptr++; - newEntity->params = j + 4; - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED ReplaceBreakableWithItemDrop(self); - DestroyEntity(&self[1]); - } -} - -void func_8018DB18(Entity* self) { - Entity* newEntity; - Collider collider; - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - s32 facing; - s16 temp; - s32 temp2; - s32 temp3; - - switch (self->step) { - case 0: - InitializeEntity(D_80180404); - self->zPriority = 0xB0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; - self->animCurFrame = self->params + 28; +REDACTED facing = GetSideToPlayer() & 1; - - temp = (Random() & 30) + 8; - self->ext.generic.unk80.modeS16.unk0 = temp; +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - self->ext.generic.unk80.modeS16.unk0 = -temp; - } - - if (self->params >= 4) { - self->ext.generic.unk80.modeS16.unk0 = - -self->ext.generic.unk80.modeS16.unk0; - } - - if (facing == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = FIX(-1); - } else { +REDACTED self->velocityX = FIX(1); - } - - temp3 = 0x8000; - temp2 = Random() << 8; +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = self->velocityX + temp3 - temp2; self->velocityY = FIX(-3); self->velocityY = (self->params >> 1) * 0x6000 - 0x30000; - if (self->params == 6) { +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step = 2; - } - - self->primIndex = 0; - if (self->params == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex != -1) { - prim = &g_PrimBuf[primIndex]; +REDACTED self->primIndex = primIndex; self->flags |= FLAG_HAS_PRIMS; UnkPolyFunc2(prim); - prim->tpage = 0x1A; - prim->clut = 0x159; - prim->u0 = prim->u2 = 0x40; - prim->u1 = prim->u3 = 0x60; - prim->v0 = prim->v1 = 0; - prim->v2 = prim->v3 = 0x20; - prim->next->x1 = self->posX.i.hi + 4; - prim->next->y0 = self->posY.i.hi - 8; - facing = LOH(prim->next->r2) = 32; - LOH(prim->next->b2) = facing; - prim->next->b3 = 16; - prim->priority = 0xB2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x37; - } - } - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ += self->ext.generic.unk80.modeS16.unk0; self->velocityY += FIX(0.25); g_api.CheckCollision( self->posX.i.hi, self->posY.i.hi + 6, &collider, 0); - if (collider.effects & 1) { - self->posY.i.hi += collider.unk18; +REDACTED +REDACTED self->velocityY = -self->velocityY / 2; self->velocityX -= self->velocityX / 3; if (self->velocityY > FIX(-0.625)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { +REDACTED CreateEntityFromEntity( E_INTENSE_EXPLOSION, self, newEntity); - newEntity->params = 16; - } - DestroyEntity(self); - break; - } - } - - if (self->primIndex != 0) { - prim = &g_PrimBuf[self->primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - LOH(prim->next->r2) = LOH(prim->next->b2) += 4; - if (LOH(prim->next->r2) > 64) { - prim->next->b3 += 252; - if (prim->next->b3 == 0) { - g_api.FreePrimitives(self->primIndex); - self->primIndex = 0; - self->flags &= ~FLAG_HAS_PRIMS; - } - } - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/cen/F890.c b/src/st/cen/F890.c index b7324173ee..aa246c643a 100644 --- a/src/st/cen/F890.c +++ b/src/st/cen/F890.c @@ -38,7 +38,7 @@ static u8 D_80180780[] = { void func_8018F890(s16 arg0) { s16 temp_v0 = arg0 - g_Tilemap.height; - if (temp_v0 > 1) { +REDACTED g_Tilemap.height++; } else if (temp_v0 < -1) { g_Tilemap.height--; @@ -46,7 +46,7 @@ void func_8018F890(s16 arg0) { g_Tilemap.height = arg0; } } - +REDACTED void func_8018F8EC(u16 index) { Tilemap* tilemap = &g_Tilemap; u16 tilePos = 0x5B6; @@ -63,56 +63,56 @@ void func_8018F8EC(u16 index) { tilePos += 0x2C; } } - -// platform that lifts you into chamber, starts cutscene, gives you holy glasses -void EntityPlatform(Entity* self) { +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - Entity* player = &PLAYER; - Primitive* prim; +REDACTED +REDACTED s16 primIndex; - s16 temp_a0; - s16 temp_s1; - s16 temp_v0; - s16 temp_v1_4; - u16 temp_a1; - - self->posY.i.hi -= 8; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a1 = GetPlayerCollisionWith(self, 0x20, 0x11, 4); temp_s1 = player->posX.i.hi + g_Tilemap.scrollX.i.hi; temp_v0 = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { InitializeEntity(g_EInitGeneric); self->animSet = ANIMSET_OVL(2); - self->animCurFrame = 9; - self->zPriority = 0x80; - +REDACTED +REDACTED +REDACTED if (g_CastleFlags[216] != 0) { - self->step = 9; - } - - func_8018F8EC(0); +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->flags |= FLAG_HAS_PRIMS; - prim->tpage = 0xF; - prim->clut = 2; - prim->u0 = prim->u2 = 0xA0; - prim->u1 = prim->u3 = 0xB0; - prim->v0 = prim->v1 = 0xA1; - prim->v2 = prim->v3 = 0xA7; - prim->priority = 0x7F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if ((GetDistanceToPlayerX() < 32) && - ((self->posY.i.hi - player->posY.i.hi) < 80)) { - D_8003C8B8 = 0; +REDACTED +REDACTED g_unkGraphicsStruct.unk0 = 1; if (g_Player.unk0C & PLAYER_STATUS_BAT_FORM) { g_Player.padSim = PAD_R1; @@ -120,20 +120,20 @@ void EntityPlatform(Entity* self) { g_Player.padSim = PAD_L1; } else if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) { g_Player.padSim = PAD_R2; - } else if (temp_s1 > 384) { +REDACTED g_Player.padSim = PAD_LEFT; - } else if (temp_s1 < 384) { +REDACTED g_Player.padSim = PAD_RIGHT; - } else { +REDACTED g_Player.padSim = 0; - } - g_Entities[1].ext.generic.unk7C.S8.unk0 = 0; - g_Player.D_80072EFC = 1; - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; if (g_Player.unk0C & PLAYER_STATUS_TRANSFORM) { if (g_Timer & 1) { @@ -143,212 +143,212 @@ void EntityPlatform(Entity* self) { g_Player.padSim = PAD_L1; } else if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) { g_Player.padSim = PAD_R2; - } - } - } else { - if ((temp_a1 != 0) || (g_Player.pl_vram_flag & 1)) { - if (temp_s1 > 384) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = PAD_LEFT; - } else if (temp_s1 < 384) { +REDACTED g_Player.padSim = PAD_RIGHT; - } - self->step++; - } - } - g_Player.D_80072EFC = 1; - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Player.padSim == 0x8000) { - if (temp_s1 <= 384) { +REDACTED g_Player.padSim = 0; - } +REDACTED } else if ((g_Player.padSim == 0x2000) && (temp_s1 >= 384)) { g_Player.padSim = 0; - } +REDACTED if (g_Player.padSim == 0) { g_Player.padSim = PAD_LEFT; player->posX.i.hi = 384 - tilemap->scrollX.i.hi; - self->step++; +REDACTED g_api.PlaySfx(SFX_METAL_CLANG_A); - D_8019D424 |= 1; +REDACTED tilemap->height = ((s16)tilemap->scrollY.i.hi + 0x100); - func_8018F8EC(0); - } - g_Player.D_80072EFC = 1; - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - g_Player.D_80072EFC = 1; +REDACTED player->posX.i.hi = 384 - tilemap->scrollX.i.hi; - if (temp_v0 > 496) { - self->posY.i.hi--; - player->posY.i.hi--; +REDACTED +REDACTED +REDACTED D_80097488.y.i.hi--; - } else { +REDACTED g_api.PlaySfx(SFX_DOOR_CLOSE_A); if (player->facingLeft == 0) { g_Player.padSim = PAD_LEFT; - } - D_8019D424 |= 4; - self->step++; - } - func_8018F890(0x200); - break; - - case 5: - func_8018F890(0x200); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - g_Player.D_80072EFC = 1; - - if (D_8019D424 & 8) { - CreateEntityFromCurrentEntity(E_EQUIP_ITEM_DROP, &g_Entities[204]); - g_Entities[204].params = NUM_HAND_ITEMS + ITEM_HOLY_GLASSES; - g_Entities[204].step = 5; - g_Entities[204].flags = 0; - self->step++; - } - break; - - case 6: - if (D_8019D424 & 2) { - self->step++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_METAL_CLANG_A); - } +REDACTED g_Player.padSim = 0; - g_Player.D_80072EFC = 1; - break; - - case 7: - if (temp_v0 < 592) { - self->posY.i.hi++; - player->posY.i.hi++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED D_80097488.x.i.hi++; - } else { - D_8003C8B8 = 1; +REDACTED +REDACTED if (g_unkGraphicsStruct.unk0 != 0) { g_unkGraphicsStruct.unk0 = 0; - } - g_Entities[1].ext.generic.unk7C.S8.unk0 = 1; - self->step++; +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_DOOR_CLOSE_A); - } - func_8018F890(0x300); +REDACTED +REDACTED g_Player.padSim = 0; - g_Player.D_80072EFC = 1; - break; - - case 8: - func_8018F890(0x300); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (tilemap->height == 0x300) { - self->step++; - } - break; - - case 9: - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[self->primIndex]; - temp_a0 = self->posX.i.hi - 8; - temp_v1_4 = self->posX.i.hi + 8; - self->posY.i.hi += 8; - prim->x0 = prim->x2 = temp_a0; - prim->x1 = prim->x3 = temp_v1_4; - prim->y0 = prim->y1 = self->posY.i.hi + 15; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->y2 = prim->y3 = 0x268 - tilemap->scrollY.i.hi; -} - +REDACTED +REDACTED // Black layer that covers room interior and lights up when cutscene starts -void EntityRoomDarkness(Entity* self) { - Primitive* prim; +REDACTED +REDACTED s16 primIndex; - s16 temp_a1; - s16 temp_a2; - s16 temp_a3; - s16 temp_t0; - s16 temp_a0; - s16 temp_v0; - s16 temp_v1; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED /* Has player seen Maria Holy Glasses Cutscene? */ if (g_CastleFlags[216] != 0) { - DestroyEntity(self); - return; - } - - primIndex = g_api.AllocPrimitives(PRIM_G4, 2); - if (primIndex != -1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->animSet = 0; - temp_a2 = self->posX.i.hi - 112; - temp_a3 = self->posX.i.hi + 112; - temp_t0 = self->posX.i.hi - 32; - temp_a0 = self->posX.i.hi + 32; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_HAS_PRIMS; temp_v1 = 0x178 - g_Tilemap.scrollY.i.hi; - temp_v0 = temp_v1 - 0x58; - temp_a1 = temp_v1 + 0x68; - self->posY.i.hi = temp_v1; - prim->y0 = prim->y1 = temp_v0; - prim->x0 = prim->x2 = temp_a2; - prim->x1 = prim->x3 = temp_a3; - prim->y2 = prim->y3 = temp_a1; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = - prim->b3 = 255; - prim->priority = 0x88; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x57; - prim = prim->next; - prim->x0 = prim->x2 = temp_t0; - prim->x1 = prim->x3 = temp_a0; - prim->y0 = prim->y1 = temp_a1; - prim->y2 = prim->y3 = temp_v1 + 0x88; - prim->r0 = prim->r1 = prim->g0 = prim->g1 = prim->b0 = prim->b1 = - 255; - prim->r2 = prim->r3 = prim->g2 = prim->g3 = prim->b2 = prim->b3 = 0; - prim->priority = 0x88; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x57; - } - break; - - case 1: - if (D_8019D424 & 4) { - prim = &g_PrimBuf[self->primIndex]; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = - prim->b3 -= 1; - prim = prim->next; - prim->r1 = prim->g0 = prim->g1 = prim->b0 = prim->b1 = prim->r0 = - prim->b1 - 1; - if (prim->r0 == 0) { - self->step++; - } - } - break; - - case 2: - prim = &g_PrimBuf[self->primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; +REDACTED prim->drawMode = DRAW_HIDE; - self->step++; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityMaria(Entity* self) { if (self->step == 0) { /* Has player seen Maria Holy Glasses Cutscene? */ if (g_CastleFlags[216] != 0) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180428); self->flags = FLAG_UNK_08000000; self->animSet = ANIMSET_OVL(1); @@ -358,33 +358,33 @@ void EntityMaria(Entity* self) { self->zPriority = 0x80; } } - -s16 func_8019040C(Primitive* prim, s16 arg1) { - s16 ret = arg1; - s16 temp_v0; - - prim->x2 = arg1; - prim->x0 = arg1; - ret += 0x20; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim->v0 = prim->v1 = 0x50; - prim->v2 = prim->v3 = 0x60; - prim->y0 = prim->y1 = 0x2C; - prim->y2 = prim->y3 = 0x3C; - prim->u0 = prim->u2 = 2; - - if (ret > 0xB0) { - temp_v0 = 0xB2 - arg1; - prim->u1 = prim->u3 = temp_v0; - ret = 0; - prim->x1 = prim->x3 = 0xB0; - } else { - prim->u1 = prim->u3 = 0x22; - prim->x1 = prim->x3 = ret; - } - return ret; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 func_801904B8(Primitive* prim, s16 arg1) { prim->u0 = prim->u2 = 0x50; prim->u1 = prim->u3 = 0x60; @@ -398,116 +398,116 @@ s16 func_801904B8(Primitive* prim, s16 arg1) { prim->y0 = prim->y1 = arg1; return arg1; } - +REDACTED // Elevator when not moving (ID 1A) -void EntityElevatorStationary(Entity* self) { - Entity* player = &PLAYER; - Primitive* prim; +REDACTED +REDACTED +REDACTED s16 primIndex; - s16 posX, posY; - s16 temp; - - switch (self->step) { - case 0: - InitializeEntity(D_8018047C); - self->animCurFrame = 3; - self->zPriority = player->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_ID_1B, &self[-1]); - self[-1].params = 1; +REDACTED CreateEntityFromCurrentEntity(E_ID_1B, &self[-2]); - self[-2].params = 2; - primIndex = g_api.AllocPrimitives(PRIM_GT4, 12); - if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.prim = prim; - self->flags |= FLAG_HAS_PRIMS; - prim->tpage = 0x12; - prim->clut = 0x223; - temp = prim->v1 = prim->u0 = prim->u2 = 0x28; - prim->v2 = prim->v3 = prim->u1 = prim->u3 = 0x38; - prim->v0 = temp; - prim->priority = 0x6B; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - - while (prim != NULL) { - prim->tpage = 0x12; - prim->clut = 0x223; - prim->priority = 0x6A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - +REDACTED +REDACTED +REDACTED if ((s16)(player->posY.i.hi + g_Tilemap.scrollY.i.hi) < 80) { - self->posY.i.hi = player->posY.i.hi; - player->posX.i.hi = self->posX.i.hi; - self->animCurFrame = 10; - g_Entities[1].ext.stub[0x00] = 1; - SetStep(3); - } - break; - - case 1: - if (*(u8*)&self[-1].ext.stub[0x4]) { - posX = self->posX.i.hi - player->posX.i.hi; - if (g_pads[0].pressed & PAD_UP) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (abs(posX) < 8) { - g_Entities[1].ext.stub[0x00] = 1; - g_Player.D_80072EFC = 2; +REDACTED +REDACTED g_Player.padSim = 0; PLAYER.velocityX = 0; PLAYER.velocityY = 0; - self->step = 2; - } - } - } - break; - - case 3: - g_Player.D_80072EFC = 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - switch (self->step_s) { - case 0: +REDACTED +REDACTED self->posY.val += FIX(0.5); - player->posY.i.hi++; +REDACTED posY = g_Tilemap.scrollY.i.hi + self->posY.i.hi; if ((g_Timer % 16) == 0) { PlaySfxPositional(SFX_METAL_CLANG_A); - } - if (posY == 0x74) { - self->step_s++; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80180780, self) == 0) { - self->animFrameIdx = 0; - self->animFrameDuration = 0; - g_Entities[1].ext.stub[0x00] = 0; - self->step_s = 0; - self->step = 1; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { g_api.PlaySfx(SFX_LEVER_METAL_BANG); - } - } - break; - - case 2: - g_Player.D_80072EFC = self->step; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80180768, self) == 0) { - self->animFrameIdx = 0; - self->animFrameDuration = 0; - self->step_s++; - } +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { g_api.PlaySfx(SFX_LEVER_METAL_BANG); } @@ -522,166 +522,166 @@ void EntityElevatorStationary(Entity* self) { case 2: if (AnimateEntity(D_80180780, self) == 0) { - self->animFrameIdx = 0; - self->animFrameDuration = 0; - g_Entities[1].ext.stub[0x00] = 0; - self->step_s = 0; - self->step = 1; - } - break; - } - } - prim = self->ext.prim; - prim->x0 = prim->x2 = self->posX.i.hi - 8; - prim->x1 = prim->x3 = self->posX.i.hi + 8; - temp = self->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim->y2 = prim->y3 = temp - 0x1F; - prim->y0 = prim->y1 = temp - 0x2F; - prim = prim->next; - - posY = self->posY.i.hi - 40; - while (prim != NULL) { - posY = func_801904B8(prim, posY); - prim = prim->next; - if (posY <= 0) { - break; - } - } - - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - +REDACTED +REDACTED +REDACTED if (abs(self->posY.i.hi) > 384) { - DestroyEntity(self); - } -} - -void EntityUnkId1B(Entity* self) { - Entity* entity = &self[self->params]; - s32 step = self->step; - - switch (self->step) { - case 0: - InitializeEntity(D_8018047C); - if (self->params & 16) { - self->animCurFrame = self->params & 15; - self->zPriority = 0x6A; - self->step = 2; - return; - } - self->animCurFrame = 0; - break; - - case 1: - self->posX.i.hi = entity->posX.i.hi; - if (self->params == step) { - self->posY.i.hi = entity->posY.i.hi + 35; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.generic.unk80.modeS8.unk0 = GetPlayerCollisionWith(self, 12, 8, 4); - } else { - self->posY.i.hi = entity->posY.i.hi - 24; +REDACTED +REDACTED self->ext.generic.unk80.modeS8.unk0 = GetPlayerCollisionWith(self, 12, 8, 6); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Elevator when moving, fixes player into position (ID 1C) -void EntityMovingElevator(Entity* self) { - Entity* player = &PLAYER; - Primitive* prim; +REDACTED +REDACTED +REDACTED s16 primIndex; - s32 step; - s16 posY; - s16 temp; - - switch (self->step) { - case 0: - InitializeEntity(D_8018047C); - self->animCurFrame = 3; - self->zPriority = player->zPriority + 2; - primIndex = g_api.AllocPrimitives(PRIM_GT4, 12); - if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.prim = prim; - self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0x12; - prim->u0 = prim->u2 = 0x50; - prim->u1 = prim->u3 = 0x60; - prim->v0 = prim->v1 = 6; - prim->v2 = prim->v3 = 0x26; - prim->clut = 0x223; - prim->priority = 0x6A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - - if (player->posY.i.hi > 192) { - step = 2; - self->posY.i.hi = player->posY.i.hi; - player->posX.i.hi = self->posX.i.hi; - } else { - step = 3; - self->posY.i.hi = player->posY.i.hi; - player->posX.i.hi = self->posX.i.hi; - } - - self->animCurFrame = 10; - g_Entities[1].ext.stub[0x00] = 1; - SetStep(step); - break; - - case 3: - g_Player.D_80072EFC = 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; self->posY.val += FIX(0.5); - player->posY.i.hi = self->posY.i.hi + 4; - g_Player.pl_vram_flag = 0x41; - break; - - case 2: - g_Player.D_80072EFC = self->step; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; self->posY.val -= FIX(0.5); - player->posY.i.hi = self->posY.i.hi + 4; - g_Player.pl_vram_flag = 0x41; - break; - } - prim = self->ext.prim; - prim->x0 = prim->x2 = self->posX.i.hi - 8; - prim->x1 = prim->x3 = self->posX.i.hi + 8; - temp = self->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim->y2 = prim->y3 = temp - 0x1F; - prim->y0 = prim->y1 = temp - 0x2F; - prim = prim->next; - - posY = self->posY.i.hi - 40; - - while (prim != NULL) { - posY = func_801904B8(prim, posY); - prim = prim->next; - if (posY <= 0) { - break; - } - prim = prim->next; - } - - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - +REDACTED +REDACTED +REDACTED if (abs(self->posY.i.hi) > 384) { - DestroyEntity(self); - } -} +REDACTED +REDACTED +REDACTED diff --git a/src/st/cen/entity.c b/src/st/cen/entity.c index 69b97ab8df..b56075b1e0 100644 --- a/src/st/cen/entity.c +++ b/src/st/cen/entity.c @@ -10,7 +10,7 @@ void EntityIntenseExplosion(Entity*); void EntitySoulStealOrb(Entity*); void EntityUnkId08(Entity*); void EntityStageNamePopup(Entity*); -void EntityEquipItemDrop(Entity*); +REDACTED void EntityRelicOrb(Entity*); void EntityHeartDrop(Entity*); void EntityEnemyBlood(Entity*); diff --git a/src/st/cen/holyglassescutscene.c b/src/st/cen/holyglassescutscene.c index d40e115b69..9949911eb8 100644 --- a/src/st/cen/holyglassescutscene.c +++ b/src/st/cen/holyglassescutscene.c @@ -46,37 +46,37 @@ static char* D_80180684[] = { static const char _pad[4] = ""; void func_8018DF0C(void) { - g_Dialogue.nextLineX = 2; - g_Dialogue.nextCharX = 2; - g_Dialogue.nextCharY = 0; - g_Dialogue.unk12 = 0; - g_Dialogue.nextCharTimer = 0; - g_Dialogue.unk17 = 8; - g_Dialogue.nextLineY = g_Dialogue.startY + 0x14; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } - +REDACTED s32 func_8018DF60(s32 textDialogue) { - Primitive* prim; - s16 firstPrimIndex; - - firstPrimIndex = g_api.AllocPrimitives(PRIM_SPRT, 7); - g_Dialogue.primIndex[2] = firstPrimIndex; - if (firstPrimIndex == -1) { - g_Dialogue.primIndex[2] = 0; - return 0; - } - g_Dialogue.nextCharDialogue = textDialogue; - g_Dialogue.unk3C = 0; - g_Dialogue.primIndex[1] = -1; - g_Dialogue.primIndex[0] = -1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED func_8018DF0C(); //! FAKE: if (prim && prim) { - } - - prim = g_Dialogue.prim[0] = &g_PrimBuf[g_Dialogue.primIndex[2]]; - +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; prim = g_Dialogue.prim[1] = prim->next; @@ -94,28 +94,28 @@ s32 func_8018DF60(s32 textDialogue) { prim->type = 4; prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 3; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0xFF; +REDACTED +REDACTED +REDACTED +REDACTED prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0; prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0; - prim->x0 = prim->x2 = 4; - prim->x1 = prim->x3 = 0xF8; - prim->priority = 0x1FD; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 1; - prim->x0 = 3; - prim->y0 = 0x2F; - prim->v0 = 0x4A; - prim->r0 = prim->g0 = prim->b0 = 0xFF; - prim->priority = 0x1FC; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; return 1; } - +REDACTED void func_8018E124(s16 arg0) { RECT rect; @@ -125,19 +125,19 @@ void func_8018E124(s16 arg0) { rect.h = 12; ClearImage(&rect, 0, 0, 0); } - +REDACTED void func_8018E180(void) { Primitive* prim; func_8018E124(g_Dialogue.nextCharY); - prim = g_Dialogue.prim[g_Dialogue.nextCharY]; +REDACTED prim->tpage = 0x10; - prim->clut = g_Dialogue.clutIndex; - prim->y0 = g_Dialogue.nextLineY; +REDACTED +REDACTED prim->u0 = 0; - prim->x0 = g_Dialogue.startX; +REDACTED prim->x0 = prim->x0 + 4; - prim->v0 = g_Dialogue.nextCharY * 0xC - 0x80; +REDACTED prim->u1 = 0xC0; prim->v1 = 0xC; prim->priority = 0x1FF; @@ -146,7 +146,7 @@ void func_8018E180(void) { // Creates primitives for the actor name at the head of the dialogue void func_8018E238(u16 actorIndex, Entity* self) { - Primitive* prim; +REDACTED s16 primIndex; s32 x; u16 chCount; @@ -175,10 +175,10 @@ void func_8018E238(u16 actorIndex, Entity* self) { DestroyEntity(self); return; } - +REDACTED // Fill prims to render the actor name on screen prim = &g_PrimBuf[primIndex]; - g_Dialogue.primIndex[1] = primIndex; +REDACTED actorName = D_80180684[actorIndex]; x = 0x38; while (prim != NULL) { @@ -196,58 +196,58 @@ void func_8018E238(u16 actorIndex, Entity* self) { prim->priority = 0x1FF; prim->drawMode = DRAW_HIDE; prim->x0 = x; - prim->y0 = g_Dialogue.startY + 6; +REDACTED prim = prim->next; x += FONT_GAP; } } } - +REDACTED void func_8018E3BC(s32 arg0) { - g_Dialogue.unk40 = arg0 + 0x100000; - g_Dialogue.timer = 0; - g_Dialogue.unk3C = 1; +REDACTED +REDACTED +REDACTED } - +REDACTED void func_8018E3E8(void) { Entity* entity; u16 startTimer; u8 entityIndex; - g_Dialogue.timer++; +REDACTED // protect from overflows - if (g_Dialogue.timer > 0xFFFE) { - g_Dialogue.unk3C = 0; +REDACTED +REDACTED return; } while (true) { // Start the dialogue script only if the start timer has passed - startTimer = (*g_Dialogue.unk40++ << 8) | *g_Dialogue.unk40++; - if (g_Dialogue.timer < startTimer) { +REDACTED +REDACTED // Re-evaluate the condition at the next frame - g_Dialogue.unk40 -= 2; +REDACTED return; } - switch (*g_Dialogue.unk40++) { +REDACTED case 0: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); - entity->entityId = *g_Dialogue.unk40++; +REDACTED entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1]; - entity->posX.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posX.i.hi = *g_Dialogue.unk40++ | entity->posX.i.hi; - entity->posY.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posY.i.hi = *g_Dialogue.unk40++ | entity->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED entity->posX.i.hi -= g_Tilemap.scrollX.i.hi; entity->posY.i.hi -= g_Tilemap.scrollY.i.hi; break; case 1: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); break; @@ -266,36 +266,36 @@ void func_8018E3E8(void) { } } } - +REDACTED // Animates the portrait size of the actor by enlarging or shrinking it -void func_8018E6C4(u8 ySteps) { - Primitive* prim; - s32 primIndex; - s32 i; - - primIndex = g_Dialogue.nextCharY + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED while (primIndex >= 5) { primIndex -= 5; } if (g_CurrentEntity->step_s == 0) { - prim = g_Dialogue.prim[primIndex]; +REDACTED prim->v1 -= ySteps; prim->v0 += ySteps; if (prim->v1 == 0) { g_CurrentEntity->step_s++; prim->drawMode = DRAW_HIDE; - } - } - - for (i = 0; i < 5; i++) { - if (i != primIndex) { - prim = g_Dialogue.prim[i]; - prim->y0 -= ySteps; - } - } - g_Dialogue.portraitAnimTimer++; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityHolyGlassesCutscene(Entity* self) { RECT rect; Primitive* prim; @@ -333,9 +333,9 @@ void EntityHolyGlassesCutscene(Entity* self) { switch (self->step) { case 0: if (g_CastleFlags[216] != 0) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED if (func_8018DF60(D_801813F0) & 0xFF) { self->flags |= FLAG_HAS_PRIMS | FLAG_UNK_2000; D_8003C704 = 1; diff --git a/src/st/dre/11A64.c b/src/st/dre/11A64.c index 2408bad289..79f5320ed5 100644 --- a/src/st/dre/11A64.c +++ b/src/st/dre/11A64.c @@ -1,93 +1,93 @@ -/* - * File: 11A64.c - * Overlay: DRE - * Description: Nightmare - */ - -#include "dre.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - +REDACTED // puts garbled hp max up text on screen void EntityUnkId11(Entity* entity) { ObjInit* obj = (ObjInit*)&D_80180528[entity->params * 10]; - - if (entity->step == 0) { +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); entity->animSet = obj->animSet; - entity->zPriority = obj->zPriority; +REDACTED entity->unk5A = obj->unk5A; - entity->palette = obj->palette; +REDACTED entity->drawFlags = obj->drawFlags; entity->drawMode = obj->drawMode; - - if (obj->unkC != 0) { +REDACTED +REDACTED entity->flags = obj->unkC; - } - - if (entity->params == 1) { +REDACTED +REDACTED +REDACTED entity->rotY = 0x200; entity->rotX = 0x200; - } - } - +REDACTED +REDACTED +REDACTED AnimateEntity(obj->unk10, entity); -} +REDACTED -void func_80191B44(Entity* entity) { - s32 ret; - u16* temp_v0_2; - u16 temp_s1 = entity->params; - u16 phi_v1; - u16 unk; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->unk6D[0] = 0; - - if (entity->step != 0) { - switch (temp_s1) { - case 4: - case 5: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Tilemap.x != 0) { return; } break; - +REDACTED case 6: if (g_pads->pressed & PAD_TRIANGLE) { g_Tilemap.x = 0; g_Tilemap.width = 1280; - entity->step++; - return; - } - break; - } - - if (entity->unk44 != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED ret = GetSideToPlayer(); - phi_v1 = entity->ext.generic.unk7C.s; +REDACTED if (phi_v1 != 0) { - phi_v1 = (ret & 2) * 2; +REDACTED } else { - phi_v1 = (ret & 1) * 4; +REDACTED } - unk = 8; - temp_s1 = (temp_s1 * unk) + phi_v1; - temp_v0_2 = &D_80180590[temp_s1]; +REDACTED +REDACTED +REDACTED g_Tilemap.x = *(temp_v0_2++); g_Tilemap.y = *(temp_v0_2++); g_Tilemap.width = *(temp_v0_2++); g_Tilemap.height = *(temp_v0_2++); - } - } else { - InitializeEntity(D_801804A0); - entity->ext.generic.unk7C.s = D_80180588[temp_s1]; - if (entity->ext.generic.unk7C.s != 0) { - entity->hitboxWidth = D_80180580[temp_s1]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxHeight = 16; } else { entity->hitboxWidth = 16; - entity->hitboxHeight = D_80180580[temp_s1]; - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED extern u16 g_eBreakableInit[]; extern u8* g_eBreakableAnimations[]; @@ -96,109 +96,109 @@ extern u8 g_eBreakableExplosionTypes[]; extern u16 g_eBreakableanimSets[]; extern u8 g_eBreakableDrawModes[]; void EntityBreakable(Entity* entity) { - Entity* temp_v0; - u16 temp_s0 = entity->params >> 0xC; - - if (entity->step != 0) { +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(g_eBreakableAnimations[temp_s0], entity); - if (entity->unk44 != 0) { +REDACTED g_api.PlaySfx(SFX_CANDLE_HIT); temp_v0 = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (temp_v0 != NULL) { +REDACTED CreateEntityFromCurrentEntity(2, temp_v0); - temp_v0->params = g_eBreakableExplosionTypes[temp_s0]; - } +REDACTED +REDACTED ReplaceBreakableWithItemDrop(entity); - } - } else { +REDACTED +REDACTED InitializeEntity(g_eBreakableInit); entity->zPriority = g_unkGraphicsStruct.g_zEntityCenter - 20; entity->drawMode = g_eBreakableDrawModes[temp_s0]; entity->hitboxHeight = g_eBreakableHitboxes[temp_s0]; entity->animSet = g_eBreakableanimSets[temp_s0]; - } -} +REDACTED +REDACTED // clouds in the background ID 0x18 -void EntityBackgroundClouds(Entity* self) { - Primitive* prim; - s16 primIndex; - s32 camX, camY; +REDACTED +REDACTED +REDACTED +REDACTED - switch (self->step) { - case 0: +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 5); - if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.prim = prim; - self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_G4; - prim->x0 = prim->x2 = 0; - prim->x1 = prim->x3 = 0x100; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->y0 = prim->y1 = 0x6E - g_Tilemap.scrollY.i.hi; - prim->y2 = prim->y3 = 0xF0; - setRGB0(prim, 16, 16, 16); - prim->priority = 0x20; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); - prim = prim->next; +REDACTED camX = -g_Tilemap.scrollX.i.hi; camY = 32 - g_Tilemap.scrollY.i.hi; - while (prim != 0) { - prim->x0 = prim->x2 = camX; - camX += 95; - prim->x1 = prim->x3 = camX; - prim->tpage = 0xF; - prim->clut = 5; - prim->u0 = prim->u2 = 0x84; - prim->u1 = prim->u3 = 0xE3; - prim->v0 = prim->v1 = 1; - prim->v2 = prim->v3 = 0x4F; - prim->y0 = prim->y1 = camY; - prim->y2 = prim->y3 = camY + 0x4E; - prim->priority = 0x20; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - prim = prim->next; - } - break; - - case 255: - /** - * Debug: Press SQUARE / CIRCLE on the second controller - * to advance/rewind current animation frame - */ - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - self->animCurFrame++; - self->params |= 1; - } else { - break; - } - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } - g_GpuBuffers[0].draw.r0 = 40; - g_GpuBuffers[0].draw.g0 = 24; - g_GpuBuffers[0].draw.b0 = 24; - g_GpuBuffers[1].draw.r0 = 40; - g_GpuBuffers[1].draw.g0 = 24; - g_GpuBuffers[1].draw.b0 = 24; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/dre/13E18.c b/src/st/dre/13E18.c index a47e7d7d34..f5ca36a1ea 100644 --- a/src/st/dre/13E18.c +++ b/src/st/dre/13E18.c @@ -1,129 +1,129 @@ -#include "dre.h" +REDACTED #include "sfx.h" - -extern s32 D_80180660; - -void EntityUnkId1C(Entity* self) { - Entity* newEntity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 velX; - s8* hitbox; - s32 i; - - if (D_80180660 == 0) { +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DEAD; - } - +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - if (self->step != 5) { - if (D_80180660 != 0) { - D_80180660--; - } - self->hitboxState = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DEAD; g_api.PlaySfxVolPan(0x6D9, 0x54, 0); - SetStep(5); - } - } - - switch (self->step) { - case 0: - InitializeEntity(D_801804F4); - self->hitboxState = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED velX = self->ext.generic.unkA0 - (self->posX.i.hi + g_Tilemap.scrollX.i.hi) << 0x10; if (velX < 0) { velX += 0x3F; - } +REDACTED self->velocityX = velX >> 6; - self->ext.generic.unk80.modeS16.unk0 = 0x40; - - case 1: - MoveEntity(); - newEntity = self->ext.generic.unk9C; - self->animCurFrame = newEntity->animCurFrame; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = newEntity->facingLeft; - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - self->hitboxState = 3; - SetStep(2); - } - break; - - case 2: - newEntity = self->ext.generic.unk9C; - self->animCurFrame = newEntity->animCurFrame; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = newEntity->facingLeft; - if (newEntity->ext.generic.unk84.U8.unk1 != 0) { - self->ext.generic.unk80.modeS16.unk0 = (self->params * 0x30) + 1; - SetStep(3); - } - break; - - case 3: - self->animCurFrame = 26; - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - SetStep(4); - } - break; - - case 4: - if (self->step_s == 0) { - self->ext.generic.unk84.S8.unk1 = 0; - self->step_s++; - } - - if (AnimateEntity(D_80180780, self) == 0) { - self->ext.generic.unk80.modeS16.unk0 = 0x120; - SetStep(3); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { PlaySfxPositional(0x6E2); - for (i = 0; i < 2; i++) { +REDACTED newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { - CreateEntityFromEntity(0x1D, self, newEntity); - newEntity->params = i; - if (i != 0) { - newEntity->posX.i.hi -= 2; - } else { - newEntity->posX.i.hi += 2; - } - newEntity->ext.generic.unk9C = self; - newEntity->posY.i.hi -= 10; - newEntity->zPriority = self->zPriority + 1; - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 5 && self->animFrameDuration == 0) { PlaySfxPositional(0x872); PlaySfxPositional(0x87C); PlaySfxPositional(SFX_FIRE_SHOT); - self->ext.generic.unk84.S8.unk1 = 1; - } - break; - - case 5: - if (self->step_s == 0) { - self->ext.generic.unk80.modeS16.unk0 = 0x20; - self->step_s++; - } - if (self->ext.generic.unk80.modeS16.unk0 & 1) { - self->animSet = 0; - } else { - self->animSet = ANIMSET_OVL(1); - } - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - DestroyEntity(self); - return; - } - break; - } - hitbox = &D_80180830[self->animCurFrame][D_801807F8]; - hitbox--; - hitbox++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; +REDACTED +REDACTED } diff --git a/src/st/dre/161DC.c b/src/st/dre/161DC.c index 7c9d65a7c3..5030519a52 100644 --- a/src/st/dre/161DC.c +++ b/src/st/dre/161DC.c @@ -1,17 +1,17 @@ #include "dre.h" -void func_801961DC(s16 arg0) { +REDACTED s16 temp_v0 = arg0 - g_unkGraphicsStruct.unkC; - - if (temp_v0 > 1) { +REDACTED +REDACTED g_unkGraphicsStruct.unkC++; - } else if (temp_v0 < -1) { +REDACTED g_unkGraphicsStruct.unkC--; - } else { +REDACTED g_unkGraphicsStruct.unkC = arg0; - } -} - +REDACTED +REDACTED +REDACTED void EntityCSMoveAlucard(Entity* self) { Tilemap* currentRoomTileLayout = &g_Tilemap; Entity* player = &PLAYER; @@ -127,27 +127,27 @@ void EntityCSMoveAlucard(Entity* self) { case 8: func_801961DC(0x80); if (g_unkGraphicsStruct.unkC == 0x80) { - D_8003C8B8 = 1; +REDACTED if (g_unkGraphicsStruct.unk0 != 0) { g_unkGraphicsStruct.unk0 = 0; - } - DestroyEntity(self); - } +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - g_Player.D_80072EFC = 1; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // appears to load from the CD and freeze the game void EntityUnkId23(Entity* self) { Entity* player = &PLAYER; Entity* ent = &g_Entities[80]; s16 diff; - - switch (self->step) { - case 0: - InitializeEntity(D_8018047C); +REDACTED +REDACTED +REDACTED +REDACTED D_8003C8B8 = 0; g_unkGraphicsStruct.unk0 = 1; g_Player.padSim = 0; @@ -171,8 +171,8 @@ void EntityUnkId23(Entity* self) { g_Player.padSim = PAD_L1; } else if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) { g_Player.padSim = PAD_R2; - } - } +REDACTED +REDACTED } else if ((g_Player.pl_vram_flag & 1) && (D_801A3F84 & 2)) { diff = player->posX.i.hi - ent->posX.i.hi; if (diff < -0x50) { diff --git a/src/st/dre/1697C.c b/src/st/dre/1697C.c index 17c1c1257c..98fd250574 100644 --- a/src/st/dre/1697C.c +++ b/src/st/dre/1697C.c @@ -1,141 +1,141 @@ -#include "dre.h" +REDACTED #include "sfx.h" - -void EntityFadeToWhite1(Entity* self) { - Primitive* prim; - s16 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_G4, 1); if (primIndex != -1) { - InitializeEntity(D_8018047C); - prim = &g_PrimBuf[primIndex]; - self->animSet = ANIMSET_DRA(0); - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - prim->x1 = prim->x3 = 0x100; - prim->y2 = prim->y3 = 0xE0; - prim->priority = 192; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = - prim->b3 = prim->y0 = prim->y1 = prim->x0 = prim->x2 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - } - break; - - case 1: - if (D_801A3F84 & 0x10) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_PrimBuf[self->primIndex].drawMode = 0x35; g_api.PlaySfx(SFX_FM_EXPLODE_A); // Fade to white - self->step++; - } - break; - - case 2: - prim = &g_PrimBuf[self->primIndex]; - prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 = - prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->r0 = - prim->b3 + 4; - if (prim->r0 > 240) { - self->ext.fadeToWhite.unk7C = 1; - self->ext.fadeToWhite.unk7E = 0x200; - self->ext.fadeToWhite.unk80 = 0; - D_801A3F84 |= 0x20; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_SUC_APPEAR); - self->step++; - } - break; - - case 3: - prim = &g_PrimBuf[self->primIndex]; - prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 = - prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->r0 = - prim->b3 - 2; - if (prim->r0 < 4) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - self->step++; - } - break; - - case 4: - if (D_801A3F84 & 0x200) { - self->ext.fadeToWhite.unk7C = 0; - g_api.PlaySfx(0xA1); - DestroyEntity(self); - } - break; - } - - if (self->ext.fadeToWhite.unk7C != 0) { - if (--self->ext.fadeToWhite.unk7E == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_SUC_APPEAR); - } - } -} - -// ID 24 -void EntityFadeToWhite2(Entity* self) { - Primitive* prim; - s16 primIndex; - s32 i; - - switch (self->step) { - case 0: - primIndex = g_api.AllocPrimitives(PRIM_G4, 2); - if (primIndex != -1) { - InitializeEntity(D_8018047C); - prim = &g_PrimBuf[primIndex]; - self->animSet = ANIMSET_DRA(0); - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - for (i = 0; prim != NULL; i++) { - prim->x0 = prim->x2 = 0; - prim->x1 = prim->x3 = 256; - prim->y0 = prim->y1 = 0; - prim->y2 = prim->y3 = 224; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = - prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 = - prim->b2 = prim->b3 = 0; - prim->priority = i + 192; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - } - break; - - case 1: - if (D_801A3F84 & 0x10) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_PrimBuf[self->primIndex].drawMode = 0x35; - self->step++; - } - break; - - case 2: - prim = &g_PrimBuf[self->primIndex]; - prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 = - prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->r0 = - prim->b3 + 2; - if (prim->r0 > 252) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - prim = prim->next; +REDACTED prim->drawMode = 0x55; - self->step++; - } - break; - - case 3: - prim = g_PrimBuf[self->primIndex].next; - prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 = - prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->r0 = - prim->b3 + 8; - if (prim->r0 > 240) { - D_801A3F84 |= 0x40; - self->step++; - } - break; - - case 4: - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/dre/1E1C8.c b/src/st/dre/1E1C8.c index 3dc84ab970..76325178ca 100644 --- a/src/st/dre/1E1C8.c +++ b/src/st/dre/1E1C8.c @@ -57,7 +57,7 @@ void EntityRoomForeground(Entity* entity) { if (objInit->unkC != 0) { entity->flags = objInit->unkC; } - if (entity->params >= 5) { +REDACTED entity->rotZ = 0x800; entity->drawFlags |= 4; } diff --git a/src/st/dre/22848.c b/src/st/dre/22848.c index feba9f7bfd..e4250e3cb9 100644 --- a/src/st/dre/22848.c +++ b/src/st/dre/22848.c @@ -147,10 +147,10 @@ Primitive* func_801A2C9C(Primitive* prim, u8* model, u16* arg2) { LOW(prim->x3) = *SPAD(model[3]); prim->drawMode = DRAW_UNK02 | DRAW_COLORS; prim->r0 = prim->g0 = prim->b0 = arg2[1]; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - prim = prim->next; +REDACTED +REDACTED +REDACTED +REDACTED model += 4; } } @@ -166,10 +166,10 @@ void Entity3DHouseSpawner(Entity* self) { dataPtr = D_801815E8; // It appears that the data here will hit an FFFF after 5 cycles. while (*dataPtr != -1) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity == NULL) { - break; - } +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_ID_BACKGROUND_HOUSE, newEntity); newEntity->posX.i.hi = *dataPtr++ - g_Tilemap.scrollX.i.hi; newEntity->posY.i.hi = *dataPtr++ - g_Tilemap.scrollY.i.hi; @@ -196,9 +196,9 @@ void Entity3DBackgroundHouse(Entity* self) { SVECTOR** vertices; s32* scratchpad; u8* model; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); primIndex = g_api.AllocPrimitives(PRIM_GT4, 16); // Usually this can be if primIndex == -1 DestroyEntity but nope diff --git a/src/st/dre/entity_heart_drop.c b/src/st/dre/entity_heart_drop.c index 2bb7e69085..d13d7c1489 100644 --- a/src/st/dre/entity_heart_drop.c +++ b/src/st/dre/entity_heart_drop.c @@ -1,7 +1,7 @@ #include "dre.h" -extern u16 D_80180660[]; -void EntityHeartDrop(Entity* self) { +REDACTED +REDACTED u16 index; u8 value; PfnEntityUpdate update; diff --git a/src/st/dre/succubus.c b/src/st/dre/succubus.c index 490a4da3e4..c5751ec829 100644 --- a/src/st/dre/succubus.c +++ b/src/st/dre/succubus.c @@ -1,969 +1,969 @@ -/* - * Overlay: DRE - * Enemy: Succubus Boss - * ID: 0x19 - * BOSS ID: 9 - */ - -#include "dre.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -typedef enum { - /* 0 */ SUCCUBUS_INIT, - /* 1 */ SUCCUBUS_CS_1, - /* 2 */ SUCCUBUS_CS_2, - /* 3 */ SUCCUBUS_CS_3, - /* 4 */ SUCCUBUS_CS_4, - /* 5 */ SUCCUBUS_IDLE, - /* 7 */ SUCCUBUS_FLY = 7, - /* 8 */ SUCCUBUS_PETAL_ATTACK, - /* 9 */ SUCCUBUS_CHARGE, - /* 11 */ SUCCUBUS_CLONE_ATTACK = 11, - /* 12 */ SUCCUBUS_SPIKE_ATTACK, - /* 13 */ SUCCUBUS_TAUNT, - /* 14 */ SUCCUBUS_GET_HIT, - /* 15 */ SUCCUBUS_FACE_PLAYER, - /* 16 */ SUCCUBUS_NEXT_ACTION_CHECK, - /* 18 */ SUCCUBUS_DYING = 18, - /* 255 */ SUCCUBUS_DEBUG = 255, -} SuccubusSteps; - -typedef enum { - /* 0 */ SUCCUBUS_FLY_0, - /* 1 */ SUCCUBUS_FLY_1, - /* 2 */ SUCCUBUS_FLY_2, -} SuccubusFlySubSteps; - -typedef enum { - /* 0 */ SUCCUBUS_PETAL_ATTACK_SETUP, - /* 1 */ SUCCUBUS_PETAL_ATTACK_ANIM, - /* 2 */ SUCCUBUS_PETAL_ATTACK_CREATE_PETALS, -} SuccubusPetalAttackSubSteps; - -typedef enum { - /* 0 */ SUCCUBUS_CHARGE_SETUP, - /* 1 */ SUCCUBUS_CHARGE_FLY_TOWARDS_PLAYER, - /* 2 */ SUCCUBUS_CHARGE_AT_PLAYER_POSITION, - /* 3 */ SUCCUBUS_CHARGE_DEAL_DAMAGE, - /* 4 */ SUCCUBUS_CHARGE_FLY_AWAY, - /* 5 */ SUCCUBUS_CHARGE_DECELERATE, -} SuccubusChargeSubSteps; - -typedef enum { - /* 0 */ SUCCUBUS_CLONE_ATTACK_ANIM_1, - /* 1 */ SUCCUBUS_CLONE_ATTACK_CREATE_CLONES, - /* 2 */ SUCCUBUS_CLONE_ATTACK_WAIT, - /* 3 */ SUCCUBUS_CLONE_ATTACK_PLACE_REAL, - /* 4 */ SUCCUBUS_CLONE_ATTACK_ANIM_2, - /* 5 */ SUCCUBUS_CLONE_ATTACK_SET_SHOOTING, - /* 6 */ SUCCUBUS_CLONE_ATTACK_STOP_SHOOTING, - /* 7 */ SUCCUBUS_CLONE_ATTACK_SHOOT_PINKBALLS, // unused -} SuccubusCloneAttackSubSteps; - -typedef enum { - /* 0 */ SUCCUBUS_SPIKE_ATTACK_CREATE_SPIKES, - /* 1 */ SUCCUBUS_SPIKE_ATTACK_1, - /* 2 */ SUCCUBUS_SPIKE_ATTACK_2, - /* 3 */ SUCCUBUS_SPIKE_ATTACK_3, - /* 4 */ SUCCUBUS_SPIKE_ATTACK_4, -} SuccubusSpikeAttackSubSteps; - -typedef enum { - /* 0 */ SUCCUBUS_DYING_SETUP, - /* 1 */ SUCCUBUS_DYING_FALL, - /* 2 */ SUCCUBUS_DYING_LAND, - /* 3 */ SUCCUBUS_DYING_ANIM_1, - /* 4 */ SUCCUBUS_DYING_ANIM_2, -} SuccubusDyingSubSteps; - -// Original name: multiple_count -extern s32 D_80180660; // clones counter - -void EntitySuccubus(Entity* self) { - const int SeenCutscene = 212; - u8* clonesShootOrder; - s32 sideToPlayer; - Entity* entity; - s32 posX, posY; - s8* hitbox; - s32 facing; - s16 angle; - s32 temp; - s32 i; - - FntPrint("multiple_count %x\n", D_80180660); - - if ((self->hitFlags & 3) && (self->step & SUCCUBUS_CS_1)) { - SetStep(SUCCUBUS_GET_HIT); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - if (self->step != SUCCUBUS_DYING) { - self->hitboxState = 0; - SetStep(SUCCUBUS_DYING); - } - } - - switch (self->step) { - case SUCCUBUS_INIT: - InitializeEntity(D_801804D0); - self->animCurFrame = 82; - SetStep(SUCCUBUS_CS_1); - CreateEntityFromCurrentEntity(E_SUCCUBUS_WING_OVERLAY, &self[1]); - - case SUCCUBUS_CS_1: // Disguised as Lisa +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[SeenCutscene] || (g_DemoMode != Demo_None)) { self->facingLeft = 0; self->posX.i.hi = 416 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = 175 - g_Tilemap.scrollY.i.hi; - SetStep(SUCCUBUS_CS_4); - self->step_s = 3; - } - self->animCurFrame = 82; - if (D_801A3F84 & 4) { - SetStep(SUCCUBUS_CS_2); - } - break; - - case SUCCUBUS_CS_2: // Disguised as Lisa - if (D_801A3ED4 != 0) { - SetSubStep(4); - } - switch (self->step_s) { - case 0: - AnimateEntity(D_8018079C, self); - if (D_801A3F84 & 0x400) { - SetSubStep(1); - } - break; - - case 1: - AnimateEntity(D_801807AC, self); - if (D_801A3F84 & 0x800) { - self->animCurFrame = 84; - SetSubStep(2); - } - break; - - case 2: - if (D_801A3F84 & 0x1000) { - SetSubStep(3); - } - break; - - case 3: - self->animCurFrame = 83; - if (D_801A3F84 & 0x2000) { - SetSubStep(4); - } - break; - - case 4: - self->animCurFrame = 84; - if (D_801A3F84 & 0x20) { - SetStep(SUCCUBUS_CS_3); - } - break; - } - break; - - // Sets Succubus in position - case SUCCUBUS_CS_3: - if ((D_801A3ED4 == 0) || (self->step_s == 0)) { - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = 0; self->posX.i.hi = 416 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = 175 - g_Tilemap.scrollY.i.hi; - self->step_s++; - - case 1: - AnimateEntity(D_8018066C, self); - if (D_801A3F84 & 0x40) { - SetSubStep(2); - } - break; - - case 2: - self->animCurFrame = 4; - if (D_801A3F84 & 0x80) { - SetSubStep(3); - } - break; - - case 3: - AnimateEntity(D_80180674, self); - if (D_801A3F84 & 0x100) { - SetSubStep(4); - } - break; - - case 4: - if (AnimateEntity(D_80180680, self) == 0) { - SetStep(SUCCUBUS_CS_4); - } - break; - } - } else { - SetStep(SUCCUBUS_CS_4); - } - break; - - // Ascends Succubus into the air - case SUCCUBUS_CS_4: - switch (self->step_s) { - case 0: - if (AnimateEntity(D_80180694, self) == 0) { - SetSubStep(1); - } - break; - - case 1: - g_api.PlaySfx(MU_ENCHANTED_BANQUET); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.TimeAttackController( TIMEATTACK_EVENT_SUCCUBUS_DEFEAT, TIMEATTACK_SET_VISITED); - self->velocityX = 0; +REDACTED self->velocityY = FIX(-4); - self->step_s++; - - case 2: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); - if (self->velocityY > 0) { - self->velocityY = 0; - } - if (AnimateEntity(D_801806A0, self) == 0) { - SetStep(SUCCUBUS_IDLE); - } - break; - - case 3: - AnimateEntity(D_80180694, self); - if (GetDistanceToPlayerX() < 96) { - SetSubStep(1); - } - break; - } - break; - - case SUCCUBUS_DYING: - switch (self->step_s) { - case SUCCUBUS_DYING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_NO_SCREAM); - CreateEntityFromCurrentEntity( - E_SUCCUBUS_CUTSCENE, &g_Entities[200]); - g_Entities[200].params = 1; - D_80180660 = 0; - D_80180664 |= 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.TimeAttackController( TIMEATTACK_EVENT_SUCCUBUS_DEFEAT, TIMEATTACK_SET_RECORD); - self->velocityX = 0; - self->velocityY = 0; +REDACTED +REDACTED posY = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - if (posY > 160) { +REDACTED self->velocityY = FIX(-2); - self->step_s = 1; - } else { - self->step_s = 2; - } - break; - - case SUCCUBUS_DYING_FALL: - AnimateEntity(D_80180768, self); - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); - if (self->velocityY > 0) { - self->step_s = 2; - } - break; - - case SUCCUBUS_DYING_LAND: - AnimateEntity(D_80180768, self); - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); posY = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - if (posY >= 176) { +REDACTED PlaySfxPositional(SFX_STOMP_HARD_A); self->posY.i.hi = 175 - g_Tilemap.scrollY.i.hi; - SetSubStep(SUCCUBUS_DYING_ANIM_1); +REDACTED posX = self->posX.i.hi + g_Tilemap.scrollX.i.hi; - if (posX < 80) { +REDACTED D_801816C4 = self->facingLeft = 1; - } else if (posX > 432) { +REDACTED D_801816C4 = self->facingLeft = 0; - } else { +REDACTED D_801816C4 = self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - D_801A3F84 |= 2; - } - break; - - case SUCCUBUS_DYING_ANIM_1: - AnimateEntity(D_80180770, self); - if (D_801A3F84 & 0x10) { - SetSubStep(SUCCUBUS_DYING_ANIM_2); - } - break; - - case SUCCUBUS_DYING_ANIM_2: - AnimateEntity(D_80180778, self); - } - break; - - case SUCCUBUS_IDLE: - if (self->step_s == 0) { - self->ext.succubus.timer = 64; - self->step_s++; - } - - AnimateEntity(D_801806C4, self); - if ((self->animFrameIdx == 3) && (self->animFrameDuration == 0)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_SU_FLAPPING_WINGS); - } - - posY = self->posY.i.hi - self->ext.succubus.yOffset; - if (posY > 8) { +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-0.75); - } - - if (--self->ext.succubus.timer == 0) { - self->ext.succubus.nextStep = SUCCUBUS_FLY; - SetStep(SUCCUBUS_FACE_PLAYER); - } - if ((self->ext.succubus.timer < 80) && (GetDistanceToPlayerX() < 80)) { - self->ext.succubus.nextStep = SUCCUBUS_FLY; - SetStep(SUCCUBUS_FACE_PLAYER); - } - break; - - case SUCCUBUS_FLY: - switch (self->step_s) { - case SUCCUBUS_FLY_0: - self->velocityY = 0; - self->ext.succubus.timer = (Random() & 31) + 32; - self->ext.succubus.nextAttack = SUCCUBUS_PETAL_ATTACK; - self->ext.succubus.yOffset = 88; - if (!(Random() % 4)) { - if (Random() % 2) { - self->ext.succubus.nextAttack = SUCCUBUS_SPIKE_ATTACK; - self->ext.succubus.yOffset = 120; - } else { - self->ext.succubus.nextAttack = SUCCUBUS_CLONE_ATTACK; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.succubus.facingLeft = 0; - self->step_s++; - - case SUCCUBUS_FLY_1: - AnimateEntity(D_801806E8, self); - if ((self->animFrameIdx == 3) && (self->animFrameDuration == 0)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_SU_FLAPPING_WINGS); - } - - MoveEntity(); - posY = self->posY.i.hi - self->ext.succubus.yOffset; - if (posY > 8) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-0.75); - } - if (posY < -8) { +REDACTED +REDACTED self->velocityY = FIX(0.75); - } - +REDACTED +REDACTED if (self->facingLeft != self->ext.succubus.facingLeft) { self->velocityX += FIX(0.09375); if (self->velocityX >= FIX(1.375)) { self->velocityX = FIX(1.375); - } - } else { +REDACTED +REDACTED self->velocityX -= FIX(0.09375); if (self->velocityX <= FIX(-1.375)) { self->velocityX = FIX(-1.375); - } - } - - if (self->ext.succubus.nextAttack == SUCCUBUS_CLONE_ATTACK) { - posX = 64; - } else { - posX = 96; - } - - temp = GetDistanceToPlayerX(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->ext.succubus.facingLeft == 0) { - if (temp < posX) { +REDACTED self->ext.succubus.facingLeft ^= 1; - } +REDACTED if (self->ext.succubus.facingLeft != 0) { - if (posX < temp) { +REDACTED self->ext.succubus.facingLeft ^= 1; - } - } - } else if (posX < temp) { +REDACTED +REDACTED +REDACTED self->ext.succubus.facingLeft ^= 1; - } - - sideToPlayer = ((GetSideToPlayer() & 1) ^ 1); +REDACTED +REDACTED +REDACTED if (self->facingLeft != sideToPlayer) { - if (temp > 16) { - self->ext.succubus.nextStep = SUCCUBUS_CLONE_ATTACK; - SetStep(SUCCUBUS_NEXT_ACTION_CHECK); - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = self->posX.i.hi + g_Tilemap.scrollX.i.hi; if (self->facingLeft != 0) { - posX = 512 - posX; - } - if (posX > 416) { +REDACTED +REDACTED +REDACTED self->ext.succubus.facingLeft = 0; - self->ext.succubus.timer = 96; - self->step_s++; - } - - if (self->ext.succubus.timer == 0) { - if (GetDistanceToPlayerX() < 96) { - if (self->ext.succubus.nextAttack == - SUCCUBUS_PETAL_ATTACK) { - SetStep(SUCCUBUS_PETAL_ATTACK); - } else { - self->ext.succubus.nextStep = - self->ext.succubus.nextAttack; - SetStep(SUCCUBUS_NEXT_ACTION_CHECK); - } - } - } else { - self->ext.succubus.timer--; - } - break; - - case SUCCUBUS_FLY_2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != self->ext.succubus.facingLeft) { self->velocityX += FIX(0.09375); if (self->velocityX >= FIX(1.375)) { self->velocityX = FIX(1.375); - } - } else { +REDACTED +REDACTED self->velocityX -= FIX(0.09375); if (self->velocityX <= FIX(-1.375)) { self->velocityX = FIX(-1.375); - } - } - AnimateEntity(D_801806E8, self); - if ((self->animFrameIdx == 3) && (self->animFrameDuration == 0)) { +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_SU_FLAPPING_WINGS); - } - MoveEntity(); - if (--self->ext.succubus.timer == 0) { - self->step_s = 0; - } - break; - } - break; - - case SUCCUBUS_FACE_PLAYER: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; - } - - if (AnimateEntity(D_801806D4, self) == 0) { - if (self->ext.succubus.nextStep != 0) { - SetStep(self->ext.succubus.nextStep); - self->ext.succubus.nextStep = 0; - } else { - SetStep(SUCCUBUS_FLY); - } - } - break; - - case SUCCUBUS_NEXT_ACTION_CHECK: - if (AnimateEntity(D_801806F8, self) == 0) { - if (self->ext.succubus.nextStep != 0) { - SetStep(self->ext.succubus.nextStep); - self->ext.succubus.nextStep = 0; - } else { - SetStep(SUCCUBUS_IDLE); - } - } - break; - - case SUCCUBUS_PETAL_ATTACK: - switch (self->step_s) { - case SUCCUBUS_PETAL_ATTACK_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - if (g_Player.unk0C & PLAYER_STATUS_CURSE) { - self->ext.succubus.unk87 = false; - } else { - self->ext.succubus.unk87 = true; - } - D_80180668 = 0; - self->step_s++; - - case SUCCUBUS_PETAL_ATTACK_ANIM: - if (AnimateEntity(D_8018070C, self) == 0) { - self->ext.succubus.timer = 128; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_LAUGH); - self->step_s++; - } - break; - - case SUCCUBUS_PETAL_ATTACK_CREATE_PETALS: - if (!(self->ext.succubus.timer & 1)) { - entity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (entity != NULL) { - CreateEntityFromEntity(E_SUCCUBUS_PETAL, self, entity); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->facingLeft = self->facingLeft; - entity->zPriority = self->zPriority - 1; - } - } - if ((self->ext.succubus.timer % 64) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_SU_PETAL_ATTACK); - } - if (--self->ext.succubus.timer == 0) { - SetStep(SUCCUBUS_FLY); - } - if (self->ext.succubus.unk87) { - if (g_Player.unk0C & PLAYER_STATUS_CURSE) { - SetStep(SUCCUBUS_CHARGE); - } - } else if (D_80180668 != 0) { - if (GetDistanceToPlayerX() > 72) { - self->ext.succubus.nextStep = SUCCUBUS_TAUNT; - SetStep(SUCCUBUS_FACE_PLAYER); - } - } - break; - } - break; - - case SUCCUBUS_CHARGE: - switch (self->step_s) { - case SUCCUBUS_CHARGE_SETUP: - self->ext.succubus.timer = 112; - self->animCurFrame = 36; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_BLANK); - self->step_s++; - - case SUCCUBUS_CHARGE_FLY_TOWARDS_PLAYER: - entity = &PLAYER; - posX = entity->posX.i.hi - self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX -= 16; - } else { - posX += 16; - } - posY = entity->posY.i.hi - self->posY.i.hi; - - angle = ratan2(posY, posX); - self->velocityX = (rcos(angle) << 0x11) >> 0xC; - self->velocityY = (rsin(angle) << 0x11) >> 0xC; - posX = self->velocityX; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX = -posX; - } - if (posX > 0) { - self->velocityX = 0; - } - - MoveEntity(); - - posX = PLAYER.posX.i.hi - self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { - posX = -posX; - } - posX -= 4; - if (posX < 0) { - posX = 512; - } - posY = PLAYER.posY.i.hi - self->posY.i.hi; - if (posY < 0) { - posY = -posY; - } - - if (!(g_Player.unk0C & 0x010401A2)) { - if ((posY < 12) && (posX < 24)) { - g_Player.unk60 = 1; - g_Player.unk64 = 0; - g_Player.unk62 = 0; - self->hitboxState = 0; - self->step_s++; - } - } else { - FntPrint("ng status\n"); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posY = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - if (posY > 176) { +REDACTED self->posY.i.hi = 176 - g_Tilemap.scrollY.i.hi; - } - - if (g_Player.unk60 == 0) { - if (--self->ext.succubus.timer == 0) { - self->ext.succubus.unk87 = false; - SetStep(SUCCUBUS_FLY); - } - } - break; - - case SUCCUBUS_CHARGE_AT_PLAYER_POSITION: - entity = &PLAYER; - posX = entity->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX -= 16; - } else { - posX += 16; - } - self->posY.i.hi = posY = entity->posY.i.hi; - self->posX.i.hi = posX; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_SUCK_YOU_DRY); - self->step_s++; - - case SUCCUBUS_CHARGE_DEAL_DAMAGE: - if (AnimateEntity(D_8018071C, self) == 0) { - g_Player.unk64 = g_api.enemyDefs[347].attack; - g_Player.unk60 = 3; - self->ext.succubus.timer = 48; - self->step_s++; - } - break; - - case SUCCUBUS_CHARGE_FLY_AWAY: - if (--self->ext.succubus.timer == 0) { - g_Player.unk60 = 0; - self->hitboxState = 3; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { self->velocityX = FIX(-4); - } else { +REDACTED self->velocityX = FIX(4); - } +REDACTED self->velocityY = FIX(-4); - self->animCurFrame = 47; - self->ext.succubus.timer = 24; - self->step_s++; - } - break; - - case SUCCUBUS_CHARGE_DECELERATE: - MoveEntity(); - self->velocityX -= self->velocityX >> 5; - self->velocityY -= self->velocityY >> 5; - if (--self->ext.succubus.timer == 0) { - SetStep(SUCCUBUS_TAUNT); - } - break; - } - break; - - case SUCCUBUS_TAUNT: - if (self->step_s == 0) { - self->ext.succubus.timer = 80; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; - if (self->ext.succubus.unk87) { +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_DELICIOUS); - } else { +REDACTED PlaySfxPositional(NA_VO_SU_LAUGH); - } - self->ext.succubus.unk87 = false; - } - AnimateEntity(D_8018072C, self); - if ((--self->ext.succubus.timer == 0) || - (GetDistanceToPlayerX() < 32)) { - SetStep(SUCCUBUS_FLY); - } - break; - - case SUCCUBUS_CLONE_ATTACK: - switch (self->step_s) { - case SUCCUBUS_CLONE_ATTACK_CREATE_CLONES: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = self->posX.i.hi + g_Tilemap.scrollX.i.hi; - posX -= 192; - - // left bound limit - if (posX < 32) { - posX = 96 - ((32 - posX) % 64); - } - - // right bound limit - temp = posX + 384; - if (temp > 480) { - posX = ((posX - 96) % 64) + 32; - } - - clonesShootOrder = *g_CloneShootOrder; - temp = Random() & 3; - clonesShootOrder += temp * 7; - - entity = &g_Entities[112]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp = self->posX.i.hi + g_Tilemap.scrollX.i.hi; - - for (i = 0; i < 6; i++, entity++, clonesShootOrder++, posX += 64) { - CreateEntityFromEntity(E_SUCCUBUS_CLONE, self, entity); - // Giving each clone a pointer to the real Succubus - entity->ext.succubus.real = self; - if (posX == temp) { - posX += 64; - } - entity->ext.succubus.clonePosX = posX; - entity->params = *clonesShootOrder; - } - self->params = *clonesShootOrder; - self->ext.succubus.timer = 64; - self->hitboxState = 0; - D_80180660 = 6; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_GRUNT_1); PlaySfxPositional(NA_SE_SU_CREATE_CLONES); - self->step_s++; - - case SUCCUBUS_CLONE_ATTACK_WAIT: - if (--self->ext.succubus.timer == 0) { - self->step_s = 3; - } - - case SUCCUBUS_CLONE_ATTACK_ANIM_1: - self->ext.succubus.unk85 = false; - AnimateEntity(D_80180734, self); - if ((self->animFrameIdx == 4) && (self->animFrameDuration == 0)) { - self->step_s++; - } - break; - - case SUCCUBUS_CLONE_ATTACK_PLACE_REAL: - entity = &g_Entities[112]; - temp = Random() % 6; - entity += temp; - - posX = entity->posX.i.hi; - posY = entity->posY.i.hi; - entity->posX.i.hi = self->posX.i.hi; - entity->posY.i.hi = self->posY.i.hi; - self->posX.i.hi = posX; - self->posY.i.hi = posY; - self->hitboxState = 3; - self->step_s++; - - case SUCCUBUS_CLONE_ATTACK_ANIM_2: - if (AnimateEntity(D_80180734, self) == 0) { - SetSubStep(SUCCUBUS_CLONE_ATTACK_SET_SHOOTING); - } - break; - - case SUCCUBUS_CLONE_ATTACK_SET_SHOOTING: - if (AnimateEntity(D_80180760, self) == 0) { - self->ext.succubus.unk85 = true; - // PinkBall attack delay set - self->ext.succubus.timer = (self->params * 48) + 1; - SetSubStep(SUCCUBUS_CLONE_ATTACK_STOP_SHOOTING); - } - break; - - case SUCCUBUS_CLONE_ATTACK_STOP_SHOOTING: - self->animCurFrame = 26; - if (--self->ext.succubus.timer == 0) { - self->ext.succubus.unk85 = false; - /*! @bug: Likely a typo meant to be - * SetSubStep(SUCCUBUS_CLONE_ATTACK_SHOOT_PINKBALLS); - * case SUCCUBUS_CLONE_ATTACK_SHOOT_PINKBALLS is - * inaccessible causing the real Succubus to be - * unable to do the PinkBall attack. - */ - SetSubStep(SUCCUBUS_CLONE_ATTACK_STOP_SHOOTING); - } - if (D_80180660 == 0) { - SetStep(SUCCUBUS_IDLE); - } - break; - - /* Unused: see @bug in previous case. - * The real Succubus was supposed to shoot last, hinting - * the player her real position, but the end result is - * she doesn't shoot at all. - */ - case SUCCUBUS_CLONE_ATTACK_SHOOT_PINKBALLS: - if (AnimateEntity(D_80180780, self) == 0) { - self->ext.succubus.timer = 288; - SetSubStep(SUCCUBUS_CLONE_ATTACK_ANIM_2); - } - if ((self->animFrameIdx == 4) && (self->animFrameDuration == 0)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_SU_CHARGE_PINKBALLS); - - for (i = 0; i < 2; i++) { - entity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (entity != NULL) { - CreateEntityFromEntity( - E_SUCCUBUS_PINK_BALL_PROJECTILE, self, entity); - entity->params = i; - if (i != 0) { - entity->posX.i.hi -= 2; - } else { - entity->posX.i.hi += 2; - } - entity->ext.succubus.real = self; - entity->posY.i.hi -= 13; - entity->zPriority = self->zPriority + 1; - } - } - } - if ((self->animFrameIdx == 5) && (self->animFrameDuration == 0)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_GRUNT_2); PlaySfxPositional(NA_VO_SU_CRYSTAL_1); PlaySfxPositional(SFX_FIRE_SHOT); - self->ext.succubus.unk85 = true; - } - break; - } - break; - - case SUCCUBUS_SPIKE_ATTACK: - switch (self->step_s) { - case SUCCUBUS_SPIKE_ATTACK_CREATE_SPIKES: - entity = &g_Entities[96]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = 0; - self->ext.succubus.unk85 = false; - D_80180668 = 0; - for (facing = 0; facing < 2; facing++) { - for (i = 0; i < 4; i++, entity += 2) { - CreateEntityFromEntity(E_SUCCUBUS_WING_SPIKE, self, entity); - entity->params = i; - entity->zPriority = self->zPriority; - entity->ext.succubus.real = self; - if (facing == 0) { - entity->posX.i.hi -= 5; - } else { - entity->posX.i.hi += 4; - } - entity->posY.i.hi -= 27; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->facingLeft = facing; - } - } - self->step_s++; - - case SUCCUBUS_SPIKE_ATTACK_1: - if (AnimateEntity(D_80180748, self) == 0) { - self->ext.succubus.unk85 = true; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_CRYSTAL_2); PlaySfxPositional(NA_VO_SU_GRUNT_3); - self->ext.succubus.timer = 64; - SetSubStep(2); - } - break; - - case SUCCUBUS_SPIKE_ATTACK_2: - if (--self->ext.succubus.timer == 0) { - self->ext.succubus.unk85 = false; - self->ext.succubus.timer = 64; - self->step_s++; - } - break; - - case SUCCUBUS_SPIKE_ATTACK_3: - if (--self->ext.succubus.timer == 0) { - self->step_s++; - } - break; - - case SUCCUBUS_SPIKE_ATTACK_4: - if (AnimateEntity(D_80180760, self) == 0) { - SetStep(SUCCUBUS_IDLE); - } - if (D_80180668 != 0) { - if (GetDistanceToPlayerX() > 64) { - self->ext.succubus.nextStep = SUCCUBUS_TAUNT; - SetStep(SUCCUBUS_FACE_PLAYER); - } - } - break; - } - break; - - case SUCCUBUS_GET_HIT: - if (self->step_s == 0) { - if (Random() % 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_VO_SU_HURT_1); - } else { +REDACTED PlaySfxPositional(NA_VO_SU_HURT_2); - } - - self->ext.succubus.timer = 32; - D_80180660 = 0; - if (GetSideToPlayer() & 1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = FIX(2); - } else { +REDACTED self->velocityX = FIX(-2); - } +REDACTED self->velocityY = FIX(-2); - self->step_s++; - } - AnimateEntity(D_80180768, self); - MoveEntity(); - self->velocityX -= self->velocityX >> 5; - self->velocityY -= self->velocityY >> 5; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.0625); - if (--self->ext.succubus.timer == 0) { - if (Random() % 2) { - self->ext.succubus.nextStep = SUCCUBUS_SPIKE_ATTACK; - } else { - self->ext.succubus.nextStep = SUCCUBUS_CLONE_ATTACK; - } - SetStep(SUCCUBUS_NEXT_ACTION_CHECK); - } - break; - - case SUCCUBUS_DEBUG: - /** - * Debug: Press SQUARE / CIRCLE on the second controller - * to advance/rewind current animation frame - */ - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - self->animCurFrame++; - self->params |= 1; - } else { - break; - } - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = self->posX.i.hi + g_Tilemap.scrollX.i.hi; posY = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - - if (self->velocityX < 0) { - if (posX < 40) { +REDACTED +REDACTED +REDACTED self->posX.i.hi = 40 - g_Tilemap.scrollX.i.hi; - } - } else if (posX > 480) { +REDACTED +REDACTED self->posX.i.hi = 480 - g_Tilemap.scrollX.i.hi; - } - if ((self->velocityY < 0) && (posY < 48)) { +REDACTED +REDACTED self->posY.i.hi = 48 - g_Tilemap.scrollY.i.hi; - } - // TODO: !FAKE - hitbox = (s8*)&D_80180830[self->animCurFrame][D_801807F8]; - hitbox--; - hitbox++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; -} - -void EntitySuccubusPetal(Entity* self) { - Entity* newEntity; - s32 temp_s2; - s16 angle; - - if (D_80180664 & 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DEAD; } if (self->hitFlags & 0x80) { @@ -972,353 +972,353 @@ void EntitySuccubusPetal(Entity* self) { if (self->flags & FLAG_DEAD) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0; - } - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_801804DC); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; self->rotZ = rand() & 0xFFF; - temp_s2 = Random() & 3; - if (temp_s2 >= 3) { - temp_s2 = 0; - } - self->animCurFrame = temp_s2 + 64; - - angle = ((Random() & 0x1F) * 16) + 0xC0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { - angle = 0x800 - angle; - } else { - angle = angle; - } - temp_s2 = ((rand() * 4) + 0x38000) >> 0xC; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = temp_s2 * rcos(angle); self->velocityY = temp_s2 * rsin(angle); - self->ext.succubus.timer = (Random() & 31) + 16; - - case 1: +REDACTED +REDACTED +REDACTED self->velocityX = self->velocityX - (self->velocityX >> 6); self->velocityY = self->velocityY - (self->velocityY >> 6); - MoveEntity(); - if (--self->ext.succubus.timer == 0) { - self->ext.succubus.timer = (Random() & 31) + 32; - self->step++; - } - break; - - case 2: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ += self->ext.succubus.timer; - break; - } -} - -// Wings that appear over the player when the succubus does her charge attack -void EntitySuccubusWingOverlay(Entity* entity) { - if (entity->step == 0) { - InitializeEntity(D_801804E8); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->posX.i.hi = entity[-1].posX.i.hi; entity->animCurFrame = 0; entity->posY.i.hi = entity[-1].posY.i.hi; entity->facingLeft = entity[-1].facingLeft; - - if (entity[-1].animCurFrame == 50) { - entity->animCurFrame = 62; - } - - if (entity[-1].animCurFrame == 51) { - entity->animCurFrame = 63; - } - - entity->zPriority = PLAYER.zPriority + 4; -} - -extern s32 D_80180660; // clones counter - -void EntitySuccubusClone(Entity* self) { - Entity* newEntity; - s8* hitbox; - s32 velX; - s32 i; - - if (D_80180660 == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DEAD; } if (self->flags & FLAG_DEAD) { - if (self->step != 5) { - if (D_80180660 != 0) { - D_80180660--; - } - self->hitboxState = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DEAD; g_api.PlaySfxVolPan(0x6D9, 0x54, 0); - SetStep(5); - } - } - - switch (self->step) { - case 0: - InitializeEntity(D_801804F4); - self->hitboxState = 0; - velX = self->ext.succubus.clonePosX - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED (self->posX.i.hi + g_Tilemap.scrollX.i.hi) - << 0x10; - if (velX < 0) { - velX += 0x3F; - } - self->velocityX = velX >> 6; - self->ext.succubus.timer = 64; - - case 1: - MoveEntity(); - newEntity = self->ext.succubus.real; - self->animCurFrame = newEntity->animCurFrame; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = newEntity->facingLeft; - if (--self->ext.succubus.timer == 0) { - self->hitboxState = 3; - SetStep(2); - } - break; - - case 2: - newEntity = self->ext.succubus.real; - self->animCurFrame = newEntity->animCurFrame; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = newEntity->facingLeft; - if (newEntity->ext.succubus.unk85 != 0) { - self->ext.succubus.timer = (self->params * 48) + 1; - SetStep(3); - } - break; - - case 3: - self->animCurFrame = 26; - if (--self->ext.succubus.timer == 0) { - SetStep(4); - } - break; - - case 4: - if (self->step_s == 0) { - self->ext.succubus.unk85 = 0; - self->step_s++; - } - - if (AnimateEntity(D_80180780, self) == 0) { - self->ext.succubus.timer = 288; - SetStep(3); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { PlaySfxPositional(0x6E2); - for (i = 0; i < 2; i++) { - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { - CreateEntityFromEntity( - E_SUCCUBUS_PINK_BALL_PROJECTILE, self, newEntity); - newEntity->params = i; - if (i != 0) { - newEntity->posX.i.hi -= 2; - } else { - newEntity->posX.i.hi += 2; - } - newEntity->ext.succubus.real = self; - newEntity->posY.i.hi -= 10; - newEntity->zPriority = self->zPriority + 1; - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 5 && self->animFrameDuration == 0) { PlaySfxPositional(NA_VO_SU_GRUNT_2); PlaySfxPositional(NA_VO_SU_CRYSTAL_1); PlaySfxPositional(SFX_FIRE_SHOT); - self->ext.succubus.unk85 = 1; - } - break; - - case 5: - if (self->step_s == 0) { - self->ext.succubus.timer = 32; - self->step_s++; - } - if (self->ext.succubus.timer & 1) { - self->animSet = ANIMSET_DRA(0); - } else { - self->animSet = ANIMSET_OVL(1); - } - if (--self->ext.succubus.timer == 0) { - DestroyEntity(self); - return; - } - break; - } - hitbox = &D_80180830[self->animCurFrame][D_801807F8]; - hitbox--; - hitbox++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; -} - +REDACTED +REDACTED +REDACTED +REDACTED // Pink ball projectile shot by succubus duplicates ID 0x1D -void EntityPinkBallProjectile(Entity* self) { - Entity* entity; - s16 temp_s0; - s16 temp_v0; - - if (D_80180664 & 2) { - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180500); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawMode = 0x30; self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; self->rotY = 0; self->rotX = 0; - - case 1: +REDACTED +REDACTED self->rotX = self->rotY += 4; if (self->rotX > 256) { self->drawFlags = 0; - } - AnimateEntity(D_80180794, self); - - entity = self->ext.succubus.real; - if (entity->ext.succubus.unk85 != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = 0; - self->step++; - } +REDACTED +REDACTED if (entity->flags & FLAG_DEAD) { - DestroyEntity(self); - } - break; - - case 2: - temp_s0 = (self->params << 10) + 0x200; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = rcos(temp_s0) * 0x38; self->velocityY = rsin(temp_s0) * 0x38; - self->ext.succubus.unkA2 = temp_s0; - self->ext.succubus.timer = 128; - self->step++; - - case 3: - AnimateEntity(D_80180794, self); - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_v0 = GetAngleBetweenEntities(self, g_Entities); temp_s0 = GetNormalizedAngle(0x10, self->ext.succubus.unkA2, temp_v0); self->velocityX = rcos(temp_s0) * 0x38; self->velocityY = rsin(temp_s0) * 0x38; - self->ext.succubus.unkA2 = temp_s0; - - if (self->hitFlags & 0x80) { - self->step = 4; - } - - if (--self->ext.succubus.timer == 0) { - self->step = 4; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - AnimateEntity(D_80180794, self); - MoveEntity(); - break; - } -} - -// Extending wing spike from succubus ID 0x1E -void EntitySuccubusWingSpike(Entity* self) { - s32 temp_s2; - s16 var_s0; - - if (D_80180664 & 2) { - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_801804E8); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; - self->animCurFrame = 0; - var_s0 = D_801807F0[self->params]; +REDACTED +REDACTED self->rotZ = var_s0; self->drawFlags |= 1; self->rotX = 0x100; - CreateEntityFromEntity(E_SUCCUBUS_WING_SPIKE_TIP, self, &self[1]); +REDACTED self[1].facingLeft = self->facingLeft; - self[1].params = self->params; +REDACTED self[1].rotZ = self->rotZ; - - case 1: - if (self->ext.succubus.real->ext.succubus.unk85 != 0) { - self->step++; - } - break; - - case 2: - self->animCurFrame = 85; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX += 0x40; if (self->rotX > 0x600) { self->rotX = 0x600; - } - - if (self->ext.succubus.real->ext.succubus.unk85 == 0) { - self->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX -= 0x40; if (self->rotX < 0x100) { - DestroyEntity(self); - return; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED var_s0 = self->rotZ; temp_s2 = (self->rotX * 0xB) >> 6; if (self->facingLeft == 0) { - var_s0 = 0x800 - var_s0; - } - - self[1].posX.i.hi = self->posX.i.hi; - self[1].posY.i.hi = self->posY.i.hi; - self[1].posX.i.hi += temp_s2 * rcos(var_s0) >> 0xC; - self[1].posY.i.hi -= temp_s2 * rsin(var_s0) >> 0xC; -} - -void EntitySuccubusWingSpikeTip(Entity* self) { - switch (self->step) { - case 0: - InitializeEntity(D_8018050C); - self->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; - self->hitboxState = 0; - - case 1: - if (self[-1].animCurFrame != 0) { - self->hitboxState = 1; - self->animCurFrame = 86; - } - if (self->hitFlags != 0) { - D_80180668 = 1; - } - if (self[-1].entityId != 0x1E) { - DestroyEntity(self); - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } diff --git a/src/st/dre/succubuscutscene.c b/src/st/dre/succubuscutscene.c index cc0afbccf1..9636761bc6 100644 --- a/src/st/dre/succubuscutscene.c +++ b/src/st/dre/succubuscutscene.c @@ -1,103 +1,103 @@ #include "dre.h" void func_80194774(void) { - g_Dialogue.nextLineX = 2; - g_Dialogue.nextCharX = 2; - g_Dialogue.nextCharY = 0; - g_Dialogue.unk12 = 0; - g_Dialogue.nextCharTimer = 0; - g_Dialogue.unk17 = 8; - g_Dialogue.nextLineY = g_Dialogue.startY + 0x14; -} - -s32 func_801947C8(s32 textDialogue) { - Primitive* prim; - s16 firstPrimIndex; - - firstPrimIndex = g_api.AllocPrimitives(PRIM_SPRT, 7); - g_Dialogue.primIndex[2] = firstPrimIndex; - if (firstPrimIndex == -1) { - g_Dialogue.primIndex[2] = 0; - return 0; - } - g_Dialogue.nextCharDialogue = textDialogue; - g_Dialogue.unk3C = 0; - g_Dialogue.primIndex[1] = -1; - g_Dialogue.primIndex[0] = -1; - func_80194774(); - - if (prim && prim) { // !FAKE - } - - prim = g_Dialogue.prim[0] = &g_PrimBuf[g_Dialogue.primIndex[2]]; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[1] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[2] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[3] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[4] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[5] = prim->next; - - prim->type = 4; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 3; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0xFF; +REDACTED +REDACTED +REDACTED +REDACTED prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0; prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0; - prim->x0 = prim->x2 = 4; - prim->x1 = prim->x3 = 0xF8; - prim->priority = 0x1FD; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 1; - prim->x0 = 3; - prim->y0 = 0x2F; - prim->v0 = 0x4A; - prim->r0 = prim->g0 = prim->b0 = 0xFF; - prim->priority = 0x1FC; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - return 1; -} - -void func_8019498C(s16 yOffset) { - RECT rect; - - rect.y = (yOffset * 12) + 384; - rect.w = 64; - rect.x = 0; - rect.h = 12; - ClearImage(&rect, 0, 0, 0); -} +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801949E8(void) { Primitive* prim; func_8019498C(g_Dialogue.nextCharY); - prim = g_Dialogue.prim[g_Dialogue.nextCharY]; +REDACTED prim->tpage = 0x10; - prim->clut = g_Dialogue.clutIndex; - prim->y0 = g_Dialogue.nextLineY; +REDACTED +REDACTED prim->u0 = 0; - prim->x0 = g_Dialogue.startX; +REDACTED prim->x0 = prim->x0 + 4; - prim->v0 = g_Dialogue.nextCharY * 0xC - 0x80; +REDACTED prim->u1 = 0xC0; prim->v1 = 0xC; prim->priority = 0x1FF; prim->drawMode = DRAW_DEFAULT; } - +REDACTED // This array is in Data, but the strings within it are rodata. That rodata // lives between the jump tables in this file, so we have to import the rodata, // and also the data. @@ -137,7 +137,7 @@ void func_80194AA0(u16 actorIndex, Entity* self) { // Fill prims to render the actor name on screen prim = &g_PrimBuf[primIndex]; - g_Dialogue.primIndex[1] = primIndex; +REDACTED actorName = D_80180938[actorIndex]; x = 0x38; while (prim != NULL) { @@ -155,56 +155,56 @@ void func_80194AA0(u16 actorIndex, Entity* self) { prim->priority = 0x1FF; prim->drawMode = DRAW_HIDE; prim->x0 = x; - prim->y0 = g_Dialogue.startY + 6; +REDACTED prim = prim->next; x += FONT_GAP; } } } - -void func_80194C24(s32 arg0) { - g_Dialogue.unk40 = arg0 + 0x100000; - g_Dialogue.timer = 0; - g_Dialogue.unk3C = 1; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_80194C50(void) { Entity* entity; u16 startTimer; u8 entityIndex; Dialogue* ptr; - g_Dialogue.timer++; +REDACTED // protect from overflows - if (g_Dialogue.timer > 0xFFFE) { - g_Dialogue.unk3C = 0; +REDACTED +REDACTED return; } while (true) { // Start the dialogue script only if the start timer has passed - startTimer = (*g_Dialogue.unk40++ << 8) | *g_Dialogue.unk40++; - if (g_Dialogue.timer < startTimer) { +REDACTED +REDACTED // Re-evaluate the condition at the next frame - g_Dialogue.unk40 -= 2; +REDACTED return; } - switch (*g_Dialogue.unk40++) { +REDACTED case 0: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); - entity->entityId = *g_Dialogue.unk40++; +REDACTED entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1]; - entity->posX.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posX.i.hi = *g_Dialogue.unk40++ | entity->posX.i.hi; - entity->posY.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posY.i.hi = *g_Dialogue.unk40++ | entity->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED break; case 1: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); break; @@ -224,51 +224,51 @@ void func_80194C50(void) { } } } - -void func_80194F14(Entity* self) { - if (g_pads[0].tapped == PAD_START) { - D_801A3ED4 = 1; - g_api.FreePrimitives(self->primIndex); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags ^= FLAG_HAS_PRIMS; if (g_Dialogue.primIndex[1] != -1) { g_api.FreePrimitives(g_Dialogue.primIndex[1]); - } +REDACTED if (g_Dialogue.primIndex[0] != -1) { g_api.FreePrimitives(g_Dialogue.primIndex[0]); - } +REDACTED g_api.PlaySfx(SET_STOP_MUSIC); - self->step = 1; - self->step_s = 0; - } -} - -void func_80194FF4(u8 ySteps) { - Primitive* prim; - s32 primIndex; - s32 i; - - primIndex = g_Dialogue.nextCharY + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED while (primIndex >= 5) { primIndex -= 5; } if (g_CurrentEntity->step_s == 0) { - prim = g_Dialogue.prim[primIndex]; +REDACTED prim->v1 -= ySteps; prim->v0 += ySteps; if (prim->v1 == 0) { g_CurrentEntity->step_s++; prim->drawMode = DRAW_HIDE; - } - } - - for (i = 0; i < 5; i++) { - if (i != primIndex) { - prim = g_Dialogue.prim[i]; - prim->y0 -= ySteps; - } - } - g_Dialogue.portraitAnimTimer++; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // dialogue with mother opens as alucard walks right ID 20 // Same pattern as a lot of other cutscenes, main differences diff --git a/src/st/mad/11D3C.c b/src/st/mad/11D3C.c index 79fd15a602..d22d6070e6 100644 --- a/src/st/mad/11D3C.c +++ b/src/st/mad/11D3C.c @@ -18,22 +18,22 @@ #include "../fall_entity.h" -u8 func_8019214C(void) { - u8 unkState; - Entity* entity; +REDACTED +REDACTED +REDACTED MoveEntity(); FallEntity(); entity = g_CurrentEntity; - - if (unkState & 1) { +REDACTED +REDACTED entity->velocityY = 0; - } - - return unkState; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "../unk_collision_func3.h" INCLUDE_ASM("asm/us/st/mad/nonmatchings/11D3C", func_80192408); @@ -77,7 +77,7 @@ void EntityExplosionSpawn(u16 arg0, u16 arg1) { g_api.PlaySfx(arg1); } if (arg0 == 0xFF) { - DestroyEntity(g_CurrentEntity); +REDACTED return; } @@ -85,7 +85,7 @@ void EntityExplosionSpawn(u16 arg0, u16 arg1) { entity->drawFlags = 0; entity->entityId = E_EXPLOSION; entity->pfnUpdate = (PfnEntityUpdate)EntityExplosion; - entity->params = arg0; +REDACTED entity->animCurFrame = 0; g_CurrentEntity->step = 0; g_CurrentEntity->step_s = 0; diff --git a/src/st/mad/15520.c b/src/st/mad/15520.c index b090bb5fe5..4170fa32ca 100644 --- a/src/st/mad/15520.c +++ b/src/st/mad/15520.c @@ -46,7 +46,7 @@ void EntityHeartDrop(Entity* self) { #include "../entity_olrox_drool.h" -bool func_80195E68(Point16* unk) { +REDACTED Collider collider; FallEntity(); @@ -243,9 +243,9 @@ u8 func_80195F64(s32 arg0) { } #include "../entity_intense_explosion.h" - -void func_801965E4(Entity* entity) { - if (entity->step == 0) { +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); entity->unk6C = 0xF0; entity->rotX = 0x1A0; @@ -254,18 +254,18 @@ void func_801965E4(Entity* entity) { entity->animCurFrame = 1; entity->zPriority += 0x10; - if (entity->params != 0) { - entity->palette = entity->params; - } else { - entity->palette = 0x8160; - } - - entity->step++; - return; - } - - MoveEntity(); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!AnimateEntity(D_80181010, entity)) { DestroyEntity(entity); } @@ -372,17 +372,17 @@ void EntityRoomForeground(Entity* entity) { if (entity->step == 0) { InitializeEntity(g_eInitGeneric2); entity->animSet = obj->animSet; - entity->zPriority = obj->zPriority; +REDACTED entity->unk5A = obj->unk5A; entity->palette = obj->palette; entity->drawFlags = obj->drawFlags; entity->drawMode = obj->drawMode; if (obj->unkC != 0) { entity->flags = obj->unkC; - } - } - AnimateEntity(obj->unk10, entity); -} +REDACTED +REDACTED +REDACTED +REDACTED // Different from other overlays, but identical to the one in Weapon 21. void BottomCornerText(u8* str, u8 lowerLeft) { @@ -443,7 +443,7 @@ void BottomCornerText(u8* str, u8 lowerLeft) { prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims]; prim->type = 3; - prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 = +REDACTED prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0; if (lowerLeft) { prim->b0 = prim->b1 = 0xAF; diff --git a/src/st/mad/D8C8.c b/src/st/mad/D8C8.c index e02f26efc1..924677bc16 100644 --- a/src/st/mad/D8C8.c +++ b/src/st/mad/D8C8.c @@ -166,16 +166,16 @@ void func_8018E674(Entity* self) { } void EntityBreakable(Entity* entity) { - u16 breakableType = entity->params >> 0xC; - if (entity->step) { +REDACTED +REDACTED AnimateEntity(g_eBreakableAnimations[breakableType], entity); if (entity->unk44) { // If the candle is destroyed - Entity* entityDropItem; +REDACTED g_api.PlaySfx(SFX_CANDLE_HIT); entityDropItem = AllocEntity(&g_Entities[224], &g_Entities[256]); if (entityDropItem != NULL) { CreateEntityFromCurrentEntity(E_EXPLOSION, entityDropItem); - entityDropItem->params = +REDACTED g_eBreakableExplosionTypes[breakableType]; } ReplaceBreakableWithItemDrop(entity); diff --git a/src/st/mad/st_update.c b/src/st/mad/st_update.c index d6525c7985..67852aef00 100644 --- a/src/st/mad/st_update.c +++ b/src/st/mad/st_update.c @@ -12,7 +12,7 @@ void UpdateStageEntities(void) { if (!entity->pfnUpdate) continue; - if (entity->step) { +REDACTED if (D_80096ED0_mad && !(entity->flags & FLAG_UNK_10000)) continue; if (entity->flags & 0xF) { @@ -26,7 +26,7 @@ void UpdateStageEntities(void) { } } - g_CurrentEntity = entity; +REDACTED entity->pfnUpdate(entity); entity->unk44 = 0; entity->hitFlags = 0; diff --git a/src/st/no3/377D4.c b/src/st/no3/377D4.c index 590101992f..0227b1a9b1 100644 --- a/src/st/no3/377D4.c +++ b/src/st/no3/377D4.c @@ -1,10 +1,10 @@ -/* - * File: 377D4.c - * Overlay: NO3 - * Description: Castle Entrance - */ - -#include "no3.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" // vase in the room with the door to the caverns @@ -28,29 +28,29 @@ void EntityCavernDoorVase(Entity* self) { AnimateEntity(objInit->unk10, self); } -void EntityUnkId12(Entity* entity) { - s32 ret; +REDACTED +REDACTED u16* temp_v0_2; - u16 temp_s1 = entity->params; +REDACTED u16 phi_v1; u16 unk; - +REDACTED entity->unk6D[0] = 0; - - if (entity->step != 0) { - switch (temp_s1) { - case 4: - case 5: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Tilemap.x != 0) { return; } break; - +REDACTED case 6: if (g_pads->pressed & PAD_TRIANGLE) { g_Tilemap.x = 0; g_Tilemap.width = 1280; - entity->step++; +REDACTED return; } break; @@ -58,32 +58,32 @@ void EntityUnkId12(Entity* entity) { if (entity->unk44 != 0) { ret = GetSideToPlayer(); - phi_v1 = entity->ext.generic.unk7C.s; +REDACTED if (phi_v1 != 0) { - phi_v1 = (ret & 2) * 2; +REDACTED } else { - phi_v1 = (ret & 1) * 4; +REDACTED } - unk = 8; - temp_s1 = (temp_s1 * unk) + phi_v1; - temp_v0_2 = &D_80180DD0[temp_s1]; +REDACTED +REDACTED +REDACTED g_Tilemap.x = *(temp_v0_2++); g_Tilemap.y = *(temp_v0_2++); g_Tilemap.width = *(temp_v0_2++); g_Tilemap.height = *(temp_v0_2++); - } - } else { - InitializeEntity(D_80180AF4); - entity->ext.generic.unk7C.s = D_80180DC8[temp_s1]; - if (entity->ext.generic.unk7C.s != 0) { - entity->hitboxWidth = D_80180DC0[temp_s1]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxHeight = 16; } else { entity->hitboxWidth = 16; - entity->hitboxHeight = D_80180DC0[temp_s1]; - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED extern u16 g_eBreakableInit[]; extern u8* g_eBreakableAnimations[8]; @@ -92,16 +92,16 @@ extern u8 g_eBreakableExplosionTypes[]; extern u16 g_eBreakableanimSets[]; extern u8 g_eBreakableDrawModes[]; void EntityBreakable(Entity* entity) { - u16 breakableType = entity->params >> 0xC; - if (entity->step) { +REDACTED +REDACTED AnimateEntity(g_eBreakableAnimations[breakableType], entity); if (entity->unk44) { // If the candle is destroyed - Entity* entityDropItem; +REDACTED g_api.PlaySfx(SFX_CANDLE_HIT); entityDropItem = AllocEntity(&g_Entities[224], &g_Entities[256]); if (entityDropItem != NULL) { CreateEntityFromCurrentEntity(E_EXPLOSION, entityDropItem); - entityDropItem->params = +REDACTED g_eBreakableExplosionTypes[breakableType]; } ReplaceBreakableWithItemDrop(entity); @@ -115,14 +115,14 @@ void EntityBreakable(Entity* entity) { } } -void EntityUnkId16(Entity* self) { - switch (self->step) { +REDACTED +REDACTED case 0: InitializeEntity(D_80180AD0); - self->ext.generic.unk7C.S8.unk0 = 16; - self->ext.generic.unk7C.S8.unk1 = 8; - self->ext.generic.unk7E.modeU8.unk0 = 56; - +REDACTED +REDACTED +REDACTED +REDACTED case 1: g_GpuBuffers[0].draw.r0 = self->ext.generic.unk7C.S8.unk0; g_GpuBuffers[0].draw.g0 = self->ext.generic.unk7C.S8.unk1; @@ -138,255 +138,255 @@ void EntityUnkId16(Entity* self) { INCLUDE_ASM("st/no3/nonmatchings/377D4", EntityBackgroundLightning); // window that opens and shuts in the background -void EntityShuttingWindow(Entity* self) { - Primitive* prim; - s16 primIndex; - SVECTOR svec; - SVEC4* svec4; - VECTOR vec; - MATRIX mtx; - s32 flag; - s32 p; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.shuttingWindow.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0xF; - prim->clut = 0xD; - prim->u0 = prim->u2 = 0x9C; - prim->u1 = prim->u3 = 0x84; - prim->v1 = 4; - prim->v0 = 4; - prim->v2 = prim->v3 = 0x7C; - prim->priority = 0x5F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - } - - case 1: - self->ext.shuttingWindow.unk80 += 8; - if (self->ext.shuttingWindow.unk80 > 0x300) { - self->ext.shuttingWindow.unk80 = 0x300; - self->ext.shuttingWindow.unk82 = 0; - self->step++; - } - break; - - case 2: - self->ext.shuttingWindow.unk80 += self->ext.shuttingWindow.unk82; - self->ext.shuttingWindow.unk82 -= 4; - if (self->ext.shuttingWindow.unk80 < 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(SE_NO3_WINDOW_CLOSE); - self->ext.shuttingWindow.unk80 = 0; - self->ext.shuttingWindow.timer = 32; - self->step++; - } - break; - - case 3: - if (--self->ext.shuttingWindow.timer == 0) { - self->step = 1; - } - break; - } - SetGeomScreen(0x400); - SetGeomOffset(self->posX.i.hi, self->posY.i.hi); - - svec4 = D_80181024; - prim = self->ext.shuttingWindow.prim; - - for (i = 0; i < 2; svec4++, i++) { - svec.vx = 0; - if (i != 0) { - svec.vy = self->ext.shuttingWindow.unk80; - } else { - svec.vy = -self->ext.shuttingWindow.unk80; - } - svec.vz = 0; - RotMatrix(&svec, &mtx); - if (i == 0) { - vec.vx = -0x18; - } else { - vec.vx = 0x19; - } - vec.vy = 0; - vec.vz = 0x400; - TransMatrix(&mtx, &vec); - SetRotMatrix(&mtx); - SetTransMatrix(&mtx); - RotTransPers4(svec4->v0, svec4->v1, svec4->v2, svec4->v3, - (long*)&prim->x0, (long*)&prim->x1, (long*)&prim->x2, - (long*)&prim->x3, (long*)&p, (long*)&flag); - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // main door to the castle that closes during intro -void EntityCastleDoor(Entity* self) { - SVECTOR sVec1; - VECTOR vec1; - MATRIX mtx1; - MATRIX mtx2; - CVECTOR cVec1; - CVECTOR cVec2; - SVECTOR sVec2; - long sxy2, sxy3, p; - Primitive* prim; - SVECTOR** var_s5; - SVEC4* var_s6; - s16 primIndex; - s32 temp_s3; - s32 tilePos; - s32 i; - u16* tilePtr; - u8* var_a0; - - sVec2 = D_801B73E0; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 3); +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; - var_a0 = D_80181118; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.castleDoor.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - for (i = 0; i < 3; i++) { - prim->tpage = 0xF; - prim->clut = 0x41; - prim->priority = 0x6A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - //! FAKE: - tilePos = prim->u2 = *var_a0++; - prim->u0 = tilePos; - - prim->u1 = prim->u3 = *var_a0; - prim->v0 = prim->v1 = 1; - prim->v2 = prim->v3 = 0x81; - prim = prim->next; - var_a0++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[52] != 0) { self->ext.castleDoor.rotZ = 0; - self->step = 5; - } - break; - - case 1: - tilePos = 0x445; - for (i = 0, tilePtr = D_80181120; i < 8; tilePtr++, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tilePtr; - tilePos += 0x20; - } +REDACTED +REDACTED self->ext.castleDoor.rotZ = -0x380; - self->ext.castleDoor.timer = 32; - self->step = 4; +REDACTED +REDACTED g_CastleFlags[52] = 1; - break; - - case 2: +REDACTED +REDACTED +REDACTED self->ext.castleDoor.rotZ -= 8; if (self->ext.castleDoor.rotZ < -0x380) { self->ext.castleDoor.rotZ = -0x380; - self->ext.castleDoor.timer = 128; - self->step++; - } - break; - - case 3: - if (--self->ext.castleDoor.timer == 0) { - self->step++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.castleDoor.rotZ += 0x10; if (self->ext.castleDoor.rotZ > 0) { self->ext.castleDoor.rotZ = 0; - self->step += 2; +REDACTED g_api.PlaySfx(SFX_START_SLAM_B); - tilePos = 0x445; - for (i = 0, tilePtr = D_80181130; i < 8; tilePtr++, i++) { +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tilePtr; - tilePos += 0x20; - } - } - break; - - case 5: - self->step++; - tilePos = 0x445; - for (i = 0, tilePtr = D_80181130; i < 8; tilePtr++, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tilePtr; - tilePos += 0x20; - } - break; - } - SetGeomScreen(768); - SetGeomOffset(self->posX.i.hi, self->posY.i.hi); - sVec1.vx = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED sVec1.vy = self->ext.castleDoor.rotZ; - sVec1.vz = 0; - RotMatrix(&sVec2, &mtx1); - RotMatrixY(sVec1.vy, &mtx1); - vec1.vx = 0; - vec1.vy = 0; - vec1.vz = 0x334; - TransMatrix(&mtx1, &vec1); - SetRotMatrix(&mtx1); - SetTransMatrix(&mtx1); - SetBackColor(128, 128, 128); - cVec1.b = cVec1.g = cVec1.r = 128; - cVec1.cd = 4; - cVec2.b = cVec2.g = cVec2.r = 64; - cVec2.cd = 4; - RotMatrix(&sVec1, &mtx2); - SetColorMatrix(&D_801810D4); - SetLightMatrix(&mtx2); - - prim = self->ext.prim; - var_s6 = &D_801810A4; - var_s5 = &D_8018110C; - for (i = 0; i < 3; var_s6++, var_s5++, i++) { - temp_s3 = RotAverageNclip4( - var_s6->v0, var_s6->v1, var_s6->v2, var_s6->v3, (long*)&prim->x0, - (long*)&prim->x1, (long*)&prim->x2, (long*)&prim->x3, &sxy2, &sxy3, - &p); - NormalColorCol(*var_s5, &cVec1, (CVECTOR*)&prim->r0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); - - if (i != 0) { - NormalColorCol(*var_s5, &cVec2, (CVECTOR*)&prim->r0); - LOW(prim->r2) = LOW(prim->r0); - } - - if (temp_s3 <= 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - } else { +REDACTED prim->drawMode = 6; - } - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED +REDACTED extern u16 D_80180B18[]; extern SVECTOR D_801811E8; @@ -420,19 +420,19 @@ void EntityBackgroundBushes(Entity* self) { InitializeEntity(D_80180B18); primIndex = g_api.AllocPrimitives(PRIM_GT4, 0x48); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->flags |= FLAG_HAS_PRIMS; self->primIndex = primIndex; - prim = &g_PrimBuf[primIndex]; +REDACTED self->ext.prim = prim; - while (prim != NULL) { - prim->tpage = 0xF; +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - } +REDACTED +REDACTED +REDACTED SetGeomScreen(0x400); SetGeomOffset(0x80, self->posY.i.hi); RotMatrix(&D_801811E8, &m); @@ -508,189 +508,189 @@ void EntityBackgroundBushes(Entity* self) { } while (prim != NULL) { prim->drawMode = DRAW_HIDE; - prim = prim->next; - } -} - -void EntityUnkId1C(Entity* self, s16 primIndex) { - volatile char pad[8]; //! FAKE - Primitive* prim; - VECTOR vec; - MATRIX mtx; - long sxy; - long p; - long flag; - s32 temp_s3; - s32 temp_a1; - s32 temp_a2; - s32 var_v1; - - if (self->step == 0) { +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 32); +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0xF; - prim->clut = D_801811E0[self->params % 16]; - prim->u0 = prim->u2 = 0xBF; - prim->u1 = prim->u3 = 0xFF; - prim->v0 = prim->v1 = 0x80; - prim->v2 = prim->v3 = 0xB8; - prim->priority = 0x5A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - } - var_v1 = D_801811D0[self->params % 16][0]; - temp_s3 = var_v1; - - SetGeomScreen(0x400); - if (self->params & 0x100) { - SetGeomOffset(0x80, 0x98); - } else { - SetGeomOffset(0x80, 0x80); - } - - RotMatrix(D_801811F0, &mtx); - vec.vx = self->posX.i.hi - 128; - vec.vy = self->posY.i.hi - 128; - vec.vz = temp_s3 + 0x400; - TransMatrix(&mtx, &vec); - SetRotMatrix(&mtx); - SetTransMatrix(&mtx); - RotTransPers(D_801811F0, &sxy, &p, &flag); - temp_a1 = sxy & 0xFFFF; - temp_a2 = sxy >> 0x10; - - if (temp_a1 < 0) { - var_v1 = temp_a1 + 0x3F; - } else { - var_v1 = temp_a1; - } - - prim = self->ext.prim; - temp_a1 -= (var_v1 >> 6) << 6; - temp_a1 -= 64; - temp_a1 -= D_801811D0[self->params % 16][1]; - while (temp_a1 < 320) { - prim->x1 = prim->x3 = temp_a1 + 64; - prim->x0 = prim->x2 = temp_a1; - prim->y0 = prim->y1 = temp_a2 - 56; - prim->y2 = prim->y3 = temp_a2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - temp_a1 += 64; - } - - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED // transparent water "plane" seen in the merman room -void EntityTransparentWater(Entity* self) { - Primitive* prim; - s16 primIndex; - u32 temp_a0; - s16 temp_t1; - s32 temp_v0; - u8* temp_v1; - u8* var_a0; - u8 temp_t2; - s32 var_a3; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->ext.transparentWater.unk80 = 4; - primIndex = g_api.AllocPrimitives(PRIM_GT4, 16); +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.transparentWater.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0xF; - prim->clut = 0x18; - prim->priority = 0xB0; +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - prim = prim->next; - } - break; - - case 1: - var_a0 = &D_801811F8; - while (*var_a0 != 0xFF) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[var_a0[0]] = g_ClutIds[var_a0[2] + 0x200]; - var_a0 += 4; - } - - if (--self->ext.transparentWater.unk80 == 0) { - self->ext.transparentWater.unk80 = 4; - self->step++; - } - break; - - case 2: - var_a0 = &D_801811F8; - while (*var_a0 != 0xFF) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[var_a0[0]] = g_ClutIds[var_a0[3] + 0x200]; - var_a0 += 4; - } - - if (--self->ext.transparentWater.unk80 == 0) { - self->ext.transparentWater.unk80 = 4; - self->step--; - } - break; - } - - AnimateEntity(D_80181224, self); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED var_a3 = -1 * g_Tilemap.scrollX.i.hi % 38; - var_a3 += 304; - if (self->params != 0) { - var_a3 = 96; - } - - prim = self->ext.transparentWater.prim; - temp_a0 = self->posY.i.hi; - temp_v1 = D_80181218; - temp_v1 += 4 * self->animCurFrame; - temp_v0 = temp_v1[0]; - temp_v1 = temp_v1[1]; - while (var_a3 > 0) { - temp_t2 = temp_v0 + 0x26; - temp_t1 = temp_v1 + 0x3E; - prim->x1 = prim->x3 = var_a3; - var_a3 -= 0x26; - prim->x0 = prim->x2 = var_a3; - prim->u0 = prim->u2 = temp_v0; - prim->u1 = prim->u3 = temp_t2; - prim->v0 = prim->v1 = temp_v1; - prim->v2 = prim->v3 = temp_t1; - prim->y0 = prim->y1 = temp_a0; - prim->y2 = prim->y3 = temp_a0 + 0x3E; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - prim = prim->next; - } - - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED void func_801B94F0(Primitive* prim) { s32 xVar; @@ -736,59 +736,59 @@ void func_801B94F0(Primitive* prim) { } // lever and platform to open caverns door -void EntityCavernDoorLever(Entity* entity) { - s32 posX; - s32 posY; - +REDACTED +REDACTED +REDACTED +REDACTED switch (entity->step) { case 0: InitializeEntity(D_80180B18); - entity->animCurFrame = 18; +REDACTED entity->rotZ = -0x200; entity->drawFlags |= 4; - CreateEntityFromEntity(0x1E, entity, &entity[1]); +REDACTED if (g_CastleFlags[0x30] != 0) { entity->rotZ = 0; - } - - case 1: - if (entity[1].ext.generic.unk84.S8.unk0 != 0) { +REDACTED +REDACTED +REDACTED +REDACTED entity->rotZ += 4; if (entity->rotZ > 0) { entity->rotZ = 0; if (g_CastleFlags[0x30] == 0) { g_api.PlaySfx(SFX_LEVER_METAL_BANG); - } +REDACTED g_CastleFlags[0x30] = 1; } else if (!(g_Timer & 0xF)) { g_api.PlaySfx(SFX_LEVER_METAL_BANG); - } - } - break; - } - - posX = entity->posX.val; - posY = entity->posY.val; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX += rcos(entity->rotZ) * 0x280; posY += rsin(entity->rotZ) * 0x280; - entity[1].posX.val = posX; - entity[1].posY.val = posY; -} +REDACTED +REDACTED +REDACTED // platform attached to lever at cavern door -void EntityCavernDoorPlatform(Entity* self) { - Entity* player; +REDACTED +REDACTED s32 xDiff; s32 collision; - switch (self->step) { - case 0: +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = 17; +REDACTED self->ext.cavernDoor.xCoord.val = self->posX.val; self->ext.cavernDoor.xCoord.val = self->posX.val; // ? WTF - - case 1: +REDACTED +REDACTED collision = GetPlayerCollisionWith(self, 6, 5, 4); self->ext.cavernDoor.collision = collision; @@ -800,36 +800,36 @@ void EntityCavernDoorPlatform(Entity* self) { } self->ext.cavernDoor.xCoord.val = self->posX.val; self->ext.cavernDoor.yCoord.val = self->posY.val; - } -} - -// door blocking way to the Underground Caverns -void EntityCavernDoor(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 primIndex; s16* tileLayoutPtr; - Entity* entity; +REDACTED Primitive* prim; - s32 i; +REDACTED s32 tilePos; s32 tileSteps; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = 10; - self->zPriority = 0x9F; - - tileLayoutPtr = &D_80181230[0]; +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[48]) { - self->step = 128; - self->animCurFrame = 0; +REDACTED +REDACTED tileLayoutPtr += 3; - } else { +REDACTED primIndex = g_api.AllocPrimitives(PRIM_TILE, 64); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->flags |= FLAG_HAS_PRIMS; self->primIndex = primIndex; prim = &g_PrimBuf[primIndex]; @@ -843,46 +843,46 @@ void EntityCavernDoor(Entity* self) { prim->drawMode = DRAW_HIDE; prim->p3 = 0; prim = prim->next; - } - } - - for (tilePos = 0x76, i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr++; - tilePos += 0x10; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[48]) { g_api.PlaySfx(SFX_SWITCH_CLICK); - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(0.375); self->ext.cavernDoor.jiggler++; // While the door opens, it jiggles left and right by repeatedly // incrementing and decrementing its x position. if (self->ext.cavernDoor.jiggler & 1) { - self->posX.i.hi++; - } else { - self->posX.i.hi--; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED tileSteps = (self->posY.i.hi - 136); tileSteps /= 16; if (tileSteps > 3) { tileSteps = 3; - self->step = 3; - } +REDACTED +REDACTED tilePos = 0x76; - tileLayoutPtr = &D_80181230[0]; +REDACTED tileLayoutPtr += 3; for (i = 0; i < tileSteps; tilePos += 0x10, i++) { g_Tilemap.fg[tilePos] = *tileLayoutPtr++; - } - +REDACTED +REDACTED if (g_Timer & 1) { break; } @@ -891,14 +891,14 @@ void EntityCavernDoor(Entity* self) { if (prim != NULL) { prim->p3 = 1; } - +REDACTED if (g_Timer & 15) { break; } - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); +REDACTED if (entity == NULL) { break; - } +REDACTED CreateEntityFromEntity(6, self, entity); entity->posY.i.hi = 156; entity->posX.i.hi += -8 + (Random() & 15); @@ -906,827 +906,827 @@ void EntityCavernDoor(Entity* self) { entity->params = 0x10; entity->drawFlags |= (FLAG_DRAW_ROTX + FLAG_DRAW_ROTY); entity->rotX = entity->rotY = 192; - break; - } - +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { for (prim = self->ext.cavernDoor.prim; prim != NULL; prim = prim->next) { if (prim->p3) { func_801B94F0(prim); - } - } - } -} - -typedef enum { WEIGHT_SMALL, WEIGHT_TALL } WeightSelect; - -void func_801B9C44(WeightSelect weight) { - s32 posY = g_CurrentEntity->posY.i.hi; - s32 posX = g_CurrentEntity->posX.i.hi; - Primitive* prim; - - if (weight != WEIGHT_SMALL) { - posY -= 64; - } else { - posY -= 16; - } - - prim = *(s32*)&g_CurrentEntity->ext.generic.unk7C; - - while (posY > 0) { - prim->y2 = prim->y3 = posY; - prim->x0 = prim->x2 = posX - 8; - prim->x1 = prim->x3 = posX + 8; - posY -= 32; - prim->y0 = prim->y1 = posY; +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - } - posY -= 32; - - while (prim != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED // switch that clicks when you step on it -void EntityClickSwitch(Entity* entity) { +REDACTED s32 temp_a0 = GetPlayerCollisionWith(entity, 8, 4, 4); - Entity* player = &PLAYER; - +REDACTED +REDACTED switch (entity->step) { case 0: InitializeEntity(D_80180B18); - entity->animCurFrame = 9; - entity->zPriority = 0x5E; +REDACTED +REDACTED if (g_CastleFlags[0x31] != 0) { - entity->step = 2; - entity->posY.i.hi += 4; - } - break; - - case 1: - if (temp_a0 != 0) { - player->posY.i.hi++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val += FIX(0.75); if ((g_Tilemap.scrollY.i.hi + entity->posY.i.hi) > 160) { entity->posY.i.hi = 160 - g_Tilemap.scrollY.i.hi; g_api.PlaySfx(SFX_SWITCH_CLICK); g_CastleFlags[0x31] = 1; - entity->step++; - } - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // smaller weight blocking path near cube of zoe -void EntityPathBlockSmallWeight(Entity* self) { +REDACTED s16 primIndex; - POLY_GT4* poly; - s32 var_a1; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = 8; - self->zPriority = 0x5E; - +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex == -1) { - DestroyEntity(self); - return; - } - +REDACTED +REDACTED +REDACTED +REDACTED poly = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - *(s32*)&self->ext.generic.unk7C = poly; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - while (poly != NULL) { - poly->tpage = 0xF; - poly->clut = 0x22; - poly->u0 = poly->u2 = 224; - poly->u1 = poly->u3 = 240; - poly->v0 = poly->v1 = 84; - poly->v2 = poly->v3 = 116; - poly->pad2 = self->zPriority + 1; - poly->pad3 = 8; - poly = (POLY_GT4*)poly->tag; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step = 3; - self->posY.i.hi += 111; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(0.5); if ((self->posY.i.hi + g_Tilemap.scrollY.i.hi) >= 175) { self->posY.i.hi = 175 - g_Tilemap.scrollY.i.hi; - self->step++; - } - break; - - case 3: - for (var_a1 = 0x179, i = 0; i < 2; var_a1 -= 0x20, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[var_a1] = 0x4FA; g_Tilemap.fg[var_a1 + 1] = 0x4FA; - } - self->step++; - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->step < 3 && GetPlayerCollisionWith(self, 16, 16, 5) & 4) { - Entity* player = &PLAYER; - - player->posY.i.hi++; - } - func_801B9C44(WEIGHT_SMALL); -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // taller weight blocking path near cube of zoe -void EntityPathBlockTallWeight(Entity* self) { - POLY_GT4* poly; +REDACTED +REDACTED s16 primIndex; - s32 temp_a2; - s32 var_a1; - s32 var_v0; - s32 temp; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = 7; - self->zPriority = 0x5E; - +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED poly = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - *(s32*)&self->ext.generic.unk7C = poly; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - while (poly != NULL) { - poly->tpage = 0xF; - poly->clut = 0x22; - poly->u0 = poly->u2 = 224; - poly->u1 = poly->u3 = 240; - poly->v0 = poly->v1 = 84; - poly->v2 = poly->v3 = 116; - poly->pad2 = self->zPriority + 1; - poly->pad3 = 8; - poly = (POLY_GT4*)poly->tag; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step = 3; - self->posY.i.hi -= 128; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val -= FIX(0.5); temp = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - if (temp <= -16) { +REDACTED self->posY.i.hi = -16 - g_Tilemap.scrollY.i.hi; - self->step++; - } - break; - } - - func_801B9C44(WEIGHT_TALL); - do { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - } while (0); - var_v0 = 112 - temp; - var_a1 = 0x157; - - if (var_v0 < 0) { - var_v0 += 15; - } - - for (temp_a2 = var_v0 >> 4, i = 0; i < temp_a2; var_a1 -= 0x20, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[var_a1] = 0; g_Tilemap.fg[var_a1 + 1] = 0; - } - - for (temp_a2 = 8 - temp_a2, i = 0; i < temp_a2; var_a1 -= 0x20, i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[var_a1] = 0x4FA; g_Tilemap.fg[var_a1 + 1] = 0x4FA; - } -} +REDACTED +REDACTED // trap door that leads to underground garden in saturn version. // also opens the one leading to the save room -void EntityTrapDoor(Entity* entity) { +REDACTED switch (entity->step) { case 0: InitializeEntity(D_80180B18); - entity->animCurFrame = 27; - entity->zPriority = 0x6A; - entity->hitboxWidth = 16; - entity->hitboxHeight = 4; +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxState = 1; - - if (g_TrapDoorFlag == 0) { - if (PLAYER.posY.val < entity->posY.val) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0xA8E / 2] = 0x129; g_Tilemap.fg[0xA90 / 2] = 0x132; - DestroyEntity(entity); - break; - } +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0xA8E / 2] = 0x6C8; g_Tilemap.fg[0xA90 / 2] = 0x6C9; - } else { - entity->animCurFrame = 30; +REDACTED +REDACTED g_Tilemap.fg[0xA8E / 2] = 0x6C8; g_Tilemap.fg[0xA90 / 2] = 0x6C9; - entity->step = 128; - } - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (entity->hitFlags != 0) { - g_TrapDoorFlag = 1; - entity->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80181240, entity); - } -} +REDACTED +REDACTED // left side of the breakable rock, drops pot roast -void EntityMermanRockLeftSide(Entity* self) { - const int jewelSwordRoomUnlock = 51; - const int rockBroken = (1 << 0); - const int wolfFlag = (1 << 2); - u16* tileLayoutPtr; - Entity* newEntity; - s32 tilePos; - u8* params; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->hitboxState = 2; - self->hitboxWidth = 16; - self->hitboxHeight = 24; - - tileLayoutPtr = &D_8018127C; - tilePos = 0x1F1; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_BgLayers[0].layout[tilePos] = *tileLayoutPtr; g_BgLayers[0].layout[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[jewelSwordRoomUnlock] & rockBroken) { - tileLayoutPtr = &D_80181264; - tilePos = 0x1F1; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } +REDACTED +REDACTED +REDACTED self->hitboxState = 1; - self->step = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { - tileLayoutPtr = &D_80181258[self->ext.generic.unk84.S16.unk0 * 6]; - tilePos = 0x1F1; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x13; - newEntity->zPriority = 0xA9; - newEntity->posX.i.hi += self->ext.generic.unk84.S16.unk0 * 16; - newEntity->posY.i.hi += 16; - } - - params = &D_80181344[self->ext.generic.unk84.S16.unk0 * 3]; - - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FALLING_ROCK_2, self, newEntity); - newEntity->params = *params++; +REDACTED +REDACTED +REDACTED newEntity->velocityX = -0x8000 - (Random() << 8); newEntity->velocityY = -Random() * 0x100; - newEntity->posY.i.hi += -16 + (i * 16); - } - } - self->ext.generic.unk84.S16.unk0++; - } - - if (self->ext.generic.unk84.S16.unk0 >= 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { - CreateEntityFromEntity(E_EQUIP_ITEM_DROP, self, newEntity); - newEntity->params = ITEM_POT_ROAST; - } +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= rockBroken; self->hitboxState = 1; - self->step++; - } - break; - - case 2: - if ((self->hitFlags != 0) && - (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= wolfFlag; - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED // right side of the merman room rock, breaks when hit -void EntityMermanRockRightSide(Entity* self) { - const int jewelSwordRoomUnlock = 51; - const int rockBroken = (1 << 1); - const int batFlag = (1 << 3); - u16* tileLayoutPtr; - Entity* newEntity; - s32 tilePos; - u8* params; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->hitboxState = 2; - self->hitboxWidth = 16; - self->hitboxHeight = 24; - - tileLayoutPtr = &D_801812B8; - tilePos = 0x1FD; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_BgLayers[0].layout[tilePos] = *tileLayoutPtr; g_BgLayers[0].layout[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[jewelSwordRoomUnlock] & rockBroken) { - tileLayoutPtr = &D_801812A0; - tilePos = 0x1FD; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } +REDACTED +REDACTED +REDACTED self->hitboxState = 1; - self->step = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { - tileLayoutPtr = &D_80181294[(self->ext.generic.unk84.S16.unk0 * 6)]; - tilePos = 0x1FD; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(2, self, newEntity); - newEntity->params = 0x13; - newEntity->zPriority = 0xA9; - newEntity->posX.i.hi -= self->ext.generic.unk84.S16.unk0 * 16; - newEntity->posY.i.hi += 16; - } - - params = &D_80181344[self->ext.generic.unk84.S16.unk0 * 3]; - - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FALLING_ROCK_2, self, newEntity); - newEntity->params = *params++; +REDACTED +REDACTED +REDACTED newEntity->velocityX = (Random() << 8) + 0x8000; newEntity->velocityY = -Random() * 0x100; newEntity->facingLeft = 1; - newEntity->posY.i.hi += -16 + (i * 16); - } - } - self->ext.generic.unk84.S16.unk0++; - } - - if (self->ext.generic.unk84.S16.unk0 >= 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= rockBroken; self->hitboxState = 1; - self->step++; - } - break; - - case 2: - if ((self->hitFlags != 0) && - (g_Player.unk0C & PLAYER_STATUS_BAT_FORM)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= batFlag; - } - break; - } -} - -void EntityUnkId26(Entity* self) { - u16* tileLayoutPtr; - s32 tileLayoutPos; - s32 i; - s32 j; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); if (g_CastleFlags[58] != 0) { - self->step = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((g_CastleFlags[51] & 12) == 12) { PlaySfxPositional(SFX_WALL_DEBRIS_B); - self->step++; - } - break; - - case 2: - for (tileLayoutPtr = &D_801812E2, i = 0; i < 3; i++) { - tileLayoutPos = 0x420 + i; - for (j = 0; j < 5; tileLayoutPos += 0x30, j++, tileLayoutPtr++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tileLayoutPos] = *tileLayoutPtr; - } - } - - for (tileLayoutPtr = &D_8018131E, i = 0; i < 3; i++) { - tileLayoutPos = 0x420 + i; - for (j = 0; j < 5; j++, tileLayoutPtr++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_BgLayers[0].layout[tileLayoutPos] = *tileLayoutPtr; - tileLayoutPos += 0x30; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[58] |= 1; - g_api.func_800F1FC4(0x3A); - self->step++; - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // falling rock that breaks into dust -void EntityFallingRock2(Entity* self) { - s32 animFrame = self->params & 0xF; +REDACTED +REDACTED Collider collider; - Entity* newEntity; - s32 temp_a0; - s32 var_a1; - s32 new_var2; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = animFrame; - self->animCurFrame += 31; - self->zPriority = 0x9F; +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); self->rotZ -= 0x20; - new_var2 = self->posY.i.hi; - new_var2 += D_8018133C[animFrame]; - g_api.CheckCollision(self->posX.i.hi, new_var2, &collider, 0); - +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { if (self->velocityY > FIX(4.0)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { - CreateEntityFromEntity(2, self, newEntity); - newEntity->params = 0x11; - if (animFrame == 0) { - newEntity->params = 0x13; - } - } - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.i.hi = self->posY.i.hi + collider.unk18; temp_a0 = -self->velocityY; self->velocityY = -self->velocityY; - if (temp_a0 < 0) { - var_a1 = temp_a0 + 7; - } else { - var_a1 = temp_a0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = temp_a0 - (var_a1 >> 3); - } - break; - } -} - -// ID 0x5C -// Stairway piece you can break before Death encounter -void EntityStairwayPiece(Entity* self, u8 arg1, u8 arg2, u8 arg3) { - const int stairwayPieceBroken = 56; - Primitive *prim, *prim2, *prim3; - Entity* newEntity; - Collider collider; - s16 primIndex; - s32 temp; - s16 x, y; - u8 v1; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 8; - self->hitboxHeight = 8; +REDACTED +REDACTED self->posX.i.hi = 1432 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = 200 - g_Tilemap.scrollY.i.hi; - self->hitPoints = 16; +REDACTED if (g_CastleFlags[stairwayPieceBroken]) { - self->hitboxState = 0; +REDACTED g_Tilemap.fg[0x4D9] = 0x3EE; g_Tilemap.fg[0x539] = 0x3D2; - self->step = 32; - break; - } - self->hitboxState = 2; +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0x4D9] = 0x408; g_Tilemap.fg[0x539] = 0x40D; - break; - - case 1: +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { g_api.PlaySfx(SFX_STOMP_SOFT_A); - } - +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); g_Tilemap.fg[0x4D9] = 0x3EE; g_Tilemap.fg[0x539] = 0x3D2; g_CastleFlags[stairwayPieceBroken] = true; - - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EQUIP_ITEM_DROP, self, newEntity); - newEntity->params = ITEM_TURKEY; - } - +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_INTENSE_EXPLOSION, self, newEntity); - newEntity->params = 0x10; - newEntity->zPriority = self->zPriority + 1; - newEntity->posX.i.hi += 8; - newEntity->posY.i.hi += 8; - } - - primIndex = g_api.AllocPrimitives(PRIM_GT4, 16); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; UnkPolyFunc2(prim); v1 = g_Tilemap.tileDef->gfxIndex[0x409]; - arg1 = v1; +REDACTED temp = g_Tilemap.tileDef->gfxPage[0x409]; prim->clut = g_Tilemap.tileDef->clut[0x409]; - prim->tpage = temp + 8; - arg1 *= 16; - arg3 = 0xF; - arg3 = arg1 | arg3; - prim->u0 = prim->u2 = arg1; - arg2 = v1 & 0xF0 | 0xF; - prim->v0 = prim->v1 = v1 & 0xF0; - prim->u1 = prim->u3 = arg3; - prim->v2 = prim->v3 = arg2; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; - LOW(prim->next->u0) = 0xFFFF0000; - LOW(prim->next->r1) = 0xFFFF0000; - LOH(prim->next->r2) = 16; - LOH(prim->next->b2) = 16; - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - self->step++; - - case 3: - prim = self->ext.prim; - prim2 = prim->next; - prim2->tpage -= 0x20; - prim2 = prim->next; - LOW(prim2->r1) += 0x2000; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - prim3 = prim->next; - x = prim3->x1; - y = prim3->y0; - g_api.CheckCollision(x, (s16)(y + 8), &collider, 0); - if (collider.effects & 1) { - self->posX.i.hi = x; - self->posY.i.hi = y - 4; - self->step++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x11; - newEntity->zPriority = self->zPriority + 1; - } - - for (i = 0; i < 6; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FALLING_ROCK, self, newEntity); - newEntity->params = Random() & 3; - if (newEntity->params == 3) { - newEntity->params = 0; - } - } - } - DestroyEntity(self); - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // falling rock with puff of smoke when it disappears. I think part of the // merman room breakable rock -void EntityFallingRock(Entity* self) { - s32 animFrame = self->params & 0xF; +REDACTED +REDACTED Collider collider; - Entity* newEntity; - s16 rndAngle; - s32 rnd; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = animFrame + 31; +REDACTED self->rotY = 0x60; self->rotX = 0x60; self->drawFlags |= 7; - rnd = (Random() & 0x1F) + 16; - rndAngle = (Random() * 6) + 0x900; +REDACTED +REDACTED self->velocityX = rnd * rcos(rndAngle); self->velocityY = rnd * rsin(rndAngle); if (self->velocityX > 0) { self->facingLeft = 1; - } - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); self->rotZ -= 0x20; - +REDACTED g_api.CheckCollision( self->posX.i.hi, self->posY.i.hi + 8, &collider, 0); if (collider.effects & EFFECT_SOLID) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(6, self, newEntity); - newEntity->params = 0x10; - if (animFrame == 0) { - newEntity->params = 0x13; - } - } - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("st/no3/nonmatchings/377D4", func_801BB548); // sky animation during death cutscene -void EntityDeathSkySwirl(Entity* self) { - Primitive* prim; - Primitive* prim2; - s16 primIndex; - SVECTOR sVec; - VECTOR vec; - MATRIX mtx; - - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[53]) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 65); +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.deathSkySwirl.prim = prim; - self->flags |= FLAG_HAS_PRIMS; - prim->tpage = 0x12; - prim->clut = 0x1F; - prim->u0 = prim->u2 = 0; - prim->u1 = prim->u3 = 0xFF; - prim->v0 = prim->v1 = 0x80; - prim->v2 = prim->v3 = 0xFF; - prim->priority = 0x1F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - } +REDACTED g_BgLayers[0].flags &= 0xFFFE; - self->ext.deathSkySwirl.unk84 -= 32; - SetGeomScreen(256); - SetGeomOffset(128, 192); - SetFogNear(256, 256); - SetFarColor(96, 96, 96); - sVec.vx = 0; - sVec.vy = self->ext.deathSkySwirl.unk84; - sVec.vz = 0; - RotMatrix(&sVec, &mtx); - vec.vy = -0xC0; - vec.vx = 0; - vec.vz = 0x200; - TransMatrix(&mtx, &vec); - SetRotMatrix(&mtx); - SetTransMatrix(&mtx); - prim = self->ext.deathSkySwirl.prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_COLORS; - - prim2 = prim->next; - prim2 = func_801BB548(&D_8018134C, &D_80181354, &D_8018135C, &D_80181364, - prim, 3, prim2, 0x1F800000); +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - while (prim2 != NULL) { +REDACTED prim2->drawMode = DRAW_HIDE; - prim2 = prim2->next; - } -} +REDACTED +REDACTED +REDACTED -void EntityUnkId29(Entity* self) { - if (self->step == 0) { +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->zPriority = 0x2A; +REDACTED self->flags &= ~FLAG_UNK_08000000; self->facingLeft = Random() & 1; g_api.PlaySfxVolPan(SFX_THUNDER_B, 0x40, (self->posX.i.hi >> 0x4) - 8); } - if (AnimateEntity(D_80181390, self) == 0) { - DestroyEntity(self); +REDACTED +REDACTED } } @@ -1735,171 +1735,171 @@ void EntityUnkId2A(Entity* entity) { InitializeEntity(D_80180B18); entity->zPriority = 0x29; entity->flags &= ~FLAG_UNK_08000000; - entity->animCurFrame = entity->params + 0x22; - entity->posX.i.hi = D_8018139C[entity->params << 1]; - entity->posY.i.hi = D_8018139E[entity->params << 1]; - entity->ext.generic.unk80.modeS16.unk0 = 5; +REDACTED +REDACTED +REDACTED +REDACTED } - entity->ext.generic.unk80.modeS16.unk0--; - if ((entity->ext.generic.unk80.modeS16.unk0 << 0x10) == 0) { +REDACTED +REDACTED DestroyEntity(entity); } } // switch that goes downwards when you stand on it -void EntitySwitch(Entity* entity) { +REDACTED s32 temp_a0 = GetPlayerCollisionWith(entity, 8, 4, 4); - Entity* player = &PLAYER; +REDACTED switch (entity->step) { case 0: InitializeEntity(D_80180B18); - entity->animCurFrame = 9; - entity->zPriority = 0x5E; +REDACTED +REDACTED if (g_CastleFlags[0x32] != 0) { - entity->step = 2; - entity->posY.i.hi += 4; +REDACTED +REDACTED } - break; +REDACTED - case 1: - if (temp_a0 != 0) { - player->posY.i.hi++; +REDACTED +REDACTED +REDACTED entity->posY.val += FIX(0.25); if ((g_Tilemap.scrollY.i.hi + entity->posY.i.hi) > 193) { entity->posY.i.hi = 193 - g_Tilemap.scrollY.i.hi; g_CastleFlags[0x32] = 1; g_api.PlaySfx(SFX_STONE_MOVE_B); - entity->step++; - } +REDACTED +REDACTED } - break; +REDACTED } } // door preventing access to warp room / heart -void EntityHeartRoomGoldDoor(Entity* self) { +REDACTED s16 primIndex; - Entity* newEntity; - POLY_GT4* poly; - s32 tilePos; - s32 temp; - s32 temp2; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B18); - self->animCurFrame = 37; - self->zPriority = 0x5E; - +REDACTED +REDACTED +REDACTED if (g_CastleFlags[50] != 0) { for ( tilePos = 0x48, i = 7, self->step = 128, self->animCurFrame = 0; i >= 0; tilePos += 0x10, i--) { g_Tilemap.fg[tilePos] = 0; - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_TILE, 64); if (primIndex == -1) { - DestroyEntity(self); - return; - } - +REDACTED +REDACTED +REDACTED +REDACTED poly = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - *(s32*)&self->ext.generic.unk7C = poly; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (poly != NULL) { - poly->v0 = 1; - poly->u0 = 1; - poly->r0 = 64; - poly->b0 = 128; - poly->g0 = 96; - poly->pad2 = self->zPriority + 0x18; - poly->pad3 = 8; - poly->p3 = 0; - poly = (POLY_GT4*)poly->tag; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED for (tilePos = 0x48, temp = 0x4FA, i = 7; i >= 0; tilePos += 0x10, i--) { g_Tilemap.fg[tilePos] = temp; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[50] != 0) { g_api.PlaySfx(SFX_STONE_MOVE_A); - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(0.375); - if (++self->ext.generic.unk80.modeS32 & 1) { - self->posX.i.hi++; - } else { - self->posX.i.hi--; - } - - temp = temp2 = self->posY.i.hi - 112; - if (temp2 < 0) { - temp2 = self->posY.i.hi - 97; - } - - temp = temp2 >> 4; - if (temp >= 9) { - temp = 8; - self->step = 3; - } - - for (tilePos = 0x48, i = 0; i < temp; tilePos += 0x10, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = 0; - } - +REDACTED +REDACTED if (!(g_Timer & 1)) { poly = FindFirstUnkPrim((POLY_GT4*)(*(s32*)&self->ext.generic.unk7C)); - if (poly != NULL) { - poly->p3 = 1; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer & 0xF)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(6, self, newEntity); - newEntity->posY.i.hi = 188; - newEntity->posX.i.hi += -8 + (Random() & 0xF); - newEntity->params = 0x10; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->rotX = newEntity->rotY = 192; newEntity->drawFlags |= 3; - } - } - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { - for (poly = *(s32*)&self->ext.generic.unk7C; poly != NULL; - poly = (POLY_GT4*)poly->tag) { - if (poly->p3 != 0) { - func_801B94F0(poly); - } - } - } -} - -void EntityUnkId49(Entity* entity) { - u16 temp; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED switch (entity->step) { case 0: InitializeEntity(g_EInitGeneric); - break; - case 1: +REDACTED +REDACTED temp = g_Tilemap.fg[9]; g_Tilemap.fg[6] = temp; temp = g_Tilemap.fg[10]; @@ -1912,7 +1912,7 @@ void EntityUnkId49(Entity* entity) { g_Tilemap.fg[0x66] = temp; temp = g_Tilemap.fg[0x6A]; g_Tilemap.fg[0x67] = temp; - entity->step++; - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/no3/3C4EC.c b/src/st/no3/3C4EC.c index 2f39c06bb8..2d4b8fb362 100644 --- a/src/st/no3/3C4EC.c +++ b/src/st/no3/3C4EC.c @@ -1,402 +1,402 @@ -#include "no3.h" - -// pushes alucard to the right -void EntityPushAlucard(Entity* entity) { - Entity* player = &PLAYER; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD0); - g_Entities[UNK_ENTITY_1].ext.alucardController.unk7C = true; +REDACTED g_Player.padSim = 0; g_Player.D_80072EFC = 255; - player->posX.i.hi = 0; +REDACTED g_unkGraphicsStruct.unkC = 0; - player->animCurFrame = 0; - D_8003C8B8 = 0; - break; - - case 1: - player->posX.val += 0x60000; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (tilemap->scrollX.i.hi > 0x800) { - g_Entities[UNK_ENTITY_1].ext.alucardController.unk7C = false; +REDACTED g_Player.padSim = PAD_RIGHT; - entity->step++; - } - player->animCurFrame = 0; +REDACTED +REDACTED +REDACTED g_Player.D_80072EFC = 1; - g_api.func_8010E0A8(); - break; - - case 2: - player->posX.val += 0x88000; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_unkGraphicsStruct.unkC += 4; if (g_unkGraphicsStruct.unkC == 192) { - entity->ext.generic.unk80.modeS32 = 0x48000; - entity->step++; - } +REDACTED +REDACTED +REDACTED g_Player.D_80072EFC = 1; - g_api.func_8010E0A8(); - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED if (g_unkGraphicsStruct.unkC > 128) { g_unkGraphicsStruct.unkC -= 1; - entity->ext.generic.unk80.modeS32 = 0x38000; - } else { - entity->ext.generic.unk80.modeS32 = 0x48000; - } - player->posX.val += entity->ext.generic.unk80.modeS32; - if (entity->ext.generic.unk80.modeS32 == 0x48000) { - entity->step++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.D_80072EFC = 1; - g_api.func_8010E0A8(); - break; - - case 4: - player->posX.val += 0x48000; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (tilemap->scrollX.i.hi > 0xF80) { g_api.PlaySfx(SE_NO3_ALUCARD_JUMP); g_Player.padSim = PAD_RIGHT | PAD_CROSS; - entity->ext.generic.unk7C.S8.unk0 = 0; - entity->step++; - } +REDACTED +REDACTED +REDACTED g_Player.D_80072EFC = 1; - g_api.func_8010E0A8(); - break; - - case 5: +REDACTED +REDACTED +REDACTED +REDACTED if ((player->velocityY > 0) && - (entity->ext.generic.unk7C.U8.unk0 == 0)) { +REDACTED g_Player.padSim = PAD_CROSS; - entity->ext.generic.unk7C.S8.unk0 = 1; - } else { +REDACTED +REDACTED g_Player.padSim = PAD_RIGHT | PAD_CROSS; - } - g_api.func_8010E0A8(); +REDACTED +REDACTED g_Player.D_80072EFC = 1; - player->posX.val += 0x48000; - } -} - -// Pushes Alucard through the castle door at the entrance -void EntityCastleDoorTransition(Entity* entity) { - Entity* player = &PLAYER; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[52]) { - DestroyEntity(entity); - return; - } +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD0); - g_Entities[UNK_ENTITY_1].ext.alucardController.unk7C = true; +REDACTED g_Player.padSim = PAD_RIGHT; g_Player.D_80072EFC = 0xFF; - player->posX.i.hi = 8; - entity->ext.castleDoorTransition.playerVelocity = 0x28000; - break; - - case 1: - player->posX.val += entity->ext.castleDoorTransition.playerVelocity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.D_80072EFC = 1; if ((player->posX.i.hi + g_Tilemap.scrollX.i.hi) > 120) { g_Player.padSim = 0; - entity->step++; - } - break; - - case 2: - if (entity->ext.castleDoorTransition.playerVelocity != 0) { - entity->ext.castleDoorTransition.playerVelocity -= 0x2800; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED EntityUnkId14Spawner( &PLAYER, 1, 1, 4, 0x18, (Random() & 3) + 1, -4); - } else { - D_8003C8B8 = 1; - entity->step++; - } - player->posX.val += entity->ext.castleDoorTransition.playerVelocity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.D_80072EFC = 1; - break; - } -} - -// large foreground tree during intro -void EntityForegroundTree(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - Entity *EntRange, *ent, *ent2; - u16* ptrParams; - u16 temp_s4; - s16 var_s3; - u16 y; - - if (self->params != 0) { - var_s3 = 320; - ptrParams = &D_80181468[self->ext.foregroundTree.unk7C].x; - } else { - var_s3 = 448; - ptrParams = &D_801813DC[self->ext.foregroundTree.unk7C].x; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD0); - EntRange = &g_Entities[192]; - self->unk68 = var_s3; - self->flags |= FLAG_UNK_08000000; - label: - if (*ptrParams <= 352) { - ent = AllocEntity(EntRange, &EntRange[64]); - if (ent != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, ent); - ent->posX.i.hi = *ptrParams++; - y = *ptrParams++; - ent->params = (y >> 8) + self->params; - ent->posY.i.hi = y & 255; - ent->unk68 = var_s3; - if (self->params != 0) { - ent->unk6C = 0x60; - } - } else { - ptrParams += 2; - } - self->ext.foregroundTree.unk7C++; - goto label; - } - break; - - case 1: - self->posX.i.hi = 128; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_s4 = var_s3 * tilemap->scrollX.i.hi / 256 + 352; - if (temp_s4 >= *ptrParams) { - ent = AllocEntity(&g_Entities[192], &g_Entities[256]); - if (ent != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, ent); - ent->posX.i.hi = temp_s4 - ptrParams[0] + 368; - y = ptrParams[1]; - ent->params = (y >> 8) + self->params; - ent->posY.i.hi = y & 255; - ent->unk68 = var_s3; - if (self->params != 0) { - ent->unk6C = 0x60; - } else if (self->ext.foregroundTree.unk7C == 7) { - ent2 = AllocEntity(&g_Entities[192], &g_Entities[256]); - CreateEntityFromEntity(E_ID_11, ent, ent2); - ent2->params = 0x12; - ent2->unk68 = var_s3; - ent2->unk6C = 0x40; - ent2->posY.i.hi -= 16; - } else if (self->ext.foregroundTree.unk7C == 10) { - ent2 = AllocEntity(&g_Entities[192], &g_Entities[256]); - CreateEntityFromEntity(E_ID_11, ent, ent2); - ent2->params = 0x13; - ent2->unk68 = var_s3; - ent2->unk6C = 0x40; - ent2->posY.i.hi += 48; - } else if (self->ext.foregroundTree.unk7C == 15) { - ent2 = AllocEntity(&g_Entities[192], &g_Entities[256]); - CreateEntityFromEntity(E_ID_11, ent, ent2); - ent2->params = 0x14; - ent2->unk68 = var_s3; - ent2->unk6C = 0x40; - ent2->posY.i.hi += 4; - } - } - self->ext.foregroundTree.unk7C++; - } - } -} - -void EntityUnkId50(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - Entity* newEntity; - Entity* temp; - u16 temp_s3; - s32 var_v0; - u16* ptr; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD0); - ptr = D_801814EC; - temp = &g_Entities[192]; - self->unk68 = 0xC0; - self->ext.et_801BCC4C.unk7C = 0; - self->flags |= FLAG_UNK_08000000; - label: - while (*ptr <= 288) { - newEntity = AllocEntity(temp, &temp[64]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, newEntity); - newEntity->posX.i.hi = *ptr++; - newEntity->params = *ptr++; - newEntity->unk68 = 0xC0; - } else { - ptr += 2; - } - self->ext.et_801BCC4C.unk7C++; - goto label; - } - break; - - case 1: - self->posX.i.hi = 128; - ptr = &D_801814EC[self->ext.et_801BCC4C.unk7C * 2]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED var_v0 = tilemap->scrollX.i.hi * 0xC0; - - if (var_v0 < 0) { - var_v0 += 0xFF; - } - temp_s3 = (var_v0 >> 8) + 288; - if (temp_s3 >= ptr[0]) { - newEntity = AllocEntity(&g_Entities[192], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, newEntity); - newEntity->posX.i.hi = temp_s3 - ptr[0] + 288; - newEntity->posX.i.lo = self->posX.i.lo; - newEntity->params = ptr[1]; - newEntity->unk68 = 0xC0; - } - self->ext.et_801BCC4C.unk7C++; - } - break; - } -} - -// part of parallax background with pine trees +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("st/no3/nonmatchings/3C4EC", EntityBackgroundPineTrees); - -void EntityUnkId52(Entity* self) { +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - Entity* newEntity; - Entity* temp; - u16 temp_s3; - s32 var_v0; - u16* ptr; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD0); - ptr = D_801817F8; - temp = &g_Entities[192]; - self->ext.et_801BCC4C.unk7C = 0; - self->flags |= FLAG_UNK_08000000; - label: - while (*ptr <= 288) { - newEntity = AllocEntity(temp, &temp[64]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, newEntity); - newEntity->posX.i.hi = *ptr; - newEntity->params = 0x10; - newEntity->unk68 = 0x18; - } - ptr++; - self->ext.et_801BCC4C.unk7C++; - goto label; - } - break; - - case 1: - self->posX.i.hi = 0x80; - ptr = &D_801817F8[self->ext.et_801BCC4C.unk7C]; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED var_v0 = tilemap->scrollX.i.hi * 0x18; - if (var_v0 < 0) { - var_v0 += 0xFF; - } - temp_s3 = (var_v0 >> 8) + 288; - if (temp_s3 >= *ptr) { - newEntity = AllocEntity(&g_Entities[192], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, newEntity); - newEntity->posX.i.hi = temp_s3 - *ptr + 288; - newEntity->posX.i.lo = self->posX.i.lo; - newEntity->params = 0x10; - if (self->ext.et_801BCC4C.unk7C == 5) { - newEntity->params = 0x11; - } - newEntity->unk68 = 0x18; - } - self->ext.et_801BCC4C.unk7C++; - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED INCLUDE_ASM("st/no3/nonmatchings/3C4EC", EntityCastleBridge); - -// ID 0x55 -void EntityBackgroundTrees(Entity* self) { - Primitive* prim; - s16 primIndex; - s16 temp_v0_2; - s16 var_a2; - - do { //! FAKE: - switch (self->step) { - case 0: - InitializeEntity(D_80180AD0); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 9); - if (primIndex == 0) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; - var_a2 = 0; - self->posX.i.hi = 128; - self->primIndex = primIndex; - self->unk68 = 0x10; - self->flags |= FLAG_UNK_08000000 | FLAG_HAS_PRIMS; - - while (prim != NULL) { - prim->x0 = prim->x2 = var_a2; - var_a2 += 0x1E; - prim->tpage = 0xE; - prim->clut = 0x67; - prim->u0 = prim->u2 = 0x61; - prim->u1 = prim->u3 = 0x7F; - prim->v0 = prim->v1 = 0xE1; - prim->v2 = prim->v3 = 0xFF; - prim->x1 = prim->x3 = var_a2; - prim->y0 = prim->y1 = 0xC0; - prim->y2 = prim->y3 = 0xE3; - prim->priority = 0x40; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - prim = prim->next; - } - break; - - case 1: - var_a2 = 128 - self->posX.i.hi; - self->posX.i.hi = 0x80; - primIndex = self->primIndex; - prim = &g_PrimBuf[self->primIndex]; - while (prim != NULL) { - temp_v0_2 = prim->x2 - var_a2; - prim->x0 = prim->x2 = temp_v0_2; - prim->x1 = prim->x3 = temp_v0_2 + 0x1E; - prim = prim->next; - } - break; - } - } while (0); -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // shows part of the parallax background castle wall void EntityBackgroundCastleWall(Entity* entity) { Entity* newEntity; - newEntity = AllocEntity(&g_Entities[192], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, newEntity); - newEntity->params = 0xC; - newEntity->unk68 = 0x80; - newEntity = AllocEntity(newEntity, &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_11, newEntity); - newEntity->params = 0xB; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->posY.i.hi = 0x80; newEntity->unk68 = 0xC0; newEntity->posX.i.hi += 0x40; diff --git a/src/st/no3/3E134.c b/src/st/no3/3E134.c index cb2b7d4e47..0f0b6dfc4e 100644 --- a/src/st/no3/3E134.c +++ b/src/st/no3/3E134.c @@ -1,131 +1,131 @@ -#include "no3.h" - -// intro owl and leaves -void EntityFlyingOwlAndLeaves(Entity* entity) { +REDACTED +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - Entity* newEntity; - u16 animFlag = true; - u16 i; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_OVL(1); - entity->animCurFrame = 56; - if (entity->params != 0) { +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY | FLAG_DRAW_UNK8; entity->rotX = 0x180; entity->rotY = 0x180; - entity->unk6C = 0x60; - entity->posY.i.hi = -16; - entity->zPriority = 0xC1; - } else { +REDACTED +REDACTED +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_UNK8; - entity->unk6C = 0x20; - entity->zPriority = 0xBF; - } - entity->unk68 = 0x1C0; - break; - - case 1: - if (entity->posX.i.hi < 224) { - entity->ext.generic.unk7C.s = 0; - entity->step++; - } - break; - - case 2: - if (!(entity->ext.generic.unk7C.s++ & 7)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SE_TREE_BRANCH); - } - if (entity->posX.i.hi < 192) { - SetStep(3); - if (entity->params != 0) { +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityX = FIX(8); entity->velocityY = FIX(3); - break; - } +REDACTED +REDACTED entity->velocityX = FIX(10); entity->velocityY = FIX(1.625); - for (i = 0; i < 8; i++) { +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(0x60, newEntity); - newEntity->params = i; - } - } - } - break; - - case 3: - if (entity->params != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED animFlag = AnimateEntity(D_801819DC, entity); entity->velocityY -= 0xA00; - } else { +REDACTED animFlag = AnimateEntity(D_801819D0, entity); if (entity->velocityY > (s32)0xFFFE0000) { entity->velocityY -= FIX(0.03125); - } - } - MoveEntity(); +REDACTED +REDACTED +REDACTED if ((entity->params == 0) && (tilemap->scrollX.i.hi > 0xD80)) { - entity->step++; - } - if (entity->posX.i.hi > 288) { - DestroyEntity(entity); - } else if (entity->posY.i.hi < -16) { - DestroyEntity(entity); - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (entity->velocityY > (s32)0xFFFE0000) { entity->velocityY -= FIX(0.03125); - } +REDACTED animFlag = AnimateEntity(D_801819D0, entity); - MoveEntity(); - if (entity->unk6C < 0x78) { - entity->unk6C += 2; - } - if (entity->posX.i.hi > 288) { - DestroyEntity(entity); - } else if (entity->posY.i.hi < -16) { - DestroyEntity(entity); - } - } - - if (!animFlag) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(SE_OWL_WING_FLAP); - } -} - +REDACTED +REDACTED +REDACTED // a single leaf from when the owl comes out in the intro -void EntityFallingLeaf(Entity* entity) { - volatile int pad; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_OVL(1); - entity->animCurFrame = (entity->params & 1) + 63; - entity->zPriority = 0xC1; +REDACTED +REDACTED entity->velocityX = D_801819E8[entity->params * 2]; entity->velocityY = D_801819EC[entity->params * 2]; - entity->unk68 = 0x1C0; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (entity->velocityX > 0) { entity->velocityX -= FIX(0.0625); - } +REDACTED if (entity->velocityY < FIX(1.0)) { entity->velocityY += 0x400; - } +REDACTED if (entity->velocityY > FIX(1.0)) { entity->velocityY -= 0x400; - } - MoveEntity(); - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/no3/3FF00.c b/src/st/no3/3FF00.c index d1e1b755cc..ba3ee2367b 100644 --- a/src/st/no3/3FF00.c +++ b/src/st/no3/3FF00.c @@ -15,7 +15,7 @@ void EntityRoomTransition2(Entity* self) { } self->ext.roomTransition2.unk80--; - switch (self->step) { +REDACTED case 0: InitializeEntity(D_80180AD0); tilemap->y = 0xFC; @@ -23,12 +23,12 @@ void EntityRoomTransition2(Entity* self) { D_8003C8B8 = 0; g_Player.D_80072EFC = 1; D_801D7DD0 |= 0x100; - break; - +REDACTED +REDACTED case 1: // Evil use of local 'gents' instead of PLAYER - if (gents->posX.i.hi < 52) { - g_Entities[UNK_ENTITY_1].ext.alucardController.unk7C = 1; +REDACTED +REDACTED g_Player.padSim = PAD_RIGHT; } else { g_Player.padSim = 0; @@ -36,8 +36,8 @@ void EntityRoomTransition2(Entity* self) { self->step++; } g_Player.D_80072EFC = 1; - break; - +REDACTED +REDACTED case 2: if (D_801D7DD0 & 0x20) { g_api.InitStatsAndGear(1); @@ -47,18 +47,18 @@ void EntityRoomTransition2(Entity* self) { if (newEntity == NULL) { break; } - CreateEntityFromEntity(E_ID_59, gents, newEntity); +REDACTED newEntity->params = localVar; } g_Player.padSim = 0x10000; - self->ext.roomTransition2.timer = 16; +REDACTED self->step++; } g_Player.D_80072EFC = 1; - break; - +REDACTED +REDACTED case 3: - if (D_801D7DD0 & 0x40 && !(--self->ext.roomTransition2.timer)) { +REDACTED localVar = g_api.AllocPrimitives(PRIM_TILE, 1); if (localVar != -1) { prim = &g_PrimBuf[localVar]; @@ -73,17 +73,17 @@ void EntityRoomTransition2(Entity* self) { prim->drawMode = 0x35; self->step++; } else { - self->ext.roomTransition2.timer++; +REDACTED } } g_Player.padSim = 0; g_Player.D_80072EFC = 1; - break; - +REDACTED +REDACTED case 4: prim = &g_PrimBuf[self->primIndex]; prim->r0 = prim->g0 = prim->b0 = prim->b0 + 8; - if (prim->r0 >= 240) { +REDACTED self->step++; DestroyEntity(&g_Entities[208]); g_BgLayers[0].flags |= 1; @@ -92,8 +92,8 @@ void EntityRoomTransition2(Entity* self) { } g_Player.padSim = 0; g_Player.D_80072EFC = 1; - break; - +REDACTED +REDACTED case 5: prim = &g_PrimBuf[self->primIndex]; prim->r0 = prim->g0 = prim->b0 = prim->b0 - 8; @@ -107,546 +107,546 @@ void EntityRoomTransition2(Entity* self) { } g_Player.padSim = 0; g_Player.D_80072EFC = 1; - break; +REDACTED } } -// Displays items took by Death in the cutscene -void EntityDeathStolenItem(Entity* self) { - u16 params = self->params; - u16 itemId = D_80181AD4[params]; - volatile char pad; - Primitive* prim; - s32 primIndex; - u16 temp1; - u16 temp3; - u16 temp4; - u16 temp6; - s32 temp2; - s32 temp8; - u8 temp7; - u8 temp5; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - break; - - case 1: +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - break; - } - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - - if (itemId < NUM_HAND_ITEMS) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.LoadEquipIcon(g_api.equipDefs[itemId].icon, g_api.equipDefs[itemId].iconPalette, params); - } else { - itemId -= NUM_HAND_ITEMS; +REDACTED +REDACTED g_api.LoadEquipIcon( g_api.accessoryDefs[itemId].icon, g_api.accessoryDefs[itemId].iconPalette, params); - } - - prim = &g_PrimBuf[primIndex]; - prim->tpage = 0x1A; - prim->clut = params + 0x1D0; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 = - 128; - prim->priority = 0x80; - prim->u0 = prim->u2 = (params & 7) << 4 | 1; - prim->u1 = prim->u3 = (params & 7) << 4 | 0xF; - prim->v0 = prim->v1 = (params & 0x18) << 1 | 0x81; - prim->v2 = prim->v3 = (params & 0x18) << 1 | 0x8F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - self->step++; - break; - - case 2: - UnkEntityFunc0(D_80181AEC[params].x, D_80181AEC[params].y); - self->ext.deathStolenItems.unk7C = 16; - self->step++; - break; - - case 3: - self->ext.deathStolenItems.unk7C--; - temp6 = self->ext.deathStolenItems.unk7C; - MoveEntity(); - temp8 = (16 - temp6) * 7; - if (temp8 < 0) { - temp8 += 15; - } - prim = &g_PrimBuf[self->primIndex]; - temp1 = temp8 >> 4; - prim->x0 = prim->x2 = self->posX.i.hi - temp1; - prim->y0 = prim->y1 = self->posY.i.hi - temp1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 6; - temp2 = temp1 << 1; - prim->x1 = prim->x3 = prim->x0 + temp2; - prim->y2 = prim->y3 = prim->y0 + temp2; - if (temp6 == 0) { - self->ext.deathStolenItems.unk7C = D_80181AE0[params]; - self->step++; - } - break; - - case 4: - if (--self->ext.deathStolenItems.unk7C == 0) { - self->ext.deathStolenItems.unk7C = 8; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SE_ITEM_YOINK); - self->step++; - } - - prim = &g_PrimBuf[self->primIndex]; - if (self->ext.deathStolenItems.unk7C & 2) { - prim->r0 = prim->r1 = prim->r2 = prim->r3 = 192; - prim->g0 = prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 = - prim->b2 = prim->b3 = 64; - } else { - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = - prim->b3 = 128; - } - break; - - case 5: - prim = &g_PrimBuf[self->primIndex]; - prim->y0 = prim->y1 = prim->y1 - 0x20; - if (self->ext.deathStolenItems.unk7C >= 2) { - temp3 = prim->x2; - temp4 = prim->x3; - prim->x2 = temp3 + 1; - prim->x0 = temp3; - prim->x3 = temp4 - 1; - prim->x1 = temp4; - } - if (--self->ext.deathStolenItems.unk7C == 0) { - self->ext.deathStolenItems.unk7C = 16; - self->step++; - } - break; - - case 6: - prim = &g_PrimBuf[self->primIndex]; - prim->y2 = prim->y3 = prim->y3 - 0x10; - if (--self->ext.deathStolenItems.unk7C == 0) { - self->step++; - DestroyEntity(self); - } - break; - } -} - -void EntityDeath(Entity* self) { - Entity* newEntity = &self[1]; - Primitive* prim; - s16 left, right; - s32 primIndex; - s32 x, y; - s32 i; - - if ((self->step >= 4) && (self->step < 13)) { - if (self->ext.death.moveTimer != 0) { - self->ext.death.moveTimer--; - } else { - if (self->ext.death.moveDirection != 0) { - self->ext.death.moveDirection = 0; - } else { - self->ext.death.moveDirection = 1; - } - self->ext.death.moveTimer = 127; - } - - if (self->ext.death.moveDirection != 0) { - self->velocityY += 0x200; - } else { - self->velocityY -= 0x200; - } - MoveEntity(); - } - - if ((self->step >= 13) && (self->step < 18)) { - if (self->velocityY != 0) { - if (self->velocityY < 0) { - self->velocityY += 0x200; - } else { - self->velocityY -= 0x200; - } - MoveEntity(); - } - } - - if (self->step >= 19) { - self->velocityX -= 0xC00; - self->velocityY -= FIX(0.15625); - MoveEntity(); - } - - switch (self->step) { - case 0: - if (D_801D7DD0 & 0x80) { - primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); - if (primIndex != -1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - self->animSet = ANIMSET_OVL(8); - self->palette = 0x2D6; - self->unk5A = 0x44; - self->primIndex = primIndex; - self->animCurFrame = 0; - self->ext.death.unk7C = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_HAS_PRIMS; - DestroyEntity(newEntity); - CreateEntityFromCurrentEntity(E_ID_5B, newEntity); - prim = &g_PrimBuf[primIndex]; - - for (i = 0; prim != NULL; i++) { - if (i != 0) { - prim->clut = self->palette; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x35; - } else { - prim->clut = 0x15F; +REDACTED +REDACTED prim->drawMode = 0x55; - } - prim->tpage = self->unk5A >> 2; - prim->u0 = prim->u2 = 0x10; - prim->u1 = prim->u3 = 0x38; - prim->v0 = prim->v1 = 0xB0; - prim->v2 = prim->v3 = 0xFF; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = - prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 = - prim->b2 = prim->b3 = 0; - prim->priority = self->zPriority + i + 1; - prim = prim->next; - } - } - } - break; - - case 1: - if (AnimateEntity(D_80181BC8, self) == 0) { - SetStep(2); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; self->rotZ = 0x1000; - self->posY.i.hi += 16; - self->animCurFrame = 0x3A; - self->ext.death.posX = self->posX.i.hi; - self->ext.death.posY = self->posY.i.hi; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ -= 0x40; if (self->rotZ == 0) { - SetStep(3); +REDACTED self->drawFlags = 0; - } - +REDACTED +REDACTED x = (0x1000 - self->rotZ) * 0x1D; - if (x < 0) { - x += 0xFFF; - } - self->posX.i.hi = self->ext.death.posX + (x >> 0xC); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED y = (0x1000 - self->rotZ) * 0x28; - if (y < 0) { - y += 0xFFF; - } - self->posY.i.hi = self->ext.death.posY - (y >> 0xC); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(self->rotZ & 0x70)) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { - CreateEntityFromCurrentEntity(E_ID_5E, newEntity); +REDACTED +REDACTED +REDACTED newEntity->rotZ = self->rotZ; - newEntity->animCurFrame = 0x3A; - } - } - break; - - case 3: - if (AnimateEntity(D_80181BE0, self) == 0) { - SetStep(4); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SE_VO_DEATH_LAUGH); - self->ext.death.moveTimer = 64; - self->ext.death.moveDirection = 0; - } - self->posX.i.hi = self->ext.death.posX; - self->posY.i.hi = self->ext.death.posY - 16; - break; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case 4: prim = &g_PrimBuf[self->primIndex]; - self->ext.death.unk7C += 4; - if (self->ext.death.unk7C == 96) { - D_801D7DD0 |= 1; - } - - if (self->ext.death.unk7C == 128) { - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - prim = prim->next; - } - self->animCurFrame = 16; - self->ext.death.unk7C = 32; - SetStep(5); - break; - } - - while (prim != NULL) { - left = self->posX.i.hi - 14; - right = self->posX.i.hi + 26; - prim->x0 = prim->x2 = left; - prim->x1 = prim->x3 = right; - left = self->posY.i.hi - 40; - right = self->posY.i.hi + 39; - prim->y0 = prim->y1 = left; - prim->y2 = prim->y3 = right; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = - prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = - prim->b3 = self->ext.death.unk7C; - prim = prim->next; - } - break; - - case 5: - AnimateEntity(D_80181B34, self); - if (--self->ext.death.unk7C == 0) { - SetStep(6); - } - break; - - case 6: - AnimateEntity(D_80181B28, self); - if (D_801D7DD0 & 2) { - SetStep(7); - } - break; - - case 7: - if (AnimateEntity(D_80181B04, self) == 0) { - SetStep(8); - } - if ((self->animCurFrame >= 7) && (self->animCurFrame < 11)) { - newEntity->ext.death.unk7C = 2; - } else { - newEntity->ext.death.unk7C = 1; - } - - if (D_801D7DD0 & 4) { - SetStep(9); - } - break; - - case 8: - AnimateEntity(D_80181B28, self); - if (D_801D7DD0 & 4) { - SetStep(9); - } - break; - - case 9: - if (AnimateEntity(D_80181BB4, self) == 0) { - SetStep(10); - } - newEntity->ext.death.unk7C = 1; - - if (D_801D7DD0 & 8) { - SetStep(11); - } - break; - - case 10: - AnimateEntity(D_80181B28, self); - if (D_801D7DD0 & 8) { - SetStep(11); - } - break; - - case 11: - if (AnimateEntity(D_80181B94, self) == 0) { - SetStep(12); - } - newEntity->ext.death.unk7C = 1; - - if (D_801D7DD0 & 0x10) { - SetStep(13); - } - break; - - case 12: - AnimateEntity(D_80181B28, self); - if (D_801D7DD0 & 0x10) { - SetStep(13); - } - break; - - case 13: - if (AnimateEntity(D_80181B58, self) == 0) { - SetStep(14); - } - newEntity->ext.death.unk7C = 1; - break; - - case 14: - if (AnimateEntity(D_80181B68, self) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SE_VO_DEATH_STEALS); - SetStep(15); - } - break; - - case 15: - if (AnimateEntity(D_80181B70, self) == 0) { - SetStep(16); - D_801D7DD0 |= 0x20; - } - break; - - case 16: - if (AnimateEntity(D_80181B74, self) == 0) { - SetStep(18); - } - - if (self->animCurFrame != 30) { - newEntity->ext.death.unk7C = 1; - } - break; - - case 18: - if (AnimateEntity(D_80181B84, self) == 0) { - SetStep(19); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SE_VO_DEATH_LAUGH); - self->velocityX = FIX(1.0); - self->velocityY = FIX(5.0); - self->ext.death.moveTimer = 0; - } - - if (self->animCurFrame != 1) { - newEntity->ext.death.unk7C = 2; - } else { - newEntity->ext.death.unk7C = 1; - } - break; - - case 19: - AnimateEntity(D_80181B8C, self); - if (self->animCurFrame == 1) { - newEntity->ext.death.unk7C = 1; - } else { - newEntity->ext.death.unk7C = 2; - } - - if ((self->ext.death.moveTimer & 3) == 0) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_5E, newEntity); - newEntity->animCurFrame = self->animCurFrame; - newEntity->params = 1; - } - newEntity->ext.death.unk7C = 3; - } - self->ext.death.moveTimer++; - - if (self->posY.i.hi < -32) { - D_801D7DD0 |= 0x40; - DestroyEntity(self); - DestroyEntity(&self[1]); - } - break; - } -} - -void EntityUnkId5B(Entity* entity) { - Entity* newEntity; - - entity->posX.i.hi = entity[-1].posX.i.hi; - entity->posY.i.hi = entity[-1].posY.i.hi; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_OVL(8); - entity->palette = 0x2D6; - entity->animCurFrame = 0; - entity->unk5A = 0x44; - break; - - case 1: - if (entity->ext.generic.unk7C.u != 0) { - switch (entity->ext.generic.unk7C.u) { - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80181B40, entity); - break; - case 2: +REDACTED +REDACTED AnimateEntity(D_80181B4C, entity); - break; - case 3: +REDACTED +REDACTED AnimateEntity(D_80181B4C, entity); newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); if (newEntity == NULL) { break; } - CreateEntityFromCurrentEntity(E_ID_5E, newEntity); - newEntity->animCurFrame = entity->animCurFrame; - newEntity->params = 1; - break; - } - } else { - entity->animCurFrame = 0; - } - } - entity->ext.generic.unk7C.s = 0; -} - -void EntityUnkId5E(Entity* entity) { - s16 animCurFrame; - - switch (entity->step) { - case 0: - animCurFrame = entity->animCurFrame; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - entity->animCurFrame = animCurFrame; +REDACTED entity->animSet = ANIMSET_OVL(8); - entity->palette = 0x2D6; - entity->unk5A = 0x44; - if (entity->params != 0) { +REDACTED +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_UNK8; entity->ext.generic.unk84.U16.unk0 = 0x40; } else { entity->drawFlags = FLAG_DRAW_ROTZ | FLAG_DRAW_UNK8; - entity->ext.generic.unk84.U16.unk0 = 0x20; - } - entity->unk6C = 0x40; +REDACTED +REDACTED +REDACTED entity->drawMode = 0x30; - break; - - case 1: - if (!(--entity->ext.generic.unk84.U16.unk0)) { - DestroyEntity(entity); - break; - } - if (entity->params != 0) { - entity->unk6C = (s8)entity->unk6C - 1; - } else { - entity->unk6C += -2; - } - break; - } -} - -void func_801C13F8() { - Entity* entity; - s16 temp_s3; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s8 temp_s4; - s32 i; +REDACTED temp_s4 = Random() & 3; temp_s3 = ((Random() & 0xF) << 8) - 0x800; - +REDACTED for (i = 0; i < 6; i++) { - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); +REDACTED if (entity != NULL) { // Make a EntityWargExplosionPuffOpaque CreateEntityFromEntity(E_WARG_EXP_OPAQUE, g_CurrentEntity, entity); @@ -659,7 +659,7 @@ void func_801C13F8() { } // A single "puff" of the warg explosion animation, opaque -void EntityWargExplosionPuffOpaque(Entity* self) { +REDACTED Unkstruct_80180FE0* obj; s32 velocityX; s32 velocityY; @@ -674,11 +674,11 @@ void EntityWargExplosionPuffOpaque(Entity* self) { case 0: InitializeEntity(g_InitializeEntityData0); params = self->params & 0xF; - obj = &D_80181C5C[params]; - self->palette = obj->palette + 0xD0; +REDACTED +REDACTED self->drawMode = obj->drawMode; - self->animSet = obj->animSet; - self->unk5A = obj->unk2; +REDACTED +REDACTED self->ext.wargpuff.unk80 = obj->unk8; self->step = params + 1; @@ -691,21 +691,21 @@ void EntityWargExplosionPuffOpaque(Entity* self) { self->palette = 0x819F; self->drawMode = DRAW_TPAGE; self->facingLeft = 1; - } - break; - - case 1: - MoveEntity(); - self->velocityY = FIX(1.0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) != 0) { - switch (self->step_s) { - case 0: +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_UNK8; self->unk6C = 0x80; self->step_s++; @@ -719,34 +719,34 @@ void EntityWargExplosionPuffOpaque(Entity* self) { case 2: self->unk6C += 0xFC; - break; - } - } else { - DestroyEntity(self); - } - break; - - case 3: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; switch (self->ext.wargpuff.unk88) { - case 1: +REDACTED if (self->ext.wargpuff.unk89 >= 0x4) { self->ext.wargpuff.unk89 += 0xFD; self->ext.wargpuff.unk84 -= 0x800; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED self->ext.wargpuff.unk84 = (u16)self->ext.wargpuff.unk84 + ((u8)self->ext.wargpuff.unk89 * 0xC0); - break; - } +REDACTED +REDACTED self->ext.wargpuff.unk84 = self->ext.wargpuff.unk84 & 0xFFF; self->rotZ = self->ext.wargpuff.unk84 & 0xFFF; temp_s0 = self->ext.wargpuff.unk89 * 0x140; - temp_s0 /= 28; +REDACTED self->velocityX = temp_s0 * rsin(self->ext.wargpuff.unk84); self->velocityY = -(temp_s0 * rcos(self->ext.wargpuff.unk84)); self->step_s++; @@ -771,10 +771,10 @@ void EntityWargExplosionPuffOpaque(Entity* self) { } MoveEntity(); if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case 4: if (self->step_s == 0) { rnd = Random(); @@ -782,12 +782,12 @@ void EntityWargExplosionPuffOpaque(Entity* self) { self->facingLeft = rnd & 1; self->rotX = 0xC0; self->drawFlags |= 1; - self->step_s++; - } - MoveEntity(); +REDACTED +REDACTED +REDACTED if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/no3/48A84.c b/src/st/no3/48A84.c index 36bbe51c34..b6163aef48 100644 --- a/src/st/no3/48A84.c +++ b/src/st/no3/48A84.c @@ -56,7 +56,7 @@ void EntityRoomForeground(Entity* entity) { if (objInit->unkC != 0) { entity->flags = objInit->unkC; } - if (entity->params >= 5) { +REDACTED entity->rotZ = 0x800; entity->drawFlags |= 4; } @@ -160,17 +160,17 @@ void func_801CC90C(Entity* arg0) { s16 temp_v0; temp_v0 = GetDistanceToPlayerX(); - temp_v1 = arg0->ext.generic.unk84.S16.unk2; +REDACTED if (temp_v1 != 0) { if ((u32)(temp_v0) < 0x60) { temp_v0_2 = temp_v1 - 2; - arg0->ext.generic.unk84.S16.unk2 = temp_v0_2; +REDACTED if (temp_v0_2 < 0) { - arg0->ext.generic.unk84.S16.unk2 = 0; +REDACTED } } else { - arg0->ext.generic.unk84.S16.unk2 = (temp_v1 - 1); +REDACTED } } } @@ -272,21 +272,21 @@ void func_801CF438(Entity* entity, u8 count, u8 params, s32 xDist, s32 yDist, void func_801CF58C(Entity* self) { self->velocityX = 0; - self->ext.generic.unk84.S16.unk2 = 0x100; - SetStep(6); +REDACTED +REDACTED g_api.PlaySfx(SE_WARG_GROWL); - self->ext.generic.unk80.modeS16.unk0 = 0x20; +REDACTED } void func_801CF5E0(Entity* self) { s16 temp_v0; if (self->facingLeft == GetSideToPlayer()) { - SetStep(5); +REDACTED return; } - if (self->ext.generic.unk84.S16.unk2 == 0) { +REDACTED func_801CF58C(self); return; } @@ -297,24 +297,24 @@ void func_801CF5E0(Entity* self) { if (temp_v0 > 16) { SetStep(3); if (self->facingLeft != 0) { - self->ext.generic.unk7C.S8.unk0 = 0; +REDACTED } else { - self->ext.generic.unk7C.S8.unk0 = 1; +REDACTED } } else if (temp_v0 < -16) { - SetStep(3); +REDACTED if (self->facingLeft != 0) { - self->ext.generic.unk7C.S8.unk0 = 1; +REDACTED } else { - self->ext.generic.unk7C.S8.unk0 = 0; +REDACTED } } else { - SetStep(7); +REDACTED } - self->ext.generic.unk80.modeS16.unk0 = 0; - self->ext.generic.unk80.modeS16.unk2 = 32; -} +REDACTED +REDACTED +REDACTED // duplicate of func_801CC90C in this file void func_801CF6D8(Entity* arg0) { @@ -323,17 +323,17 @@ void func_801CF6D8(Entity* arg0) { s16 temp_v0; temp_v0 = GetDistanceToPlayerX(); - temp_v1 = arg0->ext.generic.unk84.S16.unk2; +REDACTED if (temp_v1 != 0) { if ((u32)(temp_v0) < 0x60) { temp_v0_2 = temp_v1 - 2; - arg0->ext.generic.unk84.S16.unk2 = temp_v0_2; +REDACTED if (temp_v0_2 < 0) { - arg0->ext.generic.unk84.S16.unk2 = 0; +REDACTED } } else { - arg0->ext.generic.unk84.S16.unk2 = (temp_v1 - 1); +REDACTED } } } @@ -356,7 +356,7 @@ void EntityWargExplosionPuffTransparent(Entity* entity) { entity->animFrameIdx = 0; entity->animFrameDuration = 0; entity->unk6C = 0x60; - temp_v0 = entity->params & 0xFF00; +REDACTED if (temp_v0 != 0) { entity->zPriority = temp_v0 >> 8; } diff --git a/src/st/no3/516B4.c b/src/st/no3/516B4.c index cac8d031b5..bce982ee85 100644 --- a/src/st/no3/516B4.c +++ b/src/st/no3/516B4.c @@ -4,271 +4,271 @@ // ID 0x35 void EntitySplashWater(Entity* self) { Tilemap* tilemap = &g_Tilemap; - u16 params = self->params; - u16 temp_s2 = params >> 0xB; - u16 temp_s5 = (params >> 8) & 7; - u16 temp_s4 = (params >> 5) & 7; - - Primitive *prim, *prim2; - Entity* newEntity; - s16 primIndex; - s16 temp_a0; - s16 temp_a1; - s16 temp_a2; - u16 temp_t3; - s16 temp_t8; - char pad[0x4]; - s32 i; - - params &= 0xF; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - if (temp_s2 != 0 && temp_s4 != 7) { - primIndex = g_api.AllocPrimitives(PRIM_GT4, 4); - } else { +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); - } - if (primIndex != -1) { - self->flags |= FLAG_HAS_PRIMS; +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - temp_t3 = self->posY.i.hi; - temp_t8 = self->posX.i.hi; +REDACTED +REDACTED self->ext.waterEffects.unk82 = temp_t3 + tilemap->scrollY.i.hi; - for (i = 0; prim != NULL; i++) { - if (i % 2) { - prim->u0 = prim->u2 = prim2->u0; - prim->u1 = prim->u3 = prim2->u1; - prim->v0 = prim->v1 = prim2->v0; - prim->v2 = prim->v3 = prim2->v2; - prim->y2 = prim2->y2; - prim->y3 = prim2->y3; - prim->x2 = prim->x0 = prim2->x0; - prim->x3 = prim->x1 = prim2->x1; - } else { - prim->u1 = prim->u3 = 0x20; - prim->v2 = prim->v3 = 0x7C; - prim->u0 = prim->u2 = 0; - prim->v0 = prim->v1 = 96; - prim->y2 = prim->y3 = temp_t3; - prim->x2 = prim->x0 = temp_t8 - 0xE; - prim->x3 = prim->x1 = temp_t8 + 0xE; - if (i >= 2) { - temp_a2 = D_80183858[temp_s4]; - if (temp_s2 >= 0xF) { - prim->u0 = prim->u2 = prim2->u1; - prim->x0 = prim->x2 = prim2->x1; - temp_a1 = prim2->y3; - prim->y2 = temp_a1; - if (temp_a2 != 0) { - prim->y3 = - temp_a1 - (prim->x1 - prim->x0) / temp_a2; - } else { - prim->y3 = temp_a1; - } - } else { - prim->u1 = prim->u3 = prim2->u0; - prim->x1 = prim->x3 = prim2->x0; - temp_a1 = prim2->y2; - prim->y3 = temp_a1; - if (temp_a2 != 0) { - prim->y2 = - temp_a1 + (prim->x1 - prim->x0) / temp_a2; - } else { - prim->y2 = temp_a1; - } - } - } else { - if (temp_s2 != 0) { - if (temp_s2 >= 0xF) { - prim->u1 = prim->u3 = - prim->u0 + (temp_s2 << 5) / 28; - prim->x1 = prim->x3 = temp_s2 + prim->x0; - } else { - prim->u0 = prim->u2 = - prim->u2 + (temp_s2 << 5) / 28; - prim->x0 = prim->x2 = temp_s2 + prim->x2; - } - } - if (temp_s5 != 0) { - temp_a0 = D_80183858[temp_s5]; - if (temp_a0 < 0) { - if (temp_t8 >= prim->x1) { - prim->y2 += (prim->x1 - prim->x0) / temp_a0; - } else { - prim->y2 += (temp_t8 - prim->x0) / temp_a0; - prim->y3 = prim->y3 - - (prim->x1 - temp_t8) / temp_a0; - } - } else if (prim->x0 >= temp_t8) { - prim->y3 -= (prim->x1 - prim->x0) / temp_a0; - } else { - prim->y2 += (temp_t8 - prim->x0) / temp_a0; - prim->y3 -= (prim->x1 - temp_t8) / temp_a0; - } - } - } - } - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = - prim->b1 = 255; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = - prim->b3 = 128; - prim->clut = 0x162; - prim->tpage = 0x1A; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x77; - if (i % 2) { - prim->clut = 0x15F; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = - prim->b1 = 0; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = - prim->b3 = 96; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x37; - prim->priority += 2; - } - prim2 = prim; - prim = prim->next; - } - - temp_a2 = (self->posX.i.hi - 120) >> 4; - if (temp_a2 < -8) { - temp_a2 = -8; - temp_a2 = -8; - } - if (temp_a2 > 8) { - temp_a2 = 8; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfxVolPan(D_801813A8, 0x7F, temp_a2); self->velocityY = D_80183878[params].x; self->ext.waterEffects.accelY = D_80183878[params].y; - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_WATER_DROP, newEntity); - newEntity->velocityY = self->velocityY; - } - break; - } - DestroyEntity(self); - return; - - case 1: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += self->ext.waterEffects.accelY; - if (self->velocityY > FIX(2.5)) { - self->step++; - } - break; - - case 2: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PrimBuf[self->primIndex].r0 < 9) { - DestroyEntity(self); - return; - } - break; - } - - temp_t3 = self->ext.waterEffects.unk82 - self->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_t3 -= tilemap->scrollY.i.hi; - prim = &g_PrimBuf[self->primIndex]; - - for (i = 0; prim != NULL; i++) { - prim->y0 = prim->y2 - temp_t3; - prim->y1 = prim->y3 - temp_t3; - if (i % 2) { - if (prim->b3 >= 4) { - prim->b3 += 252; - } - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - } else { - if (prim->b3 >= 8) { - prim->b3 += 252; - } - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - if (prim->b3 <= 8) { - if (prim->b1 >= 8) { - prim->b1 += 248; - } - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1; - } - } - prim = prim->next; - } -} - -// ID 0x36 -void EntitySurfacingWater(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - s16 left, right, bottom; - Primitive* prim; - s16 primIndex; - s16 temp_t0; - s32 rnd; - s16 var_s2; - u16 params; - s16* ptr; - s16 temp3; - s16 tempv0; - s16 x, y; - s32 i, j; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); - if (primIndex == -1) { - DestroyEntity(self); - return; - } - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - var_s2 = (self->posX.i.hi - 120) >> 4; - if (var_s2 < -8) { - var_s2 = -8; - } - if (var_s2 > 8) { - var_s2 = 8; - } - params = self->params; - if (!(params & 0x8000)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfxVolPan(D_801813AA, 0x7F, var_s2); - } - params = (params >> 8) & 0x7F; - prim = &g_PrimBuf[primIndex]; - right = self->posX.i.hi; - bottom = self->posY.i.hi; - left = right - 9; - right += 9; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.unk82 = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - - for (i = 0; i < 2; i++) { - prim->u2 = 0; - prim->u0 = 0; - prim->u1 = prim->u3 = 0x1E; - prim->v0 = prim->v1 = 0x60; - prim->v2 = prim->v3 = 0x7C; - prim->y2 = prim->y3 = bottom; - prim->x2 = prim->x0 = left; - prim->x3 = prim->x1 = right; - if (params != 0) { - var_s2 = D_80183858[params]; - prim->y2 = prim->y2 + 9 / var_s2; - prim->y3 = prim->y3 - 9 / var_s2; - } - prim->clut = 0x162; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 = - 255; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3 = - 128; - prim->tpage = 0x1A; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x77; - if (i != 0) { - prim->clut = 0x161; - prim->priority = self->zPriority + 4; +REDACTED +REDACTED +REDACTED prim->drawMode = 0x77; } prim = prim->next; @@ -276,344 +276,344 @@ void EntitySurfacingWater(Entity* self) { rnd = (rand() & 1) + 12; self->ext.waterEffects.topY.i.hi = D_80183898[(u8)self->params] + rnd; self->velocityX = self->ext.waterEffects.unk8A * 16; - if (params != 0) { - self->velocityY = self->velocityX / var_s2; - if (self->velocityY < 0) { - self->velocityY = -self->velocityY; - } - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.topY.val -= FIX(0.25); - break; - } - - MoveEntity(self); - - //! FAKE: - j = self->velocityX; - - if (self->velocityX != 0) { - right = D_801813AC[self->ext.waterEffects.unk88]; - ptr = D_801813AC; - if (self->velocityX < 0) { - right += 6; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED x = right - tilemap->scrollX.i.hi; - if (self->posX.i.hi < x) { - DestroyEntity(self); - return; - } - } else { - ptr++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp3 = tilemap->scrollX.i.hi + 6; - x = right; - x += (ptr[self->ext.waterEffects.unk88] - temp3); - if (self->posX.i.hi >= x) { - DestroyEntity(self); - return; - } - } - } - - j = 0; - tempv0 = self->ext.waterEffects.unk82; - x = self->posX.i.hi; - y = self->posY.i.hi; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED bottom = tempv0 - y - tilemap->scrollY.i.hi; - - prim = &g_PrimBuf[self->primIndex]; - temp_t0 = x - 9; - x += 9; - - while (j < 2) { - prim->y2 = prim->y2 - bottom; - prim->y3 = prim->y3 - bottom; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->y0 = prim->y2 - self->ext.waterEffects.topY.i.hi; prim->y1 = prim->y3 - self->ext.waterEffects.topY.i.hi; - prim->x2 = prim->x0 = temp_t0; - prim->x3 = prim->x1 = x; - prim->b1 += 248; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1; - prim->b3 += 252; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - if (prim->r0 < 9) { - DestroyEntity(self); - return; - } - prim = prim->next; - j++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.unk82 = self->posY.i.hi + tilemap->scrollY.i.hi; -} +REDACTED -// ID 0x37 -void EntitySideWaterSplash(Entity* self) { +REDACTED +REDACTED Primitive* prim; s16 primIndex; - s32 temp_lo; - s32 temp_s0; - s32 temp_s1; - s32 temp_s3; - u16 params; - s16 angle; - u16 x, y; - s32* ptr; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->u0 = prim->u2 = 0xF0; - prim->u1 = prim->u3 = 0xFF; - prim->v0 = prim->v1 = 0; - prim->v2 = prim->v3 = 0xF; - prim->clut = 0x161; - prim->tpage = 0x1A; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = - prim->b3 = prim->r0 = prim->g0 = prim->b0 = prim->r1 = - prim->g1 = prim->b1 = 128; - prim->p1 = 0; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x37; - prim = prim->next; - } - params = self->params; - temp_s0 = params & 0xF; - if (temp_s0 == 0) { - g_api.PlaySfx(D_801813A8); - } - angle = LOH(D_801838E4[(params >> 3) & 0x1E]); - ptr = (s32*)&D_801838A4[temp_s0]; - temp_s1 = rcos(angle) * *ptr; - temp_s3 = rsin(angle + 0x800) * *ptr; - ptr++; - temp_s1 += rsin(angle) * *ptr; - temp_lo = rcos(angle) * *ptr; - self->velocityX = temp_s1 + (((params & 0xFF00) << 0x10) >> 0xE); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.accelY = FIX(22.0 / 128); - self->velocityY = temp_s3 + temp_lo; - } else { - DestroyEntity: - DestroyEntity(self); - return; - } - break; - - case 1: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += self->ext.waterEffects.accelY; - break; - } - - x = self->posX.i.hi; - y = self->posY.i.hi; - - prim = &g_PrimBuf[self->primIndex]; - while (prim != NULL) { - prim->x0 = prim->x2 = x - (prim->p1 / 2) - 4; - prim->x1 = prim->x3 = x + (prim->p1 / 2) + 4; - prim->y0 = prim->y1 = y - (prim->p1 / 2) - 4; - prim->y2 = prim->y3 = y + (prim->p1 / 2) + 4; - if (prim->b1 >= 3) { - prim->b1 += 253; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1; - if (prim->b3 >= 4) { - prim->b3 += 252; - } - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - prim->p1++; - prim = prim->next; - } else { - goto DestroyEntity; - } - } -} - -// ID 0x38 -void EntitySmallWaterDrop(Entity* self) { - s32 params = self->params; - s16 temp_s5 = params & 0xFF00; - Primitive *prim, *prim2; - s16 primIndex; - s32 var_v1; - u16 x, y; - - params &= 0xFF; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - primIndex = g_api.AllocPrimitives(PRIM_TILE, 1); - if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - - x = self->posX.i.hi; - y = self->posY.i.hi; - y -= Random() & 3; - - if (temp_s5 > 0) { - x += Random() & 3; - } else { - x -= Random() & 3; - } - self->posX.i.hi = x; - self->posY.i.hi = y; - - while (prim != NULL) { - prim->v0 = prim->u0 = 2; - prim->x0 = x; - prim->y0 = y; - prim->r0 = 96; - prim->g0 = 96; - prim->b0 = 128; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - prim = prim->next; - } - var_v1 = D_801838F4[params * 2]; - if (temp_s5 > 0) { - var_v1 = -var_v1; - } - self->velocityX = var_v1 + (temp_s5 * 16); - self->velocityY = D_801838F4[params * 2 + 1]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.accelY = FIX(0.25); break; case 1: MoveEntity(self); self->velocityY += self->ext.waterEffects.accelY; - break; - } - - x = self->posX.i.hi; - y = self->posY.i.hi; - - prim = &g_PrimBuf[self->primIndex]; - prim->x0 = x; - prim->y0 = y; - if (prim->b0 >= 8) { - prim->b0 += 248; - prim->r0 = prim->g0 -= 6; - return; - } - DestroyEntity(self); -} - -// ID 0x38 -void EntityWaterDrop(Entity* self) { - u16 x = self->posX.i.hi; - u16 y = self->posY.i.hi; - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); primIndex = g_api.func_800EDB58(PRIM_TILE_ALT, 0x21); if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.generic.unk7C.s = 0x2F; - self->flags |= FLAG_HAS_PRIMS; - - while (1) { +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x73; - prim->priority = self->zPriority + 2; - - if (prim->next == NULL) { - prim->u0 = 0; - prim->x0 = 0; - prim->y0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode &= ~DRAW_HIDE; - break; - } - - prim->x1 = 0; - LOH(prim->r1) = 0; - LOW(prim->r2) = (rand() * 8) + self->velocityY; - prim->y1 = y + (rand() & 15); - LOH(prim->b1) = x + (rand() & 31) - 16; - LOH(prim->u2) = (rand() & 15) + 32; - prim->b0 = prim->g0 = prim->r0 = 255; - prim->v0 = prim->u0 = 2; - prim->x0 = LOH(prim->b1); - prim->y0 = prim->y1; - prim = prim->next; - } - break; - - case 1: - if (--self->ext.generic.unk7C.s == 0) { - DestroyEntity(self); - return; - } - - prim = &g_PrimBuf[self->primIndex]; - - while (1) { - if (prim->next == NULL) { - prim->u0 = 0; - prim->x0 = 0; - prim->y0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode &= ~DRAW_HIDE; - return; - } - LOH(prim->b1) = prim->x0; - prim->y1 = prim->y0; - LOH(prim->u2)--; - if (LOH(prim->u2) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= DRAW_HIDE; - } - LOW(prim->x1) += LOW(prim->r2); - if (LOW(prim->r2) > 0x8000) { - prim->r0 += 252; - prim->g0 += 252; - prim->b0 += 252; - } else { - LOW(prim->r2) += 0x3800; - } - prim->x0 = LOW(prim->b1); - prim->y0 = prim->y1; - prim = prim->next; - } - break; - } -} - -s32 func_801D2D40(s16 yVector) { - s16 newY = yVector + g_CurrentEntity->posY.i.hi; - s32 expectedResult = 0; - Collider collider; - Entity* newEntity; - s32 res; - - g_api.CheckCollision(g_CurrentEntity->posX.i.hi, newY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED res = expectedResult == (collider.effects & EFFECT_SOLID); if (collider.effects & EFFECT_WATER) { if (!g_CurrentEntity->ext.merman.isUnderwater) { newEntity = AllocEntity(g_Entities + 232, g_Entities + 256); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity( E_MERMAN_UNK0, g_CurrentEntity, newEntity); - newEntity->posY.i.hi += yVector; - newEntity->zPriority = g_CurrentEntity->zPriority; - } +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SE_WATER_SPLASH); g_CurrentEntity->ext.merman.isUnderwater = true; } @@ -637,499 +637,499 @@ void EntityMerman2(Entity* self) { s32 primIndex; Collider collider; Entity* newEntity; - Entity* newEntity2; - Primitive* prim; - s16 posX, posY; - s32 colRes; - s32 offset; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED u32 colorOffset; - s16* pos; - s16 camY; - s32 rnd; - s32 i; - - if (self->ext.merman2.ignoreCol && (self->step < MERMAN2_7)) { - SetStep(MERMAN2_7); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < MERMAN2_DYING)) { PlaySfxPositional(0x71D); self->drawFlags = 0; if (self->flags & FLAG_HAS_PRIMS) { g_api.FreePrimitives(self->primIndex); self->flags &= ~FLAG_HAS_PRIMS; - } +REDACTED self->hitboxState = 0; - self->flags &= ~FLAG_UNK_20000000; - SetStep(MERMAN2_DYING); - } - - switch (self->step) { - case MERMAN2_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B48); self->hitboxOffY = 8; - self->zPriority = 0xA9; - if (self->params != 0) { - self->palette++; - } +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-1); - break; - - case MERMAN2_SWIMMING_UP: +REDACTED +REDACTED +REDACTED AnimateEntity(D_8018398C, self); - MoveEntity(); - posY = self->posY.i.hi - 24; - g_api.CheckCollision(self->posX.i.hi, posY, &collider, 0); +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { - SetStep(MERMAN2_SWIMMING); - } +REDACTED +REDACTED break; - - case MERMAN2_SWIMMING: - if (self->step_s == 0) { - rnd = Random() & 3; +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = D_80183914[rnd].x; self->velocityY = D_80183914[rnd].y; self->step_s++; } if (AnimateEntity(D_8018398C, self) == 0) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - MoveEntity(); - posX = self->posX.i.hi; - posY = self->posY.i.hi; - posY -= 24; - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { self->velocityY = FIX(0.5); - } +REDACTED pos = D_801813AC; - pos += (self->params >> 8) & 1; +REDACTED posY += g_Tilemap.scrollY.i.hi; - if (pos[4] < posY) { +REDACTED self->posY.i.hi = pos[4] - g_Tilemap.scrollY.i.hi - 24; - } - - if ((u8)self->ext.merman2.timer++ > 32) { - self->ext.merman2.timer = 0; - self->step_s = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((GetDistanceToPlayerX() >= 48) && !(Random() & 1)) { - SetStep(MERMAN2_JUMPING); - } - } - break; - - case MERMAN2_JUMPING: - switch (self->step_s) { - case MERMAN2_JUMPING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = FIX(-8.5); - self->step_s++; +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { - u32 v0; +REDACTED prim = &g_PrimBuf[primIndex]; - self->animCurFrame = 0; +REDACTED self->primIndex = primIndex; - self->ext.merman2.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - prim->tpage = 0x12; - prim->clut = 0x28C; - if (self->params & 1) { - prim->clut = 0x28D; - } - prim->u0 = 0; - prim->u1 = 0x20; - prim->v1 = prim->v0 = 0x38; - prim->u2 = prim->u0; - prim->u3 = prim->u1; - v0 = prim->v0 + 0x38; - prim->v2 = v0; - prim->v3 = v0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - s16 posX = self->posX.i.hi; - prim->x0 = posX + 15; - prim->x1 = posX - 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - } else { - s16 posX = self->posX.i.hi; - prim->x0 = posX - 15; - prim->x1 = posX + 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - } - prim->y0 = prim->y1 = self->posY.i.hi - 17; - - setRGB0(prim, 64, 64, 160); - - *(s32*)&prim->r1 = *(s32*)&prim->r0; - *(s32*)&prim->r2 = *(s32*)&prim->r0; - *(s32*)&prim->r3 = *(s32*)&prim->r0; - - prim->y3 = prim->y2 = prim->y0 + 0x38; - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 6; } else { self->animCurFrame = 17; DestroyEntity(self); } - break; - - case MERMAN2_JUMPING_UNDERWATER: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED pos = D_801813AC; - pos += (self->params >> 8) & 1; - posY = self->posY.i.hi; - posY -= 24; +REDACTED +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi + posY; - if (camY < pos[3]) { - g_api.PlaySfx(NA_SE_EV_WATER_SPLASH); +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); if (newEntity != NULL) { CreateEntityFromEntity(E_MERMAN_UNK0, self, newEntity); - newEntity->posY.i.hi -= 24; - newEntity->zPriority = self->zPriority; - } +REDACTED +REDACTED +REDACTED self->rotZ = 0; self->drawFlags |= 4; - self->step_s++; - } - break; - - case MERMAN2_JUMPING_IN_AIR: - prim = self->ext.merman2.prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY > ~0xBFFF) { prim->drawMode = DRAW_HIDE; - self->animCurFrame = 18; - self->hitboxHeight = 8; +REDACTED +REDACTED self->rotZ -= 0x80; - } else { +REDACTED if (self->facingLeft != 0) { - s16 posX = self->posX.i.hi; - prim->x0 = posX + 15; - prim->x1 = posX - 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - prim->y1 = prim->y0 = self->posY.i.hi - 17; - prim->y3 = prim->y2 = prim->y0 + 0x38; - } else { - s16 posX = self->posX.i.hi; - prim->x0 = posX - 15; - prim->x1 = posX + 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - prim->y1 = prim->y0 = self->posY.i.hi - 17; - prim->y3 = prim->y2 = prim->y0 + 0x38; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED colorOffset = (u32)(((__builtin_abs(self->velocityY) >> 0xC) - 10) & 0xFF) >> 1; - +REDACTED setRGB0(prim, 128 - colorOffset, 128 - colorOffset, colorOffset + 192); - - *(s32*)&prim->r1 = *(s32*)&prim->r0; - *(s32*)&prim->r2 = *(s32*)&prim->r0; - *(s32*)&prim->r3 = *(s32*)&prim->r0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY < 0) { newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); if (newEntity != NULL) { CreateEntityFromEntity(E_MERMAN2_UNK0, self, newEntity); - newEntity->posX.i.hi -= 6 - ((Random() & 3) * 4); - newEntity->zPriority = self->zPriority + 1; - } - } +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY > 0) { func_801D2D40(0x1B); } if (self->ext.merman2.isUnderwater == 0) { if (UnkCollisionFunc3(&D_80183938) & 1) { g_api.FreePrimitives(self->primIndex); - self->hitboxHeight = 21; +REDACTED self->flags &= ~FLAG_HAS_PRIMS; self->drawFlags &= 0xFB; - SetStep(MERMAN2_WALKING_TO_PLAYER); - } - } else { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); - } - } - break; - - case MERMAN2_WALKING_TO_PLAYER: - switch (self->step_s) { - case MERMAN2_WALKING_TO_PLAYER_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80183984, self) == 0) { - self->animFrameIdx = 0; - self->animFrameDuration = 0; - self->step_s++; - } - break; - - case MERMAN2_WALKING_TO_PLAYER_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->ext.merman2.timer = D_80183934[Random() & 3]; - self->step_s++; - break; - - case MERMAN2_WALKING_TO_PLAYER_WALKING: +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80183960, self); colRes = UnkCollisionFunc2(&D_80183958); - if (colRes == 0xFF) { +REDACTED self->facingLeft ^= 1; - } +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - - if (colRes & 0x80) { +REDACTED +REDACTED +REDACTED self->posX.val += self->velocityX; - } - - if (!(self->params & 1) || +REDACTED +REDACTED +REDACTED (self->velocityX *= 2, !(self->params & 1))) { - if (!(self->posX.i.hi & 0xFF00)) { - self->ext.merman2.timer--; - if ((self->ext.merman2.timer & 0xFF) == 0) { - if (Random() % 2) { - SetStep(MERMAN2_SPIT_FIRE); - } else { - self->step_s--; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (func_801D2D40(0x1B)) { self->ext.merman2.ignoreCol = 1; } } } else { if (func_801D2D40(0x1B)) { - self->ext.merman2.ignoreCol = 1; - } - } - } - break; - - case MERMAN2_SPIT_FIRE: - switch (self->step_s) { - case MERMAN2_SPIT_FIRE_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; +REDACTED break; case MERMAN2_SPIT_FIRE_ATTACK: if (AnimateEntity(D_8018396C, self) == 0) { PlaySfxPositional(SFX_FIREBALL_SHOT_C); - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); +REDACTED i = 0; if (newEntity != NULL) { CreateEntityFromEntity(E_MERMAN2_UNK1, self, newEntity); - newEntity->posY.i.hi -= 12; +REDACTED newEntity->facingLeft = self->facingLeft; - } +REDACTED newEntity2 = g_Entities + 224; - for (offset = 0; i < 3; i++, offset += 8) { +REDACTED newEntity = AllocEntity(newEntity2, newEntity2 + 32); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_MERMAN2_UNK2, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 8 + offset; - } else { - newEntity->posX.i.hi += -8 - offset; - } - newEntity->posY.i.hi -= 12; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - if (i == 0) { - newEntity->params = 1; - } - } - } - self->ext.merman2.rotation = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ = 0; self->drawFlags |= 4; if (self->facingLeft != 0) { self->velocityX = FIX(-6); - } else { +REDACTED self->velocityX = FIX(6); - } +REDACTED self->velocityY = FIX(-0.0625); - self->posY.i.hi -= 1; - self->step_s++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->ext.merman2.rotation < 0x100) && (g_Timer & 1)) { - self->ext.merman2.rotation *= 2; - } +REDACTED +REDACTED if (self->velocityX != 0) { if (self->facingLeft != 0) { self->velocityX += FIX(0.1875); - } else { +REDACTED self->velocityX -= FIX(0.1875); - } - } - posX = self->posX.i.hi; - posY = self->posY.i.hi + 8; +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX -= 20; - } else { - posX += 20; - } - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { self->velocityX = 0; - } +REDACTED self->rotZ += self->ext.merman2.rotation; self->velocityY -= FIX(0.125); - +REDACTED if (UnkCollisionFunc3(&D_80183938) & 1) { if (self->facingLeft == 0) { self->velocityX = FIX(2.5); } else { self->velocityX = FIX(-5.0 / 2.0); - } - self->ext.merman2.rotation = 4; - self->posY.i.hi += 10; - self->step_s++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED func_801D2D40(0x1B); - if (self->ext.merman2.isUnderwater) { - self->ext.merman2.ignoreCol = 1; - } - break; - - case 3: - posY = self->posY.i.hi + 8; - posX = self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX -= 20; - } else { - posX += 20; - } - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { self->velocityX = 0; - } - MoveEntity(); +REDACTED +REDACTED self->rotZ += 0xC0; if (self->rotZ > 0x1000) { - self->posY.i.hi -= 10; +REDACTED self->drawFlags &= 0xFB; - SetStep(MERMAN2_WALKING_TO_PLAYER); - } +REDACTED +REDACTED if (func_801D2D40(0x1B)) { - self->ext.merman2.ignoreCol = 1; - } - } - break; - - case MERMAN2_7: - if (self->step_s == 0) { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - self->step_s++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED MoveEntity(); self->velocityY += FIX(0.25); if (!(func_801D2D40(0x1B)) && !(self->ext.merman2.isUnderwater)) { - self->ext.merman2.ignoreCol = 0; - SetStep(MERMAN2_WALKING_TO_PLAYER); - } - break; - - case MERMAN2_DYING: - switch (self->step_s) { - case 0: - self->animCurFrame = 14; - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(GetSideToPlayer() & 1)) { self->velocityX = FIX(-2); - } else { +REDACTED self->velocityX = FIX(2); - } +REDACTED self->velocityY = FIX(-1); - self->step_s++; +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex != -1) { - u32 v0; +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.merman2.prim = prim; - self->flags |= 0x800000; +REDACTED +REDACTED UnkPolyFunc2(prim); - prim->tpage = 0x12; - prim->clut = 0x292; - if (self->params & 1) { - prim->clut = 0x293; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - u32 u1 = 0x1C8; - prim->u0 = 0xF0; - prim->u1 = u1; - } else { - prim->u0 = 0xC8; - prim->u1 = 0xF0; - } - - prim->v0 = prim->v1 = 0; - prim->u2 = prim->u0; - prim->u3 = prim->u1; - v0 = prim->v0 + 0x30; - prim->v2 = v0; - prim->v3 = v0; - - prim->priority = self->zPriority + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - *(s16*)&prim->next->r2 = 0x28; - *(s16*)&prim->next->b2 = 0x30; - prim->next->b3 = 0x80; +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - prim->next->x1 = self->posX.i.hi - 3; - } else { - prim->next->x1 = self->posX.i.hi + 3; - } - prim->next->y0 = self->posY.i.hi + 2; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - break; - - case 1: +REDACTED +REDACTED +REDACTED UnkCollisionFunc3(&D_80183948); - prim = self->ext.merman2.prim; +REDACTED self->velocityY -= FIX(0.1875); if (self->facingLeft != 0) { - prim->next->x1 = self->posX.i.hi - 3; - } else { - prim->next->x1 = self->posX.i.hi + 3; - } - prim->next->y0 = self->posY.i.hi + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); if (!(g_Timer % 10)) { - prim->clut += 2; - if (prim->clut >= 0x2A0) { +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - self->step_s++; - } else { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN2_UNK3, self, newEntity); newEntity->facingLeft = self->facingLeft; - newEntity->params = prim->clut; - newEntity->zPriority = self->zPriority; - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED func_801D2D40(0x1B); break; @@ -1142,17 +1142,17 @@ void EntityMerman2(Entity* self) { } } -// some sort of explosion -void EntityExplosion2(Entity* entity, s32 arg1) { +REDACTED +REDACTED Primitive* prim; s16 primIndex; - - if (entity->step == 0) { - InitializeEntity(D_80180B48); - entity->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxState = 0; entity->zPriority += 4; - if (entity->params != 0) { +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex == -1) { DestroyEntity(entity); @@ -1192,20 +1192,20 @@ void EntityExplosion2(Entity* entity, s32 arg1) { } } - entity->ext.generic.unk84.U8.unk0++; - if (!(entity->ext.generic.unk84.U8.unk0 % 4)) { - entity->posY.i.hi++; - } - - if (AnimateEntity(D_801839A0, entity) == 0) { - DestroyEntity(entity); - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // medium sized water splash used with merman void EntityMediumWaterSplash(Entity* entity) { - Entity* newEntity; - +REDACTED +REDACTED if (entity->step == 0) { InitializeEntity(D_80180B54); entity->animCurFrame = 0; @@ -1220,132 +1220,132 @@ void EntityMediumWaterSplash(Entity* entity) { MoveEntity(); if (entity->flags & FLAG_DEAD) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(2, entity, newEntity); - newEntity->params = 0; +REDACTED +REDACTED +REDACTED } DestroyEntity(entity); } } // spawns EntityMediumWaterSplash, part of merman splash -void EntityMermanWaterSplash(Entity* self) { - Unkstruct_801C7954 sp; - Entity* newEntity; +REDACTED +REDACTED +REDACTED Primitive* prim; s16 primIndex; - s16* posPtr; - s32* velPtr; - u8 temp; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - break; - - case 1: - primIndex = g_api.AllocPrimitives(PRIM_TILE, 4); +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { DestroyEntity(self); return; } - prim = &g_PrimBuf[primIndex]; +REDACTED self->primIndex = primIndex; - self->ext.mermanWaterSplash.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - for (i = 0; prim != NULL; i++) { - prim->g0 = prim->r0 = 64; - prim->b0 = 160; - prim->v0 = prim->u0 = 2; - prim->x0 = self->posX.i.hi + D_801839E8[i]; - prim->y0 = self->posY.i.hi - 12; - LOW(sp.y3) = D_801839C0[i].x; - prim->y1 = sp.y1; - prim->y3 = sp.y3; - LOW(sp.x3) = D_801839C0[i].y; - prim->x2 = sp.x2; - prim->x3 = sp.x3; - prim->p1 = 0; - prim->p3 = 1; - prim->p2 = i % 2; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - prim = prim->next; - } - - posPtr = &D_801839FC; - velPtr = &D_80183A0C; - - for (i = 0; i < 7; i++) { - newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_MEDIUM_WATER_SPLASH, self, newEntity); - newEntity->params = D_801839F4[i]; - newEntity->posX.i.hi = newEntity->posX.i.hi + posPtr[i]; - newEntity->velocityX = velPtr[i]; - newEntity->zPriority = self->zPriority + 1; - } - } - self->ext.mermanWaterSplash.unk84 = 0; - self->ext.mermanWaterSplash.unk86 = 0; - self->step++; - break; - - case 2: - prim = self->ext.mermanWaterSplash.prim; - temp = false; - while (prim != NULL) { - if (prim->p1 == 0) { - sp.x0 = prim->x0; - sp.x1 = prim->x1; - sp.y0 = prim->y0; - sp.y2 = prim->y2; - sp.y1 = prim->y1; - sp.y3 = prim->y3; - sp.x2 = prim->x2; - sp.x3 = prim->x3; - temp |= true; - LOW(sp.x1) += LOW(sp.y3); - LOW(sp.y2) += LOW(sp.x3); - LOW(sp.x3) += 0x2000; - if ((LOW(sp.x3) > 0) && (prim->p2 != 0) && (prim->p3 != 0)) { - if (LOH(sp.x0) > self->posX.i.hi) { - LOW(sp.y3) += 0x4000; - } else { - LOW(sp.y3) -= 0x4000; - } - prim->p3 = 0; - } - if (prim->y0 & 0xFF00) { - prim->p1 = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= 8; - } - prim->x0 = sp.x0; - prim->x1 = sp.x1; - prim->y0 = sp.y0; - prim->y2 = sp.y2; - prim->x2 = sp.x2; - prim->x3 = sp.x3; - prim->y1 = sp.y1; - prim->y3 = sp.y3; - } - prim = prim->next; - } - if (!temp) { - DestroyEntity(self); - return; - } - break; - } -} - -// some kind of falling object -void EntityFallingObject2(Entity* self) { - if (self->step == 0) { - InitializeEntity(D_80180B48); - self->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; self->flags |= 0x2000; self->zPriority += 4; @@ -1353,15 +1353,15 @@ void EntityFallingObject2(Entity* self) { MoveEntity(); self->velocityY += FIX(0.15625); if (AnimateEntity(D_801839A8, self) == 0) { - DestroyEntity(self); - } -} - -void EntityUnkId3D(Entity* self) { - s8 temp; // probably !FAKE - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); self->animSet = ANIMSET_DRA(2); self->velocityY = FIX(-5); @@ -1373,15 +1373,15 @@ void EntityUnkId3D(Entity* self) { self->rotX = 0x100; self->rotY = 0x1A0; self->drawFlags |= 3; - self->ext.generic.unk84.S8.unk1 = 0x11; - self->ext.generic.unk84.S8.unk0 = self->params; +REDACTED +REDACTED self->drawFlags |= 8; break; case 1: - temp = self->ext.generic.unk84.S8.unk0 - 1; - self->ext.generic.unk84.S8.unk0--; - self->ext.generic.unk84.S8.unk1--; +REDACTED +REDACTED +REDACTED if (!(temp & 0xFF)) { self->step++; } @@ -1396,7 +1396,7 @@ void EntityUnkId3D(Entity* self) { if (self->posY.i.hi > 256) { DestroyEntity(self); } - if (!--self->ext.generic.unk84.U8.unk1) { +REDACTED self->velocityY = 0; self->step++; } @@ -1408,33 +1408,33 @@ void EntityUnkId3D(Entity* self) { self->velocityY += FIX(0.25); self->rotX += 6; self->rotY -= 4; - } - if (self->posY.i.hi > 256) { - DestroyEntity(self); - } - break; - } -} - -// falling object, larger -void EntityLargeFallingObject(Entity* self) { - u8 temp_v0; - - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B48); self->animCurFrame = 13; - self->ext.generic.unk84.S8.unk0 = 0x20; +REDACTED self->hitboxState = 0; self->velocityY = FIX(0.0625); - self->palette = self->params + 0xE; +REDACTED self->unk6C = 0x80; self->drawFlags |= 8; self->flags |= 0x2000; return; } MoveEntity(); - temp_v0 = self->ext.generic.unk84.U8.unk0 - 1; - self->ext.generic.unk84.U8.unk0--; +REDACTED +REDACTED self->velocityY += FIX(0.0625); self->unk6C += 0xFE; if (temp_v0 == 0) { @@ -1442,40 +1442,40 @@ void EntityLargeFallingObject(Entity* self) { } } -void EntityMermanSpawner(Entity* self) { - Entity* newEntity; - u16 temp_s0_2; - u16 temp_s0; - s32 temp2; - s16 temp; - - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD0); self->flags |= FLAG_UNK_2000; - } - +REDACTED +REDACTED if (!(g_Timer & 0x3F)) { - Entity* player = &PLAYER; +REDACTED temp = g_Tilemap.scrollY.i.hi + player->posY.i.hi; - if (temp >= 256) { +REDACTED temp_s0 = g_Tilemap.scrollX.i.hi + player->posX.i.hi; - temp_s0_2 = 128; - temp_s0_2 = temp_s0 - temp_s0_2 + Random(); - temp_s0 = temp_s0_2 - 64; - if (temp_s0 <= 0x280) { - temp2 = 496; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[160], &g_Entities[170]); - if (newEntity != 0) { - if (Random() & 1) { +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_ID_3A, newEntity); newEntity->params = Random() & 1; } else { CreateEntityFromCurrentEntity(E_ID_41, newEntity); - } +REDACTED newEntity->posX.i.hi = temp_s0_2 - g_Tilemap.scrollX.i.hi; newEntity->posY.i.hi = temp2 - g_Tilemap.scrollY.i.hi; - } - } - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/no3/53F38.c b/src/st/no3/53F38.c index d1880eb6a6..38bf7de99d 100644 --- a/src/st/no3/53F38.c +++ b/src/st/no3/53F38.c @@ -15,154 +15,154 @@ extern s16 D_80183A5C; extern s16 D_80183A6C; extern u8 D_80183ADC[]; // animation extern s16 D_801813AC[]; - -void EntityMerman(Entity* self) { - Entity* newEntity; - Collider collider; - s16 posX, posY; - s32 colRet; - s16* pos; - s16 camY; - s32 rnd; - - if (self->ext.merman.isUnderwater) { - self->palette = self->ext.merman.palette; - } - if (self->ext.merman.ignoreCol && (self->step < MERMAN_FALLING)) { - SetStep(MERMAN_FALLING); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < MERMAN_DYING)) { PlaySfxPositional(0x71D); self->hitboxState = 0; - if (self->step == MERMAN_LUNGE) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - } - DestroyEntity(self); - return; - } - SetStep(MERMAN_DYING); - } - - switch (self->step) { - case MERMAN_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B60); - self->ext.merman.palette = 0x2B9; - self->zPriority = 0xA9; +REDACTED +REDACTED self->velocityY = FIX(-1); - self->hitboxWidth = 5; - self->hitboxHeight = 17; - self->palette = self->ext.merman.palette; - break; - - case MERMAN_SWIMMING_UP: - if (self->step_s == 0) { - self->hitboxWidth = 18; - self->hitboxHeight = 4; - self->step_s++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80183AC0, self); - MoveEntity(); - - posX = self->posX.i.hi; - posY = self->posY.i.hi - 24; - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { - SetStep(MERMAN_SWIMMING); - } +REDACTED +REDACTED break; - case MERMAN_SWIMMING: - if (self->step_s == 0) { - self->hitboxWidth = 5; - self->hitboxHeight = 17; - rnd = Random() & 3; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = D_80183A28[rnd].x; self->velocityY = D_80183A28[rnd].y; self->step_s++; } if (AnimateEntity(D_80183AC0, self) == 0) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - MoveEntity(); +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi; - posX = self->posX.i.hi; - posY = self->posY.i.hi; - posY -= 24; - - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { self->velocityY = FIX(0.5); - } - +REDACTED +REDACTED pos = D_801813AC; - pos += (self->params >> 8) & 1; +REDACTED posY += g_Tilemap.scrollY.i.hi; - if (pos[4] < posY) { +REDACTED self->posY.i.hi = pos[4] - g_Tilemap.scrollY.i.hi - 24; - } - if ((u8)self->ext.merman.timer2++ > 32) { - self->ext.merman.timer2 = 0; - self->step_s = 0; +REDACTED +REDACTED +REDACTED +REDACTED if ((GetDistanceToPlayerX() >= 48) && !(Random() & 1)) { - SetStep(MERMAN_JUMPING); - } - } - break; - - case MERMAN_JUMPING: - switch (self->step_s) { - case MERMAN_JUMPING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = FIX(-8.5); - self->step_s++; - break; - - case MERMAN_JUMPING_UNDERWATER: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED pos = D_801813AC; - pos += (self->params >> 8) & 1; +REDACTED camY = g_Tilemap.scrollY.i.hi; - posY = self->posY.i.hi; - posY -= 20; - posY += camY; - if (posY < pos[3]) { - g_api.PlaySfx(NA_SE_EV_WATER_SPLASH); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); if (newEntity != NULL) { CreateEntityFromEntity(E_MERMAN_UNK0, self, newEntity); - newEntity->posY.i.hi -= 20; - newEntity->zPriority = self->zPriority; - } - self->step_s++; - } - break; - - case MERMAN_JUMPING_IN_AIR: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80183AAC, self); if (!self->ext.merman.isUnderwater) { if (UnkCollisionFunc3(&D_80183A4C) & 1) { - self->animFrameDuration = 0; - self->animFrameIdx = 0; - self->step_s++; - } - } else { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); - } - - self->ext.merman.timer++; +REDACTED +REDACTED +REDACTED if (self->velocityY < 0) { - if ((self->ext.merman.palette >= 0x2B3) && - !(self->ext.merman.timer % 4)) { - self->ext.merman.palette--; - } - self->palette = self->ext.merman.palette; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); if (newEntity != NULL) { CreateEntityFromEntity(E_MERMAN_UNK1, self, newEntity); @@ -179,195 +179,195 @@ void EntityMerman(Entity* self) { case MERMAN_JUMPING_LANDING: if (AnimateEntity(D_80183ACC, self) != 0) { - break; - } - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } - break; - - case MERMAN_WALKING_TOWARDS_PLAYER: - switch (self->step_s) { - case MERMAN_WALKING_TOWARDS_START: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } +REDACTED self->ext.merman.timer2 = D_80183A48[Random() & 3]; - self->step_s++; - break; - - case MERMAN_WALKING_TOWARDS_PLAYER_WALKING: +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80183A84, self); colRet = UnkCollisionFunc2(&D_80183A7C); - if (colRet == 0xFF) { +REDACTED self->facingLeft ^= 1; - } +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - if (colRet & 0x80) { +REDACTED +REDACTED self->posX.val += self->velocityX; - } - self->ext.merman.timer2--; - if (!(self->ext.merman.timer2 & 0xFF)) { - if (Random() % 2) { - SetStep(MERMAN_SPIT_FIRE); - } else { - SetStep(MERMAN_LUNGE); - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (func_801D2D40(0x15)) { - self->ext.merman.ignoreCol = 1; - } - } - break; - - case MERMAN_SPIT_FIRE: - switch (self->step_s) { - case MERMAN_SPIT_FIRE_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; - break; - - case MERMAN_SPIT_FIRE_ATTACK: +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80183A9C, self) == 0) { - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { PlaySfxPositional(SFX_FIREBALL_SHOT_C); - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN_UNK2, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 12; - } else { - newEntity->posX.i.hi -= 12; - } - newEntity->posY.i.hi -= 10; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - } - } - } - break; - - case MERMAN_LUNGE: - switch (self->step_s) { - case MERMAN_LUNGE_START: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80183ACC, self) == 0) { - self->step_s++; - } - break; - - case MERMAN_LUNGE_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-5.0 / 2.0); - } else { +REDACTED self->velocityX = FIX(2.5); - } - +REDACTED +REDACTED self->velocityY = FIX(-2); - self->ext.merman.timer2 = 64; - self->animCurFrame = 12; - self->hitboxWidth = 18; - self->hitboxHeight = 4; - self->step_s++; - break; - - case MERMAN_LUNGE_TOWARDS_PLAYER: - posY = self->posY.i.hi + 8; - posX = self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX += 24; - } else { - posX -= 24; - } - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { self->velocityX = 0; - } +REDACTED UnkCollisionFunc5(&D_80183A5C); if (self->facingLeft != 0) { self->velocityX -= FIX(0.03125); - } else { +REDACTED self->velocityX += FIX(0.03125); - } - self->ext.merman.timer2--; - if ((self->ext.merman.timer2 & 0xFF) == 0) { +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = FIX(2); - self->posY.i.hi -= 9; +REDACTED UnkCollisionFunc3(&D_80183A4C); - self->animFrameIdx = 2; - self->hitboxWidth = 5; - self->animFrameDuration = 0; - self->hitboxHeight = 17; - self->step_s++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED func_801D2D40(11); - if (self->ext.merman.isUnderwater) { - self->ext.merman.ignoreCol = 1; - } - break; - - case MERMAN_LUNGE_STANDING: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkCollisionFunc3(&D_80183A4C); if (AnimateEntity(D_80183ACC, self) == 0) { self->velocityY = 0; - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } +REDACTED +REDACTED func_801D2D40(11); - if (self->ext.merman.isUnderwater) { - self->ext.merman.ignoreCol = 1; - } - } - break; - - case MERMAN_FALLING: - if (self->step_s == 0) { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - self->step_s++; - } - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); if (!(func_801D2D40(21)) && !(self->ext.merman.isUnderwater)) { - self->ext.merman.ignoreCol = 0; - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } - break; - - case MERMAN_DYING: - switch (self->step_s) { - case MERMAN_DYING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.merman.palette = PAL_DRA(0x2BC); self->velocityY = 0; - self->step_s++; - - case MERMAN_DYING_KNOCKEDBACK: +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_80183A6C) & 1) { if (!(GetSideToPlayer() & 1)) { self->velocityX = FIX(-0.5); - } else { +REDACTED self->velocityX = FIX(0.5); - } - self->step_s++; - } +REDACTED +REDACTED +REDACTED // fallthrough case MERMAN_DYING_END: AnimateEntity(D_80183ADC, self); // spinning - MoveEntity(); - self->palette = self->ext.merman.palette; +REDACTED +REDACTED if (!(g_Timer % 8)) { - self->ext.merman.palette++; +REDACTED if (self->ext.merman.palette == PAL_DRA(0x2C0)) { PlaySfxPositional(SFX_FM_EXPLODE_B); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN_UNK3, self, newEntity); newEntity->params = 2; } @@ -382,16 +382,16 @@ void EntityMerman(Entity* self) { } } -// fireball shot by merman -void EntityMermanFireball(Entity* self) { - Entity* entity; - - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B6C); - self->hitboxWidth = 6; - self->animCurFrame = 0; - self->hitboxHeight = 3; - +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { self->velocityX = 0x10000 | 0x8000; // LINT_IGNORE } else { @@ -401,10 +401,10 @@ void EntityMermanFireball(Entity* self) { self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; self->rotY = self->rotX = 0x80; - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { - CreateEntityFromEntity(E_ID_15, self, entity); - entity->ext.generic.unk94 = 4; +REDACTED +REDACTED +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; entity->zPriority = self->zPriority + 8; entity->rotY = entity->rotX = 192; @@ -419,9 +419,9 @@ void EntityMermanFireball(Entity* self) { if (self->flags & FLAG_DEAD) { entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { - CreateEntityFromEntity(2, self, entity); - entity->params = 0; +REDACTED +REDACTED +REDACTED } DestroyEntity(self); } @@ -449,24 +449,24 @@ extern s32 D_80183B30[]; extern u16 D_80183B48[]; // part of explosion when merman dies -void EntityMermanExplosion(Entity* self) { - if (self->step == 0) { +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); self->palette = PAL_OVL(0x2BB); self->animSet = ANIMSET_DRA(2); self->animCurFrame = D_80183B44[self->params]; self->velocityY = D_80183B30[self->params]; - self->step++; - return; - } else { - self->animFrameDuration++; +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += self->velocityY; - } - - if (!(self->animFrameDuration & 1)) { - self->animCurFrame++; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (D_80183B48[self->params] < self->animFrameDuration) { DestroyEntity(self); } diff --git a/src/st/no3/56264.c b/src/st/no3/56264.c index 5f36b06e48..1100cce783 100644 --- a/src/st/no3/56264.c +++ b/src/st/no3/56264.c @@ -1,73 +1,73 @@ -#include "no3.h" - -void EntityBat(Entity* entity) { - Entity* newEntity; - s16 xDistance; - s16 yDistance; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (entity->flags & FLAG_DEAD) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(2, entity, newEntity); - newEntity->params = 1; - } +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(SE_BAT_DEATH); - DestroyEntity(entity); - return; - } - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B90); - entity->animCurFrame = 31; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED xDistance = GetDistanceToPlayerX(); yDistance = GetDistanceToPlayerY(); - if ((xDistance < 0x60) && (yDistance < 0x60) && +REDACTED !(GetSideToPlayer() & 2)) { - entity->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80183C60, entity) == 0) { entity->facingLeft = (GetSideToPlayer() & 1) ^ 1; entity->velocityY = FIX(0.875); if (entity->facingLeft != 0) { entity->velocityX = FIX(0.25); - } else { +REDACTED entity->velocityX = FIX(-0.25); - } - entity->animFrameIdx = (Random() & 3) * 3; - entity->animFrameDuration = 0; - entity->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80183C44, entity); - MoveEntity(); +REDACTED if (GetDistanceToPlayerY() < 0x20) { if (entity->facingLeft == 0) { entity->velocityX = FIX(-1); - } else { +REDACTED entity->velocityX = FIX(1); - } - *(s32*)&entity->ext.generic.unk7C.s = 0x800; - entity->step++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80183C44, entity); - MoveEntity(); +REDACTED if ((u32)(entity->velocityY + 0x10000) > 0x20000U) { - *(s32*)&entity->ext.generic.unk7C.s = - (s32) - *(s32*)&entity->ext.generic.unk7C.s; - } +REDACTED +REDACTED +REDACTED entity->velocityY += *(s32*)&entity->ext.generic.unk7C.u; - break; - } -} +REDACTED +REDACTED +REDACTED diff --git a/src/st/no3/564B0.c b/src/st/no3/564B0.c index 788bfe2a04..3077d7a311 100644 --- a/src/st/no3/564B0.c +++ b/src/st/no3/564B0.c @@ -1,81 +1,81 @@ -#include "no3.h" +REDACTED #include "sfx.h" - -void EntityZombie(Entity* self) { - Entity* newEntity; - s32 temp_a0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < 4)) { PlaySfxPositional(SFX_EXPLODE_SMALL); self->hitboxState = 0; - // Spawn Zombie explosion +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_WARG_EXP_OPAQUE, self, newEntity); - newEntity->zPriority = self->zPriority + 1; - newEntity->params = 3; - newEntity->posY.i.hi += 12; - } - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180BA8); - self->hitboxWidth = 8; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = 0x10; - self->hitboxHeight = 0; - self->zPriority += 4; +REDACTED +REDACTED if (g_Timer & 1) { - self->palette++; - } - if (Random() & 1) { - self->palette++; - } - self->animCurFrame = 0; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_80183CAC) & 1) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step++; - } - break; - - case 2: - if (AnimateEntity(D_80183C84, self) == 0) { - SetStep(3); - } - if (self->animFrameDuration == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY -= 2; - self->hitboxHeight += 2; - } - break; - - case 3: - AnimateEntity(D_80183C7C, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a0 = UnkCollisionFunc2(&D_80183CBC); if (self->facingLeft != 0) { self->velocityX = FIX(0.5); - } else { +REDACTED self->velocityX = FIX(-0.5); - } - - if (temp_a0 & 0xC0) { +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - SetStep(4); - } - break; - - case 4: - if (AnimateEntity(D_80183C98, self) == 0) { - DestroyEntity(self); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED /* * An invisible entity that is responsible for spawning the "floor * zombies" that come up from the ground and swarm the player. @@ -84,42 +84,42 @@ void EntityZombie(Entity* self) { * The exact position a zombie is spawned in is also randomized. */ void EntityZombieSpawner(Entity* self) { - s32 distCameraEntity; - Entity* newEntity; - s32 rnd; - - if (self->step == 0) { - InitializeEntity(D_80180AD0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.zombieSpawner.spawnDelay = 1; self->flags &= FLAG_UNK_2000; - } - +REDACTED +REDACTED if (g_CastleFlags[0x37]) { - self->posX.i.hi = 128; +REDACTED if (--self->ext.zombieSpawner.spawnDelay == 0) { newEntity = AllocEntity(g_Entities + 160, g_Entities + 168); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_ZOMBIE, self, newEntity); - rnd = (Random() & 0x3F) + 96; - +REDACTED +REDACTED if (self->ext.zombieSpawner.spawnSide != 0) { - newEntity->posX.i.hi += rnd; - } else { - newEntity->posX.i.hi -= rnd; - } - newEntity->posY.i.hi -= 48; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.zombieSpawner.spawnSide ^= 1; - +REDACTED // Zombies are prevented from spawning too close to the // edges of the room. distCameraEntity = g_Tilemap.scrollX.i.hi + newEntity->posX.i.hi; if ((distCameraEntity < (g_Tilemap.x + 128)) || ((g_Tilemap.width - 128) < distCameraEntity)) { - DestroyEntity(newEntity); - } - } +REDACTED +REDACTED +REDACTED self->ext.zombieSpawner.spawnDelay = (Random() & 0x3F) + 32; - } - } -} +REDACTED +REDACTED +REDACTED diff --git a/src/st/no3/deathcutscene.c b/src/st/no3/deathcutscene.c index 52d3014759..fa0cb6a5c7 100644 --- a/src/st/no3/deathcutscene.c +++ b/src/st/no3/deathcutscene.c @@ -3,35 +3,35 @@ void func_801BE544(void) { g_Dialogue.nextLineX = 0x182; // Note that these two lines are "= 2" g_Dialogue.nextCharX = 0x182; // for all other cutscenes (so far)! - g_Dialogue.nextCharY = 0; - g_Dialogue.unk12 = 0; - g_Dialogue.nextCharTimer = 0; - g_Dialogue.unk17 = 8; - g_Dialogue.nextLineY = g_Dialogue.startY + 0x14; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 func_801BE598(s32 textDialogue) { - Primitive* prim; - s16 firstPrimIndex; - - firstPrimIndex = g_api.AllocPrimitives(PRIM_SPRT, 7); - g_Dialogue.primIndex[2] = firstPrimIndex; - if (firstPrimIndex == -1) { - g_Dialogue.primIndex[2] = 0; - return 0; - } - g_Dialogue.nextCharDialogue = textDialogue; - g_Dialogue.unk3C = 0; - g_Dialogue.primIndex[1] = -1; - g_Dialogue.primIndex[0] = -1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED func_801BE544(); //! FAKE: if (prim && prim) { - } - - prim = g_Dialogue.prim[0] = &g_PrimBuf[g_Dialogue.primIndex[2]]; - +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; prim = g_Dialogue.prim[1] = prim->next; @@ -49,24 +49,24 @@ s32 func_801BE598(s32 textDialogue) { prim->type = 4; prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 3; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0xFF; +REDACTED +REDACTED +REDACTED +REDACTED prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0; prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0; - prim->x0 = prim->x2 = 4; - prim->x1 = prim->x3 = 0xF8; - prim->priority = 0x1FD; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 1; - prim->x0 = 3; - prim->y0 = 0x2F; - prim->v0 = 0x4A; - prim->r0 = prim->g0 = prim->b0 = 0xFF; - prim->priority = 0x1FC; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; return 1; } @@ -87,10 +87,10 @@ void func_801BE7BC(void) { func_801BE75C(g_Dialogue.nextCharY); prim = g_Dialogue.prim[g_Dialogue.nextCharY]; prim->tpage = 0x16; - prim->clut = g_Dialogue.clutIndex; - prim->y0 = g_Dialogue.nextLineY; +REDACTED +REDACTED prim->u0 = 0; - prim->x0 = g_Dialogue.startX; +REDACTED prim->x0 = prim->x0 + 4; prim->v0 = g_Dialogue.nextCharY * 0xC; prim->u1 = 0xC0; @@ -98,7 +98,7 @@ void func_801BE7BC(void) { prim->priority = 0x1FF; prim->drawMode = DRAW_DEFAULT; } - +REDACTED // Creates primitives for the actor name at the head of the dialogue void func_801BE870(u16 actorIndex, Entity* self) { Primitive* prim; @@ -133,7 +133,7 @@ void func_801BE870(u16 actorIndex, Entity* self) { // Fill prims to render the actor name on screen prim = &g_PrimBuf[primIndex]; - g_Dialogue.primIndex[1] = primIndex; +REDACTED actorName = D_80181ACC[actorIndex]; x = 0x38; while (prim != NULL) { @@ -151,55 +151,55 @@ void func_801BE870(u16 actorIndex, Entity* self) { prim->priority = 0x1FF; prim->drawMode = DRAW_HIDE; prim->x0 = x; - prim->y0 = g_Dialogue.startY + 6; +REDACTED prim = prim->next; x += FONT_GAP; } } } - -void func_801BE9F4(s32 arg0) { - g_Dialogue.unk40 = arg0 + 0x100000; - g_Dialogue.timer = 0; - g_Dialogue.unk3C = 1; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801BEA20(void) { Entity* entity; u16 startTimer; u8 entityIndex; - g_Dialogue.timer++; +REDACTED // protect from overflows - if (g_Dialogue.timer > 0xFFFE) { - g_Dialogue.unk3C = 0; +REDACTED +REDACTED return; } while (true) { // Start the dialogue script only if the start timer has passed - startTimer = (*g_Dialogue.unk40++ << 8) | *g_Dialogue.unk40++; - if (g_Dialogue.timer < startTimer) { +REDACTED +REDACTED // Re-evaluate the condition at the next frame - g_Dialogue.unk40 -= 2; +REDACTED return; } - switch (*g_Dialogue.unk40++) { +REDACTED case 0: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); - entity->entityId = *g_Dialogue.unk40++; +REDACTED entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1]; - entity->posX.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posX.i.hi = *g_Dialogue.unk40++ | entity->posX.i.hi; - entity->posY.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posY.i.hi = *g_Dialogue.unk40++ | entity->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED break; case 1: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); break; @@ -216,36 +216,36 @@ void func_801BEA20(void) { } } } - +REDACTED void func_801BECCC(Entity* self) { if (g_pads[0].tapped == PAD_START) { - D_801D7D20 = 1; +REDACTED g_api.FreePrimitives(self->primIndex); self->flags ^= FLAG_HAS_PRIMS; if (g_Dialogue.primIndex[1] != -1) { g_api.FreePrimitives(g_Dialogue.primIndex[1]); - } +REDACTED if (g_Dialogue.primIndex[0] != -1) { g_api.FreePrimitives(g_Dialogue.primIndex[0]); - } +REDACTED g_api.PlaySfx(SET_STOP_MUSIC); self->step = 1; self->step_s = 0; - } -} - +REDACTED +REDACTED +REDACTED // Animates the portrait size of the actor by enlarging or shrinking it void func_801BEDAC(u8 ySteps) { Primitive* prim; s32 primIndex; s32 i; - primIndex = g_Dialogue.nextCharY + 1; +REDACTED while (primIndex >= 5) { primIndex -= 5; } if (g_CurrentEntity->step_s == 0) { - prim = g_Dialogue.prim[primIndex]; +REDACTED prim->v1 -= ySteps; prim->v0 += ySteps; if (prim->v1 == 0) { @@ -256,13 +256,13 @@ void func_801BEDAC(u8 ySteps) { for (i = 0; i < 5; i++) { if (i != primIndex) { - prim = g_Dialogue.prim[i]; +REDACTED prim->y0 -= ySteps; } } - g_Dialogue.portraitAnimTimer++; +REDACTED } - +REDACTED void EntityDeathCutscene(Entity* self) { RECT rect; Primitive* prim; diff --git a/src/st/no3/player_water_effect.c b/src/st/no3/player_water_effect.c index 315a51e6ea..e57bcc41b3 100644 --- a/src/st/no3/player_water_effect.c +++ b/src/st/no3/player_water_effect.c @@ -47,7 +47,7 @@ void EntityAlucardWaterEffect(Entity* arg0) { u16 sp4A; s32 status; Tilemap* tilemap = &g_Tilemap; - Entity* player = &PLAYER; +REDACTED sp18 = player->posX.i.hi + tilemap->scrollX.i.hi; status = g_Player.unk0C; diff --git a/src/st/np3/32830.c b/src/st/np3/32830.c index 04f749c774..353accf4fa 100644 --- a/src/st/np3/32830.c +++ b/src/st/np3/32830.c @@ -1,33 +1,33 @@ -#include "np3.h" +REDACTED #include "sfx.h" -void func_801B2830(Entity* self) { - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180A60); - self->ext.generic.unk7C.S8.unk0 = 16; - self->ext.generic.unk7C.S8.unk1 = 8; - self->ext.generic.unk7E.modeU8.unk0 = 56; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_GpuBuffers[0].draw.r0 = self->ext.generic.unk7C.S8.unk0; g_GpuBuffers[0].draw.g0 = self->ext.generic.unk7C.S8.unk1; g_GpuBuffers[0].draw.b0 = self->ext.generic.unk7E.modeU8.unk0; g_GpuBuffers[1].draw.r0 = self->ext.generic.unk7C.S8.unk0; g_GpuBuffers[1].draw.g0 = self->ext.generic.unk7C.S8.unk1; g_GpuBuffers[1].draw.b0 = self->ext.generic.unk7E.modeU8.unk0; - break; - } -} +REDACTED +REDACTED +REDACTED void func_801B28E4(Entity* self) { Entity* newEntity; s32 animFrame; s32 random0to3; u8* clutIndices; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->ext.et_801B28E4.timer = 0x80; self->animCurFrame = 15; @@ -39,15 +39,15 @@ void func_801B28E4(Entity* self) { case 1: switch (self->step_s) { case 0: - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_801B5DE8, newEntity); random0to3 = Random() & 3; newEntity->posX.i.hi = D_80180EA4[random0to3][0]; newEntity->posY.i.hi = D_80180EA4[random0to3][1]; } - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_801B5E98, newEntity); if (random0to3 >= 3) { random0to3 = 0; @@ -103,202 +103,202 @@ void func_801B28E4(Entity* self) { } } -void EntityShuttingWindow(Entity* self) { - Primitive* prim; - s16 primIndex; - SVECTOR svec; - SVEC4* svec4; - VECTOR vec; - MATRIX mtx; - s32 flag; - s32 p; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.shuttingWindow.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0xF; - prim->clut = 0xD; - prim->u0 = prim->u2 = 0x9C; - prim->u1 = prim->u3 = 0x84; - prim->v1 = 4; - prim->v0 = 4; - prim->v2 = prim->v3 = 0x7C; - prim->priority = 0x5F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - } - - case 1: - self->ext.shuttingWindow.unk80 += 8; - if (self->ext.shuttingWindow.unk80 > 0x300) { - self->ext.shuttingWindow.unk80 = 0x300; - self->ext.shuttingWindow.unk82 = 0; - self->step++; - } - break; - - case 2: - self->ext.shuttingWindow.unk80 += self->ext.shuttingWindow.unk82; - self->ext.shuttingWindow.unk82 -= 4; - if (self->ext.shuttingWindow.unk80 < 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EV_WINDOW_LATCH); - self->ext.shuttingWindow.unk80 = 0; - self->ext.shuttingWindow.timer = 32; - self->step++; - } - break; - - case 3: - if (--self->ext.shuttingWindow.timer == 0) { - self->step = 1; - } - break; - } - SetGeomScreen(0x400); - SetGeomOffset(self->posX.i.hi, self->posY.i.hi); - - svec4 = D_80180EEC; - prim = self->ext.shuttingWindow.prim; - - for (i = 0; i < 2; svec4++, i++) { - svec.vx = 0; - if (i != 0) { - svec.vy = self->ext.shuttingWindow.unk80; - } else { - svec.vy = -self->ext.shuttingWindow.unk80; - } - svec.vz = 0; - RotMatrix(&svec, &mtx); - if (i == 0) { - vec.vx = -0x18; - } else { - vec.vx = 0x19; - } - vec.vy = 0; - vec.vz = 0x400; - TransMatrix(&mtx, &vec); - SetRotMatrix(&mtx); - SetTransMatrix(&mtx); - RotTransPers4(svec4->v0, svec4->v1, svec4->v2, svec4->v3, - (long*)&prim->x0, (long*)&prim->x1, (long*)&prim->x2, - (long*)&prim->x3, (long*)&p, (long*)&flag); - prim = prim->next; - } -} - -// Entity ID: 0x19 -void EntityCastleDoor(Entity* self) { - SVECTOR svec1; - VECTOR vec; - MATRIX mtx1, mtx2; - CVECTOR cvec1, cvec2; - SVECTOR svec2; - long sxy2, sxy3, p; - SVECTOR** var_s5; - Primitive* prim; - SVEC4* var_s6; - s16 primIndex; - s32 temp_s3; - u16* tilePtr; - s32 tilePos; - u8* temp_a0; - s32 i; - - svec2 = D_801B1EA0; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 3); +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; - temp_a0 = D_80180FE0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.castleDoor.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - for (i = 0; i < 3; i++) { - prim->tpage = 0xF; - prim->clut = 0x41; - prim->priority = 0x6A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim->u0 = prim->u2 = *temp_a0++; - prim->u1 = prim->u3 = *temp_a0; - prim->v0 = prim->v1 = 1; - prim->v2 = prim->v3 = 0x81; - prim = prim->next; - temp_a0++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.castleDoor.rotZ = 0; - - tilePos = 0x445; - for (i = 0, tilePtr = D_80180FF8; i < 8; tilePtr++, i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tilePtr; - tilePos += 0x20; - } - } - SetGeomScreen(0x300); - SetGeomOffset(self->posX.i.hi, self->posY.i.hi); - svec1.vx = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED svec1.vy = self->ext.castleDoor.rotZ; - svec1.vz = 0; - RotMatrix(&svec2, &mtx1); - RotMatrixY(svec1.vy, &mtx1); - vec.vx = 0; - vec.vy = 0; - vec.vz = 0x334; - TransMatrix(&mtx1, &vec); - SetRotMatrix(&mtx1); - SetTransMatrix(&mtx1); - SetBackColor(128, 128, 128); - cvec1.b = cvec1.g = cvec1.r = 128; - cvec1.cd = 4; - cvec2.b = cvec2.g = cvec2.r = 64; - cvec2.cd = 4; - RotMatrix(&svec1, &mtx2); - SetColorMatrix(&D_80180F9C); - SetLightMatrix(&mtx2); - - prim = self->ext.castleDoor.prim; - var_s6 = &D_80180F6C; - var_s5 = D_80180FD4; - for (i = 0; i < 3; var_s6++, var_s5++, i++) { - temp_s3 = RotAverageNclip4( - var_s6->v0, var_s6->v1, var_s6->v2, var_s6->v3, (long*)&prim->x0, - (long*)&prim->x1, (long*)&prim->x2, (long*)&prim->x3, &sxy2, &sxy3, - &p); - NormalColorCol(*var_s5, &cvec1, (CVECTOR*)&prim->r0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); - - if (i != 0) { - NormalColorCol(*var_s5, &cvec2, (CVECTOR*)&prim->r0); - LOW(prim->r2) = LOW(prim->r0); - } - - if (temp_s3 > 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 6; - } else { +REDACTED prim->drawMode = DRAW_HIDE; - } - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED +REDACTED extern SVECTOR D_801810B0; extern s16 D_80181068; @@ -327,22 +327,22 @@ void EntityBackgroundBushes(Entity* self) { MATRIX m; if (!self->step) { - InitializeEntity(D_80180AA8); +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 0x48); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->flags |= FLAG_HAS_PRIMS; self->primIndex = primIndex; - prim = &g_PrimBuf[primIndex]; +REDACTED self->ext.prim = prim; - while (prim != NULL) { - prim->tpage = 0xF; +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - } +REDACTED +REDACTED +REDACTED SetGeomScreen(0x400); SetGeomOffset(0x80, self->posY.i.hi); RotMatrix(&D_801810B0, &m); @@ -418,188 +418,188 @@ void EntityBackgroundBushes(Entity* self) { } while (prim != NULL) { prim->drawMode = DRAW_HIDE; - prim = prim->next; - } -} - -void func_801B3704(Entity* self, s16 primIndex) { - volatile char pad[8]; //! FAKE - Primitive* prim; - VECTOR vec; - MATRIX mtx; - long sxy; - long p; - long flag; - s32 temp_s3; - s32 temp_a1; - s32 temp_a2; - s32 var_v1; - - if (self->step == 0) { - InitializeEntity(D_80180AA8); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 32); +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0xF; - prim->clut = D_801810A8[self->params % 16]; - prim->u0 = prim->u2 = 0xBF; - prim->u1 = prim->u3 = 0xFF; - prim->v0 = prim->v1 = 0x80; - prim->v2 = prim->v3 = 0xB8; - prim->priority = 0x5A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - } - var_v1 = D_80181098[self->params % 16][0]; - temp_s3 = var_v1; - - SetGeomScreen(0x400); - if (self->params & 0x100) { - SetGeomOffset(0x80, 0x98); - } else { - SetGeomOffset(0x80, 0x80); - } - - RotMatrix(D_801810B8, &mtx); - vec.vx = self->posX.i.hi - 128; - vec.vy = self->posY.i.hi - 128; - vec.vz = temp_s3 + 0x400; - TransMatrix(&mtx, &vec); - SetRotMatrix(&mtx); - SetTransMatrix(&mtx); - RotTransPers(D_801810B8, &sxy, &p, &flag); - temp_a1 = sxy & 0xFFFF; - temp_a2 = sxy >> 0x10; - - if (temp_a1 < 0) { - var_v1 = temp_a1 + 0x3F; - } else { - var_v1 = temp_a1; - } - - prim = self->ext.prim; - temp_a1 -= (var_v1 >> 6) << 6; - temp_a1 -= 64; - temp_a1 -= D_80181098[self->params % 16][1]; - while (temp_a1 < 320) { - prim->x1 = prim->x3 = temp_a1 + 64; - prim->x0 = prim->x2 = temp_a1; - prim->y0 = prim->y1 = temp_a2 - 56; - prim->y2 = prim->y3 = temp_a2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - temp_a1 += 64; - } - - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } -} - -void EntityTransparentWater(Entity* self) { - Primitive* prim; - s16 primIndex; - u32 temp_a0; - s16 temp_t1; - s32 temp_v0; - u8* temp_v1; - u8* var_a0; - u8 temp_t2; - s32 var_a3; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->ext.transparentWater.unk80 = 4; - primIndex = g_api.AllocPrimitives(PRIM_GT4, 16); +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.transparentWater.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->tpage = 0xF; - prim->clut = 0x18; - prim->priority = 0xB0; +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - prim = prim->next; - } - break; - - case 1: - var_a0 = &D_801810C0; - while (*var_a0 != 0xFF) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[var_a0[0]] = g_ClutIds[var_a0[2] + 0x200]; - var_a0 += 4; - } - - if (--self->ext.transparentWater.unk80 == 0) { - self->ext.transparentWater.unk80 = 4; - self->step++; - } - break; - - case 2: - var_a0 = &D_801810C0; - while (*var_a0 != 0xFF) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[var_a0[0]] = g_ClutIds[var_a0[3] + 0x200]; - var_a0 += 4; - } - - if (--self->ext.transparentWater.unk80 == 0) { - self->ext.transparentWater.unk80 = 4; - self->step--; - } - break; - } - - AnimateEntity(D_801810EC, self); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED var_a3 = -1 * g_Tilemap.scrollX.i.hi % 38; - var_a3 += 304; - if (self->params != 0) { - var_a3 = 96; - } - - prim = self->ext.transparentWater.prim; - temp_a0 = self->posY.i.hi; - temp_v1 = D_801810E0; - temp_v1 += 4 * self->animCurFrame; - temp_v0 = temp_v1[0]; - temp_v1 = temp_v1[1]; - while (var_a3 > 0) { - temp_t2 = temp_v0 + 0x26; - temp_t1 = temp_v1 + 0x3E; - prim->x1 = prim->x3 = var_a3; - var_a3 -= 0x26; - prim->x0 = prim->x2 = var_a3; - prim->u0 = prim->u2 = temp_v0; - prim->u1 = prim->u3 = temp_t2; - prim->v0 = prim->v1 = temp_v1; - prim->v2 = prim->v3 = temp_t1; - prim->y0 = prim->y1 = temp_a0; - prim->y2 = prim->y3 = temp_a0 + 0x3E; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - prim = prim->next; - } - - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED void func_801B3D24(Primitive* prim) { s32 xVar; @@ -644,59 +644,59 @@ void func_801B3D24(Primitive* prim) { } } -void EntityCavernDoorLever(Entity* entity) { - s32 posX; - s32 posY; - - switch (entity->step) { - case 0: - InitializeEntity(D_80180AA8); - entity->animCurFrame = 18; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->rotZ = -0x200; entity->drawFlags |= 4; - CreateEntityFromEntity(E_ID_1E, entity, &entity[1]); +REDACTED if (g_CastleFlags[0x30] != 0) { entity->rotZ = 0; - } - - case 1: - if (entity[1].ext.generic.unk84.S8.unk0 != 0) { +REDACTED +REDACTED +REDACTED +REDACTED entity->rotZ += 4; if (entity->rotZ > 0) { entity->rotZ = 0; if (g_CastleFlags[48] == 0) { g_api.PlaySfx(SFX_LEVER_METAL_BANG); - } +REDACTED g_CastleFlags[48] = 1; } else if (!(g_Timer & 0xF)) { g_api.PlaySfx(SFX_LEVER_METAL_BANG); - } - } - break; - } - - posX = entity->posX.val; - posY = entity->posY.val; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX += rcos(entity->rotZ) * 0x280; posY += rsin(entity->rotZ) * 0x280; - entity[1].posX.val = posX; - entity[1].posY.val = posY; -} +REDACTED +REDACTED +REDACTED -// platform attached to lever at cavern door -void EntityCavernDoorPlatform(Entity* self) { - Entity* player; +REDACTED +REDACTED +REDACTED s32 xDiff; s32 collision; - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = 17; +REDACTED +REDACTED +REDACTED +REDACTED self->ext.cavernDoor.xCoord.val = self->posX.val; self->ext.cavernDoor.xCoord.val = self->posX.val; // ? WTF - - case 1: +REDACTED +REDACTED collision = GetPlayerCollisionWith(self, 6, 5, 4); self->ext.cavernDoor.collision = collision; @@ -708,39 +708,39 @@ void EntityCavernDoorPlatform(Entity* self) { // These two lines are extra compared to NO3 D_80097488.x.i.hi += xDiff; D_80097488.y.i.hi += 1; - } +REDACTED self->ext.cavernDoor.xCoord.val = self->posX.val; self->ext.cavernDoor.yCoord.val = self->posY.val; - } -} - -// door blocking way to the Underground Caverns -void EntityCavernDoor(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 primIndex; s16* tileLayoutPtr; - Entity* entity; +REDACTED Primitive* prim; - s32 i; +REDACTED s32 tilePos; s32 tileSteps; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = 10; - self->zPriority = 0x9F; - - tileLayoutPtr = &D_801810F8[0]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[48]) { - self->step = 128; - self->animCurFrame = 0; +REDACTED +REDACTED tileLayoutPtr += 3; - } else { +REDACTED primIndex = g_api.AllocPrimitives(PRIM_TILE, 64); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->flags |= FLAG_HAS_PRIMS; self->primIndex = primIndex; prim = &g_PrimBuf[primIndex]; @@ -754,52 +754,52 @@ void EntityCavernDoor(Entity* self) { prim->drawMode = DRAW_HIDE; prim->p3 = 0; prim = prim->next; - } - } - - for (tilePos = 0x76, i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr++; - tilePos += 0x10; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[48]) { // Missing line compared to NO3 // g_api.PlaySfx(SFX_SWITCH_CLICK); - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(0.375); self->ext.cavernDoor.jiggler++; // While the door opens, it jiggles left and right by repeatedly // incrementing and decrementing its x position. if (self->ext.cavernDoor.jiggler & 1) { - self->posX.i.hi++; - } else { - self->posX.i.hi--; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED tileSteps = (self->posY.i.hi - 136); tileSteps /= 16; if (tileSteps > 3) { tileSteps = 3; - self->step = 3; - } +REDACTED +REDACTED // Extra block compared to NO3 if (!(self->ext.cavernDoor.jiggler & 15)) { g_api.PlaySfx(SFX_STONE_MOVE_C); - } - +REDACTED +REDACTED tilePos = 0x76; - tileLayoutPtr = &D_801810F8[0]; +REDACTED tileLayoutPtr += 3; for (i = 0; i < tileSteps; tilePos += 0x10, i++) { g_Tilemap.fg[tilePos] = *tileLayoutPtr++; - } - +REDACTED +REDACTED if (g_Timer & 1) { break; } @@ -808,14 +808,14 @@ void EntityCavernDoor(Entity* self) { if (prim != NULL) { prim->p3 = 1; } - +REDACTED if (g_Timer & 15) { break; } - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); +REDACTED if (entity == NULL) { break; - } +REDACTED CreateEntityFromEntity(6, self, entity); entity->posY.i.hi = 156; entity->posX.i.hi += -8 + (Random() & 15); @@ -823,937 +823,937 @@ void EntityCavernDoor(Entity* self) { entity->params = 0x10; entity->drawFlags |= (FLAG_DRAW_ROTX + FLAG_DRAW_ROTY); entity->rotX = entity->rotY = 192; - break; - } - +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { for (prim = self->ext.cavernDoor.prim; prim != NULL; prim = prim->next) { if (prim->p3) { func_801B3D24(prim); - } - } - } -} - -typedef enum { WEIGHT_SMALL, WEIGHT_TALL } WeightSelect; - -void func_801B44B4(WeightSelect weight) { - s32 posY = g_CurrentEntity->posY.i.hi; - s32 posX = g_CurrentEntity->posX.i.hi; - Primitive* prim; - - if (weight != WEIGHT_SMALL) { - posY -= 64; - } else { - posY -= 16; - } - - prim = *(s32*)&g_CurrentEntity->ext.generic.unk7C; - - while (posY > 0) { - prim->y2 = prim->y3 = posY; - prim->x0 = prim->x2 = posX - 8; - prim->x1 = prim->x3 = posX + 8; - posY -= 32; - prim->y0 = prim->y1 = posY; +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - } - posY -= 32; - - while (prim != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } -} +REDACTED +REDACTED +REDACTED -// switch that clicks when you step on it -void EntityClickSwitch(Entity* entity) { +REDACTED +REDACTED s32 temp_a0 = GetPlayerCollisionWith(entity, 8, 4, 4); - Entity* player = &PLAYER; - - switch (entity->step) { - case 0: - InitializeEntity(D_80180AA8); - entity->animCurFrame = 9; - entity->zPriority = 0x5E; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - entity->step = 2; - entity->posY.i.hi += 4; - } - break; - - case 1: - if (temp_a0 != 0) { - player->posY.i.hi++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val += FIX(0.75); if ((g_Tilemap.scrollY.i.hi + entity->posY.i.hi) > 160) { entity->posY.i.hi = 160 - g_Tilemap.scrollY.i.hi; g_api.PlaySfx(SFX_SWITCH_CLICK); g_CastleFlags[49] = 1; - entity->step++; - } - } - break; - } -} - -// smaller weight blocking path near cube of zoe -void EntityPathBlockSmallWeight(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED s16 primIndex; - POLY_GT4* poly; - s32 var_a1; - s32 i; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = 8; - self->zPriority = 0x5E; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex == -1) { - DestroyEntity(self); - return; - } - +REDACTED +REDACTED +REDACTED +REDACTED poly = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - *(s32*)&self->ext.generic.unk7C = poly; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - while (poly != NULL) { - poly->tpage = 0xF; - poly->clut = 0x22; - poly->u0 = poly->u2 = 224; - poly->u1 = poly->u3 = 240; - poly->v0 = poly->v1 = 84; - poly->v2 = poly->v3 = 116; - poly->pad2 = self->zPriority + 1; - poly->pad3 = 8; - poly = (POLY_GT4*)poly->tag; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posX.i.hi = 416 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = 64 - g_Tilemap.scrollY.i.hi; if (g_CastleFlags[49] != 0) { - self->posY.i.hi += 111; - self->step = 3; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(0.5); if ((self->posY.i.hi + g_Tilemap.scrollY.i.hi) >= 175) { PlaySfxPositional(SFX_START_SLAM_B); self->posY.i.hi = 175 - g_Tilemap.scrollY.i.hi; - self->step++; - } - break; - - case 3: - for (var_a1 = 0x179, i = 0; i < 2; var_a1 -= 0x20, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[var_a1] = 0x4FA; g_Tilemap.fg[var_a1 + 1] = 0x4FA; - } - self->step++; - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->step < 3) && (GetPlayerCollisionWith(self, 16, 16, 5) & 4)) { - Entity* player = &PLAYER; - - player->posY.i.hi++; - } - func_801B44B4(WEIGHT_SMALL); -} - -// taller weight blocking path near cube of zoe -void EntityPathBlockTallWeight(Entity* self) { - POLY_GT4* poly; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - s32 temp_a2; - s32 var_a1; - s32 var_v0; - s32 temp; - s32 i; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = 7; - self->zPriority = 0x5E; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex == -1) { - DestroyEntity(self); - return; - } - +REDACTED +REDACTED +REDACTED +REDACTED poly = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - *(s32*)&self->ext.generic.unk7C = poly; +REDACTED self->flags |= FLAG_HAS_PRIMS; - - while (poly != NULL) { - poly->tpage = 0xF; - poly->clut = 0x22; - poly->u0 = poly->u2 = 224; - poly->u1 = poly->u3 = 240; - poly->v0 = poly->v1 = 84; - poly->v2 = poly->v3 = 116; - poly->pad2 = self->zPriority + 1; - poly->pad3 = 8; - poly = (POLY_GT4*)poly->tag; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step = 3; - self->posY.i.hi -= 128; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[49] != 0) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val -= FIX(0.5); temp = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - if (temp <= -16) { +REDACTED self->posY.i.hi = -16 - g_Tilemap.scrollY.i.hi; - self->step++; - } - break; - } - - func_801B44B4(WEIGHT_TALL); - do { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - } while (0); - var_v0 = 112 - temp; - var_a1 = 0x157; - - if (var_v0 < 0) { - var_v0 += 15; - } - - for (temp_a2 = var_v0 >> 4, i = 0; i < temp_a2; var_a1 -= 0x20, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED g_Tilemap.fg[var_a1] = 0; g_Tilemap.fg[var_a1 + 1] = 0; - } - - for (temp_a2 = 8 - temp_a2, i = 0; i < temp_a2; var_a1 -= 0x20, i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[var_a1] = 0x4FA; g_Tilemap.fg[var_a1 + 1] = 0x4FA; - } -} - -void EntityTrapDoor(Entity* entity) { - switch (entity->step) { - case 0: - InitializeEntity(D_80180AA8); - entity->animCurFrame = 0x1B; - entity->zPriority = 0x6A; - entity->hitboxWidth = 0x10; - entity->hitboxHeight = 4; +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxState = 1; - - if (g_TrapDoorFlag == 0) { - if (PLAYER.posY.val < entity->posY.val) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0xA8E / 2] = 0x129; g_Tilemap.fg[0xA90 / 2] = 0x132; - DestroyEntity(entity); - return; - } +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0xA8E / 2] = 0x6C8; g_Tilemap.fg[0xA90 / 2] = 0x6C9; - } else { - entity->animCurFrame = 30; +REDACTED +REDACTED g_Tilemap.fg[0xA8E / 2] = 0x6C8; g_Tilemap.fg[0xA90 / 2] = 0x6C9; - entity->step = 128; - } - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (entity->hitFlags != 0) { - g_TrapDoorFlag = 1; - entity->step++; - } - break; - - case 2: - AnimateEntity(D_80181108, entity); - break; - } -} - -// left side of the breakable rock, drops pot roast -void EntityMermanRockLeftSide(Entity* self) { - const int jewelSwordRoomUnlock = 51; - const int rockBroken = (1 << 0); - const int wolfFlag = (1 << 2); - u16* tileLayoutPtr; - Entity* newEntity; - s32 tilePos; - u8* params; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->hitboxState = 2; - self->hitboxWidth = 16; - self->hitboxHeight = 24; - - tileLayoutPtr = &D_80181144; - tilePos = 0x1F1; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_BgLayers[0].layout[tilePos] = *tileLayoutPtr; g_BgLayers[0].layout[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } +REDACTED +REDACTED +REDACTED if (g_CastleFlags[jewelSwordRoomUnlock] & rockBroken) { - tileLayoutPtr = &D_8018112C; - tilePos = 0x1F1; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } +REDACTED +REDACTED +REDACTED self->hitboxState = 1; - self->step = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { - tileLayoutPtr = &D_80181120[self->ext.generic.unk84.S16.unk0 * 6]; - tilePos = 0x1F1; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x13; - newEntity->zPriority = 0xA9; - newEntity->posX.i.hi += self->ext.generic.unk84.S16.unk0 * 16; - newEntity->posY.i.hi += 16; - } - - params = &D_8018120C[self->ext.generic.unk84.S16.unk0 * 3]; - - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FALLING_ROCK_2, self, newEntity); - newEntity->params = *params++; +REDACTED +REDACTED +REDACTED newEntity->velocityX = -0x8000 - (Random() << 8); newEntity->velocityY = -Random() * 0x100; - newEntity->posY.i.hi += -16 + (i * 16); - } - } - self->ext.generic.unk84.S16.unk0++; - } - - if (self->ext.generic.unk84.S16.unk0 >= 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { - CreateEntityFromEntity(E_EQUIP_ITEM_DROP, self, newEntity); - newEntity->params = ITEM_POT_ROAST; - } +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= rockBroken; self->hitboxState = 1; - self->step++; - } - break; - - case 2: - if ((self->hitFlags != 0) && - (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= wolfFlag; - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // right side of the merman room rock, breaks when hit -void EntityMermanRockRightSide(Entity* self) { - const int jewelSwordRoomUnlock = 51; - const int rockBroken = (1 << 1); - const int batFlag = (1 << 3); - u16* tileLayoutPtr; - Entity* newEntity; - s32 tilePos; - u8* params; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->hitboxState = 2; - self->hitboxWidth = 16; - self->hitboxHeight = 24; - - tileLayoutPtr = &D_80181180; - tilePos = 0x1FD; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_BgLayers[0].layout[tilePos] = *tileLayoutPtr; g_BgLayers[0].layout[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[jewelSwordRoomUnlock] & rockBroken) { - tileLayoutPtr = &D_80181168; - tilePos = 0x1FD; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } +REDACTED +REDACTED +REDACTED self->hitboxState = 1; - self->step = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { - tileLayoutPtr = &D_8018115C[(self->ext.generic.unk84.S16.unk0 * 6)]; - tilePos = 0x1FD; - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 3); - tileLayoutPtr++; - tilePos += 0x30; - } - +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x13; - newEntity->zPriority = 0xA9; - newEntity->posX.i.hi -= self->ext.generic.unk84.S16.unk0 * 16; - newEntity->posY.i.hi += 16; - } - - params = &D_8018120C[self->ext.generic.unk84.S16.unk0 * 3]; - - for (i = 0; i < 3; i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FALLING_ROCK_2, self, newEntity); - newEntity->params = *params++; +REDACTED +REDACTED +REDACTED newEntity->velocityX = (Random() << 8) + 0x8000; newEntity->velocityY = -Random() * 0x100; newEntity->facingLeft = 1; - newEntity->posY.i.hi += -16 + (i * 16); - } - } - self->ext.generic.unk84.S16.unk0++; - } - - if (self->ext.generic.unk84.S16.unk0 >= 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= rockBroken; self->hitboxState = 1; - self->step++; - } - break; - - case 2: - if ((self->hitFlags != 0) && - (g_Player.unk0C & PLAYER_STATUS_BAT_FORM)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[jewelSwordRoomUnlock] |= batFlag; - } - break; - } -} - -void func_801B5488(Entity* self) { - u16* tileLayoutPtr; - s32 tileLayoutPos; - s32 i; - s32 j; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); if (g_CastleFlags[58] != 0) { - self->step = 2; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((g_CastleFlags[51] & 12) == 12) { PlaySfxPositional(SFX_WALL_DEBRIS_B); - self->step++; - } - break; - - case 2: - for (tileLayoutPtr = &D_801811AA, i = 0; i < 3; i++) { - tileLayoutPos = 0x420 + i; - for (j = 0; j < 5; tileLayoutPos += 0x30, j++, tileLayoutPtr++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tileLayoutPos] = *tileLayoutPtr; - } - } - - for (tileLayoutPtr = &D_801811E6, i = 0; i < 3; i++) { - tileLayoutPos = 0x420 + i; - for (j = 0; j < 5; j++, tileLayoutPtr++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_BgLayers[0].layout[tileLayoutPos] = *tileLayoutPtr; - tileLayoutPos += 0x30; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED g_CastleFlags[58] |= 1; - g_api.func_800F1FC4(0x3A); - self->step++; - break; - } -} - -void EntityFallingRock2(Entity* self) { - s32 animFrame = self->params & 0xF; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED Collider collider; - Entity* newEntity; - s32 temp_a0; - s32 var_a1; - s32 new_var2; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = animFrame; - self->animCurFrame += 31; - self->zPriority = 0x9F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); self->rotZ -= 0x20; - new_var2 = self->posY.i.hi; - new_var2 += D_80181204[animFrame]; - g_api.CheckCollision(self->posX.i.hi, new_var2, &collider, 0); - +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { if (self->velocityY > FIX(4.0)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x11; - if (animFrame == 0) { - newEntity->params = 0x13; - } - } - DestroyEntity(self); - return; - } - self->posY.i.hi = self->posY.i.hi + *(u16*)&collider.unk18; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a0 = -self->velocityY; self->velocityY = -self->velocityY; - if (temp_a0 < 0) { - var_a1 = temp_a0 + 7; - } else { - var_a1 = temp_a0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = temp_a0 - (var_a1 >> 3); - } - break; - } -} - -// ID 0x4B -// Stairway piece you can break before Death encounter -void EntityStairwayPiece(Entity* self, u8 arg1, u8 arg2, u8 arg3) { - const int stairwayPieceBroken = 56; - Primitive *prim, *prim2, *prim3; - Entity* newEntity; - Collider collider; - s16 primIndex; - s32 temp; - s16 x, y; - u8 v1; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 8; - self->hitboxHeight = 8; +REDACTED +REDACTED self->posX.i.hi = 1432 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = 200 - g_Tilemap.scrollY.i.hi; - self->hitPoints = 16; +REDACTED if (g_CastleFlags[stairwayPieceBroken]) { - self->hitboxState = 0; +REDACTED g_Tilemap.fg[0x4D9] = 0x3EE; g_Tilemap.fg[0x539] = 0x3D2; - self->step = 32; - break; - } - self->hitboxState = 2; +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0x4D9] = 0x408; g_Tilemap.fg[0x539] = 0x40D; - break; - - case 1: +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { g_api.PlaySfx(SFX_STOMP_SOFT_A); - } - +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); g_Tilemap.fg[0x4D9] = 0x3EE; g_Tilemap.fg[0x539] = 0x3D2; g_CastleFlags[stairwayPieceBroken] = true; - - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EQUIP_ITEM_DROP, self, newEntity); - newEntity->params = ITEM_TURKEY; - } - +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_INTENSE_EXPLOSION, self, newEntity); - newEntity->params = 0x10; - newEntity->zPriority = self->zPriority + 1; - newEntity->posX.i.hi += 8; - newEntity->posY.i.hi += 8; - } - - primIndex = g_api.AllocPrimitives(PRIM_GT4, 16); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; UnkPolyFunc2(prim); v1 = g_Tilemap.tileDef->gfxIndex[0x409]; - arg1 = v1; +REDACTED temp = g_Tilemap.tileDef->gfxPage[0x409]; prim->clut = g_Tilemap.tileDef->clut[0x409]; - prim->tpage = temp + 8; - arg1 *= 16; - arg3 = 0xF; - arg3 = arg1 | arg3; - prim->u0 = prim->u2 = arg1; - arg2 = v1 & 0xF0 | 0xF; - prim->v0 = prim->v1 = v1 & 0xF0; - prim->u1 = prim->u3 = arg3; - prim->v2 = prim->v3 = arg2; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; - LOW(prim->next->u0) = 0xFFFF0000; - LOW(prim->next->r1) = 0xFFFF0000; - LOH(prim->next->r2) = 16; - LOH(prim->next->b2) = 16; - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - self->step++; - - case 3: - prim = self->ext.prim; - prim2 = prim->next; - prim2->tpage -= 0x20; - prim2 = prim->next; - LOW(prim2->r1) += 0x2000; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - prim3 = prim->next; - x = prim3->x1; - y = prim3->y0; - g_api.CheckCollision(x, (s16)(y + 8), &collider, 0); - if (collider.effects & 1) { - self->posX.i.hi = x; - self->posY.i.hi = y - 4; - self->step++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x11; - newEntity->zPriority = self->zPriority + 1; - } - - for (i = 0; i < 6; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_FALLING_ROCK, self, newEntity); - newEntity->params = Random() & 3; - if (newEntity->params == 3) { - newEntity->params = 0; - } - } - } - DestroyEntity(self); - } -} - -void EntityFallingRock(Entity* self) { - s32 animFrame = self->params & 0xF; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED Collider collider; - Entity* newEntity; - s16 rndAngle; - s32 rnd; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = animFrame + 31; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotY = 0x60; self->rotX = 0x60; self->drawFlags |= 7; - rnd = (Random() & 0x1F) + 16; - rndAngle = (Random() * 6) + 0x900; +REDACTED +REDACTED self->velocityX = rnd * rcos(rndAngle); self->velocityY = rnd * rsin(rndAngle); if (self->velocityX > 0) { self->facingLeft = 1; - } - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); self->rotZ -= 0x20; - +REDACTED g_api.CheckCollision( self->posX.i.hi, self->posY.i.hi + 8, &collider, 0); if (collider.effects & EFFECT_SOLID) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_INTENSE_EXPLOSION, self, newEntity); - newEntity->params = 0x10; - if (animFrame == 0) { - newEntity->params = 0x13; - } - } - DestroyEntity(self); - } - break; - } -} - -void func_801B5DE8(Entity* self) { - if (self->step == 0) { - InitializeEntity(D_80180AA8); - self->zPriority = 0x2A; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED self->flags &= ~FLAG_UNK_08000000; self->facingLeft = Random() & 1; g_api.PlaySfxVolPan(SFX_THUNDER_B, 0x40, (self->posX.i.hi >> 0x4) - 8); - } - if (AnimateEntity(D_80181214, self) == 0) { - DestroyEntity(self); - } -} - -void func_801B5E98(Entity* self) { - if (self->step == 0) { - InitializeEntity(D_80180AA8); - self->zPriority = 0x29; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED self->flags &= ~FLAG_UNK_08000000; - self->animCurFrame = self->params + 0x22; - self->posX.i.hi = D_80181220[self->params][0]; - self->posY.i.hi = D_80181220[self->params][1]; - self->ext.generic.unk80.modeS16.unk0 = 5; - } - - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - DestroyEntity(self); - } -} - -void EntitySwitch(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED s32 temp_a0 = GetPlayerCollisionWith(self, 8, 4, 4); - Entity* player = &PLAYER; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = 9; - self->zPriority = 0x5E; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[50]) { - self->step = 2; - self->posY.i.hi += 4; - } - break; - - case 1: - if (temp_a0 != 0) { - player->posY.i.hi++; - self->posY.val += FIX(0.25); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((g_Tilemap.scrollY.i.hi + self->posY.i.hi) > 193) { self->posY.i.hi = 193 - g_Tilemap.scrollY.i.hi; g_CastleFlags[50] = true; g_api.PlaySfx(SFX_SWITCH_CLICK); - self->step++; - } - } - break; - } -} - -void EntityHeartRoomGoldDoor(Entity* self) { - Entity* newEntity; - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED s16 primIndex; - s32 tilePos; - s32 temp; - s32 temp2; - s32 i; - - switch (self->step) { - case 0: - InitializeEntity(D_80180AA8); - self->animCurFrame = 0x25; - self->zPriority = 0x5E; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[50] != 0) { for ( tilePos = 0x48, i = 7, self->step = 128, self->animCurFrame = 0; i >= 0; tilePos += 0x10, i--) { g_Tilemap.fg[tilePos] = 0; - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_TILE, 64); if (primIndex == -1) { - DestroyEntity(self); - return; - } - - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.heartRoomGoldDoor.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->v0 = 1; - prim->u0 = 1; - prim->r0 = 64; - prim->b0 = 128; - prim->g0 = 96; - prim->priority = self->zPriority + 0x18; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - prim->p3 = 0; - prim = prim->next; - } - - for (tilePos = 0x48, temp = 0x4FA, i = 7; i >= 0; tilePos += 0x10, - i--) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = temp; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[50]) { g_api.PlaySfx(SFX_STONE_MOVE_A); - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(0.375); - if (++self->ext.heartRoomGoldDoor.timer & 1) { - self->posX.i.hi++; - } else { - self->posX.i.hi--; - } - - if ((self->ext.heartRoomGoldDoor.timer % 16) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_STONE_MOVE_A); - } - temp = temp2 = self->posY.i.hi - 112; - if (temp2 < 0) { - temp2 = self->posY.i.hi - 97; - } - - temp = temp2 >> 4; - if (temp >= 9) { - temp = 8; - self->step = 3; - } - - for (tilePos = 0x48, i = 0; i < temp; tilePos += 0x10, i++) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = 0; - } - +REDACTED +REDACTED if (!(g_Timer & 1)) { prim = FindFirstUnkPrim(self->ext.heartRoomGoldDoor.prim); - if (prim != NULL) { - prim->p3 = 1; - } +REDACTED +REDACTED +REDACTED if (!(g_Timer & 0xF)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity( E_INTENSE_EXPLOSION, self, newEntity); - newEntity->posY.i.hi = 188; - newEntity->posX.i.hi += -8 + (Random() & 15); - newEntity->params = 0x10; +REDACTED +REDACTED +REDACTED newEntity->rotX = newEntity->rotY = 192; newEntity->drawFlags |= 3; - } - } - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { - prim = self->ext.heartRoomGoldDoor.prim; - while (prim != NULL) { - if (prim->p3 != 0) { - func_801B3D24(prim); - } - prim = prim->next; - } - } -} - -void EntityUnkId49(Entity* self) { - u16 temp; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED + +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - break; - case 1: +REDACTED +REDACTED temp = g_Tilemap.fg[0x12 / 2]; g_Tilemap.fg[0xC / 2] = temp; temp = g_Tilemap.fg[0x14 / 2]; @@ -1766,7 +1766,7 @@ void EntityUnkId49(Entity* self) { g_Tilemap.fg[0xCC / 2] = temp; temp = g_Tilemap.fg[0xD4 / 2]; g_Tilemap.fg[0xCE / 2] = temp; - self->step++; - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/363FC.c b/src/st/np3/363FC.c index 6e2043e640..3b045965c0 100644 --- a/src/st/np3/363FC.c +++ b/src/st/np3/363FC.c @@ -1,15 +1,15 @@ -#include "np3.h" - +REDACTED +REDACTED // Make a EntityWargExplosionPuffOpaque -void func_801B653C(void) { - Entity* entity; - s8 temp_s4 = Random() & 3; - s16 temp_s3 = ((Random() & 0xF) << 8) - 0x800; - s32 i; - - for (i = 0; i < 6; i++) { - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Make a EntityWargExplosionPuffOpaque CreateEntityFromEntity(E_WARG_EXP_OPAQUE, g_CurrentEntity, entity); entity->params = 2; @@ -20,7 +20,7 @@ void func_801B653C(void) { } } -void EntityWargExplosionPuffOpaque(Entity* self) { +REDACTED Unkstruct_80180FE0* obj; s32 velocityX; s32 velocityY; @@ -35,11 +35,11 @@ void EntityWargExplosionPuffOpaque(Entity* self) { case 0: InitializeEntity(g_InitializeEntityData0); params = self->params & 0xF; - obj = &D_8018129C[params]; - self->palette = obj->palette + 0xD0; +REDACTED +REDACTED self->drawMode = obj->drawMode; - self->animSet = obj->animSet; - self->unk5A = obj->unk2; +REDACTED +REDACTED self->ext.wargpuff.unk80 = obj->unk8; self->step = params + 1; @@ -52,21 +52,21 @@ void EntityWargExplosionPuffOpaque(Entity* self) { self->palette = 0x819F; self->drawMode = DRAW_TPAGE; self->facingLeft = 1; - } - break; - - case 1: - MoveEntity(); - self->velocityY = FIX(1.0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) != 0) { - switch (self->step_s) { - case 0: +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_UNK8; self->unk6C = 0x80; self->step_s++; @@ -80,34 +80,34 @@ void EntityWargExplosionPuffOpaque(Entity* self) { case 2: self->unk6C += 0xFC; - break; - } - } else { - DestroyEntity(self); - } - break; - - case 3: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; switch (self->ext.wargpuff.unk88) { - case 1: +REDACTED if (self->ext.wargpuff.unk89 >= 0x4) { self->ext.wargpuff.unk89 += 0xFD; self->ext.wargpuff.unk84 -= 0x800; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED self->ext.wargpuff.unk84 = (u16)self->ext.wargpuff.unk84 + ((u8)self->ext.wargpuff.unk89 * 0xC0); - break; - } +REDACTED +REDACTED self->ext.wargpuff.unk84 = self->ext.wargpuff.unk84 & 0xFFF; self->rotZ = self->ext.wargpuff.unk84 & 0xFFF; temp_s0 = self->ext.wargpuff.unk89 * 0x140; - temp_s0 /= 28; +REDACTED self->velocityX = temp_s0 * rsin(self->ext.wargpuff.unk84); self->velocityY = -(temp_s0 * rcos(self->ext.wargpuff.unk84)); self->step_s++; @@ -132,10 +132,10 @@ void EntityWargExplosionPuffOpaque(Entity* self) { } MoveEntity(); if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case 4: if (self->step_s == 0) { rnd = Random(); @@ -143,12 +143,12 @@ void EntityWargExplosionPuffOpaque(Entity* self) { self->facingLeft = rnd & 1; self->rotX = 0xC0; self->drawFlags |= 1; - self->step_s++; - } - MoveEntity(); +REDACTED +REDACTED +REDACTED if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/44DCC.c b/src/st/np3/44DCC.c index a4338645f0..f2ede4e453 100644 --- a/src/st/np3/44DCC.c +++ b/src/st/np3/44DCC.c @@ -1,1161 +1,1161 @@ -/* - * Overlay: NP3 - * Description: Merman Room - */ - -#include "np3.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" #include "../e_merman2.h" - -// EntitySplashWater ID 0x2D -void EntitySplashWater(Entity* self) { +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - u16 params = self->params; - u16 temp_s2 = params >> 0xB; - u16 temp_s5 = (params >> 8) & 7; - u16 temp_s4 = (params >> 5) & 7; - - Primitive *prim, *prim2; - Entity* newEntity; - s16 primIndex; - s16 temp_a0; - s16 temp_a1; - s16 temp_a2; - u16 temp_t3; - s16 temp_t8; - char pad[0x4]; - s32 i; - - params &= 0xF; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - if (temp_s2 != 0 && temp_s4 != 7) { - primIndex = g_api.AllocPrimitives(PRIM_GT4, 4); - } else { +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); - } - if (primIndex != -1) { - self->flags |= FLAG_HAS_PRIMS; +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - temp_t3 = self->posY.i.hi; - temp_t8 = self->posX.i.hi; +REDACTED +REDACTED self->ext.waterEffects.unk82 = temp_t3 + tilemap->scrollY.i.hi; - for (i = 0; prim != NULL; i++) { - if (i % 2) { - prim->u0 = prim->u2 = prim2->u0; - prim->u1 = prim->u3 = prim2->u1; - prim->v0 = prim->v1 = prim2->v0; - prim->v2 = prim->v3 = prim2->v2; - prim->y2 = prim2->y2; - prim->y3 = prim2->y3; - prim->x2 = prim->x0 = prim2->x0; - prim->x3 = prim->x1 = prim2->x1; - } else { - prim->u1 = prim->u3 = 0x20; - prim->v2 = prim->v3 = 0x7C; - prim->u0 = prim->u2 = 0; - prim->v0 = prim->v1 = 96; - prim->y2 = prim->y3 = temp_t3; - prim->x2 = prim->x0 = temp_t8 - 0xE; - prim->x3 = prim->x1 = temp_t8 + 0xE; - if (i >= 2) { - temp_a2 = D_80182168[temp_s4]; - if (temp_s2 >= 0xF) { - prim->u0 = prim->u2 = prim2->u1; - prim->x0 = prim->x2 = prim2->x1; - temp_a1 = prim2->y3; - prim->y2 = temp_a1; - if (temp_a2 != 0) { - prim->y3 = - temp_a1 - (prim->x1 - prim->x0) / temp_a2; - } else { - prim->y3 = temp_a1; - } - } else { - prim->u1 = prim->u3 = prim2->u0; - prim->x1 = prim->x3 = prim2->x0; - temp_a1 = prim2->y2; - prim->y3 = temp_a1; - if (temp_a2 != 0) { - prim->y2 = - temp_a1 + (prim->x1 - prim->x0) / temp_a2; - } else { - prim->y2 = temp_a1; - } - } - } else { - if (temp_s2 != 0) { - if (temp_s2 >= 0xF) { - prim->u1 = prim->u3 = - prim->u0 + (temp_s2 << 5) / 28; - prim->x1 = prim->x3 = temp_s2 + prim->x0; - } else { - prim->u0 = prim->u2 = - prim->u2 + (temp_s2 << 5) / 28; - prim->x0 = prim->x2 = temp_s2 + prim->x2; - } - } - if (temp_s5 != 0) { - temp_a0 = D_80182168[temp_s5]; - if (temp_a0 < 0) { - if (temp_t8 >= prim->x1) { - prim->y2 += (prim->x1 - prim->x0) / temp_a0; - } else { - prim->y2 += (temp_t8 - prim->x0) / temp_a0; - prim->y3 = prim->y3 - - (prim->x1 - temp_t8) / temp_a0; - } - } else if (prim->x0 >= temp_t8) { - prim->y3 -= (prim->x1 - prim->x0) / temp_a0; - } else { - prim->y2 += (temp_t8 - prim->x0) / temp_a0; - prim->y3 -= (prim->x1 - temp_t8) / temp_a0; - } - } - } - } - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = - prim->b1 = 255; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = - prim->b3 = 128; - prim->clut = 0x162; - prim->tpage = 0x1A; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x77; - if (i % 2) { - prim->clut = 0x15F; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = - prim->b1 = 0; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = - prim->b3 = 96; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x37; - prim->priority += 2; - } - prim2 = prim; - prim = prim->next; - } - - temp_a2 = (self->posX.i.hi - 120) >> 4; - if (temp_a2 < -8) { - temp_a2 = -8; - temp_a2 = -8; - } - if (temp_a2 > 8) { - temp_a2 = 8; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfxVolPan(D_8018122C, 0x7F, temp_a2); - self->velocityY = D_80182188[params].x; +REDACTED self->ext.waterEffects.accelY = D_80182188[params].y; - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_WATER_DROP, newEntity); - newEntity->velocityY = self->velocityY; - } - break; - } - DestroyEntity(self); - return; - - case 1: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += self->ext.waterEffects.accelY; - if (self->velocityY > FIX(2.5)) { - self->step++; - } - break; - - case 2: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PrimBuf[self->primIndex].r0 < 9) { - DestroyEntity(self); - return; - } - break; - } - - temp_t3 = self->ext.waterEffects.unk82 - self->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_t3 -= tilemap->scrollY.i.hi; - prim = &g_PrimBuf[self->primIndex]; - - for (i = 0; prim != NULL; i++) { - prim->y0 = prim->y2 - temp_t3; - prim->y1 = prim->y3 - temp_t3; - if (i % 2) { - if (prim->b3 >= 4) { - prim->b3 += 252; - } - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - } else { - if (prim->b3 >= 8) { - prim->b3 += 252; - } - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - if (prim->b3 <= 8) { - if (prim->b1 >= 8) { - prim->b1 += 248; - } - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1; - } - } - prim = prim->next; - } -} - -// ID 0x2E -void EntitySurfacingWater(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - s16 left, right, bottom; - Primitive* prim; - s16 primIndex; - s16 temp_t0; - s32 rnd; - s16 var_s2; - u16 params; - s16* ptr; - s16 temp3; - s16 tempv0; - s16 x, y; - s32 i, j; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); - if (primIndex == -1) { - DestroyEntity(self); - return; - } - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - var_s2 = (self->posX.i.hi - 120) >> 4; - if (var_s2 < -8) { - var_s2 = -8; - } - if (var_s2 > 8) { - var_s2 = 8; - } - params = self->params; - if (!(params & 0x8000)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfxVolPan(D_8018122E, 0x7F, var_s2); - } - params = (params >> 8) & 0x7F; - prim = &g_PrimBuf[primIndex]; - right = self->posX.i.hi; - bottom = self->posY.i.hi; - left = right - 9; - right += 9; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.unk82 = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - - for (i = 0; i < 2; i++) { - prim->u2 = 0; - prim->u0 = 0; - prim->u1 = prim->u3 = 0x1E; - prim->v0 = prim->v1 = 0x60; - prim->v2 = prim->v3 = 0x7C; - prim->y2 = prim->y3 = bottom; - prim->x2 = prim->x0 = left; - prim->x3 = prim->x1 = right; - if (params != 0) { - var_s2 = D_80182168[params]; - prim->y2 = prim->y2 + 9 / var_s2; - prim->y3 = prim->y3 - 9 / var_s2; - } - prim->clut = 0x162; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 = - 255; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3 = - 128; - prim->tpage = 0x1A; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x77; - if (i != 0) { - prim->clut = 0x161; - prim->priority = self->zPriority + 4; +REDACTED +REDACTED +REDACTED prim->drawMode = 0x77; - } - prim = prim->next; - } - rnd = (rand() & 1) + 12; +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.topY.i.hi = D_801821A8[(u8)self->params] + rnd; self->velocityX = self->ext.waterEffects.unk8A * 16; - if (params != 0) { - self->velocityY = self->velocityX / var_s2; - if (self->velocityY < 0) { - self->velocityY = -self->velocityY; - } - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.topY.val -= FIX(0.25); - break; - } - - MoveEntity(self); - - //! FAKE: - j = self->velocityX; - - if (self->velocityX != 0) { - right = D_80181230[self->ext.waterEffects.unk88]; - ptr = D_80181230; - if (self->velocityX < 0) { - right += 6; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED x = right - tilemap->scrollX.i.hi; - if (self->posX.i.hi < x) { - DestroyEntity(self); - return; - } - } else { - ptr++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp3 = tilemap->scrollX.i.hi + 6; - x = right; - x += (ptr[self->ext.waterEffects.unk88] - temp3); - if (self->posX.i.hi >= x) { - DestroyEntity(self); - return; - } - } - } - - j = 0; - tempv0 = self->ext.waterEffects.unk82; - x = self->posX.i.hi; - y = self->posY.i.hi; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED bottom = tempv0 - y - tilemap->scrollY.i.hi; - - prim = &g_PrimBuf[self->primIndex]; - temp_t0 = x - 9; - x += 9; - - while (j < 2) { - prim->y2 = prim->y2 - bottom; - prim->y3 = prim->y3 - bottom; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->y0 = prim->y2 - self->ext.waterEffects.topY.i.hi; prim->y1 = prim->y3 - self->ext.waterEffects.topY.i.hi; - prim->x2 = prim->x0 = temp_t0; - prim->x3 = prim->x1 = x; - prim->b1 += 248; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1; - prim->b3 += 252; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - if (prim->r0 < 9) { - DestroyEntity(self); - return; - } - prim = prim->next; - j++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.unk82 = self->posY.i.hi + tilemap->scrollY.i.hi; -} - -// ID 0x2F -void EntitySideWaterSplash(Entity* self) { - Primitive* prim; - s16 primIndex; - s32 temp_lo; - s32 temp_s0; - s32 temp_s1; - s32 temp_s3; - u16 params; - s16 angle; - u16 x, y; - s32* ptr; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->u0 = prim->u2 = 0xF0; - prim->u1 = prim->u3 = 0xFF; - prim->v0 = prim->v1 = 0; - prim->v2 = prim->v3 = 0xF; - prim->clut = 0x161; - prim->tpage = 0x1A; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = - prim->b3 = prim->r0 = prim->g0 = prim->b0 = prim->r1 = - prim->g1 = prim->b1 = 128; - prim->p1 = 0; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x37; - prim = prim->next; - } - params = self->params; - temp_s0 = params & 0xF; - if (temp_s0 == 0) { - g_api.PlaySfx(D_8018122C); - } - angle = LOH(D_801821F4[(params >> 3) & 0x1E]); - ptr = (s32*)&D_801821B4[temp_s0]; - temp_s1 = rcos(angle) * *ptr; - temp_s3 = rsin(angle + 0x800) * *ptr; - ptr++; - temp_s1 += rsin(angle) * *ptr; - temp_lo = rcos(angle) * *ptr; - self->velocityX = temp_s1 + (((params & 0xFF00) << 0x10) >> 0xE); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.accelY = FIX(22.0 / 128); - self->velocityY = temp_s3 + temp_lo; - } else { - DestroyEntity: - DestroyEntity(self); - return; - } - break; - - case 1: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += self->ext.waterEffects.accelY; - break; - } - - x = self->posX.i.hi; - y = self->posY.i.hi; - - prim = &g_PrimBuf[self->primIndex]; - while (prim != NULL) { - prim->x0 = prim->x2 = x - (prim->p1 / 2) - 4; - prim->x1 = prim->x3 = x + (prim->p1 / 2) + 4; - prim->y0 = prim->y1 = y - (prim->p1 / 2) - 4; - prim->y2 = prim->y3 = y + (prim->p1 / 2) + 4; - if (prim->b1 >= 3) { - prim->b1 += 253; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1; - if (prim->b3 >= 4) { - prim->b3 += 252; - } - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; - prim->p1++; - prim = prim->next; - } else { - goto DestroyEntity; - } - } -} - -// ID 0x30 -void EntitySmallWaterDrop(Entity* self) { - s32 params = self->params; - s16 temp_s5 = params & 0xFF00; - Primitive *prim, *prim2; - s16 primIndex; - s32 var_v1; - u16 x, y; - - params &= 0xFF; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); - primIndex = g_api.AllocPrimitives(PRIM_TILE, 1); - if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; - - x = self->posX.i.hi; - y = self->posY.i.hi; - y -= Random() & 3; - - if (temp_s5 > 0) { - x += Random() & 3; - } else { - x -= Random() & 3; - } - self->posX.i.hi = x; - self->posY.i.hi = y; - - while (prim != NULL) { - prim->v0 = prim->u0 = 2; - prim->x0 = x; - prim->y0 = y; - prim->r0 = 96; - prim->g0 = 96; - prim->b0 = 128; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - prim = prim->next; - } - var_v1 = D_80182204[params * 2]; - if (temp_s5 > 0) { - var_v1 = -var_v1; - } - self->velocityX = var_v1 + (temp_s5 * 16); - self->velocityY = D_80182204[params * 2 + 1]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.waterEffects.accelY = FIX(0.25); - break; - - case 1: - MoveEntity(self); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += self->ext.waterEffects.accelY; - break; - } - - x = self->posX.i.hi; - y = self->posY.i.hi; - - prim = &g_PrimBuf[self->primIndex]; - prim->x0 = x; - prim->y0 = y; - if (prim->b0 >= 8) { - prim->b0 += 248; - prim->r0 = prim->g0 -= 6; - return; - } - DestroyEntity(self); -} - -// ID 0x31 -void EntityWaterDrop(Entity* self) { - u16 x = self->posX.i.hi; - u16 y = self->posY.i.hi; - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); primIndex = g_api.func_800EDB58(PRIM_TILE_ALT, 0x21); if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.generic.unk7C.s = 0x2F; - self->flags |= FLAG_HAS_PRIMS; - - while (1) { +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x73; - prim->priority = self->zPriority + 2; - - if (prim->next == NULL) { - prim->u0 = 0; - prim->x0 = 0; - prim->y0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode &= ~DRAW_HIDE; - break; - } - - prim->x1 = 0; - LOH(prim->r1) = 0; - LOW(prim->r2) = (rand() * 8) + self->velocityY; - prim->y1 = y + (rand() & 15); - LOH(prim->b1) = x + (rand() & 31) - 16; - LOH(prim->u2) = (rand() & 15) + 32; - prim->b0 = prim->g0 = prim->r0 = 255; - prim->v0 = prim->u0 = 2; - prim->x0 = LOH(prim->b1); - prim->y0 = prim->y1; - prim = prim->next; - } - break; - - case 1: - if (--self->ext.generic.unk7C.s == 0) { - DestroyEntity(self); - return; - } - - prim = &g_PrimBuf[self->primIndex]; - - while (1) { - if (prim->next == NULL) { - prim->u0 = 0; - prim->x0 = 0; - prim->y0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode &= ~DRAW_HIDE; - return; - } - LOH(prim->b1) = prim->x0; - prim->y1 = prim->y0; - LOH(prim->u2)--; - if (LOH(prim->u2) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= DRAW_HIDE; - } - LOW(prim->x1) += LOW(prim->r2); - if (LOW(prim->r2) > 0x8000) { - prim->r0 += 252; - prim->g0 += 252; - prim->b0 += 252; - } else { - LOW(prim->r2) += 0x3800; - } - prim->x0 = LOW(prim->b1); - prim->y0 = prim->y1; - prim = prim->next; - } - break; - } -} - -s32 func_801C6458(s16 yOffset) { - s16 newY = yOffset + g_CurrentEntity->posY.i.hi; - s32 expectedResult = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Collider collider; - Entity* newEntity; - s32 res; - - g_api.CheckCollision(g_CurrentEntity->posX.i.hi, newY, &collider, 0); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (expectedResult == (collider.effects & EFFECT_SOLID)) { - res = true; - } else { - res = false; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_WATER) { - if (!g_CurrentEntity->ext.merman.isUnderwater) { +REDACTED newEntity = AllocEntity(g_Entities + 232, g_Entities + 256); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity( E_MERMAN_UNK0, g_CurrentEntity, newEntity); - newEntity->posY.i.hi += yOffset; - newEntity->zPriority = g_CurrentEntity->zPriority; - } - g_api.PlaySfx(NA_SE_EV_WATER_SPLASH); - g_CurrentEntity->ext.merman.isUnderwater = true; - } - } - return res; -} - -void EntityMerman2(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 primIndex; - Collider collider; - Entity* newEntity; - Entity* newEntity2; - Primitive* prim; - s16 posX, posY; - s32 colRes; - s32 offset; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED u32 colorOffset; - s16* pos; - s16 camY; - s32 rnd; - s32 i; - - if (self->ext.merman2.ignoreCol && (self->step < MERMAN2_7)) { - SetStep(MERMAN2_7); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < MERMAN2_DYING)) { PlaySfxPositional(0x71D); self->drawFlags = 0; if (self->flags & FLAG_HAS_PRIMS) { g_api.FreePrimitives(self->primIndex); self->flags &= ~FLAG_HAS_PRIMS; - } +REDACTED self->hitboxState = 0; - self->flags &= ~FLAG_UNK_20000000; - SetStep(MERMAN2_DYING); - } - - switch (self->step) { - case MERMAN2_INIT: - InitializeEntity(D_80180AB4); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = 8; - self->zPriority = 0xA9; - if (self->params != 0) { - self->palette++; - } +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-1); - break; - - case MERMAN2_SWIMMING_UP: - AnimateEntity(D_8018229C, self); - MoveEntity(); - posY = self->posY.i.hi - 24; - g_api.CheckCollision(self->posX.i.hi, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { - SetStep(MERMAN2_SWIMMING); - } +REDACTED +REDACTED break; - - case MERMAN2_SWIMMING: - if (self->step_s == 0) { - rnd = Random() & 3; +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = D_80182224[rnd].x; self->velocityY = D_80182224[rnd].y; - self->step_s++; - } - if (AnimateEntity(D_8018229C, self) == 0) { +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - MoveEntity(); - posX = self->posX.i.hi; - posY = self->posY.i.hi; - posY -= 24; - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { self->velocityY = FIX(0.5); - } - pos = D_80181230; - pos += (self->params >> 8) & 1; +REDACTED +REDACTED +REDACTED posY += g_Tilemap.scrollY.i.hi; - if (pos[4] < posY) { +REDACTED self->posY.i.hi = pos[4] - g_Tilemap.scrollY.i.hi - 24; - } - - if ((u8)self->ext.merman2.timer++ > 32) { - self->ext.merman2.timer = 0; - self->step_s = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((GetDistanceToPlayerX() >= 48) && !(Random() & 1)) { - SetStep(MERMAN2_JUMPING); - } - } - break; - - case MERMAN2_JUMPING: - switch (self->step_s) { - case MERMAN2_JUMPING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = FIX(-8.5); - self->step_s++; +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { - u32 v0; +REDACTED prim = &g_PrimBuf[primIndex]; - self->animCurFrame = 0; +REDACTED self->primIndex = primIndex; - self->ext.merman2.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - prim->tpage = 0x12; - prim->clut = 0x28C; - if (self->params & 1) { - prim->clut = 0x28D; - } - prim->u0 = 0; - prim->u1 = 0x20; - prim->v1 = prim->v0 = 0x38; - prim->u2 = prim->u0; - prim->u3 = prim->u1; - v0 = prim->v0 + 0x38; - prim->v2 = v0; - prim->v3 = v0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - s16 posX = self->posX.i.hi; - prim->x0 = posX + 15; - prim->x1 = posX - 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - } else { - s16 posX = self->posX.i.hi; - prim->x0 = posX - 15; - prim->x1 = posX + 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - } - prim->y0 = prim->y1 = self->posY.i.hi - 17; - - setRGB0(prim, 64, 64, 160); - - *(s32*)&prim->r1 = *(s32*)&prim->r0; - *(s32*)&prim->r2 = *(s32*)&prim->r0; - *(s32*)&prim->r3 = *(s32*)&prim->r0; - - prim->y3 = prim->y2 = prim->y0 + 0x38; - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 6; } else { self->animCurFrame = 17; DestroyEntity(self); - } - break; - - case MERMAN2_JUMPING_UNDERWATER: - MoveEntity(); - pos = D_80181230; - pos += (self->params >> 8) & 1; - posY = self->posY.i.hi; - posY -= 24; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi + posY; - if (camY < pos[3]) { - g_api.PlaySfx(NA_SE_EV_WATER_SPLASH); +REDACTED +REDACTED newEntity = AllocEntity(g_Entities + 232, g_Entities + 256); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_MERMAN_UNK0, self, newEntity); - newEntity->posY.i.hi -= 24; - newEntity->zPriority = self->zPriority; - } +REDACTED +REDACTED +REDACTED self->rotZ = 0; self->drawFlags |= 4; - self->step_s++; - } - break; - - case MERMAN2_JUMPING_IN_AIR: - prim = self->ext.merman2.prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY > ~0xBFFF) { prim->drawMode = DRAW_HIDE; - self->animCurFrame = 18; - self->hitboxHeight = 8; +REDACTED +REDACTED self->rotZ -= 0x80; - } else { +REDACTED if (self->facingLeft != 0) { - s16 posX = self->posX.i.hi; - prim->x0 = posX + 15; - prim->x1 = posX - 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - prim->y1 = prim->y0 = self->posY.i.hi - 17; - prim->y3 = prim->y2 = prim->y0 + 0x38; - } else { - s16 posX = self->posX.i.hi; - prim->x0 = posX - 15; - prim->x1 = posX + 17; - prim->x2 = prim->x0; - prim->x3 = prim->x1; - prim->y1 = prim->y0 = self->posY.i.hi - 17; - prim->y3 = prim->y2 = prim->y0 + 0x38; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED colorOffset = (u32)(((abs(self->velocityY) >> 0xC) - 10) & 0xFF) >> 1; - +REDACTED setRGB0(prim, 128 - colorOffset, 128 - colorOffset, colorOffset + 192); - - *(s32*)&prim->r1 = *(s32*)&prim->r0; - *(s32*)&prim->r2 = *(s32*)&prim->r0; - *(s32*)&prim->r3 = *(s32*)&prim->r0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY < 0) { newEntity = AllocEntity(g_Entities + 232, g_Entities + 256); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_MERMAN2_UNK0, self, newEntity); - newEntity->posX.i.hi -= 6 - ((Random() & 3) * 4); - newEntity->zPriority = self->zPriority + 1; - } - } +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY > 0) { - func_801C6458(0x1B); - } - if (self->ext.merman2.isUnderwater == 0) { +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_80182248) & 1) { g_api.FreePrimitives(self->primIndex); - self->hitboxHeight = 21; +REDACTED self->flags &= ~FLAG_HAS_PRIMS; self->drawFlags &= 0xFB; - SetStep(MERMAN2_WALKING_TO_PLAYER); - } - } else { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); - } - } - break; - - case MERMAN2_WALKING_TO_PLAYER: - switch (self->step_s) { - case MERMAN2_WALKING_TO_PLAYER_SETUP: - if (AnimateEntity(D_80182294, self) == 0) { - self->animFrameIdx = 0; - self->animFrameDuration = 0; - self->step_s++; - } - break; - - case MERMAN2_WALKING_TO_PLAYER_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->ext.merman2.timer = D_80182244[Random() & 3]; - self->step_s++; - break; - - case MERMAN2_WALKING_TO_PLAYER_WALKING: - AnimateEntity(D_80182270, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED colRes = UnkCollisionFunc2(&D_80182268); - if (colRes == 0xFF) { +REDACTED self->facingLeft ^= 1; - } +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - - if (colRes & 0x80) { +REDACTED +REDACTED +REDACTED self->posX.val += self->velocityX; - } - - if (!(self->params & 1) || +REDACTED +REDACTED +REDACTED (self->velocityX *= 2, !(self->params & 1))) { - if (!(self->posX.i.hi & 0xFF00)) { - self->ext.merman2.timer--; - if ((self->ext.merman2.timer & 0xFF) == 0) { - if (Random() % 2) { - SetStep(MERMAN2_SPIT_FIRE); - } else { - self->step_s--; - } - } - if (func_801C6458(0x1B)) { - self->ext.merman2.ignoreCol = 1; - } - } - } else { - if (func_801C6458(0x1B)) { - self->ext.merman2.ignoreCol = 1; - } - } - } - break; - - case MERMAN2_SPIT_FIRE: - switch (self->step_s) { - case MERMAN2_SPIT_FIRE_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; +REDACTED break; - - case MERMAN2_SPIT_FIRE_ATTACK: - if (AnimateEntity(D_8018227C, self) == 0) { +REDACTED +REDACTED +REDACTED PlaySfxPositional(SFX_FIREBALL_SHOT_C); newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - i = 0; - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN2_UNK1, self, newEntity); - newEntity->posY.i.hi -= 12; +REDACTED newEntity->facingLeft = self->facingLeft; - } +REDACTED newEntity2 = g_Entities + 224; - for (offset = 0; i < 3; i++, offset += 8) { +REDACTED newEntity = AllocEntity(newEntity2, newEntity2 + 32); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_MERMAN2_UNK2, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 8 + offset; - } else { - newEntity->posX.i.hi += -8 - offset; - } - newEntity->posY.i.hi -= 12; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - if (i == 0) { - newEntity->params = 1; - } - } - } - self->ext.merman2.rotation = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ = 0; self->drawFlags |= 4; if (self->facingLeft != 0) { self->velocityX = FIX(-6); - } else { +REDACTED self->velocityX = FIX(6); - } +REDACTED self->velocityY = FIX(-0.0625); - self->posY.i.hi -= 1; - self->step_s++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->ext.merman2.rotation < 0x100) && (g_Timer & 1)) { - self->ext.merman2.rotation *= 2; - } +REDACTED +REDACTED if (self->velocityX != 0) { if (self->facingLeft != 0) { self->velocityX += FIX(0.1875); - } else { +REDACTED self->velocityX -= FIX(0.1875); - } - } - posX = self->posX.i.hi; - posY = self->posY.i.hi + 8; +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX -= 20; - } else { - posX += 20; - } - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { self->velocityX = 0; - } +REDACTED self->rotZ += self->ext.merman2.rotation; self->velocityY -= FIX(0.125); - +REDACTED if (UnkCollisionFunc3(&D_80182248) & 1) { if (self->facingLeft == 0) { self->velocityX = FIX(2.5); - } else { +REDACTED self->velocityX = FIX(-5.0 / 2.0); - } - self->ext.merman2.rotation = 4; - self->posY.i.hi += 10; - self->step_s++; - } - func_801C6458(0x1B); - if (self->ext.merman2.isUnderwater) { - self->ext.merman2.ignoreCol = 1; - } - break; - - case 3: - posY = self->posY.i.hi + 8; - posX = self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX -= 20; - } else { - posX += 20; - } - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { self->velocityX = 0; - } - MoveEntity(); +REDACTED +REDACTED self->rotZ += 0xC0; if (self->rotZ > 0x1000) { - self->posY.i.hi -= 10; +REDACTED self->drawFlags &= 0xFB; - SetStep(MERMAN2_WALKING_TO_PLAYER); - } - if (func_801C6458(0x1B)) { - self->ext.merman2.ignoreCol = 1; - } - } - break; - - case MERMAN2_7: - if (self->step_s == 0) { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - self->step_s++; - } - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); - if (!(func_801C6458(0x1B)) && !(self->ext.merman2.isUnderwater)) { - self->ext.merman2.ignoreCol = 0; - SetStep(MERMAN2_WALKING_TO_PLAYER); - } - break; - - case MERMAN2_DYING: - switch (self->step_s) { - case 0: - self->animCurFrame = 14; - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(GetSideToPlayer() & 1)) { self->velocityX = FIX(-2); - } else { +REDACTED self->velocityX = FIX(2); - } +REDACTED self->velocityY = FIX(-1); - self->step_s++; +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex != -1) { - u32 v0; +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.merman2.prim = prim; - self->flags |= 0x800000; +REDACTED +REDACTED UnkPolyFunc2(prim); - prim->tpage = 0x12; - prim->clut = 0x292; - if (self->params & 1) { - prim->clut = 0x293; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - u32 u1 = 0x1C8; - prim->u0 = 0xF0; - prim->u1 = u1; - } else { - prim->u0 = 0xC8; - prim->u1 = 0xF0; - } - - prim->v0 = prim->v1 = 0; - prim->u2 = prim->u0; - prim->u3 = prim->u1; - v0 = prim->v0 + 0x30; - prim->v2 = v0; - prim->v3 = v0; - - prim->priority = self->zPriority + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - *(s16*)&prim->next->r2 = 0x28; - *(s16*)&prim->next->b2 = 0x30; - prim->next->b3 = 0x80; +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - prim->next->x1 = self->posX.i.hi - 3; - } else { - prim->next->x1 = self->posX.i.hi + 3; - } - prim->next->y0 = self->posY.i.hi + 2; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - break; - - case 1: +REDACTED +REDACTED +REDACTED UnkCollisionFunc3(&D_80182258); - prim = self->ext.merman2.prim; +REDACTED self->velocityY -= FIX(0.1875); if (self->facingLeft != 0) { - prim->next->x1 = self->posX.i.hi - 3; - } else { - prim->next->x1 = self->posX.i.hi + 3; - } - prim->next->y0 = self->posY.i.hi + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); if (!(g_Timer % 10)) { - prim->clut += 2; - if (prim->clut >= 0x2A0) { +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - self->step_s++; - } else { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN2_UNK3, self, newEntity); newEntity->facingLeft = self->facingLeft; - newEntity->params = prim->clut; - newEntity->zPriority = self->zPriority; - } - } - } - func_801C6458(0x1B); - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(SFX_FM_EXPLODE_B); - func_801B653C(); - DestroyEntity(self); - } - break; - } -} - -// some sort of explosion: ID 0x36 -void EntityExplosion2(Entity* entity, s32 arg1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Primitive* prim; s16 primIndex; - - if (entity->step == 0) { - InitializeEntity(D_80180AB4); - entity->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED entity->hitboxState = 0; - entity->zPriority += 4; - if (entity->params != 0) { +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex == -1) { - DestroyEntity(entity); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED entity->primIndex = primIndex; *(s32*)&entity->ext.generic.unk7C.s = prim; entity->flags |= FLAG_HAS_PRIMS; @@ -1176,300 +1176,300 @@ void EntityExplosion2(Entity* entity, s32 arg1) { prim->next->y0 = entity->posY.i.hi; prim->priority = entity->zPriority - 4; prim->drawMode = 6; - } - } - - if (entity->params != 0) { +REDACTED +REDACTED +REDACTED +REDACTED prim = *(s32*)&entity->ext.generic.unk7C.s; UnkPrimHelper(prim); prim->next->b3 += 252; LOH(prim->next->u1) -= 128; if (prim->next->b3 < 16) { prim->drawMode = DRAW_HIDE; - } - } - - entity->ext.generic.unk84.U8.unk0++; - if (!(entity->ext.generic.unk84.U8.unk0 % 4)) { - entity->posY.i.hi++; - } - - if (AnimateEntity(D_801822B0, entity) == 0) { - DestroyEntity(entity); - } -} - -void EntityMediumWaterSplash(Entity* entity) { - Entity* newEntity; - - if (entity->step == 0) { - InitializeEntity(D_80180AC0); - entity->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (entity->facingLeft != 0) { entity->velocityX = FIX(2); - return; - } +REDACTED +REDACTED entity->velocityX = FIX(-2); - return; - } - AnimateEntity(D_801822A4, entity); - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED if (entity->flags & FLAG_DEAD) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, entity, newEntity); - newEntity->params = 0; - } - DestroyEntity(entity); - } -} - -void EntityMermanWaterSplash(Entity* self) { - Unkstruct_801C7954 sp; - Entity* newEntity; - Primitive* prim; - s16 primIndex; - s16* posPtr; - s32* velPtr; - u8 temp; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - break; - - case 1: - primIndex = g_api.AllocPrimitives(PRIM_TILE, 4); +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.mermanWaterSplash.prim = prim; - self->flags |= FLAG_HAS_PRIMS; - - for (i = 0; prim != NULL; i++) { - prim->g0 = prim->r0 = 64; - prim->b0 = 160; - prim->v0 = prim->u0 = 2; - prim->x0 = self->posX.i.hi + D_801822F8[i]; - prim->y0 = self->posY.i.hi - 12; - LOW(sp.y3) = D_801822D0[i].x; - prim->y1 = sp.y1; - prim->y3 = sp.y3; - LOW(sp.x3) = D_801822D0[i].y; - prim->x2 = sp.x2; - prim->x3 = sp.x3; - prim->p1 = 0; - prim->p3 = 1; - prim->p2 = i % 2; - prim->priority = self->zPriority + 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - prim = prim->next; - } - - posPtr = &D_8018230C; - velPtr = &D_8018231C; - - for (i = 0; i < 7; i++) { - newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_MEDIUM_WATER_SPLASH, self, newEntity); - newEntity->params = D_80182304[i]; - newEntity->posX.i.hi = newEntity->posX.i.hi + posPtr[i]; - newEntity->velocityX = velPtr[i]; - newEntity->zPriority = self->zPriority + 1; - } - } - self->ext.mermanWaterSplash.unk84 = 0; - self->ext.mermanWaterSplash.unk86 = 0; - self->step++; - break; - - case 2: - prim = self->ext.mermanWaterSplash.prim; - temp = false; - while (prim != NULL) { - if (prim->p1 == 0) { - sp.x0 = prim->x0; - sp.x1 = prim->x1; - sp.y0 = prim->y0; - sp.y2 = prim->y2; - sp.y1 = prim->y1; - sp.y3 = prim->y3; - sp.x2 = prim->x2; - sp.x3 = prim->x3; - temp |= true; - LOW(sp.x1) += LOW(sp.y3); - LOW(sp.y2) += LOW(sp.x3); - LOW(sp.x3) += 0x2000; - if ((LOW(sp.x3) > 0) && (prim->p2 != 0) && (prim->p3 != 0)) { - if (LOH(sp.x0) > self->posX.i.hi) { - LOW(sp.y3) += 0x4000; - } else { - LOW(sp.y3) -= 0x4000; - } - prim->p3 = 0; - } - if (prim->y0 & 0xFF00) { - prim->p1 = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= 8; - } - prim->x0 = sp.x0; - prim->x1 = sp.x1; - prim->y0 = sp.y0; - prim->y2 = sp.y2; - prim->x2 = sp.x2; - prim->x3 = sp.x3; - prim->y1 = sp.y1; - prim->y3 = sp.y3; - } - prim = prim->next; - } - if (!temp) { - DestroyEntity(self); - return; - } - break; - } -} - -void func_801C7D80(Entity* self) { - if (self->step == 0) { - InitializeEntity(D_80180AB4); - self->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; self->flags |= FLAG_UNK_2000; - self->zPriority += 4; - } - MoveEntity(); +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.15625); if (AnimateEntity(D_801822B8, self) == 0) { - DestroyEntity(self); - } -} - -// ID 0x35 -void func_801C7E18(Entity* self) { - s8 temp; // probably !FAKE - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); self->animSet = ANIMSET_DRA(2); self->velocityY = FIX(-5); - self->palette = 0x8162; +REDACTED self->drawMode = DRAW_TPAGE; - self->palette = 0x8018; +REDACTED self->drawMode = 0x30; - self->unk6C = 0xA0; +REDACTED self->rotX = 0x100; self->rotY = 0x1A0; self->drawFlags |= 3; - self->ext.generic.unk84.S8.unk1 = 0x11; - self->ext.generic.unk84.S8.unk0 = self->params; +REDACTED +REDACTED self->drawFlags |= 8; - break; - - case 1: - temp = self->ext.generic.unk84.S8.unk0 - 1; - self->ext.generic.unk84.S8.unk0--; - self->ext.generic.unk84.S8.unk1--; - if (!(temp & 0xFF)) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_801822C0, self); - MoveEntity(); +REDACTED self->velocityY += FIX(0.25); self->rotX += 6; self->rotY -= 4; - if (self->posY.i.hi > 256) { - DestroyEntity(self); - } - if (!--self->ext.generic.unk84.U8.unk1) { +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = 0; - self->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_801822C0, self) == 0) { - MoveEntity(); +REDACTED self->velocityY += FIX(0.25); self->rotX += 6; self->rotY -= 4; - } - if (self->posY.i.hi > 256) { - DestroyEntity(self); - } - break; - } -} - -void EntityLargeFallingObject(Entity* self) { - u8 temp_v0; - - if (self->step == 0) { - InitializeEntity(D_80180AB4); - self->animCurFrame = 13; - self->ext.generic.unk84.S8.unk0 = 0x20; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; self->velocityY = FIX(0.0625); - self->palette = self->params + 0xE; - self->unk6C = 0x80; +REDACTED +REDACTED self->drawFlags |= 8; self->flags |= FLAG_UNK_2000; - return; - } - MoveEntity(); - temp_v0 = self->ext.generic.unk84.U8.unk0 - 1; - self->ext.generic.unk84.U8.unk0--; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.0625); - self->unk6C += 0xFE; - if (temp_v0 == 0) { - DestroyEntity(self); - } -} - -void EntityMermanSpawner(Entity* self) { - Entity* newEntity; - u16 temp_s0_2; - u16 temp_s0; - s32 temp2; - s16 temp; - - if (self->step == 0) { - InitializeEntity(D_80180A60); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_UNK_2000; - } - +REDACTED +REDACTED if (!(g_Timer & 0x3F)) { - Entity* player = &PLAYER; +REDACTED temp = g_Tilemap.scrollY.i.hi + player->posY.i.hi; - if (temp >= 256) { +REDACTED temp_s0 = g_Tilemap.scrollX.i.hi + player->posX.i.hi; - temp_s0_2 = 128; - temp_s0_2 = temp_s0 - temp_s0_2 + Random(); - temp_s0 = temp_s0_2 - 64; - if (temp_s0 <= 0x280) { - temp2 = 496; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[160], &g_Entities[170]); - if (newEntity != 0) { - if (Random() & 1) { - CreateEntityFromCurrentEntity(0x32, newEntity); - newEntity->params = Random() & 1; - } else { - CreateEntityFromCurrentEntity(0x39, newEntity); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->posX.i.hi = temp_s0_2 - g_Tilemap.scrollX.i.hi; newEntity->posY.i.hi = temp2 - g_Tilemap.scrollY.i.hi; - } - } - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/48238.c b/src/st/np3/48238.c index ddb8b17dc7..b357b93bd8 100644 --- a/src/st/np3/48238.c +++ b/src/st/np3/48238.c @@ -1,458 +1,458 @@ -/* - * Overlay: NP3 - * Description: Merman Room (2) - */ - -#include "np3.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" #include "../e_merman.h" - -void EntityMerman(Entity* self) { - Entity* newEntity; - Collider collider; - s16 posX, posY; - s32 colRet; - s16* pos; - s16 camY; - s32 rnd; - - if (self->ext.merman.isUnderwater) { - self->palette = self->ext.merman.palette; - } - if (self->ext.merman.ignoreCol && (self->step < MERMAN_FALLING)) { - SetStep(MERMAN_FALLING); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < MERMAN_DYING)) { PlaySfxPositional(0x71D); self->hitboxState = 0; - if (self->step == MERMAN_LUNGE) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - } - DestroyEntity(self); - return; - } - SetStep(MERMAN_DYING); - } - - switch (self->step) { - case MERMAN_INIT: - InitializeEntity(D_80180ACC); - self->ext.merman.palette = 0x2B9; - self->zPriority = 0xA9; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-1); - self->hitboxWidth = 5; - self->hitboxHeight = 17; - self->palette = self->ext.merman.palette; - break; - - case MERMAN_SWIMMING_UP: - if (self->step_s == 0) { - self->hitboxWidth = 18; - self->hitboxHeight = 4; - self->step_s++; - } - AnimateEntity(D_801823D0, self); - MoveEntity(); - - posX = self->posX.i.hi; - posY = self->posY.i.hi - 24; - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { - SetStep(MERMAN_SWIMMING); - } +REDACTED +REDACTED break; - - case MERMAN_SWIMMING: - if (self->step_s == 0) { - self->hitboxWidth = 5; - self->hitboxHeight = 17; - rnd = Random() & 3; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = D_80182338[rnd].x; self->velocityY = D_80182338[rnd].y; - self->step_s++; - } - if (AnimateEntity(D_801823D0, self) == 0) { +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - MoveEntity(); +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi; - posX = self->posX.i.hi; - posY = self->posY.i.hi; - posY -= 24; - - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(collider.effects & EFFECT_WATER)) { self->velocityY = FIX(0.5); - } - - pos = D_80181230; - pos += (self->params >> 8) & 1; +REDACTED +REDACTED +REDACTED +REDACTED posY += g_Tilemap.scrollY.i.hi; - if (pos[4] < posY) { +REDACTED self->posY.i.hi = pos[4] - g_Tilemap.scrollY.i.hi - 24; - } - if ((u8)self->ext.merman.timer2++ > 32) { - self->ext.merman.timer2 = 0; - self->step_s = 0; +REDACTED +REDACTED +REDACTED +REDACTED if ((GetDistanceToPlayerX() >= 48) && !(Random() & 1)) { - SetStep(MERMAN_JUMPING); - } - } - break; - - case MERMAN_JUMPING: - switch (self->step_s) { - case MERMAN_JUMPING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = FIX(-8.5); - self->step_s++; - break; - - case MERMAN_JUMPING_UNDERWATER: - MoveEntity(); - pos = D_80181230; - pos += (self->params >> 8) & 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi; - posY = self->posY.i.hi; - posY -= 20; - posY += camY; - if (posY < pos[3]) { - g_api.PlaySfx(NA_SE_EV_WATER_SPLASH); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_MERMAN_UNK0, self, newEntity); - newEntity->posY.i.hi -= 20; - newEntity->zPriority = self->zPriority; - } - self->step_s++; - } - break; - - case MERMAN_JUMPING_IN_AIR: - AnimateEntity(D_801823BC, self); - if (!self->ext.merman.isUnderwater) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_8018235C) & 1) { - self->animFrameDuration = 0; - self->animFrameIdx = 0; - self->step_s++; - } - } else { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); - } - - self->ext.merman.timer++; +REDACTED +REDACTED +REDACTED if (self->velocityY < 0) { - if ((self->ext.merman.palette >= 0x2B3) && - !(self->ext.merman.timer % 4)) { - self->ext.merman.palette--; - } - self->palette = self->ext.merman.palette; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[232], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_MERMAN_UNK1, self, newEntity); - newEntity->posX.i.hi -= 6 - ((Random() & 3) * 4); +REDACTED newEntity->velocityX = D_80182418[self->animFrameIdx]; - } - } else { +REDACTED +REDACTED self->palette = PAL_DRA(0x2B2); if (self->velocityY > 0) { - func_801C6458(0x15); - } - } - break; - - case MERMAN_JUMPING_LANDING: - if (AnimateEntity(D_801823DC, self) != 0) { - break; - } - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } - break; - - case MERMAN_WALKING_TOWARDS_PLAYER: - switch (self->step_s) { - case MERMAN_WALKING_TOWARDS_START: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - self->ext.merman.timer2 = D_80182358[Random() & 3]; - self->step_s++; - break; - - case MERMAN_WALKING_TOWARDS_PLAYER_WALKING: - AnimateEntity(D_80182394, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED colRet = UnkCollisionFunc2(&D_8018238C); - if (colRet == 0xFF) { +REDACTED self->facingLeft ^= 1; - } +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - if (colRet & 0x80) { +REDACTED +REDACTED self->posX.val += self->velocityX; - } - self->ext.merman.timer2--; - if (!(self->ext.merman.timer2 & 0xFF)) { - if (Random() % 2) { - SetStep(MERMAN_SPIT_FIRE); - } else { - SetStep(MERMAN_LUNGE); - } - } - if (func_801C6458(0x15)) { - self->ext.merman.ignoreCol = 1; - } - } - break; - - case MERMAN_SPIT_FIRE: - switch (self->step_s) { - case MERMAN_SPIT_FIRE_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; - break; - - case MERMAN_SPIT_FIRE_ATTACK: - if (AnimateEntity(D_801823AC, self) == 0) { - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { PlaySfxPositional(SFX_FIREBALL_SHOT_C); - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN_UNK2, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 12; - } else { - newEntity->posX.i.hi -= 12; - } - newEntity->posY.i.hi -= 10; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - } - } - } - break; - - case MERMAN_LUNGE: - switch (self->step_s) { - case MERMAN_LUNGE_START: - if (AnimateEntity(D_801823DC, self) == 0) { - self->step_s++; - } - break; - - case MERMAN_LUNGE_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-5.0 / 2.0); - } else { +REDACTED self->velocityX = FIX(2.5); - } - +REDACTED +REDACTED self->velocityY = FIX(-2); - self->ext.merman.timer2 = 64; - self->animCurFrame = 12; - self->hitboxWidth = 18; - self->hitboxHeight = 4; - self->step_s++; - break; - - case MERMAN_LUNGE_TOWARDS_PLAYER: - posY = self->posY.i.hi + 8; - posX = self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - posX += 24; - } else { - posX -= 24; - } - g_api.CheckCollision(posX, posY, &collider, 0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (collider.effects & EFFECT_SOLID) { self->velocityX = 0; - } +REDACTED UnkCollisionFunc5(&D_8018236C); if (self->facingLeft != 0) { self->velocityX -= FIX(0.03125); - } else { +REDACTED self->velocityX += FIX(0.03125); - } - self->ext.merman.timer2--; - if ((self->ext.merman.timer2 & 0xFF) == 0) { +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = FIX(2); - self->posY.i.hi -= 9; +REDACTED UnkCollisionFunc3(&D_8018235C); - self->animFrameIdx = 2; - self->hitboxWidth = 5; - self->animFrameDuration = 0; - self->hitboxHeight = 17; - self->step_s++; - } - func_801C6458(11); - if (self->ext.merman.isUnderwater) { - self->ext.merman.ignoreCol = 1; - } - break; - - case MERMAN_LUNGE_STANDING: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkCollisionFunc3(&D_8018235C); - if (AnimateEntity(D_801823DC, self) == 0) { +REDACTED self->velocityY = 0; - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } - func_801C6458(11); - if (self->ext.merman.isUnderwater) { - self->ext.merman.ignoreCol = 1; - } - } - break; - - case MERMAN_FALLING: - if (self->step_s == 0) { - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - self->step_s++; - } - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); - if (!(func_801C6458(21)) && !(self->ext.merman.isUnderwater)) { - self->ext.merman.ignoreCol = 0; - SetStep(MERMAN_WALKING_TOWARDS_PLAYER); - } - break; - - case MERMAN_DYING: - switch (self->step_s) { - case MERMAN_DYING_SETUP: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.merman.palette = PAL_DRA(0x2BC); self->velocityY = 0; - self->step_s++; - - case MERMAN_DYING_KNOCKEDBACK: +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_8018237C) & 1) { if (!(GetSideToPlayer() & 1)) { self->velocityX = FIX(-0.5); - } else { +REDACTED self->velocityX = FIX(0.5); - } - self->step_s++; - } +REDACTED +REDACTED +REDACTED // fallthrough - - case MERMAN_DYING_END: - AnimateEntity(D_801823EC, self); // spinning - MoveEntity(); - self->palette = self->ext.merman.palette; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer % 8)) { - self->ext.merman.palette++; +REDACTED if (self->ext.merman.palette == PAL_DRA(0x2C0)) { PlaySfxPositional(SFX_FM_EXPLODE_B); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_MERMAN_UNK3, self, newEntity); - newEntity->params = 2; - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED if (self->ext.merman.palette >= PAL_DRA(0x2C5)) { - DestroyEntity(self); - } - break; - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityMermanFireball(Entity* self) { - Entity* entity; - - if (self->step == 0) { +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AD8); - self->hitboxWidth = 6; - self->animCurFrame = 0; - self->hitboxHeight = 3; - +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { self->velocityX = FIX(1.5); - } else { +REDACTED self->velocityX = ~0x17FFF; - } - +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; self->rotY = self->rotX = 0x80; - - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { - CreateEntityFromEntity(E_ID_15, self, entity); - entity->ext.generic.unk94 = 4; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; - entity->zPriority = self->zPriority + 8; +REDACTED entity->rotY = entity->rotX = 192; - } - } else { +REDACTED +REDACTED AnimateEntity(D_80182400, self); - MoveEntity(); - +REDACTED +REDACTED if (self->rotX < 0x100) { self->rotY = self->rotX += 8; - } - +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, entity); - entity->params = 0; - } - DestroyEntity(self); - } - } -} - -// some kind of falling object -void func_801C8F54(Entity* self) { - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180ACC); - self->animCurFrame = 0; +REDACTED self->hitboxState = 0; - self->zPriority += 4; +REDACTED self->flags |= FLAG_UNK_2000; - } - MoveEntity(); +REDACTED +REDACTED self->velocityY += FIX(0.15625); if (AnimateEntity(D_80182414, self) == 0) { - DestroyEntity(self); - } -} - -void EntityMermanExplosion(Entity* self) { - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); - self->palette = 0x82BB; +REDACTED self->animSet = ANIMSET_DRA(2); - self->animCurFrame = D_80182454[self->params]; +REDACTED self->velocityY = D_80182440[self->params]; - self->step++; - return; - } else { - self->animFrameDuration++; +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += self->velocityY; - } - - if (!(self->animFrameDuration & 1)) { - self->animCurFrame++; - } - - if (D_80182458[self->params] < self->animFrameDuration) { - DestroyEntity(self); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } diff --git a/src/st/np3/4997C.c b/src/st/np3/4997C.c index d9adec87c5..323f412ad0 100644 --- a/src/st/np3/4997C.c +++ b/src/st/np3/4997C.c @@ -1,72 +1,72 @@ -#include "np3.h" - -void EntityBat(Entity* entity) { - Entity* newEntity; - s16 xDistance; - s16 yDistance; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (entity->flags & FLAG_DEAD) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, entity, newEntity); - newEntity->params = 1; - } +REDACTED +REDACTED PlaySfxPositional(0x69C); - DestroyEntity(entity); - return; - } - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180AFC); - entity->animCurFrame = 31; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED xDistance = GetDistanceToPlayerX(); yDistance = GetDistanceToPlayerY(); if ((xDistance < 96) && (yDistance < 96) && !(GetSideToPlayer() & 2)) { - entity->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80182570, entity) == 0) { entity->facingLeft = (GetSideToPlayer() & 1) ^ 1; entity->velocityY = FIX(0.875); if (entity->facingLeft != 0) { entity->velocityX = FIX(0.25); - } else { +REDACTED entity->velocityX = FIX(-0.25); - } - entity->animFrameIdx = (Random() & 3) * 3; - entity->animFrameDuration = 0; - entity->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80182554, entity); - MoveEntity(); +REDACTED if (GetDistanceToPlayerY() < 0x20) { if (entity->facingLeft == 0) { entity->velocityX = FIX(-1); - } else { +REDACTED entity->velocityX = FIX(1); - } - *(s32*)&entity->ext.generic.unk7C.s = 0x800; - entity->step++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80182554, entity); - MoveEntity(); +REDACTED if ((u32)(entity->velocityY + 0x10000) > 0x20000U) { - *(s32*)&entity->ext.generic.unk7C.s = - (s32) - *(s32*)&entity->ext.generic.unk7C.s; - } +REDACTED +REDACTED +REDACTED entity->velocityY += *(s32*)&entity->ext.generic.unk7C.u; - break; - } -} +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/49BC8.c b/src/st/np3/49BC8.c index 8f2d9c29de..b22b1525f1 100644 --- a/src/st/np3/49BC8.c +++ b/src/st/np3/49BC8.c @@ -1,81 +1,81 @@ -#include "np3.h" +REDACTED #include "sfx.h" - -void EntityZombie(Entity* self) { - Entity* newEntity; - s32 temp_a0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < 4)) { PlaySfxPositional(SFX_EXPLODE_SMALL); self->hitboxState = 0; - // Spawn Zombie explosion +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_WARG_EXP_OPAQUE, self, newEntity); - newEntity->zPriority = self->zPriority + 1; - newEntity->params = 3; - newEntity->posY.i.hi += 12; - } - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180B08); - self->hitboxWidth = 8; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = 0x10; - self->hitboxHeight = 0; - self->zPriority += 4; +REDACTED +REDACTED if (g_Timer & 1) { - self->palette++; - } - if (Random() & 1) { - self->palette++; - } - self->animCurFrame = 0; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(D_801825BC) & 1) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step++; - } - break; - - case 2: - if (AnimateEntity(D_80182594, self) == 0) { - SetStep(3); - } - if (self->animFrameDuration == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY -= 2; - self->hitboxHeight += 2; - } - break; - - case 3: - AnimateEntity(D_8018258C, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a0 = UnkCollisionFunc2(&D_801825CC); if (self->facingLeft != 0) { self->velocityX = FIX(0.5); - } else { +REDACTED self->velocityX = FIX(-0.5); - } - - if (temp_a0 & 0xC0) { +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - SetStep(4); - } - break; - - case 4: - if (AnimateEntity(D_801825A8, self) == 0) { - DestroyEntity(self); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED /* * An invisible entity that is responsible for spawning the "floor * zombies" that come up from the ground and swarm the player. @@ -84,42 +84,42 @@ void EntityZombie(Entity* self) { * The exact position a zombie is spawned in is also randomized. */ void EntityZombieSpawner(Entity* self) { - s32 distCameraEntity; - Entity* newEntity; - s32 rnd; - - if (self->step == 0) { - InitializeEntity(D_80180A60); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.zombieSpawner.spawnDelay = 1; self->flags &= FLAG_UNK_2000; - } - +REDACTED +REDACTED if (g_CastleFlags[0x37]) { - self->posX.i.hi = 128; +REDACTED if (--self->ext.zombieSpawner.spawnDelay == 0) { newEntity = AllocEntity(g_Entities + 160, g_Entities + 168); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_ZOMBIE, self, newEntity); - rnd = (Random() & 0x3F) + 96; - +REDACTED +REDACTED if (self->ext.zombieSpawner.spawnSide != 0) { - newEntity->posX.i.hi += rnd; - } else { - newEntity->posX.i.hi -= rnd; - } - newEntity->posY.i.hi -= 48; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.zombieSpawner.spawnSide ^= 1; - +REDACTED // Zombies are prevented from spawning too close to the // edges of the room. distCameraEntity = g_Tilemap.scrollX.i.hi + newEntity->posX.i.hi; if ((distCameraEntity < (g_Tilemap.x + 128)) || ((g_Tilemap.width - 128) < distCameraEntity)) { - DestroyEntity(newEntity); - } - } +REDACTED +REDACTED +REDACTED self->ext.zombieSpawner.spawnDelay = (Random() & 0x3F) + 32; - } - } -} +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/49F98.c b/src/st/np3/49F98.c index eab8fc25a7..724ed30ebe 100644 --- a/src/st/np3/49F98.c +++ b/src/st/np3/49F98.c @@ -1,36 +1,36 @@ -/* - * Overlay: NP3 - * Enemy: Bloody Zombie - */ - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // NOTE: There is an nz0/e_bloody_zombie.c which is almost exactly the same as // this file. Would maybe be smart to try to de-duplicate. Could be marked as // an Issue for someone to deal with later? -#include "np3.h" +REDACTED #include "sfx.h" - -typedef enum { - BLOODY_ZOMBIE_INIT, - BLOODY_ZOMBIE_WALK, - BLOODY_ZOMBIE_UNK_2, - BLOODY_ZOMBIE_CHASE, - BLOODY_ZOMBIE_ATTACK, - BLOODY_ZOMBIE_TAKE_HIT = 6, - BLOODY_ZOMBIE_DYING = 8, - BLOODY_ZOMBIE_DESTROY -} EntityBloodyZombieSteps; - -void EntityBloodSplatter(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Primitive* prim; s32 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); - break; - - case 1: +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex != -1) { self->flags |= FLAG_HAS_PRIMS; @@ -38,463 +38,463 @@ void EntityBloodSplatter(Entity* self) { prim = &g_PrimBuf[primIndex]; self->ext.bloodSplatter.prim = prim; } else { - DestroyEntity(self); - return; - } - self->step++; - break; - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = FindFirstUnkPrim2(self->ext.bloodSplatter.prim, 2); - if (prim != NULL) { +REDACTED self->ext.bloodSplatter.prim2 = prim; UnkPolyFunc2(prim); - prim->tpage = 0x1A; - prim->clut = 0x1B7; - prim->u0 = 0x50; - prim->u1 = 0x50; - prim->u2 = 0x40; - prim->u3 = 0x40; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->v0 = 0x30; - prim->v1 = 0x40; +REDACTED prim->v2 = 0x30; - prim->v3 = 0x40; - prim->next->b3 = 0x60; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED LOH(prim->next->r2) = 0x10; LOH(prim->next->b2) = 0x10; LOW(prim->next->r1) = -0x6000; - +REDACTED if (self->facingLeft) { LOW(prim->next->u0) = 0xA000; - prim->next->tpage = 0x200; +REDACTED prim->next->x1 += 4; - } else { +REDACTED LOW(prim->next->u0) = 0xFFFF6000; LOH(prim->next->tpage) = -0x200; prim->next->x1 -= 4; - } - prim->priority = self->zPriority + 2; +REDACTED +REDACTED prim->drawMode = 6; - } - +REDACTED +REDACTED prim = FindFirstUnkPrim2(self->ext.bloodSplatter.prim, 2); - if (prim != NULL) { +REDACTED self->ext.bloodSplatter.prim3 = prim; UnkPolyFunc2(prim); - prim->tpage = 0x1A; - prim->clut = 0x1B7; - prim->u0 = 0x20; - prim->u1 = 0x20; - prim->u2 = 0; - prim->u3 = 0; - prim->v0 = 0x20; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->v1 = 0x40; - prim->v2 = 0x20; +REDACTED prim->v3 = 0x40; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; +REDACTED +REDACTED LOH(prim->next->r2) = 8; LOH(prim->next->b2) = 0x10; - prim->next->b3 = 0x80; +REDACTED LOW(prim->next->r1) = -0x8000; if (self->facingLeft) { LOW(prim->next->u0) = 0xC000; LOH(prim->next->tpage) = 0x200; - } else { +REDACTED LOW(prim->next->u0) = 0xFFFF4000; LOH(prim->next->tpage) = -0x200; - } - prim->priority = self->zPriority + 2; +REDACTED +REDACTED prim->drawMode = 6; - } - self->step++; - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = self->ext.bloodSplatter.prim2; UnkPrimHelper(prim); - +REDACTED if (g_Timer % 2) { LOH(prim->next->r2)++; LOH(prim->next->b2)++; - prim->clut = 0x1B7; - } else { - prim->clut = 0x16D; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED LOW(prim->next->r1) += 0xC00; - +REDACTED if (self->facingLeft) { - prim->next->tpage += 0x18; - } else { +REDACTED +REDACTED prim->next->tpage -= 0x18; - } - +REDACTED +REDACTED prim->next->b3 -= 2; if (UpdateAnimation(&D_8018268C, prim) == 0) { UnkPolyFunc0(prim); - } - +REDACTED +REDACTED prim = self->ext.bloodSplatter.prim3; UnkPrimHelper(prim); LOH(prim->next->r2) += 2; LOH(prim->next->b2) += 2; if (prim->p1 > 3) { LOH(prim->next->b2) = 16; - } - +REDACTED +REDACTED prim->next->b3 -= 3; if (prim->next->b3 > 240) { prim->next->b3 = 0; - } - +REDACTED +REDACTED if (UpdateAnimation(&D_801826A4, prim) == 0) { UnkPolyFunc0(prim); - } - +REDACTED +REDACTED if (self->ext.bloodSplatter.unk80++ > 128) { - DestroyEntity(self); - } - break; - } -} - -void func_801CA498(Primitive* prim) { - switch (prim->next->u2) { - case 0: - prim->tpage = 0x12; - prim->clut = 0x16D; - prim->u0 = 80; - prim->u1 = 96; - prim->v1 = 239; - prim->v0 = 239; - prim->v3 = 255; - prim->v2 = 255; - prim->u2 = prim->u0; - prim->u3 = prim->u1; - *(s16*)&prim->next->r2 = 16; - *(s16*)&prim->next->b2 = 16; - prim->next->x1 = g_CurrentEntity->posX.i.hi; - prim->next->y0 = g_CurrentEntity->posY.i.hi; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != 0) { - prim->next->x1 -= 8; - } else { - prim->next->x1 += 8; - } - if (prim->next->r3 == 0) { - *(s32*)&prim->next->u0 = -0x4000; - } else { - *(s32*)&prim->next->u0 = 0x4000; - } - *(s32*)&prim->next->r1 = -0x20000; - prim->next->b3 = 0x80; - prim->priority = g_CurrentEntity->zPriority + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim->next->u2 = 1; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - *(s32*)&prim->next->r1 += 0x2000; - if (*(s32*)&prim->next->r1 > 0x20000) { +REDACTED +REDACTED UnkPolyFunc0(prim); - } - break; - } -} - -void EntityBloodyZombie(Entity* self) { - Primitive* prim; - Entity* newEntity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; s16 facing; - s32 animStatus; - +REDACTED +REDACTED if (self->unk44 && self->step & 1) { PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_INJURED_SCREAM); PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_INJURED); - SetStep(BLOODY_ZOMBIE_TAKE_HIT); - } - +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD && self->step < 8) { PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_DEATH_SCREAM); self->hitboxState = 0; self->flags &= ~FLAG_UNK_20000000; - SetStep(BLOODY_ZOMBIE_DYING); - } - - switch (self->step) { - case BLOODY_ZOMBIE_INIT: - InitializeEntity(D_80180B38); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = 1; self->hitboxOffY = 4; - SetStep(BLOODY_ZOMBIE_UNK_2); - break; - - case BLOODY_ZOMBIE_UNK_2: +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_801825D4) & 1) { - SetStep(BLOODY_ZOMBIE_WALK); - } - break; - - case BLOODY_ZOMBIE_WALK: - if (self->step_s == 0) { - self->ext.generic.unk80.modeS16.unk0 = 128; - self->step_s++; - } - - AnimateEntity(D_801825EC, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkCollisionFunc2(D_801825E4); - +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - self->ext.generic.unk80.modeS16.unk0 = 128; +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft ^= 1; - } - - if (!(Random() % 64)) { // Drop BloodDrips from the enemy knife - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x49, self, newEntity); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - newEntity->posX.i.hi += 16; - } else { - newEntity->posX.i.hi -= 16; - } - newEntity->posY.i.hi += 12; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED facing = GetSideToPlayer() & 1; if (PLAYER.facingLeft == facing && GetDistanceToPlayerX() < 128) { self->facingLeft = facing ^ 1; - SetStep(BLOODY_ZOMBIE_CHASE); - } - break; - - case BLOODY_ZOMBIE_CHASE: - if (AnimateEntity(D_8018267C, self) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } +REDACTED UnkCollisionFunc2(D_801825E4); - +REDACTED if (self->facingLeft != 0) { self->velocityX = FIX(0.75); - } else { +REDACTED self->velocityX = FIX(-0.75); - } - - if (!(Random() % 64)) { // Drop BloodDrips from the enemy knife - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x49, self, newEntity); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - newEntity->posX.i.hi += 18; - } else { - newEntity->posX.i.hi -= 18; - } - newEntity->posY.i.hi += 12; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() < 40) { - SetStep(BLOODY_ZOMBIE_ATTACK); - } - break; - - case BLOODY_ZOMBIE_ATTACK: - animStatus = AnimateEntity(D_801825FC, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (animStatus & 0x80 && self->animFrameIdx == 10) { PlaySfxPositional(SFX_WEAPON_SWISH_B); - } - if (animStatus == 0) { - SetStep(BLOODY_ZOMBIE_WALK); - } - break; - - case BLOODY_ZOMBIE_TAKE_HIT: - if (self->step_s == 0) { - // Splat blood - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x4A, self, newEntity); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = GetSideToPlayer() & 1; - } - self->step_s++; - } - - if (AnimateEntity(D_80182620, self) == 0) { - SetStep(BLOODY_ZOMBIE_WALK); - self->step_s++; - } - break; - - case BLOODY_ZOMBIE_DYING: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 0x14); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; prim = &g_PrimBuf[primIndex]; - *(s32*)&self->ext.generic.unk7C = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - self->step_s++; - } - - if (self->animFrameIdx < 13) { +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer % 8)) { PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_HEMORRHAGE); newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x4A, self, newEntity); +REDACTED +REDACTED newEntity->facingLeft = self->ext.generic.unk84.U8.unk0; if (self->facingLeft != 0) { - newEntity->posX.i.hi -= 4; - } else { - newEntity->posX.i.hi += 4; - } - newEntity->posY.i.hi += 4; - } - self->ext.generic.unk84.U8.unk0 ^= 1; - } - self->ext.generic.unk80.modeS16.unk0 = 0; - } else { - if (self->ext.generic.unk80.modeS16.unk0 == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_HEMORRHAGE); - } - - self->ext.generic.unk80.modeS16.unk0++; +REDACTED +REDACTED +REDACTED if (!(g_Timer & 3)) { prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2); if (prim != NULL) { UnkPolyFunc2(prim); prim->next->r3 = self->ext.generic.unk84.U8.unk0; - } - self->ext.generic.unk84.U8.unk0 ^= 1; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { - prim = *(s32*)&self->ext.generic.unk7C; - while (prim != NULL) { - if (prim->p3 & 8) { - func_801CA498(prim); - } - prim = prim->next; - } - } - - if (AnimateEntity(D_80182634, self) == 0) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - newEntity->posY.i.hi += 16; +REDACTED +REDACTED if (self->facingLeft != 0) { - newEntity->posX.i.hi -= 8; - } else { - newEntity->posX.i.hi += 8; - } - } - self->ext.generic.unk80.modeS16.unk0 = 64; - self->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_EXPLOSIVE_DEATH); - self->step++; - } - break; - - case BLOODY_ZOMBIE_DESTROY: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { - prim = *(s32*)&self->ext.generic.unk7C; - while (prim != NULL) { - if (prim->p3 & 8) { - func_801CA498(prim); - } - prim = prim->next; - } - } - - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - DestroyEntity(self); - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animCurFrame > 10 && self->animCurFrame < 13) { - self->hitboxWidth = 18; - self->hitboxHeight = 12; +REDACTED +REDACTED *(s16*)&self->hitboxOffX = -12; self->hitboxOffY = -12; - } else { - self->hitboxWidth = 4; - self->hitboxHeight = 22; +REDACTED +REDACTED +REDACTED self->hitboxOffX = 1; self->hitboxOffY = 4; - } -} - -void func_801CAE0C(Entity* self) { // BloodDrips - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED 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; +REDACTED 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 = 255; - prim->r1 = 32; - prim->g0 = 0; - prim->g1 = 0; - prim->b0 = 48; - prim->b1 = 16; - prim->priority = self->zPriority + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= 0x37; - prim = prim->next; - } - } else { - DestroyEntity(self); - } - break; - - case 1: - prim = *(s32*)&self->ext.generic.unk7C; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (CheckColliderOffsets(&D_801826C4, 0)) { - prim->y1 += 2; - if (self->step_s == 0) { - self->step_s = 1; - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.09375); 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) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.FreePrimitives(self->primIndex); - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/4B018.c b/src/st/np3/4B018.c index c2e371a116..4d6d0e1cf2 100644 --- a/src/st/np3/4B018.c +++ b/src/st/np3/4B018.c @@ -1,6 +1,6 @@ -#include "np3.h" +REDACTED #include "sfx.h" - +REDACTED // Owl's Owl Knight shows up one slot above it, so define this for // ease of readability. #define KNIGHT (self + 1) @@ -20,8 +20,8 @@ void EntityOwl(Entity* self) { if (!(self->flags & FLAG_DEAD)) { SetStep(8); self->ext.owl.unk80 ^= 0x20; - } - } +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { if (self->step < 9) { self->hitboxState = 0; @@ -31,8 +31,8 @@ void EntityOwl(Entity* self) { PlaySfxPositional(0x796); SetStep(9); KNIGHT->ext.owl.unk80 |= 8; - } - } +REDACTED +REDACTED switch (self->step) { case 0: InitializeEntity(&D_80180B2C); @@ -48,7 +48,7 @@ void EntityOwl(Entity* self) { self->posX.i.hi -= 10; } else { self->posX.i.hi += 10; - } +REDACTED if (otherEnt->animCurFrame == 0x10) { self->posY.i.hi = otherEnt->posY.i.hi - 0x21; } else { @@ -111,7 +111,7 @@ void EntityOwl(Entity* self) { SetEntityVelocityFromAngle(self->ext.owl.unk84, 0x20); if (self->velocityX > 0) { self->facingLeft = 1; - } else { +REDACTED self->facingLeft = 0; } xVar = abs(xVar); @@ -222,27 +222,27 @@ void EntityOwl(Entity* self) { MoveEntity(); self->velocityY -= FIX(28.0 / 128); if (self->velocityY < FIX(-2)) { - self->animFrameIdx = 0; - self->animFrameDuration = 0; - self->step_s++; - } - break; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case 4: AnimateEntity(D_80182734, self); MoveEntity(); if (self->posY.i.hi < 0x60) { if (self->ext.owl.unk80 & 8) { SetStep(6); - } else { +REDACTED KNIGHT->ext.owl.unk80 |= 2; SetStep(4); } if (self->ext.owl.unk80 & 0x40) { SetStep(7); - } - } +REDACTED +REDACTED break; - } +REDACTED break; case 6: switch (self->step_s) { @@ -301,7 +301,7 @@ void EntityOwl(Entity* self) { self->facingLeft = KNIGHT->facingLeft; } break; - } +REDACTED break; case 8: switch (self->step_s) { @@ -353,7 +353,7 @@ void EntityOwl(Entity* self) { SetStep(7); break; } - } +REDACTED break; case 9: switch (self->step_s) { @@ -377,7 +377,7 @@ void EntityOwl(Entity* self) { self->step++; } break; - } +REDACTED break; case 10: if (!(--self->ext.owl.unk82) || (KNIGHT->entityId == 0)) { @@ -391,19 +391,19 @@ void EntityOwl(Entity* self) { self->step = 24; KNIGHT->ext.owl.unk80 |= 0x10; DestroyEntity(self); - } +REDACTED break; case 16: FntPrint("charal %x\n", self->animCurFrame); if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params != 0) { - break; - } +REDACTED +REDACTED +REDACTED self->animCurFrame = self->animCurFrame + 1; self->params |= 1; - } else { +REDACTED self->params = 0; - } +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { if (self->step_s == 0) { self->animCurFrame = self->animCurFrame - 1; @@ -411,10 +411,10 @@ void EntityOwl(Entity* self) { } } else { self->step_s = 0; - } +REDACTED break; - } -} +REDACTED +REDACTED static u8 func_801CBF18(void) { Primitive* prim; @@ -655,7 +655,7 @@ void EntityOwlKnight(Entity* self) { } break; case 8: - if (self->step_s == 0) { +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->velocityX = 0; self->step_s++; @@ -734,9 +734,9 @@ void EntityOwlKnight(Entity* self) { UnkCollisionFunc2(D_80182768); if (self->facingLeft ^ self->ext.owl.unk8C) { self->velocityX = FIX(0.5); - } else { +REDACTED self->velocityX = FIX(-0.5); - } +REDACTED if (self->ext.owl.unk8C != 0) { self->velocityX -= self->velocityX / 16; } @@ -783,9 +783,9 @@ void EntityOwlKnight(Entity* self) { } if (self->facingLeft ^ self->ext.owl.unk8C) { self->velocityX = FIX(0.5); - } else { +REDACTED self->velocityX = FIX(-0.5); - } +REDACTED if (self->ext.owl.unk8C != 0) { self->velocityX -= self->velocityX / 16; } @@ -939,9 +939,9 @@ void EntityOwlKnight(Entity* self) { } if (self->facingLeft == 0) { self->velocityX = FIX(-0.5); - } else { +REDACTED self->velocityX = FIX(0.5); - } +REDACTED UnkCollisionFunc2(D_80182768); xVar = GetDistanceToPlayerX(); if (xVar < 0x50) { @@ -997,14 +997,14 @@ void EntityOwlKnight(Entity* self) { case 32: FntPrint("charal %x\n", self->animCurFrame); if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params != 0) { - break; - } +REDACTED +REDACTED +REDACTED self->animCurFrame = self->animCurFrame + 1; self->params |= 1; - } else { +REDACTED self->params = 0; - } +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { if (self->step_s == 0) { self->animCurFrame = self->animCurFrame - 1; @@ -1012,9 +1012,9 @@ void EntityOwlKnight(Entity* self) { } } else { self->step_s = 0; - } +REDACTED break; - } +REDACTED hitboxPtr = D_801828B8; index = D_801828C8[self->animCurFrame + 1] - 7; if (index < 0) { diff --git a/src/st/np3/4D540.c b/src/st/np3/4D540.c index 6c5afbcf30..3bf34563c6 100644 --- a/src/st/np3/4D540.c +++ b/src/st/np3/4D540.c @@ -1,40 +1,40 @@ #include "np3.h" -void func_801CD540(Entity* self) { - s8* hitbox; - s32 diff; - - if (self->step == 0) { - InitializeEntity(D_80180B20); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = self[-1].facingLeft; - self->posX.i.hi = self[-1].posX.i.hi; - self->posY.i.hi = self[-1].posY.i.hi; - hitbox = D_80182914; - diff = D_80182935[self[-1].animCurFrame]; - - diff -= 4; - if (diff < 0) { - diff = 0; - } - - hitbox += diff * 4; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; +REDACTED +REDACTED if (self[-1].entityId != 0x44) { - DestroyEntity(self); - } -} - -void func_801CD620(Entity* self) { - if (self->step == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - } -} - +REDACTED +REDACTED +REDACTED static s32 D_801D3378; static s32 D_801D337C; static s32 D_801D3380; @@ -42,95 +42,95 @@ static s32 D_801D3384; static s32 D_801D3388; STATIC_PAD_BSS(104); -void func_801CD658(void) { - g_CurrentBuffer = g_CurrentBuffer->next; - FntPrint("a:%x\n", D_801D3378); - FntPrint("b:%x\n", D_801D337C); - FntPrint("c:%x\n", D_801D3380); - FntPrint("d:%x\n", D_801D3384); - FntPrint("e:%x\n", D_801D3388); - DrawSync(0); - VSync(0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PutDrawEnv(&g_CurrentBuffer->draw); PutDispEnv(&g_CurrentBuffer->disp); - FntFlush(-1); -} +REDACTED +REDACTED void func_801CD734() { while (PadRead(0)) func_801CD658(); - while (!PadRead(0)) +REDACTED func_801CD658(); } void func_801CD78C(Point32* src, s32 speed, s16 angle, Point32* dst) { if (g_CurrentEntity->facingLeft) { - angle = -angle; - } +REDACTED +REDACTED *dst = *src; - +REDACTED dst->x -= speed * rsin(angle) * 16; dst->y += speed * rcos(angle) * 16; -} - -void func_801CD83C(Entity* self) { +REDACTED +REDACTED +REDACTED s16 angle = self->ext.GH_Props.rotZ; - Entity* src; - +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != 0) { - angle = -angle; - } - +REDACTED +REDACTED +REDACTED src = self->ext.GH_Props.parent; - self->posX.val = src->posX.val; - self->posY.val = src->posY.val; - self->posX.val -= self->ext.GH_Props.unk9E * rsin(angle) * 16; - self->posY.val += self->ext.GH_Props.unk9E * rcos(angle) * 16; - if (self->ext.GH_Props.unkA8 != 0) { - FntPrint("CAUTION!! WARNING_A AT %x\n", self->animCurFrame); - } - self->ext.GH_Props.unkA8 |= 1; -} - -void func_801CD91C(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 angle = self->ext.GH_Props.rotZ; - Entity* src; - +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != 0) { - angle = -angle; - } +REDACTED +REDACTED src = self->ext.GH_Props.parent; - src->posX.val = self->posX.val; - src->posY.val = self->posY.val; - src->posX.val -= -self->ext.GH_Props.unk9E * rsin(angle) * 16; - src->posY.val = - -self->ext.GH_Props.unk9E * rcos(angle) * 16 + src->posY.val; - if (self->ext.GH_Props.unkA8 != 0) { - FntPrint("CAUTION!! WARNING_B AT %x\n", self->animCurFrame); - } - self->ext.GH_Props.unkA8 |= 1; -} - -void func_801CDA14(Entity* ent1, Entity* ent2) { - Entity* temp_a0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a0 = ent1->ext.GH_Props.parent; - func_801CD78C( +REDACTED temp_a0, temp_a0->ext.GH_Props.unk9E, temp_a0->ext.GH_Props.rotZ, ent1); func_801CD78C( ent1, ent2->ext.GH_Props.unk9E, ent2->ext.GH_Props.rotZ, ent2); -} - -void func_801CDA6C(Entity* self, s32 arg1) { - Entity* temp_s0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_s0 = self->ext.GH_Props.parent; - func_801CD78C( +REDACTED self, -self->ext.GH_Props.unk9E, self->ext.GH_Props.rotZ, temp_s0); - func_801CD78C(temp_s0, -temp_s0->ext.GH_Props.unk9E, +REDACTED temp_s0->ext.GH_Props.rotZ, arg1); -} - +REDACTED +REDACTED void func_801CDAC8(Entity* ent1, Entity* ent2) { Point32 sp10; s32 ratanX; @@ -169,80 +169,80 @@ void func_801CDAC8(Entity* ent1, Entity* ent2) { ratanY = ent2->posY.val - sp10.y; ent2->ext.GH_Props.unkA4 = ratan2(-ratanX, ratanY); } - -bool func_801CDC80(s16* arg0, s16 arg1, s16 arg2) { +REDACTED +REDACTED if (abs(*arg0 - arg1) < arg2) { - *arg0 = arg1; - return true; - } - - if (arg1 < *arg0) { - *arg0 = *arg0 - arg2; - } - - if (*arg0 < arg1) { - *arg0 = arg2 + *arg0; - } - - return false; -} - -void func_801CDD00(Entity* entity, s16 arg1, s16 arg2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 temp_t0 = arg1 - entity->ext.GH_Props.rotZ; - - if (temp_t0 > 0x800) { - temp_t0 -= 0x1000; - } - - if (temp_t0 < -0x800) { - temp_t0 += 0x1000; - } - - do { - entity->ext.GH_Props.unkA4 = arg1; - entity->ext.GH_Props.unkA6 = temp_t0 / arg2; - } while (0); -} - -void func_801CDD80(s16* arg0, Entity* arg1) { - s16* posY = arg1->posY.val; - - while (*arg0 != 0) { - if (*arg0 != 0xFF) { - func_801CDD00(&g_CurrentEntity[*arg0], *posY, arg1->posX.val); - } - arg0++; - posY++; - } -} - -void func_801CDE10(s16* arg0) { - Entity* temp_a0; - - while (*arg0 != 0) { - if (*arg0 != 0xFF) { - temp_a0 = &g_CurrentEntity[*arg0]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a0->ext.GH_Props.rotZ = temp_a0->ext.GH_Props.rotZ + temp_a0->ext.GH_Props.unkA6; - } - arg0++; - } -} - -void func_801CDE88(s16* arg0) { - Entity* temp_a0; - - while (*arg0 != 0) { - if (*arg0 != 0xFF) { - temp_a0 = &g_CurrentEntity[*arg0]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp_a0->ext.GH_Props.rotZ = temp_a0->ext.GH_Props.rotZ + temp_a0->ext.GH_Props.unkA6; - func_801CD83C(temp_a0); - } - arg0++; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801CDF1C(s16 entIndices[], s16 arg1[][4], s32 arg2) { arg1 += (u16)g_CurrentEntity->ext.GH_Props.unkB0[arg2]; @@ -260,197 +260,197 @@ void func_801CDF1C(s16 entIndices[], s16 arg1[][4], s32 arg2) { } } } - -void func_801CDFD8(Entity* self, s32 arg1) { - if (self->ext.et_801CDFD8.unkB4 == 0) { - func_801CDD00(self, self->ext.et_801CDFD8.unkA4, arg1); - self->ext.et_801CDFD8.unkB4 = arg1; - } - self->ext.et_801CDFD8.unkB4--; - self->ext.et_801CDFD8.unk9C += self->ext.et_801CDFD8.unkA6; - func_801CD83C(self); -} - -void func_801CE04C(Entity* entity, Collider* collider) { - s16 var_s0 = 0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.CheckCollision( entity->posX.i.hi, (s16)(entity->posY.i.hi + collider->unk18), collider, 0); if (collider->effects & 1) { - var_s0 = 1; +REDACTED if (collider->effects & 0x8000) { if (collider->effects & 0x4000) { if (g_CurrentEntity->facingLeft != 0) { - var_s0 = 4; - } else { - var_s0 = 2; - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != 0) { - var_s0 = 2; - } else { - var_s0 = 4; - } - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->ext.GH_Props.unk88 = var_s0; -} - -s32 func_801CE120(Entity* self, s32 facing) { - Collider collider; - s32 x = self->posX.i.hi; - s32 y = self->posY.i.hi + 9; - s32 ret = 0; - - if (facing != 0) { - x += 64; - } else { - x -= 64; - } - - g_api.CheckCollision(x, y - 6, &collider, 0); - if (collider.effects & 1) { - ret |= 2; - } - - g_api.CheckCollision(x, y + 6, &collider, 0); - if (!(collider.effects & 1)) { - ret |= 4; - } - - return ret; -} - -void func_801CE1E8(s16 step) { - s32 i; - - g_CurrentEntity->step = step; - g_CurrentEntity->step_s = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CurrentEntity->animFrameIdx = 0; g_CurrentEntity->animFrameDuration = 0; - - for (i = 0; i < 4; i++) { - g_CurrentEntity->ext.GH_Props.unkB0[i] = 0; - g_CurrentEntity->ext.GH_Props.unkB0[i + 2] = 0; - } -} - -void func_801CE228(s16 step) { - s32 i; - - for (i = 0; i < 4; i++) { - g_CurrentEntity->ext.GH_Props.unkB0[i] = 0; - g_CurrentEntity->ext.GH_Props.unkB0[i + 2] = 0; - } -} - -void func_801CE258(s16* arg0) { - Entity* entity; - - while (*arg0 != 0) { - entity = &g_CurrentEntity[*arg0]; - if (entity->ext.GH_Props.unkA8 == 0) { - func_801CD83C(entity); - } - arg0++; - } -} - -void func_801CE2CC(s16* arg0) { - s16* var_s0; - - func_801CD91C(&g_CurrentEntity[arg0[1]]); - func_801CD91C(&g_CurrentEntity[arg0[0]]); - func_801CD83C(&g_CurrentEntity[arg0[2]]); - func_801CD83C(&g_CurrentEntity[arg0[3]]); - - for (arg0 += 4; *arg0 != 0; arg0++) { - if (*arg0 != 0xFF) { - func_801CD83C(&g_CurrentEntity[*arg0]); - } - } -} - -void func_801CE3FC(s16* arg0) { - s16* var_s0; - s16 var_v0; - s32 i; - - for (i = 0, var_s0 = arg0; i < 4; i++) { - func_801CD83C(&g_CurrentEntity[*var_s0]); - var_s0++; - } - - for (arg0 += 4; *arg0 != 0; arg0++) { - if (*arg0 != 0xFF) { - func_801CD83C(&g_CurrentEntity[*arg0]); - } - } -} - -s32 func_801CE4CC(Entity* self) { - Entity* entity; - s32 step; - s32 x; - - if (g_CurrentEntity->ext.et_801CE4CC.unk8E != 0) { - g_CurrentEntity->ext.et_801CE4CC.unk8E--; - } - - x = self->posX.i.hi - PLAYER.posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != 0) { - x = -x; - } - - if (x < -16) { - func_801CE1E8(10); - return; - } - - if (g_CurrentEntity->ext.et_801CE4CC.unk84 == 1) { - entity = g_CurrentEntity + 10; - } else { - entity = g_CurrentEntity + 13; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (func_801CE120(entity, g_CurrentEntity->facingLeft) != 0) { - func_801CE1E8(7); - return; - } +REDACTED +REDACTED +REDACTED if (func_801CE120(entity, g_CurrentEntity->facingLeft ^ 1) != 0) { - func_801CE1E8(5); - return; - } - - if (g_CurrentEntity->step == 8) { - if (x < 80) { - step = 5; - } else { - step = 8; - } - } else { - if (x < 80) { - step = 7; - } else { - step = 5; - } - if (x > 160) { - step = 8; - } - } - - if ((g_CurrentEntity->ext.et_801CE4CC.unk8E == 0) && (x < 96)) { - g_CurrentEntity->ext.et_801CE4CC.unk8E = 3; - step = 6; - } - if (step != g_CurrentEntity->step) { - func_801CE1E8(step); - } - if (g_CurrentEntity->step == 7) { - if (step == 5) { - g_CurrentEntity->ext.et_801CE4CC.unkB0 = 1; - } - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/4E69C.c b/src/st/np3/4E69C.c index 6a8200708f..d2d1eab67a 100644 --- a/src/st/np3/4E69C.c +++ b/src/st/np3/4E69C.c @@ -1,8 +1,8 @@ -#include "np3.h" +REDACTED #include "sfx.h" - +REDACTED void EntityHammer(Entity* self) { - Collider collider; +REDACTED Entity* otherEnt; // These are two different ents using var_s3. I dunno. Entity* var_s3_1; @@ -18,19 +18,19 @@ void EntityHammer(Entity* self) { PlaySfxPositional(0x745); func_801CE1E8(0x18); } - switch (self->step) { - case 0: +REDACTED +REDACTED InitializeEntity(D_80180B8C); self->animCurFrame = 3; - self->hitboxWidth = 6; - self->hitboxHeight = 6; +REDACTED +REDACTED /* fallthrough */ - case 1: +REDACTED if (UnkCollisionFunc3(D_80182978) & 1) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->step++; } - break; +REDACTED case 2: var_s3_1 = self; for (var_s4 = &D_80182988; *var_s4 != 0; var_s4 += 5) { @@ -117,8 +117,8 @@ void EntityHammer(Entity* self) { } else { var_s2 = D_80182AD0; } - switch (self->step_s) { - case 0: +REDACTED +REDACTED if (self->ext.GH_Props.unk84 == 1) { var_s2 = D_80182A40; } else { @@ -131,8 +131,8 @@ void EntityHammer(Entity* self) { self->ext.GH_Props.unkB0[2] == 0) { self->step_s++; } - break; - case 1: +REDACTED +REDACTED func_801CDF1C(var_s2, &D_80182C9C, 0); func_801CDE10(var_s2); func_801CE2CC(var_s2); @@ -152,7 +152,7 @@ void EntityHammer(Entity* self) { self->step_s++; /* fallthrough */ case 3: - MoveEntity(); +REDACTED self->velocityY += FIX(48.0 / 128); func_801CDF1C(var_s2, &D_80182CC4, 0); func_801CDE10(var_s2); @@ -167,16 +167,16 @@ void EntityHammer(Entity* self) { func_801CE228(); self->step_s = 1; func_801CE4CC(otherEnt); - } - break; - } +REDACTED +REDACTED +REDACTED func_801CE258(&D_80182A20); - break; +REDACTED case 6: - switch (self->step_s) { - case 0: - self->step_s++; - case 1: +REDACTED +REDACTED +REDACTED +REDACTED var_s3_2 = self + 8; if (self->ext.GH_Props.unk84 == 1) { var_s2 = D_80182AE8; @@ -248,9 +248,9 @@ void EntityHammer(Entity* self) { break; case 4: func_801CE4CC(self); - break; - } - break; +REDACTED +REDACTED +REDACTED case 10: if (self->ext.GH_Props.unk84 == 1) { var_s2 = D_80182AB8; @@ -264,18 +264,18 @@ void EntityHammer(Entity* self) { if (self->ext.GH_Props.unkB0[2] == 0) { self->facingLeft ^= 1; func_801CE4CC(self); - } - break; +REDACTED +REDACTED case 12: if (self->step_s == 0) { PlaySfxPositional(0x744); self->step_s++; - } +REDACTED if (self->ext.GH_Props.unk84 == 1) { var_s2 = D_80182A40; - } else { +REDACTED var_s2 = D_80182A5C; - } +REDACTED func_801CDF1C(var_s2, &D_80182EDC, 0); func_801CDE10(var_s2); func_801CE2CC(var_s2); @@ -283,11 +283,11 @@ void EntityHammer(Entity* self) { if (self->ext.GH_Props.unkB0[0] == 0 && self->ext.GH_Props.unkB0[2] == 0) { func_801CE4CC(self); - } - break; - case 24: - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED for (var_s2 = &D_80182A20; *var_s2 != 0; var_s2++) { otherEnt = self + *var_s2; otherEnt->hitboxState = 0; @@ -297,10 +297,10 @@ void EntityHammer(Entity* self) { self->velocityY = FIX(-2); self->hitboxState = 0; self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - self->step_s++; +REDACTED /* fallthrough */ - case 1: - MoveEntity(); +REDACTED +REDACTED self->velocityY += FIX(0.1875); if (!(g_Timer & 7)) { if (Random() & 1) { @@ -308,59 +308,59 @@ void EntityHammer(Entity* self) { } else { PlaySfxPositional(SFX_EXPLODE_D); } - } +REDACTED return; - } - break; - } +REDACTED +REDACTED +REDACTED for (var_s2 = &D_80182A20; *var_s2 != 0; var_s2++) { otherEnt = self + *var_s2; otherEnt->facingLeft = self->facingLeft; otherEnt->ext.GH_Props.unkA8 = 0; - } +REDACTED D_8006C384.y = self->ext.GH_Props.unkB0[0]; D_8006C38C.y = self->ext.GH_Props.unkB0[2]; return; -} - +REDACTED +REDACTED void EntityGurkhaBodyParts(Entity* self) { Entity* parent; Collider collider; s16 angle; s32 speed; u16 unk88; - - switch (self->step) { - case 0: - switch (self->params >> 8) { - case 0: - InitializeEntity(D_80180B8C); - break; - case 1: - InitializeEntity(D_80180BA4); - break; - case 2: - InitializeEntity(D_80180BBC); - break; - } - self->hitboxWidth = 6; - self->hitboxHeight = 6; - self->params = (u8)self->params; - self->animCurFrame = self->params; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= DRAW_COLORS; break; case 1: self->rotZ = self->ext.GH_Props.rotZ; - break; - case 24: - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED speed = (Random() & 0x1F) + 0x10; angle = (Random() * 6) + 0x900; self->velocityX = (speed * rcos(angle)) / 2; self->velocityY = speed * rsin(angle); self->ext.GH_Props.unk80 = (Random() & 0x1F) + 0x20; - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; +REDACTED self->hitboxState = 0; self->step_s++; break; @@ -369,9 +369,9 @@ void EntityGurkhaBodyParts(Entity* self) { self->velocityY += FIX(0.125); self->rotZ += self->ext.GH_Props.unkA6; if (--self->ext.GH_Props.unk80 == 0) { - self->step = 0; - self->pfnUpdate = EntityExplosion; - self->params = 0; +REDACTED +REDACTED +REDACTED self->drawFlags = 0; } return; @@ -380,12 +380,12 @@ void EntityGurkhaBodyParts(Entity* self) { } // Careful following control flow here, this is completely after // the previous switch. - switch (self->params) { - case 8: - case 14: - collider.unk18 = 9; - func_801CE04C(self, &collider); - break; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case 9: case 15: parent = self->ext.GH_Props.parent; @@ -401,8 +401,8 @@ void EntityGurkhaBodyParts(Entity* self) { angle = self->rotZ; self->hitboxOffX = (-(rsin(angle) * 8) >> 0xC); self->hitboxOffY = (u32)rcos(angle) / 512; - self->attack = g_api.enemyDefs[192].attack; - self->attackElement = g_api.enemyDefs[192].attackElement; +REDACTED +REDACTED } else { self->hitboxOffX = 0; self->hitboxOffY = 0; diff --git a/src/st/np3/4F5B8.c b/src/st/np3/4F5B8.c index c6841f42b6..9d75b02bee 100644 --- a/src/st/np3/4F5B8.c +++ b/src/st/np3/4F5B8.c @@ -1,53 +1,53 @@ #include "np3.h" #include "sfx.h" -void EntityHammerWeapon(Entity* self) { - s16 temp_s0; +REDACTED +REDACTED s32 velY; - s32 temp_s1; - s16 angle; - - switch (self->step) { - case 0: - InitializeEntity(D_80180B98); - self->hitboxWidth = 10; - self->hitboxHeight = 10; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; - - case 1: - angle = *(u16*)&self->ext.stub[0x20]; +REDACTED +REDACTED +REDACTED self->rotZ = angle; self->hitboxOffX = ((u32)(rsin(angle) * 0xD) >> 0xA); self->hitboxOffY = (-(rcos(angle) * 0x34) >> 0xC); - break; - - case 24: - switch (self->step_s) { - case 0: - temp_s1 = (Random() & 0x1F) + 0x10; - temp_s0 = (Random() * 6) + 0x900; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = (temp_s1 * rcos(temp_s0)) / 2; velY = temp_s1 * rsin(temp_s0); self->hitboxState = 0; self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - self->step_s++; +REDACTED self->velocityY = velY; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); func_801CDC80(&self->rotZ, 0x800, 0x20); - break; - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801CF778(void) { ET_801CF254* et = &g_CurrentEntity[15].ext.et_801CF254; et->unk9C = et->next->ext.et_801CF254.unk9C + 0x300; } - +REDACTED int func_801CF7A0(Entity* ent) { Entity* otherEnt; s32 step; @@ -114,7 +114,7 @@ int func_801CF7A0(Entity* ent) { g_CurrentEntity->ext.factory.unkB0 = 1; } } - +REDACTED void EntityGurkha(Entity* self) { Collider collider; Entity* otherEnt; @@ -143,7 +143,7 @@ void EntityGurkha(Entity* self) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->step++; } - break; +REDACTED case 2: var_s3 = self; for (var_s4 = &D_80182F04; *var_s4 != 0; var_s4 += 5) { @@ -246,8 +246,8 @@ void EntityGurkha(Entity* self) { self->ext.GH_Props.unkB0[2] == 0) { self->step_s++; } - break; - case 1: +REDACTED +REDACTED func_801CDF1C(var_s2, &D_801831F8, 0); func_801CDE10(var_s2); func_801CE2CC(var_s2); @@ -268,7 +268,7 @@ void EntityGurkha(Entity* self) { self->step_s++; /* fallthrough */ case 3: - MoveEntity(); +REDACTED self->velocityY += FIX(11.0 / 128); func_801CDF1C(var_s2, &D_80183218, 0); func_801CDE10(var_s2); @@ -486,7 +486,7 @@ void EntityGurkha(Entity* self) { self->velocityY = FIX(-2); self->hitboxState = 0; self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - self->step_s++; +REDACTED /* fallthrough */ case 1: MoveEntity(); @@ -506,91 +506,91 @@ void EntityGurkha(Entity* self) { otherEnt = self + *var_s2; otherEnt->facingLeft = self->facingLeft; otherEnt->ext.GH_Props.unkA8 = 0; - } +REDACTED D_8006C384.y = self->ext.GH_Props.unkB0[0]; D_8006C38C.y = self->ext.GH_Props.unkB0[2]; return; -} - -void EntityGurkhaSword(Entity* self) { - s16 angle; - s32 rnd; - - switch (self->step) { - case 0: - InitializeEntity(D_80180BB0); - self->hitboxWidth = 8; - self->hitboxHeight = 8; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; - break; - - case 1: - angle = self->ext.gurkhaSword.unk9C; +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ = angle; self->hitboxOffX = (u32)rsin(angle) >> 8; self->hitboxOffY = -(rcos(angle) * 16) >> 0xC; - if (self->ext.gurkhaSword.unk8C) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-8); - } else { +REDACTED self->velocityX = FIX(8); - } - self->step++; - - case 3: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ -= 0x100; self->ext.gurkhaSword.unk9C = self->rotZ; - self->ext.gurkhaSword.unkA6 = -0xC0; +REDACTED angle = self->rotZ; self->hitboxOffX = (u32)rsin(self->rotZ) >> 8; - self->hitboxOffY = -(rcos(angle) * 16) >> 0xC; - +REDACTED +REDACTED if (self->facingLeft != 0) { self->velocityX -= FIX(0.25); - } else { +REDACTED self->velocityX += FIX(0.25); - } - +REDACTED +REDACTED if ((g_Timer % 16) == 0) { PlaySfxPositional(SFX_ARROW_SHOT_A); - } - +REDACTED +REDACTED if (abs(self->velocityX) == 0x80000) { - self->ext.gurkhaSword.unk8C = 0; - self->step = 1; - } - break; - - case 24: - switch (self->step_s) { - case 0: - rnd = (Random() & 0x1F) + 0x10; - angle = (Random() * 6) + 0x900; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = (rnd * rcos(angle)) / 2; self->velocityY = rnd * rsin(angle); - self->ext.gurkhaSword.unk80 = (Random() & 0x1F) + 0x20; +REDACTED self->hitboxState = 0; self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - self->step_s++; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); self->rotZ += self->ext.gurkhaSword.unkA6; - if (--self->ext.gurkhaSword.unk80 == 0) { - self->step = 0; - self->pfnUpdate = EntityExplosion; - self->params = 0; +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = 0; - } - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/blade.c b/src/st/np3/blade.c index 7e23fe06f7..a9db53f82a 100644 --- a/src/st/np3/blade.c +++ b/src/st/np3/blade.c @@ -4,19 +4,19 @@ // The enemy called "Blade", his helper functions, and his swords static void func_801D0A00(s16* arg0) { - func_801CD91C(&g_CurrentEntity[arg0[1]]); - func_801CD91C(&g_CurrentEntity[arg0[0]]); - func_801CD91C(&g_CurrentEntity[18]); - func_801CD83C(&g_CurrentEntity[arg0[2]]); - func_801CD83C(&g_CurrentEntity[arg0[3]]); - - for (arg0 += 4; *arg0 != 0; arg0++) { - if (*arg0 != 0xFF) { - func_801CD83C(&g_CurrentEntity[*arg0]); - } - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static void func_801D0B40(void) { s16* unk88 = g_CurrentEntity[15].ext.et_801D0B40.unk88; g_CurrentEntity[15].ext.et_801D0B40.unk84 = unk88[0x4E] - 0x600; @@ -24,83 +24,83 @@ static void func_801D0B40(void) { unk88 = g_CurrentEntity[16].ext.et_801D0B40.unk88; g_CurrentEntity[16].ext.et_801D0B40.unk84 = unk88[0x4E] - 0x600; } - +REDACTED // Function does not use the argument, but all calls in EntityBlade // give one, so we include it here. static s32 func_801D0B78(Entity* unused) { - s32 ret; - - //! FAKE: - do { - } while (0); - - ret = 0; - - switch (g_CurrentEntity->step) { - case 8: - if (GetDistanceToPlayerX() < 64) { - ret = 10; - } - if (GetDistanceToPlayerX() > 80) { - ret = 6; - } - if (g_CurrentEntity->ext.et_801D0B78.unk88 != 0) { - ret = 7; - } - break; - - case 10: - if (GetDistanceToPlayerX() < 88) { - ret = 8; - } - if (GetDistanceToPlayerX() < 56) { - ret = 7; - } - if (GetDistanceToPlayerX() > 80) { - ret = 6; - } - if (g_CurrentEntity->ext.et_801D0B78.unk88 != 0) { - ret = 7; - } - break; - - case 12: - if (GetDistanceToPlayerX() < 64) { - ret = 10; - } - break; - - case 6: - if (g_CurrentEntity->ext.et_801D0B78.unk88 != 0) { - ret = 7; - } - if (GetDistanceToPlayerX() < 48) { - ret = 10; - } - if (GetDistanceToPlayerX() < 80) { - ret = 8; - } - break; - - default: - if (GetDistanceToPlayerX() > 80) { - ret = 6; - } - if (GetDistanceToPlayerX() < 64) { - ret = 10; - } - if (g_CurrentEntity->ext.et_801D0B78.unk88 != 0) { - ret = 7; - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != ((GetSideToPlayer() & 1) ^ 1)) { - ret = 12; - } - return ret; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityBlade(Entity* self) { Collider collider; Entity* otherEnt; @@ -132,7 +132,7 @@ void EntityBlade(Entity* self) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->step++; } - break; +REDACTED case 2: var_s3 = self; for (var_s4 = &D_801833F4; *var_s4 != 0; var_s4 += 5) { @@ -238,8 +238,8 @@ void EntityBlade(Entity* self) { } else { var_s2 = D_80183548; } - switch (self->step_s) { - case 0: +REDACTED +REDACTED if (self->ext.GH_Props.unk84 == 1) { var_s2 = D_801834B8; } else { @@ -276,7 +276,7 @@ void EntityBlade(Entity* self) { self->step_s++; /* fallthrough */ case 3: - MoveEntity(); +REDACTED self->velocityY += FIX(11.0 / 128); func_801CDF1C(var_s2, &D_80183720, 0); func_801CDE10(var_s2); @@ -470,7 +470,7 @@ void EntityBlade(Entity* self) { self->ext.GH_Props.unkB0[2] == 0) { self->step_s++; } - break; +REDACTED case 2: var_s2 = D_80183580; func_801CDF1C(var_s2, &D_80183A4C, 0); @@ -519,118 +519,118 @@ void EntityBlade(Entity* self) { otherEnt = self + *var_s2; otherEnt->facingLeft = self->facingLeft; otherEnt->ext.GH_Props.unkA8 = 0; - } +REDACTED D_8006C384.y = self->ext.GH_Props.unkB0[0]; D_8006C38C.y = self->ext.GH_Props.unkB0[2]; } -void EntityBladeSword(Entity* self) { - Primitive *prim, *prim2; - s32 x0, x1, y0, y1; - s16 primIndex; - s16 angle; - s32 i; - - if (self->ext.et_801D1BB8.unk8C != 0) { - self->step = 8; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180BC8); - self->hitboxWidth = 6; - self->hitboxHeight = 6; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 4; - primIndex = g_api.AllocPrimitives(PRIM_G4, 6); - if (primIndex == -1) { - self->ext.et_801D1BB8.prim = NULL; - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.et_801D1BB8.prim = prim; - self->flags |= FLAG_HAS_PRIMS; - - for (i = 0; prim != NULL; prim = prim->next) { - prim->r0 = i; - prim->g0 = i; - prim->b0 = i; - i += 10; - prim->r2 = i; - prim->g2 = i; - prim->b2 = i; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r2); - prim->x0 = self->posX.i.hi; - prim->y0 = self->posY.i.hi; - LOW(prim->x1) = LOW(prim->x0); - LOW(prim->x2) = LOW(prim->x0); - LOW(prim->x3) = LOW(prim->x0); - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - } - - case 1: +REDACTED +REDACTED +REDACTED self->rotZ = self->ext.et_801D1BB8.unk9C; - break; - - case 24: - self->hitboxState = 0; - self->flags |= FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - break; - - case 8: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { - self->velocityX = FIX(-8.0); - } else { - self->velocityX = FIX(8.0); - } - MoveEntity(); - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED angle = self->rotZ; - self->hitboxOffX = -1 * (rsin(angle) * 13) >> 12; - self->hitboxOffY = +1 * (rcos(angle) * 13) >> 12; - - prim = self->ext.et_801D1BB8.prim; - if (prim != NULL) { - for (i = 0; i < 5; i++) { - prim2 = prim->next; - LOW(prim->x0) = LOW(prim2->x0); - LOW(prim->x1) = LOW(prim2->x1); - LOW(prim->x2) = LOW(prim2->x2); - LOW(prim->x3) = LOW(prim2->x3); - if (self->ext.et_801D1BB8.unk8D) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - } else { +REDACTED prim->drawMode = 0xA; - } - prim = prim2; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED angle = self->rotZ; if (self->facingLeft != 0) { - angle = -angle; - } - - x0 = (-1 * (rsin(angle) * 20) >> 12) + self->posX.i.hi; - y0 = (+1 * (rcos(angle) * 20) >> 12) + self->posY.i.hi; - x1 = (+1 * (rsin(angle) * 4) >> 12) + self->posX.i.hi; - y1 = (-1 * (rcos(angle) * 4) >> 12) + self->posY.i.hi; - - LOW(prim->x2) = LOW(prim->x0); - LOW(prim->x3) = LOW(prim->x1); - - prim->x0 = x0; - prim->y0 = y0; - prim->y1 = y1; - prim->x1 = x1; - - if (self->ext.et_801D1BB8.unk8D) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x33; - } else { +REDACTED prim->drawMode = 0xA; - } -} +REDACTED +REDACTED diff --git a/src/st/np3/e_bone_scimitar.c b/src/st/np3/e_bone_scimitar.c index d8720390ec..9c959e835f 100644 --- a/src/st/np3/e_bone_scimitar.c +++ b/src/st/np3/e_bone_scimitar.c @@ -1,2 +1,2 @@ -#include "np3.h" +REDACTED #include "../e_bone_scimitar.h" diff --git a/src/st/np3/e_room_fg.c b/src/st/np3/e_room_fg.c index d13f2e7fb2..2c05b74958 100644 --- a/src/st/np3/e_room_fg.c +++ b/src/st/np3/e_room_fg.c @@ -15,7 +15,7 @@ void EntityRoomForeground(Entity* entity) { if (objInit->unkC != 0) { entity->flags = objInit->unkC; } - if (entity->params >= 5) { +REDACTED entity->rotZ = 0x800; entity->drawFlags |= 4; } diff --git a/src/st/np3/gaibon.c b/src/st/np3/gaibon.c index aa9a4115df..4a21a9f7ed 100644 --- a/src/st/np3/gaibon.c +++ b/src/st/np3/gaibon.c @@ -3,78 +3,78 @@ #define SLOGRA self[-8] -typedef enum { - GAIBON_INIT, - GAIBON_IDLE = 2, - GAIBON_FLY_TOWARDS_PLAYER, - GAIBON_FLY_SHOOT_FIREBALLS, - GAIBON_LANDING_AFTER_SHOOTING, - GAIBON_SHOOT_FROM_GROUND, - GAIBON_FLY_SHOOT_BIG_FIREBALL = 8, - GAIBON_PICKUP_SLOGRA, - GAIBON_NEAR_DEATH = 15, +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SLOGRA_GAIBON_RETREAT, - GAIBON_DYING, - GAIBON_DEBUG = 255, -} GaibonSteps; - -typedef enum { - GAIBON_FLY_TOWARDS_PLAYER_BEGIN, - GAIBON_FLY_TOWARDS_PLAYER_MOVEMENT, - GAIBON_FLY_TOWARDS_PLAYER_END, -} GaibonFlyTowardsPlayerSubSteps; - -typedef enum { - GAIBON_FLY_SHOOT_FIREBALLS_BEGIN, - GAIBON_FLY_SHOOT_FIREBALLS_MOVING_SHOOTING, - GAIBON_FLY_SHOOT_FIREBALLS_END, -} GaibonFlyShootFirewalls_SubSteps; - -typedef enum { - GAIBON_LANDING_AFTER_SHOOTING_SETUP, - GAIBON_FALLING_WITHOUT_MAP_COLLISION, - GAIBON_FALLING_WITH_MAP_COLLISION, - GAIBON_FALLING_ON_GROUND, -} GaibonLandingAfterShootingSubSteps; - -typedef enum { - GAIBON_SHOOT_FROM_GROUND_FACE_PLAYER, - GAIBON_SHOOT_FROM_GROUND_FACE_SETUP, - GAIBON_SHOOT_FROM_GROUND_FACE_SHOOTING, -} GaibonShootFromGroundSubSteps; - -typedef enum { - GAIBON_FLY_SHOOT_BIG_FIREBALL_SETUP, - GAIBON_FLY_SHOOT_BIG_FIREBALL_SHOOTING, - GAIBON_FLY_SHOOT_BIG_FIREBALL_END, -} GaibonFlyShootBigFirewallSubSteps; - -typedef enum { - GAIBON_PICKUP_SLOGRA_SETUP, - GAIBON_PICKUP_SLOGRA_MOVING, - GAIBON_PICKUP_SLOGRA_ASCENDING, - GAIBON_PICKUP_SLOGRA_AIMING, - GAIBON_PICKUP_SLOGRA_RELEASE, -} GaibonPickupSlograSubSteps; - -typedef enum { - GAIBON_NEAR_DEATH_SETUP, - GAIBON_NEAR_DEATH_FLOOR_HIT_WAIT, - GAIBON_NEAR_DEATH_FLOOR_LANDING, - GAIBON_NEAR_DEATH_TRANSFORM, -} GaibonNearDeathSubSteps; - -typedef enum { - GAIBON_RETREAT_FACE_SLOGRA, - GAIBON_RETREAT_PICKUP_SLOGRA, - GAIBON_RETREAT_FLY_AWAY, -} GaibonRetreatSubSteps; - -typedef enum { - GAIBON_DYING_REACT, - GAIBON_DYING_TURN_INTO_BONES, -} GaibonDyingSubSteps; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED extern u16 D_80180B68[]; static s32 D_801814B4[] = { @@ -147,22 +147,22 @@ void EntityGaibon(Entity* self) { xVar = self->posX.i.hi - 0x80; if (abs(xVar) < 0x60) { self->hitboxState = 0; - SetStep(GAIBON_NEAR_DEATH); - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED if ((!(self->flags & FLAG_DEAD) || (self->step >= GAIBON_NEAR_DEATH)) && - (SLOGRA.ext.GS_Props.pickupFlag) && - (self->step < GAIBON_LANDING_AFTER_SHOOTING)) { - SetStep(GAIBON_PICKUP_SLOGRA); - } +REDACTED +REDACTED +REDACTED +REDACTED if (D_801812CC) { self->hitboxState = 0; - if (self->step != SLOGRA_GAIBON_RETREAT) { - SetStep(SLOGRA_GAIBON_RETREAT); - } - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED switch (self->step) { case 0x0: if ((g_CastleFlags[132] == 0) && (*(&g_CastleFlags[56] + 1) == 0)) { @@ -185,9 +185,9 @@ void EntityGaibon(Entity* self) { SetStep(GAIBON_FLY_TOWARDS_PLAYER); } break; - case GAIBON_FLY_TOWARDS_PLAYER: - switch (self->step_s) { - case GAIBON_FLY_TOWARDS_PLAYER_BEGIN: +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; // Results in facing away from player other = &PLAYER; @@ -211,11 +211,11 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(5.0 / 128); if (self->ext.GS_Props.speed >= speedLimit) { self->ext.GS_Props.speed = speedLimit; - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(self->ext.GS_Props.angle)) >> 0xC; self->velocityY = (speed * rsin(self->ext.GS_Props.angle)) >> 0xC; - MoveEntity(); +REDACTED AnimateEntity(D_801814C4, self); if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); @@ -225,8 +225,8 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FLY_TOWARDS_PLAYER_END: - MoveEntity(); +REDACTED +REDACTED self->velocityX -= self->velocityX / 32; self->velocityY -= self->velocityY / 32; if (!AnimateEntity(D_801814D8, self)) { @@ -238,9 +238,9 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_FLY_SHOOT_FIREBALLS: - switch (self->step_s) { - case GAIBON_FLY_SHOOT_FIREBALLS_BEGIN: +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; other = &PLAYER; xVar = other->posX.i.hi; @@ -253,14 +253,14 @@ void EntityGaibon(Entity* self) { xVar -= self->posX.i.hi; yVar -= self->posY.i.hi; self->ext.GS_Props.angle = ratan2(yVar, xVar); - self->ext.GS_Props.speed = 0; - self->ext.GS_Props.timer = 80; - if (self->ext.GS_Props.nearDeath) { - self->ext.GS_Props.timer = 40; - } - self->step_s++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED /* fallthrough */ - case GAIBON_FLY_SHOOT_FIREBALLS_MOVING_SHOOTING: +REDACTED speedLimit = FIX(2); if (self->ext.GS_Props.nearDeath) { speedLimit *= 2; @@ -268,11 +268,11 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(5.0 / 128); if (self->ext.GS_Props.speed >= speedLimit) { self->ext.GS_Props.speed = speedLimit; - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(self->ext.GS_Props.angle)) >> 0xC; self->velocityY = (speed * rsin(self->ext.GS_Props.angle)) >> 0xC; - MoveEntity(); +REDACTED AnimateEntity(D_8018150C, self); if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); @@ -303,8 +303,8 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FLY_SHOOT_FIREBALLS_END: - MoveEntity(); +REDACTED +REDACTED self->velocityX -= self->velocityX / 32; self->velocityY -= self->velocityY / 32; if (AnimateEntity(D_801814D8, self) == 0) { @@ -314,26 +314,26 @@ void EntityGaibon(Entity* self) { } else { SetStep(3); } - if (self->ext.GS_Props.nearDeath) { - SetStep(GAIBON_FLY_SHOOT_BIG_FIREBALL); - } - } +REDACTED +REDACTED +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } break; } break; - case GAIBON_LANDING_AFTER_SHOOTING: - switch (self->step_s) { - case GAIBON_LANDING_AFTER_SHOOTING_SETUP: - self->animCurFrame = 9; +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step_s++; +REDACTED /* fallthrough */ - case GAIBON_FALLING_WITHOUT_MAP_COLLISION: - MoveEntity(); +REDACTED +REDACTED self->velocityY += FIX(12.0 / 128); other = &PLAYER; // We enter the version with collision only if @@ -345,8 +345,8 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FALLING_WITH_MAP_COLLISION: - MoveEntity(); +REDACTED +REDACTED self->velocityY += FIX(12.0 / 128); xVar = self->posX.i.hi; yVar = self->posY.i.hi + 28; @@ -363,16 +363,16 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_SHOOT_FROM_GROUND: - switch (self->step_s) { - case GAIBON_SHOOT_FROM_GROUND_FACE_PLAYER: +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; +REDACTED /* fallthrough */ case GAIBON_SHOOT_FROM_GROUND_FACE_SETUP: if (AnimateEntity(D_80181540, self) == 0) { - self->ext.GS_Props.timer = 64; - if (self->ext.GS_Props.nearDeath) { +REDACTED +REDACTED self->ext.GS_Props.timer *= 2; } self->step_s++; @@ -408,9 +408,9 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_FLY_SHOOT_BIG_FIREBALL: - switch (self->step_s) { - case GAIBON_FLY_SHOOT_BIG_FIREBALL_SETUP: +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80181550, self) == 0) { self->step_s++; } @@ -437,39 +437,39 @@ void EntityGaibon(Entity* self) { self->velocityY = FIX(-2); if (self->facingLeft) { self->velocityX = FIX(-2); - } else { +REDACTED self->velocityX = FIX(2); - } - self->ext.GS_Props.timer = 32; - self->step_s++; +REDACTED +REDACTED +REDACTED /* fallthrough */ - case GAIBON_FLY_SHOOT_BIG_FIREBALL_END: - MoveEntity(); +REDACTED +REDACTED self->velocityX -= self->velocityX / 16; self->velocityY -= self->velocityY / 16; if (!(--self->ext.GS_Props.timer)) { xVar = self->posX.i.hi - 0x80; if (abs(xVar) < 0x60) { - SetStep(GAIBON_LANDING_AFTER_SHOOTING); - } else { - SetStep(GAIBON_FLY_TOWARDS_PLAYER); - } +REDACTED +REDACTED +REDACTED +REDACTED } break; } break; - case GAIBON_PICKUP_SLOGRA: - switch (self->step_s) { - case GAIBON_PICKUP_SLOGRA_SETUP: +REDACTED +REDACTED +REDACTED other = &SLOGRA; xVar = other->posX.i.hi - self->posX.i.hi; if (xVar > 0) { self->facingLeft = 1; - } else { +REDACTED self->facingLeft = 0; - } - self->ext.GS_Props.speed = 0; - self->step_s++; +REDACTED +REDACTED +REDACTED /* fallthrough */ case GAIBON_PICKUP_SLOGRA_MOVING: other = &SLOGRA; @@ -479,11 +479,11 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(0.5); if (self->ext.GS_Props.speed >= FIX(3.5)) { self->ext.GS_Props.speed = FIX(3.5); - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(angle)) >> 0xC; self->velocityY = (speed * rsin(angle)) >> 0xC; - MoveEntity(); +REDACTED if ((abs(xVar) < 8) && (abs(yVar) < 8)) { self->ext.GS_Props.grabedAscending = 1; self->velocityX = 0; @@ -491,10 +491,10 @@ void EntityGaibon(Entity* self) { self->step_s++; } if (!other->ext.GS_Props.pickupFlag) { - self->ext.GS_Props.grabedAscending = 0; - SetStep(GAIBON_FLY_SHOOT_FIREBALLS); - } - break; +REDACTED +REDACTED +REDACTED +REDACTED case GAIBON_PICKUP_SLOGRA_ASCENDING: AnimateEntity(D_80181520, self); if (!self->animFrameDuration && self->animFrameIdx == 1) { @@ -512,10 +512,10 @@ void EntityGaibon(Entity* self) { if (self->posY.i.hi < 0) { self->velocityX = 0; self->velocityY = 0; - self->ext.GS_Props.timer = 96; - self->step_s++; - } - break; +REDACTED +REDACTED +REDACTED +REDACTED case GAIBON_PICKUP_SLOGRA_AIMING: AnimateEntity(D_80181520, self); if (!self->animFrameDuration && self->animFrameIdx == 1) { @@ -542,15 +542,15 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_PICKUP_SLOGRA_RELEASE: - self->ext.GS_Props.grabedAscending = 0; - SetStep(GAIBON_FLY_TOWARDS_PLAYER); - } - break; - case GAIBON_NEAR_DEATH: - switch (self->step_s) { - case GAIBON_NEAR_DEATH_SETUP: - self->animCurFrame = 9; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; self->ext.GS_Props.nearDeath = 1; @@ -558,22 +558,22 @@ void EntityGaibon(Entity* self) { /* fallthrough */ case GAIBON_NEAR_DEATH_FLOOR_HIT_WAIT: if (UnkCollisionFunc3(D_801814B4) & 1) { - SetSubStep(GAIBON_NEAR_DEATH_FLOOR_LANDING); - } - break; +REDACTED +REDACTED +REDACTED case GAIBON_NEAR_DEATH_FLOOR_LANDING: if (AnimateEntity(D_80181564, self) == 0) { - self->ext.GS_Props.flag = 0; - SetSubStep(GAIBON_NEAR_DEATH_TRANSFORM); - } - break; +REDACTED +REDACTED +REDACTED +REDACTED case GAIBON_NEAR_DEATH_TRANSFORM: if (AnimateEntity(D_80181570, self) == 0) { self->ext.GS_Props.flag++; self->palette = D_80180B68[3] + self->ext.GS_Props.flag; - if (self->ext.GS_Props.flag == 6) { - D_801812CC = 1; - self->flags &= ~0xF; +REDACTED +REDACTED +REDACTED SetStep(SLOGRA_GAIBON_RETREAT); } } @@ -586,10 +586,10 @@ void EntityGaibon(Entity* self) { xVar = SLOGRA.posX.i.hi - self->posX.i.hi; if (xVar > 0) { self->facingLeft = 1; - } else { +REDACTED self->facingLeft = 0; - } - self->ext.GS_Props.speed = 0; +REDACTED +REDACTED g_CastleFlags[57] |= 1; self->step_s++; /* fallthrough */ @@ -601,36 +601,36 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(0.5); if (self->ext.GS_Props.speed >= FIX(3.5)) { self->ext.GS_Props.speed = FIX(3.5); - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(angle)) >> 0xC; self->velocityY = (speed * rsin(angle)) >> 0xC; - MoveEntity(); +REDACTED if (abs(xVar) < 8 && abs(yVar) < 8) { self->velocityX = 0; self->velocityY = 0; - self->step_s++; - } - break; +REDACTED +REDACTED +REDACTED case 2: AnimateEntity(D_80181520, self); MoveEntity(); self->velocityY -= FIX(5.0 / 128); if (self->velocityY < FIX(-2)) { self->velocityY = FIX(-2); - } - SLOGRA.posX.i.hi = self->posX.i.hi; - SLOGRA.posY.i.hi = self->posY.i.hi + 28; - break; - } - break; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Because we are in the initial Entrance encounter, it is not possible to // reach this step. The fact that it is here anyway seems like strong // evidence that this whole function was copy-pasted, and then tweaked to // suit the needs in Entrance. - case GAIBON_DYING: - switch (self->step_s) { - case GAIBON_DYING_REACT: +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80181578, self) == 0) { self->ext.GS_Props.timer = 96; self->animCurFrame = 0x1F; @@ -639,8 +639,8 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_DYING_TURN_INTO_BONES: - if (!(self->ext.GS_Props.timer & 7)) { +REDACTED +REDACTED other = AllocEntity(&g_Entities[224], &g_Entities[256]); if (other != NULL) { CreateEntityFromEntity(E_EXPLOSION, self, other); @@ -659,26 +659,26 @@ void EntityGaibon(Entity* self) { } break; case 0xFF: - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { +REDACTED +REDACTED if (self->params) { - break; - } - self->animCurFrame++; - self->params |= 1; - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { if (!self->step_s) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED hitboxPtr = &D_80181584[0]; hitboxPtr += D_801815B4[0][self->animCurFrame] * 4; self->hitboxOffX = *hitboxPtr++; @@ -688,121 +688,121 @@ void EntityGaibon(Entity* self) { return; } -void func_801B8CC0(Entity* self) { - Entity* prevEntity; - s16 animCurFrame; - - if (self->step == 0) { - InitializeEntity(D_80180B68); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - } - - prevEntity = &self[-1]; +REDACTED +REDACTED +REDACTED self->facingLeft = prevEntity->facingLeft; - self->palette = prevEntity->palette; - self->posX.i.hi = prevEntity->posX.i.hi; - self->posY.i.hi = prevEntity->posY.i.hi; - self->animCurFrame = 0; - - if ((prevEntity->animCurFrame - 32) < 3U) { - self->animCurFrame = 0x26; - } else if (prevEntity->animCurFrame == 35) { - self->animCurFrame = 0x27; - } else if ((prevEntity->animCurFrame - 36) < 2U) { - self->animCurFrame = 0x28; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (prevEntity->entityId != E_GAIBON) { - DestroyEntity(self); - } -} +REDACTED +REDACTED +REDACTED // small red projectile from gaibon -void EntitySmallGaibonProjectile(Entity* self) { +REDACTED if (self->flags & FLAG_DEAD) { - self->pfnUpdate = EntityExplosion; +REDACTED self->drawFlags = 0; - self->step = 0; +REDACTED self->entityId = 2; - self->params = 0; - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180B74); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->animSet = ANIMSET_DRA(2); - self->animCurFrame = 1; +REDACTED self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTZ; self->rotX = 0xC0; self->velocityX = (rcos(self->rotZ) * 0x28000) >> 0xC; self->velocityY = (rsin(self->rotZ) * 0x28000) >> 0xC; - self->palette = 0x81B6; +REDACTED self->rotZ -= 0x400; - - case 1: - MoveEntity(); - AnimateEntity(D_801815E0, self); - break; - } -} - -void EntityLargeGaibonProjectile(Entity* self) { - Entity* newEntity; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - self->pfnUpdate = EntityExplosion; +REDACTED self->entityId = 2; self->drawFlags = 0; - self->step = 0; - self->params = 1; - return; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B80); - if (self->params == 0) { +REDACTED self->animSet = ANIMSET_DRA(2); self->drawFlags = FLAG_DRAW_ROTZ; self->velocityX = (rcos(self->rotZ) * 0x38000) >> 0xC; self->velocityY = (rsin(self->rotZ) * 0x38000) >> 0xC; - self->palette = 0x81B6; +REDACTED self->rotZ -= 0x400; - } else { +REDACTED self->animSet = ANIMSET_DRA(14); - self->unk5A = 0x79; +REDACTED self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTZ | FLAG_DRAW_UNK8; self->rotX = 0x100; - self->unk6C = 0x80; - self->palette = 0x81F3; +REDACTED +REDACTED self->drawMode = 0x30; - self->step = 2; +REDACTED self->hitboxState = 0; self->flags |= FLAG_UNK_2000; - } - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_801815EC, self); if (!(g_Timer & 3)) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_GAIBON_BIG_FIREBALL, self, newEntity); - newEntity->params = 1; +REDACTED +REDACTED +REDACTED +REDACTED newEntity->rotZ = self->rotZ; - newEntity->zPriority = self->zPriority + 1; - } - } - break; - - case 2: - self->unk6C += 0xFE; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX -= 4; if (AnimateEntity(D_801815FC, self) == 0) { - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/player_water_effect.c b/src/st/np3/player_water_effect.c index d8702513c5..b873210eea 100644 --- a/src/st/np3/player_water_effect.c +++ b/src/st/np3/player_water_effect.c @@ -47,7 +47,7 @@ void EntityAlucardWaterEffect(Entity* arg0) { u16 sp4A; s32 status; Tilemap* tilemap = &g_Tilemap; - Entity* player = &PLAYER; +REDACTED sp18 = player->posX.i.hi + tilemap->scrollX.i.hi; status = g_Player.unk0C; diff --git a/src/st/np3/slogra.c b/src/st/np3/slogra.c index 6efd3f3e4a..754a977a93 100644 --- a/src/st/np3/slogra.c +++ b/src/st/np3/slogra.c @@ -1,506 +1,506 @@ -/* - * Overlay: NP3 - * Enemy: Slogra & Gaibon Boss - */ - -#include "np3.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" #define GAIBON self[8] - -typedef enum { - SLOGRA_INIT, - SLOGRA_FLOOR_ALIGN, - SLOGRA_IDLE, - SLOGRA_TAUNT_WITH_SPEAR, - SLOGRA_SPEAR_POKE, - SLOGRA_SPEAR_FIRE, - SLOGRA_ATTACK, - SLOGRA_KNOCKBACK = 8, - SLOGRA_WALKING_WITH_SPEAR, - SLOGRA_TAUNT_WITHOUT_SPEAR, - SLOGRA_WALKING_WITHOUT_SPEAR, - SLOGRA_LOSE_SPEAR, - SLOGRA_GAIBON_COMBO_ATTACK, - SLOGRA_GAIBON_RETREAT, - SLOGRA_DYING = 16, - SLOGRA_DEBUG = 255, -} SlograSteps; - -typedef enum { - SLOGRA_FIRE_FACE_PLAYER, - SLOGRA_FIRE_PROJECTILE, - SLOGRA_FIRE_COOLDOWN, - SLOGRA_FIRE_END, -} SlograSpearFireSubSteps; - -typedef enum { - SLOGRA_COMBO_ATTACK_START, - SLOGRA_COMBO_ATTACK_PLUNGE, - SLOGRA_COMBO_ATTACK_COOLDOWN, -} SlograComboAttackSubSteps; - -typedef enum { - SLOGRA_DYING_START, - SLOGRA_DYING_EXPLODING, - SLOGRA_DYING_END, -} SlograDyingSubSteps; - -void EntitySlogra(Entity* self) { - const int RetreatedInEntrance = 57; - const int KilledInAlchLab = 132; - Entity* newEntity; - s32 hitPoints; - u8* animation; - s8* hitbox; - - self->ext.GS_Props.pickupFlag = 0; - - if (self->step != SLOGRA_INIT) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->hitFlags & 3) && (self->step != SLOGRA_KNOCKBACK)) { - SetStep(SLOGRA_KNOCKBACK); - } - if (self->ext.GS_Props.nearDeath == 0) { - hitPoints = g_api.enemyDefs[243].hitPoints; - if (hitPoints < 0) { - hitPoints += 3; - } - if ((self->hitPoints < (hitPoints >> 2)) && - (self->step != SLOGRA_LOSE_SPEAR)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; PlaySfxPositional(NA_SE_EN_SLOGRA_HURT_2); - SetStep(SLOGRA_LOSE_SPEAR); - } - } - if (GAIBON.ext.GS_Props.grabedAscending != 0) { - if ((self->step != SLOGRA_DYING) && - (self->step != SLOGRA_GAIBON_COMBO_ATTACK)) { - SetStep(SLOGRA_GAIBON_COMBO_ATTACK); - } - } - if (D_801812CC != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - if (self->step != SLOGRA_GAIBON_RETREAT) { - SetStep(SLOGRA_GAIBON_RETREAT); - } - } - } - - switch (self->step) { - case SLOGRA_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[KilledInAlchLab] || g_CastleFlags[RetreatedInEntrance]) { - DestroyEntity(self); - return; - } - InitializeEntity(D_80180B44); +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - CreateEntityFromCurrentEntity(E_SLOGRA_SPEAR, &self[1]); - - case SLOGRA_FLOOR_ALIGN: +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_801812D0) & 1) { - SetStep(SLOGRA_IDLE); - } - break; - - case SLOGRA_IDLE: - AnimateEntity(D_801812F4, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() < 96) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } - break; - - case SLOGRA_TAUNT_WITH_SPEAR: - if (AnimateEntity(D_801812F4, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } - break; - - case SLOGRA_WALKING_WITH_SPEAR: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - if (self->ext.GS_Props.attackMode != 0) { - self->ext.GS_Props.flag = 1; - } else { - self->ext.GS_Props.flag = 0; - } - self->ext.GS_Props.timer = 128; - self->step_s++; - } - AnimateEntity(D_801812E8, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; if (self->facingLeft != self->ext.GS_Props.flag) { self->velocityX = FIX(0.75); - } else { +REDACTED self->velocityX = FIX(-0.75); - } +REDACTED UnkCollisionFunc2(&D_801812E0); - if (self->ext.GS_Props.flag == 0) { +REDACTED if (GetDistanceToPlayerX() < 72) { - if (self->ext.GS_Props.attackMode == 0) { - self->ext.GS_Props.timer = 1; - } else { - self->ext.GS_Props.flag ^= 1; - } - } - } - if (self->ext.GS_Props.flag != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() > 112) { - if (self->ext.GS_Props.attackMode != 0) { - self->ext.GS_Props.timer = 1; - } else { - self->ext.GS_Props.flag ^= 1; - } - } - } - if (!(Random() % 64)) { - SetStep(SLOGRA_TAUNT_WITH_SPEAR); - } - self->ext.GS_Props.timer--; - if (self->ext.GS_Props.timer == 0) { - if (self->ext.GS_Props.attackMode != 0) { - SetStep(SLOGRA_SPEAR_FIRE); - } else { - SetStep(SLOGRA_SPEAR_POKE); - } - self->ext.GS_Props.attackMode ^= 1; - } - break; - - case SLOGRA_SPEAR_POKE: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_HISSING); - self->step_s++; - } - if (AnimateEntity(D_80181328, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { PlaySfxPositional(NA_SE_EN_SLOGRA_SPEAR_SLASH); - } - break; - - case SLOGRA_SPEAR_FIRE: - switch (self->step_s) { - case SLOGRA_FIRE_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; - - case SLOGRA_FIRE_PROJECTILE: - if (AnimateEntity(D_80181300, self) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_SPEAR_PROJECTILE); newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity( E_SLOGRA_SPEAR_PROJECTILE, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 68; - } else { - newEntity->posX.i.hi -= 68; - } - newEntity->posY.i.hi -= 6; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->zPriority = self->zPriority + 1; - } - SetSubStep(SLOGRA_FIRE_COOLDOWN); - } - break; - - case SLOGRA_FIRE_COOLDOWN: - if (AnimateEntity(D_80181310, self) == 0) { - SetSubStep(SLOGRA_FIRE_END); - } - break; - - case SLOGRA_FIRE_END: - if (AnimateEntity(D_8018131C, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } - break; - } - break; - - case SLOGRA_KNOCKBACK: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_HURT); - self->step_s++; - } - if (self->ext.GS_Props.nearDeath != 0) { - animation = &D_80181388; - } else { - animation = &D_80181348; - } - if (AnimateEntity(animation, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - if (self->ext.GS_Props.nearDeath != 0) { - SetStep(SLOGRA_TAUNT_WITHOUT_SPEAR); - } - } - break; - - case SLOGRA_LOSE_SPEAR: - if (AnimateEntity(D_8018135C, self) == 0) { - D_801812CC = 1; - SetStep(SLOGRA_GAIBON_RETREAT); - } - if (self->animFrameIdx >= 2) { - self->ext.GS_Props.nearDeath = 1; - } - break; - - case SLOGRA_TAUNT_WITHOUT_SPEAR: - if (AnimateEntity(D_8018137C, self) == 0) { - SetStep(SLOGRA_WALKING_WITHOUT_SPEAR); - } - break; - - case SLOGRA_WALKING_WITHOUT_SPEAR: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->ext.GS_Props.flag = 1; - self->ext.GS_Props.timer = 128; - self->step_s++; - } - - AnimateEntity(D_80181370, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; if (self->facingLeft != self->ext.GS_Props.flag) { self->velocityX = FIX(0.75); - } else { +REDACTED self->velocityX = FIX(-0.75); - } - +REDACTED +REDACTED UnkCollisionFunc2(&D_801812E0); - if (self->ext.GS_Props.flag == 0) { +REDACTED if (GetDistanceToPlayerX() < 72) { - self->ext.GS_Props.flag ^= 1; - } - if (self->ext.GS_Props.flag != 0) { +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() > 112) { - self->ext.GS_Props.flag ^= 1; - } - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() >= 0x71) { - self->ext.GS_Props.flag ^= 1; - } - } - if (!(Random() % 64)) { - SetStep(SLOGRA_TAUNT_WITHOUT_SPEAR); - } - self->ext.GS_Props.timer--; - if (self->ext.GS_Props.timer == 0) { - SetStep(SLOGRA_ATTACK); - } - break; - - case SLOGRA_ATTACK: // Attack without spear - if (AnimateEntity(D_8018139C, self) == 0) { - SetStep(SLOGRA_WALKING_WITHOUT_SPEAR); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 7 && self->animFrameDuration == 0) { PlaySfxPositional(NA_SE_EN_SLOGRA_BEAK_ATTACK); - } - break; - - case SLOGRA_GAIBON_COMBO_ATTACK: // Unused - switch (self->step_s) { - case SLOGRA_COMBO_ATTACK_START: - if (GAIBON.ext.GS_Props.grabedAscending == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step_s++; - } - break; - - case 1: - if (self->ext.GS_Props.nearDeath != 0) { - AnimateEntity(D_801813B4, self); - } else { - AnimateEntity(D_801813CC, self); - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_801812D0) & 1) { - g_api.func_80102CD8(1); - self->ext.GS_Props.timer = 16; - self->step_s++; - } - break; - - case SLOGRA_COMBO_ATTACK_COOLDOWN: - self->ext.GS_Props.timer--; - if (self->ext.GS_Props.timer == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - if (self->ext.GS_Props.nearDeath != 0) { - SetStep(SLOGRA_WALKING_WITHOUT_SPEAR); - } - } - break; - } - break; - - case SLOGRA_GAIBON_RETREAT: - if (self->ext.GS_Props.nearDeath != 0) { - AnimateEntity(D_8018137C, self); - } else { - AnimateEntity(D_801812F4, self); - } - break; - - case SLOGRA_DYING: // Unused - switch (self->step_s) { - case SLOGRA_DYING_START: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - if (self->ext.GS_Props.nearDeath == 0) { - self->ext.GS_Props.nearDeath = 1; - } - self->ext.GS_Props.timer = 64; +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_DEATH_EXPLOSION); g_CastleFlags[RetreatedInEntrance] |= 1; - self->step_s++; - - case SLOGRA_DYING_EXPLODING: +REDACTED +REDACTED +REDACTED UnkCollisionFunc3(&D_801812D0); - AnimateEntity(D_801813C4, self); +REDACTED if (!(g_Timer % 4)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->posX.i.hi -= 16 - (Random() & 31); - newEntity->posY.i.hi -= 16 - (Random() & 31); - newEntity->zPriority = self->zPriority + 1; - newEntity->params = 1; - } - } - self->ext.GS_Props.timer--; - if (self->ext.GS_Props.timer == 0) { - self->step_s++; - } - break; - - case SLOGRA_DYING_END: - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 3; - newEntity->posY.i.hi += 16; - } - DestroyEntity(self); - return; - } - break; - - case SLOGRA_DEBUG: - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - self->animCurFrame++; - self->params |= 1; - } else { - break; - } - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } - hitbox = &D_8018142C[self->animCurFrame][D_801813EC]; - hitbox--; - hitbox++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; -} - -void EntitySlograSpear(Entity* self) { - s8* hitbox; - - switch (self->step) { - case 0: - InitializeEntity(D_80180B50); - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = self[-1].facingLeft; - self->posX.i.hi = self[-1].posX.i.hi; - self->posY.i.hi = self[-1].posY.i.hi; - hitbox = D_80181454; - hitbox += 4 * D_8018148C[self[-1].animCurFrame]; +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = *hitbox++; - self->hitboxHeight = *hitbox++; - if (self[-1].ext.GS_Props.nearDeath != 0) { - self->step++; - } - break; - - case 2: - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; self->hitboxState = 0; if (self->facingLeft != 0) { self->velocityX = FIX(-2.25); - } else { +REDACTED self->velocityX = FIX(2.25); - } +REDACTED self->velocityY = FIX(-4); - self->animCurFrame = 35; +REDACTED self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - self->step_s++; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.15625); self->rotZ += 0x80; if (!(self->rotZ & 0xFFF)) { PlaySfxPositional(SFX_ARROW_SHOT_A); - } - } - } -} - -// projectile fired from slogra's spear -void EntitySlograSpearProjectile(Entity* self) { - Entity* entity; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, entity); - entity->params = 1; - } - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180B5C); if (self->facingLeft == 0) { self->velocityX = FIX(-4); - } else { +REDACTED self->velocityX = FIX(4); - } - - case 1: - if (AnimateEntity(D_801813D4, self) == 0) { - SetStep(SLOGRA_IDLE); - } - break; - - case 2: - MoveEntity(); - AnimateEntity(D_801813E4, self); - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/np3/st_debug.c b/src/st/np3/st_debug.c index e6ac092afa..08b48f84ec 100644 --- a/src/st/np3/st_debug.c +++ b/src/st/np3/st_debug.c @@ -3,7 +3,7 @@ void func_801B246C(Entity* self) { ObjInit2* objInit = &D_80180C10[self->params]; - if (self->step == 0) { +REDACTED InitializeEntity(g_eInitGeneric2); self->animSet = objInit->animSet; self->zPriority = objInit->zPriority; diff --git a/src/st/nz0/30958.c b/src/st/nz0/30958.c index 35ada6a535..5170176fc4 100644 --- a/src/st/nz0/30958.c +++ b/src/st/nz0/30958.c @@ -1,16 +1,16 @@ -/* - * File: 394D4.c - * Overlay: NZ0 - * Description: Alchemy Laboratory - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -void func_801B0958(Entity* self) { +REDACTED +REDACTED ObjInit* objInit = &D_80180D64[self->params]; - - if (self->step == 0) { +REDACTED +REDACTED InitializeEntity(g_eInitGeneric2); self->animSet = objInit->animSet; self->zPriority = objInit->zPriority; @@ -20,23 +20,23 @@ void func_801B0958(Entity* self) { self->drawMode = objInit->drawMode; if (objInit->unkC != 0) { self->flags = objInit->unkC; - } - } +REDACTED +REDACTED AnimateEntity(objInit->unk10, self); -} - -bool func_801B0A20(Entity* self) { - s16 diffX = PLAYER.posX.i.hi - self->posX.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED diffX = abs(diffX); - if (self->hitboxWidth >= diffX) { - diffX = PLAYER.posY.i.hi - self->posY.i.hi; +REDACTED +REDACTED diffX = abs(diffX); return self->hitboxHeight >= diffX; - } else { - return false; - } -} +REDACTED +REDACTED +REDACTED +REDACTED void func_801B0AA4(Entity* self) { Tilemap* tilemap = &g_Tilemap; diff --git a/src/st/nz0/311C0.c b/src/st/nz0/311C0.c index 547ca51fa6..8836c6f210 100644 --- a/src/st/nz0/311C0.c +++ b/src/st/nz0/311C0.c @@ -1,40 +1,40 @@ #include "nz0.h" // bust with red eyes that can have a candle on it -void EntityRedEyeBust(Entity* self) { - switch (self->step) { - case 0: - InitializeEntity(D_80180C34); - self->animCurFrame = 7; - self->zPriority = 0x70; - break; - - case 1: - break; - - case 2: - FntPrint(&D_801B058C, self->animCurFrame); // "charal %x\n" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - self->animCurFrame++; - self->params |= 1; - } else - break; - } else { - self->params = 0; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // A purplish-red brick background that scrolls behind the foreground layer void EntityPurpleBrickScrollingBackground(Entity* self) { @@ -53,9 +53,9 @@ void EntityPurpleBrickScrollingBackground(Entity* self) { // Composed of 15 primitives primIndex = g_api.AllocPrimitives(PRIM_GT4, 15); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; @@ -99,148 +99,148 @@ void EntityPurpleBrickScrollingBackground(Entity* self) { } } -void EntityLeftSecretRoomWall(Entity* self, u16* tileLayoutPtr, s32 tilePos) { - Entity* newEntity; - s32 cond; - s32 i; - - switch (self->step) { - case LEFT_SECRET_ROOM_WALL_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 16; - self->hitboxHeight = 32; +REDACTED +REDACTED self->hitboxState = 2; - +REDACTED cond = g_CastleFlags[129] != 0; - tileLayoutPtr = &D_80180E54 + (-cond & 0xC); - - tilePos = 0x260; - for (i = 0; i < 4; i++) { +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 1); - tilePos += 0x10; - tileLayoutPtr += 2; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[129] != 0) { - DestroyEntity(self); - break; - } - - case LEFT_SECRET_ROOM_WALL_IDLE: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { PlaySfxPositional(SFX_WALL_DEBRIS_B); - self->step++; - } - break; - - case LEFT_SECRET_ROOM_WALL_BREAK: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.nz0311c0.unk84++; tileLayoutPtr = &D_80180E54 + (self->ext.nz0311c0.unk84 * 4); - tilePos = 0x260; - for (i = 0; i < 4; i++) { +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 1); - tileLayoutPtr += 2; - tilePos += 0x10; - } - +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x13; - } +REDACTED +REDACTED self->ext.nz0311c0.unk80 = 32; self->step++; if (self->ext.nz0311c0.unk84 == 3) { g_CastleFlags[129] = 1; - g_api.func_800F1FC4(0x81); - - for (i = 0; i < 8; i++) { +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_WALL_DEBRIS, self, newEntity); - newEntity->posX.i.hi += (Random() & 0xF); - newEntity->posY.i.hi -= 0x20 - (Random() & 0x3F); - } - } - DestroyEntity(self); - } - break; - - case LEFT_SECRET_ROOM_WALL_CHECK: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (--self->ext.nz0311c0.unk80 == 0) { - self->step = LEFT_SECRET_ROOM_WALL_IDLE; - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityBottomSecretRoomFloor( Entity* self, u16* tileLayoutPtr, s32 tilePos) { - Entity* newEntity; - s32 flag; - s32 i; - - switch (self->step) { - case BOTTOM_SECRET_ROOM_FLOOR_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 16; - self->hitboxHeight = 16; +REDACTED +REDACTED self->hitboxState = 2; flag = (g_CastleFlags[130] != 0); - tileLayoutPtr = &D_80180E94 + (-flag & 0x6); - - tilePos = 0x2E7; - for (i = 0; i < 2; i++) { +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 1); - tileLayoutPtr += 2; - tilePos += 0x10; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (g_CastleFlags[130] != 0) { - DestroyEntity(self); - break; - } - - case BOTTOM_SECRET_ROOM_FLOOR_IDLE: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { PlaySfxPositional(SFX_WALL_DEBRIS_B); - self->step++; - } - return; - - case BOTTOM_SECRET_ROOM_FLOOR_BREAK: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.nz0311c0.unk84++; tileLayoutPtr = &D_80180E94 + (self->ext.nz0311c0.unk84 * 2); - - tilePos = 0x2E7; - for (i = 0; i < 2; i++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; g_Tilemap.fg[tilePos + 1] = *(tileLayoutPtr + 1); - tileLayoutPtr += 2; - tilePos += 0x10; - } - +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x11; - } +REDACTED +REDACTED self->ext.nz0311c0.unk80 = 32; self->step++; if (self->ext.nz0311c0.unk84 == 3) { g_CastleFlags[130] = 1; - g_api.func_800F1FC4(0x82); - DestroyEntity(self); - } - break; - - case BOTTOM_SECRET_ROOM_FLOOR_CHECK: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (--self->ext.nz0311c0.unk80 == 0) { self->step = BOTTOM_SECRET_ROOM_FLOOR_IDLE; } @@ -251,92 +251,92 @@ void EntityBottomSecretRoomFloor( // Debris produced when left wall is destroyed void EntitySecretWallDebris(Entity* self) { Collider collider; - Entity* newEntity; - s32 rnd; - s16 rnd2; - s32 i; - - switch (self->step) { - case 0: - InitializeEntity(D_80180C34); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; - - if (Random() & 1) { - self->animCurFrame = 1; - } else { - self->animCurFrame = 2; - } - - rnd = (Random() & 0x1F) + 16; - rnd2 = ((Random() & 0x3F) * 16) | 0xC00; - if (self->params != 0) { - self->animCurFrame = 3; - rnd = (Random() & 0x1F) + 16; - rnd2 = (Random() * 6) + 0x900; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = rnd * rcos(rnd2); self->velocityY = rnd * rsin(rnd2); if (self->velocityX < 0) { self->facingLeft = 1; - } - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ += 0x20; - if (self->params != 0) { +REDACTED self->rotZ += 0x20; - } - +REDACTED +REDACTED self->velocityY += FIX(0.125); g_api.CheckCollision( self->posX.i.hi, self->posY.i.hi + 6, &collider, 0); if (collider.effects & EFFECT_SOLID) { self->posY.i.hi += collider.unk18; - if (self->params == 0) { +REDACTED PlaySfxPositional(SFX_WALL_DEBRIS_B); - for (i = 0; i < 2; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_WALL_DEBRIS, self, newEntity); - newEntity->params = 0x1; - } - } - DestroyEntity(self); - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->velocityY < FIX(0.5)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity( E_INTENSE_EXPLOSION, self, newEntity); - newEntity->params = 0x10; - } - DestroyEntity(self); - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = -self->velocityY; self->velocityY *= 2; self->velocityY /= 3; - } - } -} +REDACTED +REDACTED +REDACTED void BoxPuzzleFloorButton(Entity* self) { s32 temp_s1 = GetPlayerCollisionWith(self, 8, 8, 4); s16 primIndex; Primitive* prim; - Entity* player; - s32 temp; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; @@ -350,36 +350,36 @@ void BoxPuzzleFloorButton(Entity* self) { prim->v1 = 16; prim->priority = 0x5F; prim->drawMode = DRAW_UNK02; - - case 1: - if (temp_s1 != 0) { - player = &PLAYER; - player->posY.i.hi++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(1.0); temp = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (temp > 468) { +REDACTED self->posY.i.hi = 468 - g_Tilemap.scrollY.i.hi; - D_80180EB4 ^= self->params; - self->step++; - } - } - break; - - case 2: - if (temp_s1 == 0) { - self->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val -= FIX(1); temp = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (temp < 464) { +REDACTED self->posY.i.hi = 464 - g_Tilemap.scrollY.i.hi; - self->step = 1; - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED prim = self->ext.prim; prim->x0 = self->posX.i.hi - 8; prim->y0 = self->posY.i.hi - 8; @@ -388,23 +388,23 @@ void BoxPuzzleFloorButton(Entity* self) { // Spikes which go up and down when pressing the buttons void BoxPuzzleSpikes(Entity* self, s16 primIndex) { Primitive* prim; - s8 var_v1; - s32 temp; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 12; - self->hitboxHeight = 12; +REDACTED +REDACTED self->attackElement = 1; self->attack = 7; self->hitboxState = 1; - +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; @@ -418,33 +418,33 @@ void BoxPuzzleSpikes(Entity* self, s16 primIndex) { prim->v1 = 32; prim->priority = 0x5F; prim->drawMode = DRAW_UNK02; - - if (self->params & D_80180EB4) { +REDACTED +REDACTED self->posY.i.hi = 480 - g_Tilemap.scrollY.i.hi; self->ext.nz0311c0.unk88 = 1; } else { self->posY.i.hi = 452 - g_Tilemap.scrollY.i.hi; self->ext.nz0311c0.unk88 = 0; - } - - case 1: - if (self->params & D_80180EB4) { +REDACTED +REDACTED +REDACTED +REDACTED self->posY.val += FIX(1.0); temp = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (temp > 480) { +REDACTED self->posY.i.hi = 480 - g_Tilemap.scrollY.i.hi; - } - var_v1 = 1; - } else { +REDACTED +REDACTED +REDACTED self->posY.val -= FIX(1); temp = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (temp < 452) { +REDACTED self->posY.i.hi = 452 - g_Tilemap.scrollY.i.hi; - self->step = 1; - } - var_v1 = 0; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->ext.nz0311c0.unk88 != var_v1) { self->ext.nz0311c0.unk88 = var_v1; PlaySfxPositional(0x69D); @@ -455,66 +455,66 @@ void BoxPuzzleSpikes(Entity* self, s16 primIndex) { prim->x0 = self->posX.i.hi - 16; prim->y0 = self->posY.i.hi - 16; temp = 480 - (g_Tilemap.scrollY.i.hi + self->posY.i.hi); - D_801CB736[self->params] = temp; -} +REDACTED +REDACTED // moveable box for spike/switch areas -void EntityMoveableBox(Entity* self) { - Entity* player; +REDACTED +REDACTED Primitive* prim; s32 temp_s1 = GetPlayerCollisionWith(self, 0x10, 0x10, 5); - s32 var_s1 = temp_s1; +REDACTED s16 primIndex; - s32 temp_v0_2; - s32 new_var; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 8; +REDACTED +REDACTED +REDACTED +REDACTED prim->v0 = 200; prim->u1 = 32; prim->v1 = 32; prim->priority = 112; prim->drawMode = DRAW_UNK02; - - case 1: - player = &PLAYER; +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; - - if (var_s1 & 1) { +REDACTED +REDACTED temp_s1 = GetSideToPlayer(); if (temp_s1 & 1 && player->velocityX > 0) { if (!(g_Timer & 7)) { g_api.PlaySfx(SFX_STONE_MOVE_B); - } +REDACTED self->velocityX = FIX(0.5); - } +REDACTED temp_s1 = GetSideToPlayer(); if (!(primIndex = (temp_s1 & 1)) && (player->velocityX < 0)) { if (!(g_Timer & 7)) { g_api.PlaySfx(SFX_STONE_MOVE_B); - } +REDACTED self->velocityX = FIX(-0.5); - } - } - +REDACTED +REDACTED +REDACTED UnkCollisionFunc2(&D_80180EB8); - - if (self->params == 0) { +REDACTED +REDACTED temp_v0_2 = self->posX.i.hi + g_Tilemap.scrollX.i.hi; if (abs(temp_v0_2 - 192) < 24) { var_s1 = 1; @@ -522,47 +522,47 @@ void EntityMoveableBox(Entity* self) { var_s1 = 0; } if (abs(temp_v0_2 - 256) < 24) { - var_s1 = 2; - } +REDACTED +REDACTED if ((self->ext.nz0311c0.unk84 == 0) && - ((s16)D_801CB736[var_s1] != 0)) { - var_s1 = 0; +REDACTED +REDACTED self->posX.val -= self->velocityX; - } +REDACTED self->ext.nz0311c0.unk84 = var_s1; - if (var_s1 != 0) { - self->posY.i.hi = +REDACTED +REDACTED (448 - D_801CB736[var_s1]) - g_Tilemap.scrollY.i.hi; - } - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED prim = self->ext.prim; new_var = ((u16)self->posX.i.hi) - 16; prim->x0 = new_var; prim->y0 = ((u16)self->posY.i.hi) - 16; -} +REDACTED // lever to operate cannon -void EntityCannonLever(Entity* self) { +REDACTED Primitive* prim; s16 primIndex; - s32 temp_v0_2; - s32 temp_v1_2; - s32 var_v0; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 4; - self->hitboxHeight = 20; +REDACTED +REDACTED self->hitboxState = 2; - +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; @@ -577,107 +577,107 @@ void EntityCannonLever(Entity* self) { prim->v1 = 0x28; prim->priority = 0x70; prim->drawMode = DRAW_UNK02; - - if (PLAYER.posX.i.hi < 128) { +REDACTED +REDACTED self->hitboxState = 0; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { self->velocityX = FIX(-4); - self->step++; - } +REDACTED +REDACTED break; - - case 2: - MoveEntity(); +REDACTED +REDACTED +REDACTED temp_v1_2 = self->velocityX; - if (temp_v1_2 < 0) { - var_v0 = temp_v1_2 + 0xF; - } else { - var_v0 = temp_v1_2; - } - temp_v0_2 = temp_v1_2 - (var_v0 >> 4); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = temp_v0_2; - if (temp_v0_2 < 0x2000) { - self->step++; - } +REDACTED +REDACTED +REDACTED break; - - case 3: +REDACTED +REDACTED D_80180ED0[0] = 1; - break; - } - +REDACTED +REDACTED +REDACTED if (D_8003BE6F[0] != 0) { self->hitboxState = 0; - } +REDACTED prim = self->ext.prim; prim->x0 = self->posX.i.hi - 4; prim->y0 = self->posY.i.hi - 20; -} +REDACTED // cannon for shortcut -void EntityCannon(Entity* self) { +REDACTED s16 primIndex; - Entity* newEntity; - Primitive* prim; - s32 var_v0; - s32 temp; - s32 temp2; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex == -1) { - DestroyEntity(self); - return; - } - +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; prim = &g_PrimBuf[primIndex]; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 0x28; - prim->v0 = 0xA8; - prim->u1 = 0x38; - prim->v1 = 0x20; - prim->priority = 0x70; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_UNK02; - - prim = prim->next; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 0x28; - prim->v0 = 0x80; - prim->u1 = 0x40; - prim->v1 = 0x28; - prim->x0 = self->posX.i.hi - 8; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->y0 = 120 - g_Tilemap.scrollY.i.hi; - prim->priority = 0x78; +REDACTED prim->drawMode = DRAW_UNK02; - - if (D_8003BE6F[0] != 0) { - self->step = 3; - } - break; - - case 1: - if (D_80180ED0[0] != 0) { - g_api.func_80102CD8(1); - g_api.PlaySfx(0x6AC); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = FIX(8); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != 0) { +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x13; - } +REDACTED +REDACTED CreateEntityFromEntity(E_CANNON_SHOT, self, &self[1]); self->step++; } @@ -685,124 +685,124 @@ void EntityCannon(Entity* self) { case 2: prim = self->ext.prim; - prim = prim->next; - self->posX.i.hi = prim->x0 + 8; - self->posX.i.lo = 0; - MoveEntity(); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp = self->velocityX; - if (temp < 0) { - var_v0 = temp + 7; - } else { - var_v0 = temp; - } - - temp2 = temp - (var_v0 >> 3); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = temp - (var_v0 >> 3); - - if (temp2 < 0x2000) { - self->step++; - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = self->ext.prim; - prim->x0 = self->posX.i.hi - 24; - prim->y0 = self->posY.i.hi - 16; -} +REDACTED +REDACTED +REDACTED // projectile shot by cannon -void EntityCannonShot(Entity* self) { - Entity* newEntity; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->animSet = ANIMSET_DRA(2); - self->animCurFrame = 1; - self->palette = 0x81AF; - self->zPriority = 0x6F; +REDACTED +REDACTED +REDACTED self->velocityX = FIX(-8); - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED if ((self->posX.i.hi + g_Tilemap.scrollX.i.hi) < 112) { - g_api.func_80102CD8(1); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 3; - } - D_8003BE6F[0] = 1; - DestroyEntity(self); - } - break; - } -} - -void EntityCannonWall(Entity* self) { - u16* tileLayoutPtr; - s32 tilePos; - s32 cond; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - +REDACTED cond = g_CastleFlags[131] != 0; - tileLayoutPtr = (-cond & 6) + &D_80180ED4[0]; - for (tilePos = 0x46, i = 0; i < 6; i++, tileLayoutPtr++) { +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; - tilePos += 0x10; - } - +REDACTED +REDACTED +REDACTED if (g_CastleFlags[131] != 0) { - DestroyEntity(self); - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED i = g_CastleFlags[131] != 0; // TODO: !FAKE: - if (i) { - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - - tileLayoutPtr = &D_80180EE0; - for (tilePos = 0x46, i = 0; i < 6; i++, tileLayoutPtr++) { +REDACTED +REDACTED +REDACTED g_Tilemap.fg[tilePos] = *tileLayoutPtr; - tilePos += 0x10; - } - DestroyEntity(self); - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Floor button which you kill the blood skeleton to lift the small elevator void EntityBloodSkeleElevButton(Entity* self) { Primitive* prim; - s16 primIndex; - s32 var_a0; - s32 temp; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxHeight = 8; - self->hitboxOffY = -22; - self->hitboxWidth = 6; +REDACTED +REDACTED +REDACTED self->hitboxState = 1; CreateEntityFromEntity(E_BLOOD_SKELETON, self, &self[-1]); self[-1].posY.i.hi = 344 - g_Tilemap.scrollY.i.hi; - +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; @@ -816,121 +816,121 @@ void EntityBloodSkeleElevButton(Entity* self) { prim->priority = 0x5F; prim->type = PRIM_SPRT; prim->drawMode = DRAW_UNK02; - - case 1: +REDACTED +REDACTED var_a0 = self->hitFlags; - +REDACTED if (abs(self->posX.i.hi - self[-1].posX.i.hi) < 8) { - var_a0 |= 0x8000; - } - +REDACTED +REDACTED +REDACTED if (var_a0) { self->posY.val += FIX(1.0); temp = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (temp > 376) { +REDACTED self->posY.i.hi = 376 - g_Tilemap.scrollY.i.hi; - } - g_CallElevator = true; - } else { +REDACTED +REDACTED +REDACTED self->posY.val -= FIX(1); temp = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (temp < 372) { +REDACTED self->posY.i.hi = 372 - g_Tilemap.scrollY.i.hi; - } - g_CallElevator = false; - } - - default: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = self->ext.prim; prim->x0 = self->posX.i.hi - 8; prim->y0 = self->posY.i.hi - 8; - } -} +REDACTED +REDACTED -void EntityElevator2(Entity* self) { +REDACTED s32 temp = GetPlayerCollisionWith(self, 16, 5, 4); - volatile int pad[3]; - Primitive* prim; - s16 primIndex; - s32 player; - s32 camY; - s32 i; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxOffX = 0; - self->hitboxOffY = 68; - g_CallElevator = false; - - primIndex = g_api.AllocPrimitives(PRIM_GT4, 3); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 8; - prim->v0 = 0x80; - prim->u1 = 0x20; - prim->v1 = 0x48; - prim->priority = 0x72; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_UNK02; - - prim = prim->next; - for (i = 0; i < 2; i++) { - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 0; - prim->v0 = 0x80; - prim->u1 = 8; - prim->v1 = 0x40; - prim->priority = 0x5F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_UNK02; - prim = prim->next; - } - - case 1: - //! FAKE: - player = PLAYER_CHARACTER; - if (g_CallElevator) { - self->posY.i.hi--; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi; - if ((self->posY.i.hi + camY) < 96) { - self->posY.i.hi = 96 - camY; - } else if (temp != 0) { - g_Entities[player].posY.i.hi--; +REDACTED +REDACTED +REDACTED +REDACTED D_80097488.y.i.hi--; - } - } else { - self->posY.i.hi++; +REDACTED +REDACTED +REDACTED camY = g_Tilemap.scrollY.i.hi; - if ((self->posY.i.hi + camY) > 216) { - self->posY.i.hi = 216 - camY; - } else if (temp != 0) { - g_Entities[player].posY.i.hi++; +REDACTED +REDACTED +REDACTED +REDACTED D_80097488.y.i.hi++; - } - } - } - prim = self->ext.prim; - prim->x0 = self->posX.i.hi - 16; - prim->y0 = self->posY.i.hi; - - prim = prim->next; - prim->x0 = self->posX.i.hi - 3; - prim->y0 = self->posY.i.hi - 56; - - prim = prim->next; - prim->x0 = self->posX.i.hi - 3; - prim->y0 = self->posY.i.hi - 120; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // First floor button encountered void EntityFloorButton(Entity* self) { @@ -947,16 +947,16 @@ void EntityFloorButton(Entity* self) { self->ext.nz0311c0.unk80 = self->posY.i.hi + g_Tilemap.scrollY.i.hi; primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; +REDACTED +REDACTED +REDACTED prim->u0 = 72; prim->v0 = 200; prim->v1 = prim->u1 = 0x10; @@ -977,8 +977,8 @@ void EntityFloorButton(Entity* self) { case 1: if (temp != 0) { - player = &PLAYER; - player->posY.i.hi++; +REDACTED +REDACTED self->posY.val += FIX(1.0); posY = g_Tilemap.scrollY.i.hi + self->posY.i.hi; if ((self->ext.nz0311c0.unk80 + 4) < posY) { @@ -1013,49 +1013,49 @@ void EntityFloorButton(Entity* self) { } } -void EntityFloorSpikes(Entity* self) { - Primitive* prim; +REDACTED +REDACTED s16 primIndex; - s32 var_v1; - s32 tilePos; - s32 new_var; - u8 temp; // !FAKE - volatile int pad[3]; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxWidth = 12; - self->hitboxHeight = 12; +REDACTED +REDACTED self->attackElement = 1; self->attack = 7; self->hitboxState = 1; self->ext.nz0311c0.unk80 = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - - temp = 4; - new_var = self->posY.i.hi - 4; +REDACTED +REDACTED +REDACTED new_var += g_Tilemap.scrollY.i.hi; tilePos = ((self->posX.i.hi - temp + g_Tilemap.scrollX.i.hi) >> 4) + (((new_var >> 4) * g_Tilemap.hSize) * 16); - +REDACTED g_Tilemap.fg[tilePos] = 0x102; g_Tilemap.fg[tilePos + 1] = 0x103; primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 0x28; - prim->v0 = 0xC8; - prim->v1 = prim->u1 = 0x20; - prim->priority = 0x5F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_UNK02; self->posY.i.hi -= 28; @@ -1083,215 +1083,215 @@ void EntityFloorSpikes(Entity* self) { self->ext.nz0311c0.unk88 = 0; } prim = self->ext.prim; - prim->x0 = self->posX.i.hi - 16; - prim->y0 = self->posY.i.hi - 16; -} +REDACTED +REDACTED +REDACTED // table with globe on it that can be broken -void EntityTableWithGlobe(Entity* self) { - switch (self->step) { - case 0: - InitializeEntity(D_80180CC4); - self->zPriority = 0x6A; - self->hitboxWidth = 8; - self->hitboxHeight = 12; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = -0xA; self->hitboxOffX = 0; self->hitboxState = 2; - - case 1: - AnimateEntity(D_80180EF0, self); +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { PlaySfxPositional(SFX_GLASS_BREAK_E); self->hitboxState = 0; CreateEntityFromEntity(E_HEART_DROP, self, &self[1]); - self[1].params = D_80180F10[self->params]; - SetStep(2); - } - break; - - case 2: - AnimateEntity(D_80180EF8, self); - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Tank (and decoration) at bottom of secret floor room. When broken, // provides a Life Max Up void EntityLifeMaxTank(Entity* self) { - Entity* newEntity; - - switch (self->step) { - case 0: - InitializeEntity(D_80180CD0); - self->zPriority = 0x6A; - self->hitboxWidth = 8; - self->hitboxHeight = 12; +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = -0xA; self->hitboxOffX = 0; self->hitboxState = 2; - - case 1: - AnimateEntity(D_80180F1C, self); +REDACTED +REDACTED +REDACTED if (self->hitFlags) { PlaySfxPositional(SFX_GLASS_BREAK_A); self->hitboxState = 0; - SetStep(2); - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80180F30, self) == 0) { CreateEntityFromEntity(E_HEART_DROP, self, &self[1]); - self[1].params = D_80180F4C[self->params]; - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - newEntity->posY.i.hi -= 8; - } - self->step++; - } - break; - - case 3: - newEntity = self; - newEntity->animCurFrame = 20; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Breakable container holding Skill of Wolf, Bat Card, maybe others void EntityRelicContainer(Entity* self) { - Entity* newEntity; - - switch (self->step) { - case 0: - InitializeEntity(D_80180CDC); - if (self->params & 0x100) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawMode = 0x30; - } else { - self->zPriority = 0x6A; - self->hitboxWidth = 8; - self->hitboxHeight = 12; +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = -0xA; self->hitboxOffX = 0; self->hitboxState = 2; CreateEntityFromEntity(E_RELIC_CONTAINER, self, self + 1); - self[1].params = 0x100; - } - - case 1: - if (self->params & 0x100) { - AnimateEntity(D_80180F74, self); - break; - } - AnimateEntity(D_80180F50, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { self->hitboxState = 0; - SetStep(2); - } - break; - - case 2: - if (self->params > 0x1) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_RELIC_ORB, self, self + 1); } else { CreateEntityFromEntity(E_HEART_DROP, self, self + 1); } (self + 1)->params = D_80180F9C[self->params]; - do { // !FAKE - } while (0); +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - newEntity->posY.i.hi -= 8; - } +REDACTED +REDACTED +REDACTED PlaySfxPositional(SFX_GLASS_BREAK_E); - self->step++; - - case 3: - self->animCurFrame = 4; - break; - - case 255: - FntPrint(&D_801B0598, self->animCurFrame); // "charal %x\n" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params != 0) { - break; - } - self->animCurFrame++; - self->params |= 1; - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - newEntity = self; - newEntity->step_s = 0; - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Table in room with bone-throwing skeleton. Drops a Resist Thunder. void EntityBlueFlameTable(Entity* self) { - switch (self->step) { - case 0: - InitializeEntity(D_80180CDC); - self->zPriority = 0x6A; - self->hitboxWidth = 8; - self->hitboxHeight = 16; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = -0xA; self->hitboxOffX = 0; self->hitboxState = 2; - - case 1: - AnimateEntity(D_80180F88, self); +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { g_api.PlaySfx(SFX_CANDLE_HIT); self->hitboxState = 0; - SetStep(2); - } - break; +REDACTED +REDACTED +REDACTED - case 2: +REDACTED CreateEntityFromEntity(E_HEART_DROP, self, &self[1]); - self[1].params = D_80180F9C[self->params]; - self->step++; - - case 3: - self->animCurFrame = 18; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void AxeKnightDeath() { - Entity* entity; - s8 temp_s4 = Random() & 3; - s16 temp_s3 = ((Random() & 0xF) << 8) - 0x800; - s32 i; - - for (i = 0; i < 6; i++) { - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_WARG_EXP_OPAQUE, g_CurrentEntity, entity); entity->params = 2; entity->ext.wargpuff.unk89 = 6 - i; entity->ext.wargpuff.unk84 = temp_s3; entity->ext.wargpuff.unk88 = temp_s4; - } - } -} +REDACTED +REDACTED +REDACTED -// Id 0x38 -void EntityWargExplosionPuffOpaque(Entity* self) { +REDACTED +REDACTED Unkstruct_80180FE0* obj; s32 velocityX; s32 velocityY; @@ -1354,9 +1354,9 @@ void EntityWargExplosionPuffOpaque(Entity* self) { return; } } else { - DestroyEntity(self); - } - break; +REDACTED +REDACTED +REDACTED case 3: if (self->step_s == 0) { @@ -1403,10 +1403,10 @@ void EntityWargExplosionPuffOpaque(Entity* self) { } MoveEntity(); if (AnimateEntity((u8*)self->ext.wargpuff.unk80, self) == 0) { - DestroyEntity(self); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case 4: if (self->step_s == 0) { rnd = Random(); diff --git a/src/st/nz0/36DE4.c b/src/st/nz0/36DE4.c index c597ff8dce..4beb06a175 100644 --- a/src/st/nz0/36DE4.c +++ b/src/st/nz0/36DE4.c @@ -1,34 +1,34 @@ -#include "nz0.h" +REDACTED #include "sfx.h" - -void func_801B6DE4(Entity* self) { +REDACTED +REDACTED s32 temp_s1; s16 primIndex; Primitive* prim; - s32 y; - +REDACTED +REDACTED temp_s1 = self->hitFlags; - switch (self->step) { - case 0: +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->ext.generic.unk80.modeS32 = self->posY.i.hi + g_Tilemap.scrollY.i.hi; - self->hitboxHeight = 8; - self->hitboxOffY = -22; - self->hitboxWidth = 6; +REDACTED +REDACTED +REDACTED self->hitboxState = 1; - +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; - prim->tpage = 0xF; - prim->clut = 9; +REDACTED +REDACTED prim->u0 = 72; prim->v0 = 200; prim->u1 = 16; @@ -36,33 +36,33 @@ void func_801B6DE4(Entity* self) { prim->priority = 0x5F; prim->type = PRIM_SPRT; prim->drawMode = DRAW_UNK02; - case 1: +REDACTED if (temp_s1) { self->posY.val += FIX(1.0); y = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if ((self->ext.generic.unk80.modeS32 + 4) < y) { - self->posY.i.hi = (u16)(self->ext.generic.unk80.modeS16.unk0 - +REDACTED +REDACTED (g_Tilemap.scrollY.i.hi - 4)); - self->step++; +REDACTED PlaySfxPositional(SFX_SWITCH_CLICK); - g_ElevatorTarget = self->params; - } - } - break; - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!temp_s1) { - self->posY.val += 0xFFFF0000; +REDACTED y = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - if (y < self->ext.generic.unk80.modeS32) { - self->posY.i.hi = (u16)(self->ext.generic.unk80.modeS16.unk0) - +REDACTED +REDACTED g_Tilemap.scrollY.i.hi; - self->step = 1; - } - } - break; - } - prim = self->ext.prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->x0 = self->posX.i.hi - 8; - prim->y0 = self->posY.i.hi; +REDACTED prim->y0 = prim->y0 - 8; -} +REDACTED diff --git a/src/st/nz0/bossfight.c b/src/st/nz0/bossfight.c index 08db8e24bc..280bd5b5ee 100644 --- a/src/st/nz0/bossfight.c +++ b/src/st/nz0/bossfight.c @@ -19,9 +19,9 @@ void EntityBossFightManager(Entity* self) { bosses_defeated = g_api.TimeAttackController( TIMEATTACK_EVENT_SLOGRA_GAIBON_DEFEAT, TIMEATTACK_GET_RECORD); if (bosses_defeated) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); g_BossFlag = 0; newEnt = self + 1; @@ -58,9 +58,9 @@ void EntityBossFightManager(Entity* self) { // the fight. xPos = PLAYER.posX.i.hi + g_Tilemap.scrollX.i.hi; if (0x220 < xPos && xPos < 0x340) { - g_BossFlag |= BOSS_FLAG_FIGHT_BEGIN; - } - if (g_BossFlag & BOSS_FLAG_FIGHT_BEGIN) { +REDACTED +REDACTED +REDACTED g_api.TimeAttackController( TIMEATTACK_EVENT_SLOGRA_GAIBON_DEFEAT, TIMEATTACK_SET_VISITED); D_80097928 = 1; @@ -114,16 +114,16 @@ void EntityBossFightManager(Entity* self) { } break; case 0xFF: // Unreachable debug state - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { +REDACTED +REDACTED if (self->params) { return; - } - self->animCurFrame++; - self->params |= 1; - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { if (!self->step_s) { self->animCurFrame--; @@ -136,53 +136,53 @@ void EntityBossFightManager(Entity* self) { break; } } - -// blocks that move to close slogra/gaibon room -void EntityBossRoomBlock(Entity* self) { - switch (self->step) { - case 0: - InitializeEntity(D_80180D00); - self->animCurFrame = 8; - - case 1: - if (g_BossFlag & 1) { - self->ext.GS_Props.timer = 16; - self->step++; - } - break; - - case 2: - if (self->params == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = FIX(1); - } else { +REDACTED self->velocityX = FIX(-1); - } - MoveEntity(); +REDACTED +REDACTED GetPlayerCollisionWith(self, 8, 8, 5); if (!(g_Timer & 3)) { g_api.PlaySfx(SFX_STONE_MOVE_B); - } - if (--self->ext.GS_Props.timer) { - break; - } - self->step++; - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED GetPlayerCollisionWith(self, 8, 8, 5); - if (g_BossFlag & BOSS_FLAG_DOORS_OPEN) { - self->step++; - } - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - if (self->params != 0) { +REDACTED self->velocityX = FIX(1); - } else { +REDACTED self->velocityX = FIX(-1); - } - MoveEntity(); - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/e_axe_knight.c b/src/st/nz0/e_axe_knight.c index a45a50d02c..2433bcb78f 100644 --- a/src/st/nz0/e_axe_knight.c +++ b/src/st/nz0/e_axe_knight.c @@ -1,24 +1,24 @@ -/* - * Overlay: NZ0 - * Enemy: Axe Knight - * Description: Low level Axe Knight - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -typedef enum { - AXE_KNIGHT_INIT, - AXE_KNIGHT_IDLE, - AXE_KNIGHT_WALK_TOWARDS_PLAYER, - AXE_KNIGHT_WALK_AWAY_FROM_PLAYER, - AXE_KNIGHT_STANDING_THROW, - AXE_KNIGHT_DUCKING_THROW, - AXE_KNIGHT_UNUSED, // Charge Attack missing step from the blue AxeKnight - AXE_KNIGHT_ARCING_THROW, // Unused, present in the blue AxeKnight - AXE_KNIGHT_DYING, -} EntityAxeKnightSteps; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED extern u16 g_EAxeKnightInit[]; static s16 sensors_move[] = {0, 32, 8, 0}; static s16 sensors_ground[4][2] = {{0, 32}, {0, 4}, {8, -4}, {-16, 0}}; @@ -61,29 +61,29 @@ static u32 init_velocity_y[] = {FIX(0), FIX(0), FIX(-4)}; // Weirdly, this function ONLY acts on prim->next, it does not act on prim. // However, it does call functions on prim. void func_801C3F9C(AxePrim* prim) { - Collider collider; +REDACTED Entity* newEnt; s16 yVar; - +REDACTED UnkPrimHelper((Primitive*)prim); switch (prim->next->step) { - case 0: +REDACTED prim->next->unk0C = 0; prim->next->unk10 = -0x10000; prim->next->step = 1; prim->next->timer = 0x100; return; - case 1: +REDACTED yVar = prim->next->y0 + (prim->next->unk1E / 3); g_api.CheckCollision(prim->next->x1, yVar, &collider, 0); if (collider.effects & EFFECT_SOLID) { prim->next->y0 += collider.unk18; if (prim->next->unk10 < 0x4000) { prim->next->timer = 1; - } +REDACTED prim->next->unk10 = -prim->next->unk10; prim->next->unk10 -= prim->next->unk10 / 2; - } +REDACTED prim->next->unk10 += 0x1800; prim->next->timer--; if (prim->next->timer == 0) { @@ -93,15 +93,15 @@ void func_801C3F9C(AxePrim* prim) { newEnt->posX.i.hi = prim->next->x1; newEnt->posY.i.hi = prim->next->y0; newEnt->params = 0; - } +REDACTED PlaySfxPositional(SFX_EXPLODE_B); UnkPolyFunc0((Primitive*)prim); - } - return; - } -} - -// Called by EntityAxeKnight +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED extern s16* sprites_nz0_3[]; s32 func_801C4198(Entity* axeKnight) { Primitive* prim; @@ -194,313 +194,313 @@ s32 func_801C4198(Entity* axeKnight) { } return 0; } - -void func_801C4550(void) { - if (g_CurrentEntity->ext.generic.unk80.modeS16.unk2 > 0) { - g_CurrentEntity->ext.generic.unk80.modeS16.unk2 -= 3; - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SetStep(steps[(Random() & 7)]); - g_CurrentEntity->ext.generic.unk80.modeS16.unk2 = 256; - } -} - -// green knight that throws axes -void EntityAxeKnight(Entity* self) { - Entity* newEntity; - u8 animStatus; - s8* hitbox; - s16 temp; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - if (self->step != AXE_KNIGHT_DYING) { +REDACTED PlaySfxPositional(NA_SE_VO_AXE_KNIGHT_SCREAM); AxeKnightDeath(); self->hitboxState = 0; - self->ext.generic.unk80.modeS16.unk0 = 65; - self->zPriority -= 0x10; - SetStep(AXE_KNIGHT_DYING); - } - } - - switch (self->step) { - case AXE_KNIGHT_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EAxeKnightInit); self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->hitboxOffY = 10; - self->ext.generic.unk7C.S8.unk1 = 0; - self->ext.generic.unk80.modeS16.unk2 = 512; - - case AXE_KNIGHT_IDLE: +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(sensors_ground) & 1) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER); - } - break; - - case AXE_KNIGHT_WALK_TOWARDS_PLAYER: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.1875); - } else { +REDACTED self->velocityX = FIX(0.1875); - } - self->step_s++; - } - +REDACTED +REDACTED +REDACTED +REDACTED animStatus = AnimateEntity(anim_walk, self); - if (self->animFrameDuration == 0) { +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - - if (animStatus == 0) { +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.1875); - } else { +REDACTED self->velocityX = FIX(0.1875); - } +REDACTED if (GetDistanceToPlayerX() < 96) { - SetStep(AXE_KNIGHT_WALK_AWAY_FROM_PLAYER); - self->ext.generic.unk7C.S8.unk0 = 1; - } - } - - if ((self->animFrameIdx == 1) || (self->animFrameIdx == 4)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX -= 0x300; - } else { +REDACTED self->velocityX += 0x300; - } +REDACTED } else if (self->facingLeft != 0) { self->velocityX -= 0x300; - } else { +REDACTED self->velocityX += 0x300; - } - +REDACTED +REDACTED if (UnkCollisionFunc2(sensors_move) & 0x60) { self->posX.val -= self->velocityX; self->velocityX = 0; - } - func_801C4550(); - break; - - case AXE_KNIGHT_WALK_AWAY_FROM_PLAYER: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(0.1875); - } else { +REDACTED self->velocityX = FIX(-0.1875); - } - self->step_s++; - } - +REDACTED +REDACTED +REDACTED +REDACTED animStatus = AnimateEntity(anim_walk, self); - if (self->animFrameDuration == 0) { +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } - if (animStatus == 0) { +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(0.1875); - } else { +REDACTED self->velocityX = FIX(-0.1875); - } - +REDACTED +REDACTED if (GetDistanceToPlayerX() > 80) { - SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER); - self->ext.generic.unk7C.S8.unk0 = 0; - } - } - - if ((self->animFrameIdx == 1) || (self->animFrameIdx == 4)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX += 0x200; - } else { +REDACTED self->velocityX -= 0x200; - } +REDACTED } else if (self->facingLeft != 0) { self->velocityX += 0x200; - } else { +REDACTED self->velocityX -= 0x200; - } - +REDACTED +REDACTED if (UnkCollisionFunc2(sensors_move) & 0x60) { self->posX.val -= self->velocityX; self->velocityX = 0; - } - func_801C4550(); - break; - - case AXE_KNIGHT_STANDING_THROW: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED animStatus = AnimateEntity(anim_throw_stand, self); - if (animStatus == 0) { - label: +REDACTED +REDACTED if (GetDistanceToPlayerX() < 89) { - SetStep(AXE_KNIGHT_WALK_AWAY_FROM_PLAYER); - self->ext.generic.unk7C.S8.unk0 = 1; - } else { - SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER); - self->ext.generic.unk7C.S8.unk0 = 0; - } - } else if ((animStatus & 0x80) && (self->animFrameIdx == 7)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_VO_AXE_KNIGHT_THROW); newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_AXE_KNIGHT_AXE, newEntity); +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->posY.i.hi -= 12; +REDACTED if (newEntity->facingLeft != 0) { - newEntity->posX.i.hi += 8; - } else { - newEntity->posX.i.hi -= 8; - } - } - } - break; - - case AXE_KNIGHT_DUCKING_THROW: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED animStatus = AnimateEntity(anim_throw_duck, self); - if (animStatus != 0) { - if ((animStatus & 0x80) && (self->animFrameIdx == 6)) { +REDACTED +REDACTED PlaySfxPositional(NA_SE_VO_AXE_KNIGHT_THROW); newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_AXE_KNIGHT_AXE, newEntity); +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->params = 1; - newEntity->posY.i.hi += 12; +REDACTED +REDACTED if (newEntity->facingLeft != 0) { - newEntity->posX.i.hi += 8; - } else { - newEntity->posX.i.hi -= 8; - } - } - } - } else { - goto label; - } - break; - - case AXE_KNIGHT_ARCING_THROW: // unused +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED animStatus = AnimateEntity(anim_throw_stand, self); - if (animStatus == 0) { +REDACTED if (GetDistanceToPlayerX() > 88) { - SetStep(AXE_KNIGHT_WALK_TOWARDS_PLAYER); - self->ext.generic.unk7C.S8.unk0 = 0; - } else { - SetStep(AXE_KNIGHT_WALK_AWAY_FROM_PLAYER); - self->ext.generic.unk7C.S8.unk0 = 1; - } - break; - } - - if ((animStatus & 0x80) && (self->animFrameIdx == 7)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_VO_AXE_KNIGHT_THROW); newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_AXE_KNIGHT_AXE, newEntity); +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->params = 2; - newEntity->posY.i.hi -= 40; +REDACTED +REDACTED if (newEntity->facingLeft != 0) { - newEntity->posX.i.hi += 16; - } else { - newEntity->posX.i.hi -= 16; - } - } - } - break; - - case AXE_KNIGHT_DYING: - if (self->ext.generic.unk80.modeS16.unk0 != 0) { - temp = --self->ext.generic.unk80.modeS16.unk0; - if (!(self->ext.generic.unk80.modeS16.unk0 & 7)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - temp >>= 3; - newEntity->params = 2; +REDACTED +REDACTED newEntity->posX.i.hi += dead_particle_pos[temp][0]; newEntity->posY.i.hi += dead_particle_pos[temp][1]; - } - } - } - +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(anim_die, self) == 0) { - if (func_801C4198(self) != 0) { - DestroyEntity(self); - return; - } - if (self->step_s < 16) { - self->animCurFrame = 0; - } - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED hitbox = hitboxes; hitbox += hitbox_lookup[self->animCurFrame] * 4; self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; -} - -void EntityAxeKnightRotateAxe(void) { - if (g_CurrentEntity->params != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CurrentEntity->rotZ += 0x80; - } else { +REDACTED g_CurrentEntity->rotZ -= 0x80; - } - +REDACTED +REDACTED g_CurrentEntity->rotZ &= 0xFFF; -} - +REDACTED +REDACTED void EntityAxeKnightThrowingAxe(Entity* entity) { s32 velocityX; - +REDACTED if (entity->flags & FLAG_DEAD) { PlaySfxPositional(SFX_WEAPON_BREAK); EntityExplosionSpawn(0, 0); - return; - } - - switch (entity->step) { - case 0: - InitializeEntity(D_80180C70); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->drawFlags = FLAG_DRAW_ROTZ; entity->velocityY = init_velocity_y[entity->params]; velocityX = init_velocity_x[entity->params]; - +REDACTED if (entity->facingLeft == 0) { entity->velocityX = -velocityX; - } else { +REDACTED entity->velocityX = velocityX; - } - - entity->ext.generic.unk7C.s = -0x40; - - if (entity->params == 2) { - entity->step++; - return; - } - break; - - case 1: - EntityAxeKnightRotateAxe(); - if ((u16)entity->ext.generic.unk7C.s < 0x20) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (entity->facingLeft != 0) { entity->velocityX -= FIX(0.125); - } else { +REDACTED entity->velocityX += FIX(0.125); - } - } - - entity->ext.generic.unk7C.s++; - MoveEntity(); - break; - - case 2: - EntityAxeKnightRotateAxe(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityY += FIX(0.125); - MoveEntity(); - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/e_bloody_skeleton.c b/src/st/nz0/e_bloody_skeleton.c index ca07bbf4f6..0226d6849c 100644 --- a/src/st/nz0/e_bloody_skeleton.c +++ b/src/st/nz0/e_bloody_skeleton.c @@ -1,116 +1,116 @@ -/* - * Overlay: NZ0 - * Enemy: Blood Skeleton - */ - -#include "nz0.h" - -typedef enum { - BLOOD_SKELETON_INIT, - BLOOD_SKELETON_IDLE, - BLOOD_SKELETON_WALK, - BLOOD_SKELETON_DISASSEMBLE, - BLOOD_SKELETON_REASSEMBLE, -} BLOOD_SKELETON_STEPS; - -void EntityBloodSkeleton(Entity* self) { - u8* animation; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < 3)) { PlaySfxPositional(NA_SE_EN_BLOOD_SKELETON_DISASSEMBLES); self->hitboxState = 0; - SetStep(BLOOD_SKELETON_DISASSEMBLE); - } - - switch (self->step) { - case BLOOD_SKELETON_INIT: - InitializeEntity(D_80180C40); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (u32)Random() % 2; - self->animCurFrame = 1; - self->flags &= 0x1FFFFFFF; - self->palette += self->params; - break; - - case BLOOD_SKELETON_IDLE: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_80182694) & 1) { - self->step_s = 0; - self->step++; - } - break; - - case BLOOD_SKELETON_WALK: - if (self->animFrameDuration == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - self->posX.i.hi += D_80182624[self->animFrameIdx]; - } else { - self->posX.i.hi -= D_80182624[self->animFrameIdx]; - } - } - - if ((AnimateEntity(D_80182610, self) == 0) && +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED (GetDistanceToPlayerY() < 48) && (Random() % 4) == 0) { self->facingLeft = GetSideToPlayer() % 2 == 0; - } - +REDACTED +REDACTED if ((u8)CheckColliderOffsets(&D_801826AC, self->facingLeft) != 2) { self->facingLeft ^= 1; - } - break; - - case BLOOD_SKELETON_DISASSEMBLE: - if (AnimateEntity(D_80182638, self) == 0) { - self->ext.generic.unk80.modeS16.unk0 = 0xF0; - self->flags &= ~0x100; - if (self->params != 0) { - self->ext.generic.unk80.modeS16.unk0 = 4; - } - SetStep(BLOOD_SKELETON_REASSEMBLE); - } - break; - - case BLOOD_SKELETON_REASSEMBLE: - switch (self->step_s) { - case 0: - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ = 0; self->drawFlags |= 4; PlaySfxPositional(NA_SE_EN_BLOOD_SKELETON_REASSEMBLES); - self->step_s++; - return; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((g_Timer % 3) == 0) { - self->ext.generic.unk80.modeS16.unk0++; - if (self->ext.generic.unk80.modeS16.unk0 % 2) { +REDACTED +REDACTED self->rotZ = 0x10; - } else { +REDACTED self->rotZ = -0x10; - } - } - - if (self->ext.generic.unk80.modeS16.unk0 >= 9) { +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = 0; self->rotZ = 0; - self->step_s++; - } - break; - - case 2: - if (self->params == 0) { - animation = &D_80182654; - } else { - animation = &D_80182670; - } - - if (AnimateEntity(animation, self) == 0) { - self->hitPoints = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 3; self->flags = g_api.enemyDefs[70].flags & 0x1FFFFFFF; - SetStep(BLOOD_SKELETON_WALK); - } - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/e_bloody_zombie.c b/src/st/nz0/e_bloody_zombie.c index 7f834b1ac1..2ee0332305 100644 --- a/src/st/nz0/e_bloody_zombie.c +++ b/src/st/nz0/e_bloody_zombie.c @@ -1,22 +1,22 @@ -/* - * Overlay: NZ0 - * Enemy: Bloody Zombie - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -typedef enum { - BLOODY_ZOMBIE_INIT, - BLOODY_ZOMBIE_WALK, - BLOODY_ZOMBIE_UNK_2, - BLOODY_ZOMBIE_CHASE, - BLOODY_ZOMBIE_ATTACK, - BLOODY_ZOMBIE_TAKE_HIT = 6, - BLOODY_ZOMBIE_DYING = 8, - BLOODY_ZOMBIE_DESTROY -} EntityBloodyZombieSteps; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED extern u16 g_EBloodyZombieInit[]; static s16 sensors_ground[4][2] = {{0, 28}, {0, 4}, {8, -4}, {-16, 0}}; static u16 sensors_move[][2] = {{0, 28}, {8, 0}}; @@ -49,16 +49,16 @@ static s16 D_801823C4[][2] = {{0x0000, 0x0000}, {0x00FF, 0x0000}}; static u8 unused[] = {0x06, 0x01, 0x04, 0x01, 0x04, 0x02, 0x06, 0x03, 0x05, 0x04, 0x05, 0x05, 0x00, 0x00, 0x00, 0x00}; -void EntityBloodSplatter(Entity* self) { +REDACTED Primitive* prim; s32 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); break; - - case 1: +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex != -1) { self->flags |= FLAG_HAS_PRIMS; @@ -66,463 +66,463 @@ void EntityBloodSplatter(Entity* self) { prim = &g_PrimBuf[primIndex]; self->ext.bloodSplatter.prim = prim; } else { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->step++; - break; - case 2: +REDACTED +REDACTED prim = FindFirstUnkPrim2(self->ext.bloodSplatter.prim, 2); - if (prim != NULL) { +REDACTED self->ext.bloodSplatter.prim2 = prim; UnkPolyFunc2(prim); - prim->tpage = 0x1A; - prim->clut = 0x1B7; - prim->u0 = 0x50; - prim->u1 = 0x50; - prim->u2 = 0x40; - prim->u3 = 0x40; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->v0 = 0x30; - prim->v1 = 0x40; +REDACTED prim->v2 = 0x30; - prim->v3 = 0x40; - prim->next->b3 = 0x60; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED LOH(prim->next->r2) = 0x10; LOH(prim->next->b2) = 0x10; LOW(prim->next->r1) = -0x6000; - +REDACTED if (self->facingLeft) { LOW(prim->next->u0) = 0xA000; - prim->next->tpage = 0x200; +REDACTED prim->next->x1 += 4; - } else { +REDACTED LOW(prim->next->u0) = 0xFFFF6000; LOH(prim->next->tpage) = -0x200; prim->next->x1 -= 4; - } - prim->priority = self->zPriority + 2; +REDACTED +REDACTED prim->drawMode = 6; - } - +REDACTED +REDACTED prim = FindFirstUnkPrim2(self->ext.bloodSplatter.prim, 2); - if (prim != NULL) { +REDACTED self->ext.bloodSplatter.prim3 = prim; UnkPolyFunc2(prim); - prim->tpage = 0x1A; - prim->clut = 0x1B7; - prim->u0 = 0x20; - prim->u1 = 0x20; - prim->u2 = 0; - prim->u3 = 0; - prim->v0 = 0x20; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->v1 = 0x40; - prim->v2 = 0x20; +REDACTED prim->v3 = 0x40; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; +REDACTED +REDACTED LOH(prim->next->r2) = 8; LOH(prim->next->b2) = 0x10; - prim->next->b3 = 0x80; +REDACTED LOW(prim->next->r1) = -0x8000; if (self->facingLeft) { LOW(prim->next->u0) = 0xC000; LOH(prim->next->tpage) = 0x200; - } else { +REDACTED LOW(prim->next->u0) = 0xFFFF4000; LOH(prim->next->tpage) = -0x200; - } - prim->priority = self->zPriority + 2; +REDACTED +REDACTED prim->drawMode = 6; - } - self->step++; - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = self->ext.bloodSplatter.prim2; UnkPrimHelper(prim); - +REDACTED if (g_Timer % 2) { LOH(prim->next->r2)++; LOH(prim->next->b2)++; - prim->clut = 0x1B7; - } else { - prim->clut = 0x16D; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED LOW(prim->next->r1) += 0xC00; - +REDACTED if (self->facingLeft) { - prim->next->tpage += 0x18; - } else { +REDACTED +REDACTED prim->next->tpage -= 0x18; - } - +REDACTED +REDACTED prim->next->b3 -= 2; if (UpdateAnimation(&D_8018238C, prim) == 0) { UnkPolyFunc0(prim); - } - +REDACTED +REDACTED prim = self->ext.bloodSplatter.prim3; UnkPrimHelper(prim); LOH(prim->next->r2) += 2; LOH(prim->next->b2) += 2; if (prim->p1 > 3) { LOH(prim->next->b2) = 16; - } - +REDACTED +REDACTED prim->next->b3 -= 3; if (prim->next->b3 > 240) { prim->next->b3 = 0; - } - +REDACTED +REDACTED if (UpdateAnimation(&D_801823A4, prim) == 0) { UnkPolyFunc0(prim); - } - +REDACTED +REDACTED if (self->ext.bloodSplatter.unk80++ > 128) { - DestroyEntity(self); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED static void func_801C53AC(Primitive* prim) { - switch (prim->next->u2) { - case 0: - prim->tpage = 0x12; - prim->clut = 0x16D; - prim->u0 = 80; - prim->u1 = 96; - prim->v1 = 239; - prim->v0 = 239; - prim->v3 = 255; - prim->v2 = 255; - prim->u2 = prim->u0; - prim->u3 = prim->u1; - *(s16*)&prim->next->r2 = 16; - *(s16*)&prim->next->b2 = 16; - prim->next->x1 = g_CurrentEntity->posX.i.hi; - prim->next->y0 = g_CurrentEntity->posY.i.hi; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_CurrentEntity->facingLeft != 0) { - prim->next->x1 -= 8; - } else { - prim->next->x1 += 8; - } - if (prim->next->r3 == 0) { - *(s32*)&prim->next->u0 = -0x4000; - } else { - *(s32*)&prim->next->u0 = 0x4000; - } - *(s32*)&prim->next->r1 = -0x20000; - prim->next->b3 = 0x80; - prim->priority = g_CurrentEntity->zPriority + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim->next->u2 = 1; - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - *(s32*)&prim->next->r1 += 0x2000; - if (*(s32*)&prim->next->r1 > 0x20000) { +REDACTED +REDACTED UnkPolyFunc0(prim); - } - break; - } -} - -void EntityBloodyZombie(Entity* self) { - Primitive* prim; - Entity* newEntity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; s16 facing; s32 animStatus; - +REDACTED if (self->unk44 && self->step & 1) { PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_INJURED_SCREAM); PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_INJURED); - SetStep(BLOODY_ZOMBIE_TAKE_HIT); - } - +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD && self->step < 8) { PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_DEATH_SCREAM); self->hitboxState = 0; self->flags &= ~FLAG_UNK_20000000; - SetStep(BLOODY_ZOMBIE_DYING); - } - - switch (self->step) { +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_INIT: InitializeEntity(g_EBloodyZombieInit); self->hitboxOffX = 1; self->hitboxOffY = 4; - SetStep(BLOODY_ZOMBIE_UNK_2); - break; - +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_UNK_2: if (UnkCollisionFunc3(sensors_ground) & 1) { - SetStep(BLOODY_ZOMBIE_WALK); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_WALK: - if (self->step_s == 0) { - self->ext.generic.unk80.modeS16.unk0 = 128; - self->step_s++; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(anim_walk, self); UnkCollisionFunc2(sensors_move); - +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-0.375); - } else { +REDACTED self->velocityX = FIX(0.375); - } - - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - self->ext.generic.unk80.modeS16.unk0 = 128; +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft ^= 1; - } - - if (!(Random() % 64)) { // Drop BloodDrips from the enemy knife - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_func_801C5D20, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 16; - } else { - newEntity->posX.i.hi -= 16; - } - newEntity->posY.i.hi += 12; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED facing = GetSideToPlayer() & 1; if (PLAYER.facingLeft == facing && GetDistanceToPlayerX() < 128) { self->facingLeft = facing ^ 1; - SetStep(BLOODY_ZOMBIE_CHASE); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_CHASE: if (AnimateEntity(anim_chase, self) == 0) { self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - } +REDACTED UnkCollisionFunc2(sensors_move); - +REDACTED if (self->facingLeft != 0) { self->velocityX = FIX(0.75); - } else { +REDACTED self->velocityX = FIX(-0.75); - } - - if (!(Random() % 64)) { // Drop BloodDrips from the enemy knife - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_func_801C5D20, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 18; - } else { - newEntity->posX.i.hi -= 18; - } - newEntity->posY.i.hi += 12; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() < 40) { - SetStep(BLOODY_ZOMBIE_ATTACK); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_ATTACK: animStatus = AnimateEntity(anim_attack, self); if (animStatus & 0x80 && self->animFrameIdx == 10) { PlaySfxPositional(SFX_WEAPON_SWISH_B); - } +REDACTED if (animStatus == 0) { - SetStep(BLOODY_ZOMBIE_WALK); - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_TAKE_HIT: - if (self->step_s == 0) { +REDACTED // Splat blood - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_BLOOD_SPLATTER, self, newEntity); newEntity->facingLeft = GetSideToPlayer() & 1; - } - self->step_s++; - } - +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(anim_hit, self) == 0) { - SetStep(BLOODY_ZOMBIE_WALK); - self->step_s++; - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_DYING: - if (self->step_s == 0) { +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 0x14); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; prim = &g_PrimBuf[primIndex]; - *(s32*)&self->ext.generic.unk7C = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - self->step_s++; - } - - if (self->animFrameIdx < 13) { +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer % 8)) { PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_HEMORRHAGE); newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_BLOOD_SPLATTER, self, newEntity); newEntity->facingLeft = self->ext.generic.unk84.U8.unk0; if (self->facingLeft != 0) { - newEntity->posX.i.hi -= 4; - } else { - newEntity->posX.i.hi += 4; - } - newEntity->posY.i.hi += 4; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.generic.unk84.U8.unk0 ^= 1; - } - self->ext.generic.unk80.modeS16.unk0 = 0; - } else { - if (self->ext.generic.unk80.modeS16.unk0 == 0) { +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_BLOODY_ZOMBIE_HEMORRHAGE); - } - - self->ext.generic.unk80.modeS16.unk0++; +REDACTED +REDACTED +REDACTED if (!(g_Timer & 3)) { prim = FindFirstUnkPrim2(*(s32*)&self->ext.generic.unk7C, 2); if (prim != NULL) { UnkPolyFunc2(prim); prim->next->r3 = self->ext.generic.unk84.U8.unk0; - } +REDACTED self->ext.generic.unk84.U8.unk0 ^= 1; - } - } - +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_HAS_PRIMS) { - prim = *(s32*)&self->ext.generic.unk7C; - while (prim != NULL) { - if (prim->p3 & 8) { - func_801C53AC(prim); - } - prim = prim->next; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (AnimateEntity(anim_die, self) == 0) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - newEntity->posY.i.hi += 16; +REDACTED +REDACTED if (self->facingLeft != 0) { - newEntity->posX.i.hi -= 8; - } else { - newEntity->posX.i.hi += 8; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.generic.unk80.modeS16.unk0 = 64; - self->animCurFrame = 0; +REDACTED PlaySfxPositional(NA_SE_EN_EXPLOSIVE_DEATH); - self->step++; - } - break; - +REDACTED +REDACTED +REDACTED +REDACTED case BLOODY_ZOMBIE_DESTROY: if (self->flags & FLAG_HAS_PRIMS) { - prim = *(s32*)&self->ext.generic.unk7C; - while (prim != NULL) { - if (prim->p3 & 8) { - func_801C53AC(prim); - } - prim = prim->next; - } - } - - if (--self->ext.generic.unk80.modeS16.unk0 == 0) { - DestroyEntity(self); - } - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animCurFrame > 10 && self->animCurFrame < 13) { - self->hitboxWidth = 18; - self->hitboxHeight = 12; +REDACTED +REDACTED *(s16*)&self->hitboxOffX = -12; self->hitboxOffY = -12; - } else { - self->hitboxWidth = 4; - self->hitboxHeight = 22; +REDACTED +REDACTED +REDACTED self->hitboxOffX = 1; self->hitboxOffY = 4; - } -} - -void func_801C5D20(Entity* self) { // BloodDrips - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED 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; +REDACTED 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 = 255; - prim->r1 = 32; - prim->g0 = 0; - prim->g1 = 0; - prim->b0 = 48; - prim->b1 = 16; - prim->priority = self->zPriority + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= 0x37; - prim = prim->next; - } - } else { - DestroyEntity(self); - } - break; - - case 1: - prim = *(s32*)&self->ext.generic.unk7C; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (CheckColliderOffsets(&D_801823C4, 0) != 0) { - prim->y1 += 2; - if (self->step_s == 0) { - self->step_s = 1; - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.09375); 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) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.FreePrimitives(self->primIndex); - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/e_bone_scimitar.c b/src/st/nz0/e_bone_scimitar.c index ccfcda1bc2..9c959e835f 100644 --- a/src/st/nz0/e_bone_scimitar.c +++ b/src/st/nz0/e_bone_scimitar.c @@ -1,2 +1,2 @@ -#include "nz0.h" +REDACTED #include "../e_bone_scimitar.h" diff --git a/src/st/nz0/e_breakable.c b/src/st/nz0/e_breakable.c index bbc53af5ce..6ec578d7f1 100644 --- a/src/st/nz0/e_breakable.c +++ b/src/st/nz0/e_breakable.c @@ -52,7 +52,7 @@ void EntityBreakableNZ0(Entity* self) { entityDropItem = AllocEntity(&g_Entities[224], &g_Entities[256]); if (entityDropItem != NULL) { CreateEntityFromCurrentEntity(E_EXPLOSION, entityDropItem); - entityDropItem->params = +REDACTED g_eBreakableExplosionTypes[breakableType]; } ReplaceBreakableWithItemDrop(self); diff --git a/src/st/nz0/e_elevator.c b/src/st/nz0/e_elevator.c index 5fecccc7ab..9d082fcb4f 100644 --- a/src/st/nz0/e_elevator.c +++ b/src/st/nz0/e_elevator.c @@ -1,150 +1,150 @@ #include "nz0.h" -typedef enum ElevatorSubSteps { - /* 0 */ ELEVATOR_INIT, - /* 1 */ ELEVATOR_IDLE, - /* 2 */ ELEVATOR_ASCEND, - /* 3 */ ELEVATOR_DESCEND, -} ElevatorSubSteps; - -void EntityElevator(Entity* self) { - Primitive* prim; - s16 primIndex; - s32 player; - s32 x, y; - s32 temp; - - FntPrint("elevator:%x\n", g_ElevatorTarget); - - if (g_Player.unk0C & 3) { - temp = 0; - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp = GetPlayerCollisionWith(self, 16, 5, 4); - } - - //! FAKE: - player = PLAYER_CHARACTER; - - switch (self->step) { - case ELEVATOR_INIT: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->hitboxOffX = 0; - self->hitboxOffY = 68; - self->hitboxWidth = 16; - self->hitboxHeight = 5; - self->hitboxState = 1; - - if (g_ElevatorTarget != 0) { - y = g_ElevatorTargetPos[g_ElevatorTarget]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posY.i.hi = y - g_Tilemap.scrollY.i.hi; - } else { - g_ElevatorTarget = self->params; - } - - primIndex = g_api.AllocPrimitives(PRIM_GT4, 32); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (primIndex == -1) { - DestroyEntity(self); - return; - } - prim = &g_PrimBuf[primIndex]; +REDACTED +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; - self->ext.elevator.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 8; - prim->v0 = 0x80; - prim->u1 = 0x20; - prim->v1 = 0x48; - prim->priority = 0x72; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - while (prim != NULL) { - prim->type = PRIM_SPRT; - prim->tpage = 0xF; - prim->clut = 9; - prim->u0 = 0; - prim->v0 = 0x80; - prim->u1 = 8; - prim->v1 = 0x40; - prim->priority = 0x5F; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; - prim = prim->next; - } - self->ext.elevator.elevatorTarget = g_ElevatorTarget; - - case ELEVATOR_IDLE: - if (temp != 0) { - if (g_pads[0].pressed & PAD_UP) { - if (--g_ElevatorTarget < 1) { - g_ElevatorTarget = 1; - } - } - if (g_pads[0].pressed & PAD_DOWN) { - if (++g_ElevatorTarget > 3) { - g_ElevatorTarget = 3; - } - } - } - - if (g_ElevatorTarget != self->ext.elevator.elevatorTarget) { - y = g_ElevatorTargetPos[g_ElevatorTarget]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED y -= g_Tilemap.scrollY.i.hi; - if (y >= self->posY.i.hi) { - self->step = ELEVATOR_DESCEND; - } else { - self->step = ELEVATOR_ASCEND; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(0x6E6); - } - self->ext.elevator.elevatorTarget = g_ElevatorTarget; - break; - - case ELEVATOR_ASCEND: - self->posY.i.hi--; - y = g_ElevatorTargetPos[self->ext.elevator.elevatorTarget] - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.scrollY.i.hi; - if (self->posY.i.hi >= y) { - if (temp != 0) { - g_api.func_8010DFF0(0, 1); - g_Entities[player].posY.i.hi--; +REDACTED +REDACTED +REDACTED +REDACTED D_80097488.y.i.hi--; - } - } else { - self->posY.i.hi = y; - self->step = ELEVATOR_IDLE; - } - break; - - case ELEVATOR_DESCEND: - self->posY.i.hi++; - y = g_ElevatorTargetPos[self->ext.elevator.elevatorTarget] - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.scrollY.i.hi; - if (y < self->posY.i.hi) { - self->posY.i.hi = y; - self->step = ELEVATOR_IDLE; - break; - } - if (temp != 0) { - g_api.func_8010DFF0(0, 1); - g_Entities[player].posY.i.hi++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED D_80097488.y.i.hi++; - } - break; - } - prim = self->ext.prim; - prim->x0 = self->posX.i.hi - 16; - prim->y0 = self->posY.i.hi; - - prim = prim->next; - x = self->posX.i.hi; - y = self->posY.i.hi - 56; - x -= 3; - while (prim != NULL) { - prim->x0 = x; - prim->y0 = y; - prim = prim->next; - y -= 0x40; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/e_init.c b/src/st/nz0/e_init.c index 922d2b7687..f5aef412b9 100644 --- a/src/st/nz0/e_init.c +++ b/src/st/nz0/e_init.c @@ -9,7 +9,7 @@ void EntityIntenseExplosion(Entity*); void EntitySoulStealOrb(Entity*); void EntityRoomForeground(Entity*); void EntityStageNamePopup(Entity*); -void EntityEquipItemDrop(Entity*); +REDACTED void EntityRelicOrb(Entity*); void EntityHeartDrop(Entity*); void EntityEnemyBlood(Entity*); diff --git a/src/st/nz0/e_magically_sealed_door.c b/src/st/nz0/e_magically_sealed_door.c index c6fa557e34..29e45f7c9d 100644 --- a/src/st/nz0/e_magically_sealed_door.c +++ b/src/st/nz0/e_magically_sealed_door.c @@ -1,31 +1,31 @@ -/* - * Overlay: NZ0 - * Entity: Magically Sealed Door - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - +REDACTED // Another dupe of EntityIsNearPlayer but needs separate definition in nz0 s32 EntityIsNearPlayer2(Entity* e) { - s16 diff = PLAYER.posX.i.hi - e->posX.i.hi; - +REDACTED +REDACTED diff = abs(diff); - - if (diff >= 25) { +REDACTED +REDACTED return 0; - } else { - diff = PLAYER.posY.i.hi - e->posY.i.hi; +REDACTED +REDACTED diff = abs(diff); if (diff < 33) { return 1; } else { return 0; } - } - return diff; -} - +REDACTED +REDACTED +REDACTED +REDACTED // sealed door that displays "Magically Sealed" prompt void EntityMagicallySealedDoor(Entity* self) { Entity* messageBox; @@ -87,9 +87,9 @@ void EntityMagicallySealedDoor(Entity* self) { } prim->drawMode = DRAW_COLORS | DRAW_UNK02; prim->r0 = prim->b0 = prim->g0 = 0x7F; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED if (i == 2 && !(self->params & 0x100)) { prim->drawMode |= DRAW_HIDE; } diff --git a/src/st/nz0/e_skeleton.c b/src/st/nz0/e_skeleton.c index 8b78f77ae3..028273a38b 100644 --- a/src/st/nz0/e_skeleton.c +++ b/src/st/nz0/e_skeleton.c @@ -1,21 +1,21 @@ -/* - * Overlay: NZ0 - * Enemy: Skeleton - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -typedef enum { - SKELETON_INIT, - SKELETON_IDLE, - SKELETON_WALK_TOWARDS_PLAYER, - SKELETON_WALK_AWAY_FROM_PLAYER, - SKELETON_ATTACK, - SKELETON_JUMP, - SKELETON_DESTROY -} SKELETON_STEPS; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED typedef enum { SKELETON_JUMPING, SKELETON_IN_AIR, @@ -51,247 +51,247 @@ static s16 sensors_move[][2] = {{-12, 16}, {0, -16}, {0, -16}}; static void SkeletonAttackCheck(Entity* self) { if ((UnkCollisionFunc2(sensors_special) & 0x60) == 0x60) { self->posX.val -= self->velocityX; - } - +REDACTED +REDACTED if (!(UnkCollisionFunc(sensors_move, LEN(sensors_move)) & 2)) { if ((--self->ext.skeleton.attackTimer) == 0) { SetStep(SKELETON_ATTACK); - } - } else { - SetStep(SKELETON_JUMP); - } -} - -void EntitySkeleton(Entity* self) { - Entity* newEntity; - u8 animStatus; - u8 i; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - self->step = SKELETON_DESTROY; - } - - switch (self->step) { - case SKELETON_INIT: - InitializeEntity(D_80180C88); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->ext.skeleton.attackTimer = 80; // Skeleton attack timer cycle self->ext.skeleton.facingLeft = 0; // Facing init self->ext.skeleton.attackTimerIndex = 0; - break; - case SKELETON_IDLE: // Wait for player to be close enough +REDACTED +REDACTED if (UnkCollisionFunc3(sensors_ground) != 0) { - self->step++; - } - break; - case SKELETON_WALK_TOWARDS_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->ext.skeleton.facingLeft = self->facingLeft; AnimateEntity(anim_walk, self); - +REDACTED if (self->ext.skeleton.facingLeft == 0) { self->velocityX = FIX(-0.5); - } else { +REDACTED self->velocityX = FIX(0.5); - } - +REDACTED +REDACTED if (GetDistanceToPlayerX() < 76) { - self->step = SKELETON_WALK_AWAY_FROM_PLAYER; - } +REDACTED +REDACTED SkeletonAttackCheck(self); - break; - case SKELETON_WALK_AWAY_FROM_PLAYER: +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; self->ext.skeleton.facingLeft = self->facingLeft ^ 1; AnimateEntity(anim_walk_backwards, self); - +REDACTED if (self->ext.skeleton.facingLeft == 0) { self->velocityX = FIX(-0.5); - } else { +REDACTED self->velocityX = FIX(0.5); - } - +REDACTED +REDACTED if (GetDistanceToPlayerX() > 92) { - self->step = SKELETON_WALK_TOWARDS_PLAYER; - } +REDACTED +REDACTED SkeletonAttackCheck(self); - break; - case SKELETON_ATTACK: +REDACTED +REDACTED animStatus = AnimateEntity(anim_throw_bone, self); - if (!animStatus) { - SetStep(SKELETON_WALK_AWAY_FROM_PLAYER); +REDACTED +REDACTED self->ext.skeleton.attackTimerIndex++; self->ext.skeleton.attackTimer = attack_timer_cycles[self->params & 1] [self->ext.skeleton.attackTimerIndex & 3]; - break; - } - - if ((animStatus & 0x80) && (self->animCurFrame == 10)) { - if (((u32)(((u16)self->posX.i.hi + 16) & 0xFFFF) <= 288) && - ((u16)self->posY.i.hi <= 240)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { // Spawn bone +REDACTED PlaySfxPositional(NA_SE_EN_SKELETON_THROW_BONE); CreateEntityFromCurrentEntity( E_SKELETON_THROWN_BONE, newEntity); if (self->facingLeft) { - newEntity->posX.i.hi -= 8; - } else { - newEntity->posX.i.hi += 8; - } - newEntity->posY.i.hi -= 16; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - } - } - } - break; - case SKELETON_JUMP: - switch (self->step_s) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case SKELETON_JUMPING: if (!(AnimateEntity(anim_jump1, self) & 1)) { u8 facing_ = self->ext.skeleton.facingLeft; - s32 facing; - - if (Random() % 4) { - facing = facing_; - } else { - facing_ ^= 1; - facing = facing_; - } - - if (facing == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = FIX(-2); - } else { +REDACTED self->velocityX = FIX(2); - } - +REDACTED +REDACTED self->velocityY = FIX(-3); - self->animFrameIdx = 0; - self->animFrameDuration = 0; - self->step_s++; - } - break; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case SKELETON_IN_AIR: if (UnkCollisionFunc3(sensors_ground) != 0) { - self->step_s++; - } +REDACTED +REDACTED CheckFieldCollision(sensors_move, 2); - break; +REDACTED case SKELETON_LAND: if (AnimateEntity(anim_jump2, self) & 1) { - self->step_s = 0; - SetStep(SKELETON_WALK_AWAY_FROM_PLAYER); - } - } - break; - case SKELETON_DESTROY: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(SFX_SKELETON_DEATH_C); - for (i = 0; i < 6; i++) { // Spawn Skeleton pieces - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_SKELETON_PIECES, newEntity); newEntity->facingLeft = self->facingLeft; - newEntity->params = i; +REDACTED newEntity->ext.skeleton.explosionTimer = dead_parts_selector[i]; if (self->facingLeft) { newEntity->posX.i.hi -= dead_parts_pos_x[i]; - } else { +REDACTED newEntity->posX.i.hi += dead_parts_pos_x[i]; - } +REDACTED newEntity->posY.i.hi += dead_parts_pos_y[i]; newEntity->velocityX = dead_parts_velocity_x[i]; newEntity->velocityY = dead_parts_velocity_y[i]; - } else { - break; - } - } - DestroyEntity(self); - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntitySkeletonPieces(Entity* self) { // From skeleton death explosion if (self->step) { self->ext.skeleton.explosionTimer--; if (self->ext.skeleton.explosionTimer & 0xFF) { self->rotZ += anim_bone_rot[self->params]; - FallEntity(); - MoveEntity(); - return; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->entityId = E_EXPLOSION; self->pfnUpdate = (PfnEntityUpdate)EntityExplosion; self->params = 0; self->step = 0; - return; - } - - InitializeEntity(D_80180C94); +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; self->animCurFrame = self->params + 15; - +REDACTED if (self->facingLeft) { self->velocityX = -self->velocityX; - } -} - +REDACTED +REDACTED +REDACTED void EntitySkeletonThrownBone(Entity* self) { // Bone Projectile from Skeleton s32 velocityX; - u32 xDistanceToPlayer; - +REDACTED +REDACTED if (self->step) { if (self->flags & FLAG_DEAD) { EntityExplosionSpawn(0, 0); - return; - } - +REDACTED +REDACTED +REDACTED self->rotZ += 0x80; self->velocityY += 0x2400; - MoveEntity(); - +REDACTED +REDACTED if (self->posY.i.hi > 240) { DestroyEntity(self); - } - } else { - InitializeEntity(D_80180CA0); +REDACTED +REDACTED +REDACTED self->posY.val -= FIX(0.0625); xDistanceToPlayer = GetDistanceToPlayerX(); - xDistanceToPlayer /= 32; +REDACTED xDistanceToPlayer = MAX(xDistanceToPlayer, 7); velocityX = bone_projectile_velocity_x[xDistanceToPlayer]; xDistanceToPlayer = self->facingLeft; - - if (xDistanceToPlayer > 0) { +REDACTED +REDACTED velocityX = -velocityX; - } - +REDACTED +REDACTED self->velocityY = FIX(-4.5); self->velocityX = velocityX; self->drawFlags = FLAG_DRAW_ROTZ; - } -} - +REDACTED +REDACTED +REDACTED // Unclear if this has a way to run. Not called, and not in // the main entity list. void func_801C6678(Entity* self) { if (self->step == 0) { - InitializeEntity(D_80180C88); +REDACTED self->rotX = 0x120; self->rotY = 0x200; self->unk6C = 0; self->hitboxState = 0; self->drawFlags = self->drawFlags | 0xB; - return; - } - +REDACTED +REDACTED +REDACTED self->facingLeft = self[-1].facingLeft; self->zPriority = self[-1].zPriority - 1; self->animCurFrame = self[-1].animCurFrame; self->posX.i.hi = self[-1].posX.i.hi; self->posY.i.hi = self[-1].posY.i.hi - 20; - +REDACTED if (self[-1].entityId != E_SKELETON) { DestroyEntity(self); - } +REDACTED } diff --git a/src/st/nz0/e_spittle_bone.c b/src/st/nz0/e_spittle_bone.c index 70f2f572f2..1f05aaea0d 100644 --- a/src/st/nz0/e_spittle_bone.c +++ b/src/st/nz0/e_spittle_bone.c @@ -1,289 +1,289 @@ -/* - * Overlay: NZ0 - * Enemy: Spittle Bone - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -// moves around on walls and drips poison -void EntitySpittleBone(Entity* self) { - Entity* newEntity; - s32 i; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < 3)) { - self->step = 3; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180CAC); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; self->rotZ = 0; self->flags &= ~(FLAG_UNK_2000 | 0x200); self->facingLeft = self->params; - break; - - case 1: +REDACTED +REDACTED +REDACTED if (UnkCollisionFunc3(&D_801824CC) & 1) { - newEntity = &self[1]; - self->ext.spittleBone.unk7C = 0; - CreateEntityFromEntity(E_ROTATE_SPITTLEBONE, self, newEntity); +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->ext.spittleBone.unk7C = self->ext.spittleBone.unk7C; +REDACTED if (self->facingLeft != 0) { self->velocityX = FIX(1); - newEntity->posX.i.hi += 16; - } else { +REDACTED +REDACTED self->velocityX = FIX(-1); - newEntity->posX.i.hi -= 16; - } +REDACTED +REDACTED newEntity->velocityX = self->velocityX; - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED AnimateEntity(D_80182524, self); - self->ext.spittleBone.unk7C = +REDACTED UnkCollisionFunc4(self->ext.spittleBone.unk7C); - if (self->ext.spittleBone.unk82 != 0) { +REDACTED self->rotZ += self->ext.spittleBone.unk80; - self->ext.spittleBone.unk82--; - if (self->ext.spittleBone.unk82 == 0) { +REDACTED +REDACTED self->rotZ = self[1].rotZ; - } - } - if (((self->ext.spittleBone.unk7C & 0x3F) == 1) && - (!(Random() & 0x1F))) { - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != 0) { - CreateEntityFromEntity(E_SPITTLEBONE_SPIT, self, newEntity); - newEntity->ext.spittleBone.unk84 = self; - newEntity->posY.i.hi += 24; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = (u32)rsin(self->rotZ) >> 8; self->hitboxOffY = -(rcos(self->rotZ) * 16) >> 0xC; - return; - - case 3: - for (i = 0; i < 6; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED MakeEntityFromId(E_SPITTLEBONE, self, newEntity); newEntity->facingLeft = self->facingLeft; newEntity->flags = FLAG_UNK_2000 | FLAG_UNK_08000000 | FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA | FLAG_DESTROY_IF_OUT_OF_CAMERA; - newEntity->palette = 0x20D; - newEntity->animCurFrame = i + 0x3A; +REDACTED +REDACTED newEntity->drawFlags |= 4; newEntity->rotZ = self->rotZ; - newEntity->step = 4; +REDACTED newEntity->velocityX = D_80182504[i]; newEntity->velocityY = 0xFFFD0000 - ((Random() & 3) << 0xF); - newEntity->ext.spittleBone.unk82 = D_801824E2[i + 0x3A]; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 1; +REDACTED newEntity->posX.i.hi += -(rsin(self->rotZ) * 0x10) >> 0xC; newEntity->posY.i.hi += -(rcos(self->rotZ) * 0x10) >> 0xC; - } +REDACTED PlaySfxPositional(SFX_SKELETON_DEATH_C); - DestroyEntity(self); - break; - - case 4: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.15625); - self->ext.spittleBone.unk82--; - if (self->ext.spittleBone.unk82 == 0) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0; - } - DestroyEntity(self); - } - break; - } -} - -void EntityRotateSpittlebone(Entity* self) { - Entity* prevEntity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 rotZ; - u32 temp1; - u32 temp2; - s32 temp3; - s8 temp4; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); - self->flags &= ~0x2200; - break; - - case 1: - temp1 = self->ext.spittleBone.unk7C & 0x3F; - prevEntity = &self[-1]; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED temp4 = UnkCollisionFunc4(self->ext.spittleBone.unk7C); - self->ext.spittleBone.unk7C = temp4; - if ((temp4 & 0x3F) != temp1) { - temp2 = temp4 & 0x3C; - if (temp2 != 0) { - temp1 = temp2 >> 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED rotZ = D_801824E4[temp1]; - } else { +REDACTED rotZ = D_801824DC[temp4 & 3]; - } - +REDACTED +REDACTED if (self->facingLeft != 0) { rotZ = -rotZ; - } - +REDACTED +REDACTED self->rotZ = rotZ; rotZ -= prevEntity->rotZ; - +REDACTED if (rotZ > 0x800) { rotZ -= 0x1000; - } +REDACTED if (rotZ < -0x800) { rotZ += 0x1000; - } - +REDACTED +REDACTED temp3 = rotZ; - if (temp3 < 0) { - temp3 += 0x1F; - } - prevEntity->ext.spittleBone.unk80 = temp3 >> 5; - prevEntity->ext.spittleBone.unk82 = 0x20; - } - break; - } -} - -// spit projectile from spittle bone -void EntitySpittleBoneSpit(Entity* self) { - Collider collider; - Unkstruct_801C6C6C test; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - Primitive* prim; - Entity* entity; +REDACTED +REDACTED s32 u0, v0, r0, b0, drawMode; - s32 i; - - switch (self->step) { - case 0: - InitializeEntity(D_80180CB8); - self->ext.spittleBone.unk82 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX = 0; self->rotY = 0; - return; - - case 1: - entity = self->ext.spittleBone.unk84; +REDACTED +REDACTED +REDACTED +REDACTED if ((entity->rotZ & 0xFFF) == 0x800) { if (entity->facingLeft != 0) { - self->posX.i.hi = entity->posX.i.hi - 3; - } else { - self->posX.i.hi = entity->posX.i.hi + 3; - } - self->posY.i.hi = entity->posY.i.hi + 27; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX += 16; self->rotY += 20; - if (++self->ext.spittleBone.unk82 > 16) { - self->ext.spittleBone.unk82 = 0; - self->step++; - } - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotY = 0x140; self->rotX = 0x100; - self->step++; - return; - - case 2: - AnimateEntity(D_80182534, self); - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.0625); - g_api.CheckCollision(self->posX.i.hi, self->posY.i.hi, &collider, 0); +REDACTED if (collider.effects != 0) { PlaySfxPositional(NA_SE_EN_SPITTLEBONE_ACID_SPLAT); EntityUnkId14Spawner(self, 1, 2, 0, 0, 5, 0); - self->animCurFrame = 0; +REDACTED self->hitboxState = 0; - self->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_TILE, 9); if (primIndex == -1) { - DestroyEntity(self); - break; - } +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.spittleBone.unk84 = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - if (prim != NULL) { +REDACTED for (u0 = 1, v0 = 2, r0 = 0x20, b0 = 0xc0, drawMode = 0x33, i = 0; - prim != NULL; i += 8) { - prim->u0 = u0; - prim->v0 = v0; - prim->x0 = self->posX.i.hi; - prim->y0 = self->posY.i.hi; - prim->r0 = r0; - prim->g0 = r0; - prim->b0 = b0; - LOW(prim->x2) = LOW(D_8018253C[i]); - LOW(prim->x3) = LOW(D_80182540[i]); - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = drawMode; - prim = prim->next; - } - } - self->ext.spittleBone.unk82 = 0x30; - self->step++; - break; - - case 4: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotY -= 0x14; if (self->rotY < 0) { self->rotY = 0; - } - - prim = *(s32*)&self->ext.spittleBone.unk84; - while (prim != NULL) { - test.x.c.x = prim->x0; - test.x.c.w = prim->x1; - test.y.c.y = prim->y0; - test.y.c.h = prim->y1; - test.x.p += LOW(prim->x2); - test.y.p += LOW(prim->x3); - prim->x0 = test.x.c.x; - prim->x1 = test.x.c.w; - prim->y0 = test.y.c.y; - prim->y1 = test.y.c.h; - LOW(prim->x3) += 0x1800; - if (LOW(prim->x3) > 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.CheckCollision( prim->x0, (s16)(prim->y0 + 16), &collider, 0); if (collider.effects != 0) { prim->drawMode = DRAW_HIDE; - } - } - prim = prim->next; - } - - if (--self->ext.spittleBone.unk82 == 0) { - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/e_subweapon_container.c b/src/st/nz0/e_subweapon_container.c index 6c0c01ded7..c9704676eb 100644 --- a/src/st/nz0/e_subweapon_container.c +++ b/src/st/nz0/e_subweapon_container.c @@ -1,282 +1,282 @@ -/* - * Overlay: NZ0 - * Entity: SubWeapon container - */ - -#include "nz0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -// SubWeapons floating in the breakable container -void EntitySubWeaponContainer(Entity* self) { - SubWpnContDebris* glassPieceTBL; - Entity* newEntity; - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - s32 rnd; - s32 rndPosX; - s32 rndPosY; - s32 absRnd; - s32 i; - s32 pad[23]; - - switch (self->step) { - case SUBWPNCONT_INIT: - InitializeEntity(D_80180CE8); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawMode = DRAW_TPAGE; - self->animCurFrame = 1; - self->zPriority = 0x70; - self->hitboxWidth = 14; - self->hitboxHeight = 32; +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffY = -0x38; self->hitboxOffX = 0; self->hitboxState = 2; - self->palette += self->params; +REDACTED CreateEntityFromEntity( E_func_801C7884, self, &self[1]); // Create SubWeapon - self[1].posY.i.hi -= 72; - self[1].params = D_801825CC[self->params]; - self[1].zPriority = self->zPriority - 2; - +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 2); if (primIndex == -1) { - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED self->primIndex = primIndex; prim = &g_PrimBuf[primIndex]; - *(s32*)&self->ext.generic.unk7C = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { - prim->priority = self->zPriority + 0xFFFF; +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - break; - - case SUBWPNCONT_IDLE: // Spawn Liquid bubbles +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer & 0xF)) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_func_801C77B8, self, newEntity); - rnd = (Random() & 0x18) - 12; - newEntity->posX.i.hi += rnd; - newEntity->posY.i.hi -= 30; - newEntity->params = Random() & 3; - if (newEntity->params == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED absRnd = abs(rnd); - if (absRnd >= 9) { - newEntity->params = 1; - } - } - newEntity->zPriority = self->zPriority - 1; - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { // container got hit! - self->step++; - } - break; - - case SUBWPNCONT_BREAK: // Break container into pieces - // Spawn falling glass pieces - glassPieceTBL = D_80182584; - i = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.FreePrimitives(self->primIndex); self->flags &= ~FLAG_HAS_PRIMS; g_api.PlaySfx(SFX_MAGIC_GLASS_BREAK); - while (i < ENTITY_SUBWPNCONT_DEBRIS_COUNT) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_func_801C7538, self, newEntity); - newEntity->posX.i.hi += glassPieceTBL->posX; - newEntity->posY.i.hi += glassPieceTBL->posY; - newEntity->ext.generic.unk84.S16.unk0 = glassPieceTBL->posX; - newEntity->params = glassPieceTBL->params; +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = glassPieceTBL->facingLeft; - newEntity->ext.generic.unk84.S16.unk2 = self->params; - } - glassPieceTBL++; - i++; - } - - for (i = 0; i < 96; i++) { // Spawn falling liquid +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity = AllocEntity( &g_Entities[UNK_ENTITY_51], &g_Entities[UNK_ENTITY_100]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_func_801C7654, self, newEntity); - rndPosX = (Random() & 0x1F) - 16; - rndPosY = -(Random() & 0x3F) - 16; - newEntity->posX.i.hi += rndPosX; - newEntity->posY.i.hi += rndPosY; +REDACTED +REDACTED +REDACTED +REDACTED newEntity->rotZ = ratan2(rndPosY, rndPosX); - newEntity->zPriority = self->zPriority + 1; - } - } +REDACTED +REDACTED +REDACTED PlaySfxPositional(SFX_GLASS_BREAK_E); self->hitboxState = 0; - self->animCurFrame = 2; - self->step++; - break; - - case SUBWPNCONT_DEBUG: - /** - * Debug: Press SQUARE / CIRCLE on the second controller - * to advance/rewind current animation frame - */ - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - newEntity->animCurFrame++; - self->params |= 1; - } else { - break; - } - } else { - self->params = 0; - } - if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - newEntity->animCurFrame--; - self->step_s |= 1; - break; - } - } else { - self->step_s = 0; - } - break; - } -} - -// Subweapon container falling glass pieces -void func_801C7538(Entity* entity) { - s32 new_var; - s16 var_v0; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180CF4); entity->drawFlags = FLAG_DRAW_ROTZ; - entity->animCurFrame = entity->params; - entity->palette += entity->ext.generic.unk84.S16.unk2; +REDACTED +REDACTED entity->velocityX = entity->ext.generic.unk84.S16.unk0 << 12; entity->velocityX += 0x8000 - (Random() << 8); entity->velocityY -= (Random() & 0x1F) << 12; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityY += FIX(0.125); - +REDACTED if (entity->velocityX != 0) { if (entity->facingLeft == 0) { new_var = (u16)entity->rotZ - 16; - var_v0 = new_var; - } else { +REDACTED +REDACTED var_v0 = entity->rotZ + 16; - } +REDACTED } else if (entity->facingLeft != 0) { var_v0 = entity->rotZ - 16; - } else { +REDACTED var_v0 = entity->rotZ + 16; - } - +REDACTED +REDACTED entity->rotZ = var_v0; - break; - } -} - -// falling liquid from subweapons container -void func_801C7654(Entity* entity) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED Collider collider; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); entity->animSet = ANIMSET_DRA(2); - entity->palette = 0x816D; +REDACTED entity->drawMode = 0x70; entity->velocityX = rcos(entity->rotZ) * 0x10; entity->velocityY = rsin(entity->rotZ) * 0x10; - break; - - case 1: +REDACTED +REDACTED +REDACTED AnimateEntity(D_801825F0, entity); - MoveEntity(); +REDACTED entity->velocityY += FIX(0.125); - +REDACTED g_api.CheckCollision( entity->posX.i.hi, entity->posY.i.hi + 8, &collider.effects, 0); - +REDACTED if (collider.effects & EFFECT_SOLID) { entity->drawFlags = FLAG_DRAW_ROTY; entity->rotY = 0x100; entity->velocityY = FIX(0.25); entity->velocityX *= 8; - entity->step++; - } - break; - - case 2: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->rotY -= 8; if (!(entity->rotY << 0x10)) { - DestroyEntity(entity); - } - break; - } -} - -// Liquid bubbles from the Subweapon container -void func_801C77B8(Entity* entity) { - s16 temp_v1_2; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180CF4); entity->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY; entity->rotY = 0x100; entity->rotX = 0x100; entity->velocityX = 0; - entity->animCurFrame = entity->params + 8; +REDACTED entity->velocityY = D_80182600[entity->params]; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED temp_v1_2 = entity->rotY - 8; entity->velocityY -= 0x400; entity->rotY = temp_v1_2; entity->rotX = temp_v1_2; - - if ((temp_v1_2 << 0x10) == 0) { - DestroyEntity(entity); - } - break; - } -} - -void func_801C7884(Entity* entity) { - u16 params = entity->params; - - switch (entity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeData0); entity->hitboxState = 0; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED AnimateEntity(g_SubweaponAnimPrizeDrop[params], entity); - +REDACTED entity->velocityY = rsin(entity->rotZ) * 2; entity->rotZ += 0x20; - - if (entity[-1].step != 1) { +REDACTED +REDACTED entity->entityId = E_PRIZE_DROP; entity->pfnUpdate = EntityPrizeDrop; entity->animFrameDuration = 0; entity->animFrameIdx = 0; - entity->step = 0; +REDACTED entity->hitboxState = 1; - } - } +REDACTED +REDACTED } diff --git a/src/st/nz0/gaibon.c b/src/st/nz0/gaibon.c index 3902b0fc04..0cc670c9a6 100644 --- a/src/st/nz0/gaibon.c +++ b/src/st/nz0/gaibon.c @@ -3,71 +3,71 @@ #define SLOGRA self[-8] -typedef enum { - GAIBON_INIT, - GAIBON_IDLE = 2, - GAIBON_FLY_TOWARDS_PLAYER, - GAIBON_FLY_SHOOT_FIREBALLS, - GAIBON_LANDING_AFTER_SHOOTING, - GAIBON_SHOOT_FROM_GROUND, - GAIBON_FLY_SHOOT_BIG_FIREBALL = 8, - GAIBON_PICKUP_SLOGRA, - GAIBON_NEAR_DEATH = 15, - GAIBON_DYING, - GAIBON_DEBUG = 255, -} GaibonSteps; - -typedef enum { - GAIBON_FLY_TOWARDS_PLAYER_BEGIN, - GAIBON_FLY_TOWARDS_PLAYER_MOVEMENT, - GAIBON_FLY_TOWARDS_PLAYER_END, -} GaibonFlyTowardsPlayerSubSteps; - -typedef enum { - GAIBON_FLY_SHOOT_FIREBALLS_BEGIN, - GAIBON_FLY_SHOOT_FIREBALLS_MOVING_SHOOTING, - GAIBON_FLY_SHOOT_FIREBALLS_END, -} GaibonFlyShootFirewalls_SubSteps; - -typedef enum { - GAIBON_LANDING_AFTER_SHOOTING_SETUP, - GAIBON_FALLING_WITHOUT_MAP_COLLISION, - GAIBON_FALLING_WITH_MAP_COLLISION, - GAIBON_FALLING_ON_GROUND, -} GaibonLandingAfterShootingSubSteps; - -typedef enum { - GAIBON_SHOOT_FROM_GROUND_FACE_PLAYER, - GAIBON_SHOOT_FROM_GROUND_FACE_SETUP, - GAIBON_SHOOT_FROM_GROUND_FACE_SHOOTING, -} GaibonShootFromGroundSubSteps; - -typedef enum { - GAIBON_FLY_SHOOT_BIG_FIREBALL_SETUP, - GAIBON_FLY_SHOOT_BIG_FIREBALL_SHOOTING, - GAIBON_FLY_SHOOT_BIG_FIREBALL_END, +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } GaibonFlyShootBigFireballSubSteps; - -typedef enum { - GAIBON_PICKUP_SLOGRA_SETUP, - GAIBON_PICKUP_SLOGRA_MOVING, - GAIBON_PICKUP_SLOGRA_ASCENDING, - GAIBON_PICKUP_SLOGRA_AIMING, - GAIBON_PICKUP_SLOGRA_RELEASE, -} GaibonPickupSlograSubSteps; - -typedef enum { - GAIBON_NEAR_DEATH_SETUP, - GAIBON_NEAR_DEATH_FLOOR_HIT_WAIT, - GAIBON_NEAR_DEATH_FLOOR_LANDING, - GAIBON_NEAR_DEATH_TRANSFORM, -} GaibonNearDeathSubSteps; - -typedef enum { - GAIBON_DYING_REACT, - GAIBON_DYING_TURN_INTO_BONES, -} GaibonDyingSubSteps; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void EntityGaibon(Entity* self) { Collider collider; Entity* other; @@ -95,30 +95,30 @@ void EntityGaibon(Entity* self) { SetStep(9); } } - switch (self->step) { - case GAIBON_INIT: - InitializeEntity(D_80180D30); +REDACTED +REDACTED +REDACTED other = self + 1; // func_801B69E8 CreateEntityFromCurrentEntity(68, other); other->zPriority = (self->zPriority + 4); SetStep(GAIBON_IDLE); break; - case GAIBON_IDLE: - AnimateEntity(D_80181250, self); +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } if (self->hitFlags) { - g_BossFlag |= BOSS_FLAG_FIGHT_BEGIN; - } - if (g_BossFlag & BOSS_FLAG_FIGHT_BEGIN) { - SetStep(GAIBON_FLY_TOWARDS_PLAYER); - } - break; - case GAIBON_FLY_TOWARDS_PLAYER: - switch (self->step_s) { - case GAIBON_FLY_TOWARDS_PLAYER_BEGIN: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; // Results in facing away from player other = &PLAYER; @@ -142,12 +142,12 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(5.0 / 128); if (self->ext.GS_Props.speed >= speedLimit) { self->ext.GS_Props.speed = speedLimit; - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(self->ext.GS_Props.angle)) >> 0xC; self->velocityY = (speed * rsin(self->ext.GS_Props.angle)) >> 0xC; - MoveEntity(); - AnimateEntity(D_80181250, self); +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } @@ -156,8 +156,8 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FLY_TOWARDS_PLAYER_END: - MoveEntity(); +REDACTED +REDACTED self->velocityX -= self->velocityX / 32; self->velocityY -= self->velocityY / 32; if (!AnimateEntity(D_80181264, self)) { @@ -169,9 +169,9 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_FLY_SHOOT_FIREBALLS: - switch (self->step_s) { - case GAIBON_FLY_SHOOT_FIREBALLS_BEGIN: +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; other = &PLAYER; xVar = other->posX.i.hi; @@ -184,14 +184,14 @@ void EntityGaibon(Entity* self) { xVar -= self->posX.i.hi; yVar -= self->posY.i.hi; self->ext.GS_Props.angle = ratan2(yVar, xVar); - self->ext.GS_Props.speed = 0; - self->ext.GS_Props.timer = 80; - if (self->ext.GS_Props.nearDeath) { - self->ext.GS_Props.timer = 40; - } - self->step_s++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED /* fallthrough */ - case GAIBON_FLY_SHOOT_FIREBALLS_MOVING_SHOOTING: +REDACTED speedLimit = FIX(2); if (self->ext.GS_Props.nearDeath) { speedLimit *= 2; @@ -199,12 +199,12 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(5.0 / 128); if (self->ext.GS_Props.speed >= speedLimit) { self->ext.GS_Props.speed = speedLimit; - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(self->ext.GS_Props.angle)) >> 0xC; self->velocityY = (speed * rsin(self->ext.GS_Props.angle)) >> 0xC; - MoveEntity(); - AnimateEntity(D_80181298, self); +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } @@ -234,32 +234,32 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FLY_SHOOT_FIREBALLS_END: - MoveEntity(); +REDACTED +REDACTED self->velocityX -= self->velocityX / 32; self->velocityY -= self->velocityY / 32; - if (AnimateEntity(D_80181264, self) == 0) { - SetStep(GAIBON_LANDING_AFTER_SHOOTING); - if (self->ext.GS_Props.nearDeath) { - SetStep(GAIBON_FLY_SHOOT_BIG_FIREBALL); - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } break; } break; - case GAIBON_LANDING_AFTER_SHOOTING: - switch (self->step_s) { - case GAIBON_LANDING_AFTER_SHOOTING_SETUP: - self->animCurFrame = 9; +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step_s++; +REDACTED /* fallthrough */ - case GAIBON_FALLING_WITHOUT_MAP_COLLISION: - MoveEntity(); +REDACTED +REDACTED self->velocityY += FIX(12.0 / 128); other = &PLAYER; // We enter the version with collision only if @@ -271,8 +271,8 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FALLING_WITH_MAP_COLLISION: - MoveEntity(); +REDACTED +REDACTED self->velocityY += FIX(12.0 / 128); xVar = self->posX.i.hi; yVar = self->posY.i.hi + 28; @@ -282,22 +282,22 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_FALLING_ON_GROUND: - if (AnimateEntity(D_801812C0, self) == 0) { - SetStep(GAIBON_SHOOT_FROM_GROUND); - } +REDACTED +REDACTED +REDACTED +REDACTED break; } break; - case GAIBON_SHOOT_FROM_GROUND: - switch (self->step_s) { - case GAIBON_SHOOT_FROM_GROUND_FACE_PLAYER: +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; +REDACTED /* fallthrough */ - case GAIBON_SHOOT_FROM_GROUND_FACE_SETUP: - if (AnimateEntity(D_801812CC, self) == 0) { - self->ext.GS_Props.timer = 64; +REDACTED +REDACTED +REDACTED if (self->ext.GS_Props.nearDeath) { self->ext.GS_Props.timer *= 2; } @@ -334,9 +334,9 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_FLY_SHOOT_BIG_FIREBALL: - switch (self->step_s) { - case GAIBON_FLY_SHOOT_BIG_FIREBALL_SETUP: +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_801812DC, self) != 0) { } else { @@ -365,14 +365,14 @@ void EntityGaibon(Entity* self) { self->velocityY = FIX(-2); if (self->facingLeft) { self->velocityX = FIX(-2); - } else { +REDACTED self->velocityX = FIX(2); - } - self->ext.GS_Props.timer = 32; - self->step_s++; +REDACTED +REDACTED +REDACTED /* fallthrough */ - case GAIBON_FLY_SHOOT_BIG_FIREBALL_END: - MoveEntity(); +REDACTED +REDACTED self->velocityX -= self->velocityX / 16; self->velocityY -= self->velocityY / 16; if (!(--self->ext.GS_Props.timer)) { @@ -381,18 +381,18 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_PICKUP_SLOGRA: - switch (self->step_s) { - case GAIBON_PICKUP_SLOGRA_SETUP: +REDACTED +REDACTED +REDACTED other = &SLOGRA; xVar = other->posX.i.hi - self->posX.i.hi; if (xVar > 0) { self->facingLeft = 1; - } else { +REDACTED self->facingLeft = 0; - } - self->ext.GS_Props.speed = 0; - self->step_s++; +REDACTED +REDACTED +REDACTED /* fallthrough */ case GAIBON_PICKUP_SLOGRA_MOVING: other = &SLOGRA; @@ -402,23 +402,23 @@ void EntityGaibon(Entity* self) { self->ext.GS_Props.speed += FIX(0.5); if (self->ext.GS_Props.speed >= FIX(3.5)) { self->ext.GS_Props.speed = FIX(3.5); - } - speed = self->ext.GS_Props.speed; +REDACTED +REDACTED self->velocityX = (speed * rcos(angle)) >> 0xC; self->velocityY = (speed * rsin(angle)) >> 0xC; - MoveEntity(); +REDACTED if ((abs(xVar) < 8) && (abs(yVar) < 8)) { self->ext.GS_Props.grabedAscending = 1; self->velocityX = 0; self->velocityY = 0; self->step_s++; } else if (!other->ext.GS_Props.pickupFlag) { - self->ext.GS_Props.grabedAscending = 0; - SetStep(GAIBON_FLY_SHOOT_FIREBALLS); - } - break; - case GAIBON_PICKUP_SLOGRA_ASCENDING: - AnimateEntity(D_801812AC, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } @@ -431,15 +431,15 @@ void EntityGaibon(Entity* self) { other->posX.i.hi = self->posX.i.hi; other->posY.i.hi = self->posY.i.hi + 28; self->ext.GS_Props.grabedAscending = 1; - if (self->posY.i.hi < 16) { +REDACTED self->velocityX = 0; self->velocityY = 0; - self->ext.GS_Props.timer = 96; - self->step_s++; - } - break; - case GAIBON_PICKUP_SLOGRA_AIMING: - AnimateEntity(D_801812AC, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!self->animFrameDuration && self->animFrameIdx == 1) { PlaySfxPositional(NA_SE_EN_GAIBON_FLAP_WINGS); } @@ -464,29 +464,29 @@ void EntityGaibon(Entity* self) { self->step_s++; } break; - case GAIBON_PICKUP_SLOGRA_RELEASE: - self->ext.GS_Props.grabedAscending = 0; - SetStep(GAIBON_FLY_TOWARDS_PLAYER); - } - break; - case GAIBON_NEAR_DEATH: - switch (self->step_s) { - case GAIBON_NEAR_DEATH_SETUP: - self->animCurFrame = 9; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step_s++; +REDACTED /* fallthrough */ case GAIBON_NEAR_DEATH_FLOOR_HIT_WAIT: if (UnkCollisionFunc3(D_80181240) & 1) { PlaySfxPositional(NA_SE_EN_GAIBON_SCREAM); - SetSubStep(GAIBON_NEAR_DEATH_FLOOR_LANDING); - } - break; - case GAIBON_NEAR_DEATH_FLOOR_LANDING: - if (AnimateEntity(D_801812F0, self) == 0) { - self->ext.GS_Props.flag = 0; - SetSubStep(GAIBON_NEAR_DEATH_TRANSFORM); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { PlaySfxPositional(SFX_NOISE_SWEEP_DOWN_A); SetStep(GAIBON_DYING); @@ -495,9 +495,9 @@ void EntityGaibon(Entity* self) { } } break; - case GAIBON_NEAR_DEATH_TRANSFORM: - if (AnimateEntity(D_801812FC, self) == 0) { - self->ext.GS_Props.flag++; +REDACTED +REDACTED +REDACTED self->palette = D_80180D30[3] + self->ext.GS_Props.flag; if (self->ext.GS_Props.flag == 6) { self->flags &= ~0xF; @@ -507,9 +507,9 @@ void EntityGaibon(Entity* self) { break; } break; - case GAIBON_DYING: - switch (self->step_s) { - case GAIBON_DYING_REACT: +REDACTED +REDACTED +REDACTED if (AnimateEntity(D_80181304, self) == 0) { self->ext.GS_Props.timer = 96; self->animCurFrame = 0x1F; @@ -522,8 +522,8 @@ void EntityGaibon(Entity* self) { } while (0); } break; - case GAIBON_DYING_TURN_INTO_BONES: - if (!(self->ext.GS_Props.timer & 7)) { +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_GAIBON_FLAME); other = AllocEntity(&g_Entities[224], &g_Entities[256]); if (other != NULL) { @@ -536,35 +536,35 @@ void EntityGaibon(Entity* self) { } } if (!(--self->ext.GS_Props.timer)) { - g_BossFlag |= BOSS_FLAG_GAIBON_DEAD; - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED break; } break; // Unreachable debug mode case 0xFF: - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { +REDACTED +REDACTED if (self->params) { - break; - } - self->animCurFrame++; - self->params |= 1; - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { if (!self->step_s) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(self->flags & FLAG_DEAD)) { xVar = self->posX.i.hi + g_Tilemap.scrollX.i.hi; yVar = self->posY.i.hi + g_Tilemap.scrollY.i.hi; @@ -586,122 +586,122 @@ void EntityGaibon(Entity* self) { } } -void func_801B69E8(Entity* self) { - Entity* prevEntity; - s16 animCurFrame; - - if (self->step == 0) { - InitializeEntity(D_80180D30); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - } - - prevEntity = &self[-1]; +REDACTED +REDACTED +REDACTED self->facingLeft = prevEntity->facingLeft; - self->palette = prevEntity->palette; - self->posX.i.hi = prevEntity->posX.i.hi; - self->posY.i.hi = prevEntity->posY.i.hi; - self->animCurFrame = 0; - - if ((prevEntity->animCurFrame - 32) < 3U) { - self->animCurFrame = 0x26; - } else if (prevEntity->animCurFrame == 35) { - self->animCurFrame = 0x27; - } else if ((prevEntity->animCurFrame - 36) < 2U) { - self->animCurFrame = 0x28; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (prevEntity->entityId != E_GAIBON) { - DestroyEntity(self); - } -} +REDACTED +REDACTED +REDACTED // small red projectile from gaibon -void EntitySmallGaibonProjectile(Entity* self) { +REDACTED if (self->flags & FLAG_DEAD) { - self->pfnUpdate = EntityExplosion; +REDACTED self->drawFlags = 0; - self->step = 0; +REDACTED self->entityId = 2; - self->params = 0; - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180D3C); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->animSet = ANIMSET_DRA(2); - self->animCurFrame = 1; +REDACTED self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTZ; self->rotX = 0xC0; self->velocityX = (rcos(self->rotZ) * 0x28000) >> 0xC; self->velocityY = (rsin(self->rotZ) * 0x28000) >> 0xC; - self->palette = 0x81B6; +REDACTED self->rotZ -= 0x400; - - case 1: - MoveEntity(); - AnimateEntity(D_8018136C, self); - break; - } -} - -// large red projectile from gaibon -void EntityLargeGaibonProjectile(Entity* self) { - Entity* newEntity; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - self->pfnUpdate = EntityExplosion; +REDACTED self->entityId = 2; self->drawFlags = 0; - self->step = 0; - self->params = 1; - return; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(D_80180D48); - if (self->params == 0) { +REDACTED self->animSet = ANIMSET_DRA(2); self->drawFlags = FLAG_DRAW_ROTZ; self->velocityX = (rcos(self->rotZ) * 0x38000) >> 0xC; self->velocityY = (rsin(self->rotZ) * 0x38000) >> 0xC; - self->palette = 0x81B6; +REDACTED self->rotZ -= 0x400; - } else { +REDACTED self->animSet = ANIMSET_DRA(14); - self->unk5A = 0x79; +REDACTED self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTZ | FLAG_DRAW_UNK8; self->rotX = 0x100; - self->unk6C = 0x80; - self->palette = 0x81F3; +REDACTED +REDACTED self->drawMode = 0x30; - self->step = 2; +REDACTED self->hitboxState = 0; self->flags |= FLAG_UNK_2000; - } - break; - - case 1: - MoveEntity(); - AnimateEntity(D_80181378, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer & 3)) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_GAIBON_BIG_FIREBALL, self, newEntity); - newEntity->params = 1; +REDACTED +REDACTED +REDACTED +REDACTED newEntity->rotZ = self->rotZ; - newEntity->zPriority = self->zPriority + 1; - } - } - break; - - case 2: - self->unk6C += 0xFE; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotX -= 4; - if (AnimateEntity(D_80181388, self) == 0) { - DestroyEntity(self); - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/nz0/lifeupspawn.c b/src/st/nz0/lifeupspawn.c index 8e74eda8ba..f372550a15 100644 --- a/src/st/nz0/lifeupspawn.c +++ b/src/st/nz0/lifeupspawn.c @@ -21,9 +21,9 @@ void EntityLifeUpSpawn(Entity* self) { s32 k; s16 xVar; s16 yVar; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_EInitGeneric); self->animSet = 2; self->animCurFrame = 0; diff --git a/src/st/nz0/maria.c b/src/st/nz0/maria.c index c60d16c7a7..97a32b4141 100644 --- a/src/st/nz0/maria.c +++ b/src/st/nz0/maria.c @@ -1,50 +1,50 @@ #include "nz0.h" #include "sfx.h" -void func_801B8E0C(Entity* self) { - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED InitializeEntity(g_MariaInit); - D_8003C8B8 = 0; +REDACTED g_unkGraphicsStruct.unk0 = 1; g_Player.padSim = PAD_LEFT; if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) { g_Player.padSim = PAD_R2; - } +REDACTED g_Player.D_80072EFC = 1; - break; - - case 1: - if (PLAYER.posX.i.hi < 176) { +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - self->step++; - } else { +REDACTED +REDACTED g_Player.padSim = 0; if (g_Player.unk0C & PLAYER_STATUS_WOLF_FORM) { if (g_Timer & 1) { g_Player.padSim = PAD_R2; - } - } else { +REDACTED +REDACTED g_Player.padSim = PAD_LEFT; - } - } - g_Player.D_80072EFC = 1; - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_mariaCutsceneFlags & 0x2000) { - D_8003C8B8 = 1; +REDACTED if (g_unkGraphicsStruct.unk0 != 0) { g_unkGraphicsStruct.unk0 = 0; - } - DestroyEntity(self); - } +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - g_Player.D_80072EFC = 1; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Maria appearing in the cutscene. Walks in from the door on the left, talks // to Alucard, and departs to the right. void EntityMaria(Entity* self) { diff --git a/src/st/nz0/mariacutscene.c b/src/st/nz0/mariacutscene.c index 9ebc7ff99f..0d00cad720 100644 --- a/src/st/nz0/mariacutscene.c +++ b/src/st/nz0/mariacutscene.c @@ -5,76 +5,76 @@ // any NZ0 functions, besides the ones in this file. void func_801B74CC(void) { - g_Dialogue.nextLineX = 2; - g_Dialogue.nextCharX = 2; - g_Dialogue.nextCharY = 0; - g_Dialogue.unk12 = 0; - g_Dialogue.nextCharTimer = 0; - g_Dialogue.unk17 = 8; - g_Dialogue.nextLineY = g_Dialogue.startY + 0x14; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } -s32 func_801B7520(s32 textDialogue) { - Primitive* prim; - s16 firstPrimIndex; - - firstPrimIndex = g_api.AllocPrimitives(PRIM_SPRT, 7); - g_Dialogue.primIndex[2] = firstPrimIndex; - if (firstPrimIndex == -1) { - g_Dialogue.primIndex[2] = 0; - return 0; - } - g_Dialogue.nextCharDialogue = textDialogue; - g_Dialogue.unk3C = 0; - g_Dialogue.primIndex[1] = -1; - g_Dialogue.primIndex[0] = -1; - func_801B74CC(); - - if (prim && prim) { // !FAKE - } - - prim = g_Dialogue.prim[0] = &g_PrimBuf[g_Dialogue.primIndex[2]]; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[1] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[2] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[3] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[4] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[5] = prim->next; - - prim->type = 4; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 3; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0xFF; +REDACTED +REDACTED +REDACTED +REDACTED prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0; prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0; - prim->x0 = prim->x2 = 4; - prim->x1 = prim->x3 = 0xF8; - prim->priority = 0x1FD; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 1; - prim->x0 = 3; - prim->y0 = 0x2F; - prim->v0 = 0x4A; - prim->r0 = prim->g0 = prim->b0 = 0xFF; - prim->priority = 0x1FC; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - return 1; -} +REDACTED +REDACTED -void func_801B76E4(s16 arg0) { +REDACTED RECT rect; rect.y = (arg0 * 12) + 384; @@ -88,24 +88,24 @@ void func_801B7740(void) { Primitive* prim; func_801B76E4(g_Dialogue.nextCharY); - prim = g_Dialogue.prim[g_Dialogue.nextCharY]; +REDACTED prim->tpage = 0x10; - prim->clut = g_Dialogue.clutIndex; - prim->y0 = g_Dialogue.nextLineY; +REDACTED +REDACTED prim->u0 = 0; - prim->x0 = g_Dialogue.startX; +REDACTED prim->x0 = prim->x0 + 4; - prim->v0 = g_Dialogue.nextCharY * 0xC - 0x80; +REDACTED prim->u1 = 0xC0; prim->v1 = 0xC; prim->priority = 0x1FF; prim->drawMode = DRAW_DEFAULT; } - +REDACTED // Creates primitives for the actor name at the head of the dialogue void func_801B77F8(u16 actorIndex, Entity* self) { - Primitive* prim; - s16 primIndex; +REDACTED +REDACTED s32 x; u16 chCount; const char* actorName; @@ -136,7 +136,7 @@ void func_801B77F8(u16 actorIndex, Entity* self) { // Fill prims to render the actor name on screen prim = &g_PrimBuf[primIndex]; - g_Dialogue.primIndex[1] = primIndex; +REDACTED actorName = D_8018146C[actorIndex]; x = 0x38; while (prim != NULL) { @@ -154,55 +154,55 @@ void func_801B77F8(u16 actorIndex, Entity* self) { prim->priority = 0x1FF; prim->drawMode = DRAW_HIDE; prim->x0 = x; - prim->y0 = g_Dialogue.startY + 6; +REDACTED prim = prim->next; x += FONT_GAP; } } } - -void func_801B797C(s32 arg0) { - g_Dialogue.unk40 = arg0 + 0x100000; - g_Dialogue.timer = 0; - g_Dialogue.unk3C = 1; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801B79A8(void) { Entity* entity; u16 startTimer; u8 entityIndex; - g_Dialogue.timer++; +REDACTED // protect from overflows - if (g_Dialogue.timer > 0xFFFE) { - g_Dialogue.unk3C = 0; +REDACTED +REDACTED return; } while (true) { // Start the dialogue script only if the start timer has passed - startTimer = (*g_Dialogue.unk40++ << 8) | *g_Dialogue.unk40++; - if (g_Dialogue.timer < startTimer) { +REDACTED +REDACTED // Re-evaluate the condition at the next frame - g_Dialogue.unk40 -= 2; +REDACTED return; } - switch (*g_Dialogue.unk40++) { +REDACTED case 0: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); - entity->entityId = *g_Dialogue.unk40++; +REDACTED entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1]; - entity->posX.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posX.i.hi = *g_Dialogue.unk40++ | entity->posX.i.hi; - entity->posY.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posY.i.hi = *g_Dialogue.unk40++ | entity->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED break; case 1: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); break; @@ -219,35 +219,35 @@ void func_801B79A8(void) { } } } - +REDACTED // Animates the portrait size of the actor by enlarging or shrinking it -void func_801B7C54(u8 ySteps) { - Primitive* prim; - s32 primIndex; - s32 i; - - primIndex = g_Dialogue.nextCharY + 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED while (primIndex >= 5) { primIndex -= 5; } if (g_CurrentEntity->step_s == 0) { - prim = g_Dialogue.prim[primIndex]; +REDACTED prim->v1 -= ySteps; prim->v0 += ySteps; if (prim->v1 == 0) { g_CurrentEntity->step_s++; prim->drawMode = DRAW_HIDE; - } - } - - for (i = 0; i < 5; i++) { - if (i != primIndex) { - prim = g_Dialogue.prim[i]; - prim->y0 -= ySteps; - } - } - g_Dialogue.portraitAnimTimer++; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // cutscene where alucard and maria discuss castle changing void EntityMariaCutscene(Entity* self) { diff --git a/src/st/nz0/slogra.c b/src/st/nz0/slogra.c index 3c237895cd..bf4e0d6442 100644 --- a/src/st/nz0/slogra.c +++ b/src/st/nz0/slogra.c @@ -1,550 +1,550 @@ -#include "nz0.h" +REDACTED #include "sfx.h" - -#define GAIBON self[8] - -typedef enum { - SLOGRA_INIT, - SLOGRA_FLOOR_ALIGN, - SLOGRA_IDLE, - SLOGRA_TAUNT_WITH_SPEAR, - SLOGRA_SPEAR_POKE, - SLOGRA_SPEAR_FIRE, - SLOGRA_ATTACK, - SLOGRA_KNOCKBACK = 8, - SLOGRA_WALKING_WITH_SPEAR, - SLOGRA_TAUNT_WITHOUT_SPEAR, - SLOGRA_WALKING_WITHOUT_SPEAR, - SLOGRA_LOSE_SPEAR, - SLOGRA_GAIBON_COMBO_ATTACK, - SLOGRA_DYING = 16, - SLOGRA_DEBUG = 255, -} SlograSteps; - -typedef enum { - SLOGRA_FIRE_FACE_PLAYER, - SLOGRA_FIRE_PROJECTILE, - SLOGRA_FIRE_COOLDOWN, - SLOGRA_FIRE_END, -} SlograSpearFireSubSteps; - -typedef enum { - SLOGRA_COMBO_ATTACK_START, - SLOGRA_COMBO_ATTACK_PLUNGE, - SLOGRA_COMBO_ATTACK_COOLDOWN, -} SlograComboAttackSubSteps; - -typedef enum { - SLOGRA_KNOCKBACK_FLOOR_CHECK, - SLOGRA_KNOCKBACK_ACCEL, - SLOGRA_KNOCKBACK_ARC, -} SlograKnockbackSubSteps; - -typedef enum { - SLOGRA_DYING_START, - SLOGRA_DYING_EXPLODING, - SLOGRA_DYING_END, -} SlograDyingSubSteps; - -s32 EntitySlograSpecialCollision(u16* unused) { - /** - * This function keeps Slogra between safe - * boundaries of the room when he gets hit by the player. - * EntitySlogra passes D_8018105C to this function but it's unused - */ - s32 ret = 0; - s32 slograPosX; - - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_CurrentEntity->velocityY += FIX(0.25); slograPosX = g_CurrentEntity->posX.i.hi + g_Tilemap.scrollX.i.hi; - +REDACTED if (g_CurrentEntity->velocityX > 0 && slograPosX > 896) { g_CurrentEntity->posX.i.hi = 896 - g_Tilemap.scrollX.i.hi; - } - +REDACTED +REDACTED if (g_CurrentEntity->velocityX < 0 && slograPosX < 64) { g_CurrentEntity->posX.i.hi = 64 - g_Tilemap.scrollX.i.hi; - } - +REDACTED +REDACTED if (g_CurrentEntity->posY.i.hi + g_Tilemap.scrollY.i.hi > 416) { - ret = 1; +REDACTED g_CurrentEntity->posY.i.hi = 416 - g_Tilemap.scrollY.i.hi; g_CurrentEntity->velocityX = 0; g_CurrentEntity->velocityY = 0; - } - - return ret; -} - -void EntitySlogra(Entity* self) { - Entity* newEntity; - s32 entityOnFloor; - u8* animation; - s32 hitPoints; - s8* hitbox; - - self->ext.GS_Props.pickupFlag = 0; - - FntPrint("beri_flag %x\n", g_BossFlag); - - if (self->step >= SLOGRA_TAUNT_WITH_SPEAR) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->hitFlags & 3) && (self->step != SLOGRA_KNOCKBACK)) { - SetStep(SLOGRA_KNOCKBACK); - } - if (self->ext.GS_Props.nearDeath == false) { - hitPoints = g_api.enemyDefs[243].hitPoints; - if (hitPoints < 0) { - hitPoints += 3; - } - if ((self->hitPoints < (hitPoints >> 2)) && - (self->step != SLOGRA_LOSE_SPEAR)) { - SetStep(SLOGRA_LOSE_SPEAR); - } - } - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step != SLOGRA_DYING)) { - SetStep(SLOGRA_DYING); - } - - if (GAIBON.ext.GS_Props.grabedAscending) { - if (self->step != SLOGRA_DYING) { - if (self->step != SLOGRA_GAIBON_COMBO_ATTACK) { - SetStep(SLOGRA_GAIBON_COMBO_ATTACK); - } - } - } - - switch (self->step) { - case SLOGRA_INIT: - InitializeEntity(D_80180D0C); - CreateEntityFromCurrentEntity(E_SLOGRA_SPEAR, &self[1]); - - case SLOGRA_FLOOR_ALIGN: - if (EntitySlograSpecialCollision(D_8018105C) & 1) { - SetStep(SLOGRA_IDLE); - } - break; - - case SLOGRA_IDLE: - AnimateEntity(D_80181080, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags != 0) { - g_BossFlag |= BOSS_FLAG_FIGHT_BEGIN; - } - if (g_BossFlag & BOSS_FLAG_FIGHT_BEGIN) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } - break; - - case SLOGRA_TAUNT_WITH_SPEAR: - if (AnimateEntity(D_80181080, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } - break; - - case SLOGRA_WALKING_WITH_SPEAR: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - if (self->ext.GS_Props.attackMode != 0) { // shoot projectile ? - self->ext.GS_Props.flag = 1; - } else { - self->ext.GS_Props.flag = 0; - } - self->ext.GS_Props.timer = 128; - self->step_s++; - } - AnimateEntity(D_80181074, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - +REDACTED if (self->facingLeft != self->ext.GS_Props.flag) { self->velocityX = FIX(0.75); - } else { +REDACTED self->velocityX = FIX(-0.75); - } +REDACTED UnkCollisionFunc2(&D_8018106C); - if (self->ext.GS_Props.flag == 0) { +REDACTED if (GetDistanceToPlayerX() < 72) { - if (self->ext.GS_Props.attackMode == 0) { - self->ext.GS_Props.timer = 1; - } else { - self->ext.GS_Props.flag ^= 1; - } - } - } - if (self->ext.GS_Props.flag != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() > 112) { - if (self->ext.GS_Props.attackMode != 0) { - self->ext.GS_Props.timer = 1; - } else { - self->ext.GS_Props.flag ^= 1; - } - } - } - if (!(Random() % 64)) { - SetStep(SLOGRA_TAUNT_WITH_SPEAR); - } - if (--self->ext.GS_Props.timer == 0) { - if (self->ext.GS_Props.attackMode != 0) { - SetStep(SLOGRA_SPEAR_FIRE); - } else { - SetStep(SLOGRA_SPEAR_POKE); - } - - self->ext.GS_Props.attackMode ^= 1; - } - break; - - case SLOGRA_SPEAR_POKE: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_HISSING); - self->step_s++; - } - if (AnimateEntity(D_801810B4, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 4 && self->animFrameDuration == 0) { PlaySfxPositional(NA_SE_EN_SLOGRA_SPEAR_SLASH); - } - break; - - case SLOGRA_SPEAR_FIRE: - switch (self->step_s) { - case SLOGRA_FIRE_FACE_PLAYER: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->step_s++; - - case SLOGRA_FIRE_PROJECTILE: - if (AnimateEntity(D_8018108C, self) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_SPEAR_PROJECTILE); newEntity = AllocEntity(g_Entities + 160, g_Entities + 192); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity( E_SLOGRA_SPEAR_PROJECTILE, self, newEntity); if (self->facingLeft != 0) { - newEntity->posX.i.hi += 68; - } else { - newEntity->posX.i.hi -= 68; - } - newEntity->posY.i.hi -= 6; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->zPriority = self->zPriority + 1; - } - SetSubStep(SLOGRA_FIRE_COOLDOWN); - } - break; - - case SLOGRA_FIRE_COOLDOWN: - if (AnimateEntity(D_8018109C, self) == 0) { - SetSubStep(SLOGRA_FIRE_END); - } - break; - - case SLOGRA_FIRE_END: // go back to standing position - if (AnimateEntity(D_801810A8, self) == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - } - break; - } - break; - - case SLOGRA_KNOCKBACK: // Knocked up, Chance to get picked up by gaibon - switch (self->step_s) { - case SLOGRA_KNOCKBACK_FLOOR_CHECK: - if (EntitySlograSpecialCollision(D_8018105C) & 1) { - self->step_s++; - } - break; - - case SLOGRA_KNOCKBACK_ACCEL: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-4); if (!(GetSideToPlayer() & 1)) { self->velocityX = FIX(-0.5); - } else { +REDACTED self->velocityX = FIX(0.5); - } +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_HURT); - self->step_s++; - - case SLOGRA_KNOCKBACK_ARC: +REDACTED +REDACTED +REDACTED if (0x18000 > self->velocityY) { - self->ext.GS_Props.pickupFlag = 1; - } - entityOnFloor = EntitySlograSpecialCollision(D_8018105C); +REDACTED +REDACTED +REDACTED self->velocityY -= 0x2400; - if (self->ext.GS_Props.nearDeath != 0) { - animation = &D_80181114; - } else { - animation = &D_801810D4; - } - if (AnimateEntity(animation, self) == 0 && entityOnFloor & 1) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - if (self->ext.GS_Props.nearDeath != 0) { - SetStep(SLOGRA_TAUNT_WITHOUT_SPEAR); - } - } - } - break; - - case SLOGRA_LOSE_SPEAR: - entityOnFloor = EntitySlograSpecialCollision(D_8018105C); - if (AnimateEntity(D_801810E8, self) == 0) { - if (entityOnFloor & 1) { - SetStep(SLOGRA_TAUNT_WITHOUT_SPEAR); - } - } - if (self->animFrameIdx >= 2) { - self->ext.GS_Props.nearDeath = 1; - } - break; - - case SLOGRA_TAUNT_WITHOUT_SPEAR: - if (AnimateEntity(D_80181108, self) == 0) { - SetStep(SLOGRA_WALKING_WITHOUT_SPEAR); - } - break; - - case SLOGRA_WALKING_WITHOUT_SPEAR: - if (self->step_s == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->ext.GS_Props.flag = 1; - self->ext.GS_Props.timer = 128; - self->step_s++; - } - AnimateEntity(D_801810FC, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - +REDACTED if (!(self->facingLeft == self->ext.GS_Props.flag)) { self->velocityX = FIX(0.75); - } else { +REDACTED self->velocityX = FIX(-0.75); - } - +REDACTED +REDACTED UnkCollisionFunc2(&D_8018106C); - if (self->ext.GS_Props.flag == 0) { +REDACTED if (GetDistanceToPlayerX() < 72) { - self->ext.GS_Props.flag ^= 1; - } - if (self->ext.GS_Props.flag != 0) { +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() > 112) { - self->ext.GS_Props.flag ^= 1; - } - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED if (GetDistanceToPlayerX() > 112) { - self->ext.GS_Props.flag ^= 1; - } - } - if (!(Random() % 64)) { - SetStep(SLOGRA_TAUNT_WITHOUT_SPEAR); - } - if (--self->ext.GS_Props.timer == 0) { - SetStep(SLOGRA_ATTACK); - } - break; - - case SLOGRA_ATTACK: // Attack without spear - if (AnimateEntity(D_80181128, self) == 0) { - SetStep(SLOGRA_WALKING_WITHOUT_SPEAR); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 7 && self->animFrameDuration == 0) { PlaySfxPositional(NA_SE_EN_SLOGRA_BEAK_ATTACK); - } - break; - - case SLOGRA_GAIBON_COMBO_ATTACK: - switch (self->step_s) { - case SLOGRA_COMBO_ATTACK_START: // inmobilize, Gaibon picks him up - if (!GAIBON.ext.GS_Props.grabedAscending) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step_s++; - } - break; - - case SLOGRA_COMBO_ATTACK_PLUNGE: - if (self->ext.GS_Props.nearDeath != 0) { - AnimateEntity(D_80181140, self); - } else { - AnimateEntity(D_80181158, self); - } - - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.25); if (self->posY.i.hi + g_Tilemap.scrollY.i.hi > 416) { self->posY.i.hi = 416 - g_Tilemap.scrollY.i.hi; PlaySfxPositional(SFX_DOOR_CLOSE_A); // Slogra Floor Stomp - g_api.func_80102CD8(1); - self->ext.GS_Props.timer = 16; - self->step_s++; - } - break; - - case SLOGRA_COMBO_ATTACK_COOLDOWN: - if (--self->ext.GS_Props.timer == 0) { - SetStep(SLOGRA_WALKING_WITH_SPEAR); - if (self->ext.GS_Props.nearDeath != 0) { - SetStep(SLOGRA_WALKING_WITHOUT_SPEAR); - } - } - break; - } - break; - - case SLOGRA_DYING: - switch (self->step_s) { - case SLOGRA_DYING_START: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - if (self->ext.GS_Props.nearDeath == 0) { - self->ext.GS_Props.nearDeath = 1; - } - self->ext.GS_Props.timer = 64; +REDACTED +REDACTED +REDACTED +REDACTED PlaySfxPositional(NA_SE_EN_SLOGRA_DEATH_EXPLOSION); - self->step_s++; - - case SLOGRA_DYING_EXPLODING: - EntitySlograSpecialCollision(D_8018105C); - AnimateEntity(D_80181150, self); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (!(g_Timer % 4)) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->posX.i.hi -= 16 - (Random() & 31); - newEntity->posY.i.hi -= 16 - (Random() & 31); - newEntity->zPriority = self->zPriority + 1; - newEntity->params = 1; - } - } - - if (--self->ext.GS_Props.timer == 0) { - self->step_s++; - } - break; - - case SLOGRA_DYING_END: - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 3; - newEntity->posY.i.hi += 16; - } - g_BossFlag |= BOSS_FLAG_SLOGRA_DEAD; - DestroyEntity(self); - return; - } - break; - - case SLOGRA_DEBUG: - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - self->animCurFrame++; - self->params |= 1; - } else { - break; - } - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - } - } else { - self->step_s = 0; - } - break; - } - hitbox = &D_801811B8[self->animCurFrame][D_80181178]; - hitbox--; - hitbox++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = hitbox[0]; - self->hitboxHeight = hitbox[1]; -} - -void EntitySlograSpear(Entity* self) { - s8* hitbox; - - switch (self->step) { - case 0: - InitializeEntity(D_80180D18); - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = self[-1].facingLeft; - self->posX.i.hi = self[-1].posX.i.hi; - self->posY.i.hi = self[-1].posY.i.hi; - hitbox = D_801811E0; - hitbox += 4 * D_80181218[self[-1].animCurFrame]; +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxOffX = *hitbox++; self->hitboxOffY = *hitbox++; - self->hitboxWidth = *hitbox++; - self->hitboxHeight = *hitbox++; - if (self[-1].ext.GS_Props.nearDeath != 0) { - self->step++; - } - break; - - case 2: - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ; self->hitboxState = 0; if (self->facingLeft != 0) { self->velocityX = FIX(-2.25); - } else { +REDACTED self->velocityX = FIX(2.25); - } +REDACTED self->velocityY = FIX(-4); - self->animCurFrame = 0x23; +REDACTED self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA; - self->step_s++; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.15625); self->rotZ += 0x80; if (!(self->rotZ & 0xFFF)) { PlaySfxPositional(SFX_ARROW_SHOT_A); - } - } - } -} - -// projectile fired from slogra's spear -void EntitySlograSpearProjectile(Entity* self) { - Entity* entity; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - entity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (entity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, entity); - entity->params = 1; - } - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180D24); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-4); - } else { +REDACTED self->velocityX = FIX(4); - } - - case 1: - if (AnimateEntity(D_80181160, self) == 0) { - SetStep(SLOGRA_IDLE); - } - break; - - case 2: - MoveEntity(); - AnimateEntity(D_80181170, self); - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/rwrp/e_init.c b/src/st/rwrp/e_init.c index 87ca8dd352..f5258eeb19 100644 --- a/src/st/rwrp/e_init.c +++ b/src/st/rwrp/e_init.c @@ -19,7 +19,7 @@ PfnEntityUpdate PfnEntityUpdates[] = { /* 3FC */ (PfnEntityUpdate)EntitySoulStealOrb, /* 400 */ (PfnEntityUpdate)EntityRoomForeground, /* 404 */ (PfnEntityUpdate)EntityStageNamePopup, - /* 408 */ (PfnEntityUpdate)EntityEquipItemDrop, +REDACTED /* 40C */ (PfnEntityUpdate)EntityRelicOrb, /* 410 */ (PfnEntityUpdate)EntityHeartDrop, /* 414 */ (PfnEntityUpdate)EntityEnemyBlood, diff --git a/src/st/sel/2C048.c b/src/st/sel/2C048.c index 19f26c5430..e77ed66de1 100644 --- a/src/st/sel/2C048.c +++ b/src/st/sel/2C048.c @@ -154,13 +154,13 @@ void func_801B2D1C(void); void func_801B2D6C(void); void func_801B3120(void); -void SetupFileChoose(void) { +REDACTED g_MainMenuCursor = 1; - g_InputCursorPos = 0; +REDACTED D_801BC3E0 = 0; D_801D6B04 = 0; - g_MemCardSelectorX = 0; - g_MemCardSelectorY = 0; +REDACTED +REDACTED } void func_801AC084(s32 arg0, s32 ypos) { @@ -435,21 +435,21 @@ void MenuHideAllGfx(void) { static void InitMainMenuBackgroundAndFadeMask(void) { s16 primIndex; Primitive* prim; - s32 i; - +REDACTED +REDACTED // Seems to be the background on the main menu (dark blue/grey door thing?) primIndex = g_api.AllocPrimitives(PRIM_GT4, 3); prim = &g_PrimBuf[primIndex]; D_801BAFC0 = primIndex; - for (i = 0; i < 3; i++) { +REDACTED SetTexturedPrimRect(prim, i << 7, 0, 128, 240, 0, 0); func_801B1D88(prim); prim->tpage = i + 137; prim->clut = 0x210; prim->drawMode = DRAW_COLORS; prim = prim->next; - } - +REDACTED +REDACTED // When the main menu is loaded in, it is covered by a black mask that fades // away. This part creates the initial mask, then MainMenuFadeIn deals // with fading it out. @@ -464,9 +464,9 @@ static void InitMainMenuBackgroundAndFadeMask(void) { prim->priority = 0x1FD; prim->drawMode = DRAW_UNK_40 | DRAW_TPAGE | DRAW_TRANSP; prim = prim->next; - } -} - +REDACTED +REDACTED +REDACTED // On title screen, you press START. Then the screen goes black, // and fades in gradually. This function handles that fade. Returns false // as long as the fade-in is ongoing. @@ -480,7 +480,7 @@ static bool MainMenuFadeIn(void) { greyLevel -= 16; if (greyLevel < 0) { greyLevel = 0; - } +REDACTED SetPrimGrey(prim, greyLevel); prim = prim->next; @@ -488,37 +488,37 @@ static bool MainMenuFadeIn(void) { if (greyLevel != 0) { return false; - } else { +REDACTED // Once the greyLevel is exhaused, we hide them. prim = &g_PrimBuf[MainMenuMaskPrimIndex]; prim->drawMode = DRAW_HIDE; prim = prim->next; prim->drawMode = DRAW_HIDE; - } -} - -s32 func_801ACEC0(void) { +REDACTED +REDACTED +REDACTED +REDACTED Primitive* prim = &g_PrimBuf[MainMenuMaskPrimIndex]; s32 var_s0 = prim->r0; - - var_s0 += 0x10; +REDACTED +REDACTED prim->drawMode = 0x51; - - if (var_s0 > 255) { - var_s0 = 255; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SetPrimGrey(prim, var_s0); prim = prim->next; prim->drawMode = 0x51; SetPrimGrey(prim, var_s0); - - if (g_api.func_80131F68()) { - return 0; - } else { - return var_s0 == 255; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801ACF7C(void) { func_801B1ED0(); @@ -571,7 +571,7 @@ void PrintFileSelectPlaceName(s32 port, s32 slot, s32 y) { const s32 row1y = 0; const s32 row2y = 8; const s32 tge = 1; - volatile u32 pad; // !FAKE: +REDACTED s32 stage = g_SaveSummary[port].stage[slot]; DrawImages8x8(D_80180128[stage].line1, x, y + row1y, tge); @@ -680,10 +680,10 @@ void func_801AD490(void) { DrawNavigationTips(Tips_MenuNavigation); DrawImages8x8(STR_SELECT /* "select" */, 52, 188, 1); DrawImages8x8(STR_DECIDE /* "start" */, 52, 204, 1); - DrawString16x16("select", 240, 32, 1); - DrawString16x16("your", 256, 48, 1); - DrawString16x16("destiny", 232, 64, 1); - +REDACTED +REDACTED +REDACTED +REDACTED for (i = 0; i < NUM_MENU_OPTIONS; i++) { Primitive* prim = &g_PrimBuf[D_801BAF18[i + 1][0]]; if (i == g_MainMenuCursor) { @@ -699,7 +699,7 @@ const char* D_80180454[] = { "− Copy File −", "− Erase File −", }; void func_801AD590(void) { - if (g_pads[0].tapped & (PAD_RIGHT + PAD_DOWN)) { +REDACTED g_api.PlaySfx(SFX_UI_MP_FULL); // MP sfx also used for Main Menu Select if (++g_MainMenuCursor == 5) { g_MainMenuCursor = 1; @@ -717,27 +717,27 @@ void func_801AD590(void) { const char* D_80180468[] = { "richter ", }; -void func_801AD66C(void) { - s32 i; +REDACTED +REDACTED s32 nSpaces; char* strRichter; - +REDACTED // check if the name only contain spaces for (nSpaces = 0, i = 0; i < 8; i++) { - g_SaveName[i] = g_InputSaveName[i]; - if (g_InputSaveName[i] == ' ') { +REDACTED +REDACTED nSpaces++; - } - } - +REDACTED +REDACTED +REDACTED // if it only contain spaces, set a default name if (nSpaces == 8) { STRCPY(g_SaveName, "alucard "); - } - - D_80097B98 = 0; - D_80097B99 = 0; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // check if the name is Richter for (strRichter = D_80180468[0], i = 0; i < 8; i++) { if (g_SaveName[i] != *strRichter++) { @@ -747,15 +747,15 @@ void func_801AD66C(void) { if (g_IsTimeAttackUnlocked != SAVE_FLAG_NORMAL) { g_IsTimeAttackUnlocked = SAVE_FLAG_REPLAY; - } - +REDACTED +REDACTED // play as Richter only if the game was previously cleared if (i == 8 && g_IsTimeAttackUnlocked != SAVE_FLAG_NORMAL) { g_PlayableCharacter = PLAYER_RICHTER; - } else { +REDACTED g_PlayableCharacter = PLAYER_ALUCARD; - } -} +REDACTED +REDACTED void func_801AD78C(void) { DrawImages8x8(STR_SELECT, 0x134, 0x24, 1); @@ -780,100 +780,100 @@ void func_801AD78C(void) { DrawString16x16(g_InputSaveName, 0x80, 0x48, 1); } -void UpdateNameEntry(void) { +REDACTED if (g_pads[0].repeat & PAD_RIGHT) { g_api.PlaySfx(SFX_UI_MOVE); - D_801BC3E0 = (D_801BC3E0 & 0x18) | ((D_801BC3E0 + 1) & 7); - } - +REDACTED +REDACTED +REDACTED if (g_pads[0].repeat & PAD_DOWN) { g_api.PlaySfx(SFX_UI_MOVE); - D_801BC3E0 = ((D_801BC3E0 + 8) & 0x18) | (D_801BC3E0 & 7); - } - +REDACTED +REDACTED +REDACTED if (g_pads[0].repeat & PAD_LEFT) { g_api.PlaySfx(SFX_UI_MOVE); - D_801BC3E0 = (D_801BC3E0 & 0x18) | ((D_801BC3E0 - 1) & 7); - } - +REDACTED +REDACTED +REDACTED if (g_pads[0].repeat & PAD_UP) { g_api.PlaySfx(SFX_UI_MOVE); - D_801BC3E0 = ((D_801BC3E0 - 8) & 0x18) | (D_801BC3E0 & 7); - } - - if (g_pads[0].tapped & (PAD_R1 + PAD_R2)) { +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_UI_MP_FULL); - if (++g_InputCursorPos == 8) { - g_InputCursorPos = 0; - } - } - - if (g_pads[0].tapped & (PAD_L1 + PAD_L2)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_UI_MP_FULL); - if (--g_InputCursorPos == -1) { - g_InputCursorPos = 7; - } - } - - if (g_pads[0].tapped & PAD_CROSS) { // Input Character - g_api.PlaySfx(0x8CD); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_InputSaveName[g_InputCursorPos] = g_AsciiSet[D_801BC3E0]; - if (++g_InputCursorPos == 8) { - g_InputCursorPos = 0; - } - } - - if (g_pads[0].tapped & PAD_TRIANGLE) { // Backspace - if (--g_InputCursorPos == -1) { - g_InputCursorPos = 7; - } - g_InputSaveName[g_InputCursorPos] = ' '; - } -} - -void UpdateFileSelect(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED if (g_SaveSummary[0].padding >= 0 || g_SaveSummary[1].padding >= 0) { - if (g_pads[0].repeat & PAD_RIGHT) { // move selector to the right +REDACTED g_api.PlaySfx(SFX_UI_MOVE); - // clamp selector inside the 6 possible X coord positions - g_MemCardSelectorX = (g_MemCardSelectorX + 1) % 6; +REDACTED +REDACTED } - - if (g_pads[0].repeat & PAD_DOWN) { // move selector down +REDACTED +REDACTED g_api.PlaySfx(SFX_UI_MOVE); - // clamp selector inside the 5 possible Y coord positions - g_MemCardSelectorY = (g_MemCardSelectorY + 4) % 5; +REDACTED +REDACTED } - - if (g_pads[0].repeat & PAD_LEFT) { // move selector to the left +REDACTED +REDACTED g_api.PlaySfx(SFX_UI_MOVE); - // clamp selector inside the 6 possible X coord positions - g_MemCardSelectorX = (g_MemCardSelectorX + 5) % 6; +REDACTED +REDACTED } - - if (g_pads[0].repeat & PAD_UP) { // move selector up +REDACTED +REDACTED g_api.PlaySfx(SFX_UI_MOVE); - // clamp selector inside the 5 possible Y coord positions - g_MemCardSelectorY = (g_MemCardSelectorY + 1) % 5; +REDACTED +REDACTED } - +REDACTED if (g_SaveSummary[0].padding > 0 && g_SaveSummary[1].padding > 0 && - (g_pads[0].tapped & (PAD_L2 + PAD_R2 + PAD_L1 + PAD_R1))) { +REDACTED g_api.PlaySfx(SFX_UI_MP_FULL); - // clamp selector inside the 6 possible X coord positions - g_MemCardSelectorX = (g_MemCardSelectorX + 3) % 6; +REDACTED +REDACTED } - +REDACTED if (g_SaveSummary[0].padding < 0) { - g_MemCardSelectorX = (g_MemCardSelectorX % 3) + 3; +REDACTED } - +REDACTED if (g_SaveSummary[1].padding < 0) { - g_MemCardSelectorX %= 3; +REDACTED } - - D_801D6B04 = (g_MemCardSelectorX % 3) + (g_MemCardSelectorY * 3) + - ((g_MemCardSelectorX / 3) * 0xF); +REDACTED +REDACTED +REDACTED } } @@ -1042,43 +1042,43 @@ void func_801AE6D0(void) { extern s32 g_MenuHeadGfxU[]; extern s32 g_MenuHeadGfxV[]; -void func_801AE9A8(void) { - s32 i; - +REDACTED +REDACTED +REDACTED MenuHideAllGfx(); - func_801ACBE4(0, 0); - +REDACTED +REDACTED for (i = 1; i < NUM_MENU_OPTIONS; i++) { - func_801ACBE4(i + 1, 4); +REDACTED SetTexturedPrimRect( &g_PrimBuf[D_801BAF18[i + 1][0]], (i * 64) - 32, (i * 5) * 8, 127, 31, g_MenuHeadGfxU[i], g_MenuHeadGfxV[i]); - } - - DrawNavigationTips(0); - func_801ACBE4(0x11, 0); -} - -void func_801AEA8C(s32 arg0) { - g_InputCursorPos = 0; - D_801BC3E0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED MenuHideAllGfx(); - func_801ACBE4(7, 0x11); - func_801ACBE4(8, 0); - func_801ACBE4(9, 0x11); - func_801ACBE4(10, 0); +REDACTED +REDACTED +REDACTED +REDACTED - if (arg0 == 0) { - func_801ACBE4(1, 0); +REDACTED +REDACTED SetPrimRect(&g_PrimBuf[D_801BAF18[GFX_UNK_1][0]], 24, 24, 127, 31); } else { func_801ACBE4(3, 0); SetPrimRect( &g_PrimBuf[D_801BAF18[GFX_FILE_DELETE][0]], 24, 24, 127, 31); - } - - DrawNavigationTips(1); -} +REDACTED +REDACTED +REDACTED +REDACTED void SelectMainMenuOption(MainMenuCursor cursor) { Primitive* prim; @@ -1117,13 +1117,13 @@ void SelectMainMenuOption(MainMenuCursor cursor) { void func_801AECA0(void) { s32 i = 0; s32 x; - s32 y = 256; - s32 w = 16; - s32 h = 48; - s32 xnext = 384; +REDACTED +REDACTED +REDACTED +REDACTED u_long** pix = g_saveIconTexture; - for (; i < 16; i++) { +REDACTED s32 tmp = 4; x = xnext; xnext += tmp; @@ -1419,10 +1419,10 @@ void SEL_Update(void) { D_801BAF0C = 0x2FF; } if (g_SaveSummary[0].padding < 0) { - g_MemCardSelectorX = (g_MemCardSelectorX % 3) + 3; +REDACTED } if (g_SaveSummary[1].padding < 0) { - g_MemCardSelectorX %= 3; +REDACTED } if (D_801BAF10) { func_801B2608("You won’t be able to save", 4); @@ -1543,10 +1543,10 @@ void SEL_Update(void) { case Upd_Eng_146: func_801ACBE4(GFX_UNK_15, 0); if (g_SaveSummary[0].padding < 0) { - g_MemCardSelectorX = (g_MemCardSelectorX % 3) + 3; +REDACTED } if (g_SaveSummary[1].padding < 0) { - g_MemCardSelectorX %= 3; +REDACTED } func_801AEE74(); if (D_801BAF10) { @@ -1705,10 +1705,10 @@ void SEL_Update(void) { break; case Upd_Eng_82: if (g_SaveSummary[0].padding < 0) { - g_MemCardSelectorX = (g_MemCardSelectorX % 3) + 3; +REDACTED } if (g_SaveSummary[1].padding < 0) { - g_MemCardSelectorX %= 3; +REDACTED } func_801AEE74(); if (D_801BAF10) { @@ -1891,10 +1891,10 @@ void SEL_Update(void) { break; case Upd_Eng_114: if (g_SaveSummary[0].padding < 0) { - g_MemCardSelectorX = (g_MemCardSelectorX % 3) + 3; +REDACTED } if (g_SaveSummary[1].padding < 0) { - g_MemCardSelectorX %= 3; +REDACTED } func_801AEE74(); if (D_801BAF10) { @@ -2197,12 +2197,12 @@ void func_801B17C8(void) { g_MenuStep++; } break; - +REDACTED case 1: func_801B3A54(D_80097924, D_8006C378); g_MenuStep++; break; - +REDACTED case 2: D_800978C4 = 0; if (func_801B3A94(1) != 0) { @@ -2326,12 +2326,12 @@ void func_801B1D68(Primitive* prim) { SetPrimGrey(prim, 0); } void func_801B1D88(Primitive* prim) { SetPrimGrey(prim, 0x80); } -void func_801B1DA8(void) { - s32 index = 0; - s32 i, j; - - for (i = 0xF0; i < 0x100; i++) { - for (j = 0x200; j < 0x300; j += 0x10) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[index++] = GetClut(j, i); } } @@ -2360,8 +2360,8 @@ void func_801B1ED0(void) { u8 func_801B1EF4(u8 arg0) { if (arg0 & 0x80) { return func_801B1EF4((arg0 & 0x7F) + 3); - } else { - return (arg0 * 0x10) & 0xF0; +REDACTED +REDACTED } } diff --git a/src/st/sel/3410C.c b/src/st/sel/3410C.c index 3be0685272..738da889f7 100644 --- a/src/st/sel/3410C.c +++ b/src/st/sel/3410C.c @@ -291,7 +291,7 @@ void HandleTitleScreen(void) { void func_801B4B9C(Entity* entity, s16 step) { entity->step = step; - entity->step_s = 0; +REDACTED entity->animFrameIdx = 0; entity->animFrameDuration = 0; } @@ -336,120 +336,120 @@ void func_801B4C68(void) { void func_801B4D78(void) { Entity* e = &g_Entities[UNK_ENTITY_3]; - +REDACTED if (e->step == 0) { e->animSet = ANIMSET_OVL(1); e->animCurFrame = 1; e->palette = 0x200; - e->ext.generic.unk80.modeS32 = 0x5C0000; - e->posY.i.hi = 208; +REDACTED +REDACTED e->zPriority = 0x80; e->step = 1; } } -void func_801B4DE0(void) { +REDACTED Entity* unkEntity = &g_Entities[UNK_ENTITY_2]; s16 primIndex; - POLY_GT4* poly; - - switch (unkEntity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_G4, 1); if (primIndex != -1) { poly = &g_PrimBuf[primIndex]; unkEntity->primIndex = primIndex; unkEntity->flags |= FLAG_HAS_PRIMS; - *(s32*)&unkEntity->ext.generic.unk7C = poly; - - poly->x1 = poly->x3 = 255; - poly->y0 = poly->y1 = 4; - poly->y2 = poly->y3 = 228; - - poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = - poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = - poly->b3 = 255; - - poly->pad2 = 0xC8; - poly->x0 = poly->x2 = 0; - poly->pad3 = 81; - D_801BC3E4 = 0; - unkEntity->step++; - } - break; - - case 1: - poly = *(s32*)&unkEntity->ext.generic.unk7C; - if (D_801BC3E4 != 0) { - poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = poly->g2 = - poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 = - poly->r0 = poly->b3 - 2; - if (poly->r0 < 5) { - D_801BC3E4 = 0; - unkEntity->step++; - } - } - break; - - case 2: - poly = *(s32*)&unkEntity->ext.generic.unk7C; - if (D_801BC3E4 != 0) { - poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = poly->g2 = - poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 = - poly->r0 = poly->b3 + 1; - if (poly->r0 >= 254) { - D_801BC3E4 = 0; - unkEntity->step++; - } - } - } -} - -void func_801B4FFC(void) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED Entity* unkEntity = &g_Entities[UNK_ENTITY_2]; s16 primIndex; - POLY_GT4* poly; - - switch (unkEntity->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_G4, 1); if (primIndex != -1) { poly = &g_PrimBuf[primIndex]; unkEntity->primIndex = primIndex; unkEntity->flags |= FLAG_HAS_PRIMS; - *(s32*)&unkEntity->ext.generic.unk7C = poly; - - poly->x1 = poly->x3 = 384; - poly->y0 = poly->y1 = 4; - poly->y2 = poly->y3 = 228; - - poly->r0 = poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = - poly->g2 = poly->g3 = poly->b0 = poly->b1 = poly->b2 = - poly->b3 = poly->x0 = poly->x2 = 0; - - poly->pad2 = 0xC8; - poly->pad3 = 0x51; - - unkEntity->step++; - } - break; - - case 1: - poly = *(s32*)&unkEntity->ext.generic.unk7C; - if (D_801BC3E4 != 0) { - poly->r1 = poly->r2 = poly->r3 = poly->g0 = poly->g1 = poly->g2 = - poly->g3 = poly->b0 = poly->b1 = poly->b2 = poly->b3 = - poly->r0 = poly->b3 + 2; - if (poly->r0 >= 254) { - D_801BC3E4 = 0; - unkEntity->step++; - } - } - - case 2: - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801B519C(void) { Entity* self; @@ -516,35 +516,35 @@ void func_801B519C(void) { void func_801B5350(void) { Entity* entity = &g_Entities[UNK_ENTITY_5]; - +REDACTED switch (entity->step) { case 0: entity->animSet = ANIMSET_DRA(1); entity->animCurFrame = 142; - entity->ext.generic.unk80.modeS32 = 0x800000; - entity->posY.i.hi = 159; +REDACTED +REDACTED entity->zPriority = 0xC0; entity->unk5A = 0; entity->palette = 0x8100; entity->step = 1; break; - +REDACTED case 1: entity->animCurFrame = 142; break; - +REDACTED case 2: if (!(AnimateEntity(D_80180528, entity) & 0xFF)) { func_801B4B9C(entity, 3); } - entity->ext.generic.unk80.modeS32 += 0xFFFE8000; +REDACTED break; - +REDACTED case 3: AnimateEntity(D_80180504, entity); - entity->ext.generic.unk80.modeS32 += 0xFFFE8000; - if (entity->ext.generic.unk80.modeS16.unk2 < 0x40) { - entity->step = 255; +REDACTED +REDACTED +REDACTED } break; } @@ -552,14 +552,14 @@ void func_801B5350(void) { void func_801B54C8(void) { Entity* e = &g_Entities[UNK_ENTITY_7]; - +REDACTED if (e->step == 0) { e->animSet = ANIMSET_OVL(2); e->animCurFrame = 38; e->facingLeft = 1; e->unk5A = 0xF; - e->ext.generic.unk80.modeS32 = 0x780000; - e->posY.i.hi = 158; +REDACTED +REDACTED e->zPriority = 0xC0; e->palette = 0x8210; e->step = 1; @@ -568,13 +568,13 @@ void func_801B54C8(void) { void func_801B5548(void) { Entity* e = &g_Entities[UNK_ENTITY_7]; - +REDACTED if (e->step == 0) { e->animSet = ANIMSET_OVL(2); e->animCurFrame = 7; e->unk5A = 0xF; - e->ext.generic.unk80.modeS32 = 0x780000; - e->posY.i.hi = 158; +REDACTED +REDACTED e->zPriority = 0xC0; e->palette = 0x8210; e->facingLeft = 0; diff --git a/src/st/sel/3585C.c b/src/st/sel/3585C.c index 0ade8aa847..b61a4e0e1b 100644 --- a/src/st/sel/3585C.c +++ b/src/st/sel/3585C.c @@ -6,30 +6,30 @@ extern u8 D_80180554[]; // more animation frames void func_801B585C(u16 arg0) { Entity* e = &g_Entities[UNK_ENTITY_5]; - - switch (e->step) { +REDACTED +REDACTED case 0: e->animSet = ANIMSET_DRA(1); - e->posY.i.hi = 159; +REDACTED e->zPriority = 0xC0; e->animCurFrame = 0; e->unk5A = 0; - e->ext.generic.unk80.entityPtr = NULL; +REDACTED e->palette = 0x8100; - e->step++; +REDACTED break; case 1: AnimateEntity(D_80180504, e); if (D_801BC3E8 & 4) { - e->step++; +REDACTED } break; case 2: AnimateEntity(D_80180504, e); - e->ext.generic.unk80.modeS32 += 0x18000; - if (e->ext.generic.unk80.modeS16.unk2 >= 0x49) { +REDACTED +REDACTED func_801B4B9C(e, 3); } break; @@ -49,18 +49,18 @@ void func_801B585C(u16 arg0) { case 5: e->facingLeft = 1; - if (!(AnimateEntity(D_80180528, e) & 0xFF)) { +REDACTED func_801B4B9C(e, 6); } - e->ext.generic.unk80.modeS32 += 0xFFFE8000; - break; +REDACTED +REDACTED case 6: AnimateEntity(D_80180504, e); - e->ext.generic.unk80.modeS32 += 0xFFFE8000; - if (arg0 && e->ext.generic.unk80.modeS16.unk2 < 0x20 || - !arg0 && e->ext.generic.unk80.modeS16.unk2 < -0x10) { - e->step = 255; +REDACTED +REDACTED +REDACTED +REDACTED } break; } @@ -78,7 +78,7 @@ void func_801B5A7C(void) { // Not sure where this entity is initialized... Entity* e = &g_Entities[8]; - switch (e->params) { +REDACTED case 0: switch (e->step) { case 0: @@ -371,7 +371,7 @@ void func_801B60D4(void) { D_801D6B24 = 0; D_801BD030 = 0; - g_Entities[8].params = D_800978B4 - 1; +REDACTED g_api.func_800EA5E4(ANIMSET_DRA(0x16)); g_api.func_800EA5E4(ANIMSET_DRA(0)); g_api.func_800EA5E4(ANIMSET_OVL(5)); @@ -393,8 +393,8 @@ void func_801B60D4(void) { if (var_v1 < 0) { var_v1 += 0xFFFF; } - ent->posX.i.hi = - (s16)(var_v1 >> 0x10) + ent->ext.generic.unk80.modeS16.unk2; +REDACTED +REDACTED ent++; } diff --git a/src/st/sel/3642C.c b/src/st/sel/3642C.c index 1eb4816bfe..6432f2a46e 100644 --- a/src/st/sel/3642C.c +++ b/src/st/sel/3642C.c @@ -1,37 +1,37 @@ #include "sel.h" void func_801B642C(void) { - g_Dialogue.nextLineX = 2; - g_Dialogue.nextCharX = 2; - g_Dialogue.nextCharY = 0; - g_Dialogue.unk12 = 0; - g_Dialogue.nextCharTimer = 0; - g_Dialogue.unk17 = 8; - g_Dialogue.nextLineY = g_Dialogue.startY + 0x14; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } u8 func_801B6480(const char* textDialogue) { - Primitive* prim; - s16 firstPrimIndex; - - firstPrimIndex = g_api.AllocPrimitives(PRIM_SPRT, 7); - g_Dialogue.primIndex[2] = firstPrimIndex; - if (firstPrimIndex == -1) { - g_Dialogue.primIndex[2] = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED return false; } - g_Dialogue.nextCharDialogue = textDialogue; - g_Dialogue.unk3C = 0; - g_Dialogue.primIndex[1] = -1; - g_Dialogue.primIndex[0] = -1; +REDACTED +REDACTED +REDACTED +REDACTED func_801B642C(); //! FAKE: if (prim && prim) { - } - - prim = g_Dialogue.prim[0] = &g_PrimBuf[g_Dialogue.primIndex[2]]; - +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; prim = g_Dialogue.prim[1] = prim->next; @@ -56,9 +56,9 @@ u8 func_801B6480(const char* textDialogue) { prim->b2 = prim->b3 = 0; prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0; prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0; - prim->x0 = prim->x2 = 4; - prim->x1 = prim->x3 = 0xF8; - prim->priority = 0x1FD; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; prim = prim->next; @@ -73,27 +73,27 @@ u8 func_801B6480(const char* textDialogue) { } void func_801B6648(s16 yOffset) { - RECT rect; - - rect.y = (yOffset * 12) + 384; - rect.w = 64; - rect.x = 0; - rect.h = 12; - ClearImage(&rect, 0, 0, 0); -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801B66A4(void) { Primitive* prim; func_801B6648(g_Dialogue.nextCharY); - prim = g_Dialogue.prim[g_Dialogue.nextCharY]; +REDACTED prim->tpage = 0x10; - prim->clut = g_Dialogue.clutIndex; - prim->y0 = g_Dialogue.nextLineY; +REDACTED +REDACTED prim->u0 = 0; - prim->x0 = g_Dialogue.startX; +REDACTED prim->x0 = prim->x0 + 4; - prim->v0 = g_Dialogue.nextCharY * 0xC - 0x80; +REDACTED prim->u1 = 0xC0; prim->v1 = 0xC; prim->priority = 0x1FF; @@ -177,7 +177,7 @@ void func_801B675C(u16 actorIndex, Entity* self) { // Fill prims to render the actor name on screen prim = &g_PrimBuf[primIndex]; - g_Dialogue.primIndex[1] = primIndex; +REDACTED actorName = g_DiagActors[actorIndex]; x = 0x38; while (prim != NULL) { @@ -195,7 +195,7 @@ void func_801B675C(u16 actorIndex, Entity* self) { prim->priority = 0x1FF; prim->drawMode = DRAW_HIDE; prim->x0 = x; - prim->y0 = g_Dialogue.startY + 6; +REDACTED prim = prim->next; x += FONT_GAP; } @@ -203,38 +203,38 @@ void func_801B675C(u16 actorIndex, Entity* self) { } void func_801B68E0(s32 arg0) { - g_Dialogue.unk40 = arg0 + 0x100000; - g_Dialogue.timer = 0; - g_Dialogue.unk3C = 1; +REDACTED +REDACTED +REDACTED } -void func_801B690C(u8 ySteps, Entity* self) { - s32 primIndex = g_Dialogue.nextCharY + 1; - Primitive* prim; - s32 i; - - while (primIndex >= 5) { - primIndex -= 5; - } - - if (self->step_s == 0) { - prim = g_Dialogue.prim[primIndex]; - prim->v1 -= ySteps; - prim->v0 = ySteps + prim->v0; - if (prim->v1 == 0) { - self->step_s++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 8; - } - } - - for (i = 0; i < 5; i++) { - if (i != primIndex) { - prim = g_Dialogue.prim[i]; - prim->y0 -= ySteps; - } - } - g_Dialogue.portraitAnimTimer++; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED // Strong resemblence to NZ0 EntityMariaCutscene and others void func_801B69F8(Entity* entity) { diff --git a/src/st/st0/27D64.c b/src/st/st0/27D64.c index 864d1f2cf7..8fa57e2262 100644 --- a/src/st/st0/27D64.c +++ b/src/st/st0/27D64.c @@ -1,35 +1,35 @@ #include "st0.h" #include "sfx.h" -void func_801A7D64(Entity* self) { +REDACTED s32 temp_v0; ObjInit* obj = &D_80180638[self->params]; - if (self->step == 0) { +REDACTED InitializeEntity(g_eInitGeneric2); self->animSet = obj->animSet; self->zPriority = obj->zPriority; self->unk5A = obj->unk5A; - self->palette = obj->palette; +REDACTED self->drawFlags = obj->drawFlags; self->drawMode = obj->drawMode; - if (obj->unkC != 0) { - self->flags = obj->unkC; +REDACTED +REDACTED } } - AnimateEntity(obj->unk10, self); +REDACTED } -bool func_801A7E2C(Entity* self) { - s16 diffX = PLAYER.posX.i.hi - self->posX.i.hi; +REDACTED +REDACTED diffX = abs(diffX); - if (self->hitboxWidth >= diffX) { - diffX = PLAYER.posY.i.hi - self->posY.i.hi; +REDACTED +REDACTED diffX = abs(diffX); return self->hitboxHeight >= diffX; - } else { - return false; +REDACTED +REDACTED } } @@ -93,286 +93,286 @@ void EntityLockCamera(Entity* self) { } } -void func_801A805C(Entity* self) { - Entity* newEntity; - s32 entityCount; - u16* paramsPtr; - u16 params_; - u16* temp; - s16 posY; - s32 i; - u16 params = self->params >> 0xC; - - if (self->step != 0) { - AnimateEntity(D_801806D0[params], self); - if (self->unk44 != 0) { - params_ = params - 2; - if (params_ < 2) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = GetSideToPlayer() & 1; - posY = self->posY.i.hi - 40; - - if (params == 2) { - entityCount = 4; - } else { - entityCount = 3; - } - - if (params == 3) { - temp = &D_80180770[10]; - } else { - temp = &D_80180770; - } - - for (i = 0, paramsPtr = temp; i < entityCount; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_ID_26, self, newEntity); - newEntity->posY.i.hi = posY; - newEntity->params = *paramsPtr; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - } - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->posY.i.hi = posY; - newEntity->params = 0; - } - posY += 16; - paramsPtr++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_CANDLE_HIT_WHOOSH_B); - } else { - if (params == 9) { - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { - CreateEntityFromCurrentEntity(E_ID_26, newEntity); - newEntity->params = 0x100; - } - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_GLASS_BREAK_E); - } - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_EXPLOSION, newEntity); - newEntity->params = D_80180704[params]; - } - ReplaceBreakableWithItemDrop(self); - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_eBreakableInit); self->zPriority = g_unkGraphicsStruct.g_zEntityCenter - 0x14; self->drawMode = D_8018074C[params]; - self->hitboxHeight = D_801806F8[params]; - self->animSet = D_80180724[params]; - self->unk5A = D_80180738[params]; - self->palette = D_80180710[params]; - self->hitboxOffY = D_80180758[params]; - } -} - -// Entity ID: 0x26 -void func_801A8328(Entity* self) { - s16 firstPrimIndex; - Entity* newEntity; - Collider collider; - Primitive* prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 velX; - s16 temp2; - - switch (self->step) { - case 0: - if (self->params & 0x100) { - InitializeEntity(D_801805D4); - self->animSet = ANIMSET_OVL(4); - self->unk5A = 0x5B; - self->palette = 0x212; - self->animCurFrame = 0x15; - self->zPriority = 0x6A; - self->step = 256; - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED InitializeEntity(g_InitializeEntityData0); - firstPrimIndex = g_api.AllocPrimitives(PRIM_GT4, 2); - if (firstPrimIndex != -1) { - prim = &g_PrimBuf[firstPrimIndex]; - self->primIndex = firstPrimIndex; - LOW(self->ext.generic.unk7C.s) = prim; - self->flags |= FLAG_HAS_PRIMS; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPolyFunc2(prim); - prim->tpage = 0x16; - prim->clut = 0x216; - prim->u0 = prim->u2 = 0x98; - prim->u1 = prim->u3 = 0xA7; - temp2 = (self->params * 16) - 124; - prim->v2 = prim->v3 = temp2 + 15; - prim->v0 = prim->v1 = temp2; - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; - LOH(prim->next->r2) = 0x10; - LOH(prim->next->b2) = 0x10; - prim->next->b3 = 0x80; - prim->priority = self->zPriority; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 2; velX = ((Random() & 7) << 0xC) + 0x8000; self->velocityX = velX; if (self->facingLeft == 0) { self->velocityX = -velX; - } +REDACTED self->velocityY = ((Random() & 7) << 0xC) - 0x8000; - } else { - DestroyEntity(self); - break; - } - - case 1: - MoveEntity(); - - prim = LOW(self->ext.generic.unk7C.s); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); - prim->next->x1 = self->posX.i.hi; - prim->next->y0 = self->posY.i.hi; - +REDACTED +REDACTED +REDACTED if (self->facingLeft != 0) { - prim->next->tpage += 0x10; - } else { - prim->next->tpage -= 0x10; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED UnkPrimHelper(prim); - +REDACTED g_api.CheckCollision( self->posX.i.hi, (s16)(self->posY.i.hi + 8), &collider, 0); - if (collider.effects & EFFECT_SOLID) { - g_api.PlaySfx(0x691); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED CreateEntityFromCurrentEntity(E_EXPLOSION, newEntity); - newEntity->params = 0; - } - DestroyEntity(self); - break; - } - } -} - -void func_801A8620(Entity* entity) { - s16 dist; - s32 params = (s16)entity->params; - - FntPrint("set:%04x\n", params); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED + +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED FntPrint("sx:%04x\n", g_Tilemap.left); FntPrint("ex:%04x\n", g_Tilemap.right); - - switch (entity->step) { +REDACTED +REDACTED case 0: InitializeEntity(g_eInitGeneric2); entity->animSet = ANIMSET_DRA(2); entity->animCurFrame = 1; - entity->zPriority = 0xB0; - break; - - case 1: - dist = entity->posY.i.hi - PLAYER.posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED dist = abs(dist); - - if (dist < 0x20) { - switch (params) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX > 0x280) { g_Tilemap.width = 0x280; g_Tilemap.right--; - entity->step++; - } - break; - - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX < 0x180) { g_Tilemap.x = 0x180; g_Tilemap.left++; - entity->step++; - } - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX < 0x100) { g_Tilemap.x = 0x100; g_Tilemap.left++; - entity->step++; - } - break; - - case 5: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX < 0x80) { g_Tilemap.x = 0x80; - entity->step++; - } - break; - - case 6: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX > 0x480) { g_Tilemap.width = 0x480; - entity->step++; - } - break; - - case 7: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX > 0x480) { g_Tilemap.width = 0x480; - entity->step++; - } - break; - - case 8: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX < 0x80) { g_Tilemap.x = 0x80; - entity->step++; - } - break; - - case 9: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX > 0x280) { g_Tilemap.width = 0x280; - entity->step++; - } - break; - - case 10: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX < 0x180) { g_Tilemap.x = 0x180; g_Tilemap.left++; - entity->step++; - } - break; - - case 11: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX > 0x280) { g_Tilemap.width = 0x280; g_Tilemap.right--; - entity->step++; - } - break; - - case 12: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX < 0x180) { g_Tilemap.x = 0x180; g_Tilemap.left++; - entity->step++; - } - break; - - case 2: - case 4: - case 13: - case 14: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_PlayerX > 0x300) { g_Tilemap.width = 0x300; g_Tilemap.right--; - entity->step++; - } - break; - } - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/st0/2A218.c b/src/st/st0/2A218.c index 65d34b8aa3..7fd7a74832 100644 --- a/src/st/st0/2A218.c +++ b/src/st/st0/2A218.c @@ -1,213 +1,213 @@ -#include "st0.h" - -void func_801AA218(s16 arg0) { - s16 temp_a1 = ((0xE0 - arg0) / 2) + 0x80; +REDACTED +REDACTED +REDACTED +REDACTED s16 temp_v1 = temp_a1 - g_unkGraphicsStruct.unkC; - - if (temp_v1 >= 3) { +REDACTED +REDACTED g_unkGraphicsStruct.unkC += 2; - } else if (temp_v1 < -2) { +REDACTED g_unkGraphicsStruct.unkC -= 2; - } else { +REDACTED g_unkGraphicsStruct.unkC = temp_a1; - } -} - -void EntityCutscene(Entity* self) { +REDACTED +REDACTED +REDACTED +REDACTED Tilemap* tilemap = &g_Tilemap; - Entity* player = &PLAYER; - u16 posX; - - self->posX.i.hi = player->posX.i.hi; - self->posY.i.hi = player->posY.i.hi - 1; - - if ((self->step != 14) && (D_801C24C8 != 0) && (D_801C2580 != 0) && - (self->step >= 5)) { - self->step = 15; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->animSet = ANIMSET_DRA(0); - self->animCurFrame = 0; - } - - switch (self->step) { - case 0: - InitializeEntity(D_80180598); - self->unk5A = 0x46; - self->palette = 0x120; - break; - - case 1: - if (self->step_s != 0) { - if ((player->step < 3) || (player->step == 25)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = player->posX.i.hi + tilemap->scrollX.i.hi; - if (posX > 0x8000) { - posX = 0; - } - if (posX > 0xA0) { +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = PAD_LEFT; - } else { +REDACTED g_Player.padSim = PAD_RIGHT; - } - g_Entities[1].ext.generic.unk7C.S8.unk0 = 1; - g_Player.D_80072EFC = 0xFF; - func_801AA218(posX); - SetStep(2); - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((player->posX.i.hi + tilemap->scrollX.i.hi) < 0xE1) { - D_8003C8B8 = 0; - self->step_s++; - } - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = player->posX.i.hi + tilemap->scrollX.i.hi; - if (posX > 0x8000) { - posX = 0; - } - +REDACTED +REDACTED +REDACTED +REDACTED if ((g_Player.padSim == 0x8000) && (posX <= 0xA0) || (g_Player.padSim == 0x2000) && (posX >= 0x9F)) { - g_Player.D_80072EFC = 1; +REDACTED g_Player.padSim = PAD_LEFT; - self->ext.generic.unk7C.s = 0x18; - D_801C257C |= 1; - self->step++; - } - func_801AA218(posX); - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = player->posX.i.hi + tilemap->scrollX.i.hi; - if (posX > 0x8000) { - posX = 0; - } - func_801AA218(posX); - g_Player.D_80072EFC = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - if (!--self->ext.generic.unk7C.u) { - SetStep(4); - } - break; - - case 4: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_80180830, self) == 0) { - self->step++; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.width = 0x100; - } - player->animCurFrame = self->animCurFrame; - break; - - case 5: - g_Player.D_80072EFC = 1; - player->animCurFrame = self->animCurFrame; - if (D_801C257C & 0x400) { - player->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->animSet = ANIMSET_OVL(5); - self->animCurFrame = 1; - SetStep(6); - } - break; - - case 6: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_8018083C, self) == 0) { - if (D_801C257C & 0x800) { - SetStep(7); - } - } - player->animCurFrame = 0; - break; - - case 7: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_8018084C, self) == 0) { - if (D_801C257C & 0x1000) { - SetStep(8); - } - } - player->animCurFrame = 0; - break; - - case 8: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_8018085C, self) == 0) { - if (D_801C257C & 0x2000) { - SetStep(9); - } - } - player->animCurFrame = 0; - break; - - case 9: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_80180864, self) == 0) { - if (D_801C257C & 0x4000) { - SetStep(10); - } - } - player->animCurFrame = 0; - break; - - case 10: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_8018086C, self) == 0) { - if (D_801C257C & 0x8000) { - SetStep(11); - } - } - player->animCurFrame = 0; - break; - - case 11: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_8018087C, self) == 0) { - if (D_801C257C & 0x10000) { - SetStep(12); - } - } - player->animCurFrame = 0; - break; - - case 12: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_80180884, self) == 0) { - if (D_801C257C & 0x20000) { - SetStep(13); - } - } - player->animCurFrame = 0; - break; - - case 13: - g_Player.D_80072EFC = 1; - if (AnimateEntity(D_8018088C, self) == 0) { - if (D_801C257C & 0x40000) { - SetStep(14); - } - } - player->animCurFrame = 0; - break; - - case 14: - g_Player.D_80072EFC = 1; - player->animCurFrame = 0; - if (AnimateEntity(D_80180894, self) == 0) { - self->animCurFrame = 0; - player->animCurFrame = 7; - SetStep(15); - } - break; - - case 15: - g_Player.D_80072EFC = 1; - player->animCurFrame = 7; - if (D_801C257C & 4) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = PAD_LEFT; - DestroyEntity(self); - D_8003C8B8 = 1; - } - break; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } diff --git a/src/st/st0/2A8DC.c b/src/st/st0/2A8DC.c index bfcf8e24d1..0fc7233b76 100644 --- a/src/st/st0/2A8DC.c +++ b/src/st/st0/2A8DC.c @@ -1,246 +1,246 @@ -/* - * Overlay: ST0 - * Entity: Secret Stairs - */ - -#include "st0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -void EntitySecretButton(Entity* self) { - Entity* newEntity; - - switch (self->step) { - case 0: - InitializeEntity(D_80180628); - self->animCurFrame = 5; - self->hitboxWidth = 6; - self->hitboxHeight = 6; - self->hitboxState = 2; - - if (self->params != 0) { - self->step = 4; - self->zPriority += 2; - break; - } - - if (g_isSecretStairsButtonPressed) { - self->animCurFrame = 4; - self->hitboxState = 0; - self->palette += 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0x1C4] = 0; - self->step = 3; - break; - } +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0x1C4] = 0x32F; - break; - - case 1: - if (self->hitFlags != 0) { +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[0x1C4] = 0; - self->animCurFrame = 4; +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(E_SECRET_BUTTON, self, newEntity); - newEntity->params = 1; - } - self->step++; - } - break; - - case 2: - if (self->hitFlags != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_ANIME_SWORD_B); - g_isSecretStairsButtonPressed = true; - self->hitboxState = 0; - self->palette += 1; - self->step++; - } - break; - - case 3: - break; - - case 4: - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags = FLAG_DRAW_ROTZ | FLAG_DRAW_UNK8; - self->unk6C = 0x60; +REDACTED self->velocityX = 0; self->velocityY = 0; - self->step_s++; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ += 0x40; if (UnkCollisionFunc3(D_801808F8) & 1) { - self->step_s++; - break; - } +REDACTED +REDACTED +REDACTED self->velocityY -= FIX(0.125); - break; - - case 2: +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_EXPLODE_FAST_A); - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 0x11; - } - DestroyEntity(self); - } - break; - } -} - -void EntitySecretStairsCeiling(Entity* entity) { - switch (entity->step) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED case 0: InitializeEntity(D_80180628); entity->animCurFrame = 3; entity->zPriority += 2; if (g_isSecretStairsButtonPressed) { entity->animCurFrame = 0; - entity->step = 3; +REDACTED } break; - - case 1: - if (g_isSecretStairsButtonPressed) { +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_WALL_DEBRIS_B); - entity->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->posY.val -= FIX(0.25); - if (entity->posY.i.hi < -16) { - entity->step++; - } - break; - - case 3: - entity->animCurFrame = 0; - break; - } -} - -void EntitySecretStairs(Entity* self) { - Entity* newEntity; - u16* tilePos; - s32 temp_s0; - s32 temp_s1; - s32 posX; - s32 posY; - s16 angle; - s32 i; - - switch (self->step) { - case 0: - InitializeEntity(D_80180628); - self->animCurFrame = 1; - if (self->params == 0) { - self->ext.generic.unk84.U8.unk0 = true; - newEntity = &self[1]; - for (i = 0; i < 3; i++) { - CreateEntityFromCurrentEntity(E_SECRET_STAIRS, newEntity); - newEntity->params = i + 1; - newEntity++; - } - - } else { - self->ext.generic.unk84.U8.unk0 = false; - if (self->params == 3) { - self->animCurFrame = 2; - self->zPriority += 1; - for (tilePos = &D_801808B0; *tilePos != 0xFFFF; tilePos += 2) { - if (!g_isSecretStairsButtonPressed) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[*tilePos] = 0; - } else { +REDACTED g_Tilemap.fg[*tilePos] = *(tilePos + 1); - } - } - - } else { - self->zPriority -= self->params; - } - } - - if (g_isSecretStairsButtonPressed) { - temp_s0 = D_801808A0[self->params].x; - temp_s1 = D_801808A0[self->params].y; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->posX.i.hi = temp_s0 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = temp_s1 - g_Tilemap.scrollY.i.hi; - self->step = 15; - break; - } +REDACTED +REDACTED +REDACTED self->rotZ = -0x200; self->drawFlags |= 4; - break; - - case 1: - if (g_isSecretStairsButtonPressed) { +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_DOOR_OPEN); - self->step++; - } - break; - - case 2: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->rotZ += 0x10; if (self->rotZ == 0) { self->drawFlags = 0; - self->step++; - } - break; - - case 3: - if (!self->ext.generic.unk84.U8.unk0) { - self->posX.i.hi = self[-1].posX.i.hi; - self->posY.i.hi = self[-1].posY.i.hi; - if (self->params == 3) { - self->posX.i.hi += 16; - self->posY.i.hi += 16; - } - } else { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_DOOR_OPEN); - self->step++; - } - break; - - case 4: - temp_s0 = D_801808A0[self->params].x; - temp_s1 = D_801808A0[self->params].y; - - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = g_Tilemap.scrollX.i.hi + self->posX.i.hi; posY = g_Tilemap.scrollY.i.hi + self->posY.i.hi; - angle = ratan2(temp_s1 - posY, temp_s0 - posX); +REDACTED self->velocityX = rcos(angle) * 12; self->velocityY = rsin(angle) * 12; - self->step_s++; - break; - - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED posX = g_Tilemap.scrollX.i.hi + self->posX.i.hi; - if (temp_s0 == posX) { +REDACTED g_api.PlaySfx(SFX_DOOR_CLOSE_A); self->posX.i.hi = temp_s0 - g_Tilemap.scrollX.i.hi; self->posY.i.hi = temp_s1 - g_Tilemap.scrollY.i.hi; - if (self->params != 3) { - self[1].ext.stub[0x8] = 1; - } else { - tilePos = &D_801808B0; - while (*tilePos != 0xFFFF) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Tilemap.fg[*tilePos] = *(tilePos + 1); - tilePos += 2; - } - } - self->step++; - } - break; - } - break; - } -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED diff --git a/src/st/st0/2B0C8.c b/src/st/st0/2B0C8.c index e9c2448bcf..a17c40cd03 100644 --- a/src/st/st0/2B0C8.c +++ b/src/st/st0/2B0C8.c @@ -1,15 +1,15 @@ -#include "st0.h" +REDACTED #include "sfx.h" - -void EntityStageTitleFadeout(Entity* self) { +REDACTED +REDACTED s16 primIndex; - Primitive* prim; - s32 temp_a0; - s32 temp_a1; - s32 posX; - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (D_80180908 != 0) { DestroyEntity(self); return; @@ -20,368 +20,368 @@ void EntityStageTitleFadeout(Entity* self) { if (primIndex != -1) { prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.stageTitleCard.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; while (prim != NULL) { prim->drawMode = DRAW_HIDE; prim = prim->next; - } - prim = self->ext.stageTitleCard.prim; +REDACTED +REDACTED prim->r0 = prim->g0 = prim->b0 = 0; prim->x1 = prim->x3 = 0x100; prim->y2 = prim->y3 = 0xF0; prim->priority = 0x1FD; prim->y0 = prim->y1 = prim->x0 = prim->x2 = 0; prim->drawMode = DRAW_DEFAULT; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED self->ext.stageTitleCard.unk88 = 0x20; - } else { - DestroyEntity(self); - break; - } - - case 1: - if (D_80180908 != 0) { - prim = self->ext.stageTitleCard.prim; - prim->r0 = prim->g0 = prim->b0 = 247; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x51; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - self->step++; - } - break; - - case 2: - prim = self->ext.stageTitleCard.prim; - prim = prim->next; - prim->r0 = prim->g0 = prim->b0 = 0; - prim->priority = 0xC0; - prim->x1 = prim->x3 = 0x100; - prim->y2 = prim->y3 = 0xF0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - prim->y0 = prim->y1 = prim->x0 = prim->x2 = 0; +REDACTED LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); - PLAYER.zPriority = 0xD0; - self->step++; - - case 3: - PLAYER.zPriority = 0xD0; - prim = self->ext.stageTitleCard.prim; - prim->r0 += 248; - if (prim->r0 > 248) { - prim->r0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; +REDACTED prim->drawMode = DRAW_DEFAULT; - self->step = 5; - break; - } - prim->g0 = prim->b0 = LOW(prim->r0); +REDACTED +REDACTED +REDACTED +REDACTED LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); break; case 4: - PLAYER.zPriority = 0xD0; - prim = self->ext.stageTitleCard.prim; - prim = prim->next; - prim->r0 += 248; - if (prim->r0 > 248) { - prim->r0 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; PLAYER.zPriority = g_unkGraphicsStruct.g_zEntityCenter; - self->step = 1; - } - prim->g0 = prim->b0 = LOW(prim->r0); +REDACTED +REDACTED +REDACTED LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); break; - case 5: - prim = self->ext.stageTitleCard.prim; - while (prim != NULL) { - prim->y0 = prim->y1 = 0; - prim->y2 = prim->y3 = 0xF0; - prim->priority = 0xB0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x55; - prim->r0 = prim->g0 = prim->b0 = 255; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - prim = prim->next; - } - prim = self->ext.stageTitleCard.prim; - prim->x0 = prim->x2 = 0; - - prim = prim->next; - prim->r0 = prim->g0 = prim->b0 = 255; - prim->r1 = prim->g1 = prim->b1 = 0; - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r1); - - prim = prim->next; - prim->x1 = prim->x3 = 0x100; - - prim = prim->next; - prim->r0 = prim->g0 = prim->b0 = 0; - prim->r1 = prim->g1 = prim->b1 = 255; - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r1); - - posX = PLAYER.posX.i.hi; - self->ext.stageTitleCard.unk88 = 32; - self->ext.stageTitleCard.unk84 = posX; - self->ext.stageTitleCard.unk80 = posX; - self->step++; - - case 6: - if (self->ext.stageTitleCard.unk88 != 0) { - self->ext.stageTitleCard.unk88--; - if (self->ext.stageTitleCard.unk88 == 0) { - g_Entities[PLAYER_CHARACTER].zPriority = +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_unkGraphicsStruct.g_zEntityCenter; - } - } - temp_a0 = self->ext.stageTitleCard.unk80; - temp_a1 = self->ext.stageTitleCard.unk84; - prim = self->ext.stageTitleCard.prim; - temp_a0 -= 4; - temp_a1 += 4; - prim->x1 = prim->x3 = temp_a0; - - prim = prim->next; - prim->x0 = prim->x2 = temp_a0; - prim->x1 = prim->x3 = temp_a0 + 0x40; - - prim = prim->next; - prim->x0 = prim->x2 = temp_a1; - - prim = prim->next; - prim->x1 = prim->x3 = temp_a1; - prim->x0 = prim->x2 = temp_a1 - 0x40; - - if ((temp_a0 < -0x40) && (temp_a1 > 0x140)) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED for (prim = self->ext.stageTitleCard.prim; prim != NULL; prim = prim->next) { prim->drawMode = DRAW_HIDE; - } - PreventEntityFromRespawning(self); - DestroyEntity(self); - break; - } - self->ext.stageTitleCard.unk80 = temp_a0; - self->ext.stageTitleCard.unk84 = temp_a1; - break; - } -} - -void EntityStageTitleCard(Entity* self) { - Entity* fakeEntity; // !FAKE +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s16 primIndex; - Primitive* prim; +REDACTED VertexFake* v; - s16 temp_unk8E; - s32 var_s7; - s16 angle; - s32 i; - s32 j; - - switch (self->step) { - case 0: - if (D_80180908 == 0) { - InitializeEntity(D_801805D4); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 8); if (primIndex == -1) { - D_80180908 = 1; - label: - DestroyEntity(self); - return; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.stageTitleCard.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; prim->type = PRIM_GT3; - prim->tpage = 0x1A; - prim->clut = 0x15F; - prim->v2 = prim->v3 = prim->u1 = prim->u3 = 0x18; - prim->r0 = prim->g0 = 8; - prim->b0 = 0x60; - prim->priority = 0x1FE; - prim->v0 = prim->v1 = prim->u0 = prim->u2 = 0x10; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_COLORS; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - - prim = prim->next; - prim->u1 = prim->u3 = 0x6F; - prim->tpage = 0x11; - prim->clut = 0x210; - prim->v0 = prim->v1 = prim->u0 = prim->u2 = 0; - prim->v2 = prim->v3 = 0xF; - prim->x0 = prim->x2 = -0x6F; - prim->y0 = prim->y1 = 0x70; - prim->priority = 0x1FF; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - prim->x1 = prim->x3 = 0; - prim->y2 = prim->y3 = 0x7F; - - prim = prim->next; - prim->u1 = prim->u3 = 0x7F; - prim->v2 = prim->v3 = 0x2A; - prim->x0 = prim->x2 = 0x100; - prim->x1 = prim->x3 = 0x17F; - prim->y0 = prim->y1 = 0x80; - prim->tpage = 0x11; - prim->clut = 0x210; - prim->u0 = prim->u2 = 0; - prim->v0 = prim->v1 = 0x10; - prim->priority = 0x1FF; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_DEFAULT; - prim->y2 = prim->y3 = 0x9A; - - prim = prim->next; - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - D_8003C8B8 = 0; - self->ext.stageTitleCard.unk88 = 0x10; - } else { - goto label; - } - - case 1: - if (--self->ext.stageTitleCard.unk88 == 0) { - self->step++; - } - g_Player.D_80072EFC = 4; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - break; - - case 2: - prim = self->ext.stageTitleCard.prim; - self->ext.stageTitleCard.unk8E += 6; - if (self->ext.stageTitleCard.unk8E > 0x20) { - self->ext.stageTitleCard.unk8E = 0x20; - var_s7 = 1; - } else { - var_s7 = 0; - } - - temp_unk8E = self->ext.stageTitleCard.unk8E; - angle = self->ext.stageTitleCard.unk8C + 0x400; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED v = (VertexFake*)&prim->x0; - for (i = 0; i < 3; i++) { +REDACTED v->x = (temp_unk8E * rcos(angle) >> 0xC) + 0x60; v->y = (temp_unk8E * rsin(angle) >> 0xC) + 0x80; - angle += 0x555; +REDACTED v++; - } - - prim = prim->next; - if (prim->x0 < 0x40) { - prim->x0 = prim->x0 + 8; - } else { - prim->x0 = 0x40; - var_s7++; - } - prim->x2 = prim->x0; - prim->x1 = prim->x3 = prim->x0 + 0x6F; - - prim = prim->next; - if (prim->x0 > 0x40) { - prim->x0 -= 6; - } else { - prim->x0 = 0x40; - var_s7++; - } - prim->x2 = prim->x0; - prim->x1 = prim->x3 = prim->x0 + 0x7F; - - if (var_s7 == 3) { - self->step++; - } - g_Player.D_80072EFC = 4; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - break; - - case 3: - prim = self->ext.stageTitleCard.prim; +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode |= 0x31; - - prim = prim->next; - prim->u1 = prim->u3 = 0x7F; - prim->v2 = prim->v3 = 0x2A; - prim->x0 = prim->x2 = 0x40; - prim->x1 = prim->x3 = 0xBF; - prim->y0 = prim->y1 = 0x70; - prim->y2 = prim->y3 = 0x9A; - prim->r0 = prim->g0 = prim->b0 = 0x80; - prim->v0 = prim->v1 = prim->u0 = prim->u2 = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x35; LOW(prim->r1) = LOW(prim->r0); LOW(prim->r2) = LOW(prim->r0); LOW(prim->r3) = LOW(prim->r0); - +REDACTED for (prim = prim->next; prim != NULL; prim = prim->next) { prim->drawMode = DRAW_HIDE; - } - self->ext.stageTitleCard.unk88 = 0x20; - self->step++; - g_Player.D_80072EFC = 4; +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - break; - - case 4: - if (self->ext.stageTitleCard.unk88 == 0x10) { - D_80180908 = 1; - } - if (--self->ext.stageTitleCard.unk88 == 0) { - self->step++; - } - g_Player.D_80072EFC = 4; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - return; - - case 5: - prim = self->ext.stageTitleCard.prim; - angle = self->ext.stageTitleCard.unk8C + 0x400; - self->ext.stageTitleCard.unk8C -= 4; - temp_unk8E = self->ext.stageTitleCard.unk8E; - - fakeEntity = self; // !FAKE - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED v = (VertexFake*)&prim->x0; - for (j = 0; j < 3; j++) { +REDACTED v->x = (temp_unk8E * rcos(angle) >> 0xC) + 0x60; v->y = (temp_unk8E * rsin(angle) >> 0xC) + 0x80; - angle += 0x555; +REDACTED v++; - } - +REDACTED +REDACTED PrimDecreaseBrightness(prim, 4); if (PrimDecreaseBrightness(prim->next, 3) == 0) { - PreventEntityFromRespawning(fakeEntity); - D_8003C8B8 = 1; - DestroyEntity(fakeEntity); - } - default: - g_Player.D_80072EFC = 4; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_Player.padSim = 0; - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED // Helper function for EntityDracula u32 func_801ABBBC(s32 step, Entity* dracula) { draculaPrimitive* prim; @@ -543,7 +543,7 @@ u32 func_801ABBBC(s32 step, Entity* dracula) { for (; i < 16; i++) { prim->drawMode = DRAW_HIDE; prim = prim->next; - } +REDACTED } prim = dracula->ext.dracula.unk84; for (i = 0, constFF = 0xFF, colorLimit = 0xFF; i < 48; i++) { @@ -657,8 +657,8 @@ u32 func_801ABBBC(s32 step, Entity* dracula) { prim = dracula->ext.dracula.unk84; for (i = 0; i < 48; i++) { prim->drawMode = DRAW_HIDE; - prim = prim->next; - } +REDACTED +REDACTED step++; dracula->drawFlags = DRAW_HIDE; dracula->unk6C = 0; @@ -700,41 +700,41 @@ u32 func_801ABBBC(s32 step, Entity* dracula) { } return step; } - -s32 func_801AC458(s16 arg0) { - s32 ret = arg0; - Entity* e; - Entity* e2; - - switch (ret) { - case 0: - e = g_CurrentEntity; - ret = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED e[1].drawFlags = FLAG_DRAW_ROTY; e[1].rotY = 0x600; - e[1].animFrameIdx = 0; - e[1].animFrameDuration = 0; - e[1].step = 2; - e[1].posX.i.hi = e->posX.i.hi; - e[1].posY.i.hi = e->posY.i.hi + 16; - - case 1: - e2 = &g_CurrentEntity[1]; - if (AnimateEntity(D_80180964, e2) == 0) { - ret++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (e2->animFrameIdx == 6 && e2->animFrameDuration == 0) { - g_CurrentEntity->ext.stub[0x24] = 1; - } - break; - - case 2: - e = &g_CurrentEntity[1]; - e->animCurFrame = 0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED e->drawFlags = 0; - e->step = 1; - ret = 0xFF; - break; - } - return ret; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } diff --git a/src/st/st0/2C564.c b/src/st/st0/2C564.c index e914364358..7034716311 100644 --- a/src/st/st0/2C564.c +++ b/src/st/st0/2C564.c @@ -1,551 +1,551 @@ -/* - * Overlay: ST0 - * Enemy: Dracula Boss - */ - -#include "st0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "sfx.h" - -void EntityDracula(Entity* self) { +REDACTED +REDACTED s16 primIndex; - Entity* newEntity; - Primitive* prim; - s16 temp_v1_8; - u16 temp_v1_6; - s32 var_a0_2; - s16 temp_19; - s16 temp_20; - s32 var_a1; - s32 index; - u16 posX; - s32 i; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if ((self->flags & FLAG_DEAD) && (self->step < 8)) { self->hitboxState = 0; self[1].hitboxState = 0; - SetStep(8); - } - - index = 1; // !FAKE - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->hitFlags == 1) { - g_api.PlaySfx(NA_SE_VO_DR_HURT_2); - } - +REDACTED +REDACTED +REDACTED if (self->hitFlags == 2) { - g_api.PlaySfx(NA_SE_VO_DR_HURT_3); - } - +REDACTED +REDACTED +REDACTED if (self->hitFlags == 3) { - g_api.PlaySfx(NA_SE_VO_DR_HURT_4); - } - - switch (self->step) { - case 0: - InitializeEntity(D_801805E0); - self->animCurFrame = 0x4F; - self->ext.dracula.unkA1 = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; self->facingLeft = 1; - CreateEntityFromCurrentEntity(0x1D, &self[1]); - self[1].zPriority = self->zPriority + 1; - +REDACTED +REDACTED +REDACTED primIndex = g_api.func_800EDB58(PRIM_GT4, 128); if (primIndex == -1) { - self->step = 0; - break; - } - +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; - self->ext.dracula.prim = prim; +REDACTED self->flags |= FLAG_HAS_PRIMS; - while (prim != NULL) { +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - SetStep(2); - break; - - case 2: - SetStep(3); - break; - - case 3: - switch (self->step_s) { - case 0: - if (D_801C257C & 0x10) { - SetSubStep(1); - } - break; - - case 1: - if ((AnimateEntity(D_80180A0C, self) == 0) && (D_801C257C & 0x20)) { - SetSubStep(2); - } - break; - - case 2: - if (AnimateEntity(D_80180A20, self) == 0) { - D_801C257C |= 0x100; - } - if (D_801C257C & 0x40) { - D_8003C744 = 1; - SetSubStep(3); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 2 && self->animFrameDuration == 0) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x1F, self, newEntity); +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->posX.i.hi -= 8; - newEntity->posY.i.hi -= 24; - } - } - break; - - case 3: - if (AnimateEntity(D_80180A2C, self) == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.TimeAttackController( TIMEATTACK_EVENT_DRACULA_DEFEAT, TIMEATTACK_SET_VISITED); - SetStep(4); - } - } - break; - - case 4: - switch (self->step_s) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - self->ext.dracula.unk9C = 0; - self->step_s++; - - case 1: - self->ext.dracula.unk9C = - func_801ABBBC(self->ext.dracula.unk9C, self); - if (self->ext.dracula.unkA0 != 0) { - g_api.PlaySfx(NA_SE_VO_DR_TAUNT_2); - self->animCurFrame = 0; - self->ext.dracula.unkA0 = 0; - } - if (self->ext.dracula.unk9C != 0xFF) { - break; - } - self->step_s++; - break; - - case 2: - SetStep(5); - } - break; - - case 5: - switch (self->step_s) { - case 0: - self->ext.dracula.unk8C = 0x80; - self->step_s++; - - case 1: - if (--self->ext.dracula.unk8C == 0) { - posX = D_80180A48[Random() & 7]; - self->posY.i.hi = 0x82; - self->ext.dracula.unk9C = 0; - self->posX.i.hi = posX; - self->step_s++; - } - break; - - case 2: - self->ext.dracula.unk9C = - func_801ABBBC(self->ext.dracula.unk9C, self); - if (self->ext.dracula.unkA0 != 0) { - g_api.PlaySfx(NA_SE_VO_DR_TAUNT_1); - self->animCurFrame = 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->ext.dracula.unkA0 = 0; - } - if (self->ext.dracula.unk9C != 0xFF) { - break; - } - self->step_s++; - break; - - case 3: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = (GetSideToPlayer() & 1) ^ 1; - self->ext.dracula.unkA2 = (self->ext.dracula.unkA2 + 1) & 3; +REDACTED self->hitboxState = 3; - if (self->ext.dracula.unkA2 == 0) { - SetStep(6); - break; - } - SetStep(7); - } - break; - - case 7: - switch (self->step_s) { - case 0: - if (AnimateEntity(D_80180914, self) == 0) { - self[1].animFrameDuration = 0; - self[1].animFrameIdx = 0; - SetSubStep(1); - g_api.PlaySfx(NA_SE_VO_DR_HURT_1); - } - break; - - case 1: - if (AnimateEntity(D_801809A4, &self[1]) == 0) { - self[1].animCurFrame = 0; - SetSubStep(2); - } - break; - - case 2: - for (i = 0; i < 3; i++) { - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x1B, self, newEntity); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; - newEntity->zPriority = self->zPriority + 1; - newEntity->params = i; +REDACTED +REDACTED if (self->facingLeft != 0) { - newEntity->posX.i.hi -= 24; - } else { - newEntity->posX.i.hi += 24; - } - newEntity->posY.i.hi += 44; - } - } - self->step_s++; - - case 3: - if (AnimateEntity(D_80180924, self) == 0) { - SetStep(4); - } - } - break; - - case 6: - switch (self->step_s) { - case 0: - if (AnimateEntity(D_80180934, self) == 0) { - SetSubStep(1); - self->ext.dracula.unk8C = 2; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_api.PlaySfx(SFX_FIREBALL_SHOT_A); - g_api.PlaySfx(NA_SE_VO_DR_HERE_IS_TRUE_POWER); - } - break; - - case 1: - case 2: - if (--self->ext.dracula.unk8C == 0) { - newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x1C, self, newEntity); - index = self->step_s - 1; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED newEntity->facingLeft = self->facingLeft; if (self->facingLeft != 0) { - newEntity->posX.i.hi += D_80180A58[index].x; - } else { - newEntity->posX.i.hi -= D_80180A58[index].x; - } - newEntity->posY.i.hi += D_80180A58[index].y; - newEntity->zPriority = self->zPriority + 1; - newEntity->params = index; - } - self->ext.dracula.unk8C = 0x20; - self->step_s++; - } - break; - - case 3: - if (--self->ext.dracula.unk8C == 0) { - self->step_s++; - } - break; - - case 4: - if (AnimateEntity(D_80180944, self) == 0) { - SetStep(4); - } - } - break; - - case 8: - switch (self->step_s) { - case 0: - prim = self->ext.dracula.prim; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - g_isDraculaFirstFormDefeated = 1; - while (prim != NULL) { +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - g_api.PlaySfx(NA_SE_VO_DR_PLAYTIME_IS_OVER); - self->step_s++; - - case 1: - if (AnimateEntity(D_80180954, self) == 0) { - self->ext.dracula.unk8C = 0x28; - self->unk5A = 0x59; - self->step_s++; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->animFrameIdx == 5 && self->animFrameDuration == 0) { - g_api.func_80102CD8(2); - } - break; - - case 2: - if (--self->ext.dracula.unk8C == 0) { - g_api.PlaySfx(NA_SE_VO_DR_GRANT_ME_POWER); - self->step_s++; - } - break; - - case 3: - prim = self->ext.dracula.prim; - self->ext.dracula.unk94 = 0x40; - self->ext.dracula.unk98 = 0; - self->unk6C = 0x80; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->drawFlags |= 8; - prim->type = PRIM_G4; - prim->x0 = prim->x2 = self->posX.i.hi; - prim->x1 = prim->x3 = self->posX.i.hi; - prim->y0 = prim->y1 = 0; - prim->y2 = prim->y3 = 0x100; - prim->r0 = prim->g0 = prim->b0 = self->ext.dracula.unk94; - prim->priority = 0xC0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x31; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - prim = prim->next; - prim->type = PRIM_G4; - prim->x0 = prim->x2 = self->posX.i.hi; - prim->x1 = prim->x3 = self->posX.i.hi; - prim->y0 = prim->y1 = prim->r0 = prim->g0 = prim->b0 = 0; - prim->y2 = prim->y3 = 0x100; - LOW(prim->r2) = LOW(prim->r0); - prim->r1 = prim->g1 = prim->b1 = self->ext.dracula.unk94; - prim->priority = 0xC0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x31; - LOW(prim->r3) = LOW(prim->r1); - prim = prim->next; - prim->type = PRIM_G4; - prim->x0 = prim->x2 = self->posX.i.hi; - prim->x1 = prim->x3 = self->posX.i.hi; - prim->y0 = prim->y1 = 0; - prim->y2 = prim->y3 = 0x100; - prim->r0 = prim->g0 = prim->b0 = self->ext.dracula.unk94; - prim->r1 = prim->g1 = prim->b1 = 0; - prim->priority = 0xC0; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = 0x31; - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r1); - self->ext.dracula.unk8C = 0x20; - self->step_s++; - - case 4: - prim = self->ext.dracula.prim; - prim = prim->next; - - prim->x0 = prim->x2 = prim->x2 - 2; - prim = prim->next; - - temp_19 = prim->x3 + 2; - prim->x1 = prim->x3 = temp_19; - if (self->posX.i.hi != (temp_19 - 0x30)) { - break; - } - self->step_s++; - break; - - case 5: - var_a1 = 0; - temp_20 = self->ext.dracula.unk98 + 4; - var_a0_2 = self->posX.i.hi - temp_20; - self->ext.dracula.unk98 = temp_20; - if (var_a0_2 < 0) { - var_a1 = 1; - var_a0_2 = 0; - } - - prim = self->ext.dracula.prim; - temp_v1_6 = var_a0_2; - prim->x0 = prim->x2 = temp_v1_6; - prim = prim->next; - prim->x0 = prim->x2 = temp_v1_6 - 0x30; - prim->x1 = prim->x3 = temp_v1_6; - - var_a0_2 = self->posX.i.hi + self->ext.dracula.unk98; - if (var_a0_2 > 0x100) { - var_a1 += 1; - var_a0_2 = 0x100; - } - temp_v1_8 = var_a0_2 + 0x30; - - prim = self->ext.dracula.prim; - prim->x1 = prim->x3 = var_a0_2; - prim = prim->next; - - prim = prim->next; - prim->x0 = prim->x2 = var_a0_2; - prim->x1 = prim->x3 = temp_v1_8; - - if (self->unk6C != 0) { - self->unk6C += 0xF8; - } - - if (self->ext.dracula.unk94 < 0xF0) { - self->ext.dracula.unk94 += 8; - } - - prim = self->ext.dracula.prim; - prim->r0 = prim->g0 = prim->b0 = self->ext.dracula.unk94; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); - - prim = prim->next; - prim->r0 = prim->g0 = prim->b0 = 0; - LOW(prim->r2) = LOW(prim->r0); - prim->r1 = prim->g1 = prim->b1 = self->ext.dracula.unk94; - LOW(prim->r3) = LOW(prim->r1); - - prim = prim->next; - prim->r0 = prim->g0 = prim->b0 = self->ext.dracula.unk94; - prim->r1 = prim->g1 = prim->b1 = 0; - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r1); - - if (var_a1 == 2) { - self->step_s++; - } - break; - - case 6: - prim = self->ext.dracula.prim; - prim = prim->next; - while (prim != NULL) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = prim->next; - } - CreateEntityFromCurrentEntity(0x2B, &self[2]); +REDACTED +REDACTED +REDACTED self[2].facingLeft = self->facingLeft; - CreateEntityFromCurrentEntity(0x20, &self[5]); +REDACTED self[5].facingLeft = self->facingLeft; - self[5].posY.i.hi += 2; - self->step_s++; - break; - - case 7: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (PrimDecreaseBrightness(self->ext.dracula.prim, 7) == 0) { - self->step_s++; - } - break; - - case 8: - if (D_801C2578 == 0) { - DestroyEntity(self); - } - } - break; - - case 255: - /** - * Debug: Press SQUARE / CIRCLE on the second controller - * to advance/rewind current animation frame - */ - if (g_pads[1].pressed & PAD_SQUARE) { - if (self->params == 0) { - self->animCurFrame++; - self->params |= 1; - } else { - break; - } - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { - if (self->step_s == 0) { - self->animCurFrame--; - self->step_s |= 1; - break; - } - } else { - self->step_s = 0; - } - break; - } -} - -void EntityDraculaBody(Entity* self) { - if (g_isDraculaFirstFormDefeated) { - DestroyEntity(self); - } - - switch (self->step) { - case 0: - InitializeEntity(D_801805E0); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 1; - self->hitPoints = 0x7FFF; +REDACTED self->hitboxOffX = 3; self->hitboxOffY = 0x27; - self->hitboxWidth = 12; - self->animCurFrame = 0; - self->hitboxHeight = 34; - break; - case 1: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->facingLeft = self[-1].facingLeft; - self->posX.i.hi = self[-1].posX.i.hi; - self->posY.i.hi = self[-1].posY.i.hi; +REDACTED +REDACTED self->hitboxState = self[-1].hitboxState & 0xFFFD; - break; - case 2: +REDACTED +REDACTED self->hitboxState = 0; - break; - } - - if (g_isDraculaFirstFormDefeated) { +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - } -} - -void EntityDraculaFireball(Entity* self) { - if (g_isDraculaFirstFormDefeated) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->flags |= FLAG_DEAD; - } - +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { - self->pfnUpdate = EntityExplosion; - self->step = 0; - self->params = 2; - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_801805EC); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (self->facingLeft == 0) { self->velocityX = FIX(-2); - } else { +REDACTED self->velocityX = FIX(2); - } - - if (self->params == 1) { +REDACTED +REDACTED +REDACTED self->velocityY = FIX(-0.5); - } - - if (self->params == 2) { +REDACTED +REDACTED +REDACTED self->velocityY = FIX(0.5); - } +REDACTED self->ext.dracula.unk8C = 0x28; - - case 1: - AnimateEntity(D_8018097C, self); - MoveEntity(); - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (--self->ext.dracula.unk8C == 0) { self->velocityY = 0; } @@ -558,19 +558,19 @@ extern u8 D_80180990[]; extern u8 D_801809B0[]; extern s16 D_80180A60[]; extern s16 D_80180A62[]; -void EntityDraculaMeteorball(Entity* entity) { +REDACTED s32 speedX; if (g_isDraculaFirstFormDefeated) { entity->entityId = E_EXPLOSION; entity->pfnUpdate = EntityExplosion; - entity->step = 0; - entity->step_s = 0; - entity->params = 1; +REDACTED +REDACTED +REDACTED return; } - switch (entity->step) { +REDACTED case 0: InitializeEntity(D_801805F8); entity->hitboxState = 0; @@ -579,26 +579,26 @@ void EntityDraculaMeteorball(Entity* entity) { case 1: if (AnimateEntity(D_801809B0, entity) == 0) { entity->hitboxState = 1; - SetStep(2); +REDACTED } break; case 2: AnimateEntity(D_80180990, entity); MoveEntity(); entity->rotZ += 4; - speedX = 0x1000; - if (entity->params != 0) { - speedX = 0xE00; - } - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (entity->facingLeft != 0) { entity->velocityX += speedX; - } else { +REDACTED entity->velocityX -= speedX; - } - +REDACTED +REDACTED if (!(g_Timer & 3)) { - Entity* newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); +REDACTED if (newEntity != 0) { s32 randomPosXYIndex; CreateEntityFromEntity(0x1E, entity, newEntity); @@ -616,13 +616,13 @@ void EntityDraculaMeteorball(Entity* entity) { extern u16 D_801805EC[]; extern u8 D_801809E0[]; -void func_801AD838(Entity* entity) { +REDACTED if (g_isDraculaFirstFormDefeated) { DestroyEntity(entity); return; } - if (entity->step == 0) { +REDACTED InitializeEntity(D_801805EC); entity->animCurFrame = 0; entity->hitboxState = 0; @@ -637,8 +637,8 @@ void func_801AD838(Entity* entity) { extern u16 D_801805EC[]; extern u8 D_80180A40[]; -void EntityDraculaGlass(Entity* entity) { - switch (entity->step) { +REDACTED +REDACTED case 0: InitializeEntity(D_801805EC); entity->animCurFrame = 0x59; @@ -646,7 +646,7 @@ void EntityDraculaGlass(Entity* entity) { entity->hitboxState = 0; entity->velocityX = FIX(-1); entity->velocityY = 0; - if (entity->params) { +REDACTED s16 radians; s32 speed; entity->animCurFrame = 0x5C; @@ -654,35 +654,35 @@ void EntityDraculaGlass(Entity* entity) { radians = (Random() * 6) + 0x900; entity->velocityX = speed * rcos(radians); entity->velocityY = speed * rsin(radians); - SetStep(3); - } - case 1: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED entity->rotZ += 0x20; entity->velocityY += FIX(0.125); if (entity->posY.i.hi >= 205) { g_api.PlaySfx(NA_SE_BREAK_GLASS); entity->posY.i.hi = 204; - SetStep(2); - } - break; - case 2: +REDACTED +REDACTED +REDACTED +REDACTED entity->drawFlags = 0; if (AnimateEntity(D_80180A40, entity) == 0) { s32 i; for (i = 0; i < 8; i++) { - Entity* glassShardEntity = - AllocEntity(&g_Entities[224], &g_Entities[256]); +REDACTED +REDACTED if (glassShardEntity != 0) { CreateEntityFromEntity(31, entity, glassShardEntity); - glassShardEntity->params = 1; - } - } - DestroyEntity(entity); - } - break; - case 3: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED entity->velocityY += FIX(0.125); if (entity->posY.i.hi >= 205) { DestroyEntity(entity); diff --git a/src/st/st0/2DAC8.c b/src/st/st0/2DAC8.c index 55d9d96fc0..8f9a13f715 100644 --- a/src/st/st0/2DAC8.c +++ b/src/st/st0/2DAC8.c @@ -3,7 +3,7 @@ bool func_801ADAC8(s32 arg0) { s32 unk = 0xD0; - Entity* entity = g_CurrentEntity; +REDACTED s16 temp_v1 = entity->posY.i.hi + arg0; if (temp_v1 >= unk) { @@ -74,7 +74,7 @@ void func_801ADB10(u16* arg0, u16 arg1, u16 arg2, s32 steps, u8* arg4) { g_ClutIds[arg2] = GetClut(bufRect.x, bufRect.y); } } - +REDACTED void EntityDraculaFinalForm(Entity* self) { byte stackpad[56]; Entity* temp_s2; @@ -185,7 +185,7 @@ void EntityDraculaFinalForm(Entity* self) { case 1: if (AnimateEntity(D_80180AB0, self) == 0) { SetSubStep(2); - } +REDACTED if (self->animFrameIdx == 5 && self->animFrameDuration == 0) { if (self->facingLeft) { self->velocityX = FIX(0.5); @@ -541,16 +541,16 @@ void EntityDraculaFinalForm(Entity* self) { if (primIndex == -1) { g_GameEngineStep = 0xA; g_MenuStep = 0; - return; - } +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->primIndex = primIndex; self->ext.prim = prim; self->flags |= FLAG_HAS_PRIMS; prim->r0 = prim->g0 = prim->b0 = 0; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->x0 = prim->x2 = 0; prim->x1 = prim->x3 = 0x100; prim->y0 = prim->y1 = 0; @@ -561,9 +561,9 @@ void EntityDraculaFinalForm(Entity* self) { case 6: prim = self->ext.prim; prim->g0 = prim->b0 = prim->r0 = prim->r0 + 0x18; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED if (prim->r0 >= 0x81) { self->step_s++; } @@ -588,16 +588,16 @@ void EntityDraculaFinalForm(Entity* self) { } break; case 0xFF: - FntPrint("charal %x\n", self->animCurFrame); - if (g_pads[1].pressed & PAD_SQUARE) { +REDACTED +REDACTED if (self->params != 0) { return; - } - self->animCurFrame++; - self->params |= 1; - } else { - self->params = 0; - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_pads[1].pressed & PAD_CIRCLE) { if (self->step_s != 0) { return; @@ -611,14 +611,14 @@ void EntityDraculaFinalForm(Entity* self) { } } -void EntityDraculaMegaFireball(Entity* self) { - s16 angle; - - if (self->step == 0) { - InitializeEntity(D_80180610); - self->flags |= FLAG_DESTROY_IF_OUT_OF_CAMERA | - FLAG_DESTROY_IF_BARELY_OUT_OF_CAMERA; - if (self->params == 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED angle = self->rotZ; self->rotY = 0x80; self->rotX = 0x80; @@ -626,94 +626,94 @@ void EntityDraculaMegaFireball(Entity* self) { self->rotZ = 0x1C0 - angle; if (self->facingLeft != 0) { self->velocityX = rcos(angle) * 0x60; - } else { +REDACTED self->velocityX = -(rcos(angle) * 0x60); - } +REDACTED self->velocityY = rsin(angle) * 0x60; - } - } - if (self->params != 0) { - if (AnimateEntity(D_80180BA0, self) == 0) { - DestroyEntity(self); - } +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED if (g_Timer & 1) { - self->animCurFrame = 0; - } - } else { +REDACTED +REDACTED +REDACTED if (self->rotX < 0x100) { self->rotX = self->rotY = self->rotY + 0x10; - } - AnimateEntity(D_80180BB8, self); - MoveEntity(); - } -} - -void EntityDraculaRainAttack(Entity* self) { - Entity* newEntity; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED s32 velY; s32 velX; - s16 angle; - s32 i; - +REDACTED +REDACTED +REDACTED if (self->flags & FLAG_DEAD) { newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { +REDACTED CreateEntityFromEntity(E_EXPLOSION, self, newEntity); - newEntity->params = 2; - } - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: - InitializeEntity(D_8018061C); - if (self->params != 0) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; - self->animCurFrame = 0x59; +REDACTED velX = (Random() & 0x1F) + 0x10; - angle = (Random() * 6) + 0x900; +REDACTED self->velocityX = velX * rcos(angle); velY = velX * rsin(angle); - self->step = 3; +REDACTED self->velocityY = velY; - break; - } +REDACTED +REDACTED self->velocityY = FIX(4); - - case 1: - MoveEntity(); - AnimateEntity(D_80180BCC, self); - if (func_801ADAC8(0x14) != 0) { - SetStep(2); - } - break; - - case 2: - if (AnimateEntity(D_80180BDC, self) == 0) { - - for (i = 0; i < 4; i++) { - newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]); - if (newEntity != NULL) { - CreateEntityFromEntity(0x22, self, newEntity); - newEntity->params = 1; - newEntity->posY.i.hi += 12; - } - } - DestroyEntity(self); - } - break; - - case 3: - MoveEntity(); +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->velocityY += FIX(0.125); - if (self->posY.i.hi >= 0xF1) { - DestroyEntity(self); - } - break; - } -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801AF380(void) { Primitive* prim; s16* var_t0; @@ -787,7 +787,7 @@ void func_801AF380(void) { D_801BEB64[i].y = (*var_t0++ - 0x53) << 0x10; } } - +REDACTED void func_801AF6D0(void) { s16* var_a0; s16* var_a1; @@ -828,10 +828,10 @@ void func_801AF774(Entity* self) { s32 xBase; s32 yBase; inline s32 add(a, b) { return a + b; } - - switch (self->step) { - case 0: - InitializeEntity(D_801805E0); +REDACTED +REDACTED +REDACTED +REDACTED self->hitboxState = 0; self->animCurFrame = 0; self->drawMode |= (DRAW_TPAGE | 0x20); @@ -864,9 +864,9 @@ void func_801AF774(Entity* self) { prim->y0 = prim->y1 = self->posY.i.hi - 0x25; prim->y2 = prim->y3 = self->posY.i.hi + 0x5B; prim->r0 = prim->g0 = prim->b0 = 0x80; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_UNK02 | DRAW_HIDE; prim->priority = 0xA8; prim = prim->next; @@ -990,9 +990,9 @@ void func_801AF774(Entity* self) { prim->g0 = var_t0; prim->r0 = var_t0; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim = prim->next; } var_t0 = (u16)self->ext.et_801AF774.unk8C >> 8; @@ -1022,9 +1022,9 @@ void func_801AF774(Entity* self) { var_a2_3++; prim->r0 = prim->g0 = prim->b0 = temp_t0; - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim = prim->next; } self->ext.et_801AF774.unk8C = diff --git a/src/st/st0/30030.c b/src/st/st0/30030.c index ee3fc310bd..97dac7d0e3 100644 --- a/src/st/st0/30030.c +++ b/src/st/st0/30030.c @@ -1,4 +1,4 @@ -#include "st0.h" +REDACTED #include "disk.h" void SetGameState(GameState gameState) { @@ -16,32 +16,32 @@ void func_801B0058(void) { for (i = 0xF0; i < 0x100; i++) { for (j = 0x200; j < 0x300; j += 0x10) { g_ClutIds[index++] = GetClut(j, i); - } - } - - for (i = 0xF0; i < 0x100; i++) { - for (j = 0; j < 0x100; j += 0x10) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[index++] = GetClut(j, i); - } - } - - for (i = 0xF0; i < 0x100; i++) { - for (j = 0x100; j < 0x200; j += 0x10) { +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED g_ClutIds[index++] = GetClut(j, i); - } - } -} - -void func_801B0180(void) { - RECT rect; - - rect.x = 0; - rect.y = 0; - rect.w = 512; - rect.h = 512; - ClearImage(&rect, 0, 0, 0); -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void SetDisplayBufferColorsToBlack(void) { g_GpuBuffers[0].draw.r0 = 0; g_GpuBuffers[0].draw.g0 = 0; @@ -59,7 +59,7 @@ void func_801B01F8(s32 arg0) { } else { g_GpuBuffers[1].draw.clip.y = 0x0114; } - g_GpuBuffers[1].draw.clip.h = 0x00CF; +REDACTED g_GpuBuffers[0].draw.isbg = g_GpuBuffers[1].draw.isbg = 1; SetDisplayBufferColorsToBlack(); g_GpuBuffers[0].disp.isrgb24 = g_GpuBuffers[1].disp.isrgb24 = 0; @@ -105,7 +105,7 @@ u16 func_801B0414(void) { return ret; } - +REDACTED // func_801B0414 is undeclared to PrologueScroll. This emulates the // undefined signature to avoid splitting the file at this time. #define fake_func_801B0414 ((s32(*)())func_801B0414) @@ -466,7 +466,7 @@ void PrologueScroll(void) { break; } } - +REDACTED u8 func_801B101C(const char* msg) { Primitive* prim; s16 i; @@ -546,5 +546,5 @@ u16* func_801B11E8(char ch) { return g_api.func_80106A28(jCh, 0); } - +REDACTED INCLUDE_ASM("st/st0/nonmatchings/30030", func_801B1298); diff --git a/src/st/st0/34908.c b/src/st/st0/34908.c index 2a2e8cb677..d2ab13a151 100644 --- a/src/st/st0/34908.c +++ b/src/st/st0/34908.c @@ -11,52 +11,52 @@ // Absolute distance from g_CurrentEntity to the player in the X Axis s16 GetDistanceToPlayerX(void) { s16 xDistance = g_CurrentEntity->posX.i.hi - PLAYER.posX.i.hi; - - if (xDistance < 0) { - xDistance = -xDistance; +REDACTED +REDACTED +REDACTED } - return xDistance; +REDACTED } // Absolute distance from g_CurrentEntity to the player in the Y Axis s32 GetDistanceToPlayerY(void) { s32 yDistance = g_CurrentEntity->posY.i.hi - PLAYER.posY.i.hi; - - if (yDistance < 0) { - yDistance = -yDistance; +REDACTED +REDACTED +REDACTED } - return yDistance; +REDACTED } s32 GetSideToPlayer(void) { - s16 side = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi; - - if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) { - side |= 2; - } - return side; -} +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "../move_entity.h" #include "../fall_entity.h" -u8 func_801B4D18(void) { - u8 unkState; - Entity* entity; +REDACTED +REDACTED +REDACTED MoveEntity(); FallEntity(); entity = g_CurrentEntity; - - if (unkState & 1) { +REDACTED +REDACTED entity->velocityY = 0; - } - - return unkState; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED #include "../unk_collision_func3.h" INCLUDE_ASM("st/st0/nonmatchings/34908", func_801B4FD4); @@ -124,9 +124,9 @@ void func_801B57D0(u16 params) { DestroyEntity(g_CurrentEntity); return; } - current = g_CurrentEntity; +REDACTED g_CurrentEntity->entityId = E_EXPLOSION; - g_CurrentEntity->pfnUpdate = EntityExplosion; +REDACTED g_CurrentEntity->drawFlags = 0; current->params = params; current->animCurFrame = 0; diff --git a/src/st/st0/37308.c b/src/st/st0/37308.c index db30e3a838..4ce9b3933b 100644 --- a/src/st/st0/37308.c +++ b/src/st/st0/37308.c @@ -59,7 +59,7 @@ void EntityRoomForeground(Entity* entity) { if (objInit->unkC != 0) { entity->flags = objInit->unkC; } - if (entity->params >= 5) { +REDACTED entity->rotZ = 0x800; entity->drawFlags |= 4; } @@ -75,8 +75,8 @@ INCLUDE_ASM("st/st0/nonmatchings/37308", EntityClockTower3D); INCLUDE_ASM("st/st0/nonmatchings/37308", EntityCutscenePhotograph); -void EntityCutscenePhotographFire(Entity* entity) { - switch (entity->step) { +REDACTED +REDACTED case 0: InitializeEntity(D_801805D4); entity->animSet = ANIMSET_OVL(7); @@ -85,7 +85,7 @@ void EntityCutscenePhotographFire(Entity* entity) { entity->drawFlags = FLAG_DRAW_UNK8; entity->unk6C = 0x40; entity->flags &= ~FLAG_UNK_08000000; - if (entity->params) { +REDACTED entity->unk6C = 0x10; entity->zPriority = 0x1FB; entity->drawMode = 0x50; diff --git a/src/st/st0/draculacutscene.c b/src/st/st0/draculacutscene.c index fe905c1e11..257e04ee9c 100644 --- a/src/st/st0/draculacutscene.c +++ b/src/st/st0/draculacutscene.c @@ -1,102 +1,102 @@ -/* - * Overlay: ST0 - * Description: Cutscene of Richter talking to Dracula - */ - -#include "st0.h" +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801A8984(void) { - g_Dialogue.nextLineX = 2; - g_Dialogue.nextCharX = 2; - g_Dialogue.nextCharY = 0; - g_Dialogue.unk12 = 0; - g_Dialogue.nextCharTimer = 0; - g_Dialogue.unk17 = 8; - g_Dialogue.nextLineY = g_Dialogue.startY + 0x14; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED } s32 func_801A89D8(const char* textDialogue) { - Primitive* prim; - s16 firstPrimIndex; - - firstPrimIndex = g_api.AllocPrimitives(PRIM_SPRT, 8); - g_Dialogue.primIndex[2] = firstPrimIndex; - if (firstPrimIndex == -1) { - g_Dialogue.primIndex[2] = 0; - return 0; - } - g_Dialogue.nextCharDialogue = textDialogue; - g_Dialogue.unk3C = 0; - g_Dialogue.primIndex[1] = -1; - g_Dialogue.primIndex[0] = -1; - func_801A8984(); - - if (prim && prim) { // !FAKE - } - - prim = g_Dialogue.prim[0] = &g_PrimBuf[g_Dialogue.primIndex[2]]; - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[1] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[2] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[3] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[4] = prim->next; - +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - prim = g_Dialogue.prim[5] = prim->next; - - prim->type = 4; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 3; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0xFF; +REDACTED +REDACTED +REDACTED +REDACTED prim->g0 = prim->g1 = prim->g2 = prim->g3 = 0; prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0; - prim->x0 = prim->x2 = 4; - prim->x1 = prim->x3 = 0xF8; - prim->priority = 0x1FD; +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - - prim = prim->next; - prim->type = 1; - prim->x0 = 3; - prim->y0 = 0x2F; - prim->v0 = 0x4A; - prim->r0 = prim->g0 = prim->b0 = 0xFF; - prim->priority = 0x1FC; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim->drawMode = DRAW_HIDE; - return 1; -} +REDACTED +REDACTED void func_801A8B9C(s16 yOffset) { - RECT rect; - - rect.y = (yOffset * 12) + 384; - rect.w = 64; - rect.x = 0; - rect.h = 12; - ClearImage(&rect, 0, 0, 0); -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801A8BF8(void) { Primitive* prim; - - func_801A8B9C(g_Dialogue.nextCharY); - prim = g_Dialogue.prim[g_Dialogue.nextCharY]; +REDACTED +REDACTED +REDACTED prim->tpage = 0x10; - prim->clut = g_Dialogue.clutIndex; - prim->y0 = g_Dialogue.nextLineY; +REDACTED +REDACTED prim->u0 = 0; - prim->x0 = g_Dialogue.startX; +REDACTED prim->x0 = prim->x0 + 4; - prim->v0 = g_Dialogue.nextCharY * 0xC - 0x80; +REDACTED prim->u1 = 0xC0; prim->v1 = 0xC; prim->priority = 0x1FF; @@ -139,7 +139,7 @@ void func_801A8CB0(u16 actorIndex, Entity* self) { // Fill prims to render the actor name on screen prim = &g_PrimBuf[primIndex]; - g_Dialogue.primIndex[1] = primIndex; +REDACTED actorName = D_80180828[actorIndex]; x = 0x38; while (prim != NULL) { @@ -157,84 +157,84 @@ void func_801A8CB0(u16 actorIndex, Entity* self) { prim->priority = 0x1FF; prim->drawMode = DRAW_HIDE; prim->x0 = x; - prim->y0 = g_Dialogue.startY + 6; +REDACTED prim = prim->next; x += FONT_GAP; } } } - -void func_801A8E34(s32 arg0) { - g_Dialogue.unk40 = arg0 + 0x100000; - g_Dialogue.timer = 0; - g_Dialogue.unk3C = 1; -} - +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED void func_801A8E60(void) { Entity* entity; u16 startTimer; u8 entityIndex; - g_Dialogue.timer++; +REDACTED // protect from overflows - if (g_Dialogue.timer > 0xFFFE) { - g_Dialogue.unk3C = 0; +REDACTED +REDACTED return; } while (true) { // Start the dialogue script only if the start timer has passed - startTimer = (*g_Dialogue.unk40++ << 8) | *g_Dialogue.unk40++; - if (g_Dialogue.timer < startTimer) { +REDACTED +REDACTED // Re-evaluate the condition at the next frame - g_Dialogue.unk40 -= 2; +REDACTED return; } - switch (*g_Dialogue.unk40++) { +REDACTED case 0: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); - entity->entityId = *g_Dialogue.unk40++; +REDACTED entity->pfnUpdate = PfnEntityUpdates[entity->entityId - 1]; - entity->posX.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posX.i.hi = *g_Dialogue.unk40++ | entity->posX.i.hi; - entity->posY.i.hi = *g_Dialogue.unk40++ * 0x10; - entity->posY.i.hi = *g_Dialogue.unk40++ | entity->posY.i.hi; +REDACTED +REDACTED +REDACTED +REDACTED break; case 1: - entityIndex = *g_Dialogue.unk40++; +REDACTED entity = &g_Entities[STAGE_ENTITY_START + entityIndex]; DestroyEntity(entity); break; case 2: - if (!((D_801C257C >> *g_Dialogue.unk40) & 1)) { - g_Dialogue.unk40--; +REDACTED +REDACTED return; } - D_801C257C &= ~(1 << *g_Dialogue.unk40++); +REDACTED break; case 3: - D_801C257C |= 1 << *g_Dialogue.unk40++; +REDACTED break; } } } - +REDACTED // Animates the portrait size of the actor by enlarging or shrinking it void func_801A910C(u8 ySteps) { Primitive* prim; s32 primIndex; s32 i; - primIndex = g_Dialogue.nextCharY + 1; +REDACTED while (primIndex >= 5) { primIndex -= 5; } if (g_CurrentEntity->step_s == 0) { - prim = g_Dialogue.prim[primIndex]; +REDACTED prim->v1 -= ySteps; prim->v0 += ySteps; if (prim->v1 == 0) { @@ -245,13 +245,13 @@ void func_801A910C(u8 ySteps) { for (i = 0; i < 5; i++) { if (i != primIndex) { - prim = g_Dialogue.prim[i]; +REDACTED prim->y0 -= ySteps; } } - g_Dialogue.portraitAnimTimer++; +REDACTED } - +REDACTED void EntityDraculaCutscene(Entity* self) { RECT rect; Primitive* prim; @@ -272,10 +272,10 @@ void EntityDraculaCutscene(Entity* self) { self->flags &= ~FLAG_HAS_PRIMS; if (g_Dialogue.primIndex[1] != -1) { g_api.FreePrimitives(g_Dialogue.primIndex[1]); - } +REDACTED if (g_Dialogue.primIndex[0] != -1) { g_api.FreePrimitives(g_Dialogue.primIndex[0]); - } +REDACTED g_api.PlaySfx(0x80); self->step = 1; self->step_s = 0; diff --git a/src/st/wrp/e_init.c b/src/st/wrp/e_init.c index d1bda4170d..4d616f8115 100644 --- a/src/st/wrp/e_init.c +++ b/src/st/wrp/e_init.c @@ -19,7 +19,7 @@ PfnEntityUpdate PfnEntityUpdates[] = { /* 3FC */ (PfnEntityUpdate)EntitySoulStealOrb, /* 400 */ (PfnEntityUpdate)EntityRoomForeground, /* 404 */ (PfnEntityUpdate)EntityStageNamePopup, - /* 408 */ (PfnEntityUpdate)EntityEquipItemDrop, +REDACTED /* 40C */ (PfnEntityUpdate)EntityRelicOrb, /* 410 */ (PfnEntityUpdate)EntityHeartDrop, /* 414 */ (PfnEntityUpdate)EntityEnemyBlood, diff --git a/src/st/wrp/e_stage_name.c b/src/st/wrp/e_stage_name.c index b98102b43c..b1310534ca 100644 --- a/src/st/wrp/e_stage_name.c +++ b/src/st/wrp/e_stage_name.c @@ -24,12 +24,12 @@ void EntityStageNamePopup(Entity* self) { InitializeEntity(g_EInitGeneric); self->ext.stpopupj.unk8C = 0; primIndex = g_api.AllocPrimitives(PRIM_GT4, 181); - if (primIndex == -1) { - DestroyEntity(self); - return; - } - self->primIndex = primIndex; - self->flags |= FLAG_HAS_PRIMS; +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED prim = &g_PrimBuf[primIndex]; self->ext.stpopupj.prim = prim; for (i = 0; i < 2; i++) { @@ -52,9 +52,9 @@ void EntityStageNamePopup(Entity* self) { if (i) { prim->r0 = prim->b0 = prim->g0 = 0; } - LOW(prim->r1) = LOW(prim->r0); - LOW(prim->r2) = LOW(prim->r0); - LOW(prim->r3) = LOW(prim->r0); +REDACTED +REDACTED +REDACTED prim->priority = 0xC0 - i; prim->drawMode = DRAW_COLORS; diff --git a/src/st/wrp/header.c b/src/st/wrp/header.c index 55eda57ea4..d94e394c5f 100644 --- a/src/st/wrp/header.c +++ b/src/st/wrp/header.c @@ -5,7 +5,7 @@ void HitDetection(void); void CreateEntityWhenInHorizontalRange(LayoutEntity*); void func_8018A520(s16); void UpdateRoomPosition(void); -void func_8018CAB0(void); +REDACTED void InitRoomEntities(s32 objLayoutId); void PlaySfxPositional(u16); void BottomCornerText(u8*, u8); diff --git a/src/st/wrp_psp/e_collect.c b/src/st/wrp_psp/e_collect.c index 92a25fce20..1909301e1e 100644 --- a/src/st/wrp_psp/e_collect.c +++ b/src/st/wrp_psp/e_collect.c @@ -194,18 +194,18 @@ static void CollectSubweapon(u16 subWeaponIdx) { } if (subWeapon) { - g_CurrentEntity->params = subWeapon; - g_CurrentEntity->posY.i.hi = player->posY.i.hi + 12; - SetStep(7); +REDACTED +REDACTED +REDACTED g_CurrentEntity->velocityY = FIX(-2.5); g_CurrentEntity->animCurFrame = 0; g_CurrentEntity->ext.equipItemDrop.unk8A = 5; if (player->facingLeft ^ 1) { g_CurrentEntity->velocityX = FIX(-2); - return; +REDACTED } g_CurrentEntity->velocityX = FIX(2); - return; +REDACTED } DestroyEntity(g_CurrentEntity); } @@ -215,12 +215,12 @@ static void CollectSubweapon(u16 subWeaponIdx) { static void CollectLifeVessel(void) { g_api.PlaySfx(SFX_HEART_PICKUP); g_api.func_800FE044(5, 0x8000); - DestroyEntity(g_CurrentEntity); -} +REDACTED +REDACTED static void CollectDummy(u16 id) { DestroyEntity(g_CurrentEntity); } -// if self->params & 0x8000 then the item will not disappear +REDACTED void EntityPrizeDrop(Entity* self) { Collider collider; Primitive* prim; @@ -304,8 +304,8 @@ void EntityPrizeDrop(Entity* self) { self->hitboxWidth = 4; } break; - case 1: - g_api.CheckCollision(self->posX.i.hi, self->posY.i.hi, &collider, 0); +REDACTED +REDACTED if (collider.effects & EFFECT_NOTHROUGH_PLUS) { DestroyEntity(self); } else { @@ -393,7 +393,7 @@ void EntityPrizeDrop(Entity* self) { break; case 6: case 7: - switch (self->step_s) { +REDACTED case 0: self->animCurFrame = 0; if (itemId >= 14 && itemId < 23) { @@ -428,12 +428,12 @@ void EntityPrizeDrop(Entity* self) { prim->clut = 0x170; prim->u0 = prim->u2 = prim->v0 = prim->v1 = 0; prim->u1 = prim->u3 = prim->v2 = prim->v3 = 0x20; - prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = - prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 = +REDACTED +REDACTED prim->b2 = prim->b3 = 128; prim->drawMode = DRAW_HIDE; prim->priority = self->zPriority + 1; - self->step_s++; +REDACTED } break; case 1: @@ -444,7 +444,7 @@ void EntityPrizeDrop(Entity* self) { self->velocityX = 0; self->velocityY = 0; self->posY.i.hi += collider.unk18; - self->step_s++; +REDACTED } else { FallEntity(); } diff --git a/src/st/wrp_psp/e_particles_maria1.c b/src/st/wrp_psp/e_particles_maria1.c index 16976be2d6..6942e78da8 100644 --- a/src/st/wrp_psp/e_particles_maria1.c +++ b/src/st/wrp_psp/e_particles_maria1.c @@ -16,8 +16,8 @@ void func_psp_0923AD68(Entity* self) { } else { pl = &PLAYER; } - switch (self->step) { - case 0: +REDACTED +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { InitializeEntity(g_InitializeData0); diff --git a/src/st/wrp_psp/e_particles_maria2.c b/src/st/wrp_psp/e_particles_maria2.c index e44678c304..bf7635c508 100644 --- a/src/st/wrp_psp/e_particles_maria2.c +++ b/src/st/wrp_psp/e_particles_maria2.c @@ -15,7 +15,7 @@ void func_psp_0923B2F0(Entity* self) { switch (self->step) { default: return; - case 0: +REDACTED primIndex = g_api.AllocPrimitives(PRIM_GT4, 1); if (primIndex != -1) { InitializeEntity(g_InitializeData0); diff --git a/src/st/wrp_psp/wrp_data_F7B0.c b/src/st/wrp_psp/wrp_data_F7B0.c index 26e1b39da3..31d2106685 100644 --- a/src/st/wrp_psp/wrp_data_F7B0.c +++ b/src/st/wrp_psp/wrp_data_F7B0.c @@ -23,7 +23,7 @@ PfnEntityUpdate D_psp_09246E30[] = { /* 3FC */ (PfnEntityUpdate)EntitySoulStealOrb, /* 400 */ (PfnEntityUpdate)EntityRoomForeground, /* 404 */ (PfnEntityUpdate)EntityStageNamePopup, - /* 408 */ (PfnEntityUpdate)EntityEquipItemDrop, +REDACTED /* 40C */ (PfnEntityUpdate)EntityRelicOrb, /* 410 */ (PfnEntityUpdate)EntityHeartDrop, /* 414 */ (PfnEntityUpdate)EntityEnemyBlood, diff --git a/src/weapon/w_001.c b/src/weapon/w_001.c index 6a8b4931d7..70babb5b1a 100644 --- a/src/weapon/w_001.c +++ b/src/weapon/w_001.c @@ -51,7 +51,7 @@ s32 func_ptr_80170004(Entity* self) { DestroyEntity(self); return; } - +REDACTED prim = &g_PrimBuf[self->primIndex]; for (i = 0; i < 16; i++) { diff --git a/src/weapon/w_010.c b/src/weapon/w_010.c index 3c4fb4c7a2..b6cb2e1fce 100644 --- a/src/weapon/w_010.c +++ b/src/weapon/w_010.c @@ -25,17 +25,17 @@ static void DebugShowWaitInfo(const char* msg) { if (D_4A000_8017CC1C++ & 4) { FntPrint("\no\n"); } - DrawSync(0); - VSync(0); +REDACTED +REDACTED PutDrawEnv(&g_CurrentBuffer->draw); PutDispEnv(&g_CurrentBuffer->disp); - FntFlush(-1); -} - +REDACTED +REDACTED +REDACTED static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); - while (!PadRead(0)) +REDACTED DebugShowWaitInfo(msg); } @@ -195,8 +195,8 @@ s32 func_ptr_80170004(Entity* self) { } FntPrint("charah:%02x\n", self->animSet); FntPrint("oya_ptr:%02x\n", self->ext.weapon.parent); - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED if (self->step == 0) { self->animSet = self->ext.weapon.parent->animSet; self->palette = PAL_OVL(0x194); diff --git a/src/weapon/w_018.c b/src/weapon/w_018.c index 31e0f09fe9..979dd55a5a 100644 --- a/src/weapon/w_018.c +++ b/src/weapon/w_018.c @@ -19,17 +19,17 @@ static void DebugShowWaitInfo(const char* msg) { if (D_82000_8017B1B4++ & 4) { FntPrint(D_82000_8017A73C); // TODO: inline } - DrawSync(0); - VSync(0); +REDACTED +REDACTED PutDrawEnv(&g_CurrentBuffer->draw); PutDispEnv(&g_CurrentBuffer->disp); - FntFlush(-1); -} - +REDACTED +REDACTED +REDACTED static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); - while (!PadRead(0)) +REDACTED DebugShowWaitInfo(msg); } @@ -128,12 +128,12 @@ s32 func_ptr_80170004(Entity* self) { s32 scale; if (self->ext.weapon.parent->ext.weapon.equipId != 0x48) { - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED SetSpriteBank1(g_Animset); self->animSet = ANIMSET_OVL(0x10); if (g_HandId != 0) { diff --git a/src/weapon/w_021.c b/src/weapon/w_021.c index d1fdf79376..56163ad2eb 100644 --- a/src/weapon/w_021.c +++ b/src/weapon/w_021.c @@ -77,7 +77,7 @@ void func_97000_8017AB54(u8* str, u8 lowerLeft) { prim = &g_PrimBuf[g_unkGraphicsStruct.BottomCornerTextPrims]; prim->type = 3; - prim->b0 = prim->b1 = prim->b2 = prim->b3 = prim->g0 = prim->g1 = prim->g2 = +REDACTED prim->g3 = prim->r0 = prim->r1 = prim->r2 = prim->r3 = 0; if (lowerLeft) { prim->b0 = prim->b1 = 0xAF; diff --git a/src/weapon/w_027.c b/src/weapon/w_027.c index 507ed40401..cd401b8503 100644 --- a/src/weapon/w_027.c +++ b/src/weapon/w_027.c @@ -23,17 +23,17 @@ static void DebugShowWaitInfo(const char* msg) { if (D_C1000_8017C6EC++ & 4) { FntPrint("\no\n\0"); // TODO: remove extra NUL byte padding } - DrawSync(0); - VSync(0); +REDACTED +REDACTED PutDrawEnv(&g_CurrentBuffer->draw); PutDispEnv(&g_CurrentBuffer->disp); - FntFlush(-1); -} - +REDACTED +REDACTED +REDACTED static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); - while (!PadRead(0)) +REDACTED DebugShowWaitInfo(msg); } diff --git a/src/weapon/w_028.c b/src/weapon/w_028.c index 5dcad8daa5..bbb5d4c041 100644 --- a/src/weapon/w_028.c +++ b/src/weapon/w_028.c @@ -367,7 +367,7 @@ static void EntityWeaponShieldSpell(Entity* self) { prim = &g_PrimBuf[self->primIndex]; if (prim->b3 > 8) { prim->b3 -= 4; - } +REDACTED prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 = prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3; if (!(g_Timer & 1)) { diff --git a/src/weapon/w_037.c b/src/weapon/w_037.c index 27be168d13..08472b234b 100644 --- a/src/weapon/w_037.c +++ b/src/weapon/w_037.c @@ -335,7 +335,7 @@ static void func_ptr_80170008(Entity* self) { switch (self->step) { case 0: - g_api.CheckCollision(self->posX.i.hi, self->posY.i.hi, &collider, 0); +REDACTED if (collider.effects & EFFECT_SOLID) { DestroyEntity(self); return; diff --git a/src/weapon/w_042.c b/src/weapon/w_042.c index 6cf8d9025e..a2c2ad7809 100644 --- a/src/weapon/w_042.c +++ b/src/weapon/w_042.c @@ -34,17 +34,17 @@ static void DebugShowWaitInfo(const char* msg) { if (D_12A000_8017B5EC++ & 4) { FntPrint(D_12A000_8017A760); // TODO: inline } - DrawSync(0); - VSync(0); +REDACTED +REDACTED PutDrawEnv(&g_CurrentBuffer->draw); PutDispEnv(&g_CurrentBuffer->disp); - FntFlush(-1); -} - +REDACTED +REDACTED +REDACTED static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); - while (!PadRead(0)) +REDACTED DebugShowWaitInfo(msg); } @@ -273,7 +273,7 @@ static void func_ptr_80170008(Entity* self) { break; case 2: self->posY.val += self->velocityY; - if (self->animFrameDuration < 0) { +REDACTED DestroyEntity(self); return; } diff --git a/src/weapon/w_046.c b/src/weapon/w_046.c index a8ee6f577b..cd80460616 100644 --- a/src/weapon/w_046.c +++ b/src/weapon/w_046.c @@ -351,8 +351,8 @@ static s32 func_ptr_80170004(Entity* self) { s32 var_v1_2; maskedParams = self->params & 0x7F00; - self->posX.i.hi = PLAYER.posX.i.hi; - self->posY.i.hi = PLAYER.posY.i.hi; +REDACTED +REDACTED switch (self->step) { case 0: self->primIndex = g_api.AllocPrimitives(PRIM_G4, PrimCount); diff --git a/src/weapon/w_047.c b/src/weapon/w_047.c index 67334d8658..8b01a38d0e 100644 --- a/src/weapon/w_047.c +++ b/src/weapon/w_047.c @@ -183,9 +183,9 @@ void EntityWeaponAttack(Entity* self) { prim->u2 = prim->u3 = 0xC0; prim->v2 = prim->v3 = self->ext.weapon_047.unk88 + 0x40; - prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = - prim->b1 = 0; - prim->r2 = prim->g2 = prim->b2 = prim->r3 = prim->g3 = +REDACTED +REDACTED +REDACTED prim->b3 = 0xFF; prim->clut = 0x159; prim->tpage = 0x19; diff --git a/src/weapon/w_051.c b/src/weapon/w_051.c index 34096faa65..51f9ad05e0 100644 --- a/src/weapon/w_051.c +++ b/src/weapon/w_051.c @@ -307,12 +307,12 @@ static void EntityWeaponAttack(Entity* self) { anim = &D_169000_8017ACD8[subType]; if (PLAYER.ext.player.anim < anim->frameStart || PLAYER.ext.player.anim >= anim->frameStart + 7 || !g_Player.unk46) { - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->animSet = 10; self->palette = 0x110; self->unk5A = 100; @@ -371,12 +371,12 @@ s32 func_ptr_80170004(Entity* self) { subType >>= 8; anim = &D_169000_8017AD18[subType]; if (PLAYER.ext.player.anim < 0xD6 || PLAYER.ext.player.anim >= 0xD8) { - DestroyEntity(self); - return; - } - - switch (self->step) { - case 0: +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED +REDACTED self->animSet = 10; self->palette = 0x110; self->unk5A = 100;