Curation round 24 (code only): pickups and slots, level generation with the Ascent and the Death Certificate return, rooms and grid entities, Game and Entity core with Polty, Clutch, Matriarch, Chimera, Bumbino and other bosses, the player's remaining branches, familiars and weapons, HUD and engine stubs, 004b6a90 renamed push_back, shared constants folded (66 duplicates, 38 main gaps)

This commit is contained in:
shweet committed 2026-11-23 03:27:24 -05:00
1 parent 11c71fe041
commit 534339a496
232 files changed
+14610 -3185

No files matched your search

+1 -1
View File
@@ -470,7 +470,7 @@
00684b90 hsv_to_rgb hue/60 sextant switch, chroma*value
00652a90 _has_flag_0x110 ? ? (this+0x110 & mask)!=0
00505b80 _Entity_NPC::GetColorWithFlash ? ? copies Color, multiplies when +0xc>0; NPC ResetColor/Update
004b6a90 std::deque<int>::push_front 4-per-block deque front insertion
004b6a90 std::deque<int>::push_back 4-per-block deque back insertion: grows when (offset+size)%4==0, writes at offset+size, offset unchanged (was push_front; the decompile proves push_back)
00452be0 _ptr_deref_or_minus1 ? ? returns *ptr or -1
00435d60 Entity::SetTargetPosition writes +0x334/+0x338 (_targetPosition)
00426980 std::vector<Vector>::_Tidy frees 8-byte element vector
Can't render this file because it is too large.
+13 -13
View File
@@ -115397,7 +115397,7 @@ LAB_004b5198:
piVar5[0x2d9] = 9;
(**(code **)(*piVar5 + 0xc))();
VStack_130.x = 0.0;
std::deque<int>::push_front(&VStack_130);
std::deque<int>::push_back(&VStack_130);
VStack_104.x = (float)npc->_child;
uVar15 = ((npc->_entityDeque)._size + (npc->_entityDeque)._offset) - 1;
uVar16 = uVar15 & 3;
@@ -116072,11 +116072,11 @@ LAB_004b67fd:
}
//@@ 004b6a90 std::deque<int>::push_front
//@@ 004b6a90 std::deque<int>::push_back
/* DB: 4-per-block deque front insertion */
void std::deque<int>::push_front(undefined4 *param_1)
void std::deque<int>::push_back(undefined4 *param_1)
{
uint uVar1;
@@ -171750,7 +171750,7 @@ LAB_00519d09:
*(undefined4 *)(extraout_EAX_00 + 0x3bc) = npc;
std::multiset<unsigned_int>::insert((undefined4 *)(extraout_EAX_00 + 0x3bc));
local_160.y = 0.0;
std::deque<int>::push_front(&local_160.y);
std::deque<int>::push_back(&local_160.y);
local_160.y = (float)((npc->_entityDeque)._offset + (npc->_entityDeque)._size);
uVar5 = (uint)&((Entity_NPC *)((int)local_160.y + -0xf60))->field_0xf5f & 3;
iVar7 = *(int *)((int)(npc->_entityDeque)._map +
@@ -245573,7 +245573,7 @@ void __fastcall NpcAI::ENTITY_VISAGE(Entity_NPC *npc)
(npc->_v1).x = 0.0;
Entity_NPC::ClearDequeRefs(npc);
local_350.x = 0.0;
std::deque<int>::push_front(&local_350);
std::deque<int>::push_back(&local_350);
(npc->_v1).y = 150.0;
uVar12 = Random();
scratchVec.x = (npc->_pos).x + 0.0;
@@ -247135,7 +247135,7 @@ void __fastcall NpcAI::ENTITY_VISAGE_mask(Entity_NPC *npc)
tmpEntity->_parent = npc;
std::multiset<unsigned_int>::insert(&tmpEntity->_parent);
local_10c.x = 0.0;
std::deque<int>::push_front(&local_10c);
std::deque<int>::push_back(&local_10c);
local_f8.y = (float)((npc->_entityDeque)._size + (npc->_entityDeque)._offset);
uVar8 = (int)local_f8.y - 1U & 3;
iVar4 = *(int *)((int)(npc->_entityDeque)._map +
@@ -258935,7 +258935,7 @@ LAB_005b8f47:
afStack_7f0[1] = (float)*puVar14;
pEVar6 = (Entity_Player *)Entity_Familiar::Player();
if (pEVar6 == curPlayer) {
std::deque<int>::push_front();
std::deque<int>::push_back();
}
uVar24 = uVar24 + 1;
uVar9 = EntityList::Size((EntityList *)boneOrbitals);
@@ -259073,7 +259073,7 @@ LAB_005c1f2d:
tmpVec = Vector::__mul(tmpVec,&bookOfTheDeadScaled2,&bookOfTheDeadRandomScale1);
Entity::SetVelocity(boneOrbital,tmpVec);
Entity::ClearEntityFlags(boneOrbital,4);
std::deque<int>::push_front();
std::deque<int>::push_back();
}
::Color::Color(bookOfTheDeadColor1);
fVar29 = random_float();
@@ -259198,7 +259198,7 @@ LAB_005c1f2d:
tmpVec = Vector::__mul(tmpVec,&bookOfTheDeadScaled6,&bookOfTheDeadRandomScale2);
Entity::SetVelocity(boneOrbital2,tmpVec);
Entity::ClearEntityFlags(boneOrbital2,4);
std::deque<int>::push_front();
std::deque<int>::push_back();
}
::Color::Color(bookOfTheDeadColor2);
fVar29 = random_float();
@@ -312245,7 +312245,7 @@ short Level::compute_room_distances
queueProxyRef[1] = 0;
*queueProxyRef = (int)&queueProxyRef;
local_8 = 0;
std::deque<int>::push_front(&local_54);
std::deque<int>::push_back(&local_54);
distances[local_54] = 0;
if (queueSize != 0) {
do {
@@ -312273,7 +312273,7 @@ short Level::compute_room_distances
}
if (newDistance < (ushort)distancesLocal[neighborRoom]) {
distancesLocal[neighborRoom] = (short)newDistance;
std::deque<int>::push_front(&neighborRoom);
std::deque<int>::push_back(&neighborRoom);
}
iVar5 = iVar5 + 1;
psVar2 = psVar3;
@@ -510395,7 +510395,7 @@ Entity * __thiscall Entity_Player::AddSwarmFlyOrbital(Entity_Player *game,Vector
}
else if ((*(int *)(familiar + 0x2c) == 0xe5) &&
(*(Entity_Player **)(familiar + 0x410) == game)) {
std::deque<int>::push_front(&familiar);
std::deque<int>::push_back(&familiar);
}
entityIndex = entityIndex + 1;
} while (entityIndex < *(uint *)((int)pvVar3 + 0x1264));
@@ -935274,7 +935274,7 @@ void __thiscall PlayerManager::restore_controller_assignment(PlayerManager *this
local_8._0_1_ = 0;
local_8._1_3_ = 0;
local_14 = g_manager->_activeControllerIndex;
std::deque<int>::push_front(&local_14);
std::deque<int>::push_back(&local_14);
uVar6 = 0;
while( true ) {
(**(code **)(PTR_vftable_00c57b2c + 0xc))(0xffffffff,uVar2);
+1 -1
View File
@@ -1100,7 +1100,7 @@
004b3f10 FUN_004b3f10 437
004b40d0 NpcHelper::heretic_choose_attack 740
004b43c0 NpcAI::ENTITY_HERETIC 1264
004b6a90 std::deque<int>::push_front 132
004b6a90 std::deque<int>::push_back 132
004b6b20 FUN_004b6b20 443
004b6ce0 FUN_004b6ce0 130
004b6d70 FUN_004b6d70 68
Can't render this file because it is too large.
-127
View File
@@ -1,127 +0,0 @@
#include "classes.h"
// 004212c0
void BossOverlay::update()
{
uint8_t isEndTriggered;
int *in_ECX;
int *counter;
Game *game;
Manager *manager;
SoundEffects *sfxManager;
if (*in_ECX != 0) {
if ((*in_ECX == 1) &&
(((in_ECX[0xf] == 0 || ((char)in_ECX[0x13] == '\0')) &&
((char)in_ECX[(in_ECX[1] + 6) * 0xe] == '\0')))) {
*in_ECX = 0;
}
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(in_ECX) + 0x111)) != '\0') {
AnimationState::Update(GHIDRA_CAST<AnimationState *>((in_ECX + 0xe)));
AnimationState::Update(GHIDRA_CAST<AnimationState *>((in_ECX + 0x16)));
}
if (in_ECX[1] == 3) {
if (in_ECX[0xf] != 0) {
isEndTriggered =
AnimationState::IsEventTriggered(GHIDRA_CAST<AnimationState *>((in_ECX + 0xe)),&DAT_00b1c00c);
manager = g_manager;
if (isEndTriggered != 0) {
sfxManager = &g_manager->_sfxManager;
counter = (g_manager->_persistentGameData)._cutsceneCounters + 0x19;
*counter = *counter + 1;
*GHIDRA_CAST<uint8_t *>(&manager->_persistentGameData) = 1;
counter = (manager->_persistentGameData)._cutsceneCounters + 2;
*counter = *counter + 1;
*GHIDRA_CAST<uint8_t *>(&manager->_persistentGameData) = 1;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((manager->_cutsceneManager))) + 0x848))) = 1;
(manager->_cutsceneManager)._isQueuedCleanup = 0;
manager->_cutsceneNextMenuState = 1;
(manager->_cutsceneManager)._queuedCutsceneId = 0x19;
(manager->_achievementOverlay)._isPopupBlocked = 1;
if ((manager->_sfxManager)._volumeModifier != 1.0) {
(manager->_sfxManager)._volumeModifier = 1.0;
(GHIDRA_CAST<SoundEffects *>((sfxManager)))->SoundEffects::ClearVolumeModifier();
}
game = g_game;
(manager->_sfxManager)._volumeModifierStep = 0.005;
Game::StartRoomTransition(game,-10,-1,1,GHIDRA_CAST<Entity_Player *>(0x0),-1);
RoomTransition::Update(&g_game->_roomTransition);
return;
}
if ((in_ECX[0xf] != 0) && ((char)in_ECX[0x13] != '\0')) {
return;
}
}
*in_ECX = 0;
in_ECX[1] = 0;
}
}
return;
}
// 004214b0
void BossOverlay::play(int overlayType)
{
void *sprite = this;
uint8_t bVar1;
LayerState *layer;
uint8_t *currentName;
uint32_t compareResult;
uint8_t unk;
uint8_t *targetName;
uint8_t *anim;
bool isLess;
uint8_t *animData;
ANM2 *sprite;
if (4 < GHIDRA_UINT(overlayType)) {
return;
}
sprite = GHIDRA_CAST<ANM2 *>((GHIDRA_INT(sprite) + 8));
ANM2::Load(sprite,GHIDRA_CAST<std_string *>((GHIDRA_INT(sprite) + overlayType * 0x38 + 0x120)),1);
ANM2::LoadGraphics(sprite,unk);
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sprite) + 4)) = overlayType;
if ((overlayType == 2) || (overlayType == 3)) {
layer = ANM2::GetLayer(sprite,&DAT_00000004);
layer->_bitflags = layer->_bitflags | 0x20;
}
anim = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(sprite) + overlayType * 0x38 + 0x138));
if (0xf < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sprite) + overlayType * 0x38 + 0x14c))) {
anim = *GHIDRA_CAST<uint8_t **>(anim);
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sprite) + 0x3c)) != 0) {
animData = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(sprite) + 0x3c));
currentName = animData;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
currentName = *GHIDRA_CAST<uint8_t **>(animData);
}
targetName = anim;
do {
bVar1 = *currentName;
isLess = bVar1 < *targetName;
if (bVar1 != *targetName) {
LAB_00421555:
compareResult = -GHIDRA_UINT(isLess) | 1;
goto LAB_0042155a;
}
if (bVar1 == 0) break;
bVar1 = currentName[1];
isLess = bVar1 < targetName[1];
if (bVar1 != targetName[1]) goto LAB_00421555;
currentName = currentName + 2;
targetName = targetName + 2;
} while (bVar1 != 0);
compareResult = 0;
LAB_0042155a:
if ((compareResult == 0) && ((animData[0x34] == 0 || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(sprite) + 0x4c)) != '\0'))))
goto LAB_00421582;
}
bVar1 = ANM2::SetAnimation(sprite,anim,1);
if (bVar1 != 0) {
AnimationState::Rewind(GHIDRA_CAST<AnimationState *>((GHIDRA_INT(sprite) + 0x38)));
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(sprite) + 0x4c)) = 1;
}
LAB_00421582:
*GHIDRA_CAST<uint32_t *>(sprite) = 1;
return;
}
+4 -91
View File
@@ -219,6 +219,7 @@ struct DeathmatchTypeSwordFight;
struct DeathmatchTypeVenom;
struct DebugRenderer;
struct DeliriousBoss;
struct DescriptionScroll;
struct DestinationQuad;
struct Devolve;
struct DimensionReturn;
@@ -373,12 +374,14 @@ struct ItemConfig_Costume;
struct ItemConfig_Item;
struct ItemConfig_Pill;
struct ItemConfig_PlayerForm;
struct ItemInfoBox;
struct ItemInfoHUD;
struct ItemOverlay;
struct ItemPool;
struct ItemPool_Item;
struct ItemUse;
struct ItemsHit;
struct JacobsCurseDelay;
struct KAGE_Filesys_File;
struct KAGE_Filesys_FileManager;
struct KAGE_Filesys_FileStream;
@@ -568,6 +571,7 @@ struct RerollEntry;
struct RevivePlayerMenu;
struct RichText;
struct RichTextIcon;
struct RichTextLine;
struct RichTextSpan;
struct RockDrop;
struct Room;
@@ -1004,14 +1008,6 @@ struct BlendMode {
};
struct BossOverlay {
static void update(); // 004212c0
void play(int overlayType); // 004214b0
int _state;
};
LAYOUT32(offsetof(BossOverlay, _state) == 0x0);
struct BufferedStream {
};
@@ -1128,22 +1124,6 @@ struct ConstLobby {
};
struct DailyChallenge {
void Init(uint32_t dailyDate); // 00426a50
unsigned int _id;
unsigned int _seed;
bool _isPractice;
uint8_t _pad_0x9[0x3];
unsigned int _specialDailyId;
uint8_t _params[0x4]; // ChallengeParam
};
LAYOUT32(offsetof(DailyChallenge, _id) == 0x0);
LAYOUT32(offsetof(DailyChallenge, _seed) == 0x4);
LAYOUT32(offsetof(DailyChallenge, _isPractice) == 0x8);
LAYOUT32(offsetof(DailyChallenge, _specialDailyId) == 0xc);
LAYOUT32(offsetof(DailyChallenge, _params) == 0x10);
struct DamageInfo {
DamageInfo(); // 006a8190
};
@@ -3704,12 +3684,6 @@ struct RenderTarget {
};
struct RichTextSpan {
uint8_t try_merge(void *other); // 009ef9a0
static void move_construct(void *dest, void *source); // 009f1ef0
};
struct RoomConfigMode {
void ctor(); // 00828b60
void Clear(); // 00828c00
@@ -5419,12 +5393,10 @@ void FUN_0040c610(); // 0040c610
uint32_t FUN_0040c630(); // 0040c630
void FUN_0040c690(); // 0040c690
uint32_t FUN_0040c6b0(); // 0040c6b0
uint32_t FUN_0040c6f0(); // 0040c6f0
void FUN_0040c720(uint8_t *param_1); // 0040c720
void deallocate(void *ptr, uint32_t count); // 0040c740
void FUN_0040c790(); // 0040c790
uint32_t FUN_0040c7c0(); // 0040c7c0
void render_color_stack_push(ColorMod *color); // 0040c890
int memcmp_eq(void *a, void *b, uint32_t size); // 0040ca70
void FUN_0040cad0(); // 0040cad0
uint8_t str_eq(uint8_t *a, uint32_t lengthA, uint8_t *b, uint32_t lengthB); // 0040cae0
@@ -5549,9 +5521,6 @@ uint32_t * FUN_00420020(int param_1, int param_2, uint32_t *param_3); // 004200
RoomTransition * FUN_00420ae0(); // 00420ae0
void FUN_00420b00(); // 00420b00
void FUN_00420b20(); // 00420b20
void FUN_00421260(); // 00421260
void FUN_00421400(); // 00421400
void FUN_004215a0(char *param_1); // 004215a0
void FUN_004215e0(uint32_t *param_1); // 004215e0
void FUN_00421620(uint8_t *param_1); // 00421620
DailyChallenge * FUN_00421780(); // 00421780
@@ -5577,8 +5546,6 @@ int FUN_004253d0(); // 004253d0
void FUN_00425410(); // 00425410
void online_stats_destroy(void *self); // 00425430
void online_stats_register_players(); // 004257b0
void FUN_00427290(); // 00427290
int holiday_get_current(uint32_t yyyymmdd); // 00427870
void FUN_00428560(uint32_t *param_1, uint32_t param_2); // 00428560
void FUN_004286b0(int *param_1, int *param_2); // 004286b0
void FUN_00428880(); // 00428880
@@ -5771,7 +5738,6 @@ void FUN_00499950(); // 00499950
void FUN_004999b0(); // 004999b0
uint32_t FUN_004999d0(uint32_t param_1); // 004999d0
uint32_t FUN_00499db0(); // 00499db0
uint32_t FUN_0049d100(); // 0049d100
void FUN_004a11b0(); // 004a11b0
int FUN_004a2920(); // 004a2920
void FUN_004aaaa0(void *param_1, int param_2); // 004aaaa0
@@ -5839,7 +5805,6 @@ void pow_wrapper(); // 00505b40
void set_byte_0x101(void *self, uint8_t value); // 00505b50
int FUN_00505ca0(); // 00505ca0
uint32_t * FUN_00505ce0(); // 00505ce0
long double FUN_00515290(Vector *param_1, uint32_t param_2, int param_3); // 00515290
void npc_distribute_orbit_angles(Entity_NPC *npc); // 00547040
int FUN_0054d1b0(int param_1); // 0054d1b0
void FUN_00557b50(uint32_t param_1); // 00557b50
@@ -5852,8 +5817,6 @@ void FUN_0056ff00(uint32_t *param_1, uint32_t param_2, uint32_t param_3); // 00
bool FUN_0056ff60(uint32_t param_1); // 0056ff60
void FUN_00571170(); // 00571170
void FUN_00571230(void *param_1, int param_2); // 00571230
void FUN_005729a0(int *param_1); // 005729a0
void FUN_00572c10(int param_1); // 00572c10
uint32_t * FUN_00575fe0(int *param_1, uint32_t param_2, uint32_t param_3, uint32_t param_4, uint32_t param_5, uint32_t param_6, int *param_7, uint32_t param_8, uint32_t param_9); // 00575fe0
void FUN_00579700(); // 00579700
uint32_t FUN_00579760(); // 00579760
@@ -6047,7 +6010,6 @@ uint32_t FUN_0060dae0(); // 0060dae0
void FUN_0062e0e0(int param_1); // 0062e0e0
void FUN_00638e20(); // 00638e20
void FUN_0063c060(int param_1); // 0063c060
void FUN_0063e180(); // 0063e180
void FUN_006431b0(); // 006431b0
void FUN_0064b6a0(); // 0064b6a0
void FUN_0064d570(uint32_t param_1); // 0064d570
@@ -6079,7 +6041,6 @@ int FUN_00652a30(uint32_t param_1, uint32_t param_2, uint32_t param_3, uint8_t p
void FUN_00652a70(); // 00652a70
bool _has_flag_0x110(uint32_t param_1); // 00652a90
int FUN_00652ae0(); // 00652ae0
void reroll_entity_to_free_tile(int param_1); // 0065ad30
bool FUN_0065cfe0(uint32_t param_1); // 0065cfe0
int FUN_0065d010(); // 0065d010
void FUN_0065d020(); // 0065d020
@@ -6092,9 +6053,6 @@ void FUN_0065d0c0(); // 0065d0c0
void FUN_0065d160(); // 0065d160
uint8_t * FUN_0065d1f0(); // 0065d1f0
Vector * FUN_006653c0(Vector *param_1); // 006653c0
void FUN_006653e0(int param_1); // 006653e0
void FUN_006655e0(); // 006655e0
void FUN_00665630(); // 00665630
void FUN_00665a30(); // 00665a30
void FUN_00665a50(); // 00665a50
void FUN_00665a90(Entity *param_1); // 00665a90
@@ -6120,7 +6078,6 @@ uint32_t FUN_0067f030(); // 0067f030
void FUN_0067f2e0(); // 0067f2e0
uint8_t string_to_bool(void *self); // 0067f600
void ResolveRelativePath(uint8_t *anmPath, uint8_t *relPath, uint8_t *outPath); // 0067f670
void ExtractAngleBracketText(); // 0067fdf0
void FUN_00680060(size_t param_1); // 00680060
void shader_stack_push(int shaderIndex); // 00682280
void FUN_00682350(); // 00682350
@@ -6428,7 +6385,6 @@ void FUN_00738390(uint32_t param_1); // 00738390
void FUN_007383b0(); // 007383b0
int FUN_00738620(uint32_t param_1, uint32_t param_2); // 00738620
void FUN_00741cc0(); // 00741cc0
void FUN_00741cf0(); // 00741cf0
void FUN_007435c8(); // 007435c8
void FUN_0074371e(); // 0074371e
void FUN_0074399a(); // 0074399a
@@ -6507,8 +6463,6 @@ void FUN_00757980(uint32_t *param_1); // 00757980
void FUN_00757a10(); // 00757a10
uint32_t FUN_00758590(); // 00758590
int FUN_00759260(); // 00759260
void FUN_0075d9f0(uint32_t param_1); // 0075d9f0
uint32_t FUN_0075ef20(ANM2 *param_1, int param_2); // 0075ef20
void FUN_00770640(float *param_1); // 00770640
void FUN_007792f0(uint32_t param_1, uint32_t param_2); // 007792f0
uint32_t FUN_007826c0(); // 007826c0
@@ -6530,7 +6484,6 @@ void FUN_007d9360(); // 007d9360
uint32_t FUN_007d9ca0(); // 007d9ca0
uint32_t FUN_007da770(); // 007da770
uint32_t FUN_007dac30(); // 007dac30
void FUN_007dad80(); // 007dad80
int FUN_007dafb0(); // 007dafb0
void FUN_007dc610(); // 007dc610
void FUN_007dc620(uint32_t *param_1); // 007dc620
@@ -6614,7 +6567,6 @@ uint32_t * FUN_007e3060(uint32_t *param_1); // 007e3060
void FUN_007e3190(); // 007e3190
void FUN_007e3230(); // 007e3230
void FUN_007e4890(); // 007e4890
uint8_t pathfinder_can_reach_pos(Vector *targetPos, Vector *startPos, Room *room); // 007e7820
void FUN_007e8620(); // 007e8620
void FUN_007e86e0(int param_1, int param_2); // 007e86e0
void * vector_PathNode_emplace_reallocate_copy(void *self, void *where, void *value); // 007e8810
@@ -6690,7 +6642,6 @@ void FUN_00839840(float *param_1); // 00839840
void FUN_00839960(); // 00839960
void FUN_008399a0(int *param_1); // 008399a0
void FUN_00839b40(); // 00839b40
void render_beast_arena_background(void *self, int pass); // 0083a3d0
void FUN_0083aae0(uint8_t param_1, int *param_2, uint32_t *param_3); // 0083aae0
void FUN_0083b830(); // 0083b830
void FUN_0083bf50(); // 0083bf50
@@ -6699,7 +6650,6 @@ void Catch_All_0083c241(); // 0083c241
uint32_t * FUN_0083c270(uint32_t *param_1, uint32_t *param_2, uint32_t *param_3); // 0083c270
void FUN_0083c320(int *param_1, int *param_2); // 0083c320
void FUN_0083c480(); // 0083c480
void item_pool_icons_render(void *iconLayer, Vector *position, KColor *color); // 0083d8c0
char * FUN_00840510(); // 00840510
std_string * int_to_string(std_string *outString, int value); // 00840540
void FUN_0084abc0(uint32_t *param_1, float *param_2, uint32_t *param_3, uint32_t *param_4); // 0084abc0
@@ -8533,16 +8483,6 @@ void kick_player_menu_render(); // 008d1600
void FUN_008d2810(); // 008d2810
uint32_t * FUN_008d2880(uint32_t *param_1, int param_2); // 008d2880
void FUN_008d28c0(uint32_t param_1, uint8_t *param_2); // 008d28c0
void FUN_008d47c0(int *param_1, uint32_t *param_2, uint32_t *param_3, uint32_t param_4, float param_5, uint32_t param_6); // 008d47c0
void FUN_008d5440(float *param_1); // 008d5440
void FUN_008d5640(float *param_1); // 008d5640
void FUN_008d57f0(float *param_1); // 008d57f0
void FUN_008d5da0(int *param_1, ANM2 *param_2, float *param_3); // 008d5da0
void render_item_info_text(void *self, void *text, Vector *position, int width, uint32_t lineStart, uint32_t lineEnd); // 008d5f70
int FUN_008d69d0(int param_1); // 008d69d0
uint32_t menu_item_description_build(void *self, int *item, uint32_t startLine, int unused, float maxHeight); // 008d7cb0
int FUN_008d8460(int *param_1); // 008d8460
void item_info_update_charge_bar(void *self, int collectibleId, Entity_Player *player); // 008d8870
void FUN_008d8a90(); // 008d8a90
bool FUN_008dc0a0(int *param_1, int *param_2); // 008dc0a0
bool FUN_008dc0d0(uint32_t param_1, int *param_2, int *param_3, uint8_t **param_4, int *param_5, int *param_6); // 008dc0d0
@@ -8830,7 +8770,6 @@ void float_split(); // 00925f30
void FUN_00926240(); // 00926240
void FUN_00926460(uint8_t param_1); // 00926460
uint32_t FUN_009264b0(uint8_t *param_1, uint8_t *param_2); // 009264b0
int save_backup_find_latest(PersistentGameData *gameData); // 00926510
void FUN_00929660(char param_1); // 00929660
uint8_t * FUN_00929b00(); // 00929b00
uint32_t FUN_00929b20(); // 00929b20
@@ -8880,7 +8819,6 @@ void cutscene_render_skip_vote_count(void *cutscene, void *state); // 0095eb60
uint32_t * FUN_00960880(void *param_1, uint32_t *param_2); // 00960880
void FUN_00960bc0(); // 00960bc0
void FUN_0096d120(int *param_1); // 0096d120
void pressure_plate_kill_enemies_timer_callback(int *param_1); // 00983f30
void FUN_0098b0a0(); // 0098b0a0
void FUN_0098b130(); // 0098b130
void FUN_00993740(); // 00993740
@@ -8898,7 +8836,6 @@ void ** vector_LaserSample_erase(void *self, void **outIter, void *where); // 0
void FUN_009a1770(uint32_t *param_1); // 009a1770
void * vector_LaserSample_emplace_reallocate(void *self, void *where, void *value); // 009a17b0
void FUN_009a1940(uint32_t *param_1, uint32_t *param_2, int param_3); // 009a1940
float * FUN_009a6320(float *param_1, int param_2, int param_3); // 009a6320
void FUN_009a8a40(); // 009a8a40
void _player_hud_set_heart_anim_state(int param_1); // 009a90b0
void move_directory_files(); // 009a90e0
@@ -9003,7 +8940,6 @@ void FUN_009e6e10(int param_1); // 009e6e10
void FUN_009e6e50(uint8_t *param_1); // 009e6e50
void FUN_009e6e80(); // 009e6e80
void FUN_009e6e90(Weapon_Brimstone *param_1, uint32_t param_2); // 009e6e90
void save_screenshot(); // 009e6eb0
void FUN_009e72e0(); // 009e72e0
void FUN_009e7300(); // 009e7300
void FUN_009e7310(); // 009e7310
@@ -9050,13 +8986,10 @@ void FUN_009ebbf0(); // 009ebbf0
void Catch_All_009ebf8f(); // 009ebf8f
void FUN_009ebfc0(); // 009ebfc0
void FUN_009ef980(uint32_t *param_1); // 009ef980
Vector * rich_text_render(void *self, Vector *outSize, uint8_t *text, Vector *position, KColor *color, float scale, int maxWidth); // 009efdb0
void rich_text_layout(void *copiedSpan, uint8_t *markup, KColor *baseColor, uint32_t maxWidth, void *outLines, float scale); // 009f0290
void FUN_009f1be0(uint32_t *param_1); // 009f1be0
void FUN_009f1d20(char *param_1, char *param_2); // 009f1d20
void FUN_009f1d50(void *param_1, int param_2); // 009f1d50
void Catch_All_009f20c7(); // 009f20c7
void FUN_009f20f0(void *param_1); // 009f20f0
void Catch_All_009f229d(); // 009f229d
uint32_t * FUN_009f2410(uint32_t *param_1); // 009f2410
void FUN_009f2480(); // 009f2480
@@ -9167,7 +9100,6 @@ void FUN_00a1d4d0(uint32_t param_1, uint32_t *param_2); // 00a1d4d0
void FUN_00a1d5a0(uint32_t *param_1); // 00a1d5a0
void FUN_00a1d600(); // 00a1d600
void FUN_00a1d6b0(int param_1); // 00a1d6b0
void render_color_quad(Vector *from, Vector *to, KColor *fromColor, KColor *toColor, float thickness); // 00a1d710
void FUN_00a1e050(); // 00a1e050
void FUN_00a1e1f0(); // 00a1e1f0
uint32_t FUN_00a1e210(); // 00a1e210
@@ -20717,14 +20649,6 @@ ItemConfig * GetItemConfig(); // 0042ca00
int Random(int Max); // 0067f010
Vector * GetRandomPickupVelocity(Vector *outVelocity, Vector *position, uint32_t pickupVelType, RNG *rng); // 006ee440
}
namespace ItemInfo {
uint8_t is_collectible_seen(int param_1); // 0083d760
uint8_t is_pickup_known(int param_1); // 0083d7c0
void measure(uint32_t *param_1); // 00840250
void measure_line(uint8_t *param_1, float *param_2, int *param_3); // 008402f0
void render_popup_callback(int param_1, uint32_t param_2); // 00840370
void render_line(uint8_t *param_1, Vector *param_2, int param_3); // 008404a0
}
namespace KAGE_Memory {
void * heap_alloc(uint32_t heapId, uint64_t *size); // 00a230b0
void heap_free(uint32_t heapId, void *ptr); // 00a23160
@@ -20758,29 +20682,18 @@ void ENTITY_BEAST_ultra_pestilence_maggot(Entity_NPC *npc); // 0044b6f0
void ENTITY_BEAST_ultra_war(Entity_NPC *npc); // 0044c070
void ENTITY_BEAST_ultra_war_fire_burst(Entity_NPC *npc); // 0044ee60
void ENTITY_BEAST_ultra_war_bomb(Entity_NPC *npc); // 0044f2b0
void ENTITY_LIL_BLUB(Entity_NPC *npc); // 00450da0
void ENTITY_BUMBINO(Entity_NPC *npc); // 00499de0
void ENTITY_CHIMERA_head_update(Entity_NPC *npc); // 0049cd90
void ENTITY_CHIMERA_body(Entity_NPC *npc); // 0049d130
uint32_t ENTITY_CHIMERA(Entity_NPC *npc); // 0049fa10
void ENTITY_MATRIARCH(Entity_NPC *npc); // 004c59d0
void ENTITY_BUTT_SLICKER(Entity_NPC *npc); // 0054d250
uint32_t ENTITY_POLTY(Entity_NPC *npc); // 0055d230
void ENTITY_CLUTCH(Entity_NPC *npc); // 00573030
void ENTITY_SCOURGE_chain(Entity_NPC *npc); // 00584140
void ENTITY_SCOURGE_main(Entity_NPC *npc); // 005864b0
void ENTITY_SCOURGE_projectile_attack(Entity_NPC *npc); // 00586c40
void ENTITY_SCOURGE(Entity_NPC *npc); // 00587aa0
void ENTITY_SINGE_body(Entity_NPC *npc); // 0058aed0
void ENTITY_SINGE_ball(Entity_NPC *npc); // 0058d8b0
void ENTITY_SIREN_main(Entity_NPC *npc); // 0058ec70
void siren_release_stolen_items(Entity_NPC *npc); // 005911b0
void ENTITY_SIREN(Entity_NPC *npc); // 00591460
void ENTITY_SIREN_HELPER(Entity_NPC *npc); // 00591cc0
}
namespace OnlinePlayerInfo {
void render_items(float *param_1); // 008d4940
}
namespace OnlineStats {
void compute_awards(); // 004254b0
}
-389
View File
@@ -1,389 +0,0 @@
#include "classes.h"
// 00426a50
void DailyChallenge::Init(uint32_t dailyDate)
{
code *pcVar1;
int iVar2;
tm *tmResult;
uint32_t uVar3;
uint32_t rolledPlayerType;
bool isGroundhogDay;
RNG rng;
uint8_t date [8];
__time64_t dateTime;
tm dateTm;
uint32_t local_c;
uint8_t auStack_8 [4];
local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4));
this->_id = 0;
this->_seed = 0;
this->_specialDailyId = 0;
this->_isPractice = 0;
ChallengeParam::Reset(&this->_params);
(this->_params)._isPathTypeSet = 1;
iVar2 = holiday_get_current(dailyDate);
this->_specialDailyId = iVar2;
this->_id = dailyDate;
DateTime::set_from_yyyymmdd(date,dailyDate);
isGroundhogDay = this->_specialDailyId == 2;
rng._seed = dailyDate;
if (isGroundhogDay) {
rng._seed = dailyDate - 1;
}
rng._shift3 = 0x15;
rng._shift1 = 10;
rng._shift2 = 9;
(this->_params)._playerType = 0x29;
uVar3 = dailyDate - 1;
if (!isGroundhogDay) {
uVar3 = dailyDate;
}
do {
if (uVar3 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
rng._seed = GHIDRA_UINT(rng._seed) >> 10 ^ rng._seed;
rng._seed = rng._seed << 9 ^ rng._seed;
rng._seed = GHIDRA_UINT(rng._seed) >> 0x15 ^ rng._seed;
rolledPlayerType = GHIDRA_UINT(rng._seed) % 0x14;
(this->_params)._playerType = rolledPlayerType;
uVar3 = rng._seed;
} while ((((rolledPlayerType == 0xc) || (rolledPlayerType == 0xb)) || (rolledPlayerType == 0x11))
|| (rolledPlayerType == 0x14));
if (rng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
rng._seed = GHIDRA_UINT(rng._seed) >> 10 ^ rng._seed;
rng._seed = rng._seed << 9 ^ rng._seed;
rng._seed = GHIDRA_UINT(rng._seed) >> 0x15 ^ rng._seed;
switch(rng._seed & 3) {
case 0:
(this->_params)._endStage = 6;
break;
case 1:
(this->_params)._endStage = 8;
break;
case 2:
(this->_params)._endStage = 10;
break;
case 3:
(this->_params)._endStage = 0xb;
}
if ((this->_params)._endStage < 10) {
LAB_00426bde:
iVar2 = 1;
}
else {
if (rng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
rng._seed = GHIDRA_UINT(rng._seed) >> 10 ^ rng._seed;
rng._seed = rng._seed << 9 ^ rng._seed;
rng._seed = GHIDRA_UINT(rng._seed) >> 0x15 ^ rng._seed;
if ((rng._seed & 1U) != 0) goto LAB_00426bde;
iVar2 = 0;
}
(this->_params)._pathType = iVar2;
(this->_params)._isMegaSatan = 0;
(this->_params)._difficulty = 0;
if ((date[0] & 2) != 0) {
dateTime = _mkgmtime64(&dateTm);
}
if ((date[0] & 3) != 0) {
tmResult = _gmtime64(&dateTime);
dateTm.tm_sec = tmResult->tm_sec;
dateTm.tm_min = tmResult->tm_min;
dateTm.tm_hour = tmResult->tm_hour;
dateTm.tm_mday = tmResult->tm_mday;
dateTm.tm_mon = tmResult->tm_mon;
dateTm.tm_year = tmResult->tm_year;
dateTm.tm_wday = tmResult->tm_wday;
dateTm.tm_yday = tmResult->tm_yday;
dateTm.tm_isdst = tmResult->tm_isdst;
}
date[0] = date[0] & 0xfc;
if ((char)dateTm.tm_wday == '\0') {
(this->_params)._endStage = 0xb;
(this->_params)._isMegaSatan = 1;
if (rng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
rng._seed = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed;
rng._seed = rng._seed << ((uint8_t)rng._shift2 & 0x1f) ^ rng._seed;
rng._seed = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift3 & 0x1f) ^ rng._seed;
if (rng._seed != (GHIDRA_UINT(rng._seed) / 6) * 6) goto LAB_00427185;
LAB_0042717b:
(this->_params)._difficulty = 1;
goto LAB_00427185;
}
if ((char)dateTm.tm_wday == '\x01') {
(this->_params)._pathType = 2;
(this->_params)._endStage = 8;
goto LAB_00427185;
}
if ((char)dateTm.tm_wday == '\x02') {
switch((this->_params)._playerType) {
case 0:
(this->_params)._playerType = 0x15;
break;
case 1:
(this->_params)._playerType = 0x16;
break;
case 2:
(this->_params)._playerType = 0x17;
break;
case 3:
(this->_params)._playerType = 0x18;
break;
case 4:
(this->_params)._playerType = 0x19;
break;
case 5:
(this->_params)._playerType = 0x1a;
break;
case 6:
(this->_params)._playerType = 0x1b;
break;
case 7:
(this->_params)._playerType = 0x1c;
break;
case 8:
(this->_params)._playerType = 0x1d;
break;
case 9:
(this->_params)._playerType = 0x1e;
break;
case 10:
(this->_params)._playerType = 0x1f;
break;
default:
KAGE_LogMessage(8,(uint8_t *)
"GetTaintedId() could not find tainted counterpart to given ePlayerType (%d) \n"
);
break;
case 0xd:
(this->_params)._playerType = 0x20;
break;
case 0xe:
(this->_params)._playerType = 0x21;
break;
case 0xf:
(this->_params)._playerType = 0x22;
break;
case 0x10:
(this->_params)._playerType = 0x23;
break;
case 0x12:
(this->_params)._playerType = 0x24;
break;
case 0x13:
(this->_params)._playerType = 0x25;
}
if (rng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
rng._seed = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed;
rng._seed = rng._seed << ((uint8_t)rng._shift2 & 0x1f) ^ rng._seed;
rng._seed = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift3 & 0x1f) ^ rng._seed;
uVar3 = GHIDRA_UINT(rng._seed) % 100;
if (uVar3 < 0x14) {
(this->_params)._endStage = 6;
goto LAB_00427185;
}
if (uVar3 < 0x28) {
(this->_params)._endStage = 8;
goto LAB_00427185;
}
if (0x31 < uVar3) {
if (0x40 < uVar3) {
if (0x4f < uVar3) {
(this->_params)._endStage = 0xb;
(this->_params)._pathType = GHIDRA_UINT((0x59 < uVar3));
goto LAB_00427185;
}
goto LAB_00426e6e;
}
goto LAB_00426e53;
}
}
else {
if ((char)dateTm.tm_wday == '\x03') {
(this->_params)._endStage = 0xc;
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(2);
(this->_params)._pathType = GHIDRA_UINT((uVar3 == 0));
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(100);
if (GHIDRA_INT(uVar3) < 0x14) {
(this->_params)._endStage = 6;
goto LAB_00427185;
}
if (GHIDRA_INT(uVar3) < 0x28) {
(this->_params)._endStage = 8;
goto LAB_00427185;
}
}
else {
if ((char)dateTm.tm_wday == '\x04') {
(this->_params)._pathType = 3;
(this->_params)._endStage = 0xd;
goto LAB_00427185;
}
if ((char)dateTm.tm_wday != '\x05') {
if ((char)dateTm.tm_wday != '\x06') goto LAB_00427185;
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(100);
if (GHIDRA_INT(uVar3) < 0xf) {
(this->_params)._endStage = 6;
}
else if (GHIDRA_INT(uVar3) < 0x1e) {
(this->_params)._endStage = 8;
}
else if (GHIDRA_INT(uVar3) < 0x28) {
(this->_params)._endStage = 0xc;
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(2);
(this->_params)._pathType = GHIDRA_UINT((uVar3 == 0));
}
else if (GHIDRA_INT(uVar3) < 0x32) {
(this->_params)._endStage = 10;
(this->_params)._pathType = 0;
}
else if (GHIDRA_INT(uVar3) < 0x3c) {
(this->_params)._endStage = 10;
(this->_params)._pathType = 1;
}
else if (GHIDRA_INT(uVar3) < 0x46) {
(this->_params)._endStage = 0xb;
(this->_params)._pathType = 0;
}
else if (GHIDRA_INT(uVar3) < 0x50) {
(this->_params)._endStage = 0xb;
(this->_params)._pathType = 1;
}
else if (GHIDRA_INT(uVar3) < 0x5a) {
(this->_params)._pathType = 3;
(this->_params)._endStage = 0xd;
}
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(2);
if (uVar3 != 0) {
switch((this->_params)._playerType) {
case 0:
(this->_params)._playerType = 0x15;
break;
case 1:
(this->_params)._playerType = 0x16;
break;
case 2:
(this->_params)._playerType = 0x17;
break;
case 3:
(this->_params)._playerType = 0x18;
break;
case 4:
(this->_params)._playerType = 0x19;
break;
case 5:
(this->_params)._playerType = 0x1a;
break;
case 6:
(this->_params)._playerType = 0x1b;
break;
case 7:
(this->_params)._playerType = 0x1c;
break;
case 8:
(this->_params)._playerType = 0x1d;
break;
case 9:
(this->_params)._playerType = 0x1e;
break;
case 10:
(this->_params)._playerType = 0x1f;
break;
default:
KAGE_LogMessage(8,(uint8_t *)
"GetTaintedId() could not find tainted counterpart to given ePlayerType (%d) \n"
);
break;
case 0xd:
(this->_params)._playerType = 0x20;
break;
case 0xe:
(this->_params)._playerType = 0x21;
break;
case 0xf:
(this->_params)._playerType = 0x22;
break;
case 0x10:
(this->_params)._playerType = 0x23;
break;
case 0x12:
(this->_params)._playerType = 0x24;
break;
case 0x13:
(this->_params)._playerType = 0x25;
}
}
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(2);
if (uVar3 == 0) goto LAB_00427185;
goto LAB_0042717b;
}
(this->_params)._difficulty = 1;
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(100);
if (GHIDRA_INT(uVar3) < 0x14) {
(this->_params)._endStage = 6;
goto LAB_00427185;
}
if (GHIDRA_INT(uVar3) < 0x28) {
(this->_params)._endStage = 8;
goto LAB_00427185;
}
}
if (0x31 < GHIDRA_INT(uVar3)) {
if (0x40 < GHIDRA_INT(uVar3)) {
if (0x4f < GHIDRA_INT(uVar3)) {
(this->_params)._endStage = 0xb;
(this->_params)._pathType = GHIDRA_UINT((0x59 < GHIDRA_INT(uVar3)));
goto LAB_00427185;
}
LAB_00426e6e:
(this->_params)._endStage = 10;
(this->_params)._pathType = 1;
goto LAB_00427185;
}
LAB_00426e53:
(this->_params)._endStage = 10;
(this->_params)._pathType = 0;
goto LAB_00427185;
}
}
(this->_params)._endStage = 0xc;
uVar3 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomInt(2);
(this->_params)._pathType = GHIDRA_UINT((uVar3 == 0));
LAB_00427185:
if (rng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
uVar3 = GHIDRA_UINT(rng._seed) >> ((uint8_t)rng._shift1 & 0x1f) ^ rng._seed;
uVar3 = uVar3 << ((uint8_t)rng._shift2 & 0x1f) ^ uVar3;
this->_seed = uVar3 >> ((uint8_t)rng._shift3 & 0x1f) ^ uVar3;
FUN_00427290(this->_specialDailyId);
return;
}
-550
View File
@@ -104,79 +104,6 @@ LAB_00499c40:
goto LAB_00499ba3;
}
// 0049f870
void NpcHelper::chimera_charge_begin(Entity_NPC *npc, Vector *target, float speed)
{
uint8_t bVar1;
uint8_t *currentName;
uint32_t compareResult;
char *chargeBeginName;
bool isLess;
float length;
float dirX;
float local_c;
float local_8;
uint8_t *animData;
Manager *manager;
animData = (npc->_sprite)._animState._animData;
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
currentName = animData;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
currentName = *GHIDRA_CAST<uint8_t **>(animData);
}
chargeBeginName = "ChargeBegin";
do {
bVar1 = *currentName;
isLess = bVar1 < (uint8_t)*chargeBeginName;
if (bVar1 != *chargeBeginName) {
LAB_0049f8b6:
compareResult = -GHIDRA_UINT(isLess) | 1;
goto LAB_0049f8bb;
}
if (bVar1 == 0) break;
bVar1 = currentName[1];
isLess = bVar1 < (uint8_t)chargeBeginName[1];
if (bVar1 != chargeBeginName[1]) goto LAB_0049f8b6;
currentName = currentName + 2;
chargeBeginName = chargeBeginName + 2;
} while (bVar1 != 0);
compareResult = 0;
LAB_0049f8bb:
if ((compareResult == 0) &&
((animData[0x34] == 0 || ((npc->_sprite)._animState._isPlaying != 0)))) goto LAB_0049f8ee;
}
bVar1 = ANM2::SetAnimation(&npc->_sprite,GHIDRA_CAST<uint8_t *>("ChargeBegin"),1);
if (bVar1 != 0) {
AnimationState::Rewind(&(npc->_sprite)._animState);
(npc->_sprite)._animState._isPlaying = 1;
}
LAB_0049f8ee:
npc->_state = 10;
manager = g_manager;
local_8 = 1.0;
if (npc->_championColorIdx == 0x12) {
local_8 = 1.5;
}
else if (npc->_championColorIdx == 0x13) {
local_8 = 0.5;
}
local_c = 4.21791e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_c));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c),1.0,2,0,local_8,0.0);
dirX = target->x - (npc->_pos).x;
local_c = target->y - (npc->_pos).y;
length = sqrtf(dirX * dirX + local_c * local_c);
if (0.0 < length) {
dirX = dirX * (1.0 / length);
local_c = local_c * (1.0 / length);
}
*GHIDRA_CAST<uint8_t *>(&npc->_i1) = 0;
(npc->_targetPosition).x = dirX * speed;
(npc->_targetPosition).y = local_c * speed;
return;
}
// 0055d070
uint8_t NpcHelper::polty_target_set(int gridIndex)
{
@@ -282,483 +209,6 @@ void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass)
return;
}
// 00572a70
Entity * NpcHelper::clutch_find_farthest_orbital(Entity_NPC *clutch, int unused)
{
uint64_t qVar1;
uint8_t isClutchFriendly;
int enemiesData;
uint64_t *heapAllocatedBytes;
uint8_t extraout_DL;
Entity *tmpEntity;
uint32_t uVar2;
float fVar3;
float deltaX;
EntityList_EL local_38;
uint32_t local_24;
float maxDistance;
Entity *local_18;
void *local_10;
uint8_t *puStack_c;
uint32_t uStack_8;
uStack_8 = 0xffffffff;
puStack_c = &LAB_00af1840;
local_10 = ExceptionList;
ExceptionList = &local_10;
local_18 = GHIDRA_CAST<Entity *>(0x0);
maxDistance = 0.0;
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&local_38,0x379,-1,-1,0,0);
uVar2 = 0;
tmpEntity = GHIDRA_CAST<Entity *>(0x0);
if (local_38._size != 0) {
enemiesData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4)));
do {
tmpEntity = *GHIDRA_CAST<Entity **>((enemiesData + uVar2 * 4));
if (tmpEntity != GHIDRA_CAST<Entity *>(0x0)) {
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (tmpEntity->_type == 1)) ||
(tmpEntity->_type - 10U < 0x3de)) {
local_24 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&tmpEntity->_flags) + 4));
isClutchFriendly = Entity::IsFriendly(GHIDRA_CAST<Entity *>(clutch));
if (((extraout_DL == isClutchFriendly) && (GHIDRA_CAST<Entity_NPC *>(tmpEntity->_parent) == clutch)) &&
((tmpEntity != GHIDRA_CAST<Entity *>(clutch->_child) &&
((tmpEntity[2]._updateTime != 1.38729e-43 &&
(fVar3 = (clutch->_pos).y - (tmpEntity->_pos).y,
deltaX = (clutch->_pos).x - (tmpEntity->_pos).x,
fVar3 = sqrtf(fVar3 * fVar3 + deltaX * deltaX), (tmpEntity->_flags & 0x10) == 0))))))
{
enemiesData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4)));
if (maxDistance < fVar3) {
maxDistance = fVar3;
local_18 = tmpEntity;
}
goto LAB_00572bab;
}
}
enemiesData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4)));
}
LAB_00572bab:
uVar2 = uVar2 + 1;
tmpEntity = local_18;
} while (uVar2 < GHIDRA_UINT(local_38._size));
}
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x0))) == '\0') {
if (g_mainHeap == (void *)0x0) {
heapAllocatedBytes = &g_allocatedBytesNoHeap;
}
else {
heapAllocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4))) != 0) {
uVar2 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4))) + -4));
qVar1 = *heapAllocatedBytes;
*GHIDRA_CAST<uint32_t *>(heapAllocatedBytes) = GHIDRA_UINT(*heapAllocatedBytes) - uVar2;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapAllocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapAllocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2));
free(GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x4))) + -4)));
}
}
ExceptionList = local_10;
return tmpEntity;
}
// 00572cc0
void NpcHelper::clutch_spawn_fire(Entity_NPC *npc, Entity *target)
{
uint32_t uVar1;
float fVar2;
float fVar3;
uint8_t bVar4;
uint32_t uVar5;
Entity *fire;
uint8_t *pbVar6;
LayerState *layer;
uint32_t angleRoll;
char *pcVar7;
uint8_t *size;
bool bVar8;
float fVar9;
Vector spawnPos;
Vector local_64;
ANM2 *local_5c;
Entity *local_58;
Entity_NPC *local_54;
Entity *local_50;
uint8_t local_4c [32];
int animPathSize;
uint8_t *animPathCapacity;
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t local_14;
code *addFlagsFn;
ANM2 *fireSprite;
uint32_t *parentSlot;
puStack_20 = local_4c + 0x48;
local_14 = 0xffffffff;
puStack_18 = &LAB_00af506d;
local_1c = ExceptionList;
uVar5 = __security_cookie ^ GHIDRA_UINT((local_4c + 0x3c));
ExceptionList = &local_1c;
local_58 = target;
uVar1 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&target->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&target->_flags) = GHIDRA_UINT(target->_flags) | 0x10;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&target->_flags) + 4)) = uVar1;
addFlagsFn = *(code **)(*GHIDRA_CAST<int *>(target) + 0x24);
local_54 = npc;
local_24 = uVar5;
EntityRef::constructor(GHIDRA_CAST<EntityRef *>(local_4c),GHIDRA_CAST<Entity *>(npc));
(*addFlagsFn)(local_4c,uVar5);
uVar5 = Random();
local_64.x = (local_58->_pos).x;
local_64.y = (local_58->_pos).y;
fire = Game::Spawn(g_game,0x21,0xd,&local_64,&g_vectorZero,GHIDRA_CAST<Entity *>(npc),0,uVar5);
animPathSize = 0;
fireSprite = &fire->_sprite;
animPathCapacity = &DAT_0000000f;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x10))) = 0.0;
local_5c = fireSprite;
local_50 = fire;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x10))) = msvc::_Allocate(0x30);
animPathSize = 0x20;
animPathCapacity = &DAT_0000002f;
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_4c))) + 0x10))),"gfx/009.002_Fire Projectile.anm2",0x21);
local_14 = 0;
ANM2::Load(fireSprite,GHIDRA_CAST<std_string *>((local_4c + 0x10)),1);
local_14 = 0xffffffff;
if (&DAT_0000000f < animPathCapacity) {
size = animPathCapacity + 1;
pcVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_4c))) + 0x10)));
if (GHIDRA_CAST<uint8_t *>(0xfff) < size) {
pcVar7 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x10))) + -4));
size = animPathCapacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x10))) + (-4 - GHIDRA_INT(pcVar7))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar7,GHIDRA_UINT(size));
}
pbVar6 = (fire->_sprite)._animState._animData;
if (pbVar6 != GHIDRA_CAST<uint8_t *>(0x0)) {
if (0xf < *GHIDRA_CAST<uint32_t *>((pbVar6 + 0x14))) {
pbVar6 = *GHIDRA_CAST<uint8_t **>(pbVar6);
}
pcVar7 = "Flickering";
do {
bVar4 = *pbVar6;
bVar8 = bVar4 < (uint8_t)*pcVar7;
if (bVar4 != *pcVar7) {
LAB_00572e46:
uVar5 = -GHIDRA_UINT(bVar8) | 1;
goto LAB_00572e4b;
}
if (bVar4 == 0) break;
bVar4 = pbVar6[1];
bVar8 = bVar4 < (uint8_t)pcVar7[1];
if (bVar4 != pcVar7[1]) goto LAB_00572e46;
pbVar6 = pbVar6 + 2;
pcVar7 = pcVar7 + 2;
} while (bVar4 != 0);
uVar5 = 0;
LAB_00572e4b:
if ((uVar5 == 0) &&
((*GHIDRA_CAST<char *>((GHIDRA_INT((fire->_sprite)._animState._animData) + 0x34)) == '\0' ||
((fire->_sprite)._animState._isPlaying != 0)))) goto LAB_00572e7c;
}
bVar4 = ANM2::SetAnimation(fireSprite,GHIDRA_CAST<uint8_t *>("Flickering"),1);
if (bVar4 != 0) {
AnimationState::Rewind(&(fire->_sprite)._animState);
(fire->_sprite)._animState._isPlaying = 1;
}
LAB_00572e7c:
fireSprite = local_5c;
pbVar6 = GHIDRA_CAST<uint8_t *>(0x0);
if ((local_50->_sprite)._layerCount != 0) {
do {
layer = ANM2::GetLayer(fireSprite,pbVar6);
fVar3 = fRam00c34e34;
fVar2 = fRam00c34e30;
fVar9 = fRam00c34e2c;
if (&layer->_color != GHIDRA_CAST<ColorMod *>(&DAT_00c34e28)) {
(layer->_color)._tint[0] = _DAT_00c34e28;
(layer->_color)._tint[1] = fVar9;
(layer->_color)._tint[2] = fVar2;
(layer->_color)._tint[3] = fVar3;
fVar3 = fRam00c34e44;
fVar2 = fRam00c34e40;
fVar9 = fRam00c34e3c;
(layer->_color)._colorize[0] = _DAT_00c34e38;
(layer->_color)._colorize[1] = fVar9;
(layer->_color)._colorize[2] = fVar2;
(layer->_color)._colorize[3] = fVar3;
*GHIDRA_CAST<uint64_t *>((layer->_color)._offset) = DAT_00c34e48;
(layer->_color)._offset[2] = DAT_00c34e50;
}
pbVar6 = pbVar6 + 1;
} while (pbVar6 < GHIDRA_CAST<uint8_t *>((local_50->_sprite)._layerCount));
npc = local_54;
}
(**(code **)(*GHIDRA_CAST<int *>(local_50) + 0xc))();
local_50 = GHIDRA_CAST<Entity *>(0x2);
do {
uVar5 = Random();
local_54 = GHIDRA_CAST<Entity_NPC *>((local_58->_pos).x);
local_64.y = (local_58->_pos).y;
angleRoll = Random();
fVar9 = (float)((double)GHIDRA_INT(angleRoll) + __uint_to_double_fixup[-(GHIDRA_INT(angleRoll) >> 0x1f)]) *
2.3283064e-10 * 3.14;
local_5c = GHIDRA_CAST<ANM2 *>((fVar9 + fVar9));
fVar9 = cos((float)local_5c);
spawnPos.x = fVar9 * 10.0 + (float)local_54;
fVar9 = sin((float)local_5c);
spawnPos.y = fVar9 * 10.0 + local_64.y;
local_54 = (Entity_NPC *)
Game::Spawn(g_game,0x399,1,&spawnPos,&g_vectorZero,GHIDRA_CAST<Entity *>(npc),0,uVar5);
parentSlot = &local_54->_parent;
if (local_54->_parent != 0) {
local_64.y = (float)parentSlot;
msvc::multiset<unsigned_int>::erase(&local_64.y);
}
*parentSlot = npc;
if (npc != GHIDRA_CAST<Entity_NPC *>(0x0)) {
msvc::multiset<unsigned_int>::insert(parentSlot);
}
uVar5 = Random();
local_50 = GHIDRA_CAST<Entity *>((GHIDRA_INT(local_50) + -1));
(local_54->_v1).x =
(float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283064e-10
* 360.0;
} while (local_50 != GHIDRA_CAST<Entity *>(0x0));
ExceptionList = local_1c;
return;
}
// 00575a10
void NpcHelper::clutch_render(Entity_NPC *npc, Vector *offset)
{
LayerState *pLVar1;
float *pfVar2;
int iVar3;
int iVar4;
int iVar5;
void *layerFrames;
int pointSlotOffset;
int iVar6;
void *animData;
int pointIndex;
uint32_t pointBlock;
uint32_t nextPointBlock;
float *nextPoint;
float flipSign;
float deltaX;
float fVar7;
double dVar8;
double dVar9;
int layerOffset;
uint32_t nextPointIndex;
uint8_t *layerId;
float segmentStretch;
Vector segmentPos [8];
ANM2 *animation;
int *pointDeque;
if (npc->_variant == 0) {
pLVar1 = ANM2::GetLayer(&npc->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
if ((0.0 < (pLVar1->_color)._tint[3]) && ((npc->_vectorDeque1)._size != 0)) {
pLVar1 = ANM2::GetLayer(&npc->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
pLVar1->_visible = 1;
pLVar1 = ANM2::GetLayer(&npc->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
layerId = GHIDRA_CAST<uint8_t *>(0x1);
layerOffset = 0x3c;
pLVar1->_visible = 1;
pointBlock = (npc->_vectorDeque1)._offset;
do {
pointDeque = (npc->_vectorDeque1)._proxy;
nextPointIndex = pointBlock + 3;
pointIndex = pointBlock;
while( true ) {
pointBlock = (npc->_vectorDeque1)._offset;
if (((npc->_vectorDeque1)._size - 3) + pointBlock <= GHIDRA_UINT(pointIndex)) break;
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar3 = 0;
}
else {
iVar3 = *pointDeque;
}
pointBlock = GHIDRA_UINT(pointIndex) >> 1;
pointSlotOffset = (pointIndex & 1U) * 8;
pfVar2 = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar3 + 4)) +
(*GHIDRA_CAST<int *>((iVar3 + 8)) - 1U & pointBlock) * 4)) + pointSlotOffset))
;
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar3 = 0;
}
else {
iVar3 = *pointDeque;
}
nextPointBlock = nextPointIndex >> 1;
fVar7 = g_displayPixelRatio * g_screenPointScale;
iVar6 = (nextPointIndex & 1) * 8;
nextPoint = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar3 + 4)) +
(*GHIDRA_CAST<int *>((iVar3 + 8)) - 1U & nextPointBlock) * 4)) + iVar6));
dVar8 = floor((double)((((*pfVar2 + *nextPoint) * 0.5 - 60.0) * 0.65 +
(g_screenWidth - 338.0) * 0.5) * fVar7 + 0.5));
dVar9 = floor((double)((((pfVar2[1] + nextPoint[1]) * 0.5 - 140.0) * 0.65 +
(g_screenHeight - 182.0) * 0.5) * fVar7 + 0.5));
segmentPos[0].x = (float)dVar8 / fVar7 + offset->x;
segmentPos[0].y = (float)dVar9 / fVar7 + offset->y;
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar3 = 0;
}
else {
iVar3 = *pointDeque;
}
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar5 = 0;
}
else {
iVar5 = *pointDeque;
}
iVar3 = GHIDRA_INT((8.0 - (*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar5 + 4)) +
(nextPointIndex + 2 >> 1 &
*GHIDRA_CAST<int *>((iVar5 + 8)) - 1U) * 4)) +
(nextPointIndex + 2 & 1) * 8)) +
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar3 + 4)) +
(nextPointIndex - 1 >> 1 & *GHIDRA_CAST<int *>((iVar3 + 8)) - 1U
) * 4)) + (nextPointIndex + 1 & 1) * 8))) * 0.5 * 8.0
));
if (iVar3 == 7) {
segmentStretch = 1.0;
LAB_00575d73:
pLVar1 = ANM2::GetLayer(&npc->_sprite,layerId);
(pLVar1->_size).x = segmentStretch;
(pLVar1->_size).y = 1.0;
if ((npc->_sprite)._flipX == 0) {
flipSign = 1.0;
}
else {
flipSign = (float)&DAT_bf800000;
}
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar5 = 0;
}
else {
iVar5 = *pointDeque;
}
pfVar2 = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar5 + 4)) +
(*GHIDRA_CAST<int *>((iVar5 + 8)) - 1U & nextPointBlock) * 4)) + iVar6));
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar6 = 0;
}
else {
iVar6 = *pointDeque;
}
iVar6 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar6 + 4)) + (*GHIDRA_CAST<int *>((iVar6 + 8)) - 1U & pointBlock) * 4));
fVar7 = atan2f(pfVar2[1] - *GHIDRA_CAST<float *>((iVar6 + 4 + pointSlotOffset)),
*pfVar2 - *GHIDRA_CAST<float *>((iVar6 + pointSlotOffset)));
pLVar1 = ANM2::GetLayer(&npc->_sprite,layerId);
pLVar1->_rotation = fVar7 * 57.295776 * flipSign;
if ((npc->_sprite)._overlayAnimState._animData != (void *)0x0) {
AnimationState::SetFrameFloat(&(npc->_sprite)._overlayAnimState,(float)iVar3);
}
if ((npc->_sprite)._loaded != 0) {
if ((npc->_sprite)._overlayRenderFirst == 0) {
animData = (npc->_sprite)._animState._animData;
if (((animData != (void *)0x0) &&
(animation = (npc->_sprite)._animState._animation,
GHIDRA_INT(layerId) < animation->_layerCount)) &&
(iVar3 = *GHIDRA_CAST<int *>((layerOffset + GHIDRA_INT(animData))), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x18)))),
segmentPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((npc->_sprite)._animState._layerFrames) + iVar3 * 4)),
&g_vectorZero,&g_vectorZero,animation);
}
animData = (npc->_sprite)._overlayAnimState._animData;
if (((animData != (void *)0x0) &&
(animation = (npc->_sprite)._overlayAnimState._animation,
GHIDRA_INT(layerId) < animation->_layerCount)) &&
(iVar3 = *GHIDRA_CAST<int *>((layerOffset + GHIDRA_INT(animData))), -1 < iVar3)) {
layerFrames = (npc->_sprite)._overlayAnimState._layerFrames;
goto LAB_00575ed0;
}
}
else {
animData = (npc->_sprite)._overlayAnimState._animData;
if (((animData != (void *)0x0) &&
(animation = (npc->_sprite)._overlayAnimState._animation,
GHIDRA_INT(layerId) < animation->_layerCount)) &&
(iVar3 = *GHIDRA_CAST<int *>((layerOffset + GHIDRA_INT(animData))), -1 < iVar3)) {
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x18)))),
segmentPos,
*GHIDRA_CAST<int *>((GHIDRA_INT((npc->_sprite)._overlayAnimState._layerFrames) + iVar3 * 4
)),&g_vectorZero,&g_vectorZero,animation);
}
animData = (npc->_sprite)._animState._animData;
if (((animData != (void *)0x0) &&
(animation = (npc->_sprite)._animState._animation,
GHIDRA_INT(layerId) < animation->_layerCount)) &&
(iVar3 = *GHIDRA_CAST<int *>((layerOffset + GHIDRA_INT(animData))), -1 < iVar3)) {
layerFrames = (npc->_sprite)._animState._layerFrames;
LAB_00575ed0:
AnimationLayer::RenderFrame
(GHIDRA_CAST<AnimationLayer *>((iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x18)))),
segmentPos,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(layerFrames) + iVar3 * 4)),&g_vectorZero,
&g_vectorZero,animation);
}
}
}
pointIndex = pointIndex + 3;
nextPointIndex = nextPointIndex + 3;
}
else {
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar5 = 0;
}
else {
iVar5 = *pointDeque;
}
iVar5 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar5 + 4)) + (*GHIDRA_CAST<int *>((iVar5 + 8)) - 1U & pointBlock) * 4));
if (pointDeque == GHIDRA_CAST<int *>(0x0)) {
iVar4 = 0;
}
else {
iVar4 = *pointDeque;
}
pfVar2 = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar4 + 4)) +
(*GHIDRA_CAST<int *>((iVar4 + 8)) - 1U & nextPointBlock) * 4)) + iVar6));
fVar7 = pfVar2[1] - *GHIDRA_CAST<float *>((iVar5 + 4 + pointSlotOffset));
deltaX = *pfVar2 - *GHIDRA_CAST<float *>((iVar5 + pointSlotOffset));
fVar7 = sqrtf(fVar7 * fVar7 + deltaX * deltaX);
segmentStretch = (fVar7 * 0.5) / (float)(8 - iVar3);
if (segmentStretch <= 1.0) {
segmentStretch = 1.0;
}
if (3.0 <= segmentStretch) {
segmentStretch = 3.0;
}
if (iVar3 < 8) goto LAB_00575d73;
pointIndex = pointIndex + 3;
nextPointIndex = nextPointIndex + 3;
}
}
layerId = layerId + 1;
layerOffset = layerOffset + 4;
} while (layerOffset < 0x41);
pLVar1 = ANM2::GetLayer(&npc->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
pLVar1->_visible = 0;
pLVar1 = ANM2::GetLayer(&npc->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
pLVar1->_visible = 0;
}
}
Entity::Render(GHIDRA_CAST<Entity *>(npc),offset);
return;
}
// 00582f60
void NpcHelper::scourge_whip(Entity_NPC *npc)
{
-71
View File
@@ -1,71 +0,0 @@
#include "classes.h"
// 009ef9a0
uint8_t RichTextSpan::try_merge(void *other)
{
int *ownStyle;
int *otherStyle;
uint32_t bytesLeft;
bool isMore;
uint32_t *otherLength;
if (*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x34)) == *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(other) + 0x34))) {
otherStyle = GHIDRA_CAST<int *>((GHIDRA_INT(other) + 0x20));
bytesLeft = 0xc;
ownStyle = GHIDRA_CAST<int *>((GHIDRA_INT(this) + 0x20));
do {
if (*ownStyle != *otherStyle) {
return 0;
}
ownStyle = ownStyle + 1;
otherStyle = otherStyle + 1;
isMore = 3 < bytesLeft;
bytesLeft = bytesLeft - 4;
} while (isMore);
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x38)) == *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(other) + 0x38))) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x3c)) == *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(other) + 0x3c)))) {
otherLength = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(other) + 0x10));
if (0xf < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(other) + 0x14))) {
other = *(void **)other;
}
this->msvc::string::append(other,*otherLength);
return 1;
}
}
return 0;
}
// 009f1ef0
void RichTextSpan::move_construct(void *dest, void *source)
{
uint32_t uVar1;
uint32_t uVar2;
uint32_t uVar3;
*GHIDRA_CAST<uint32_t *>(dest) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x10)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x14)) = 0;
uVar1 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 4));
uVar2 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 8));
uVar3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0xc));
*GHIDRA_CAST<uint32_t *>(dest) = *GHIDRA_CAST<uint32_t *>(source);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 4)) = uVar1;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 8)) = uVar2;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0xc)) = uVar3;
*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(dest) + 0x10)) = *GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(source) + 0x10));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x10)) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x14)) = 0xf;
*GHIDRA_CAST<uint8_t *>(source) = 0;
uVar1 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x1c));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x18)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x18));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x1c)) = uVar1;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x20)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x20));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x24)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x24));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x28)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x28));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x2c)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x2c));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x30)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x30));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x34)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x34));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x38)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x38));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(dest) + 0x3c)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(source) + 0x3c));
return;
}
-343
View File
@@ -1,343 +0,0 @@
#include "classes.h"
// 0084dc00
void StatsPanel::add_stat_line()
{
char *format;
void **formattedString;
int in_ECX;
uint8_t *textEnd;
void *pvVar1;
uint32_t allocSize;
float in_XMM1_Da;
void *entry;
void *pvStack_1bc;
void *pvStack_1b8;
void *pvStack_1b4;
uint64_t local_1b0;
uint8_t local_1a8 [12];
uint8_t local_19c [12];
uint8_t local_190 [12];
uint8_t local_184 [12];
uint8_t local_178 [12];
uint8_t local_16c [20];
void *local_158;
uint32_t local_148;
uint32_t local_144;
void *textString [4];
uint32_t local_130;
uint32_t local_12c;
uint8_t text [260];
uint32_t local_24;
uint8_t *puStack_20;
void *local_1c;
uint8_t *puStack_18;
uint32_t local_14;
uint8_t ch;
puStack_20 = text + 0x124;
local_14 = 0xffffffff;
puStack_18 = &LAB_00b02fbb;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((text + 0x118));
ExceptionList = &local_1c;
if (in_XMM1_Da != 0.0) {
format = "<color=FF3BF745>+%.2f<color=0xffffffff>";
if (in_XMM1_Da < 0.0) {
format = "<color=FFF7513B>%.2f<color=0xffffffff>";
}
sprintf_s(text,0x100,GHIDRA_CAST<uint8_t *>(format));
InfoDisplayText::constructor(&entry);
local_14 = 0;
textEnd = text;
local_130 = 0;
local_12c = 0xf;
textString[0] = (void *)0x0;
do {
ch = *textEnd;
textEnd = textEnd + 1;
} while (ch != 0);
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(textString))))->msvc::string::assign(text,GHIDRA_INT(textEnd) - GHIDRA_INT((text + 1)));
local_14 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),1);
formattedString = (void **)FUN_00651d50();
if (&entry != formattedString) {
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&entry))))->msvc::string::_Tidy_deallocate();
entry = *formattedString;
pvStack_1bc = formattedString[1];
pvStack_1b8 = formattedString[2];
pvStack_1b4 = formattedString[3];
local_1b0 = *GHIDRA_CAST<uint64_t *>((formattedString + 4));
formattedString[4] = (void *)0x0;
formattedString[5] = (void *)0xf;
*GHIDRA_CAST<char *>(formattedString) = '\0';
}
if (0xf < local_144) {
allocSize = local_144 + 1;
pvVar1 = local_158;
if (0xfff < allocSize) {
pvVar1 = *(void **)(GHIDRA_CAST<char *>(local_158) + -4);
allocSize = local_144 + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_158) + (-4 - GHIDRA_INT(pvVar1))))) goto LAB_0084ddc1;
}
operator_delete(pvVar1,allocSize);
}
local_14 = local_14 & 0xffffff00;
local_148 = 0;
local_144 = 0xf;
local_158 = (void *)(GHIDRA_UINT(local_158) & 0xffffff00);
if (0xf < local_12c) {
allocSize = local_12c + 1;
pvVar1 = textString[0];
if (0xfff < allocSize) {
pvVar1 = *(void **)(GHIDRA_INT(textString[0]) + -4);
allocSize = local_12c + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(textString[0]) + (-4 - GHIDRA_INT(pvVar1))))) {
LAB_0084ddc1:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar1,allocSize);
}
pvVar1 = *(void **)(in_ECX + 0x24);
if (pvVar1 == *(void **)(in_ECX + 0x28)) {
msvc::vector<104byte>::_Emplace_reallocate(pvVar1,&entry);
}
else {
InfoDisplayEntry::copy_constructor(pvVar1,&entry);
*GHIDRA_CAST<int *>((in_ECX + 0x24)) = *GHIDRA_CAST<int *>((in_ECX + 0x24)) + 0x68;
}
FID_conflict__Tidy(local_16c);
FID_conflict__Tidy(local_178);
FID_conflict__Tidy(local_184);
FID_conflict__Tidy(local_190);
FID_conflict__Tidy(local_19c);
FID_conflict__Tidy(local_1a8);
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_1b0)) + 0x4)))) {
allocSize = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_1b0)) + 0x4))) + 1;
pvVar1 = entry;
if (0xfff < allocSize) {
pvVar1 = *(void **)(GHIDRA_CAST<char *>(entry) + -4);
allocSize = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_1b0)) + 0x4))) + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(entry) + (-4 - GHIDRA_INT(pvVar1))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar1,allocSize);
}
}
ExceptionList = local_1c;
return;
}
// 0084dea0
void StatsPanel::set(Entity_Player *player, uint8_t isGoldenTrinket)
{
uint32_t uVar1;
void *extraout_ECX;
void *extraout_ECX_00;
void *panel;
undefined3 in_stack_00000009;
std_string statName;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b03025;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT(&(&statName)[1]._size);
ExceptionList = &local_10;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) != 0) {
*GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(this) + 0x48)) = player;
if (*GHIDRA_CAST<int *>(this) == 0) {
preview_collectible(1);
panel = extraout_ECX;
}
else {
panel = this;
if (*GHIDRA_CAST<int *>(this) == 1) {
preview_trinket(1,_isGoldenTrinket);
panel = extraout_ECX_00;
}
}
FUN_00856840(panel,uVar1);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x24)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x20));
statName._capacity = 0xf;
statName._size = 6;
builtin_strncpy(statName._buf," Speed",7);
local_8 = 0;
add_stat_line(&statName);
local_8 = 0xffffffff;
if (0xf < statName._capacity) {
uVar1 = statName._capacity + 1;
panel = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
if (0xfff < uVar1) {
panel = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
uVar1 = statName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
}
operator_delete(panel,uVar1);
}
statName._capacity = 0xf;
statName._size = 6;
builtin_strncpy(statName._buf," Tears",7);
local_8 = 1;
add_stat_line(&statName);
local_8 = 0xffffffff;
if (0xf < statName._capacity) {
uVar1 = statName._capacity + 1;
panel = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
if (0xfff < uVar1) {
panel = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
uVar1 = statName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
}
operator_delete(panel,uVar1);
}
statName._capacity = 0xf;
statName._size = 7;
builtin_strncpy(statName._buf," Damage",8);
local_8 = 2;
add_stat_line(&statName);
local_8 = 0xffffffff;
if (0xf < statName._capacity) {
uVar1 = statName._capacity + 1;
panel = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
if (0xfff < uVar1) {
panel = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
uVar1 = statName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
}
operator_delete(panel,uVar1);
}
statName._capacity = 0xf;
statName._size = 6;
builtin_strncpy(statName._buf," Range",7);
local_8 = 3;
add_stat_line(&statName);
local_8 = 0xffffffff;
if (0xf < statName._capacity) {
uVar1 = statName._capacity + 1;
panel = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
if (0xfff < uVar1) {
panel = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
uVar1 = statName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
}
operator_delete(panel,uVar1);
}
builtin_strncpy(statName._buf + 8,"eed",4);
statName._capacity = 0xf;
statName._size = 0xb;
builtin_strncpy(statName._buf," Shot Sp",8);
local_8 = 4;
add_stat_line(&statName);
local_8 = 0xffffffff;
if (0xf < statName._capacity) {
uVar1 = statName._capacity + 1;
panel = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
if (0xfff < uVar1) {
panel = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
uVar1 = statName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) goto LAB_0084e1d4;
}
operator_delete(panel,uVar1);
}
statName._capacity = 0xf;
statName._size = 5;
builtin_strncpy(statName._buf," Luck",6);
local_8 = 5;
add_stat_line(&statName);
if (0xf < statName._capacity) {
uVar1 = statName._capacity + 1;
panel = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)statName._buf)) + 0x0)));
if (0xfff < uVar1) {
panel = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) + -4);
uVar1 = statName._capacity + 0x24;
if (0x1f < ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(statName._buf)) + 0x0))) - GHIDRA_INT(panel)) - 4U) {
LAB_0084e1d4:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(panel,uVar1);
}
}
ExceptionList = local_10;
return;
}
// 0084e9d0
void StatsPanel::snapshot_stats(uint32_t param_1)
{
int in_ECX;
if (*GHIDRA_CAST<int *>((in_ECX + 0x48)) != 0) {
StatTracker::set(param_1);
StatTracker::set(param_1);
StatTracker::set(param_1);
StatTracker::set(param_1);
StatTracker::set(param_1);
StatTracker::set(param_1);
}
return;
}
// 0084ea90
void StatsPanel::preview_collectible(uint8_t param_1)
{
uint32_t *puVar1;
int iVar2;
int in_ECX;
if (*GHIDRA_CAST<int *>((in_ECX + 0x48)) != 0) {
snapshot_stats(0);
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
*GHIDRA_CAST<uint32_t *>((iVar2 + 0x2ef4)) = *GHIDRA_CAST<uint32_t *>((in_ECX + 4));
*GHIDRA_CAST<uint8_t *>((iVar2 + 0x2ef0)) = param_1;
puVar1 = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
*puVar1 = *puVar1 | 0x41f;
Entity_Player::EvaluateItems(*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)));
snapshot_stats(1);
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
*GHIDRA_CAST<uint32_t *>((iVar2 + 0x2ef4)) = 0;
*GHIDRA_CAST<uint8_t *>((iVar2 + 0x2ef0)) = 1;
puVar1 = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
*puVar1 = *puVar1 | 0x41f;
Entity_Player::EvaluateItems(*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)));
}
return;
}
// 0084eb10
void StatsPanel::preview_trinket(uint8_t param_1, int param_2)
{
uint32_t *puVar1;
int iVar2;
uint32_t uVar3;
int in_ECX;
if (*GHIDRA_CAST<int *>((in_ECX + 0x48)) != 0) {
snapshot_stats(0);
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
uVar3 = *GHIDRA_CAST<uint32_t *>((in_ECX + 4)) | 0x8000;
if (param_2 != 1) {
uVar3 = *GHIDRA_CAST<uint32_t *>((in_ECX + 4));
}
*GHIDRA_CAST<uint32_t *>((iVar2 + 0x2ef8)) = uVar3;
*GHIDRA_CAST<uint8_t *>((iVar2 + 0x2ef0)) = param_1;
puVar1 = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
*puVar1 = *puVar1 | 0x41f;
Entity_Player::EvaluateItems(*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)));
snapshot_stats(1);
iVar2 = *GHIDRA_CAST<int *>((in_ECX + 0x48));
*GHIDRA_CAST<uint32_t *>((iVar2 + 0x2ef8)) = 0;
*GHIDRA_CAST<uint8_t *>((iVar2 + 0x2ef0)) = 1;
puVar1 = GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((in_ECX + 0x48)) + 0x1574));
*puVar1 = *puVar1 | 0x41f;
Entity_Player::EvaluateItems(*GHIDRA_CAST<Entity_Player **>((in_ECX + 0x48)));
}
return;
}
-71
View File
@@ -8226,8 +8226,6 @@ uint8_t BitSet128::IsNonZero() { generated_stub("BitSet128::IsNonZero 004171b0")
BitSet128 * BitSet128::operator__(BitSet128 *other) { generated_stub("BitSet128::operator__ 00435bf0"); }
BitSet128 * BitSet128::operator_or(BitSet128 *outResult, BitSet128 *a, BitSet128 *b) { generated_stub("BitSet128::operator_or 00435c20"); }
uint8_t BitSet128::IsZero() { generated_stub("BitSet128::IsZero 00592230"); }
void BossOverlay::update() { generated_stub("BossOverlay::update 004212c0"); }
void BossOverlay::play(int overlayType) { generated_stub("BossOverlay::play 004214b0"); }
Color::Color() { generated_stub("Color::Color 00407170"); }
ColorMod * Color::operator_assign(ColorMod *other) { generated_stub("Color::operator_assign 004071c0"); }
float Color::R() { generated_stub("Color::R 00407240"); }
@@ -8250,7 +8248,6 @@ void Color::SetOffset(float redOffset, float greenOffset, float blueOffset) { ge
void Color::__mul(ColorMod *other) { generated_stub("Color::__mul 006831c0"); }
ColorMod * Color::Lerp(ColorMod *out, ColorMod *from, ColorMod *to, float t) { generated_stub("Color::Lerp 006832e0"); }
void CommandThread::post_command(void *command) { generated_stub("CommandThread::post_command 00a73100"); }
void DailyChallenge::Init(uint32_t dailyDate) { generated_stub("DailyChallenge::Init 00426a50"); }
DamageInfo::DamageInfo() { generated_stub("DamageInfo::DamageInfo 006a8190"); }
void DateTime::set_from_yyyymmdd(void *dateTime, int yyyymmdd) { generated_stub("DateTime::set_from_yyyymmdd 0085af30"); }
void DateTime::constructor(uint8_t isNow) { generated_stub("DateTime::constructor 00a24270"); }
@@ -9210,14 +9207,10 @@ void * NetworkManager::receive_message(void *outMessage, uint8_t channel, uint8_
void NetworkManager::receive_packet(uint64_t *sender, void *buffer, int size) { generated_stub("NetworkManager::receive_packet 00a78a10"); }
void * NetworkManager::get_peer(void *outPeer, uint64_t *userId) { generated_stub("NetworkManager::get_peer 00a790b0"); }
int * NpcHelper::chub_nearest_segment(int *param_1, int param_2) { generated_stub("NpcHelper::chub_nearest_segment 00499a50"); }
void NpcHelper::chimera_charge_begin(Entity_NPC *npc, Vector *target, float speed) { generated_stub("NpcHelper::chimera_charge_begin 0049f870"); }
uint8_t NpcHelper::polty_target_set(int gridIndex) { generated_stub("NpcHelper::polty_target_set 0055d070"); }
uint8_t NpcHelper::polty_is_target_liftable(Entity_NPC *npc) { generated_stub("NpcHelper::polty_is_target_liftable 0055d0b0"); }
uint8_t NpcHelper::polty_is_pot_cell(Entity_NPC *npc, int gridIndex) { generated_stub("NpcHelper::polty_is_pot_cell 0055d180"); }
void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass) { generated_stub("NpcHelper::mother_set_collision_class 005688c0"); }
Entity * NpcHelper::clutch_find_farthest_orbital(Entity_NPC *clutch, int unused) { generated_stub("NpcHelper::clutch_find_farthest_orbital 00572a70"); }
void NpcHelper::clutch_spawn_fire(Entity_NPC *npc, Entity *target) { generated_stub("NpcHelper::clutch_spawn_fire 00572cc0"); }
void NpcHelper::clutch_render(Entity_NPC *npc, Vector *offset) { generated_stub("NpcHelper::clutch_render 00575a10"); }
void NpcHelper::scourge_whip(Entity_NPC *npc) { generated_stub("NpcHelper::scourge_whip 00582f60"); }
void NpcHelper::scourge_chain_shoot() { generated_stub("NpcHelper::scourge_chain_shoot 00587480"); }
void NpcHelper::singe_explode_at(Entity_NPC *npc, Vector *position) { generated_stub("NpcHelper::singe_explode_at 0058ac10"); }
@@ -9251,8 +9244,6 @@ void ReferenceCountBase::vfunc_3() { generated_stub("ReferenceCountBase::vfunc_3
void ReferenceCountBase::vfunc_4() { generated_stub("ReferenceCountBase::vfunc_4 00af05d3"); }
void ReferenceCountBase::vfunc_5() { generated_stub("ReferenceCountBase::vfunc_5 00af05d3"); }
ReferenceCountBase::ReferenceCountBase() { generated_stub("ReferenceCountBase::ReferenceCountBase 0040cc10"); }
uint8_t RichTextSpan::try_merge(void *other) { generated_stub("RichTextSpan::try_merge 009ef9a0"); }
void RichTextSpan::move_construct(void *dest, void *source) { generated_stub("RichTextSpan::move_construct 009f1ef0"); }
void * SaveDataManager::open_file_read(uint8_t *fileName) { generated_stub("SaveDataManager::open_file_read 00a24fd0"); }
void * SaveDataManager::open_file_write(uint8_t *path, int mode) { generated_stub("SaveDataManager::open_file_write 00a25090"); }
Shape::Shape(void *other) { generated_stub("Shape::Shape 0042f850"); }
@@ -9290,11 +9281,6 @@ int Sprite::GetLayerCount() { generated_stub("Sprite::GetLayerCount 00440e40");
void Sprite::set_offset(Vector *offset) { generated_stub("Sprite::set_offset 00456340"); }
long double Sprite::PlaybackSpeed() { generated_stub("Sprite::PlaybackSpeed 00456360"); }
Vector * Sprite::Offset() { generated_stub("Sprite::Offset 0049cb40"); }
void StatsPanel::add_stat_line() { generated_stub("StatsPanel::add_stat_line 0084dc00"); }
void StatsPanel::set(Entity_Player *player, uint8_t isGoldenTrinket) { generated_stub("StatsPanel::set 0084dea0"); }
void StatsPanel::snapshot_stats(uint32_t param_1) { generated_stub("StatsPanel::snapshot_stats 0084e9d0"); }
void StatsPanel::preview_collectible(uint8_t param_1) { generated_stub("StatsPanel::preview_collectible 0084ea90"); }
void StatsPanel::preview_trinket(uint8_t param_1, int param_2) { generated_stub("StatsPanel::preview_trinket 0084eb10"); }
SteamCloudFile::~SteamCloudFile() { generated_stub("SteamCloudFile::~SteamCloudFile 00683710"); }
void SteamCloudFile::vfunc_1() { generated_stub("SteamCloudFile::vfunc_1 0067efb0"); }
void SteamCloudFile::vfunc_2() { generated_stub("SteamCloudFile::vfunc_2 0067efc0"); }
@@ -9453,12 +9439,10 @@ void FUN_0040c610() { generated_stub("FUN_0040c610 0040c610"); }
uint32_t FUN_0040c630() { generated_stub("FUN_0040c630 0040c630"); }
void FUN_0040c690() { generated_stub("FUN_0040c690 0040c690"); }
uint32_t FUN_0040c6b0() { generated_stub("FUN_0040c6b0 0040c6b0"); }
uint32_t FUN_0040c6f0() { generated_stub("FUN_0040c6f0 0040c6f0"); }
void FUN_0040c720(uint8_t *param_1) { generated_stub("FUN_0040c720 0040c720"); }
void deallocate(void *ptr, uint32_t count) { generated_stub("deallocate 0040c740"); }
void FUN_0040c790() { generated_stub("FUN_0040c790 0040c790"); }
uint32_t FUN_0040c7c0() { generated_stub("FUN_0040c7c0 0040c7c0"); }
void render_color_stack_push(ColorMod *color) { generated_stub("render_color_stack_push 0040c890"); }
int memcmp_eq(void *a, void *b, uint32_t size) { generated_stub("memcmp_eq 0040ca70"); }
void FUN_0040cad0() { generated_stub("FUN_0040cad0 0040cad0"); }
uint8_t str_eq(uint8_t *a, uint32_t lengthA, uint8_t *b, uint32_t lengthB) { generated_stub("str_eq 0040cae0"); }
@@ -9586,9 +9570,6 @@ uint32_t * FUN_00420020(int param_1, int param_2, uint32_t *param_3) { generated
RoomTransition * FUN_00420ae0() { generated_stub("FUN_00420ae0 00420ae0"); }
void FUN_00420b00() { generated_stub("FUN_00420b00 00420b00"); }
void FUN_00420b20() { generated_stub("FUN_00420b20 00420b20"); }
void FUN_00421260() { generated_stub("FUN_00421260 00421260"); }
void FUN_00421400() { generated_stub("FUN_00421400 00421400"); }
void FUN_004215a0(char *param_1) { generated_stub("FUN_004215a0 004215a0"); }
void FUN_004215e0(uint32_t *param_1) { generated_stub("FUN_004215e0 004215e0"); }
void FUN_00421620(uint8_t *param_1) { generated_stub("FUN_00421620 00421620"); }
DailyChallenge * FUN_00421780() { generated_stub("FUN_00421780 00421780"); }
@@ -9615,8 +9596,6 @@ void FUN_00425410() { generated_stub("FUN_00425410 00425410"); }
void online_stats_destroy(void *self) { generated_stub("online_stats_destroy 00425430"); }
void OnlineStats::compute_awards() { generated_stub("OnlineStats::compute_awards 004254b0"); }
void online_stats_register_players() { generated_stub("online_stats_register_players 004257b0"); }
void FUN_00427290() { generated_stub("FUN_00427290 00427290"); }
int holiday_get_current(uint32_t yyyymmdd) { generated_stub("holiday_get_current 00427870"); }
void FUN_00428560(uint32_t *param_1, uint32_t param_2) { generated_stub("FUN_00428560 00428560"); }
void FUN_004286b0(int *param_1, int *param_2) { generated_stub("FUN_004286b0 004286b0"); }
void FUN_00428880() { generated_stub("FUN_00428880 00428880"); }
@@ -9799,7 +9778,6 @@ void NpcAI::ENTITY_BEAST_ultra_war_fire_burst(Entity_NPC *npc) { generated_stub(
void NpcAI::ENTITY_BEAST_ultra_war_bomb(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_BEAST_ultra_war_bomb 0044f2b0"); }
void FUN_00450880(uint32_t param_1) { generated_stub("FUN_00450880 00450880"); }
void FUN_004508a0(uint32_t param_1) { generated_stub("FUN_004508a0 004508a0"); }
void NpcAI::ENTITY_LIL_BLUB(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_LIL_BLUB 00450da0"); }
uint32_t _ptr_deref_or_minus1() { generated_stub("_ptr_deref_or_minus1 00452be0"); }
void FUN_00456170(int *param_1) { generated_stub("FUN_00456170 00456170"); }
void FUN_00456190(uint32_t *param_1) { generated_stub("FUN_00456190 00456190"); }
@@ -9827,11 +9805,6 @@ void FUN_00499950() { generated_stub("FUN_00499950 00499950"); }
void FUN_004999b0() { generated_stub("FUN_004999b0 004999b0"); }
uint32_t FUN_004999d0(uint32_t param_1) { generated_stub("FUN_004999d0 004999d0"); }
uint32_t FUN_00499db0() { generated_stub("FUN_00499db0 00499db0"); }
void NpcAI::ENTITY_BUMBINO(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_BUMBINO 00499de0"); }
void NpcAI::ENTITY_CHIMERA_head_update(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_CHIMERA_head_update 0049cd90"); }
uint32_t FUN_0049d100() { generated_stub("FUN_0049d100 0049d100"); }
void NpcAI::ENTITY_CHIMERA_body(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_CHIMERA_body 0049d130"); }
uint32_t NpcAI::ENTITY_CHIMERA(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_CHIMERA 0049fa10"); }
void FUN_004a11b0() { generated_stub("FUN_004a11b0 004a11b0"); }
int FUN_004a2920() { generated_stub("FUN_004a2920 004a2920"); }
void FUN_004aaaa0(void *param_1, int param_2) { generated_stub("FUN_004aaaa0 004aaaa0"); }
@@ -9866,7 +9839,6 @@ uint32_t FUN_004bc660() { generated_stub("FUN_004bc660 004bc660"); }
void FUN_004bfd20() { generated_stub("FUN_004bfd20 004bfd20"); }
void FUN_004c5850(uint8_t *param_1) { generated_stub("FUN_004c5850 004c5850"); }
void FUN_004c5980(float *param_1, Vector *param_2) { generated_stub("FUN_004c5980 004c5980"); }
void NpcAI::ENTITY_MATRIARCH(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_MATRIARCH 004c59d0"); }
void FUN_004cdce0() { generated_stub("FUN_004cdce0 004cdce0"); }
uint32_t FUN_004ce0f0() { generated_stub("FUN_004ce0f0 004ce0f0"); }
void FUN_004cf0f0(uint8_t param_1) { generated_stub("FUN_004cf0f0 004cf0f0"); }
@@ -9901,7 +9873,6 @@ void pow_wrapper() { generated_stub("pow_wrapper 00505b40"); }
void set_byte_0x101(void *self, uint8_t value) { generated_stub("set_byte_0x101 00505b50"); }
int FUN_00505ca0() { generated_stub("FUN_00505ca0 00505ca0"); }
uint32_t * FUN_00505ce0() { generated_stub("FUN_00505ce0 00505ce0"); }
long double FUN_00515290(Vector *param_1, uint32_t param_2, int param_3) { generated_stub("FUN_00515290 00515290"); }
void npc_distribute_orbit_angles(Entity_NPC *npc) { generated_stub("npc_distribute_orbit_angles 00547040"); }
int FUN_0054d1b0(int param_1) { generated_stub("FUN_0054d1b0 0054d1b0"); }
void NpcAI::ENTITY_BUTT_SLICKER(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_BUTT_SLICKER 0054d250"); }
@@ -9916,9 +9887,6 @@ void FUN_0056ff00(uint32_t *param_1, uint32_t param_2, uint32_t param_3) { gener
bool FUN_0056ff60(uint32_t param_1) { generated_stub("FUN_0056ff60 0056ff60"); }
void FUN_00571170() { generated_stub("FUN_00571170 00571170"); }
void FUN_00571230(void *param_1, int param_2) { generated_stub("FUN_00571230 00571230"); }
void FUN_005729a0(int *param_1) { generated_stub("FUN_005729a0 005729a0"); }
void FUN_00572c10(int param_1) { generated_stub("FUN_00572c10 00572c10"); }
void NpcAI::ENTITY_CLUTCH(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_CLUTCH 00573030"); }
uint32_t * FUN_00575fe0(int *param_1, uint32_t param_2, uint32_t param_3, uint32_t param_4, uint32_t param_5, uint32_t param_6, int *param_7, uint32_t param_8, uint32_t param_9) { generated_stub("FUN_00575fe0 00575fe0"); }
void FUN_00579700() { generated_stub("FUN_00579700 00579700"); }
uint32_t FUN_00579760() { generated_stub("FUN_00579760 00579760"); }
@@ -9940,7 +9908,6 @@ void NpcAI::ENTITY_SCOURGE_projectile_attack(Entity_NPC *npc) { generated_stub("
void NpcAI::ENTITY_SCOURGE(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SCOURGE 00587aa0"); }
uint32_t FUN_0058ab60() { generated_stub("FUN_0058ab60 0058ab60"); }
void NpcAI::ENTITY_SINGE_body(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SINGE_body 0058aed0"); }
void NpcAI::ENTITY_SINGE_ball(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SINGE_ball 0058d8b0"); }
uint8_t FUN_0058e210() { generated_stub("FUN_0058e210 0058e210"); }
void FUN_0058e240(uint32_t param_1) { generated_stub("FUN_0058e240 0058e240"); }
void NpcAI::ENTITY_SIREN_main(Entity_NPC *npc) { generated_stub("NpcAI::ENTITY_SIREN_main 0058ec70"); }
@@ -10122,7 +10089,6 @@ uint32_t FUN_0060dae0() { generated_stub("FUN_0060dae0 0060dae0"); }
void FUN_0062e0e0(int param_1) { generated_stub("FUN_0062e0e0 0062e0e0"); }
void FUN_00638e20() { generated_stub("FUN_00638e20 00638e20"); }
void FUN_0063c060(int param_1) { generated_stub("FUN_0063c060 0063c060"); }
void FUN_0063e180() { generated_stub("FUN_0063e180 0063e180"); }
void FUN_006431b0() { generated_stub("FUN_006431b0 006431b0"); }
void FUN_0064b6a0() { generated_stub("FUN_0064b6a0 0064b6a0"); }
void FUN_0064d570(uint32_t param_1) { generated_stub("FUN_0064d570 0064d570"); }
@@ -10154,7 +10120,6 @@ int FUN_00652a30(uint32_t param_1, uint32_t param_2, uint32_t param_3, uint8_t p
void FUN_00652a70() { generated_stub("FUN_00652a70 00652a70"); }
bool _has_flag_0x110(uint32_t param_1) { generated_stub("_has_flag_0x110 00652a90"); }
int FUN_00652ae0() { generated_stub("FUN_00652ae0 00652ae0"); }
void reroll_entity_to_free_tile(int param_1) { generated_stub("reroll_entity_to_free_tile 0065ad30"); }
bool FUN_0065cfe0(uint32_t param_1) { generated_stub("FUN_0065cfe0 0065cfe0"); }
int FUN_0065d010() { generated_stub("FUN_0065d010 0065d010"); }
void FUN_0065d020() { generated_stub("FUN_0065d020 0065d020"); }
@@ -10167,9 +10132,6 @@ void FUN_0065d0c0() { generated_stub("FUN_0065d0c0 0065d0c0"); }
void FUN_0065d160() { generated_stub("FUN_0065d160 0065d160"); }
uint8_t * FUN_0065d1f0() { generated_stub("FUN_0065d1f0 0065d1f0"); }
Vector * FUN_006653c0(Vector *param_1) { generated_stub("FUN_006653c0 006653c0"); }
void FUN_006653e0(int param_1) { generated_stub("FUN_006653e0 006653e0"); }
void FUN_006655e0() { generated_stub("FUN_006655e0 006655e0"); }
void FUN_00665630() { generated_stub("FUN_00665630 00665630"); }
void FUN_00665a30() { generated_stub("FUN_00665a30 00665a30"); }
void FUN_00665a50() { generated_stub("FUN_00665a50 00665a50"); }
void FUN_00665a90(Entity *param_1) { generated_stub("FUN_00665a90 00665a90"); }
@@ -10196,7 +10158,6 @@ uint32_t FUN_0067f030() { generated_stub("FUN_0067f030 0067f030"); }
void FUN_0067f2e0() { generated_stub("FUN_0067f2e0 0067f2e0"); }
uint8_t string_to_bool(void *self) { generated_stub("string_to_bool 0067f600"); }
void ResolveRelativePath(uint8_t *anmPath, uint8_t *relPath, uint8_t *outPath) { generated_stub("ResolveRelativePath 0067f670"); }
void ExtractAngleBracketText() { generated_stub("ExtractAngleBracketText 0067fdf0"); }
void FUN_00680060(size_t param_1) { generated_stub("FUN_00680060 00680060"); }
void shader_stack_push(int shaderIndex) { generated_stub("shader_stack_push 00682280"); }
void FUN_00682350() { generated_stub("FUN_00682350 00682350"); }
@@ -10507,7 +10468,6 @@ void FUN_00738390(uint32_t param_1) { generated_stub("FUN_00738390 00738390"); }
void FUN_007383b0() { generated_stub("FUN_007383b0 007383b0"); }
int FUN_00738620(uint32_t param_1, uint32_t param_2) { generated_stub("FUN_00738620 00738620"); }
void FUN_00741cc0() { generated_stub("FUN_00741cc0 00741cc0"); }
void FUN_00741cf0() { generated_stub("FUN_00741cf0 00741cf0"); }
void FUN_007435c8() { generated_stub("FUN_007435c8 007435c8"); }
void FUN_0074371e() { generated_stub("FUN_0074371e 0074371e"); }
void FUN_0074399a() { generated_stub("FUN_0074399a 0074399a"); }
@@ -10586,8 +10546,6 @@ void FUN_00757980(uint32_t *param_1) { generated_stub("FUN_00757980 00757980");
void FUN_00757a10() { generated_stub("FUN_00757a10 00757a10"); }
uint32_t FUN_00758590() { generated_stub("FUN_00758590 00758590"); }
int FUN_00759260() { generated_stub("FUN_00759260 00759260"); }
void FUN_0075d9f0(uint32_t param_1) { generated_stub("FUN_0075d9f0 0075d9f0"); }
uint32_t FUN_0075ef20(ANM2 *param_1, int param_2) { generated_stub("FUN_0075ef20 0075ef20"); }
void FUN_00770640(float *param_1) { generated_stub("FUN_00770640 00770640"); }
void FUN_007792f0(uint32_t param_1, uint32_t param_2) { generated_stub("FUN_007792f0 007792f0"); }
uint32_t FUN_007826c0() { generated_stub("FUN_007826c0 007826c0"); }
@@ -10609,7 +10567,6 @@ void FUN_007d9360() { generated_stub("FUN_007d9360 007d9360"); }
uint32_t FUN_007d9ca0() { generated_stub("FUN_007d9ca0 007d9ca0"); }
uint32_t FUN_007da770() { generated_stub("FUN_007da770 007da770"); }
uint32_t FUN_007dac30() { generated_stub("FUN_007dac30 007dac30"); }
void FUN_007dad80() { generated_stub("FUN_007dad80 007dad80"); }
int FUN_007dafb0() { generated_stub("FUN_007dafb0 007dafb0"); }
void FUN_007dc610() { generated_stub("FUN_007dc610 007dc610"); }
void FUN_007dc620(uint32_t *param_1) { generated_stub("FUN_007dc620 007dc620"); }
@@ -10693,7 +10650,6 @@ uint32_t * FUN_007e3060(uint32_t *param_1) { generated_stub("FUN_007e3060 007e30
void FUN_007e3190() { generated_stub("FUN_007e3190 007e3190"); }
void FUN_007e3230() { generated_stub("FUN_007e3230 007e3230"); }
void FUN_007e4890() { generated_stub("FUN_007e4890 007e4890"); }
uint8_t pathfinder_can_reach_pos(Vector *targetPos, Vector *startPos, Room *room) { generated_stub("pathfinder_can_reach_pos 007e7820"); }
void FUN_007e8620() { generated_stub("FUN_007e8620 007e8620"); }
void FUN_007e86e0(int param_1, int param_2) { generated_stub("FUN_007e86e0 007e86e0"); }
void * vector_PathNode_emplace_reallocate_copy(void *self, void *where, void *value) { generated_stub("vector_PathNode_emplace_reallocate_copy 007e8810"); }
@@ -10770,7 +10726,6 @@ void FUN_00839840(float *param_1) { generated_stub("FUN_00839840 00839840"); }
void FUN_00839960() { generated_stub("FUN_00839960 00839960"); }
void FUN_008399a0(int *param_1) { generated_stub("FUN_008399a0 008399a0"); }
void FUN_00839b40() { generated_stub("FUN_00839b40 00839b40"); }
void render_beast_arena_background(void *self, int pass) { generated_stub("render_beast_arena_background 0083a3d0"); }
void FUN_0083aae0(uint8_t param_1, int *param_2, uint32_t *param_3) { generated_stub("FUN_0083aae0 0083aae0"); }
void FUN_0083b830() { generated_stub("FUN_0083b830 0083b830"); }
void FUN_0083bf50() { generated_stub("FUN_0083bf50 0083bf50"); }
@@ -10779,13 +10734,6 @@ void Catch_All_0083c241() { generated_stub("Catch_All_0083c241 0083c241"); }
uint32_t * FUN_0083c270(uint32_t *param_1, uint32_t *param_2, uint32_t *param_3) { generated_stub("FUN_0083c270 0083c270"); }
void FUN_0083c320(int *param_1, int *param_2) { generated_stub("FUN_0083c320 0083c320"); }
void FUN_0083c480() { generated_stub("FUN_0083c480 0083c480"); }
uint8_t ItemInfo::is_collectible_seen(int param_1) { generated_stub("ItemInfo::is_collectible_seen 0083d760"); }
uint8_t ItemInfo::is_pickup_known(int param_1) { generated_stub("ItemInfo::is_pickup_known 0083d7c0"); }
void item_pool_icons_render(void *iconLayer, Vector *position, KColor *color) { generated_stub("item_pool_icons_render 0083d8c0"); }
void ItemInfo::measure(uint32_t *param_1) { generated_stub("ItemInfo::measure 00840250"); }
void ItemInfo::measure_line(uint8_t *param_1, float *param_2, int *param_3) { generated_stub("ItemInfo::measure_line 008402f0"); }
void ItemInfo::render_popup_callback(int param_1, uint32_t param_2) { generated_stub("ItemInfo::render_popup_callback 00840370"); }
void ItemInfo::render_line(uint8_t *param_1, Vector *param_2, int param_3) { generated_stub("ItemInfo::render_line 008404a0"); }
char * FUN_00840510() { generated_stub("FUN_00840510 00840510"); }
std_string * int_to_string(std_string *outString, int value) { generated_stub("int_to_string 00840540"); }
void FUN_0084abc0(uint32_t *param_1, float *param_2, uint32_t *param_3, uint32_t *param_4) { generated_stub("FUN_0084abc0 0084abc0"); }
@@ -12620,17 +12568,6 @@ void kick_player_menu_render() { generated_stub("kick_player_menu_render 008d160
void FUN_008d2810() { generated_stub("FUN_008d2810 008d2810"); }
uint32_t * FUN_008d2880(uint32_t *param_1, int param_2) { generated_stub("FUN_008d2880 008d2880"); }
void FUN_008d28c0(uint32_t param_1, uint8_t *param_2) { generated_stub("FUN_008d28c0 008d28c0"); }
void FUN_008d47c0(int *param_1, uint32_t *param_2, uint32_t *param_3, uint32_t param_4, float param_5, uint32_t param_6) { generated_stub("FUN_008d47c0 008d47c0"); }
void OnlinePlayerInfo::render_items(float *param_1) { generated_stub("OnlinePlayerInfo::render_items 008d4940"); }
void FUN_008d5440(float *param_1) { generated_stub("FUN_008d5440 008d5440"); }
void FUN_008d5640(float *param_1) { generated_stub("FUN_008d5640 008d5640"); }
void FUN_008d57f0(float *param_1) { generated_stub("FUN_008d57f0 008d57f0"); }
void FUN_008d5da0(int *param_1, ANM2 *param_2, float *param_3) { generated_stub("FUN_008d5da0 008d5da0"); }
void render_item_info_text(void *self, void *text, Vector *position, int width, uint32_t lineStart, uint32_t lineEnd) { generated_stub("render_item_info_text 008d5f70"); }
int FUN_008d69d0(int param_1) { generated_stub("FUN_008d69d0 008d69d0"); }
uint32_t menu_item_description_build(void *self, int *item, uint32_t startLine, int unused, float maxHeight) { generated_stub("menu_item_description_build 008d7cb0"); }
int FUN_008d8460(int *param_1) { generated_stub("FUN_008d8460 008d8460"); }
void item_info_update_charge_bar(void *self, int collectibleId, Entity_Player *player) { generated_stub("item_info_update_charge_bar 008d8870"); }
void FUN_008d8a90() { generated_stub("FUN_008d8a90 008d8a90"); }
bool FUN_008dc0a0(int *param_1, int *param_2) { generated_stub("FUN_008dc0a0 008dc0a0"); }
bool FUN_008dc0d0(uint32_t param_1, int *param_2, int *param_3, uint8_t **param_4, int *param_5, int *param_6) { generated_stub("FUN_008dc0d0 008dc0d0"); }
@@ -12922,7 +12859,6 @@ void float_split() { generated_stub("float_split 00925f30"); }
void FUN_00926240() { generated_stub("FUN_00926240 00926240"); }
void FUN_00926460(uint8_t param_1) { generated_stub("FUN_00926460 00926460"); }
uint32_t FUN_009264b0(uint8_t *param_1, uint8_t *param_2) { generated_stub("FUN_009264b0 009264b0"); }
int save_backup_find_latest(PersistentGameData *gameData) { generated_stub("save_backup_find_latest 00926510"); }
void FUN_00929660(char param_1) { generated_stub("FUN_00929660 00929660"); }
uint8_t * FUN_00929b00() { generated_stub("FUN_00929b00 00929b00"); }
uint32_t FUN_00929b20() { generated_stub("FUN_00929b20 00929b20"); }
@@ -12972,7 +12908,6 @@ void cutscene_render_skip_vote_count(void *cutscene, void *state) { generated_st
uint32_t * FUN_00960880(void *param_1, uint32_t *param_2) { generated_stub("FUN_00960880 00960880"); }
void FUN_00960bc0() { generated_stub("FUN_00960bc0 00960bc0"); }
void FUN_0096d120(int *param_1) { generated_stub("FUN_0096d120 0096d120"); }
void pressure_plate_kill_enemies_timer_callback(int *param_1) { generated_stub("pressure_plate_kill_enemies_timer_callback 00983f30"); }
void FUN_0098b0a0() { generated_stub("FUN_0098b0a0 0098b0a0"); }
void FUN_0098b130() { generated_stub("FUN_0098b130 0098b130"); }
void FUN_00993740() { generated_stub("FUN_00993740 00993740"); }
@@ -12990,7 +12925,6 @@ void ** vector_LaserSample_erase(void *self, void **outIter, void *where) { gene
void FUN_009a1770(uint32_t *param_1) { generated_stub("FUN_009a1770 009a1770"); }
void * vector_LaserSample_emplace_reallocate(void *self, void *where, void *value) { generated_stub("vector_LaserSample_emplace_reallocate 009a17b0"); }
void FUN_009a1940(uint32_t *param_1, uint32_t *param_2, int param_3) { generated_stub("FUN_009a1940 009a1940"); }
float * FUN_009a6320(float *param_1, int param_2, int param_3) { generated_stub("FUN_009a6320 009a6320"); }
void FUN_009a8a40() { generated_stub("FUN_009a8a40 009a8a40"); }
void _player_hud_set_heart_anim_state(int param_1) { generated_stub("_player_hud_set_heart_anim_state 009a90b0"); }
void move_directory_files() { generated_stub("move_directory_files 009a90e0"); }
@@ -13095,7 +13029,6 @@ void FUN_009e6e10(int param_1) { generated_stub("FUN_009e6e10 009e6e10"); }
void FUN_009e6e50(uint8_t *param_1) { generated_stub("FUN_009e6e50 009e6e50"); }
void FUN_009e6e80() { generated_stub("FUN_009e6e80 009e6e80"); }
void FUN_009e6e90(Weapon_Brimstone *param_1, uint32_t param_2) { generated_stub("FUN_009e6e90 009e6e90"); }
void save_screenshot() { generated_stub("save_screenshot 009e6eb0"); }
void FUN_009e72e0() { generated_stub("FUN_009e72e0 009e72e0"); }
void FUN_009e7300() { generated_stub("FUN_009e7300 009e7300"); }
void FUN_009e7310() { generated_stub("FUN_009e7310 009e7310"); }
@@ -13142,13 +13075,10 @@ void FUN_009ebbf0() { generated_stub("FUN_009ebbf0 009ebbf0"); }
void Catch_All_009ebf8f() { generated_stub("Catch_All_009ebf8f 009ebf8f"); }
void FUN_009ebfc0() { generated_stub("FUN_009ebfc0 009ebfc0"); }
void FUN_009ef980(uint32_t *param_1) { generated_stub("FUN_009ef980 009ef980"); }
Vector * rich_text_render(void *self, Vector *outSize, uint8_t *text, Vector *position, KColor *color, float scale, int maxWidth) { generated_stub("rich_text_render 009efdb0"); }
void rich_text_layout(void *copiedSpan, uint8_t *markup, KColor *baseColor, uint32_t maxWidth, void *outLines, float scale) { generated_stub("rich_text_layout 009f0290"); }
void FUN_009f1be0(uint32_t *param_1) { generated_stub("FUN_009f1be0 009f1be0"); }
void FUN_009f1d20(char *param_1, char *param_2) { generated_stub("FUN_009f1d20 009f1d20"); }
void FUN_009f1d50(void *param_1, int param_2) { generated_stub("FUN_009f1d50 009f1d50"); }
void Catch_All_009f20c7() { generated_stub("Catch_All_009f20c7 009f20c7"); }
void FUN_009f20f0(void *param_1) { generated_stub("FUN_009f20f0 009f20f0"); }
void Catch_All_009f229d() { generated_stub("Catch_All_009f229d 009f229d"); }
uint32_t * FUN_009f2410(uint32_t *param_1) { generated_stub("FUN_009f2410 009f2410"); }
void FUN_009f2480() { generated_stub("FUN_009f2480 009f2480"); }
@@ -13260,7 +13190,6 @@ void FUN_00a1d4d0(uint32_t param_1, uint32_t *param_2) { generated_stub("FUN_00a
void FUN_00a1d5a0(uint32_t *param_1) { generated_stub("FUN_00a1d5a0 00a1d5a0"); }
void FUN_00a1d600() { generated_stub("FUN_00a1d600 00a1d600"); }
void FUN_00a1d6b0(int param_1) { generated_stub("FUN_00a1d6b0 00a1d6b0"); }
void render_color_quad(Vector *from, Vector *to, KColor *fromColor, KColor *toColor, float thickness) { generated_stub("render_color_quad 00a1d710"); }
void FUN_00a1e050() { generated_stub("FUN_00a1e050 00a1e050"); }
void FUN_00a1e1f0() { generated_stub("FUN_00a1e1f0 00a1e1f0"); }
uint32_t FUN_00a1e210() { generated_stub("FUN_00a1e210 00a1e210"); }
+2 -1
View File
@@ -1,4 +1,5 @@
#include "anm2.h"
#include "color_stack.h"
#include "game.h"
#include "kage_graphics.h"
#include "data.h"
@@ -1176,7 +1177,7 @@ static ColorMod layer_color_get(const AnimationFrame& frame, const LayerState& l
ColorMod color = (flags & ANIM_RENDER_UNTINTED) ? layer.color : animation.color;
if (flags & ANIM_RENDER_UNTINTED) color_multiply(color, frame.color);
else if (g_colorStackSize != 0) color = *(const ColorMod*)(uintptr_t)FUN_0040c6f0();
else if (const ColorMod* top = color_stack_top()) color = *top;
else
{
color_multiply(color, layer.color);
+8 -14
View File
@@ -45,7 +45,6 @@ constexpr uint32_t RNG_SHIFT_CONTROLS = 39;
// A room's grid cells on the surfaces, and the walls two cells thick that frame its floor.
constexpr float GRID_SIZE = 26;
constexpr int WALL_CELLS = 2;
constexpr float WALL_SIZE = WALL_CELLS * GRID_SIZE;
constexpr uint32_t FLOOR_SECOND = 1;
@@ -114,7 +113,6 @@ constexpr std::string_view KEYBOARD_ANIMATION = "Keyboard";
constexpr std::string_view GAMEPAD_ANIMATION = "XboxOne";
constexpr int KEYBOARD_CONTROLLER = 0;
constexpr int ACTION_NONE = -1;
constexpr int KEY_SPACE = 32;
constexpr float SPACE_KEY_PADDING = 4;
constexpr float ICON_PADDING = 4;
constexpr float ICON_WIDTH = 8;
@@ -145,14 +143,11 @@ constexpr int WALL_EDGE_COLUMNS = 7;
constexpr int WALL_EDGE_ROWS = 4;
constexpr int WALL_MIDDLE_COLUMN = 7;
constexpr int WALL_MIDDLE_ROW = 4;
constexpr int NARROW_COLUMN_INSET = 4;
constexpr int NARROW_ROW_INSET = 2;
constexpr int L_CORNER_SHEET_X = 18;
// The blood splats a room may start with: on world cells 40 apart, kept 20 from the walls or 100 from the middle.
constexpr float WORLD_CELL = 40;
constexpr float WORLD_ORIGIN_X = 40;
constexpr float WORLD_ORIGIN_Y = 120;
constexpr float SPLAT_MARGIN = 20;
constexpr float SPLAT_RADIUS = 100;
constexpr float SPLAT_SQUASH = 0.6f;
@@ -210,7 +205,6 @@ constexpr int DOOR_SIDE_SLOT = 2;
constexpr int MINES_LANTERN_ODDS = 4;
constexpr int MAUSOLEUM_TORCH_ODDS = 3;
constexpr int GEHENNA_CHAIN_ODDS = 3;
constexpr int COLOR_PRIORITY_TOP = 255;
// RenderFloor: the Error room's floor sprite repeats every 100 pixels.
constexpr float ERROR_TILE = 100;
@@ -1043,7 +1037,7 @@ static void blood_splat_spawn(Backdrop& backdrop, Vector position, bool isDarken
float scale = backdrop.rng.RandomFloat() * SPLAT_SCALE_RANGE + SPLAT_SCALE_MIN;
splat->sprite.scale = vector_make(scale, scale);
if (isDarkened) splat->SetColor(CORPSE_SPLAT_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_TOP, false, true);
if (isDarkened) splat->SetColor(CORPSE_SPLAT_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_DEFAULT, false, true);
splat->Update();
}
@@ -1055,8 +1049,8 @@ static void blood_splats_spawn(Backdrop& backdrop)
uint32_t id = backdrop.backdropId;
int cells = room.gridHeight * room.gridWidth;
auto cell_position = [&](int cell) {
return vector_make((float)(cell % room.gridWidth) * WORLD_CELL + WORLD_ORIGIN_X,
(float)(cell / room.gridWidth) * WORLD_CELL + WORLD_ORIGIN_Y);
return vector_make((float)(cell % room.gridWidth) * WORLD_CELL + GRID_ORIGIN_X,
(float)(cell / room.gridWidth) * WORLD_CELL + GRID_ORIGIN_Y);
};
if (id == BACKDROP_BASEMENT && room.roomType == ROOM_BOSS)
@@ -1469,7 +1463,7 @@ static Entity* null_light_spawn(Vector position, const NullFrame& frame)
light->flags |= FLAG_BACKDROP_DETAIL;
static_cast<Entity_Effect*>(light)->scale = LIGHT_SCALE;
light->SetColor(frame.color, COLOR_DURATION_FOREVER, COLOR_PRIORITY_TOP, false, true);
light->SetColor(frame.color, COLOR_DURATION_FOREVER, COLOR_PRIORITY_DEFAULT, false, true);
light->sprite.scale = frame.scale;
return light;
}
@@ -1508,7 +1502,7 @@ static void ember_spawn(Backdrop& backdrop, const WallSlot& slot, float drawBack
Entity* ember = wall_light_spawn(slot, drawBack, 0);
static_cast<Entity_Effect*>(ember)->scale = LIGHT_SCALE;
ember->SetColor(EMBER_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_TOP, false, true);
ember->SetColor(EMBER_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_DEFAULT, false, true);
if (!isFlattened)
{
float scale = backdrop.rng.RandomFloat() * BURNING_EMBER_RANGE + BURNING_EMBER_MIN;
@@ -1573,7 +1567,7 @@ static void colored_splat_spawn(Backdrop& backdrop, Vector position, const Color
{.position = position, .type = ENTITY_EFFECT, .variant = EFFECT_BLOOD_SPLAT, .seed = backdrop.rng.Next()});
splat->sprite.scale = vector_make(scale, scale);
splat->SetColor(color, COLOR_DURATION_FOREVER, COLOR_PRIORITY_TOP, false, true);
splat->SetColor(color, COLOR_DURATION_FOREVER, COLOR_PRIORITY_DEFAULT, false, true);
splat->Update();
}
@@ -1590,7 +1584,7 @@ static void cathedral_light_spawn(const WallSlot& slot)
g_game->Spawn({.position = position, .type = ENTITY_EFFECT, .variant = EFFECT_LIGHT, .seed = Random()});
light->flags |= FLAG_BACKDROP_DETAIL;
light->SetColor(CATHEDRAL_LIGHT_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_TOP, false, true);
light->SetColor(CATHEDRAL_LIGHT_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_DEFAULT, false, true);
light->sprite.scale = vector_make(CATHEDRAL_LIGHT_SCALE_X, CATHEDRAL_LIGHT_SCALE_Y);
light->sprite.rotation = ySign * xSign * CATHEDRAL_LIGHT_ANGLE;
}
@@ -1635,7 +1629,7 @@ static void dross_details_spawn(Backdrop& backdrop, const WallSlot& slot, bool i
int subType = backdrop.rng.RandomInt(DROSS_LIGHT_ODDS) == 0;
Entity* light = wall_light_spawn(slot, -WALL_LIGHT_OUT, subType);
light->SetColor(DROSS_LIGHT_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_TOP, false, true);
light->SetColor(DROSS_LIGHT_COLOR, COLOR_DURATION_FOREVER, COLOR_PRIORITY_DEFAULT, false, true);
light->sprite.scale = vector_make(DROSS_LIGHT_SCALE, DROSS_LIGHT_SCALE);
return;
}
+114 -10
View File
@@ -2,7 +2,9 @@
#include "fx_layers.h"
#include "game.h"
#include "log.h"
#include "render_passes.h"
#include "room.h"
#include <array>
constexpr int BACKGROUND_LAYER_COUNT = 15;
constexpr int BACKGROUND_GLOW_LAYER = 8;
@@ -99,27 +101,129 @@ void BeastArena::interpolate()
}
}
// The light layer's texture (hell_overlay.png), drawn over the screen from the spot that puts its (16, 121) at the
// room floor's screen centre, offset by a 480 by 270 screen and the floor's 26 margin.
// The background's art is laid out for a 480 by 270 screen around the room floor, with the floor's 26 margin. The light
// layer's texture (hell_overlay.png) puts its (16, 121) at the floor's screen centre.
constexpr int BACKGROUND_LIGHT_LAYER = 16;
constexpr float LIGHT_SCREEN_WIDTH = 480;
constexpr float LIGHT_SCREEN_HEIGHT = 270;
constexpr float LIGHT_FLOOR_MARGIN = 26;
constexpr float ART_SCREEN_WIDTH = 480;
constexpr float ART_SCREEN_HEIGHT = 270;
constexpr float ART_FLOOR_MARGIN = 26;
static const Vector LIGHT_ANCHOR = vector_make(16, 121);
// The background's layers each pass draws (up to the first -1), and by layer how far it scrolls and how much of the
// darkness it takes.
constexpr int PASS_LAYER_SLOTS = 6;
constexpr std::array<std::array<int, PASS_LAYER_SLOTS>, BEAST_PASS_COUNT> PASS_LAYERS = {
{{0, 1, 2, -1}, {3, 4, 5, 6, 7, 8}, {9, 10, -1}, {11, 12, 13, 14, 15, -1}}};
constexpr std::array<float, BACKGROUND_LAYER_COUNT + 1> LAYER_PARALLAX = {
0, 0.25f, 0.25f, 0, 0.33333334f, 0.33333334f, 0.5f, 0.5f, 0, 0.71428573f, 0.71428573f, 1, 1, 0, 0, 1.25f};
constexpr std::array<float, BACKGROUND_LAYER_COUNT + 1> LAYER_DARKNESS = {
0, 1, 1, 0, 0.8f, 0.8f, 0.6f, 0.6f, 0.4f, 0.1f, 0.1f, 0, 0, 0, 0, 0.98f};
// The background layers drawn from their own rows of the texture: the bands as tall as their keyframe, the ground down
// to the screen's bottom, and the hills and the low glow below their first rows.
constexpr int LAYER_HILLS_BACK = 0;
constexpr int LAYER_HILLS_FRONT = 3;
constexpr int LAYER_BAND_BACK = 9;
constexpr int LAYER_GROUND_BACK = 10;
constexpr int LAYER_BAND_FRONT = 11;
constexpr int LAYER_GROUND_FRONT = 12;
constexpr int LAYER_GLOW = 13;
constexpr float HILLS_FIRST_ROW = 69;
constexpr float GLOW_FIRST_ROW = 292;
// Where the art's 480 by 270 screen starts on the real one: around the room floor's screen rectangle, following the
// room's scroll and the screen shake.
static Vector art_origin_get()
{
Room& room = *g_game->room;
Vector floor = vector_sub(room.floorScreenBottomRight, room.floorScreenTopLeft);
Vector shift = vector_add(vector_add(room.renderSurfaceTopLeft, room.renderScrollOffset), g_game->screenShakeOffset);
return vector_make((floor.x + ART_FLOOR_MARGIN * 2 - ART_SCREEN_WIDTH) * HALF + shift.x + ART_FLOOR_MARGIN,
(floor.y + ART_FLOOR_MARGIN * 2 - ART_SCREEN_HEIGHT) * HALF + shift.y + ART_FLOOR_MARGIN);
}
// 0083a1b0 Draws the background's light layer over the whole screen in plain alpha, following the room's floor on
// screen, its scroll and the screen shake.
void BeastArena::render_light()
{
KAGE::Graphics::manager.blend_set(KAGE::Graphics::BLEND_NORMAL);
Room& room = *g_game->room;
Vector floor = vector_sub(room.floorScreenBottomRight, room.floorScreenTopLeft);
Vector shift = vector_add(vector_add(room.renderSurfaceTopLeft, room.renderScrollOffset), g_game->screenShakeOffset);
Vector at = vector_make((floor.x + LIGHT_FLOOR_MARGIN * 2 - LIGHT_SCREEN_WIDTH) * HALF + shift.x + LIGHT_FLOOR_MARGIN,
(floor.y + LIGHT_FLOOR_MARGIN * 2 - LIGHT_SCREEN_HEIGHT) * HALF + shift.y + LIGHT_FLOOR_MARGIN);
Vector at = art_origin_get();
std::shared_ptr<KAGE::Graphics::ImageBase> texture = background.GetLayer(BACKGROUND_LIGHT_LAYER)->spriteSheet;
if (!texture) return;
Vector screen = vector_make(g_screenWidth, g_screenHeight);
texture->Render(KAGE::Graphics::source_quad_rect(vector_sub(LIGHT_ANCHOR, at), screen),
KAGE::Graphics::color_quad_rect({}, screen, WHITE), WHITE);
}
// 0083a3d0 (render_beast_arena_background) Draws a pass of the hell background over the screen: under everything a red
// backdrop dimmed by the darkness, then each of the pass's layers in its own blending, scrolled by its parallax, tinted
// by its keyframe and dimmed by its share of the darkness, from the row its keyframe puts it at down. A layer starting
// below the screen is skipped.
// The original returns with the textured shader still pushed when a layer has no spritesheet, and reads a missing
// keyframe. Here the pass ends as usual then.
void BeastArena::render_background(BeastArenaPass pass)
{
namespace Graphics = KAGE::Graphics;
if (!isActive) return;
Graphics::Manager& graphics = Graphics::manager;
Vector origin = art_origin_get();
Vector screen = vector_make(g_screenWidth, g_screenHeight);
float darkness = g_game->darknessStrength * g_game->darknessModifier;
if (pass == BEAST_PASS_BACKGROUND)
{
graphics.blend_set(Graphics::BLEND_OPAQUE);
render_color_shader_pass(Graphics::color_quad_rect({}, screen, kcolor_rgba(1 - darkness, 0, 0, 1)));
}
graphics.shader_push(Graphics::COLOR_TEXTURE_SHADER);
for (int layerId : PASS_LAYERS[pass])
{
if (layerId < 0) break;
LayerState& layer = *background.GetLayer(layerId);
const std::array<int, BLEND_PART_COUNT>& mode = layer.blendMode;
using Factor = Graphics::BlendFactor;
graphics.blendMode = {(Graphics::BlendEquation)mode[BLEND_EQUATION], (Factor)mode[BLEND_RGB_SOURCE],
(Factor)mode[BLEND_RGB_DEST], (Factor)mode[BLEND_ALPHA_SOURCE],
(Factor)mode[BLEND_ALPHA_DEST]};
std::shared_ptr<Graphics::ImageBase> texture = layer.spriteSheet;
const AnimationFrame* frame = background.animState.GetLayerFrame(layerId);
if (!texture || !frame) break;
float shade = 1 - darkness * LAYER_DARKNESS[layerId];
ColorMod tint = frame->color;
color_multiply(tint, {{shade, shade, shade, 1}, {0, 0, 0, 0}, {0, 0, 0}});
float top = origin.y + ART_SCREEN_HEIGHT + frame->pos.y - frame->pivot.y - ART_FLOOR_MARGIN;
if (top >= screen.y) continue;
float destTop = 0;
float destBottom = screen.y;
float sourceTop = -top;
bool isBandLayer = layerId == LAYER_BAND_BACK || layerId == LAYER_BAND_FRONT;
if (isBandLayer)
{
destTop = top;
destBottom = top + frame->height;
sourceTop = frame->crop.y;
}
else if (layerId == LAYER_GROUND_BACK || layerId == LAYER_GROUND_FRONT)
{
destTop = top;
sourceTop = 0;
}
else if (layerId == LAYER_GLOW || layerId == LAYER_HILLS_BACK || layerId == LAYER_HILLS_FRONT)
{
sourceTop = layerId == LAYER_GLOW ? GLOW_FIRST_ROW : HILLS_FIRST_ROW;
destTop = top + sourceTop;
}
float sourceBottom = isBandLayer ? sourceTop + frame->height : screen.y - top;
float scrollX = -scrollRendered * LAYER_PARALLAX[layerId] - origin.x;
Vector sourceSize = vector_make(screen.x, sourceBottom - sourceTop);
Vector destSize = vector_make(screen.x, destBottom - destTop);
texture->Render(Graphics::source_quad_rect(vector_make(scrollX, sourceTop), sourceSize),
Graphics::color_quad_rect(vector_make(0, destTop), destSize, WHITE),
kcolor_rgba(tint._tint[0], tint._tint[1], tint._tint[2], tint._tint[3]));
}
graphics.shader_pop();
graphics.blend_set(Graphics::BLEND_NORMAL);
}
+11
View File
@@ -2,6 +2,16 @@
#include "anm2.h"
// The Beast's arena draws in passes around the room's: under everything, over the floor, over the entities, last.
enum BeastArenaPass
{
BEAST_PASS_BACKGROUND,
BEAST_PASS_FLOOR,
BEAST_PASS_ENTITIES,
BEAST_PASS_FOREGROUND,
BEAST_PASS_COUNT
};
// Construction and destruction are the defaults. The scroll speed's getter (00592260) is the public field.
// The scrolling hell of the Beast's fight (Room's beastArena): active in Home's Beast crawlspace, where its background
// scrolls by scrollSpeed and carries everything but the players and familiars along.
@@ -17,4 +27,5 @@ struct BeastArena
void update();
void interpolate();
void render_light();
void render_background(BeastArenaPass pass);
};
+1 -1
View File
@@ -926,7 +926,7 @@ void explosion_effects(const Explosion& explosion)
else if (flags[TEAR_GIGA_BOMB]) blast->sprite.scale = vector_make(explosion.radiusMultiplier * 2, explosion.radiusMultiplier * 2);
bool isFetusBomb = source && source->type == ENTITY_BOMB && static_cast<Entity_Bomb*>(source)->isFetus;
if (g_game->dailyChallenge._specialDailyId == SPECIAL_DAILY_FIREWORKS && isFetusBomb)
if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_FIREWORKS && isFetusBomb)
{
Entity* fireworks = g_game->Spawn({.position = explosion.position, .subType = 1, .type = ENTITY_EFFECT,
.variant = EFFECT_FIREWORKS, .seed = Random()});
-1
View File
@@ -61,7 +61,6 @@ constexpr std::array<std::string_view, 3> BEAST_HURT_ANIMATIONS = {"Damage1", "D
constexpr std::array<std::string_view, 3> BEAST_MOVE_HURT_ANIMATIONS = {"MoveLoopDamage1", "MoveLoopDamage2",
"MoveLoopDamage3"};
constexpr int BEAST_MUSIC_FIGHT_LAYER = 3;
constexpr int BOSS_OVERLAY_BEAST_DEAD = 4;
// Its moves toward its target: 6% of the way a frame, at most 8 (12 doubled after the dive, 15 switching sides), and
// half on an interpolation.
+702
View File
@@ -0,0 +1,702 @@
#include "boss_ai.h"
#include "boss_repentance.h"
#include "capsule.h"
#include "entity_bomb.h"
#include "entity_config.h"
#include "entity_pickup.h"
#include "entity_player.h"
#include "entity_slot.h"
#include "grid_entity.h"
#include "item_pool.h"
#include "npc_basement.h"
#include "room_grid.h"
#include <algorithm>
#include <array>
// Bumbino's states: resting, walking (after coins or its target), dizzy after a wall, swiping, slamming the ground,
// ramming up or down, throwing a butt bomb, and spawning its item before it goes.
enum BumbinoState
{
BUMBINO_REST = NPC_STATE_IDLE,
BUMBINO_WALK = NPC_STATE_MOVE,
BUMBINO_DIZZY = NPC_STATE_SUICIDE,
BUMBINO_SWIPE = NPC_STATE_ATTACK,
BUMBINO_SLAM = NPC_STATE_ATTACK2,
BUMBINO_RAM = NPC_STATE_ATTACK3,
BUMBINO_BUTT_BOMB = NPC_STATE_ATTACK4,
BUMBINO_LEAVE = NPC_STATE_SPECIAL
};
// Resting 30 to 59 frames (10 to 29 after an attack), then walking 60 to 119. Resting, one time in ten it throws a
// butt bomb at its target when that is down and to a side (its direction 0.31 to 0.91 down) in a clear line.
constexpr uint32_t BUMBINO_REST_RANGE = 30;
constexpr int BUMBINO_REST_FRAMES = 30;
constexpr uint32_t REST_SHORT_RANGE = 20;
constexpr int REST_SHORT_FRAMES = 10;
constexpr uint32_t WALK_RANGE = 60;
constexpr int WALK_FRAMES = 60;
constexpr float BUMBINO_LEAD = 0.1f;
constexpr float BUTT_BOMB_DOWN_MIN = 0.30710676f;
constexpr float BUTT_BOMB_DOWN_MAX = 0.90710676f;
constexpr uint32_t BUTT_BOMB_ODDS = 10;
constexpr float REST_FRICTION = 0.8f;
// Walking: after the nearest free coin it has a path to (searched every 3 frames, one time in four while it has
// one), else at its target, kept within 80 below its target when below the room's middle. It pauses 3 frames on each
// step. Stuck against a wall 9 frames it swipes. One time in four with its target level within 40 (and 200 across)
// it swipes (cooled down, or one time in 50), and one time in six with its target within 40 across it rams.
constexpr float COIN_SEARCH_EVERY = 3;
constexpr uint32_t COIN_KEEP_MASK = 3;
constexpr float COIN_REACH_SQUARED = 100000;
constexpr int STEP_PAUSE = 3;
constexpr float STEP_FRICTION = 0.4f;
constexpr float WALK_REACH_BELOW = 80;
constexpr float BUMBINO_WALK_SPEED = 0.8f;
constexpr float WALK_COIN_SPEED = 0.95f;
constexpr int STUCK_FRAMES = 9;
constexpr uint32_t SWIPE_MASK = 3;
constexpr float SWIPE_LEVEL = 40;
constexpr float SWIPE_ACROSS = 200;
constexpr uint32_t SWIPE_HOT_ODDS = 50;
constexpr float RAM_ACROSS = 40;
constexpr uint32_t RAM_ODDS = 6;
constexpr int COIN_WALK_FRAMES = 15;
constexpr int SWIPE_STUCK = -1;
constexpr int SWIPE_AIMED = 1;
// Its coins: twelve picked up, it leaves an item from its list.
constexpr int COINS_TO_LEAVE = 12;
constexpr std::array<int, 12> BUMBINO_ITEMS = {
COLLECTIBLE_YUM_HEART, COLLECTIBLE_HEART, COLLECTIBLE_COMMON_COLD, COLLECTIBLE_SINUS_INFECTION,
COLLECTIBLE_NUMBER_ONE, COLLECTIBLE_LEMON_MISHAP, COLLECTIBLE_POOP, COLLECTIBLE_BUTT_BOMBS,
COLLECTIBLE_COMPOUND_FRACTURE, COLLECTIBLE_BONE_SPURS, COLLECTIBLE_DEAD_TOOTH, COLLECTIBLE_MONSTROS_TOOTH};
// The swipe lunges at 12 across (4 to 12 at its target a twentieth of the gap across when aimed), up to 4 toward its
// target's height, slowing by 0.75 a frame. Its hitbox knocks things away at 10, hurting players and familiars 2 and
// the rest 35, and knocks one to three coins out of a player (at 3 plus 2 to 7). Stuck, it swipes back and forth.
constexpr float BUMBINO_SWIPE_FRICTION = 0.8f;
constexpr float SWIPE_SPEED = 12;
constexpr float SWIPE_AIM_SHARE = 20;
constexpr float SWIPE_AIM_MIN = 4;
constexpr float SWIPE_CLIMB = 4;
constexpr float SWIPE_NEAR = 0.001f;
constexpr float SWIPE_DRAG = 0.75f;
constexpr float SWIPE_STILL = 0.1f;
constexpr float SWIPE_WALL_SPEED = 10;
constexpr float SWIPE_WALL_FACING = 0.3f;
constexpr float SWIPE_KNOCK = 10;
constexpr float SWIPE_PLAYER_DAMAGE = 2;
constexpr float SWIPE_DAMAGE = 35;
constexpr int SWIPE_HIT_COUNTDOWN = 30;
constexpr uint32_t COIN_LOSS_RANGE = 3;
constexpr float COIN_KNOCK = 3;
constexpr float BUMBINO_COIN_SPEED_RANGE = 5;
constexpr float COIN_SPEED = 2;
constexpr int COIN_DROPPED_SUBTYPE = 1;
constexpr int SWIPE_AGAIN_FRAME = 7;
// Its trail of dust while lunging, every 2 frames, at a fifth of its speed plus 2 at random.
constexpr float DUST_EVERY = 2;
constexpr float DUST_TRAIL_SHARE = 0.2f;
constexpr float BUMBINO_DUST_SPIN = 10;
constexpr float BUMBINO_DUST_SPIN_MIN = 2;
constexpr uint32_t DUST_TRAIL_RANGE = 15;
constexpr int DUST_TRAIL_FRAMES = 15;
constexpr ColorMod BUMBINO_DUST_COLOR = {{0.8f, 0.7f, 0.65f, 0.75f}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr float BUMBINO_DUST_DEPTH = -5;
// The slam: 15 dust clouds at 15 to 20 and four crackwaves, a ring of eight rocks at 12, ten rock particles, and
// players within 100 thrown at 3. Then a rest and 30 to 89 frames of cooldown.
constexpr int BUMBINO_SLAM_SHAKE = 14;
constexpr int SLAM_DUST = 15;
constexpr float SLAM_DUST_SPEED = 15;
constexpr float BUMBINO_SLAM_DUST_SPEED_RANGE = 5;
constexpr float BUMBINO_DUST_SCALE = 0.9f;
constexpr float BUMBINO_DUST_SCALE_RANGE = 0.3f;
constexpr uint32_t SLAM_DUST_RANGE = 20;
constexpr int SLAM_DUST_FRAMES = 20;
constexpr int SLAM_CRACKWAVES = 4;
constexpr float BUMBINO_CRACKWAVE_FIRST = 45;
constexpr float BUMBINO_CRACKWAVE_STEP = 90;
constexpr int BUMBINO_SLAM_SOUND_DELAY = 20;
constexpr ColorMod SLAM_POOF_COLOR = {{0.9f, 0.85f, 0.84f, 0.9f}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr float SLAM_ROCK_SCALE = 1.25f;
constexpr float BUMBINO_SLAM_ROCK_SPEED = 12;
constexpr int BUMBINO_SLAM_PARTICLES = 10;
constexpr float PARTICLE_SPEED_MIN = 0.5f;
constexpr float PARTICLE_FLATTEN = 0.8f;
constexpr float BUMBINO_PARTICLE_SPEED = 10;
constexpr float PARTICLE_OUT = 3;
constexpr uint32_t PARTICLE_PLAIN_ODDS = 3;
constexpr int PARTICLE_DARK_SUBTYPE = 0x20000;
constexpr float SLAM_THROW_REACH = 100;
constexpr float PLAYER_THROW_SPEED = 3;
constexpr float PLAYER_THROW_HEIGHT = 9;
constexpr uint32_t BUMBINO_COOLDOWN_RANGE = 60;
constexpr int COOLDOWN_FRAMES = 30;
constexpr float SLAM_FRICTION = 0.7f;
// The ram: down at 10 or up at 8, a doubled push at its start.
constexpr float RAM_DOWN_SPEED = 10;
constexpr float RAM_UP_SPEED = -8;
// The butt bomb: a fart of 85 and a butt bomb at 12 within 45 degrees of its side toward its target ahead, on a 20
// fuse.
constexpr float BUMBINO_BUTT_FART_RADIUS = 85;
constexpr float BUTT_BOMB_RIGHT = 30;
constexpr float BUTT_BOMB_LEFT = 150;
constexpr float BUTT_BOMB_TURN = 45;
constexpr float BUTT_BOMB_SPEED = 12;
constexpr int BUTT_BOMB_FUSE = 20;
// A wall hit while lunging: dizzy for 60 frames, ten dust clouds thrown off the wall at 15 to 19, eight rocks at 100
// off the wall, and players within 150 thrown. Dizzy it rains rocks every other frame from 400 up, on its target one
// time in five, else on a free spot. A lunge breaks rocks it hits and bridges a pit behind them.
constexpr int BUMBINO_DIZZY_FRAMES = 60;
constexpr int WALL_DUST = 10;
constexpr float WALL_DUST_SPREAD = 160;
constexpr float WALL_DUST_FIRST = 100;
constexpr float WALL_DUST_SPEED_RANGE = 4;
constexpr float WALL_DUST_SPEED = 15;
constexpr int WALL_ROCKS = 8;
constexpr float WALL_ROCK_OUT = 100;
constexpr float WALL_THROW_REACH = 150;
constexpr float DIZZY_FRICTION = 0.7f;
constexpr int DIZZY_RAIN_END = 10;
constexpr uint32_t DIZZY_TARGET_ODDS = 5;
constexpr float DIZZY_SPOT_MARGIN = 10;
constexpr float DIZZY_SPOT_STEP = 64;
constexpr float RAIN_HEIGHT = -400;
constexpr float BUMBINO_RAIN_FALL_ACCEL = 2;
constexpr float RAIN_SCALE = 1.2f;
constexpr float RAIN_SCALE_RANGE = 0.40000004f;
constexpr float RAIN_FALL_RANGE = 10;
constexpr float CHARGING_DAMAGE_MIN = 2;
constexpr float CELL_HALF_STEP = 0.5f;
// Its leaving: an item from its list where items spawn, in a poof.
constexpr float BUMBINO_LEAVE_FRICTION = 0.5f;
// A cloud of its trail behind it, every 2 frames.
static void bumbino_trail_spawn(Entity_NPC& npc)
{
if (!npc.GetIntervalTicks(DUST_EVERY, 0)) return;
uint32_t seed = Random();
Vector drift = random_direction();
Vector velocity = vector_add(vector_scale(npc.velocity, DUST_TRAIL_SHARE), vector_add(drift, drift));
auto* cloud = static_cast<Entity_Effect*>(g_game->Spawn(
{.position = npc.pos, .velocity = velocity, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_DUST_CLOUD, .seed = seed}));
cloud->rotation = random_unit() * BUMBINO_DUST_SPIN + BUMBINO_DUST_SPIN_MIN;
cloud->SetTimeout((int)(Random() % DUST_TRAIL_RANGE) + DUST_TRAIL_FRAMES);
cloud->SetColor(BUMBINO_DUST_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
cloud->renderDepthOffset = BUMBINO_DUST_DEPTH;
}
// A cloud thrown off a slam or a wall: spinning either way, sized 0.9 to 1.2, lasting 20 to 39 frames.
static void bumbino_burst_dust(Entity_NPC& npc, const Vector& position, const Vector& velocity)
{
auto* cloud = static_cast<Entity_Effect*>(g_game->Spawn({.position = position,
.velocity = velocity,
.spawner = &npc,
.type = ENTITY_EFFECT,
.variant = EFFECT_DUST_CLOUD,
.seed = Random()}));
float side = Random() & 1 ? 1.0f : -1.0f;
cloud->rotation = (random_unit() * BUMBINO_DUST_SPIN + BUMBINO_DUST_SPIN_MIN) * side;
float scale = random_unit() * BUMBINO_DUST_SCALE_RANGE + BUMBINO_DUST_SCALE;
cloud->sprite.scale = vector_make(scale, scale);
cloud->SetTimeout((int)(Random() % SLAM_DUST_RANGE) + SLAM_DUST_FRAMES);
cloud->SetColor(BUMBINO_DUST_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
}
// Players within a reach of a spot are thrown away from it.
static void bumbino_players_throw(Entity_NPC& npc, const Vector& from, float reach)
{
for (Entity_Player* player : g_game->playerManager.playerList)
{
Vector away = vector_sub(player->pos, from);
if (vector_length(away) >= reach) continue;
player->TryThrow(EntityRef(&npc), vector_scale(vector_normalized(away), PLAYER_THROW_SPEED), PLAYER_THROW_HEIGHT);
}
}
// Its target ahead by a tenth of a second per unit of distance.
static Vector bumbino_lead(Entity_NPC& npc)
{
Entity* target = npc.GetPlayerTarget();
float distance = vector_distance(npc.pos, target->pos);
return vector_add(target->pos, vector_scale(target->velocity, distance * BUMBINO_LEAD));
}
// Back to rest for 10 to 29 frames.
static void bumbino_rest(Entity_NPC& npc)
{
npc.state = BUMBINO_REST;
npc.i1 = (int)(Random() % REST_SHORT_RANGE) + REST_SHORT_FRAMES;
}
// Starts a swipe (aimed or stuck): its lunge waits for the Shoot event.
static void bumbino_swipe_start(Entity_NPC& npc, int swipe)
{
npc.stateFrame = swipe;
npc.v1 = {};
npc.state = BUMBINO_SWIPE;
npc.sprite.Play("Swipe", PLAY_FORCED);
npc_sound_play(SOUND_BUMBINO_PUNCH, 1, 2, 1);
}
// The nearest free coin it can walk to, kept a while once picked.
static void bumbino_coin_update(Entity_NPC& npc)
{
Entity* coin = npc.entityRef.get();
bool isValid = !coin || (!coin->isDead && coin->type == ENTITY_PICKUP && coin->variant == PICKUP_COIN);
if (isValid && !(npc.IsFrame(COIN_SEARCH_EVERY, 0) && (!coin || (Random() & COIN_KEEP_MASK) == 0))) return;
if (!isValid) npc.entityRef = nullptr;
Entity* nearest = nullptr;
float nearestDistance = COIN_REACH_SQUARED;
for (Entity* candidate : entity_query(ENTITY_PICKUP, PICKUP_COIN))
{
if (candidate->isDead || static_cast<Entity_Pickup*>(candidate)->price != 0) continue;
if (!npc.pathfinder.HasPathToPos(candidate->pos, false)) continue;
float distance = vector_length_squared(vector_sub(npc.pos, candidate->pos));
if (nearestDistance <= distance) continue;
nearest = candidate;
nearestDistance = distance;
}
if (nearest) npc.entityRef = nearest;
}
// Walking after coins or its target, swiping or ramming when it lines up.
static void bumbino_walk_update(Entity_NPC& npc, int ticks)
{
bumbino_coin_update(npc);
npc.sprite.Play("Walk");
if (npc.sprite.IsEventTriggered("Step"))
{
npc.PlaySound(SOUND_MEAT_IMPACTS, 1, 2, false, 1);
npc.stateFrame = STEP_PAUSE - ticks;
npc.friction *= STEP_FRICTION;
}
else if (npc.stateFrame > 0)
{
npc.stateFrame -= ticks;
npc.friction *= STEP_FRICTION;
}
Entity* coin = npc.entityRef.get();
Vector goal = coin ? coin->pos : npc.CalcTargetPosition(0);
if (!coin && npc.pos.y > Room::GetCenterPos().y)
{
Vector up = vector_sub(room_laser_target_get(goal, vector_make(0, -1)), goal);
float length = vector_length(up);
if (length > WALK_REACH_BELOW && length > 0) up = vector_scale(up, WALK_REACH_BELOW / length);
goal = vector_add(goal, up);
}
npc.pathfinder.FindGridPath(goal, coin ? WALK_COIN_SPEED : BUMBINO_WALK_SPEED, GRID_PATH_FREED, DIRECT_PATH_FAR);
npc.i1 -= ticks;
npc.sprite.isFlipX = npc.pos.x < goal.x;
if (npc.aiCounter >= STUCK_FRAMES && npc.projectileCooldown <= 0) bumbino_swipe_start(npc, SWIPE_STUCK);
else if (coin) npc.i1 = std::max(npc.i1, COIN_WALK_FRAMES);
else
{
Vector lead = bumbino_lead(npc);
bool isSwiping = (Random() & SWIPE_MASK) == 0 && std::abs(lead.y - npc.pos.y) <= SWIPE_LEVEL &&
std::abs(lead.x - npc.pos.x) <= SWIPE_ACROSS &&
(npc.projectileCooldown < 1 || Random() % SWIPE_HOT_ODDS == 0);
if (isSwiping) bumbino_swipe_start(npc, SWIPE_AIMED);
else if (std::abs(lead.x - npc.pos.x) <= RAM_ACROSS && Random() % RAM_ODDS == 0)
{
npc.state = BUMBINO_RAM;
npc.v1 = vector_sub(lead, npc.pos);
npc.sprite.Play(npc.v1.y >= 0 ? "DownCharge" : "UpCharge");
npc.stateFrame = 0;
}
}
if (npc.i1 < 1) bumbino_rest(npc);
}
// Dizzy after a wall: it rains rocks, then shakes it off.
static void bumbino_dizzy_update(Entity_NPC& npc, int ticks)
{
npc.friction *= DIZZY_FRICTION;
bool isFinished = npc.sprite.IsFinished();
if (npc.stateFrame != 0)
{
if (!isFinished) return;
npc_sound_play(SOUND_BUMBINO_MISC, 1, 2, 1);
return bumbino_rest(npc);
}
if (isFinished)
{
npc.sprite.Play("Dizzy");
npc_sound_play(SOUND_BUMBINO_DIZZY, 1, 2, 1);
}
for (int tick = 0; tick < ticks; tick++)
{
npc.i1--;
if (npc.i1 <= DIZZY_RAIN_END || (npc.i1 & 1) != 0) continue;
Room& room = *g_game->room;
Vector spot = Random() % DIZZY_TARGET_ODDS == 0
? npc.CalcTargetPosition(0)
: room_free_pickup_position_find({.position = room.GetRandomPosition(DIZZY_SPOT_MARGIN), .step = DIZZY_SPOT_STEP});
ProjectileParams params;
params.heightModifier = RAIN_HEIGHT;
params.fallingAccelModifier = BUMBINO_RAIN_FALL_ACCEL;
params.scale = RAIN_SCALE - random_unit() * RAIN_SCALE_RANGE;
params.variant = PROJECTILE_ROCK;
params.fallingSpeedModifier = random_unit() * RAIN_FALL_RANGE + 0;
float angle = random_unit() * RANDOM_HALF_TURN * 2;
float speed = random_unit();
npc.FireProjectiles(spot, vector_make(std::cos(angle) * speed, std::sin(angle) * speed), PROJECTILES_SINGLE, params);
}
if (npc.i1 >= 0) return;
npc.sprite.Play("ShakeOff");
npc_sound_play(SOUND_BUMBINO_SNAP_OUT, 1, 2, 1);
npc.stateFrame++;
}
// The swipe's hitbox knocks back and hurts what it touches, and shakes coins out of players.
static void bumbino_hitbox_update(Entity_NPC& npc)
{
Capsule hitbox;
npc.GetNullCapsule(hitbox, "Hitbox");
if (hitbox.radius <= 0) return;
// The hitspheres debug view (debug flag 6) is left out until Entity::GetDebugShape is written.
for (Entity* other : entity_query_radius(hitbox.center, hitbox.halfLength + hitbox.radius, QUERY_ALL))
{
if (other->entityCollisionClass == ENTCOLL_NONE || other->entityGridCollisionClass == GRIDCOLL_BULLET || other == &npc)
continue;
if (!Capsule::Collide(hitbox, other->GetCollisionCapsule({}))) continue;
Vector away = vector_normalized(vector_sub(other->pos, npc.pos));
other->velocity = vector_add(other->velocity, vector_scale(away, SWIPE_KNOCK));
bool isFriend = other->type == ENTITY_PLAYER || other->type == ENTITY_FAMILIAR;
other->TakeDamage(isFriend ? SWIPE_PLAYER_DAMAGE : SWIPE_DAMAGE, 0, EntityRef(&npc), SWIPE_HIT_COUNTDOWN);
auto* player = other->ToPlayer();
bool isRobbed = player && player->variant == 0 && !player->isCoopGhost &&
!player->HasInvincibility(0, EntityRef()) && player->numCoins > 0;
if (!isRobbed) continue;
player->AddCoins(-1);
int dropped = std::min((int)(Random() % COIN_LOSS_RANGE) + 1, player->numCoins);
for (int i = 0; i < dropped; i++)
{
uint32_t seed = Random();
Vector knock = vector_scale(away, COIN_KNOCK);
float angle = random_unit() * RANDOM_HALF_TURN * 2;
float speed = random_unit() * BUMBINO_COIN_SPEED_RANGE + COIN_SPEED;
Vector velocity = vector_add(knock, vector_make(std::cos(angle) * speed, std::sin(angle) * speed));
g_game->Spawn({.position = player->pos,
.velocity = velocity,
.subType = COIN_DROPPED_SUBTYPE,
.type = ENTITY_PICKUP,
.variant = PICKUP_COIN,
.seed = seed});
}
player->AddCoins(-dropped);
}
}
// The swipe: a lunge across (and toward its target's height), its hitbox live, swiping back while stuck, ending in a
// slam. Whether it lunges, and whether it hit a wall hard.
static bool bumbino_swipe_update(Entity_NPC& npc, bool& isWallImpact)
{
npc.friction *= BUMBINO_SWIPE_FRICTION;
if (npc.sprite.IsEventTriggered("Shoot"))
{
npc.PlaySound(SOUND_FAT_WIGGLE, 1, 2, false, 1);
Entity* target = npc.GetPlayerTarget();
float distance = vector_distance(npc.pos, target->pos);
float climb = distance <= SWIPE_NEAR ? 0 : (target->pos.y - npc.pos.y) / distance;
npc.v1 = vector_make(npc.sprite.isFlipX ? SWIPE_SPEED : -SWIPE_SPEED, std::clamp(climb * SWIPE_CLIMB, -SWIPE_CLIMB, SWIPE_CLIMB));
if (npc.stateFrame == 0)
{
float aim = (target->pos.x - npc.pos.x) / SWIPE_AIM_SHARE;
npc.v1.x = npc.v1.x >= 0 ? std::clamp(aim, SWIPE_AIM_MIN, SWIPE_SPEED) : std::clamp(aim, -SWIPE_SPEED, -SWIPE_AIM_MIN);
}
}
bool isLunging = false;
if (!vector_is_zero(npc.v1))
{
bumbino_trail_spawn(npc);
npc.AddVelocity_divided(npc.v1, false);
npc.v1 = vector_scale(npc.v1, timescale_factor(SWIPE_DRAG, npc.speedMultiplier));
if (std::abs(npc.v1.x) < SWIPE_STILL) npc.v1 = {};
bool isHard = npc.isCollidesWithGrid && vector_length(npc.gridCollisionVelocity) > SWIPE_WALL_SPEED;
if (isHard) isWallImpact = vector_dot(vector_normalized(npc.gridCollisionVelocity), npc.gridCollisionNormal) > SWIPE_WALL_FACING;
isLunging = true;
}
bumbino_hitbox_update(npc);
if (npc.stateFrame > 0 && npc.sprite.IsEventTriggered("Sound"))
{
npc.stateFrame--;
npc.sprite.isFlipX = !npc.sprite.isFlipX;
npc.sprite.Play("Swipe", PLAY_FORCED);
npc_sound_play(SOUND_BUMBINO_PUNCH, 1, 2, 1);
npc.sprite.SetFrame((float)SWIPE_AGAIN_FRAME);
}
if (npc.sprite.IsPlaying()) return isLunging;
if (npc.stateFrame < 0)
{
npc.state = BUMBINO_REST;
npc.i1 = 1;
npc.projectileCooldown = 1;
}
else
{
npc.sprite.isFlipX = false;
npc.sprite.Play("GroundSlam");
npc.state = BUMBINO_SLAM;
}
return isLunging;
}
// The slam: dust, crackwaves, a ring of rocks and rock particles, throwing players near.
static void bumbino_slam_update(Entity_NPC& npc)
{
npc.friction *= SLAM_FRICTION;
if (npc.sprite.IsEventTriggered("Sound")) npc_sound_play(SOUND_BUMBINO_SLAM, 1, 2, 1);
if (npc.sprite.IsEventTriggered("Shoot"))
{
Vector hit = vector_add(npc.pos, npc.GetNullOffset("Hitbox"));
game_shake_screen(BUMBINO_SLAM_SHAKE);
for (int i = 0; i < SLAM_DUST; i++)
{
float angle = random_unit() * RANDOM_HALF_TURN * 2;
float speed = random_unit() * BUMBINO_SLAM_DUST_SPEED_RANGE + SLAM_DUST_SPEED;
bumbino_burst_dust(npc, hit, vector_make(std::cos(angle) * speed, std::sin(angle) * speed));
}
for (int i = 0; i < SLAM_CRACKWAVES; i++)
{
auto* wave = static_cast<Entity_Effect*>(g_game->Spawn(
{.position = hit, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_CRACKWAVE, .seed = Random()}));
wave->parent = &npc;
wave->rotation = (float)i * BUMBINO_CRACKWAVE_STEP + BUMBINO_CRACKWAVE_FIRST;
}
npc_sound_play(SOUND_HELLBOSS_GROUNDPOUND, 1, BUMBINO_SLAM_SOUND_DELAY, 1);
game_shake_screen(BUMBINO_SLAM_SHAKE);
npc.MakeGroundPoof(hit, SLAM_POOF_COLOR, 1);
ProjectileParams params;
params.variant = PROJECTILE_ROCK;
params.scale = SLAM_ROCK_SCALE;
npc.FireProjectiles(hit, vector_make(BUMBINO_SLAM_ROCK_SPEED, 0), PROJECTILES_EIGHT, params);
for (int i = 0; i < BUMBINO_SLAM_PARTICLES; i++)
{
float angle = random_unit() * RANDOM_HALF_TURN * 2;
float speed = random_unit() + PARTICLE_SPEED_MIN;
Vector direction = vector_make(std::cos(angle) * speed, std::sin(angle) * speed * PARTICLE_FLATTEN);
uint32_t seed = Random();
int subType = Random() % PARTICLE_PLAIN_ODDS != 0 ? PARTICLE_DARK_SUBTYPE : 0;
g_game->Spawn({.position = vector_add(hit, vector_scale(direction, PARTICLE_OUT)),
.velocity = vector_scale(direction, BUMBINO_PARTICLE_SPEED),
.subType = subType,
.type = ENTITY_EFFECT,
.variant = EFFECT_ROCK_PARTICLE,
.seed = seed});
}
bumbino_players_throw(npc, hit, SLAM_THROW_REACH);
}
if (npc.sprite.IsPlaying()) return;
npc.state = BUMBINO_REST;
npc.i1 = (int)(Random() % REST_SHORT_RANGE) + REST_SHORT_FRAMES;
npc.projectileCooldown = (int)(Random() % BUMBINO_COOLDOWN_RANGE) + COOLDOWN_FRAMES;
}
// The ram up or down. Whether it lunges, and whether it hit a wall.
static bool bumbino_ram_update(Entity_NPC& npc, bool& isWallImpact)
{
npc.friction *= SLAM_FRICTION;
if (npc.stateFrame == 0)
{
if (npc.sprite.IsEventTriggered("Sound")) npc.PlaySound(SOUND_FAT_WIGGLE, 1, 2, false, 1);
if (!npc.sprite.IsEventTriggered("Shoot")) return false;
npc_sound_play(SOUND_BUMBINO_RAM, 1, 2, 1);
npc.stateFrame++;
float speed = npc.v1.y <= 0 ? RAM_UP_SPEED : RAM_DOWN_SPEED;
npc.v1 = vector_make(0, speed);
npc.AddVelocity_divided(vector_make(0, speed + speed), false);
return false;
}
if (npc.stateFrame != 1) return false;
bumbino_trail_spawn(npc);
npc.AddVelocity_divided(npc.v1, false);
isWallImpact = npc.isCollidesWithGrid;
return true;
}
// The butt bomb: a fart and a butt bomb lobbed toward its target.
static void bumbino_butt_bomb_update(Entity_NPC& npc)
{
npc.friction *= SLAM_FRICTION;
if (npc.sprite.IsEventTriggered("Sound")) npc.PlaySound(SOUND_BUMBINO_HIT_WALL, 1, 2, false, 1);
if (npc.sprite.IsEventTriggered("Shoot"))
{
Vector origin = vector_add(npc.pos, npc.GetNullOffset("Hitbox"));
game_fart({.position = origin, .source = &npc, .radius = BUMBINO_BUTT_FART_RADIUS});
float side = npc.sprite.isFlipX ? BUTT_BOMB_LEFT : BUTT_BOMB_RIGHT;
Vector aim = vector_sub(bumbino_lead(npc), origin);
uint32_t seed = Random();
float angle = angle_approach(side, vector_angle(aim), BUTT_BOMB_TURN);
auto* bomb = static_cast<Entity_Bomb*>(g_game->Spawn({.position = origin,
.velocity = vector_scale(vector_from_angle(angle), BUTT_BOMB_SPEED),
.spawner = &npc,
.type = ENTITY_BOMB,
.variant = BOMB_BUTT,
.seed = seed}));
bomb->SetExplosionCountdown(BUTT_BOMB_FUSE);
bomb->entityCollisionClass = ENTCOLL_NONE;
}
if (!npc.sprite.IsPlaying()) bumbino_rest(npc);
}
// A lunge breaks the rocks it runs into (bridging a pit behind each). Whether any broke.
static bool bumbino_rocks_break(Entity_NPC& npc)
{
Room& room = *g_game->room;
bool isBroken = false;
for (Vector point : npc.collisionPoints)
{
Vector at = vector_add(vector_add(vector_scale(npc.gridCollisionVelocity, CELL_HALF_STEP), npc.pos), point);
int column = (int)((at.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + CELL_HALF_STEP);
int row = (int)((at.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + CELL_HALF_STEP);
if (column < 0 || column >= room.gridWidth || row < 0 || row >= room.gridHeight) continue;
int index = room.gridWidth * row + column;
GridEntity* rock = room.GetGridEntity((uint32_t)index);
uint32_t collision = room.GetGridCollision(index);
bool isSolid = collision == COLLISION_SOLID || collision == COLLISION_OBJECT;
if (!isSolid || !rock || rock->collisionClass != COLLISION_SOLID) continue;
if (!rock->Destroy(false, EntityRef(&npc))) continue;
Vector cell = vector_make((float)(rock->gridIndex % room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_X,
(float)(rock->gridIndex / room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_Y);
Vector beyond = vector_add(cell, vector_scale(vector_cardinal(vector_sub(cell, npc.pos)), GRID_CELL_SIZE));
int beyondIndex = room.GetGridIndex(beyond);
if (beyondIndex >= 0) room_bridge_make(room.GetGridEntity((uint32_t)beyondIndex), rock);
isBroken = true;
}
return isBroken;
}
// A lunge into a wall: a crash of dust and rocks, players thrown, and it reels dizzy.
static void bumbino_wall_impact(Entity_NPC& npc)
{
npc_sound_play(SOUND_HELLBOSS_GROUNDPOUND, 1, BUMBINO_SLAM_SOUND_DELAY, 1);
game_shake_screen(BUMBINO_SLAM_SHAKE);
npc.sprite.Play("WallImpact");
npc_sound_play(SOUND_BUMBINO_HIT_WALL, 1, 2, 1);
npc.state = BUMBINO_DIZZY;
npc.stateFrame = 0;
npc.i1 = BUMBINO_DIZZY_FRAMES;
npc.GetPlayerTarget();
for (int i = 0; i < WALL_DUST; i++)
{
float angle = random_unit() * WALL_DUST_SPREAD + WALL_DUST_FIRST;
Vector off = vector_rotated(npc.gridCollisionNormal, angle);
float speed = random_unit() * WALL_DUST_SPEED_RANGE + WALL_DUST_SPEED;
bumbino_burst_dust(npc, npc.pos, vector_scale(off, speed));
}
ProjectileParams params;
params.variant = PROJECTILE_ROCK;
npc.FireBossProjectiles(WALL_ROCKS, vector_sub(npc.pos, vector_scale(npc.gridCollisionNormal, WALL_ROCK_OUT)), 0, params);
bumbino_players_throw(npc, npc.pos, WALL_THROW_REACH);
}
// 00499de0 Bumbino walks after coins (twelve and it leaves an item) or its target, swiping, ramming, slamming and
// throwing butt bombs. Lunging into a wall leaves it dizzy under falling rocks.
void boss_bumbino_update(Entity_NPC& npc)
{
int ticks = npc_ticks_get(npc);
npc.aiCounter = npc.isCollidesWithGrid ? npc.aiCounter + 1 : 0;
if (npc.isDead) npc_sound_play(SOUND_BUMBINO_DEATH, 1, 2, 1);
bool isLunging = false;
bool isWallImpact = false;
switch (npc.state)
{
case NPC_STATE_INIT:
npc.state = BUMBINO_REST;
npc.i2 = 0;
npc.aiCounter = 0;
npc.i1 = (int)(Random() % BUMBINO_REST_RANGE) + BUMBINO_REST_FRAMES;
npc.pathfinder.canCrushRocks = true;
break;
case BUMBINO_REST:
{
npc.friction *= REST_FRICTION;
npc.sprite.Play("Idle2");
npc.i1 -= ticks;
if (npc.i1 < 1)
{
npc.state = BUMBINO_WALK;
npc.stateFrame = 0;
npc.i1 = (int)(Random() % WALK_RANGE) + WALK_FRAMES;
break;
}
Vector lead = bumbino_lead(npc);
Vector gap = vector_sub(lead, npc.pos);
Vector direction = vector_normalized(gap);
bool isBombing = direction.y > BUTT_BOMB_DOWN_MIN && direction.y < BUTT_BOMB_DOWN_MAX &&
room_check_line(npc.pos, lead, LINE_MODE_CELL, 0) && Random() % BUTT_BOMB_ODDS == 0;
if (!isBombing) break;
npc.sprite.Play("ButtBomb");
npc.state = BUMBINO_BUTT_BOMB;
npc.sprite.isFlipX = gap.x < 0;
break;
}
case BUMBINO_WALK:
bumbino_walk_update(npc, ticks);
break;
case BUMBINO_DIZZY:
bumbino_dizzy_update(npc, ticks);
break;
case BUMBINO_SWIPE:
isLunging = bumbino_swipe_update(npc, isWallImpact);
break;
case BUMBINO_SLAM:
bumbino_slam_update(npc);
break;
case BUMBINO_RAM:
isLunging = bumbino_ram_update(npc, isWallImpact);
break;
case BUMBINO_BUTT_BOMB:
bumbino_butt_bomb_update(npc);
break;
case BUMBINO_LEAVE:
npc.friction *= BUMBINO_LEAVE_FRICTION;
if (npc.sprite.IsEventTriggered("Shoot"))
{
int item = g_game->itemPool.GetCollectibleFromList(BUMBINO_ITEMS, npc.initSeed, COLLECTIBLE_POOP, LIST_PICK_BLACKLIST);
uint32_t seed = npc.dropRNG.Next();
Entity* pedestal = g_game->Spawn({.position = collectible_spawn_position(npc.pos),
.subType = item,
.type = ENTITY_PICKUP,
.variant = PICKUP_COLLECTIBLE,
.seed = seed});
g_game->Spawn({.position = pedestal->pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
npc_sound_play(SOUND_THUMBSUP, 1, 2, 1);
}
if (npc.sprite.IsPlaying()) break;
npc.Remove();
return g_game->room->TriggerBossDeath(npc);
}
npc.collisionDamage = isLunging ? std::max(npc.config->collisionDamage, CHARGING_DAMAGE_MIN) : npc.config->collisionDamage;
if (npc.isCollidesWithGrid && isLunging && bumbino_rocks_break(npc))
npc.velocity = vector_scale(npc.gridCollisionVelocity, CELL_HALF_STEP);
else if (isWallImpact) bumbino_wall_impact(npc);
if (npc.projectileCooldown > 0) npc.projectileCooldown -= ticks;
bool isCalm = npc.state == BUMBINO_REST || npc.state == BUMBINO_WALK;
if (!isCalm || npc.i2 < COINS_TO_LEAVE) return;
npc.i2 = 0;
npc.state = BUMBINO_LEAVE;
npc.sprite.Play("ItemSpawn");
npc.sprite.isFlipX = false;
npc.RemoveStatusEffects();
npc.entityCollisionClass = ENTCOLL_NONE;
}
+1152
View File
File diff suppressed because it is too large. Load diff
+740
View File
@@ -0,0 +1,740 @@
#include "boss_repentance.h"
#include "boss_ai.h"
#include "grid_entity_trap_door.h"
#include "entity_config.h"
#include "npc_fireplace.h"
#include <algorithm>
#include <vector>
// Clutch's forms, by variant: Clutch himself and the fireballs circling him.
constexpr int CLUTCH_FIREBALL = 1;
// Clutch's states: resting before he picks a Clickety Clack, wandering in his last phase, inside a Clickety Clack,
// stunned once none is left, flying to the one he picked, flying at his target, his ring of flames, leaving a
// Clickety Clack, and his last phase's start.
enum ClutchState
{
CLUTCH_IDLE = NPC_STATE_IDLE,
CLUTCH_WANDER = NPC_STATE_MOVE,
CLUTCH_POSSESS = NPC_STATE_JUMP,
CLUTCH_STUNNED = NPC_STATE_STOMP,
CLUTCH_FLY = NPC_STATE_ATTACK,
CLUTCH_CHARGE = NPC_STATE_ATTACK2,
CLUTCH_RING = NPC_STATE_ATTACK3,
CLUTCH_UNPOSSESS = NPC_STATE_ATTACK4,
CLUTCH_TRANSITION = NPC_STATE_SPECIAL
};
// The Clickety Clacks' states Clutch drives: its stomp, its stun, getting up and its pile of bones.
// His last phase starts at a quarter of his health. His Clickety Clacks take 1.75 times their health.
constexpr float CLUTCH_LAST_PHASE = 0.25f;
constexpr float CLACK_HEALTH_SHARE = 1.75f;
constexpr ColorMod CLUTCH_SPLAT_COLOR = {{0.8f, 0.75f, 1, 0.5f}, {2.1f, 1.7f, 2.5f, 1}, {0, 0, 0}};
constexpr uint32_t CLUTCH_AI_CALLS = AI_CALL_INTERPOLATE | AI_CALL_POST_UPDATE;
// Resting 15 frames, then flying at his pick: starting 29 frames in after a quick revert, waiting 30 more.
constexpr int CLUTCH_REST = 15;
constexpr float CLUTCH_FRICTION = 0.9f;
constexpr float CLUTCH_SLOW_FRICTION = 0.8f;
constexpr float CLUTCH_MOVE_START_FRAME = 29;
constexpr int CLUTCH_REVERT_REST = 30;
// The flight: up to 0.8 a frame faster a frame (30 at most) to his pick, entering it within 20. In his last phase he
// wanders 8 frames, then flies at half the gap to his target (1.2 a frame faster, 30 at most) and rings it with flames
// within 20: six rings of nine fire shots at 9, every other one turned 30 degrees.
constexpr float CLUTCH_FLY_GAIN = 0.8f;
constexpr float CLUTCH_FLY_MAX = 30;
constexpr float CLUTCH_REACH = 20;
constexpr int CLUTCH_WANDER_FRAMES = 8;
constexpr float CLUTCH_CHARGE_GAIN = 1.2f;
constexpr float CLUTCH_RING_SPEED = 9;
constexpr float CLUTCH_RING_SHOTS = 6;
constexpr float CLUTCH_RING_TURN = 0.5235988f;
constexpr int CLUTCH_RINGS = 5;
constexpr float CLUTCH_RING_VOLUME = 0.8f;
// Stunned with no Clickety Clack left he takes 80 hurt (a tenth a frame at least) before rising, waking the burnt piles
// every 8 frames. Thrown out of a dead Clickety Clack at 20. In his last phase he takes a tenth of each hit.
constexpr float CLUTCH_STUN_HEALTH = 80;
constexpr float CLUTCH_STUN_DRAIN = 0.1f;
constexpr float CLUTCH_THROW_SPEED = 20;
constexpr float CLUTCH_PILE_EVERY = 8;
constexpr float CLUTCH_LAST_DAMAGE_SHARE = 0.1f;
constexpr float CLUTCH_ROAR_VOLUME = 2;
constexpr float CLUTCH_LAST_ROAR_VOLUME = 1.5f;
constexpr int CLUTCH_SHAKE = 16;
constexpr float CLUTCH_RIPPLE_AMPLITUDE = 0.035f;
constexpr float CLUTCH_RIPPLE_SPEED = 0.025f;
constexpr int CLUTCH_RIPPLE_FRAMES = 10;
constexpr float CLUTCH_COUNT_EVERY = 15;
// The beam between Clutch and his pick fades over 10 frames, raised 12, once he enters it.
constexpr ColorMod CLUTCH_BEAM_COLOR = {{0.35f, 0.1f, 1, 0.8f}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr int CLUTCH_BEAM_FADE = 10;
constexpr float CLUTCH_BEAM_RAISE = -12;
// A Clickety Clack burnt for good becomes a purple fire with two fireballs 10 out at a random angle.
constexpr std::string_view CLUTCH_FIRE_ANM2 = "gfx/009.002_Fire Projectile.anm2";
constexpr std::string_view CLUTCH_POOF_ANM2 = "gfx/033.010_Movable Fireplace.anm2";
constexpr int CLUTCH_FIREBALLS = 2;
constexpr float CLUTCH_FIREBALL_OUT = 10;
constexpr float CLUTCH_POOF_VOLUME = 0.85f;
// The trail of purple flames behind him: one more every time the Trail null moved 8 (squared) from the last, 0.6 to 0.8
// of the null's size, drifting 1.5 down (or swinging across his flight), slowing by 0.9 plus 0.08 of its size, shaking
// by 0.3 of it and shrinking 0.08 a frame, kept within 40 of the null. Half a step between frames.
constexpr float TRAIL_SPACING_SQUARED = 8;
constexpr float CLUTCH_TRAIL_SIZE = 0.6f;
constexpr float TRAIL_SIZE_RANGE = 0.2f;
constexpr float TRAIL_DRIFT = 1.5f;
constexpr float TRAIL_SWAY = 6;
constexpr float TRAIL_SWAY_PERIOD = 15;
constexpr float TRAIL_SWING_RATE = 0.25f;
constexpr float TRAIL_SWING_SHARE = 0.33f;
constexpr float TRAIL_DRAG = 0.9f;
constexpr float TRAIL_SIZE_DRAG = 0.08f;
constexpr float TRAIL_SHAKE = 0.3f;
constexpr float CLUTCH_TRAIL_SHRINK = 0.08f;
constexpr float TRAIL_REACH = 40;
constexpr float TRAIL_PULL = 0.6f;
constexpr float TRAIL_INTERPOLATED_STEP = 0.5f;
constexpr ColorMod TRAIL_HIDDEN_COLOR = {{1, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr size_t TRAIL_POINT = 3;
constexpr int TRAIL_FIRST_LAYER = 1;
constexpr int TRAIL_LAST_LAYER = 2;
// A trail segment shows one of 8 frames by its flames' size, stretched to half its length per missing frame (1 to 3).
constexpr int TRAIL_FRAMES = 8;
constexpr float TRAIL_STRETCH_MAX = 3;
// Whether a Clickety Clack (or other NPC) is one of Clutch's side.
static bool clutch_is_ally(Entity_NPC& npc, Entity& other)
{
return Entity::is_enemy_type(other.type) && other.IsFriendly() == npc.IsFriendly();
}
// The Clickety Clacks of his side he leads.
static std::vector<Entity_NPC*> clutch_clacks_get(Entity_NPC& npc)
{
std::vector<Entity_NPC*> clacks;
for (Entity* other : Entity_NPC::QueryNPCsType(ENTITY_CLICKETY_CLACK, -1))
if (clutch_is_ally(npc, *other) && other->parent.get() == &npc) clacks.push_back(static_cast<Entity_NPC*>(other));
return clacks;
}
// 00572a70 The Clickety Clack of his farthest from him he may enter: not his pick, not burning, not untargetable.
static Entity_NPC* clutch_clack_farthest(Entity_NPC& npc)
{
Entity_NPC* farthest = nullptr;
float farthestDistance = 0;
for (Entity* other : entity_query(ENTITY_CLICKETY_CLACK, -1))
{
auto* clack = static_cast<Entity_NPC*>(other);
bool isPick = clutch_is_ally(npc, *clack) && clack->parent.get() == &npc && clack != npc.child.get() &&
clack->i2 != CLACK_FLAME && !clack->HasEntityFlags(FLAG_NO_TARGET);
float distance = vector_distance(npc.pos, clack->pos);
if (!isPick || distance <= farthestDistance) continue;
farthestDistance = distance;
farthest = clack;
}
return farthest;
}
// How his beam goes: left fading where his pick stands, or removed.
enum BeamRelease
{
BEAM_RELEASE_FADE,
BEAM_RELEASE_REMOVE
};
// 005729a0 Lets the beam to his pick go.
static void clutch_beam_release(Entity_NPC& npc, BeamRelease release)
{
Entity* beam = npc.entityRef.get();
if (!beam || beam->type != ENTITY_EFFECT) return;
if (release == BEAM_RELEASE_REMOVE) beam->Remove();
else
{
static_cast<Entity_Effect*>(beam)->SetTimeout(CLUTCH_BEAM_FADE);
beam->pos = npc.child->pos;
beam->posOffset = vector_make(0, CLUTCH_BEAM_RAISE);
beam->target = nullptr;
}
npc.entityRef = nullptr;
}
// His purple beam from a spawner to a Clickety Clack, under a parent.
Entity* clutch_beam_spawn(Entity& spawner, Entity& target, Entity* parent)
{
Entity* beam = g_game->Spawn({.position = target.pos,
.spawner = &spawner,
.type = ENTITY_EFFECT,
.variant = EFFECT_KINETI_BEAM,
.seed = Random()});
beam->SetColor(CLUTCH_BEAM_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
beam->target = &target;
beam->parent = parent;
beam->Update();
return beam;
}
// Clutch flies off to a Clickety Clack, his beam on it, stunning it.
static void clutch_beam_to(Entity_NPC& npc, Entity_NPC& clack)
{
npc_sound_play(SOUND_DEVILROOM_DEAL, 1, 2, CLUTCH_SOUND_PITCH);
clutch_beam_release(npc, BEAM_RELEASE_FADE);
npc.entityRef = clutch_beam_spawn(npc, clack, &npc);
}
// Where a Clickety Clack burnt for good goes: a purple poof of the movable fireplace.
static void clutch_fire_poof(Entity& at)
{
npc_sound_play(SOUND_STEAM_HALFSEC, CLUTCH_POOF_VOLUME, 2, 1);
Entity* poof = g_game->Spawn({.position = at.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
poof->sprite.Load(CLUTCH_POOF_ANM2, GRAPHICS_LOAD);
for (LayerState& layer : poof->sprite.layerStates) layer.color = CLUTCH_FLAME_COLOR;
poof->sprite.Play("Disappear");
poof->Update();
}
// 00572c10 A pile of bones gets up again at full health, from its Regen's 15th frame.
static void clutch_pile_regen(Entity_NPC& clack)
{
clack.health = clack.maxHitPoints;
clack.sprite.Play("Regen");
if (clack.sprite.animState.animData) clack.sprite.animState.SetFrameFloat(CLACK_REGEN_FRAME);
clack.state = CLACK_REGEN;
}
// 00572cc0 A Clickety Clack burns for good: killed as a purple fire, two fireballs circling Clutch.
static void clutch_fire_spawn(Entity_NPC& npc, Entity& clack)
{
clack.AddEntityFlags(FLAG_NO_TARGET);
clack.Kill(EntityRef(&npc));
Entity* fire = g_game->Spawn({.position = clack.pos,
.spawner = &npc,
.type = ENTITY_FIREPLACE,
.variant = FIRE_MOVEABLE_PURPLE,
.seed = Random()});
fire->sprite.Load(CLUTCH_FIRE_ANM2, GRAPHICS_LOAD);
fire->sprite.Play("Flickering");
for (LayerState& layer : fire->sprite.layerStates) layer.color = CLUTCH_FLAME_COLOR;
fire->Update();
for (int i = 0; i < CLUTCH_FIREBALLS; i++)
{
uint32_t seed = Random();
Vector position = vector_add(clack.pos, vector_scale(random_direction(), CLUTCH_FIREBALL_OUT));
auto* fireball = static_cast<Entity_NPC*>(g_game->Spawn(
{.position = position, .spawner = &npc, .type = ENTITY_CLUTCH, .variant = CLUTCH_FIREBALL, .seed = seed}));
fireball->parent = &npc;
fireball->v1.x = random_unit() * FULL_TURN_DEGREES;
}
}
// Clutch's roar on a stun's end or his last phase: shaking the room with a ripple.
static void clutch_roar(Entity_NPC& npc, float volume)
{
npc.PlaySound(SOUND_THUMBS_DOWN, 1, 2, false, 1);
npc.PlaySound(SOUND_MULTI_SCREAM, 1, 2, false, 1);
npc.PlaySound(SOUND_FORSAKEN_SCREAM, volume, 2, false, 1);
game_shake_screen(CLUTCH_SHAKE);
shockwave_make(npc.pos, CLUTCH_RIPPLE_AMPLITUDE, CLUTCH_RIPPLE_SPEED, CLUTCH_RIPPLE_FRAMES);
}
// Which Clickety Clacks the roar picks from: the piles, or any.
enum ClackPick
{
PICK_PILES,
PICK_ANY
};
// Every 8 frames after the roar one of his Clickety Clacks: a pile gets up, or one burns in his last phase.
static void clutch_roar_pick(Entity_NPC& npc, ClackPick pick, void (*picked)(Entity_NPC&, Entity_NPC&))
{
if (!npc.sprite.WasEventTriggered("Shoot") || !npc.GetIntervalTicks(CLUTCH_PILE_EVERY, 0)) return;
std::vector<Entity_NPC*> clacks;
for (Entity_NPC* clack : clutch_clacks_get(npc))
if (pick == PICK_ANY || clack->state == CLACK_PILE) clacks.push_back(clack);
if (!clacks.empty()) picked(npc, *clacks[random_below((int)clacks.size())]);
}
// The rest after the roar: every pile of his gets up (or burns), and he goes back to resting (or wandering).
static void clutch_roar_finish(Entity_NPC& npc, void (*finished)(Entity_NPC&, Entity_NPC&))
{
for (Entity_NPC* clack : clutch_clacks_get(npc))
if (clack->state == CLACK_PILE) finished(npc, *clack);
}
static void clack_regen_picked(Entity_NPC&, Entity_NPC& clack)
{
clutch_pile_regen(clack);
}
static void clack_burn_picked(Entity_NPC& npc, Entity_NPC& clack)
{
clutch_fire_spawn(npc, clack);
}
// Enters his last phase: a roar, out of any Clickety Clack, his beam gone.
static void clutch_transition_start(Entity_NPC& npc)
{
npc.sprite.Play("Transition");
npc.state = CLUTCH_TRANSITION;
clutch_beam_release(npc, BEAM_RELEASE_REMOVE);
}
// Resting: once rested (or after a quick revert) he flies to the Clickety Clack he left or the farthest, stunning it.
static void clutch_idle_update(Entity_NPC& npc, int ticks)
{
npc.sprite.Play("Idle");
npc.pathfinder.MoveRandomlyBoss(STATUS_OBEYED);
if (npc.stateFrame >= 0) npc.stateFrame += ticks;
npc.friction *= CLUTCH_FRICTION;
if (npc.stateFrame <= CLUTCH_REST && npc.stateFrame >= 0) return;
auto* clack = static_cast<Entity_NPC*>(npc.parent.get());
if (!clack || clack->type != ENTITY_CLICKETY_CLACK) clack = clutch_clack_farthest(npc);
if (!clack) clutch_transition_start(npc);
else
{
npc.state = CLUTCH_FLY;
Vector gap = vector_sub(clack->pos, npc.pos);
if (std::abs(gap.x) > std::abs(gap.y)) npc.sprite.Play("MoveStart");
else npc.sprite.Play(npc.pos.y <= clack->pos.y ? "MoveStartDown" : "MoveStartUp");
npc.child = clack;
if (npc.stateFrame < 0)
{
if (npc.sprite.animState.animData) npc.sprite.animState.SetFrameFloat(CLUTCH_MOVE_START_FRAME);
npc.entityCollisionClass = ENTCOLL_PLAYEROBJECTS;
npc.shadowSize = npc.config->shadowSize;
}
else clutch_beam_to(npc, *clack);
if (clack->state != CLACK_PILE)
{
clack->state = CLACK_STUNNED;
clack->sprite.Play("Stunned");
clack->targetPosition = {};
}
npc.sprite.isFlipX = npc.pos.x < clack->pos.x;
}
npc.stateFrame = npc.stateFrame < 0 ? CLUTCH_REVERT_REST : 0;
}
// Inside a Clickety Clack, riding it until it dies: then he takes the farthest other (or falls stunned with none),
// thrown away from his target.
static void clutch_possess_update(Entity_NPC& npc)
{
Entity* clack = npc.child.get();
npc.friction *= CLUTCH_FRICTION;
if (clack && !clack->isDead && !clack->HasEntityFlags(FLAG_NO_TARGET))
{
npc.velocity = vector_sub(clack->pos, npc.pos);
if (npc.sprite.IsEventTriggered("Sound")) npc_sound_play(SOUND_PORTAL_SPAWN, 1, 2, CLUTCH_SOUND_PITCH);
if (!npc.sprite.IsEventTriggered("Shoot")) return;
npc_sound_play(SOUND_BONE_HEART, 1, 2, CLUTCH_SOUND_PITCH);
npc.entityCollisionClass = ENTCOLL_NONE;
npc.shadowSize = 0;
Entity_NPC* host = npc.ChildNPC();
host->state = CLACK_STOMP;
host->sprite.Play("Transition");
if (host == npc.ParentNPC() && host->sprite.animState.animData)
host->sprite.animState.SetFrameFloat(CLUTCH_MOVE_START_FRAME);
return;
}
if (npc.entityCollisionClass != ENTCOLL_NONE)
{
npc.sprite.Play("Idle");
npc.state = CLUTCH_IDLE;
npc.stateFrame = CLUTCH_REST;
npc.entityCollisionClass = ENTCOLL_PLAYEROBJECTS;
npc.shadowSize = npc.config->shadowSize;
return;
}
Entity_NPC* next = clutch_clack_farthest(npc);
if (!next)
{
npc.sprite.Play("Stun");
npc.state = CLUTCH_STUNNED;
npc.stateFrame = 0;
npc.v1.x = CLUTCH_STUN_HEALTH;
}
else
{
npc.parent = next;
npc.state = CLUTCH_UNPOSSESS;
npc_sound_play(SOUND_DEVILROOM_DEAL, 1, 2, CLUTCH_SOUND_PITCH);
clutch_beam_release(npc, BEAM_RELEASE_REMOVE);
npc.entityRef = clutch_beam_spawn(npc, *next, &npc);
npc.sprite.Play("Unpossess");
}
npc.entityCollisionClass = ENTCOLL_PLAYEROBJECTS;
npc.shadowSize = npc.config->shadowSize;
Vector away = vector_normalized(vector_sub(npc.pos, npc.GetPlayerTarget()->pos));
npc.velocity = vector_add(npc.velocity, vector_scale(away, CLUTCH_THROW_SPEED));
}
// Stunned with none left: the burning piles go out first, then he takes hurt until he rises with a roar, waking them.
static void clutch_stunned_update(Entity_NPC& npc)
{
npc.friction *= CLUTCH_SLOW_FRICTION;
if (npc.stateFrame == 0)
{
npc.stateFrame = 1;
for (Entity_NPC* clack : clutch_clacks_get(npc))
{
if (clack->state != CLACK_PILE || clack->i2 != CLACK_FLAME) continue;
clack->i2 = 0;
clack->sprite.Play("Collapse");
if (clack->sprite.animState.animData) clack->sprite.animState.AdvancePosition(clack->sprite.animState.animData->length - 1);
clutch_fire_poof(*clack);
}
}
if (npc.v1.x > 0)
{
if (!npc.sprite.IsPlaying()) npc.sprite.Play("StunLoop");
npc.v1.x -= std::max(npc.speedMultiplier * CLUTCH_STUN_DRAIN, npc.pendingDamage);
return;
}
npc.sprite.Play("StunEnd");
npc.parent = nullptr;
npc.child = nullptr;
if (npc.sprite.IsEventTriggered("Shoot")) clutch_roar(npc, CLUTCH_ROAR_VOLUME);
clutch_roar_pick(npc, PICK_PILES, clack_regen_picked);
if (npc.sprite.IsPlaying()) return;
clutch_roar_finish(npc, clack_regen_picked);
npc.sprite.Play("Idle");
npc.state = CLUTCH_IDLE;
npc.stateFrame = 0;
}
// Flying to his pick, faster each frame. Whether he entered it.
static bool clutch_fly_update(Entity_NPC& npc, int ticks)
{
npc.friction *= CLUTCH_FRICTION;
Entity* clack = npc.child.get();
if (!clack)
{
npc.sprite.Play("Idle");
npc.state = CLUTCH_IDLE;
npc.stateFrame = CLUTCH_REST;
return false;
}
if (!npc.sprite.IsPlaying()) npc.sprite.Play("MoveLoop");
npc.stateFrame += ticks;
if (npc.sprite.IsEventTriggered("Shoot"))
{
npc_sound_play(SOUND_BEAST_GHOST_DASH, 1, 2, 1);
clutch_beam_release(npc, BEAM_RELEASE_FADE);
}
if (!npc.sprite.WasEventTriggered("Shoot") && !npc.sprite.animState.IsLoopingAnimation()) return false;
float maxSpeed = std::min((float)npc.stateFrame * CLUTCH_FLY_GAIN, CLUTCH_FLY_MAX);
npc.velocity = vector_sub(clack->pos, npc.pos);
float distance = vector_length(npc.velocity);
if (distance >= CLUTCH_REACH)
{
if (maxSpeed < distance && distance > 0) npc.velocity = vector_scale(npc.velocity, maxSpeed / distance);
return false;
}
npc.sprite.Play("Possess");
npc.state = CLUTCH_POSSESS;
npc.stateFrame = 0;
return true;
}
// His last phase: he wanders, flies at his target and rings it with fire. Hits do a tenth while he roars.
static void clutch_last_phase_update(Entity_NPC& npc, int ticks)
{
switch (npc.state)
{
case CLUTCH_WANDER:
npc.pathfinder.MoveRandomlyBoss(STATUS_OBEYED);
npc.stateFrame += ticks;
npc.friction *= CLUTCH_FRICTION;
if (npc.stateFrame > CLUTCH_WANDER_FRAMES)
{
Vector target = npc.GetPlayerTarget()->pos;
if (vector_is_zero(target)) break;
npc.state = CLUTCH_CHARGE;
npc.sprite.Play("MoveStart2");
npc.targetPosition = target;
npc.sprite.isFlipX = npc.pos.x < target.x;
npc.stateFrame = 0;
}
break;
case CLUTCH_CHARGE:
{
if (npc.sprite.IsFinished()) npc.sprite.Play("MoveLoop2");
npc.stateFrame += ticks;
if (!npc.sprite.WasEventTriggered("Shoot") && !npc.sprite.animState.IsLoopingAnimation()) break;
float maxSpeed = std::min((float)npc.stateFrame * CLUTCH_CHARGE_GAIN, CLUTCH_FLY_MAX);
npc.velocity = vector_scale(vector_sub(npc.targetPosition, npc.pos), HALF);
float distance = vector_length(npc.velocity);
if (distance < CLUTCH_REACH)
{
npc.sprite.Play("AttackStart");
npc.state = CLUTCH_RING;
npc.stateFrame = 0;
}
else if (maxSpeed < distance) npc.velocity = vector_resized(npc.velocity, maxSpeed);
break;
}
case CLUTCH_RING:
npc.friction *= CLUTCH_FRICTION;
if (npc.sprite.IsEventTriggered("Shoot"))
{
npc.PlaySound(SOUND_BEAST_FIRE_RING, CLUTCH_RING_VOLUME, 2, false, CLUTCH_SOUND_PITCH);
ProjectileParams params;
params.circleAngle = npc.stateFrame & 1 ? 0 : CLUTCH_RING_TURN;
params.variant = PROJECTILE_FIRE;
params.color = CLUTCH_FLAME_COLOR;
npc.FireProjectiles(npc.pos, vector_make(CLUTCH_RING_SPEED, CLUTCH_RING_SHOTS), PROJECTILES_RING, params);
npc.stateFrame++;
}
if (!npc.sprite.IsFinished()) break;
if (npc.stateFrame > CLUTCH_RINGS)
{
npc.sprite.Play("Idle2");
npc.state = CLUTCH_WANDER;
npc.stateFrame = 0;
}
else npc.sprite.Play("Attack", PLAY_FORCED);
break;
case CLUTCH_TRANSITION:
npc.friction *= CLUTCH_SLOW_FRICTION;
if (npc.sprite.IsEventTriggered("Shoot")) clutch_roar(npc, CLUTCH_LAST_ROAR_VOLUME);
clutch_roar_pick(npc, PICK_ANY, clack_burn_picked);
if (npc.sprite.IsPlaying())
{
npc.pendingDamage = 0;
for (DamageEvent& hit : npc.damageEvents)
{
hit.damage *= CLUTCH_LAST_DAMAGE_SHARE;
npc.pendingDamage += hit.damage;
}
break;
}
clutch_roar_finish(npc, clack_burn_picked);
npc.sprite.Play("Idle2");
npc.state = CLUTCH_WANDER;
npc.stateFrame = 0;
break;
}
}
// Numbers the Clickety Clacks he leads standing (his pick 0) for their places, keeping one more than their count.
static void clutch_clacks_count(Entity_NPC& npc)
{
int count = 1;
for (Entity* other : entity_query(ENTITY_CLICKETY_CLACK, -1))
{
auto* clack = static_cast<Entity_NPC*>(other);
if (!Entity::is_enemy_type(clack->type) || clack->parent.get() != &npc || clack->state == CLACK_PILE) continue;
clack->i2 = clack == npc.child.get() ? 0 : count++;
}
npc.i1 = count;
}
// Dying, he takes his Clickety Clacks, purple fires and fireballs with him. His shots fall.
static void clutch_death_update(Entity_NPC& npc)
{
for (Entity* other : entities_live(g_game->room->entityList.updateEL))
{
if (!clutch_is_ally(npc, *other))
{
if (other->type == ENTITY_PROJECTILE && other->parent.get() == &npc)
{
static_cast<Entity_Projectile*>(other)->projectileFlags = 0;
other->isDead = true;
}
continue;
}
if (other->type == ENTITY_CLICKETY_CLACK)
{
if (other->parent.get() != &npc) continue;
other->AddEntityFlags(FLAG_NO_TARGET);
other->Kill(EntityRef(&npc));
}
else if (other->type == ENTITY_FIREPLACE && other->variant == FIRE_MOVEABLE_PURPLE)
{
other->Kill(EntityRef(&npc));
clutch_fire_poof(*other);
}
else if (other->type == ENTITY_CLUTCH && other->variant == CLUTCH_FIREBALL && other->parent.get() == &npc)
other->Kill(EntityRef(&npc));
}
}
// Part of 00573030 Between frames the trail steps half and keeps its last whole step. After the update it steps whole,
// grows a flame and takes the Trail null's colour onto its two layers.
static void clutch_trail_update(Entity_NPC& npc)
{
bool isInterpolated = npc.aiCallPhase == AI_PHASE_INTERPOLATE;
if (isInterpolated) npc.vectorDeque2 = npc.vectorDeque1;
else npc.vectorDeque1 = npc.vectorDeque2;
bool isFlying = (npc.state == CLUTCH_FLY || npc.state == CLUTCH_CHARGE) &&
(npc.sprite.WasEventTriggered("Shoot") || npc.sprite.animState.IsLoopingAnimation());
Vector anchor = vector_add(npc.pos, npc.GetNullOffset("Trail"));
Vector drift = vector_make(0, TRAIL_DRIFT);
if (!isFlying) anchor.x += std::sin(npc.updateTime * PI_F / TRAIL_SWAY_PERIOD) * TRAIL_SWAY;
else
{
Vector side = vector_rotated(npc.velocity, RIGHT_ANGLE_DEGREES);
float swing = std::sin(npc.updateTime * PI_F * TRAIL_SWING_RATE);
anchor = vector_add(anchor, vector_scale(side, swing));
drift = vector_scale(side, TRAIL_SWING_SHARE * swing);
}
const NullFrame* null = npc.sprite.animState.animData ? npc.sprite.animState.GetNullFrame("Trail") : nullptr;
std::deque<Vector>& trail = npc.vectorDeque1;
float step = (isInterpolated ? TRAIL_INTERPOLATED_STEP : 1) * npc.speedMultiplier;
for (size_t i = 0; i < trail.size();)
{
Vector& position = trail[i];
Vector& velocity = trail[i + 1];
Vector& size = trail[i + 2];
position = vector_add(position, vector_scale(velocity, step));
velocity = vector_scale(velocity, timescale_factor(size.x * TRAIL_SIZE_DRAG + TRAIL_DRAG, step));
Vector shake = random_direction();
float strength = size.x * random_unit() * TRAIL_SHAKE * step;
velocity = vector_add(velocity, vector_scale(shake, strength));
size.x = std::max(size.x - step * CLUTCH_TRAIL_SHRINK, 0.0f);
float distance = vector_distance(anchor, position);
if (distance > TRAIL_REACH)
{
float kept = timescale_factor(TRAIL_PULL, step) * (distance - TRAIL_REACH) + TRAIL_REACH;
position = vector_add(anchor, vector_scale(vector_sub(position, anchor), kept / distance));
}
if (size.x > 0 || isInterpolated) i += TRAIL_POINT;
else trail.erase(trail.begin() + (long)i, trail.begin() + (long)(i + TRAIL_POINT));
}
bool isSpaced = trail.empty() || vector_length_squared(vector_sub(anchor, trail.front())) > TRAIL_SPACING_SQUARED;
if (!isInterpolated && isSpaced)
{
float scale = null ? null->scale.x : 1;
trail.push_front(vector_make((random_unit() * TRAIL_SIZE_RANGE + CLUTCH_TRAIL_SIZE) * scale, 0));
trail.push_front(drift);
trail.push_front(anchor);
}
ColorMod color = null && null->isVisible ? null->color : TRAIL_HIDDEN_COLOR;
npc.sprite.GetLayer(TRAIL_LAST_LAYER)->color = color;
npc.sprite.GetLayer(TRAIL_FIRST_LAYER)->color = color;
}
// 00573030 Clutch rides his Clickety Clacks one by one, leaving each dead one to stomp its bones and wake again, and
// falls stunned once none is left. Below a quarter of his health he burns them all and flies at his target, ringing
// it with fire.
void boss_clutch_update(Entity_NPC& npc)
{
if (npc.aiCallPhase == AI_PHASE_POST_UPDATE || npc.aiCallPhase == AI_PHASE_INTERPOLATE) return clutch_trail_update(npc);
int ticks = npc_ticks_get(npc);
bool isCounted = npc.GetIntervalTicks(CLUTCH_COUNT_EVERY, 0);
bool isLastPhaseDue = npc.state == CLUTCH_IDLE || npc.state == CLUTCH_FLY ||
(npc.state == CLUTCH_STUNNED && !npc.sprite.WasEventTriggered("Shoot"));
if (isLastPhaseDue && npc.health <= npc.maxHitPoints * CLUTCH_LAST_PHASE)
{
clutch_transition_start(npc);
npc.entityCollisionClass = ENTCOLL_PLAYEROBJECTS;
npc.shadowSize = npc.config->shadowSize;
}
switch (npc.state)
{
case NPC_STATE_INIT:
{
npc.splatColor = CLUTCH_SPLAT_COLOR;
npc.state = CLUTCH_IDLE;
npc.aiCallFlags = CLUTCH_AI_CALLS;
npc.sprite.PlayOverlay("Trail");
npc.sprite.GetLayer(TRAIL_FIRST_LAYER)->isVisible = false;
npc.sprite.GetLayer(TRAIL_LAST_LAYER)->isVisible = false;
npc.entityCollisionClass = ENTCOLL_PLAYEROBJECTS;
npc.entityGridCollisionClass = GRIDCOLL_WALLS;
int count = 1;
for (Entity* other : Entity_NPC::QueryNPCsType(ENTITY_CLICKETY_CLACK, -1))
{
if (!clutch_is_ally(npc, *other) || other->parent) continue;
auto* clack = static_cast<Entity_NPC*>(other);
clack->parent = &npc;
clack->maxHitPoints *= CLACK_HEALTH_SHARE;
clack->i2 = count++;
clack->health = clack->maxHitPoints;
}
npc.i1 = count;
break;
}
case CLUTCH_IDLE:
clutch_idle_update(npc, ticks);
break;
case CLUTCH_POSSESS:
clutch_possess_update(npc);
break;
case CLUTCH_STUNNED:
clutch_stunned_update(npc);
break;
case CLUTCH_FLY:
if (clutch_fly_update(npc, ticks)) isCounted = true;
break;
case CLUTCH_UNPOSSESS:
npc.friction *= CLUTCH_SLOW_FRICTION;
if (npc.sprite.IsPlaying()) break;
npc.state = CLUTCH_IDLE;
npc.stateFrame = CLUTCH_REVERT_WAIT;
break;
default:
clutch_last_phase_update(npc, ticks);
break;
}
if (isCounted) clutch_clacks_count(npc);
if (npc.isDead) clutch_death_update(npc);
}
// 00575a10 Clutch draws his trail of flames segment by segment on his two trail layers, each between two flames,
// turned along them and showing their size, then himself. The fireballs draw plainly.
void clutch_render(Entity_NPC& npc, const Vector& offset)
{
std::deque<Vector>& trail = npc.vectorDeque1;
if (npc.variant != 0 || npc.sprite.GetLayer(TRAIL_FIRST_LAYER)->color._tint[3] <= 0 || trail.empty())
return npc.Entity::Render(offset);
npc.sprite.GetLayer(TRAIL_FIRST_LAYER)->isVisible = true;
npc.sprite.GetLayer(TRAIL_LAST_LAYER)->isVisible = true;
for (int layerId = TRAIL_FIRST_LAYER; layerId <= TRAIL_LAST_LAYER; layerId++)
for (size_t i = 0; i + TRAIL_POINT < trail.size(); i += TRAIL_POINT)
{
Vector from = trail[i];
Vector to = trail[i + TRAIL_POINT];
Vector middle = render_position_get(vector_scale(vector_add(from, to), HALF), RENDER_SNAPPED);
float size = (trail[i + TRAIL_POINT + 2].x + trail[i + 2].x) * HALF;
int frame = (int)((float)TRAIL_FRAMES - size * TRAIL_FRAMES);
if (frame >= TRAIL_FRAMES) continue;
float stretch = 1;
if (frame != TRAIL_FRAMES - 1)
stretch = std::clamp(vector_distance(from, to) * HALF / (float)(TRAIL_FRAMES - frame), 1.0f, TRAIL_STRETCH_MAX);
LayerState& layer = *npc.sprite.GetLayer(layerId);
layer.size = vector_make(stretch, 1);
Vector gap = vector_sub(to, from);
layer.rotation = std::atan2(gap.y, gap.x) * RADIANS_TO_DEGREES * (npc.sprite.isFlipX ? -1.0f : 1.0f);
if (npc.sprite.overlayAnimState.animData) npc.sprite.overlayAnimState.SetFrameFloat((float)frame);
npc.sprite.RenderLayer(layerId, SpriteDraw{vector_add(middle, offset), {}, {}});
}
npc.sprite.GetLayer(TRAIL_FIRST_LAYER)->isVisible = false;
npc.sprite.GetLayer(TRAIL_LAST_LAYER)->isVisible = false;
npc.Entity::Render(offset);
}
+3 -5
View File
@@ -39,8 +39,6 @@ constexpr int VARIANT_MOTHER_PHASE_TWO = 10;
constexpr int BIG_HORN_SMALL_HOLE = 1;
constexpr int BIG_HORN_BIG_HOLE = 2;
constexpr int ENVY_SIZES = 10;
constexpr int ROTGUT_BOSS_ROOM_SUBTYPE = 3;
constexpr int DUNGEON_BOSS_SUBTYPE_FIRST = 2;
constexpr int MINIBOSS_PRIDE = 6;
constexpr int MINIBOSS_ULTRA_PRIDE = 14;
constexpr int MINIBOSS_ID_LIMIT = 16;
@@ -425,11 +423,11 @@ static void boss_death_rewards(Room& room, Entity_NPC& boss, RNG& rng, bool isGr
Game& game = *g_game;
RoomType roomType = room.roomType;
RoomDescriptor* descriptor = room.descriptor;
bool isDungeonBoss = roomType == ROOM_DUNGEON && descriptor->data->subtype >= DUNGEON_BOSS_SUBTYPE_FIRST &&
descriptor->data->subtype <= ROTGUT_BOSS_ROOM_SUBTYPE;
bool isDungeonBoss = roomType == ROOM_DUNGEON && descriptor->data->subtype >= DUNGEON_ROTGUT &&
descriptor->data->subtype <= DUNGEON_ROTGUT_HEART;
if (isDungeonBoss)
{
if (boss.type != ENTITY_ROTGUT || descriptor->data->subtype != ROTGUT_BOSS_ROOM_SUBTYPE) return;
if (boss.type != ENTITY_ROTGUT || descriptor->data->subtype != DUNGEON_ROTGUT_HEART) return;
RoomDescriptor* returnRoom = game.GetRoomByIdx(game.dungeonReturnRoomIndex, -1);
if (returnRoom->data && returnRoom->data->type == ROOM_BOSS)
returnRoom->flags |= ROOM_DESCRIPTOR_FLAG_ROTGUT_CLEARED;
-2
View File
@@ -1099,8 +1099,6 @@ constexpr int DOGMA_ANGEL_GLITCH_FRAMES = 3;
constexpr std::array<std::string_view, 4> DOGMA_ANGEL_GLITCHES = {"Glitch0", "Glitch1", "Glitch2", "Glitch3"};
// Its death: the boss overlay, the music's second layer, then the controls off and the jingle while the sounds hush.
constexpr int BOSS_OVERLAY_DOGMA_DYING = 2;
constexpr int BOSS_OVERLAY_DOGMA_DEAD = 3;
constexpr int DOGMA_MUSIC_DEATH_LAYER = 1;
constexpr float DOGMA_JINGLE_FADE = 0.5f;
constexpr float DOGMA_DEATH_HUSH = -10;
+2 -3
View File
@@ -26,7 +26,6 @@ constexpr float BABY_SPAWN_OFFSET_Y = -8;
constexpr float TWIN_FRICTION = 0.8f;
constexpr float NO_CORD_FRICTION = 0.92f;
constexpr int CREEP_FRAMES = 7;
constexpr float WALK_THRESHOLD = 0.1f;
constexpr float SPEED = 1.4f;
constexpr float OVUM_SPEED = 1.6f;
constexpr float PATH_SPEED_SCALE = 0.83f;
@@ -188,7 +187,7 @@ static void twin_state_update(Entity_NPC& npc)
return twin_head_idle(npc);
case NPC_STATE_MOVE:
{
npc.AnimWalkFrame("WalkHori", "WalkVert", WALK_THRESHOLD);
npc.AnimWalkFrame("WalkHori", "WalkVert", MOVEMENT_DEADZONE);
npc.aiFloat = npc.variant == GEMINI_BLIGHTED_OVUM ? OVUM_SPEED : SPEED;
twin_walk(npc, npc.aiFloat);
twin_head_idle(npc);
@@ -205,7 +204,7 @@ static void twin_state_update(Entity_NPC& npc)
case NPC_STATE_ATTACK:
npc.aiFloat = (npc.aiFloat + RAGE_ACCELERATION) * RAGE_DAMPING;
twin_walk(npc, npc.variant == GEMINI_BLIGHTED_OVUM ? npc.aiFloat + OVUM_RAGE_BONUS : npc.aiFloat);
npc.AnimWalkFrame("WalkHori", "WalkVert", WALK_THRESHOLD);
npc.AnimWalkFrame("WalkHori", "WalkVert", MOVEMENT_DEADZONE);
npc.sprite.PlayOverlay("RageBody");
if (++npc.stateFrame <= RAGE_FRAMES) return;
+1 -2
View File
@@ -136,7 +136,6 @@ constexpr float CELL_SIZE = 40;
constexpr float CELL_ORIGIN_X = 40;
constexpr float CELL_ORIGIN_Y = 120;
constexpr RNG CRAWLSPACE_RNG_SHIFTS = {0, 1, 27, 27};
constexpr int CRAWLSPACE_GIDEON = 1;
static int cooldown_get(const Entity_NPC& npc, int shift)
{
@@ -694,7 +693,7 @@ static void gideon_stairs_spawn(Entity_NPC& npc)
RNG rng = CRAWLSPACE_RNG_SHIFTS;
rng._seed = game.devilAngelRoomRNG._seed;
crawlspace->InitSeeds(rng);
RoomQuery query = {.stageId = STAGE_ID_SPECIAL_ROOMS, .subtype = CRAWLSPACE_GIDEON, .type = ROOM_DUNGEON};
RoomQuery query = {.stageId = STAGE_ID_SPECIAL_ROOMS, .subtype = DUNGEON_GIDEON, .type = ROOM_DUNGEON};
crawlspace->data = game.roomConfig.GetRandomRoom(rng.Next(), WEIGHT_KEEP, query);
}
game.room->SpawnGridEntity(npc.projectileDelay, GRID_STAIRS, STAIRS_GIDEON, Random(), 0);
+456
View File
@@ -0,0 +1,456 @@
#include "boss_ai.h"
#include "boss_repentance.h"
#include "fx_layers.h"
#include "level.h"
#include "npc_basement.h"
#include "room_grid.h"
#include <algorithm>
#include <utility>
// Lil Blub's states: resting, throwing small leeches, throwing a big one, spraying a ring of shots, and its jumps.
enum LilBlubState
{
BLUB_REST = NPC_STATE_IDLE,
BLUB_LEECHES = NPC_STATE_ATTACK,
BLUB_BIG_LEECH = NPC_STATE_ATTACK2,
BLUB_SPRAY = NPC_STATE_ATTACK3,
BLUB_JUMPS = NPC_STATE_ATTACK4
};
// Resting it throws leeches one time in 40 (six of its leeches at most out), a big one one time in 70 (40 when hurt
// to below 30 percent, with no big one free), sprays one time in 45 (with three of its leeches out), or jumps one time
// in 110 (with three of its leeches out, one time in ten and two to four more jumps when hurt).
constexpr uint32_t LEECHES_ODDS = 40;
constexpr int LEECHES_LIMIT = 6;
constexpr uint32_t BIG_LEECH_ODDS = 70;
constexpr uint32_t BIG_LEECH_HURT_ODDS = 40;
constexpr uint32_t SPRAY_ODDS = 45;
constexpr int SPRAY_LEECHES = 2;
constexpr uint32_t JUMPS_ODDS = 110;
constexpr uint32_t JUMPS_HURT_ODDS = 10;
constexpr int JUMPS_LEECHES = 3;
constexpr uint32_t JUMPS_HURT_RANGE = 3;
constexpr int JUMPS_HURT_EXTRA = 2;
constexpr float BLUB_HURT_HEALTH = 0.3f;
// Leeches: one to three small ones (twice as tough) 30 out and 30 below, or a big one at its target within 90, thrown
// from 30 up, each in a splash 40 up thrown 5 down.
constexpr uint32_t LEECHES_RANGE = 3;
constexpr float LEECH_OUT = 30;
constexpr float LEECH_DROP = 30;
constexpr float LEECH_HEIGHT = -30;
constexpr float LEECH_MARGIN = 5;
constexpr float BIG_LEECH_REACH = 90;
constexpr int SPLASH_SUBTYPE = 1;
constexpr float BLUB_SPLASH_FALL = 5;
constexpr float SPLASH_RAISE = -40;
constexpr int BLUB_SPLASH_DEPTH = 500;
// The spray: on every other frame up to 12 a ring of six shots from a random turn, each jittered 6 degrees, 30 out
// at 8 to 10, falling slightly, with a splash 40 out every fourth frame. It pushes its leeches away at 8.
constexpr int BLUB_SPRAY_SHOTS = 6;
constexpr float SPRAY_STEP = 60;
constexpr float BLUB_SPRAY_JITTER = 12;
constexpr float BLUB_SPRAY_JITTER_HALF = 6;
constexpr int BLUB_SPRAY_END = 12;
constexpr float BLUB_SPRAY_HEIGHT = -10;
constexpr float BLUB_SPRAY_FALL_RANGE = 0.049999997f;
constexpr float BLUB_SPRAY_FALL = -0.08f;
constexpr float BLUB_SPRAY_SCALE_RANGE = 0.6f;
constexpr float BLUB_SPRAY_SCALE = 0.9f;
constexpr float BLUB_SPRAY_SPEED = 10;
constexpr float SPRAY_SPEED_RANGE = 0.19999999f;
constexpr float SPRAY_SPEED_SHARE = 0.8f;
constexpr float BLUB_SPRAY_SCATTER = 3;
constexpr float SPRAY_OUT = 30;
constexpr int SPRAY_SPLASH_EVERY = 4;
constexpr float SPRAY_SPLASH_OUT = 40;
constexpr float SPRAY_SPLASH_SPEED = 7;
constexpr float SPRAY_SPLASH_RAISE = -28;
constexpr float BLUB_SPRAY_PUSH = 8;
// The jumps: at its target a twenty-fifth of a second ahead per unit, 240 at most (160 when hurt), a sixteenth of the
// way a frame, landing with 35 hurt to enemies within 60 and, when hurt, a plus of shots at 10 and a cross at 4 (else
// 8 frames of fountain shots). Its next jump starts from frame 19.
constexpr float JUMP_LEAD = 0.04f;
constexpr float BLUB_JUMP_MARGIN = 20;
constexpr float BLUB_JUMP_REACH = 240;
constexpr float JUMP_HURT_REACH = 160;
constexpr float BLUB_JUMP_STEP = 0.0625f;
constexpr float BLUB_JUMP_PUSH = 1;
constexpr int JUMP_FOUNTAIN_FRAMES = 8;
constexpr float JUMP_PLUS_SPEED = 10;
constexpr float JUMP_CROSS_SPEED = 4;
constexpr float JUMP_CRUSH_REACH = 60;
constexpr float JUMP_CRUSH_DAMAGE = 35;
constexpr int JUMP_CRUSH_COUNTDOWN = 30;
constexpr int BLUB_JUMP_SHAKE = 8;
constexpr float JUMP_LOOP_FRAME = 19;
constexpr float JUMP_LANDED_FRICTION = 0.2f;
constexpr float BLUB_JUMP_FRICTION = 0.9f;
// It floats 40 below the room's top, bouncing off the edges, drifting at 0.5 diagonally (fleeing within 180 when
// afraid). Its small champion slows more.
constexpr float BLUB_TOP_MARGIN = 40;
constexpr float BLUB_FRICTION = 0.8f;
constexpr float BLUB_DRIFT = 0.5f;
constexpr float BLUB_DRIFT_TURN = 0.1f;
constexpr float BLUB_FLEE_REACH = 180;
constexpr float BLUB_FLEE_SHARE = 0.02f;
constexpr int BLUB_SLOW_SUBTYPE = 2;
constexpr float BLUB_SLOW_FRICTION = 0.9f;
// Dying it bursts in a big splash, its leeches pushed away at 4, two to four more thrown within 60, and a fountain of
// shots 15 frames running.
constexpr float DEATH_SPLASH_SCALE = 1.5f;
constexpr float DEATH_PUSH = 4;
constexpr uint32_t DEATH_TIMER_TIMES = 15;
constexpr uint32_t DEATH_LEECHES_RANGE = 3;
constexpr uint32_t DEATH_LEECHES = 2;
constexpr float DEATH_LEECH_REACH = 60;
constexpr float LEECH_HEALTH_SHARE = 0.5f;
// The fountain: two shots at up to 4 from up to 15 high, and two at up to 2.5 from up to 1000 high, within 15.
constexpr int FOUNTAIN_SHOTS = 2;
constexpr float FOUNTAIN_SPEED = 4;
constexpr float FOUNTAIN_HIGH_SPEED = 2.5f;
constexpr float FOUNTAIN_SPREAD = 15;
constexpr float FOUNTAIN_ACCEL = 2;
constexpr float FOUNTAIN_SCALE = 1.4f;
constexpr float FOUNTAIN_FALL = -15;
constexpr float FOUNTAIN_FALL_RANGE = 60;
constexpr float FOUNTAIN_HEIGHT = -15;
constexpr float FOUNTAIN_HIGH_HEIGHT = -1000;
// Whether the floor is the Dross, whose water is sewage: brown splashes and puke shots instead of tears.
static bool blub_is_sewage()
{
return g_game->GetStageID() == STAGE_ID_DROSS;
}
static int blub_shot_variant()
{
return blub_is_sewage() ? PROJECTILE_PUKE : PROJECTILE_TEAR;
}
// A splash of its water spinning at a random angle, raised.
static void blub_splash_spawn(const Vector& position, const Vector& velocity, float raise)
{
Entity* splash = g_game->Spawn({.position = position,
.velocity = velocity,
.subType = SPLASH_SUBTYPE,
.type = ENTITY_EFFECT,
.variant = EFFECT_BLOOD_EXPLOSION,
.seed = Random()});
splash->sprite.rotation = random_unit() * FULL_TURN_DEGREES;
splash->sprite.Play("Poof");
splash->posOffset = vector_make(0, raise);
splash->renderZOffset = BLUB_SPLASH_DEPTH;
splash->sprite.color = blub_is_sewage() ? SEWAGE_SPLASH_COLOR : WATER_SPLASH_COLOR;
}
// A leech thrown up out of it toward a spot kept in the room.
static Entity_NPC* blub_leech_throw(Entity_NPC& npc, Vector target, bool isBig)
{
Vector landing = g_game->room->GetClampedPositionImpl(target, LEECH_MARGIN, LEECH_MARGIN, LEECH_MARGIN, LEECH_MARGIN);
return leech_throw({.position = npc.pos, .target = landing, .spawner = &npc, .height = LEECH_HEIGHT, .isBig = isBig});
}
// 004508c0 The fountain its death leaves: four shots of its water raining about the timer.
static void blub_fountain_timer(Entity_Effect* timer)
{
Vector origin = timer->pos;
for (auto [speed, height] : {std::pair{FOUNTAIN_SPEED, FOUNTAIN_HEIGHT}, std::pair{FOUNTAIN_HIGH_SPEED, FOUNTAIN_HIGH_HEIGHT}})
for (int i = 0; i < FOUNTAIN_SHOTS; i++)
{
Vector direction = random_direction();
uint32_t seed = Random();
Vector velocity = vector_scale(direction, random_unit() * speed);
Vector position = vector_add(origin, vector_scale(direction, FOUNTAIN_SPREAD * random_unit()));
auto* shot = static_cast<Entity_Projectile*>(g_game->Spawn({.position = position,
.velocity = velocity,
.type = ENTITY_PROJECTILE,
.variant = blub_shot_variant(),
.seed = seed}));
shot->spawnerType = ENTITY_LIL_BLUB;
shot->fallingAccel = FOUNTAIN_ACCEL;
shot->scale = random_unit() * FOUNTAIN_SCALE;
shot->fallingSpeed = FOUNTAIN_FALL - random_unit() * FOUNTAIN_FALL_RANGE;
shot->height = random_unit() * height;
shot->Update();
}
}
// Its leeches out: all of the room's, its own, and the big ones run free.
struct BlubLeeches
{
int all = 0;
int bigFree = 0;
int own = 0;
};
static BlubLeeches blub_leeches_count(Entity_NPC& npc)
{
BlubLeeches count;
for (Entity* leech : g_game->room->entityList.updateEL)
{
if (leech->type != ENTITY_SMALL_LEECH || leech->spawnerType != ENTITY_LIL_BLUB) continue;
count.all++;
if (leech->parent.get() == &npc) count.own++;
if (!leech->parent && leech->subtype == 1) count.bigFree++;
}
return count;
}
// Resting, it picks its next attack.
static void blub_rest_update(Entity_NPC& npc, const BlubLeeches& leeches, bool isHurt)
{
npc.sprite.Play("Idle");
npc.projectileDelay = 0;
if (Random() % LEECHES_ODDS == 0 && leeches.all < LEECHES_LIMIT) npc.state = BLUB_LEECHES;
else if ((Random() % BIG_LEECH_ODDS == 0 || (isHurt && Random() % BIG_LEECH_HURT_ODDS == 0)) && leeches.bigFree < 1)
npc.state = BLUB_BIG_LEECH;
else if (Random() % SPRAY_ODDS == 0 && leeches.own > SPRAY_LEECHES) npc.state = BLUB_SPRAY;
else
{
uint32_t roll = Random();
bool isJumping = isHurt ? roll % JUMPS_HURT_ODDS == 0 : roll % JUMPS_ODDS == 0 && leeches.own >= JUMPS_LEECHES;
if (!isJumping) return;
npc.state = BLUB_JUMPS;
npc.projectileDelay = 1;
if (isHurt) npc.projectileDelay += (int)(Random() % JUMPS_HURT_RANGE) + JUMPS_HURT_EXTRA;
}
}
// Throws one to three small leeches of its own (twice as tough) about it.
static void blub_leeches_throw(Entity_NPC& npc)
{
for (uint32_t i = Random() % LEECHES_RANGE + 1; i != 0; i--)
{
Vector spot = vector_add(npc.pos, vector_scale(random_direction(), LEECH_OUT));
Entity_NPC* leech = blub_leech_throw(npc, vector_make(spot.x + 0, spot.y + LEECH_DROP), false);
leech->spawnerType = npc.type;
leech->spawnerVariant = (uint32_t)npc.variant;
leech->maxHitPoints *= 2;
leech->health = leech->maxHitPoints;
leech->parent = &npc;
}
blub_splash_spawn(npc.pos, vector_make(npc.velocity.x + 0, npc.velocity.y + BLUB_SPLASH_FALL), SPLASH_RAISE);
npc_sound_play(SOUND_MONSTER_GRUNT_2, 1, 2, champion_pitch_get(npc));
}
// Throws a big leech at its target within 90.
static void blub_big_leech_throw(Entity_NPC& npc)
{
Vector gap = vector_sub(npc.GetPlayerTarget()->pos, npc.pos);
float distance = vector_length(gap);
if (distance > BIG_LEECH_REACH) gap = vector_scale(gap, BIG_LEECH_REACH / distance);
Entity_NPC* leech = blub_leech_throw(npc, vector_add(npc.pos, gap), true);
leech->spawnerType = npc.type;
leech->spawnerVariant = (uint32_t)npc.variant;
blub_splash_spawn(npc.pos, vector_make(npc.velocity.x + 0, npc.velocity.y + BLUB_SPLASH_FALL), SPLASH_RAISE);
npc.PlaySound(SOUND_MONSTER_GRUNT_1, 1, 2, false, 1);
}
// The spray: a ring of six shots each other frame, its leeches pushed off.
static void blub_spray_update(Entity_NPC& npc, float& leechPush)
{
if (npc.sprite.IsEventTriggered("Shoot"))
{
npc.PlaySound(SOUND_MONSTER_GRUNT_4, 1, 2, false, 1);
leechPush = BLUB_SPRAY_PUSH;
npc.v1.x = random_unit() * FULL_TURN_DEGREES;
}
if (!npc.sprite.WasEventTriggered("Shoot")) return;
int step = npc.projectileDelay;
if (step % 2 == 0 && step < BLUB_SPRAY_END)
for (int i = 0; i < BLUB_SPRAY_SHOTS; i++)
{
Vector ring = vector_from_angle((float)i * SPRAY_STEP + npc.v1.x);
Vector direction = vector_rotated(ring, random_unit() * BLUB_SPRAY_JITTER - BLUB_SPRAY_JITTER_HALF);
float roll = random_unit();
ProjectileParams params;
params.heightModifier = BLUB_SPRAY_HEIGHT;
params.variant = blub_shot_variant();
params.fallingAccelModifier = roll * BLUB_SPRAY_FALL_RANGE + BLUB_SPRAY_FALL;
params.scale = roll * BLUB_SPRAY_SCALE_RANGE + BLUB_SPRAY_SCALE;
Vector velocity = vector_scale(direction, BLUB_SPRAY_SPEED * (roll * SPRAY_SPEED_RANGE + SPRAY_SPEED_SHARE));
Vector scatter = vector_scale(random_direction(), BLUB_SPRAY_SCATTER);
Vector position = vector_add(vector_add(scatter, vector_scale(direction, SPRAY_OUT)), npc.pos);
npc.FireProjectiles(position, velocity, PROJECTILES_SINGLE, params);
if (npc.projectileDelay % SPRAY_SPLASH_EVERY != 0) continue;
blub_splash_spawn(vector_add(npc.pos, vector_scale(direction, SPRAY_SPLASH_OUT)),
vector_scale(direction, SPRAY_SPLASH_SPEED), SPRAY_SPLASH_RAISE);
}
npc.projectileDelay = step + 1;
}
// The jumps: a leap at its target, landing with a crush, its leeches pushed off. Whether it keeps on.
static bool blub_jumps_update(Entity_NPC& npc, float& leechPush, bool isHurt)
{
if (npc.sprite.IsEventTriggered("Jump"))
{
npc.PlaySound(SOUND_FAT_WIGGLE, 1, 2, false, 1);
npc.PlaySound(SOUND_BOSS2_DIVE, 1, 2, false, 1);
g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_BIG_SPLASH, .seed = Random()})->Update();
Entity* target = npc.GetPlayerTarget();
float distance = vector_distance(npc.pos, target->pos);
Vector lead = vector_add(target->pos, vector_scale(target->velocity, JUMP_LEAD * distance));
Vector landing = g_game->room->GetClampedPositionImpl(lead, BLUB_JUMP_MARGIN, 0, 0, 0);
Vector gap = vector_sub(landing, npc.pos);
float reach = isHurt ? JUMP_HURT_REACH : BLUB_JUMP_REACH;
float length = vector_length(gap);
if (reach < length && length > 0) gap = vector_scale(gap, reach / length);
leechPush = BLUB_JUMP_PUSH;
npc.targetPosition = vector_add(gap, npc.pos);
npc.v2 = vector_scale(vector_sub(npc.targetPosition, npc.pos), BLUB_JUMP_STEP);
npc.entityCollisionClass = ENTCOLL_NONE;
}
if (npc.sprite.IsEventTriggered("Land"))
{
npc.PlaySound(SOUND_FAT_WIGGLE, 1, 2, false, 1);
npc.PlaySound(SOUND_FORESTBOSS_STOMPS, 1, 2, false, 1);
g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_BIG_SPLASH, .seed = Random()})->Update();
npc.targetPosition = {};
npc.entityCollisionClass = ENTCOLL_ALL;
if (!isHurt) npc.stateFrame = JUMP_FOUNTAIN_FRAMES;
else
{
ProjectileParams params;
params.variant = blub_shot_variant();
npc.FireProjectiles(npc.pos, vector_make(JUMP_PLUS_SPEED, 0), PROJECTILES_PLUS, params);
npc.FireProjectiles(npc.pos, vector_make(JUMP_CROSS_SPEED, 0), PROJECTILES_CROSS, params);
}
for (Entity* other : entity_query_radius(npc.pos, JUMP_CRUSH_REACH, QUERY_ENEMIES))
if (other->IsVulnerableEnemy(nullptr)) other->TakeDamage(JUMP_CRUSH_DAMAGE, DAMAGE_EXPLOSION, EntityRef(&npc), JUMP_CRUSH_COUNTDOWN);
game_shake_screen(BLUB_JUMP_SHAKE);
npc.projectileDelay--;
}
if (vector_is_zero(npc.targetPosition)) npc.friction *= JUMP_LANDED_FRICTION;
else
{
npc.friction *= BLUB_JUMP_FRICTION;
npc.velocity = vector_scale(npc.v2, 1 / npc.friction);
}
if (npc.stateFrame > 0)
{
npc.stateFrame--;
ProjectileParams params;
params.variant = blub_shot_variant();
npc.FireBossProjectiles((int)(Random() & 1) + 1, {}, 0, params);
}
if (npc.projectileDelay >= 1 && npc.sprite.IsEventTriggered("Shoot")) npc.sprite.animState.SetFrameFloat(JUMP_LOOP_FRAME);
return npc.sprite.IsPlaying();
}
// It floats in the room, bouncing off its edges, drifting diagonally (or wandering confused).
static void blub_float_update(Entity_NPC& npc)
{
Room& room = *g_game->room;
npc.pos = room.GetClampedPositionImpl(npc.pos, BLUB_TOP_MARGIN, 0, 0, 0);
if (npc.pos.x == room.bottomRightPos.x) npc.velocity.x = -1;
if (npc.pos.x == room.topLeftPos.x) npc.velocity.x = 1;
if (npc.pos.y == room.bottomRightPos.y) npc.velocity.y = -1;
if (npc.pos.y == room.topLeftPos.y + BLUB_TOP_MARGIN) npc.velocity.y = 1;
bool isSlow = npc.variant == 0 && npc.subtype == BLUB_SLOW_SUBTYPE;
if (npc.HasEntityFlags(FLAG_CONFUSION) && !npc.HasEntityFlags(FLAG_CHARM))
{
npc.friction *= BLUB_FRICTION;
if (isSlow) npc.friction *= BLUB_SLOW_FRICTION;
npc.pathfinder.MoveRandomly(STATUS_OBEYED);
return;
}
Vector drift = vector_make(npc.velocity.x > 0 ? 1.0f : -1.0f, npc.velocity.y < BLUB_DRIFT_TURN ? -1.0f : 1.0f);
npc.friction *= BLUB_FRICTION;
npc_push(npc, vector_scale(drift, BLUB_DRIFT));
if (isSlow) npc.friction *= BLUB_SLOW_FRICTION;
if (!npc.HasEntityFlags(FLAG_FEAR | FLAG_SHRINK)) return;
Vector away = vector_sub(npc.pos, npc.GetPlayerTarget()->pos);
float distance = vector_length(away);
if (distance > 0) away = vector_scale(away, std::clamp((BLUB_FLEE_REACH - distance) * BLUB_FLEE_SHARE, 0.0f, 1.0f) / distance);
npc_push(npc, away);
}
// Dying: a big splash, a fountain of shots, and two to four more leeches.
static void blub_burst(Entity_NPC& npc)
{
Entity* splash = g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_BIG_SPLASH, .seed = Random()});
splash->sprite.scale = vector_make(DEATH_SPLASH_SCALE, DEATH_SPLASH_SCALE);
splash->Update();
Entity_Effect* timer = Entity_Effect::CreateTimer(reinterpret_cast<void*>(&blub_fountain_timer), 1, DEATH_TIMER_TIMES, false);
timer->pos = npc.pos;
timer->Update();
for (uint32_t i = Random() % DEATH_LEECHES_RANGE + DEATH_LEECHES; i != 0; i--)
{
float angle = random_unit() * RANDOM_HALF_TURN * 2;
float reach = random_unit() * DEATH_LEECH_REACH;
blub_leech_throw(npc, vector_add(npc.pos, vector_make(std::cos(angle) * reach, std::sin(angle) * reach)), false);
}
}
// 00450da0 Lil Blub floats about its flooded room throwing leeches, spraying rings of water and jumping at its
// target, pushing its leeches off when it sprays, jumps or dies.
void boss_lil_blub_update(Entity_NPC& npc)
{
float leechPush = -1;
BlubLeeches leeches = blub_leeches_count(npc);
bool isHurt = npc.health / npc.maxHitPoints < BLUB_HURT_HEALTH;
bool isEnded = false;
switch (npc.state)
{
case NPC_STATE_INIT:
npc.state = BLUB_REST;
npc.entityGridCollisionClass = GRIDCOLL_WALLS;
npc.targetPosition = {};
npc.splatColor = blub_is_sewage() ? SEWAGE_SPLASH_COLOR : WATER_SPLASH_COLOR;
npc.projectileDelay = 0;
npc.stateFrame = 0;
break;
case BLUB_REST:
blub_rest_update(npc, leeches, isHurt);
break;
case BLUB_LEECHES:
npc.sprite.Play("Attack01");
if (npc.sprite.IsEventTriggered("Shoot")) blub_leeches_throw(npc);
isEnded = !npc.sprite.IsPlaying();
break;
case BLUB_BIG_LEECH:
npc.sprite.Play("Attack02");
if (npc.sprite.IsEventTriggered("Shoot")) blub_big_leech_throw(npc);
isEnded = !npc.sprite.IsPlaying();
break;
case BLUB_SPRAY:
npc.sprite.Play("Attack03");
blub_spray_update(npc, leechPush);
isEnded = !npc.sprite.IsPlaying();
break;
case BLUB_JUMPS:
npc.sprite.Play("Attack04");
isEnded = !blub_jumps_update(npc, leechPush, isHurt);
if (isEnded) npc.stateFrame = 0;
break;
}
if (isEnded) npc.state = BLUB_REST;
blub_float_update(npc);
if (npc.isDead)
{
leechPush = DEATH_PUSH;
blub_burst(npc);
}
if (leechPush <= 0) return;
for (Entity* leech : g_game->room->entityList.updateEL)
{
if (leech->type != ENTITY_SMALL_LEECH || leech->parent.get() != &npc) continue;
leech->parent = nullptr;
npc_push(*leech, vector_scale(vector_normalized(vector_sub(leech->pos, npc.pos)), leechPush));
static_cast<Entity_NPC*>(leech)->v1.x = 0;
leech->health = std::min(leech->health, leech->maxHitPoints * LEECH_HEALTH_SHARE);
}
}
+574
View File
@@ -0,0 +1,574 @@
#include "boss_ai.h"
#include "boss_repentance.h"
#include "entity_config.h"
#include "manager.h"
#include "npc_basement.h"
#include "npc_depths.h"
#include <algorithm>
#include <array>
#include <tuple>
#include <vector>
// The Matriarch's states: resting, flinching from a lost chunk, hopping, flinching in the air, spitting a Fistuloid,
// spraying worms, spitting a big shot, her rage of Fistuloids and her death into Chub.
enum MatriarchState
{
MATRIARCH_IDLE = NPC_STATE_IDLE,
MATRIARCH_FLINCH = NPC_STATE_SUICIDE,
MATRIARCH_HOP = NPC_STATE_JUMP,
MATRIARCH_AIR_FLINCH = NPC_STATE_STOMP,
MATRIARCH_SUMMON = NPC_STATE_ATTACK,
MATRIARCH_WORMS = NPC_STATE_ATTACK2,
MATRIARCH_SHOT = NPC_STATE_ATTACK3,
MATRIARCH_RAGE = NPC_STATE_SUMMON,
MATRIARCH_DEATH = NPC_STATE_SPECIAL
};
// She loses a chunk at 80, 65, 50 and 35 percent of her health: a Fistula or two (from the third) thrown back 40 out
// within 45 degrees of away from her target at 2 to 4, flinching back at 20 (6 in the air). Each chunk adds 90 to
// her anger (i1), which hits raise by 1 plus 0.6 per chunk lost, falling 1 a frame.
constexpr std::array<float, 4> MATRIARCH_CHUNKS = {0.8f, 0.65f, 0.5f, 0.35f};
constexpr float CHUNK_VOLUME = 0.8f;
constexpr int CHUNK_TWO_FROM = 1;
constexpr float CHUNK_SPREAD = 90;
constexpr float CHUNK_SPREAD_HALF = 45;
constexpr float CHUNK_OUT = 40;
constexpr float CHUNK_SPEED = 2;
constexpr float CHUNK_SPEED_RANGE = 2;
constexpr int CHUNK_FISTULA_SUBTYPE = 1000;
constexpr float CHUNK_BLOOD_SHARE = 0.5f;
constexpr float CHUNK_FLINCH_SPEED = 20;
constexpr float CHUNK_AIR_FLINCH_SPEED = 6;
constexpr int CHUNK_ANGER = 90;
constexpr float ANGER_PER_CHUNK = 0.6f;
constexpr float BLOOD_RAISE = -16;
constexpr int BLOOD_SUBTYPE_FISTULA = 4;
constexpr int BLOOD_SUBTYPE_SPLASH = 3;
constexpr int BLOOD_SUBTYPE_MEDIUM = 2;
constexpr int BLOOD_SUBTYPE_SMALL = 1;
// Resting: angered past 300 with three chunks lost she rages one time in five. Else one time in 12 she attacks: a
// Fistuloid (weight 100, 300 when angered past 150 or none is out, none with four out or when it would cost a chunk),
// worms (100) or a shot (100, 200 when cooled down). Else one time in ten she hops.
constexpr int RAGE_ANGER = 300;
constexpr int RAGE_CHUNKS = 3;
constexpr uint32_t MATRIARCH_RAGE_ODDS = 5;
constexpr int RAGE_START_ANGER = 400;
constexpr uint32_t MATRIARCH_ATTACK_ODDS = 12;
constexpr uint32_t SUMMON_WEIGHT = 100;
constexpr uint32_t SUMMON_ANGRY_WEIGHT = 300;
constexpr int SUMMON_ANGER = 150;
constexpr size_t SUMMON_LIMIT = 3;
constexpr int MATRIARCH_ATTACK_WEIGHT = 100;
constexpr int ATTACK_COOLED_WEIGHT = 200;
constexpr uint32_t MATRIARCH_HOP_ODDS = 10;
constexpr float IDLE_FRICTION = 0.5f;
constexpr float FLINCH_FRICTION = 0.8f;
// A hop at 6 at her target or the Fistuloid she leads, swerving 45 degrees when the swerve lands 128 out in the room
// and the target is more than 100 away.
constexpr float HOP_SPEED = 6;
constexpr float HOP_SWERVE_REACH = 100;
constexpr float HOP_SWERVE = 45;
constexpr float HOP_SWERVE_OUT = 128;
constexpr float MATRIARCH_LAND_VOLUME = 0.7f;
// A Fistuloid spat 20 ahead and 4 up at 10 (4 up), costing her its health down to a point above her next chunk.
constexpr float SUMMON_OUT = 20;
constexpr float SUMMON_RAISE = 4;
constexpr float MATRIARCH_SUMMON_SPEED = 10;
constexpr float SUMMON_BLOOD_SHARE = 0.3f;
constexpr int SUMMON_HIT_COUNTDOWN = 30;
// Worms: eight Chubber worms on an ellipse of 16 (22.4 across), their blood thrown at 0.3, 0.5 and 0.6 of their speed.
constexpr int WORMS = 8;
constexpr float WORM_STEP = 45;
constexpr float WORM_REACH = 16;
constexpr float WORM_WIDTH = 1.4f;
constexpr int WORM_SUBTYPE = 2;
constexpr float WORM_BLOOD_SPLASH = 0.3f;
constexpr float WORM_BLOOD_MEDIUM = 0.5f;
constexpr float WORM_BLOOD_SMALL = 0.6f;
constexpr float WORM_SOUND_VOLUME = 0.8f;
// A shot: a big red shot leaving creep at 10 from 40 ahead and 3 down, at where her target will be (a tenth of its
// speed per unit of distance, in the room), turned 45 degrees at most from straight ahead, cooling 90 to 149 frames.
constexpr float MATRIARCH_SHOT_LEAD = 0.1f;
constexpr float SHOT_MARGIN = 4;
constexpr float SHOT_OUT = 40;
constexpr float SHOT_DROP = 3;
constexpr float SHOT_TURN_MAX = 45;
constexpr float MATRIARCH_SHOT_SPEED = 10;
constexpr float MATRIARCH_SHOT_SCALE = 2;
constexpr float SHOT_SPIT_PITCH = 0.8f;
constexpr float SHOT_HEART_VOLUME = 0.8f;
constexpr float SHOT_BLOOD_RAISE = -10;
constexpr uint32_t SHOT_COOLDOWN_RANGE = 60;
constexpr int SHOT_COOLDOWN = 90;
// Her rage: she lets her Fistuloid go and spits one every 8 frames one time in two, within 90 degrees of her target,
// 20 out at 5 to 10, with half health, that dies on touch and the player cannot steer, until her anger falls to
// nothing at 2 a frame.
constexpr int RAGE_SPIT_EVERY = 8;
constexpr float RAGE_SPREAD = 180;
constexpr float RAGE_SPREAD_HALF = 90;
constexpr float RAGE_OUT = 20;
constexpr float RAGE_SPEED = 5;
constexpr float RAGE_SPEED_RANGE = 5;
constexpr float RAGE_HEALTH_SHARE = 0.5f;
constexpr int RAGE_ANGER_DRAIN = 2;
constexpr ColorMod RAGE_LOOSE_COLOR = {{1.5f, 0.6f, 0.6f, 1}, {0, 0, 0, 0}, {0.4f, 0.08f, 0.05f}};
constexpr ColorMod RAGE_LOOSE_FLASH = {{1, 1, 1, 1}, {0, 0, 0, 0}, {0.8f, 0.3f, 0.2f}};
constexpr int RAGE_LOOSE_FLASH_FRAMES = 15;
// Every 15 frames one time in two, leading none, she takes one of her Fistuloids to lead when at most one other
// door-shutting enemy is out (or one time in 100).
constexpr int LEAD_EVERY = 15;
constexpr uint32_t LEAD_CROWD_ODDS = 100;
// At a fifth of her health she bursts (a Fistula 40 out at 2 to 4, see below) and turns into a three-part Chub at a
// fifth of her health, her parts at her full health, in front of her.
constexpr float DEATH_HEALTH = 0.2f;
constexpr int DEATH_BURST_FISTULAS = 3;
constexpr int CHUB_SUBTYPE = 1000;
constexpr int CHUB_HEAD_DEPTH = 1500;
constexpr int CHUB_MIDDLE_DEPTH = 500;
constexpr int CHUB_TAIL_DEPTH = -500;
constexpr float CHUB_MIDDLE_SHADOW = 0.34f;
constexpr float CHUB_TAIL_SHADOW = 0.26f;
constexpr int MATRIARCH_CHUB_CHARGE = NPC_STATE_ATTACK;
// The chunk threshold she is at, none past her last.
static float matriarch_chunk_health(Entity_NPC& npc)
{
// The original reads past the table at her fifth chunk, a value so large no summon or cost fits under it.
return npc.i2 < (int)MATRIARCH_CHUNKS.size() ? MATRIARCH_CHUNKS[(size_t)npc.i2] * npc.maxHitPoints : INFINITY;
}
// A blood explosion raised to her mouth (FUN_004c5980).
static void matriarch_blood_spawn(int subType, const Vector& position, const Vector& velocity, float raise)
{
Entity* blood = g_game->Spawn({.position = position,
.velocity = velocity,
.subType = subType,
.type = ENTITY_EFFECT,
.variant = EFFECT_BLOOD_EXPLOSION,
.seed = Random()});
blood->posOffset = vector_make(0, raise);
}
// A Fistula thrown out of her along a direction, free of the boss bar.
static void matriarch_fistula_throw(Entity_NPC& npc, int type, Vector direction)
{
Vector position = vector_add(npc.pos, vector_scale(direction, CHUNK_OUT));
uint32_t seed = Random();
float speed = random_unit() * CHUNK_SPEED_RANGE + CHUNK_SPEED;
Entity* fistula = g_game->Spawn({.position = position,
.velocity = vector_scale(direction, speed),
.spawner = &npc,
.subType = CHUNK_FISTULA_SUBTYPE,
.type = type,
.seed = seed});
fistula->ClearEntityFlags(FLAG_APPEAR);
fistula->AddEntityFlags(FLAG_DONT_COUNT_BOSS_HP);
matriarch_blood_spawn(BLOOD_SUBTYPE_FISTULA, position, vector_scale(direction, CHUNK_BLOOD_SHARE), BLOOD_RAISE);
}
// The hits that would take her past her next chunks throw Fistulas off her and make her flinch.
static void matriarch_chunks_update(Entity_NPC& npc)
{
float health = npc.health - npc.pendingDamage;
while (npc.i2 < (int)MATRIARCH_CHUNKS.size() && health < matriarch_chunk_health(npc))
{
npc_sound_play(SOUND_DEATH_BURST_LARGE, CHUNK_VOLUME, 2, 1);
Vector away = vector_normalized(vector_sub(npc.pos, npc.GetPlayerTarget()->pos));
for (int i = 0; i < (npc.i2 > CHUNK_TWO_FROM) + 1; i++)
{
float angle = random_unit() * CHUNK_SPREAD - CHUNK_SPREAD_HALF;
matriarch_fistula_throw(npc, ENTITY_FISTULA_SMALL, vector_rotated(away, angle));
}
bool isAirborne = npc.state == MATRIARCH_HOP && npc.sprite.WasEventTriggered("Jump") &&
!npc.sprite.WasEventTriggered("Land");
if (isAirborne)
{
npc.sprite.Play("AirFlinch");
npc.state = MATRIARCH_AIR_FLINCH;
npc.velocity = vector_scale(away, CHUNK_AIR_FLINCH_SPEED);
}
else if (npc.state != MATRIARCH_FLINCH && npc.state != MATRIARCH_AIR_FLINCH)
{
npc.sprite.Play("Flinch");
npc.state = MATRIARCH_FLINCH;
npc.velocity = vector_scale(away, CHUNK_FLINCH_SPEED);
}
npc.i2++;
npc.i1 += CHUNK_ANGER;
}
}
// A Fistuloid's health, what spitting one costs her.
static float fistuloid_health_get()
{
// The original reads a missing config through a null pointer. Here it costs nothing.
EntityConfig_Entity* config = g_manager->entityConfig.GetEntity(ENTITY_FISTULOID, 0, 0);
return config ? config->baseHP : 0;
}
// Resting: her rage, an attack or a hop.
static void matriarch_idle_update(Entity_NPC& npc)
{
npc.sprite.Play("Idle");
npc.friction *= IDLE_FRICTION;
if (npc.i1 > RAGE_ANGER && npc.i2 >= RAGE_CHUNKS && Random() % MATRIARCH_RAGE_ODDS == 0)
{
npc.sprite.Play("RageBegin");
npc.state = MATRIARCH_RAGE;
npc.stateFrame = 0;
npc.i1 = RAGE_START_ANGER;
return;
}
if (Random() % MATRIARCH_ATTACK_ODDS != 0)
{
if (Random() % MATRIARCH_HOP_ODDS != 0) return;
npc.state = MATRIARCH_HOP;
npc.sprite.Play(Random() & 1 ? "Jump" : "Jump2");
return;
}
size_t led = 0;
for (Entity* fistuloid : Entity_NPC::QueryNPCsType(ENTITY_FISTULOID, -1))
if (fistuloid->parent.get() == &npc) led++;
uint32_t summonWeight = SUMMON_WEIGHT;
if (led > SUMMON_LIMIT || npc.health - fistuloid_health_get() < matriarch_chunk_health(npc)) summonWeight = 0;
else if (npc.i1 > SUMMON_ANGER || led == 0) summonWeight = SUMMON_ANGRY_WEIGHT;
uint32_t shotWeight = npc.projectileCooldown < 1 ? ATTACK_COOLED_WEIGHT : MATRIARCH_ATTACK_WEIGHT;
uint32_t roll = Random() % (shotWeight + summonWeight);
if (roll < summonWeight)
{
npc.PlaySound(SOUND_MONSTER_ROAR_1, 1, 2, false, 1);
npc.state = MATRIARCH_SUMMON;
}
else npc.state = roll < summonWeight + MATRIARCH_ATTACK_WEIGHT ? MATRIARCH_WORMS : MATRIARCH_SHOT;
}
// A hop at her target, or the Fistuloid she leads.
static void matriarch_hop_start(Entity_NPC& npc)
{
Vector direction{};
if (Entity* led = npc.child.get()) direction = vector_normalized(vector_sub(led->pos, npc.pos));
else
{
Vector gap = vector_sub(npc.CalcTargetPosition(0), npc.pos);
direction = vector_normalized(gap);
if (vector_length(gap) > HOP_SWERVE_REACH)
{
Vector swerve = vector_rotated(direction, Random() & 1 ? -HOP_SWERVE : HOP_SWERVE);
if (g_game->room->IsPositionInRoom(vector_add(npc.pos, vector_scale(swerve, HOP_SWERVE_OUT)), 0)) direction = swerve;
}
}
npc.targetPosition = vector_scale(direction, HOP_SPEED);
npc.velocity = npc.targetPosition;
}
// Where her shot aims: her target ahead by a tenth of its speed per unit of distance, kept in the room.
static Vector matriarch_shot_aim(Entity_NPC& npc)
{
Entity* target = npc.GetPlayerTarget();
float distance = vector_distance(npc.pos, target->pos);
Vector aim = vector_add(target->pos, vector_scale(target->velocity, MATRIARCH_SHOT_LEAD * distance));
return g_game->room->GetClampedPositionImpl(aim, SHOT_MARGIN, SHOT_MARGIN, SHOT_MARGIN, SHOT_MARGIN);
}
// Spits a Fistuloid ahead, costing her its health down to just above her next chunk.
static void matriarch_summon_spit(Entity_NPC& npc)
{
npc_sound_play(SOUND_SUMMONSOUND, 1, 2, 1);
float side = npc.sprite.isFlipX ? -1.0f : 1.0f;
Vector position = vector_make(npc.pos.x + side * SUMMON_OUT, npc.pos.y - SUMMON_RAISE);
Vector velocity = vector_make(-side * MATRIARCH_SUMMON_SPEED, -SUMMON_RAISE);
auto* fistuloid = static_cast<Entity_NPC*>(g_game->Spawn(
{.position = position, .velocity = velocity, .spawner = &npc, .type = ENTITY_FISTULOID, .seed = Random()}));
fistuloid->parent = &npc;
fistuloid->ClearEntityFlags(FLAG_APPEAR);
fistuloid_orbit_spread(*fistuloid);
g_game->Spawn({.position = position, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
matriarch_blood_spawn(BLOOD_SUBTYPE_SPLASH, position, vector_scale(fistuloid->velocity, SUMMON_BLOOD_SHARE), BLOOD_RAISE);
float left = std::max(npc.health - fistuloid_health_get(), matriarch_chunk_health(npc) + 1);
if (left < npc.health) npc.TakeDamage(npc.health - left, 0, EntityRef(), SUMMON_HIT_COUNTDOWN);
}
// Sprays a ring of eight Chubber worms, each in its blood.
static void matriarch_worms_spray(Entity_NPC& npc)
{
npc_sound_play(SOUND_HEARTOUT, WORM_SOUND_VOLUME, 2, 1);
for (int i = 0; i < WORMS; i++)
{
Vector unit = vector_from_angle((float)i * WORM_STEP);
Vector velocity = vector_make(unit.x * WORM_REACH * WORM_WIDTH, unit.y * WORM_REACH);
auto* worm = static_cast<Entity_NPC*>(g_game->Spawn({.position = vector_add(npc.pos, velocity),
.velocity = velocity,
.spawner = &npc,
.subType = WORM_SUBTYPE,
.type = ENTITY_VIS,
.variant = CHUBBER_WORM,
.seed = Random()}));
worm->state = NPC_STATE_INIT;
worm->parent = &npc;
worm->Update();
matriarch_blood_spawn(BLOOD_SUBTYPE_SPLASH, worm->pos, vector_scale(worm->velocity, WORM_BLOOD_SPLASH), BLOOD_RAISE);
matriarch_blood_spawn(BLOOD_SUBTYPE_MEDIUM, worm->pos, vector_scale(worm->velocity, WORM_BLOOD_MEDIUM), BLOOD_RAISE);
matriarch_blood_spawn(BLOOD_SUBTYPE_SMALL, worm->pos, vector_scale(worm->velocity, WORM_BLOOD_SMALL), BLOOD_RAISE);
}
}
// Spits her big shot ahead, turned 45 degrees at most toward where her target will be.
static void matriarch_shot_fire(Entity_NPC& npc)
{
npc_sound_play(SOUND_WORM_SPIT, 1, 2, SHOT_SPIT_PITCH);
npc_sound_play(SOUND_HEARTIN, SHOT_HEART_VOLUME, 2, 1);
Vector mouth = vector_make(npc.pos.x + (npc.sprite.isFlipX ? SHOT_OUT : -SHOT_OUT), npc.pos.y + SHOT_DROP);
Vector aim = matriarch_shot_aim(npc);
float ahead = npc.sprite.isFlipX ? 0 : HALF_TURN_DEGREES;
float turn = normalize_angle_degrees(vector_angle(vector_sub(aim, mouth)) - ahead);
Vector velocity = vector_scale(vector_from_angle(ahead + std::clamp(turn, -SHOT_TURN_MAX, SHOT_TURN_MAX)), MATRIARCH_SHOT_SPEED);
ProjectileParams params;
params.bulletFlags |= PROJECTILE_ACID_RED | PROJECTILE_RED_CREEP;
params.scale = MATRIARCH_SHOT_SCALE;
npc.FireProjectiles(mouth, velocity, PROJECTILES_SINGLE, params);
matriarch_blood_spawn(BLOOD_SUBTYPE_MEDIUM, mouth, velocity, SHOT_BLOOD_RAISE);
npc.projectileCooldown = (int)(Random() % SHOT_COOLDOWN_RANGE) + SHOT_COOLDOWN;
}
// A Fistuloid gone wild in her rage: reddened, flashing, deadly on touch and beyond a player's control.
static void matriarch_fistuloid_loose(Entity& fistuloid)
{
fistuloid.AddEntityFlags(FLAG_NO_PLAYER_CONTROL);
fistuloid.sprite.GetLayer(0)->color = RAGE_LOOSE_COLOR;
fistuloid.SetColor(RAGE_LOOSE_FLASH, RAGE_LOOSE_FLASH_FRAMES, COLOR_PRIORITY_DEFAULT, true, true);
}
// Her rage: she lets her Fistuloid loose on the roar, then spits wild ones until her anger is spent.
static void matriarch_rage_update(Entity_NPC& npc)
{
npc.friction *= IDLE_FRICTION;
if (npc.stateFrame == 0)
{
if (!npc.sprite.IsEventTriggered("Shoot")) return;
npc.PlaySound(SOUND_MONSTER_ROAR_1, 1, 2, false, 1);
npc.stateFrame = 1;
npc.sprite.isFlipX = npc.pos.x < npc.CalcTargetPosition(0).x;
if (Entity* led = npc.child.get())
{
led->parent = nullptr;
led->isKillOnTouch = true;
matriarch_fistuloid_loose(*led);
npc.child = nullptr;
}
return;
}
if (npc.stateFrame < 0)
{
if (!npc.sprite.IsPlaying()) npc.state = MATRIARCH_IDLE;
return;
}
if (!npc.sprite.IsPlaying()) npc.sprite.Play("RageLoop");
if (npc.stateFrame % RAGE_SPIT_EVERY == 0 && (Random() & 1) == 0)
{
npc_sound_play(SOUND_SUMMONSOUND, 1, 2, 1);
Vector toward = vector_normalized(vector_sub(npc.CalcTargetPosition(0), npc.pos));
Vector direction = vector_rotated(toward, random_unit() * RAGE_SPREAD - RAGE_SPREAD_HALF);
Vector position = vector_add(npc.pos, vector_scale(direction, RAGE_OUT));
uint32_t seed = Random();
float speed = random_unit() * RAGE_SPEED_RANGE + RAGE_SPEED;
Entity* fistuloid = g_game->Spawn({.position = position,
.velocity = vector_scale(direction, speed),
.spawner = &npc,
.type = ENTITY_FISTULOID,
.seed = seed});
float health = fistuloid->maxHitPoints * RAGE_HEALTH_SHARE;
fistuloid->ClearEntityFlags(FLAG_APPEAR);
fistuloid->isKillOnTouch = true;
fistuloid->maxHitPoints = health;
fistuloid->health = health;
matriarch_fistuloid_loose(*fistuloid);
g_game->Spawn({.position = position, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
matriarch_blood_spawn(BLOOD_SUBTYPE_SPLASH, position, vector_scale(fistuloid->velocity, SUMMON_BLOOD_SHARE), BLOOD_RAISE);
}
npc.stateFrame++;
npc.i1 -= RAGE_ANGER_DRAIN;
if (npc.i1 >= 1) return;
npc.i1 = 0;
npc.stateFrame = -1;
npc.sprite.Play("RageEnd");
}
// Her death: she bursts and turns into Chub, two more parts trailing her, charging at her target.
static void matriarch_burst(Entity_NPC& npc)
{
npc_sound_play(SOUND_ROCKET_BLAST_DEATH, 1, 2, 1);
uint32_t burst = Random();
g_game->Spawn({.position = npc.pos, .spawner = &npc, .type = ENTITY_EFFECT, .variant = EFFECT_LARGE_BLOOD_EXPLOSION, .seed = burst});
// The original counts its Fistulas on from the burst's seed, so all but one seed in a billion throw one small Fistula.
uint32_t thrown = burst;
do matriarch_fistula_throw(npc, thrown != 0 ? ENTITY_FISTULA_SMALL : ENTITY_FISTULA_MEDIUM, random_direction());
while (++thrown < DEATH_BURST_FISTULAS);
if (Entity* led = npc.child.get())
{
led->parent = nullptr;
npc.child = nullptr;
}
auto* fistuloid = static_cast<Entity_NPC*>(
g_game->Spawn({.position = npc.pos, .spawner = &npc, .type = ENTITY_FISTULOID, .seed = Random()}));
fistuloid->parent = &npc;
fistuloid->ClearEntityFlags(FLAG_APPEAR);
fistuloid_orbit_spread(*fistuloid);
float maxHealth = npc.maxHitPoints;
npc.RemoveStatusEffects();
npc.Morph(ENTITY_CHUB, 0, CHUB_SUBTYPE, -1);
npc.maxHitPoints = maxHealth;
npc.spawnerType = ENTITY_MATRIARCH;
npc.entityCollisionClass = ENTCOLL_ALL;
npc.health = maxHealth * DEATH_HEALTH;
auto* middle = static_cast<Entity_NPC*>(g_game->Spawn(
{.position = npc.pos, .spawner = &npc, .subType = npc.subtype, .type = npc.type, .variant = npc.variant, .seed = Random()}));
auto* tail = static_cast<Entity_NPC*>(g_game->Spawn(
{.position = npc.pos, .spawner = &npc, .subType = npc.subtype, .type = npc.type, .variant = npc.variant, .seed = Random()}));
middle->ClearEntityFlags(FLAG_APPEAR);
tail->ClearEntityFlags(FLAG_APPEAR);
npc.child = middle;
middle->parent = &npc;
middle->child = tail;
tail->parent = middle;
npc.ClearEntityFlags(FLAG_NO_DEATH_TRIGGER);
npc.i1 = 0;
npc.renderZOffset = CHUB_HEAD_DEPTH;
// Chub's parts carry their place along it in i1.
for (auto [part, depth, shadow, place] : {std::tuple{middle, CHUB_MIDDLE_DEPTH, CHUB_MIDDLE_SHADOW, 1},
std::tuple{tail, CHUB_TAIL_DEPTH, CHUB_TAIL_SHADOW, 2}})
{
part->renderZOffset = depth;
part->shadowSize = shadow;
part->i1 = place;
part->AddEntityFlags(FLAG_DONT_COUNT_BOSS_HP);
part->maxHitPoints = npc.maxHitPoints;
part->health = npc.maxHitPoints;
}
Vector toward = vector_sub(npc.GetPlayerTarget()->pos, npc.pos);
npc.PlaySound(SOUND_MONSTER_ROAR_0, 1, 2, false, 1);
npc.v1 = vector_cardinal(toward);
npc.state = MATRIARCH_CHUB_CHARGE;
npc.stateFrame = 0;
npc.pathfinder.movementTarget = {};
npc.pathfinder.moveDirection = {};
}
// Every 15 frames one time in two she takes a Fistuloid to lead, unless the room is crowded.
static void matriarch_lead_update(Entity_NPC& npc)
{
if (!npc.IsFrame(LEAD_EVERY, 0) || npc.child || (Random() & 1) != 0) return;
int crowd = 0;
for (Entity* entity : g_game->room->entityList.updateEL)
if (Entity::is_enemy_type(entity->type) && entity->CanShutDoors() && entity->type != ENTITY_MATRIARCH &&
entity->type != ENTITY_FISTULOID)
crowd++;
if (crowd > 1 && Random() % LEAD_CROWD_ODDS != 0) return;
std::vector<Entity*> led;
for (Entity* fistuloid : entity_query(ENTITY_FISTULOID, -1))
if (fistuloid->parent.get() == &npc) led.push_back(fistuloid);
if (led.empty()) return;
Entity* picked = led[random_below((int)led.size())];
npc.child = picked;
fistuloid_orbit_spread(static_cast<Entity_NPC&>(*picked));
}
// 004c59d0 The Matriarch hops about trailed by her Fistuloids, spitting them, worms and big shots. Losing chunks of
// her health throws Fistulas off her and angers her into a rage of wild Fistuloids. At a fifth of her health she
// bursts into Chub.
void boss_matriarch_update(Entity_NPC& npc)
{
bool isDeliriumForm = npc.deliriumBossType != 0;
if (!isDeliriumForm && npc.pendingDamage > 0 && npc.state != MATRIARCH_RAGE) matriarch_chunks_update(npc);
bool isEnded = true;
switch (npc.state)
{
case NPC_STATE_INIT:
npc.state = MATRIARCH_IDLE;
npc.i1 = 0;
npc.i2 = 0;
isEnded = false;
break;
case MATRIARCH_IDLE:
matriarch_idle_update(npc);
isEnded = false;
break;
case MATRIARCH_FLINCH:
npc.friction *= FLINCH_FRICTION;
break;
case MATRIARCH_HOP:
case MATRIARCH_AIR_FLINCH:
{
if (npc.state == MATRIARCH_HOP && npc.sprite.IsEventTriggered("Jump")) matriarch_hop_start(npc);
if (npc.sprite.IsEventTriggered("Land")) npc_sound_play(SOUND_FORESTBOSS_STOMPS, MATRIARCH_LAND_VOLUME, 2, 1);
bool isAirborne = npc.sprite.WasEventTriggered("Jump") && !npc.sprite.WasEventTriggered("Land");
if (isAirborne && npc.state == MATRIARCH_HOP) npc.sprite.isFlipX = npc.targetPosition.x > 0;
if (!isAirborne) npc.friction *= IDLE_FRICTION;
break;
}
case MATRIARCH_SUMMON:
npc.friction *= IDLE_FRICTION;
npc.sprite.Play("Attack1");
if (npc.sprite.IsEventTriggered("Shoot")) matriarch_summon_spit(npc);
break;
case MATRIARCH_WORMS:
npc.friction *= IDLE_FRICTION;
npc.sprite.Play("Attack2");
if (npc.sprite.IsEventTriggered("Shoot")) matriarch_worms_spray(npc);
break;
case MATRIARCH_SHOT:
npc.friction *= IDLE_FRICTION;
npc.sprite.Play("Attack3");
if (npc.sprite.GetFrame() == 0) npc.sprite.isFlipX = npc.pos.x < matriarch_shot_aim(npc).x;
if (npc.sprite.IsEventTriggered("Shoot")) matriarch_shot_fire(npc);
break;
case MATRIARCH_RAGE:
matriarch_rage_update(npc);
npc.friction *= FLINCH_FRICTION;
break;
case MATRIARCH_DEATH:
npc.friction *= IDLE_FRICTION;
npc.sprite.Play("Death");
if (!npc.sprite.IsPlaying()) return matriarch_burst(npc);
isEnded = false;
break;
default:
isEnded = false;
break;
}
if (isEnded && !npc.sprite.IsPlaying()) npc.state = MATRIARCH_IDLE;
if (npc.projectileCooldown > 0) npc.projectileCooldown--;
if (npc.state != MATRIARCH_RAGE)
{
if (npc.pendingDamage > 0) npc.i1 += (int)(((float)npc.i2 * ANGER_PER_CHUNK + 1) * npc.pendingDamage);
if (npc.i1 > 0) npc.i1--;
matriarch_lead_update(npc);
}
if (!isDeliriumForm && (npc.isDead || npc.health <= npc.maxHitPoints * DEATH_HEALTH))
{
npc.isDead = false;
npc.entityCollisionClass = ENTCOLL_NONE;
npc.state = MATRIARCH_DEATH;
npc.health = npc.maxHitPoints * DEATH_HEALTH;
}
}
+1 -2
View File
@@ -62,7 +62,6 @@ constexpr float LINE_UP_RANGE = 50;
constexpr float REPEAT_REROLL_ODDS = 0.9f;
constexpr float CRUSH_RADIUS = 70;
constexpr float MONSTRO_CRUSH_DAMAGE = 30;
constexpr int CRUSH_COUNTDOWN = 30;
constexpr float MONSTRO_LASER_HEIGHT = -20;
constexpr float LASER_RIGHT_DEGREES = 0;
constexpr float LASER_LEFT_DEGREES = 180;
@@ -296,7 +295,7 @@ static void suckers_crush(Entity_NPC& npc)
for (Entity* sucker : entity_query_radius(npc.pos, CRUSH_RADIUS, QUERY_ENEMIES))
if (sucker->type == ENTITY_SUCKER && sucker->variant == 0)
sucker->TakeDamage(MONSTRO_CRUSH_DAMAGE, 0, EntityRef(&npc), CRUSH_COUNTDOWN);
sucker->TakeDamage(MONSTRO_CRUSH_DAMAGE, 0, EntityRef(&npc), HIT_COUNTDOWN);
}
// A hop toward its target's cell: pulled there while airborne (harder for the quick one), dust where it lands, and
+86
View File
@@ -0,0 +1,86 @@
#include "boss_overlay.h"
#include "cutscene.h"
#include "game.h"
#include "manager.h"
#include "menu_manager.h"
#include "sfx_manager.h"
// The 480 by 270 screen the overlays are drawn for, Dogma's static layer that ignores the game's time, and the room
// Dogma's shutdown leads to.
constexpr float OVERLAY_SCREEN_WIDTH = 480;
constexpr float OVERLAY_SCREEN_HEIGHT = 270;
constexpr int DOGMA_STATIC_LAYER = 4;
constexpr const char* EVENT_END = "End";
// The sound effects back to full volume at the normal fade.
static void sound_volume_restore()
{
SFXManager& sounds = g_manager->sfxManager;
if (sounds.volumeModifier != 1)
{
sounds.volumeModifier = 1;
sounds.ClearVolumeModifier();
}
sounds.volumeModifierStep = VOLUME_MODIFIER_STEP;
}
// 004214b0 Shows an overlay: its .anm2 loaded and its animation played (Dogma's static layer ignoring the game's
// time). An id past the table is ignored.
void BossOverlay::play(int overlayType)
{
if ((unsigned)overlayType >= BOSS_OVERLAY_COUNT) return;
BossOverlayEntry& entry = entries[overlayType];
sprite.Load(entry.anm2Path, GRAPHICS_LOAD);
sprite.LoadGraphics();
type = overlayType;
if (overlayType == BOSS_OVERLAY_DOGMA_DYING || overlayType == BOSS_OVERLAY_DOGMA_DEAD)
sprite.GetLayer(DOGMA_STATIC_LAYER)->bitflags |= ANIM_RENDER_STATIC;
sprite.Play(entry.animation);
state = BOSS_OVERLAY_SHOWN;
}
// 004212c0 Plays the overlay on, hiding a finished one that does not stay. Dogma's shutdown, at its "End" event, shows
// the Dogma cutscene (keeping the run, then the title) and takes the players through the fade to the Beast's
// floor, else hides once it is over.
void BossOverlay::update()
{
if (state == BOSS_OVERLAY_HIDDEN) return;
bool isFinished = !sprite.animState.animData || !sprite.animState.isPlaying;
if (isFinished && !entries[type].isPersistent) state = BOSS_OVERLAY_HIDDEN;
sprite.Update();
if (type != BOSS_OVERLAY_DOGMA_DEAD) return;
if (sprite.animState.animData && sprite.animState.IsEventTriggered(EVENT_END))
{
g_manager->ShowCutscene(CUTSCENE_DOGMA, CUTSCENE_KEEP_STATE, MENU_TITLE);
sound_volume_restore();
g_game->StartRoomTransition({.animation = TRANSITION_FADE, .roomIndex = ROOM_SECRET_EXIT_IDX});
g_game->roomTransition.Update();
return;
}
if (sprite.animState.animData && sprite.animState.isPlaying) return;
state = BOSS_OVERLAY_HIDDEN;
type = BOSS_OVERLAY_NONE;
}
// 00421400 Draws the overlay stretched from its 480 by 270 screen over the real one, without the screen shake.
void BossOverlay::render()
{
if (state == BOSS_OVERLAY_HIDDEN) return;
DAT_00c33910 = 0;
sprite.scale = vector_make(g_screenWidth / OVERLAY_SCREEN_WIDTH, g_screenHeight / OVERLAY_SCREEN_HEIGHT);
sprite.Render({});
DAT_00c33910 = 1;
}
// 00421260 Hides the overlay, unloading its sprite, and the sound effects come back to full volume.
void BossOverlay::stop()
{
sprite.Reset();
state = BOSS_OVERLAY_HIDDEN;
type = BOSS_OVERLAY_NONE;
sound_volume_restore();
}
+50
View File
@@ -0,0 +1,50 @@
#pragma once
#include "anm2.h"
#include <array>
#include <string>
constexpr int BOSS_OVERLAY_COUNT = 5;
// The overlays bossoverlays.xml defines, by id: the whiteouts and Dogma's static as it falls and shuts down.
enum BossOverlayType : int
{
BOSS_OVERLAY_NONE,
BOSS_OVERLAY_WHITEOUT,
BOSS_OVERLAY_DOGMA_DYING,
BOSS_OVERLAY_DOGMA_DEAD,
BOSS_OVERLAY_BEAST_DEAD
};
// Whether the overlay is hidden or shows its entry.
enum BossOverlayState : int
{
BOSS_OVERLAY_HIDDEN,
BOSS_OVERLAY_SHOWN
};
// A boss overlay animation as bossoverlays.xml defines it: its .anm2, its animation and whether it stays once played.
struct BossOverlayEntry
{
std::string anm2Path;
std::string animation;
int id = 0;
bool isPersistent = false;
};
// Construction and destruction are the defaults.
// The full screen animations of the late bosses (Game's bossOverlay): the entries bossoverlays.xml defines and the one
// shown, stretched over the screen.
class BossOverlay
{
public:
std::array<BossOverlayEntry, BOSS_OVERLAY_COUNT> entries;
ANM2 sprite;
BossOverlayState state = BOSS_OVERLAY_HIDDEN;
int type = BOSS_OVERLAY_NONE;
void play(int overlayType);
void update();
void render();
void stop();
};
+2 -5
View File
@@ -27,24 +27,21 @@ constexpr uint32_t DOUBLE_TROUBLE_ODDS_CHAPTER_4 = 40;
constexpr int BOSS_MONSTRO = 1;
constexpr int BOSS_MOMS_HEART = 8;
constexpr int BOSS_DEATH = 12;
constexpr int BOSS_HEADLESS_HORSEMAN = 22;
constexpr int BOSS_IT_LIVES = 25;
constexpr int BOSS_THE_BLOAT = 30;
constexpr int BOSS_CONQUEST = 38;
constexpr int BOSS_THE_LAMB = 54;
constexpr int BOSS_DELIRIUM = 70;
constexpr int BOSS_REAP_CREEP = 74;
// The Horsemen of the first floor of chapters 1 to 4, by chapter.
constexpr std::array<int, 4> HORSEMEN = {9, 10, 11, BOSS_DEATH};
constexpr std::array<int, 4> HORSEMEN = {BOSS_FAMINE, BOSS_PESTILENCE, BOSS_WAR, BOSS_DEATH};
// The bosses the dark bosses special daily fixes on stages 1 to 7 (none on stage 6).
constexpr int SPECIAL_DAILY_DARK_BOSSES = 13;
constexpr std::array<int, 8> SPECIAL_DAILY_BOSSES = {0, 60, 43, 50, 23, 51, 0, 15};
constexpr int ACHIEVEMENT_HARBINGERS = 5;
constexpr int ACHIEVEMENT_FORGOTTEN_HORSEMAN = 66;
constexpr int STAGE_CHAPTER_1 = 1;
constexpr int STAGE_CHAPTER_2 = 3;
@@ -252,7 +249,7 @@ int BossPool::GetBossId(int levelStage, int stageType)
if (game.challenge == CHALLENGE_APRILS_FOOL) return BOSS_THE_BLOAT;
bool isDailyStage = levelStage >= 0 && levelStage < (int)SPECIAL_DAILY_BOSSES.size();
if (game.dailyChallenge._specialDailyId == SPECIAL_DAILY_DARK_BOSSES && isDailyStage &&
if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_DARK_BOSSES && isDailyStage &&
SPECIAL_DAILY_BOSSES[levelStage] != 0)
return SPECIAL_DAILY_BOSSES[levelStage];
if (int boss = chapter_end_boss(levelStage, stageType)) return boss;
+5
View File
@@ -13,9 +13,14 @@ constexpr int BOSS_ID_COUNT = 104;
// The bosses the game checks by id (bossportraits.xml's ids).
constexpr int BOSS_MOM = 6;
constexpr int BOSS_FAMINE = 9;
constexpr int BOSS_PESTILENCE = 10;
constexpr int BOSS_WAR = 11;
constexpr int BOSS_DEATH = 12;
constexpr int BOSS_THE_FALLEN = 23;
constexpr int BOSS_SATAN = 24;
constexpr int BOSS_ISAAC = 39;
constexpr int BOSS_CONQUEST = 38;
constexpr int BOSS_BLUE_BABY = 40;
constexpr int BOSS_MEGA_SATAN = 55;
constexpr int BOSS_ULTRA_GREED = 62;
+34
View File
@@ -44,3 +44,37 @@ void boss_mothers_shadow_update(Entity_NPC& npc);
void boss_clog_update(Entity_NPC& npc);
void boss_raglich_update(Entity_NPC& npc);
void hornfel_room_controller(Entity_Effect& controller);
// Clutch (boss_clutch.cpp): the purple of his flames and Clickety Clacks' glow, the burning pile's mark (a Clickety
// Clack's i2), his beam to a Clickety Clack, his AI and his trail's drawing.
constexpr ColorMod CLUTCH_FLAME_COLOR = {{1, 1, 1, 1}, {1.3f, 1, 2, 1}, {0, 0, 0}};
constexpr int CLACK_FLAME = 99;
// The Clickety Clack's states Clutch drives (its stomp, its stun, getting up from its Regen's 15th frame and its pile
// of bones), Clutch's wait after a quick revert, and the pitch of his sounds.
constexpr int CLACK_STOMP = NPC_STATE_SUICIDE;
constexpr int CLACK_STUNNED = NPC_STATE_STOMP;
constexpr int CLACK_REGEN = NPC_STATE_SUMMON;
constexpr int CLACK_PILE = NPC_STATE_SPECIAL;
constexpr int CLACK_REGEN_FRAME = 15;
constexpr int CLUTCH_REVERT_WAIT = -1000;
constexpr float CLUTCH_SOUND_PITCH = 1.5f;
Entity* clutch_beam_spawn(Entity& spawner, Entity& target, Entity* parent);
void boss_clutch_update(Entity_NPC& npc);
// The Chimera's forms, by variant: whole, its body once its head is off, and its head.
enum ChimeraVariant
{
CHIMERA_WHOLE,
CHIMERA_BODY,
CHIMERA_HEAD
};
// The Repentance bosses of the Mausoleum's and Gehenna's ranks (boss_matriarch.cpp and its neighbours).
void boss_matriarch_update(Entity_NPC& npc);
void chimera_body_update(Entity_NPC& npc);
void chimera_head_update(Entity_NPC& npc);
void boss_lil_blub_update(Entity_NPC& npc);
void boss_bumbino_update(Entity_NPC& npc);
void singe_ball_update(Entity_NPC& npc);
void clutch_render(Entity_NPC& npc, const Vector& offset);
+188
View File
@@ -0,0 +1,188 @@
#include "boss_ai.h"
#include "boss_repentance.h"
#include "entity_player.h"
#include "grid_entity.h"
#include "player_manager.h"
#include "room_grid.h"
#include <algorithm>
#include <cmath>
// Singe's ball rolls about untouchable, bounced by blasts. Its roll frame stands for its turn (v1.x, 0 to 1), its
// height (v2.y) and fall (v1.y) lift it, and i1 tells a sideways roll from an up-and-down one.
constexpr uint64_t BALL_FLAGS = FLAG_NO_STATUS_EFFECTS | FLAG_NO_TARGET | FLAG_NO_BLOOD_SPLASH | FLAG_NO_DEATH_TRIGGER;
constexpr uint32_t BALL_SHIFT_1 = 2;
constexpr uint32_t BALL_SHIFT_2 = 5;
constexpr uint32_t BALL_SHIFT_3 = 15;
constexpr int BALL_ROLL_SIDEWAYS = 1;
// Flat File retracts its spikes: the ball's sheet changes and it does no contact damage.
constexpr std::string_view SINGE_BALL_SHEET = "gfx/Bosses/repentance/singe_ball.png";
constexpr std::string_view SINGE_BALL_RETRACTED_SHEET = "gfx/Bosses/repentance/singe_ball_retracted.png";
// It goes once no enemy is left (unless pressure plates hold the room under 9 frames of clearing). Above 50 it
// passes over things, and above 1 (or rising) over the floor's obstacles.
constexpr int BALL_CLEAR_DELAY = 9;
constexpr float SINGE_BALL_HIGH = -50;
constexpr float BALL_LIFTED = -1;
// A blast pushes it away at up to 40 (less the faster it already rolls away, from 20 against to 20 along) and pops it
// up at 6. It falls 0.8 a frame, bouncing back at 0.35 above 4 with a thud, dropping into pits it lands over (and
// gone 10 below).
constexpr float SINGE_BLAST_PUSH = 20;
constexpr float BLAST_ALONG = 20;
constexpr float BLAST_ALONG_SPAN = 40;
constexpr float BLAST_POP = -6;
constexpr float SINGE_BALL_GRAVITY = 0.8f;
constexpr float BALL_SINK = 10;
constexpr float BALL_BOUNCE_MIN = 4;
constexpr float BALL_BOUNCE = -0.35f;
constexpr float THUD_VOLUME_SHARE = 0.1f;
constexpr float THUD_VOLUME = 0.2f;
constexpr float THUD_VOLUME_MAX = 1.2f;
constexpr float THUD_PITCH_RANGE = 0.2f;
constexpr float THUD_PITCH = 0.9f;
// Rolling faster than 2 picks its roll's axis. It turns 0.02 of its speed a frame, slowing by 0.7 to 0.99 as it rolls
// from 0.5 to 4.
constexpr float ROLL_TURN_SPEED_SQUARED = 4;
constexpr float SINGE_ROLL_TURN = 0.02f;
constexpr float ROLL_SLOW = 0.5f;
constexpr float ROLL_SLOW_SPAN = 3.5f;
constexpr float ROLL_FRICTION_RANGE = 0.29000002f;
constexpr float ROLL_FRICTION = 0.7f;
// Sets its roll animation still at the frame its turn shows.
static void singe_ball_roll_set(Entity_NPC& npc, std::string_view animation)
{
if (npc.sprite.SetAnimation(animation, SWITCH_KEEP_FRAME) && npc.sprite.animState.animData)
{
npc.sprite.animState.SetFrameFloat(0);
if (npc.sprite.animState.animData) npc.sprite.animState.isPlaying = false;
}
if (const AnimationData* data = npc.sprite.animState.animData)
npc.sprite.animState.SetFrameFloat((float)(int)((float)data->length * npc.v1.x));
}
// The blasts of the frame push it away and pop it up.
static void singe_ball_blasts_update(Entity_NPC& npc)
{
if (!(npc.pendingDamageFlags & DAMAGE_EXPLOSION)) return;
for (DamageEvent& hit : npc.damageEvents)
{
if (!(hit.damageFlags & DAMAGE_EXPLOSION) || vector_is_zero(hit.source.position)) continue;
Vector away = vector_normalized(vector_sub(npc.pos, hit.source.position));
float along = std::clamp((vector_dot(away, npc.velocity) + BLAST_ALONG) / BLAST_ALONG_SPAN, 0.0f, 1.0f);
float push = 2 - (along + along);
npc.velocity = vector_add(npc.velocity, vector_scale(away, push * SINGE_BLAST_PUSH * npc.speedMultiplier));
if (npc.v2.y >= 0 && npc.v1.y >= 0) npc.v1.y = BLAST_POP;
}
}
// Its height: falling (and bouncing, or dropping into a pit) while up or popped.
static void singe_ball_fall_update(Entity_NPC& npc)
{
bool isAirborne = npc.v2.y < 0 || npc.v1.y < 0 || npc.entityGridCollisionClass == GRIDCOLL_PITSONLY;
if (!isAirborne)
{
npc.posOffset.y = npc.v2.y;
return;
}
float fall = npc.v1.y;
npc.v1.y = npc.speedMultiplier * SINGE_BALL_GRAVITY + fall;
npc.v2.y += npc.speedMultiplier * fall;
if (npc.entityGridCollisionClass == GRIDCOLL_PITSONLY)
{
if (npc.v2.y > BALL_SINK)
{
g_game->Spawn({.position = npc.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
npc.Remove();
}
}
else if (npc.v2.y > 0)
{
Room& room = *g_game->room;
Vector ahead = vector_add(npc.pos, npc.velocity);
int column = (int)((ahead.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + HALF);
int row = (int)((ahead.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + HALF);
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
if (room.GetGridCollision(isInside ? room.gridWidth * row + column : -1) == COLLISION_PIT)
npc.entityGridCollisionClass = GRIDCOLL_PITSONLY;
else
{
npc.v2.y = 0;
if (npc.v1.y > 0 && npc.v1.y <= BALL_BOUNCE_MIN) npc.v1.y = 0;
else if (npc.v1.y > 0)
{
float pitch = random_unit() * THUD_PITCH_RANGE + THUD_PITCH;
npc_sound_play(SOUND_STONE_IMPACT, std::min(npc.v1.y * THUD_VOLUME_SHARE + THUD_VOLUME, THUD_VOLUME_MAX), 2, pitch);
npc.v1.y *= BALL_BOUNCE;
}
}
}
npc.posOffset.y = npc.v2.y;
}
// 0058d8b0 Singe's ball rolls about wherever it is knocked, bounced by blasts and turning with its roll, harmless
// with Flat File. It goes with the last enemy, or into a pit.
void singe_ball_update(Entity_NPC& npc)
{
if (npc.state == NPC_STATE_INIT)
{
npc.AddEntityFlags(BALL_FLAGS);
npc.isInvincible = true;
RNG turn = {npc.initSeed, BALL_SHIFT_1, BALL_SHIFT_2, BALL_SHIFT_3};
npc.v1.y = 0;
npc.v2.y = 0;
npc.i1 = 0;
npc.i2 = 0;
npc.v1.x = turn.RandomFloat();
singe_ball_roll_set(npc, "RollVert");
npc.state = NPC_STATE_IDLE;
}
Entity_Player* flatFile = g_game->playerManager.FirstTrinketOwner(TRINKET_FLAT_FILE);
if (flatFile && (flatFile->GetTrinketMultiplier(TRINKET_FLAT_FILE) > 1) != (npc.i2 != 0))
{
bool isRetracted = flatFile->GetTrinketMultiplier(TRINKET_FLAT_FILE) > 1;
npc.i2 = isRetracted;
npc.sprite.ReplaceSpritesheet(0, isRetracted ? SINGE_BALL_RETRACTED_SHEET : SINGE_BALL_SHEET);
npc.sprite.LoadGraphics();
npc.collisionDamage = npc.i2 == 0 ? 1.0f : 0.0f;
}
Room& room = *g_game->room;
bool isRoomHeld = room.isTriggerPressurePlates && room.roomClearDelay >= BALL_CLEAR_DELAY;
if (npc.subtype == 0 && npc.GetAliveEnemyCount() < 1 && !isRoomHeld && !npc.isDead) npc.Kill(EntityRef());
if (npc.entityGridCollisionClass == GRIDCOLL_PITSONLY) npc.entityCollisionClass = ENTCOLL_NONE;
else
{
npc.entityCollisionClass = npc.v2.y > SINGE_BALL_HIGH ? ENTCOLL_ALL : ENTCOLL_NONE;
npc.entityGridCollisionClass = npc.v2.y <= BALL_LIFTED || npc.v1.y < 0 ? GRIDCOLL_NOPITS : GRIDCOLL_GROUND;
}
singe_ball_blasts_update(npc);
singe_ball_fall_update(npc);
float speedSquared = vector_length_squared(npc.velocity);
int axis = std::abs(npc.velocity.y) < std::abs(npc.velocity.x) ? BALL_ROLL_SIDEWAYS : 0;
if (speedSquared > ROLL_TURN_SPEED_SQUARED && axis != npc.i1)
{
npc.i1 = axis;
singe_ball_roll_set(npc, axis == BALL_ROLL_SIDEWAYS ? "RollHori" : "RollVert");
}
float speed = std::sqrt(npc.v1.y * npc.v1.y + speedSquared);
float heading = npc.i1 == BALL_ROLL_SIDEWAYS ? npc.velocity.x : npc.velocity.y;
npc.v1.x += heading < 0 ? -speed * SINGE_ROLL_TURN : speed * SINGE_ROLL_TURN;
float slowing = std::clamp((speed - ROLL_SLOW) / ROLL_SLOW_SPAN, 0.0f, 1.0f);
npc.friction *= slowing * ROLL_FRICTION_RANGE + ROLL_FRICTION;
while (npc.v1.x < 0) npc.v1.x += 1;
while (npc.v1.x >= 1) npc.v1.x -= 1;
const AnimationData* data = npc.sprite.animState.animData;
if (!data) return;
int frame = (int)((float)data->length * npc.v1.x);
if (frame != (int)std::floor(npc.sprite.animState.animFrame)) npc.sprite.animState.SetFrameFloat((float)frame);
}
+23
View File
@@ -0,0 +1,23 @@
#include "color_stack.h"
#include <vector>
// The pushed colours, the last on top.
static std::vector<ColorMod> colorStack;
// 0040c890 Pushes a colour over every layer drawn until it is popped.
void color_stack_push(const ColorMod& color)
{
colorStack.push_back(color);
}
// Pops the top colour, as the callers of the push do inline.
void color_stack_pop()
{
if (!colorStack.empty()) colorStack.pop_back();
}
// 0040c6f0 The colour layers draw in, null while none is pushed.
const ColorMod* color_stack_top()
{
return colorStack.empty() ? nullptr : &colorStack.back();
}
+8
View File
@@ -0,0 +1,8 @@
#pragma once
#include "classes.h"
// KAGE's render colour stack: while a colour is pushed, every sprite layer draws in the top one instead of its own.
void color_stack_push(const ColorMod& color);
void color_stack_pop();
const ColorMod* color_stack_top();
+2 -28
View File
@@ -24,38 +24,12 @@
#include <fstream>
#include <span>
// The GLFW keys the console reads.
enum ConsoleKey : int
{
KEY_V = 86,
KEY_GRAVE_ACCENT = 96,
KEY_ESCAPE = 256,
KEY_ENTER = 257,
KEY_BACKSPACE = 259,
KEY_DELETE = 261,
KEY_RIGHT = 262,
KEY_LEFT = 263,
KEY_DOWN = 264,
KEY_UP = 265,
KEY_PAGE_UP = 266,
KEY_PAGE_DOWN = 267,
KEY_HOME = 268,
KEY_END = 269,
KEY_KEYPAD_SUBTRACT = 333,
KEY_KEYPAD_ADD = 334,
KEY_KEYPAD_ENTER = 335,
KEY_LEFT_CONTROL = 341,
KEY_LEFT_SUPER = 343,
KEY_RIGHT_CONTROL = 345
};
constexpr std::string_view GREETING = "Repentance+ Console\n";
constexpr const char* HISTORY_FILE = "cmd_history.txt";
constexpr const char* WHITESPACE = " \t\n\v\f\r";
constexpr size_t HISTORY_LINE_MAX = 1024;
constexpr size_t HISTORY_LOAD_MAX = 64;
// The Lua input hook and ButtonAction a mod can open the console with.
constexpr int INPUT_HOOK_TRIGGERED = 1;
// The ButtonAction a mod can open the console with.
constexpr int ACTION_CONSOLE = 33;
constexpr int SLIDE_FRAMES = 14;
@@ -144,7 +118,7 @@ ConsoleText console_text_get()
// Whether the console may be used: enabled in the options and not in a scored daily run. Netplay is offline.
static bool is_console_allowed()
{
bool isDailyScored = g_game && g_game->dailyChallenge._id != 0 && !g_game->dailyChallenge._isPractice;
bool isDailyScored = g_game && g_game->dailyChallenge.id != 0 && !g_game->dailyChallenge.isPractice;
return !isDailyScored && g_manager->optionsConfig.isDebugConsoleEnabled;
}
+11 -3
View File
@@ -775,7 +775,7 @@ static void macro_run(ConsoleCommand& command)
size_t count = command.words.size();
Console& console = *command.console;
if (name == "lp") reconstruction_missing("Game::ChangeRoom 006fe2f0");
if (name == "lp") return g_game->ChangeRoom(ROOM_LIL_PORTAL_IDX, -1);
for (const ConsoleMacro& macro : MACROS)
{
if (macro.name != name) continue;
@@ -969,10 +969,18 @@ static void reloadwisps_run(ConsoleCommand&)
entity->Init(entity->type, entity->variant, entity->subtype, entity->initSeed);
}
// rewind: restarts the run from the state the Glowing Hourglass keeps, without fading in.
// rewind: rewinds the run to the state the Glowing Hourglass keeps, then restarts it from the save on its seeds,
// without fading in.
static void rewind_run(ConsoleCommand&)
{
reconstruction_missing("Game::rewind 00706020");
Manager& manager = *g_manager;
Game::rewind(nullptr);
Manager::RestartGame();
manager.startSeeds = g_game->seedEffects;
manager.isSaveOnExit = true;
manager.isRerunAvailable = true;
g_game->isInstantFadeIn = true;
}
static void clear_run(ConsoleCommand& command)
+1
View File
@@ -14,6 +14,7 @@
// The cutscenes cutscenes.xml can fill, by id. Id 0 is no cutscene.
constexpr int CUTSCENE_ENTRY_COUNT = 27;
constexpr int CUTSCENE_CREDITS = 2;
constexpr int CUTSCENE_DOGMA = 25;
constexpr int SUBTITLE_LINE_LIMIT = 4;
constexpr int NO_PART = -1;
+293
View File
@@ -0,0 +1,293 @@
#include "daily_challenge.h"
#include "entity_player.h"
#include "game.h"
#include "level.h"
#include "log.h"
#include "platform.h"
#include "room.h"
#include "seeds.h"
#include <algorithm>
#include <array>
#include <chrono>
constexpr uint32_t DAILY_SHIFT_INDEX = 64;
constexpr uint32_t SPECIAL_DAILY_GROUNDHOG = 2;
constexpr uint32_t SPECIAL_DAILY_EASTER = 6;
constexpr uint32_t SPECIAL_DAILY_THANKSGIVING = 16;
constexpr uint32_t SPECIAL_DAILY_G_FUEL = 52;
constexpr const char* G_FUEL_SEED = "XRA8 J6GH";
constexpr int NOVEMBER = 11;
constexpr int EASTER_LAST_YEAR = 3100;
constexpr int DAILY_ROLL_RANGE = 100;
constexpr int SUNDAY_HARD_ODDS = 6;
// The characters a daily may draw (by its seed modulo 20, skipping the Lost, Lazarus risen and the Soul), and the
// stages a daily ends on by two bits of the seed.
constexpr int DAILY_CHARACTER_RANGE = 20;
constexpr std::array<int, 3> DAILY_SKIPPED_CHARACTERS = {PLAYER_LAZARUS2, PLAYER_THELOST, PLAYER_THESOUL};
constexpr std::array<int, 4> DAILY_END_STAGES = {STAGE_DEPTHS_II, STAGE_WOMB_II, STAGE_SHEOL, STAGE_DARK_ROOM};
// The bounds of the rolls out of 100 picking a daily's end stage: on most days, past which the Chest is picked, and
// on Saturdays.
constexpr std::array<int, 5> STAGE_ROLLS = {20, 40, 50, 65, 80};
constexpr int CHEST_ROLL = 89;
constexpr std::array<int, 8> SATURDAY_ROLLS = {15, 30, 40, 50, 60, 70, 80, 90};
// The weekdays that change a daily's rules.
enum DailyWeekday : int
{
WEEKDAY_SUNDAY,
WEEKDAY_MONDAY,
WEEKDAY_TUESDAY,
WEEKDAY_WEDNESDAY,
WEEKDAY_THURSDAY,
WEEKDAY_FRIDAY,
WEEKDAY_SATURDAY
};
// A date's special daily, by month and day (MMDD), besides Easter, Thanksgiving and G FUEL's.
struct HolidayDate
{
uint32_t monthDay = 0;
uint32_t specialDailyId = 0;
};
constexpr std::array<HolidayDate, 50> HOLIDAY_DATES = {{
{101, 1}, {114, 20}, {116, 21}, {127, 22}, {202, 2}, {209, 23}, {211, 24}, {214, 3}, {218, 25},
{302, 4}, {304, 26}, {317, 5}, {320, 27}, {322, 28}, {401, 7}, {410, 29}, {415, 30}, {422, 31},
{504, 32}, {508, 8}, {513, 33}, {517, 34}, {530, 9}, {605, 35}, {618, 36}, {619, 10}, {625, 11},
{702, 37}, {704, 12}, {711, 38}, {713, 39}, {815, 40}, {816, 41}, {822, 42}, {905, 43}, {917, 44},
{922, 45}, {1006, 46}, {1007, 47}, {1031, 13}, {1101, 14}, {1104, 52}, {1111, 15}, {1113, 48}, {1119, 49},
{1205, 17}, {1206, 18}, {1223, 50}, {1225, 19}, {1231, 51},
}};
// The dates G FUEL's daily also fell on.
constexpr std::array<uint32_t, 2> G_FUEL_DATES = {20230324, 20230414};
// What a special daily sets: the character, end stage, path, difficulty and Mega Satan (-1 keeps the drawn one), no
// shooting, and the treasure rooms (and shops) it leaves out.
struct SpecialDailyRules
{
uint32_t id = 0;
int playerType = -1;
int endStage = -1;
int pathType = -1;
int difficulty = -1;
int isMegaSatan = -1;
bool isCantShoot = false;
bool isTreasureFiltered = false;
bool isShopFiltered = false;
};
constexpr std::array<SpecialDailyRules, 51> SPECIAL_DAILY_RULES = {{
{1, 8, 11, 0, 0, 0, true}, {3, 1, 8, -1, 0, 0}, {4, 0, 11, -1, 0, 1}, {5, 2, 11, -1, 0, 1},
{6, 8, 10, 1, 0, 0, false, true}, {7, 14, 11, 1, 0, 1}, {8, 0, 8, -1, 0, 0, false, true},
{9, 10, 11, 1, 0, 0, true}, {10, 2, 8, -1, 0, 0, false, true}, {11, 10, 6, -1, 0, 0}, {12, 6, 11, -1, 0, 1},
{13, 5, 10, 0, 0, 0}, {14, 10, 11, 0, 1, 0}, {15, 10, 11, -1, 1, 1, false, true},
{16, 1, 11, -1, 0, 1}, {17, 0, 10, 0, 0, 0}, {18, 0, 10, 1, 0, 0}, {19, 0, 11, -1, 0, 1},
{20, 0, -1, -1, -1, -1, false, true}, {21, 15, -1, -1, -1, -1, false, true, true},
{22, 4, -1, -1, -1, -1, false, true, true}, {23, 2, -1, -1, -1, -1, false, true}, {24, 1}, {25, 0},
{26, 1, -1, -1, -1, -1, false, true}, {27, 0, -1, -1, -1, -1, false, true}, {28, 0}, {29, 13},
{30, 8, -1, -1, -1, -1, false, true}, {31, 1, -1, -1, -1, -1, false, true}, {32, 0},
{33, 1, -1, -1, -1, -1, false, true}, {34, 0}, {35, 4}, {36, 2}, {37, 16},
{38, 4, -1, -1, -1, -1, false, true}, {39, 8, -1, -1, -1, -1, false, true},
{40, 1, -1, -1, -1, -1, false, true}, {41, 14}, {42, 0}, {43, 1}, {44, 2}, {45, 1}, {46, 3}, {47, 0},
{48, 0, -1, -1, -1, -1, false, true}, {49, 4, -1, -1, -1, -1, false, true}, {50, 3}, {51, 0},
{SPECIAL_DAILY_G_FUEL, 0, 11, 1, 0, 0},
}};
// A YYYYMMDD date as a calendar date, normalized as mktime would.
static std::chrono::sys_days date_days_get(uint32_t date)
{
using namespace std::chrono;
year_month_day day = year{(int)(date / DATE_YEAR)} / month{date % DATE_YEAR / DATE_PART} / 1;
return sys_days{day} + days{date % DATE_PART - 1};
}
// A calendar date as YYYYMMDD.
static uint32_t date_make(std::chrono::sys_days days)
{
std::chrono::year_month_day day{days};
return (uint32_t)(int)day.year() * DATE_YEAR + (uint32_t)day.month() * DATE_PART + (uint32_t)day.day();
}
// Easter Sunday of a year by Gauss's computus, or the epoch past the years it covers (logged).
static uint32_t easter_get(int year)
{
using namespace std::chrono;
if (year > EASTER_LAST_YEAR)
{
log_printf(LOG_WARN, "Cannot calculate Easter date for year %d", year);
return date_make(sys_days{});
}
int golden = year % 19;
int century = year / 100;
int yearInCentury = year % 100;
int epact = (19 * golden + century - century / 4 - (century - (century + 8) / 25 + 1) / 3 + 15) % 30;
int weekday = (32 + 2 * (century % 4) + 2 * (yearInCentury / 4) - epact - yearInCentury % 4) % 7;
int correction = (golden + 11 * epact + 22 * weekday) / 451;
int days = epact + weekday - 7 * correction + 114;
return date_make(sys_days{std::chrono::year{year} / (days / 31) / (days % 31 + 1)});
}
// 00427870 The special daily a YYYYMMDD date falls on: Thanksgiving (the fourth Thursday of November), Easter,
// G FUEL's, one of the year's fixed dates, or 0 for none.
uint32_t holiday_get_current(uint32_t date)
{
using namespace std::chrono;
int year = (int)year_month_day{date_days_get(date)}.year();
sys_days novemberFirst{std::chrono::year{year} / NOVEMBER / 1};
sys_days thanksgiving = novemberFirst + (Thursday - weekday{novemberFirst}) + weeks{3};
if (date == date_make(thanksgiving)) return SPECIAL_DAILY_THANKSGIVING;
if (date == easter_get(year)) return SPECIAL_DAILY_EASTER;
if (std::ranges::find(G_FUEL_DATES, date) != G_FUEL_DATES.end()) return SPECIAL_DAILY_G_FUEL;
auto holiday = std::ranges::find(HOLIDAY_DATES, date % DATE_YEAR, &HolidayDate::monthDay);
return holiday == HOLIDAY_DATES.end() ? 0 : holiday->specialDailyId;
}
// A character's tainted self, or the character itself (logged) for those without one.
static int tainted_id_get(int playerType)
{
if (playerType >= PLAYER_ISAAC && playerType <= PLAYER_THELOST) return playerType + PLAYER_ISAAC_B;
switch (playerType)
{
case PLAYER_LILITH: return PLAYER_LILITH_B;
case PLAYER_KEEPER: return PLAYER_KEEPER_B;
case PLAYER_APOLLYON: return PLAYER_APOLLYON_B;
case PLAYER_THEFORGOTTEN: return PLAYER_THEFORGOTTEN_B;
case PLAYER_BETHANY: return PLAYER_BETHANY_B;
case PLAYER_JACOB: return PLAYER_JACOB_B;
}
log_printf(LOG_ERROR, "GetTaintedId() could not find tainted counterpart to given ePlayerType (%d) \n",
playerType);
return playerType;
}
// The end stage and path a roll out of 100 picks: the Depths, the Womb, the Void on either path, Sheol or the
// Cathedral, or the Dark Room or the Chest past 89.
static void daily_stage_roll(ChallengeParam& params, RNG& rng, int roll)
{
if (roll < STAGE_ROLLS[0]) params.endStage = STAGE_DEPTHS_II;
else if (roll < STAGE_ROLLS[1]) params.endStage = STAGE_WOMB_II;
else if (roll < STAGE_ROLLS[2])
{
params.endStage = STAGE_VOID;
params.pathType = rng.RandomInt(2) == 0 ? PATH_TYPE_CATHEDRAL : PATH_TYPE_SHEOL;
}
else if (roll < STAGE_ROLLS[4])
{
params.endStage = STAGE_SHEOL;
params.pathType = roll < STAGE_ROLLS[3] ? PATH_TYPE_SHEOL : PATH_TYPE_CATHEDRAL;
}
else
{
params.endStage = STAGE_DARK_ROOM;
params.pathType = roll > CHEST_ROLL ? PATH_TYPE_CATHEDRAL : PATH_TYPE_SHEOL;
}
}
// Saturday's end stage and path, a roll out of 100 in tenths (the first two halves of fifteen), none past 89.
static void saturday_stage_roll(ChallengeParam& params, RNG& rng, int roll)
{
if (roll < SATURDAY_ROLLS[0]) params.endStage = STAGE_DEPTHS_II;
else if (roll < SATURDAY_ROLLS[1]) params.endStage = STAGE_WOMB_II;
else if (roll < SATURDAY_ROLLS[2])
{
params.endStage = STAGE_VOID;
params.pathType = rng.RandomInt(2) == 0 ? PATH_TYPE_CATHEDRAL : PATH_TYPE_SHEOL;
}
else if (roll < SATURDAY_ROLLS[6])
{
int band = (roll - SATURDAY_ROLLS[2]) / (SATURDAY_ROLLS[3] - SATURDAY_ROLLS[2]);
params.endStage = band < 2 ? STAGE_SHEOL : STAGE_DARK_ROOM;
params.pathType = band % 2 ? PATH_TYPE_CATHEDRAL : PATH_TYPE_SHEOL;
}
else if (roll < SATURDAY_ROLLS[7])
{
params.pathType = PATH_TYPE_HOME;
params.endStage = STAGE_HOME;
}
}
// 00427290 Applies a special daily's rules over the drawn ones: G FUEL's also plays with its seed and G FUEL's effect.
static void special_daily_apply(DailyChallenge& daily)
{
ChallengeParam& params = daily.params;
auto rules = std::ranges::find(SPECIAL_DAILY_RULES, daily.specialDailyId, &SpecialDailyRules::id);
if (rules == SPECIAL_DAILY_RULES.end()) return;
auto apply = [](int& value, int rule) { value = rule >= 0 ? rule : value; };
apply(params.playerType, rules->playerType);
apply(params.endStage, rules->endStage);
apply(params.difficulty, rules->difficulty);
if (rules->pathType >= 0) params.pathType = (PathType)rules->pathType;
if (rules->isMegaSatan >= 0) params.isMegaSatan = rules->isMegaSatan;
if (rules->isCantShoot) params.isCanShoot = false;
if (rules->isTreasureFiltered) params.roomset.insert(ROOM_TREASURE);
if (rules->isShopFiltered) params.roomset.insert(ROOM_SHOP);
if (daily.specialDailyId != SPECIAL_DAILY_G_FUEL) return;
params.seedEffects = {SEED_G_FUEL};
daily.seed = Seeds::String2Seed(G_FUEL_SEED);
}
// 00426a50 Draws a date's daily from it (Groundhog Day repeats the day before): a character (tainted on some
// Tuesdays and Saturdays), an end stage and path, then the weekday's twist (Sunday's Mega Satan, maybe hard, Monday's
// Repentance path to the Womb, Wednesday's and Friday's (hard) rolls, Thursday's Home, Saturday's anything), the run's
// seed, and the special daily's rules over them.
// The original stops in the debugger on a zero seed. Here the seed just stays zero.
void DailyChallenge::Init(uint32_t dailyDate)
{
seed = 0;
isPractice = false;
params.Reset();
params.isPathTypeSet = true;
specialDailyId = holiday_get_current(dailyDate);
id = dailyDate;
RNG rng = rng_make(specialDailyId == SPECIAL_DAILY_GROUNDHOG ? dailyDate - 1 : dailyDate, DAILY_SHIFT_INDEX);
do params.playerType = (int)(rng.Next() % DAILY_CHARACTER_RANGE);
while (std::ranges::find(DAILY_SKIPPED_CHARACTERS, params.playerType) != DAILY_SKIPPED_CHARACTERS.end());
params.endStage = DAILY_END_STAGES[rng.Next() & 3];
params.pathType = params.endStage < STAGE_SHEOL || (rng.Next() & 1) ? PATH_TYPE_CATHEDRAL : PATH_TYPE_SHEOL;
params.isMegaSatan = false;
params.difficulty = DIFFICULTY_NORMAL;
switch (std::chrono::weekday{date_days_get(dailyDate)}.c_encoding())
{
case WEEKDAY_SUNDAY:
params.endStage = STAGE_DARK_ROOM;
params.isMegaSatan = true;
if (rng.Next() % SUNDAY_HARD_ODDS == 0) params.difficulty = DIFFICULTY_HARD;
break;
case WEEKDAY_MONDAY:
params.pathType = PATH_TYPE_REPENTANCE;
params.endStage = STAGE_WOMB_II;
break;
case WEEKDAY_TUESDAY:
params.playerType = tainted_id_get(params.playerType);
daily_stage_roll(params, rng, (int)(rng.Next() % DAILY_ROLL_RANGE));
break;
case WEEKDAY_WEDNESDAY:
params.endStage = STAGE_VOID;
params.pathType = rng.RandomInt(2) == 0 ? PATH_TYPE_CATHEDRAL : PATH_TYPE_SHEOL;
daily_stage_roll(params, rng, (int)rng.RandomInt(DAILY_ROLL_RANGE));
break;
case WEEKDAY_THURSDAY:
params.pathType = PATH_TYPE_HOME;
params.endStage = STAGE_HOME;
break;
case WEEKDAY_FRIDAY:
params.difficulty = DIFFICULTY_HARD;
daily_stage_roll(params, rng, (int)rng.RandomInt(DAILY_ROLL_RANGE));
break;
case WEEKDAY_SATURDAY:
saturday_stage_roll(params, rng, (int)rng.RandomInt(DAILY_ROLL_RANGE));
if (rng.RandomInt(2) != 0) params.playerType = tainted_id_get(params.playerType);
if (rng.RandomInt(2) != 0) params.difficulty = DIFFICULTY_HARD;
break;
}
seed = rng.Next();
special_daily_apply(*this);
}
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include "challenge_params.h"
#include <cstdint>
// A YYYYMMDD date's factors: the year's, then the month's and the day's part.
constexpr uint32_t DATE_YEAR = 10000;
constexpr uint32_t DATE_PART = 100;
// A day's daily run (DailyChallenge): its date (0 when no daily is played), seed, the special daily the date falls on
// and the rules drawn for it, and whether it is only practiced.
struct DailyChallenge
{
ChallengeParam params;
uint32_t id = 0;
uint32_t seed = 0;
uint32_t specialDailyId = 0;
bool isPractice = false;
void Init(uint32_t dailyDate);
};
uint32_t holiday_get_current(uint32_t date);
+59 -38
View File
@@ -313,10 +313,16 @@ Entity* Entity::GetStatusEffectTarget()
return DoesEntityShareStatus() ? GetLastParent() : this;
}
// 0067a720
float Entity::GetRootParent()
// 0067a720 (misnamed GetRootParent) How many frames a Ludovico water tear's bob lasts: the max fire delay of the
// player its spawners lead back to, plus 8, or 18 for anything else.
float Entity::hydrobounce_period_get()
{
reconstruction_missing("Entity::GetRootParent 0067a720");
constexpr float PERIOD_BASE = 8;
constexpr float PERIOD_FIRE_DELAY = 10;
Entity* root = GetLastSpawner();
float fireDelay = root->type == ENTITY_PLAYER ? static_cast<Entity_Player*>(root)->maxFireDelay : PERIOD_FIRE_DELAY;
return fireDelay + PERIOD_BASE;
}
// Follows a chain of links from start, stopping at the first entity found or where the chain loops.
@@ -568,10 +574,33 @@ bool Entity::is_valid_boss_enemy()
return is_enemy_type(type) && CanShutDoors() && type != ENTITY_DARK_ESAU && !IsFriendly();
}
// 006d8990
// 006d8990 Whether a player may take control of it: a living enemy that is not a fireplace, shopkeeper, TNT, poop,
// prop, minecart or the blood cultist's spawn, nobody controls yet and that has no FLAG_NO_PLAYER_CONTROL. A body of
// segments counts only at its root: a Ring of Flies or Swarm fly's parent NPC, an Army Fly's last enemy parent, or the
// head of a body sharing its status.
// The original reads a versus player's controller as an NPC's. Here a player has none.
bool Entity::is_valid_target()
{
reconstruction_missing("Entity::is_valid_target 006d8990");
bool isEnemy = is_enemy_type(type) && type != ENTITY_FIREPLACE && type != ENTITY_SHOPKEEPER &&
type != ENTITY_MOVABLE_TNT && type != ENTITY_GENERIC_PROP && type != ENTITY_MINECART &&
type != ENTITY_POOP && !(type == ENTITY_CULTIST && variant == CULTIST_BLOOD_SPAWN);
if (!isEnemy || isDead) return false;
Entity* root = this;
auto* npc = static_cast<Entity_NPC*>(this);
if (type == ENTITY_RING_OF_FLIES || (type == ENTITY_SWARM && npc->ParentNPC())) root = npc->ParentNPC();
else if (type == ENTITY_ARMYFLY)
{
Entity* ancestor = GetLastParent();
if (is_enemy_type(ancestor->type)) root = ancestor;
}
else if (type != ENTITY_SWARM)
{
if (DoesEntityShareStatus()) root = GetLastParent();
if (!is_enemy_type(root->type)) root = nullptr;
}
bool isControlled = type != ENTITY_PLAYER && npc->controllerID != -1;
return root == this && !isControlled && !HasEntityFlags(FLAG_NO_PLAYER_CONTROL);
}
// 006a8f80 Whether its config lists anything it can devolve into.
@@ -696,6 +725,17 @@ void Entity::Init(int entityType, int entityVariant, int entitySubType, uint32_t
data_release();
}
// An entity's health on the current floor: its base health, plus its stage health for each stage (to the tenth, a
// fifth less from the fifth) when it has any.
float stage_health_get(float baseHealth, float stageHealth)
{
if (stageHealth <= STAGE_HP_MIN) return baseHealth;
float stage = std::min((float)g_game->stage, STAGE_HP_CAP);
float scale = g_game->stage < STAGE_HP_REDUCED_FROM ? 1 : STAGE_HP_REDUCED_SCALE;
return stage * scale * stageHealth + baseHealth;
}
// 006a98b0 Takes its stats from its config (preloading its resources), or defaults with a log line without one.
void Entity::LoadEntityConfig()
{
@@ -722,13 +762,7 @@ void Entity::LoadEntityConfig()
shadowSize = config->shadowSize;
collisionDamage = config->collisionDamage;
mass = config->mass;
maxHitPoints = config->baseHP;
if (STAGE_HP_MIN < config->stageHP)
{
float stage = std::min((float)g_game->stage, STAGE_HP_CAP);
float scale = g_game->stage < STAGE_HP_REDUCED_FROM ? 1 : STAGE_HP_REDUCED_SCALE;
maxHitPoints = stage * scale * config->stageHP + config->baseHP;
}
maxHitPoints = stage_health_get(config->baseHP, config->stageHP);
size = 0;
sizeMulti = {};
@@ -1223,18 +1257,6 @@ void Entity::SetSpriteOverlayFrame(std::string_view animation, int frame)
// The rest of Entity is not reconstructed yet.
// 0064bb70
void Entity::convert_shot_for_enemy_owner(Entity*)
{
reconstruction_missing("Entity::convert_shot_for_enemy_owner 0064bb70");
}
// 006b5e60
void* Entity::GetData(void*)
{
reconstruction_missing("Entity::GetData 006b5e60");
}
// 006b5f10
void* Entity::GetDebugShape(bool)
{
@@ -1281,20 +1303,19 @@ void Entity::GetNullCapsule(Capsule& outCapsule, std::string_view nullLayerName)
outCapsule = Capsule(vector_add(offset, pos), size, rotation, 1);
}
// 007079c0
void Entity::RemoveWithPoof(Entity*)
// 007079c0 Removes an entity in a pink poof, a boss's death counting for the room. Dogma stays.
void Entity::RemoveWithPoof(Entity* entity)
{
reconstruction_missing("Entity::RemoveWithPoof 007079c0");
constexpr ColorMod POOF_COLOR = {{1, 0.6f, 0.9f, 1}, {0, 0, 0, 0}, {0.2f, 0.15f, 0.18f}};
if (entity->type == ENTITY_DOGMA) return;
Entity* poof =
g_game->Spawn({.position = entity->pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
poof->SetColor(POOF_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
poof->Update();
bool isBossDeath = is_enemy_type(entity->type) && entity->IsBoss();
if (isBossDeath) g_game->room->TriggerBossDeath(*static_cast<Entity_NPC*>(entity));
entity->Remove();
}
// 0085e680
int Entity::IsVulnerableEnemy_lua(lua_State*)
{
reconstruction_missing("Entity::IsVulnerableEnemy_lua 0085e680");
}
// 008c5cf2
void Entity::KillWithSource()
{
reconstruction_missing("Entity::KillWithSource 008c5cf2");
}
+24 -5
View File
@@ -3,6 +3,7 @@
#include "anm2.h"
#include "classes.h"
#include "seeds.h"
#include <array>
#include <bitset>
#include <cstdint>
#include <string_view>
@@ -281,6 +282,7 @@ enum EntityType : int
ENTITY_POOFER = 892,
ENTITY_BALL_AND_CHAIN = 893,
ENTITY_REAP_CREEP = 900,
ENTITY_LIL_BLUB = 901,
ENTITY_VISAGE = 903,
ENTITY_SIREN = 904,
ENTITY_HERETIC = 905,
@@ -313,6 +315,8 @@ enum EntityType : int
// The types an enemy can have, both ends included.
constexpr int ENTITY_FIRST_ENEMY = 10;
constexpr int ENTITY_LAST_ENEMY = 999;
// Two entities closer than this are not pushed apart.
constexpr float PUSH_MIN_DISTANCE = 0.0001f;
// An entity's fall into a pit (pitfallState): falling, at the bottom, climbing back out, or gone through to another
// room.
@@ -328,6 +332,20 @@ enum PitfallState : int
// A color offset step: one 255th.
constexpr float COLOR_OFFSET_UNIT = 0.003921569f;
// Angelic Prism's four tints of the tears, bombs and knives it splits (Color's 255th offsets), and the turns and tints
// of the lasers it fans out.
constexpr std::array<ColorMod, 4> PRISM_COLORS = {{
{{1, 1, 1, 1}, {0, 0, 0, 0}, {155 * COLOR_OFFSET_UNIT, -100 * COLOR_OFFSET_UNIT, -100 * COLOR_OFFSET_UNIT}},
{{1, 1, 1, 1}, {0, 0, 0, 0}, {138 * COLOR_OFFSET_UNIT, 155 * COLOR_OFFSET_UNIT, -100 * COLOR_OFFSET_UNIT}},
{{1, 1, 1, 1}, {0, 0, 0, 0}, {-100 * COLOR_OFFSET_UNIT, 155 * COLOR_OFFSET_UNIT, -67 * COLOR_OFFSET_UNIT}},
{{1, 1, 1, 1}, {0, 0, 0, 0}, {-100 * COLOR_OFFSET_UNIT, 103 * COLOR_OFFSET_UNIT, 155 * COLOR_OFFSET_UNIT}}}};
constexpr std::array<float, 4> PRISM_LASER_SPREAD = {-30, -10, 10, 30};
constexpr std::array<ColorMod, 4> PRISM_LASER_COLORS = {{
{{1, 1, 1, 1}, {0, 0, 0, 0}, {0, 0, 0}},
{{1, 2, 1, 1}, {0, 0, 0, 0}, {100 * COLOR_OFFSET_UNIT, 200 * COLOR_OFFSET_UNIT, 0}},
{{1, 2, 1, 1}, {0, 0, 0, 0}, {-200 * COLOR_OFFSET_UNIT, 200 * COLOR_OFFSET_UNIT, 100 * COLOR_OFFSET_UNIT}},
{{1, 1, 2, 1}, {0, 0, 0, 0}, {-200 * COLOR_OFFSET_UNIT, 100 * COLOR_OFFSET_UNIT, 200 * COLOR_OFFSET_UNIT}}}};
// Gigante Bean's push of every enemy a doubled fart hits, away from the fart.
constexpr float GIGANTE_KNOCKBACK_SPEED = 8;
constexpr int GIGANTE_KNOCKBACK_FRAMES = 18;
@@ -355,6 +373,7 @@ enum EntityFlag : uint64_t
FLAG_NO_REMOVE_ON_TEX_RENDER = 1ull << 17,
FLAG_NO_DEATH_TRIGGER = 1ull << 18,
FLAG_NO_SPIKE_DAMAGE = 1ull << 19,
FLAG_ITEM_SHOULD_DUPLICATE = 1ull << 19,
FLAG_BOSSDEATH_TRIGGERED = 1ull << 20,
FLAG_DONT_OVERWRITE = 1ull << 21,
FLAG_SPAWN_STICKY_SPIDERS = 1ull << 22,
@@ -822,7 +841,7 @@ struct Entity
Entity* GetLastSpawner();
Entity* GetPlayerAncestor();
Entity* GetStatusEffectTarget();
float GetRootParent();
float hydrobounce_period_get();
bool IsDescendantOf(Entity* ancestor);
bool HasCommonParentWithEntity(Entity* other);
bool is_same_segmented_body(Entity* other);
@@ -877,22 +896,18 @@ struct Entity
Entity_Effect* MakeBloodPoof(const Vector& position, const ColorMod& poofColor, float scale);
Entity_Effect* MakeBloodPoofAtPos(const ColorMod& poofColor, float scale);
Entity_NPC* GiveMinecart(const Vector& position, const Vector& cartVelocity);
void convert_shot_for_enemy_owner(Entity* shot);
WaterClipInfo GetWaterClipInfo();
void water_ripples_update();
void* GetDebugShape(bool isUnknown);
void* GetData(void* outRef);
Vector GetNullOffset(std::string_view nullLayerName);
void GetNullCapsule(Capsule& outCapsule, std::string_view nullLayerName);
void SetSpriteFrame(std::string_view animation, int frame);
void SetSpriteOverlayFrame(std::string_view animation, int frame);
void KillWithSource();
static void ReleaseLuaRef(Entity* entity);
static void RemoveWithPoof(Entity* entity);
static void DestroyRockGridAt(const Vector& position, GridEntityDesc* desc, Entity* source, int backdropType);
static int IsVulnerableEnemy_lua(lua_State* state);
private:
void data_release();
@@ -906,6 +921,10 @@ private:
void magnet_pull_update();
};
// The blood cultist's spawn (885.10), which nothing targets.
constexpr int CULTIST_BLOOD_SPAWN = 10;
void hit_list_insert(std::vector<uint32_t>& hitList, Entity& entity);
float stage_health_get(float baseHealth, float stageHealth);
Vector render_position_get(const Vector& world, RenderSnap snap);
int render_z_get(float depth);
-1
View File
@@ -104,7 +104,6 @@ constexpr int VISAGE_MASK_VARIANT = 10;
constexpr float LOW_COLLIDER_SLOW = 0.2f;
constexpr float LOW_BOMB_SLOW = 0.5f;
constexpr float PLAYER_PUSH = 0.4f;
constexpr float PUSH_MIN_DISTANCE = 0.0001f;
// Hydrobounce's bounce: how much of the fall it keeps, its splash's reach and share of the damage, and its sound.
constexpr float BOUNCE_KEEP = -0.7f;
-1
View File
@@ -77,7 +77,6 @@ constexpr int NULL_TOOTH_AND_NAIL = 59;
constexpr std::array<int, 10> SHOT_ANCHORED_TYPES = {23, 25, 41, 55, 62, 91, 254, 283, 245, 292};
// Two entities closer than this are not pushed apart. A player or the Punching Bag is not pushed into a wall.
constexpr float PUSH_MIN_DISTANCE = 0.0001f;
constexpr float PLAYER_PUSH_SHARE = 0.5f;
constexpr float BEAST_PUSH_DAMPING = 0.25f;
+88 -23
View File
@@ -67,7 +67,6 @@ constexpr std::array<int, 7> STATIC_OBSTACLE_TYPES = {292, 245, 302, 42, 201, 20
constexpr int STATIC_OBSTACLE_EXTRA = 202;
// The items, trinkets and player kinds the combat code reads (Lua's ids).
constexpr int COLLECTIBLE_MOMS_HEELS = 30;
constexpr int COLLECTIBLE_ARIES = 300;
constexpr int NULLITEM_TOOTH_AND_NAIL = 59;
constexpr int PLAYER_FORM_COUNT_NEEDED = 3;
@@ -115,7 +114,6 @@ constexpr uint32_t TEAR_BOUNCE_PIERCE_MASK = 3;
constexpr int INFAMY_CHANCE = 2;
constexpr int INFAMY_CHANCE_VERSUS = 4;
constexpr int INFAMY_FLASH_FRAMES = 15;
constexpr int COLOR_PRIORITY_TOP = 255;
constexpr float MULLIGAN_FLY_CHANCE = 0.166f;
constexpr float GUPPY_FLY_CHANCE = 0.66f;
constexpr float LASTING_BEAM_FLY_SCALE = 0.1f;
@@ -123,6 +121,17 @@ constexpr float LASTING_BEAM_FLY_SCALE = 0.1f;
// Entity_Player::HandleCollision: the contact damage the items deal.
constexpr int CONTACT_COUNTDOWN = 15;
constexpr int SUPLEX_STATE_PASSING = 3;
// Mega Mush's stomp (weaker in versus) and the suplex grab: the fireplace it snuffs, its aim's time and its scamper's
// pitch. Breath of Life's burst: its damage, more per floor deep, and its size.
constexpr float MEGA_MUSH_STOMP = 80;
constexpr float MEGA_MUSH_STOMP_VERSUS = 10;
constexpr float SUPLEX_FIREPLACE_DAMAGE = 1000;
constexpr int SUPLEX_GRAB_AIM_FRAMES = 60;
constexpr float SUPLEX_GRAB_PITCH_MIN = 0.9f;
constexpr float SUPLEX_GRAB_PITCH_RANGE = 0.2f;
constexpr float BREATH_BURST_DAMAGE = 15;
constexpr float BREATH_BURST_DAMAGE_PER_STAGE = 2.1f;
constexpr float BREATH_BURST_SIZE = 80;
constexpr float HEELS_DAMAGE = 12;
constexpr float HEELS_DAMAGE_VERSUS = 2;
constexpr float VIRUS_DAMAGE = 12;
@@ -171,8 +180,6 @@ constexpr float GIB_SPEED_MIN = 2;
constexpr float GIB_SPEED_RANGE = 4;
constexpr float GIB_LIFT = 0.5f;
constexpr float GIB_WORM_HEIGHT = -40;
constexpr float DUST_SPEED = 5;
constexpr float DUST_RADIUS = 20;
constexpr float DUST_ALPHA_MIN = 0.2f;
constexpr float DUST_ALPHA_RANGE = 0.5f;
constexpr float DROP_SPEED = 10;
@@ -421,7 +428,7 @@ static void burst_drops_spawn(Entity& entity, int gibsAmount)
drop->rotation = (random_unit() * DROP_SPIN_RANGE + DROP_SPIN_MIN) * side;
float alpha = (random_unit() * DROP_ALPHA_RANGE + DROP_ALPHA_MIN) * blood._alpha;
drop->SetColor({{blood._red, blood._green, blood._blue, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, -1,
COLOR_PRIORITY_TOP, false, true);
COLOR_PRIORITY_DEFAULT, false, true);
if (!isHuge) drop->SetTimeout((int)(Random() % GIB_TIMEOUT_RANGE) + GIB_TIMEOUT_MIN);
else
{
@@ -484,7 +491,7 @@ void Entity::BloodExplode()
if (type == ENTITY_BOMB || type == ENTITY_PICKUP || HasEntityFlags(FLAG_NO_BLOOD_SPLASH)) return;
Entity_Effect* splat = effect_spawn(EFFECT_BLOOD_SPLAT, 0, pos, {}, nullptr, Random());
splat->SetColor(splatColor, -1, COLOR_PRIORITY_TOP, false, true);
splat->SetColor(splatColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
if (g_game->seedEffects.HasSeedEffect(SEED_EXTRA_BLOOD))
splat->sprite.scale = vector_make(EXTRA_BLOOD_SPLAT_SCALE, EXTRA_BLOOD_SPLAT_SCALE);
splat->Update();
@@ -530,7 +537,7 @@ static void gib_dust_spawn(const GibSpawn& gibs, int half)
dust->rotation = (random_unit() * DROP_SPIN_RANGE + DROP_SPIN_MIN) * spin_side(*dust, gibs.position, velocity);
dust->SetTimeout((int)(Random() % GIB_TIMEOUT_RANGE) + GIB_TIMEOUT_MIN);
float alpha = random_unit() * DUST_ALPHA_RANGE + DUST_ALPHA_MIN;
dust->SetColor({{1, 1, 1, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, -1, COLOR_PRIORITY_TOP, false, true);
dust->SetColor({{1, 1, 1, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, -1, COLOR_PRIORITY_DEFAULT, false, true);
dust->Update();
}
}
@@ -570,14 +577,14 @@ static Entity_Effect* gib_blood_spawn(const GibSpawn& gibs, int kind, uint32_t s
Entity_Effect* gib = gib_fling(gibs, EFFECT_BLOOD_PARTICLE, kind, seed, speed);
if (!gibs.spawner || !gibs.spawner->HasEntityFlags(FLAG_POISON))
{
gib->SetColor(gibs.color, -1, COLOR_PRIORITY_TOP, false, true);
gib->SetColor(gibs.color, -1, COLOR_PRIORITY_DEFAULT, false, true);
gib->splatColor = gibs.color;
}
else
{
ColorMod tinted = gibs.color;
color_multiply(tinted, POISON_GIB_TINT);
gib->SetColor(kind == 0 ? tinted : gibs.color, -1, COLOR_PRIORITY_TOP, false, true);
gib->SetColor(kind == 0 ? tinted : gibs.color, -1, COLOR_PRIORITY_DEFAULT, false, true);
gib->splatColor = tinted;
}
if (kind == GIB_KIND_BONE) gib->AddEntityFlags(FLAG_NO_BLOOD_SPLASH);
@@ -618,7 +625,7 @@ static Entity_Effect* gib_spawn(const GibSpawn& gibs, int kind)
if (kind == GIB_KIND_ROCK_SMALL)
{
Entity_Effect* tooth = gib_scatter(gibs, EFFECT_TOOTH_PARTICLE, draw);
tooth->SetColor(TOOTH_COLOR, -1, COLOR_PRIORITY_TOP, false, true);
tooth->SetColor(TOOTH_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
return tooth;
}
if (kind == GIB_KIND_CHAIN) return gib_scatter(gibs, EFFECT_CHAIN_GIB, draw);
@@ -733,7 +740,7 @@ static TearContact tear_player_contact(Entity_Tear& tear, Entity_Player& player)
int infamyChance = g_game->deathmatchManager.is_active() ? INFAMY_CHANCE_VERSUS : INFAMY_CHANCE;
if (!player.HasCollectible(COLLECTIBLE_INFAMY) || random_below(infamyChance) != 0) return TEAR_CONTACT_HIT;
player.SetColor(INFAMY_COLOR, INFAMY_FLASH_FRAMES, COLOR_PRIORITY_TOP, true, true);
player.SetColor(INFAMY_COLOR, INFAMY_FLASH_FRAMES, COLOR_PRIORITY_DEFAULT, true, true);
tear.Kill(EntityRef(&player));
return TEAR_CONTACT_PASS;
}
@@ -994,10 +1001,10 @@ bool Entity_Tear::HandleCollision(Entity* collider, bool isLow)
tear_hit_push(*this, *collider, owner);
}
ApplyTearFlagEffects(collider, pos, tearFlags, this, collisionDamage);
if (variant == TEAR_ERASER && collider->IsVulnerableEnemy(nullptr) && (!collider->IsBoss() || collider->HasMortalDamage()))
reconstruction_missing("Entity_Tear::HandleCollision 00673660: the Eraser erasing an enemy");
bool isErasable = collider->IsVulnerableEnemy(nullptr) && (!collider->IsBoss() || collider->HasMortalDamage());
if (variant == TEAR_ERASER && isErasable && enemy_erase(*collider)) npc_sound_play(SOUND_ERASER_HIT, 1, 2, 1);
if (tearFlags[TEAR_TELEPORT] && collider->IsVulnerableEnemy(nullptr) && !collider->IsBoss())
reconstruction_missing("Entity_Tear::HandleCollision 00673660: a teleporting tear's reroll");
tear_hit_teleport(*collider);
if (isExplosive)
{
@@ -1124,9 +1131,44 @@ static float player_contact_damage(Entity_Player& player, Entity& collider, bool
return damage;
}
// Part of 0078e1f0: the player's ways of touching: shoving an iced enemy, Tainted Magdalene's hug, and those not
// written yet: Mega Mush's stomp, Tainted Soul grabbing her body and the suplex grab.
static void player_contact_missing_check(Entity_Player& player, Entity& collider)
// Part of 0078e1f0: Mega Mush's stomp crushes what the giant touches once each: an enemy (unless friendly), a slot or a
// pickup, the last two blown up as well.
static void mega_mush_stomp(Entity_Player& player, Entity& collider)
{
bool isEnemy = collider.IsEnemy() && !collider.HasEntityFlags(FLAG_FRIENDLY);
if (!isEnemy && !collider.is_slot() && !collider.is_pickup()) return;
if (EntityList::HitListContains(player.contactHitList, collider)) return;
hit_list_insert(player.contactHitList, collider);
float damage = isEnemy && g_game->deathmatchManager.is_active() ? MEGA_MUSH_STOMP_VERSUS : MEGA_MUSH_STOMP;
uint64_t flags = isEnemy ? DAMAGE_CRUSH : DAMAGE_CRUSH | DAMAGE_EXPLOSION;
collider.TakeDamage(damage, flags, EntityRef(&player), HIT_COUNTDOWN);
}
// Part of 0078e1f0: Suplex!'s dash grabs what it runs into: shots pass, a fireplace is snuffed out, and an enemy or a
// bomb is lifted for the aim. Whether the collision is ignored for good.
static bool suplex_grab(Entity_Player& player, Entity& collider)
{
if (collider.type == ENTITY_PROJECTILE) return true;
if (!collider.IsEnemy() && !collider.is_bomb()) return false;
if (collider.type == ENTITY_FIREPLACE)
{
collider.TakeDamage(SUPLEX_FIREPLACE_DAMAGE, 0, EntityRef(&player), HIT_COUNTDOWN);
return false;
}
if (!player.TryHoldEntity(&collider)) return false;
player.itemState = COLLECTIBLE_SUPLEX;
player.suplexAimCountdown = SUPLEX_GRAB_AIM_FRAMES;
player.suplexState = SUPLEX_AIMING;
npc_sound_play(SOUND_SUPLEX_GRAB, 1, 2, 1);
npc_sound_play(SOUND_SCAMPER, 1, 2, random_unit() * SUPLEX_GRAB_PITCH_RANGE + SUPLEX_GRAB_PITCH_MIN);
return true;
}
// Part of 0078e1f0: the player's ways of touching before it hurts anything: shoving an iced enemy, Tainted Magdalene's
// hug and Mega Mush's stomp.
static void player_contact_touch(Entity_Player& player, Entity& collider)
{
bool isEnemyLike = Entity::is_enemy_type(collider.type) ||
(g_game->deathmatchManager.is_active() && collider.type == ENTITY_PLAYER);
@@ -1139,9 +1181,7 @@ static void player_contact_missing_check(Entity_Player& player, Entity& collider
collider.AddKnockback(EntityRef(&player), vector_scale(push, ICE_SHOVE_SPEED), ICE_SHOVE_FRAMES, true);
}
tainted_magdalene_hug(player, collider);
if (player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH))
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: Mega Mush's stomp");
if (player.suplexState == 1) reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: the suplex grab");
if (player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH)) mega_mush_stomp(player, collider);
}
// Part of 0078e1f0: The Virus and Serpent's Kiss poison an enemy touched for 60 frames at 2 plus a twentieth of the
@@ -1163,6 +1203,25 @@ static void virus_poison_apply(Entity_Player& player, Entity& collider)
false);
}
// Part of 0078e1f0: Breath of Life's holy burst where the player's edge meets the enemy it hurt, stronger deeper down
// (none while the player keeps Judas' Book of Belial), and a short spell unhurt.
static void breath_of_life_burst(Entity_Player& player, Entity& collider)
{
float damage = (float)g_game->stage_depth_get() * BREATH_BURST_DAMAGE_PER_STAGE + BREATH_BURST_DAMAGE;
Vector edge = vector_add(player.pos, vector_resized(vector_sub(collider.pos, player.pos), player.size));
if (!player.HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE))
{
Entity* burst = g_game->Spawn({.position = edge, .spawner = &player, .type = ENTITY_EFFECT,
.variant = EFFECT_CRACK_THE_SKY, .seed = Random()});
burst->parent = &player;
burst->SetCollisionDamage(damage);
burst->SetSize(BREATH_BURST_SIZE, vector_make(-1, -1), -1);
burst->subtype = 1;
}
if (player.damageCooldown < 1) player.AddEntityFlags(FLAG_NO_DAMAGE_BLINK);
player.damageCooldown = std::max(player.damageCooldown, CONTACT_COUNTDOWN);
}
// 0078e1f0 Touches another entity, after a mod's MC_PRE_PLAYER_COLLISION: mid-suplex it passes enemies and shots,
// it hurts a vulnerable enemy by its items' contact damage, poisons with The Virus or Serpent's Kiss, and a thrown
// Tainted Forgotten slows on enemies. Tainted Forgotten's soul picks the body up. Whether the collision is ignored, which a pony's dash makes it.
@@ -1172,7 +1231,7 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
if (lua == LUA_RESULT_TRUE) return true;
if (lua == LUA_RESULT_FALSE) return false;
player_contact_missing_check(*this, *collider);
player_contact_touch(*this, *collider);
if (playerType == PLAYER_THESOUL_B && collider->type == ENTITY_PLAYER &&
static_cast<Entity_Player*>(collider)->playerType == PLAYER_THEFORGOTTEN_B)
{
@@ -1182,6 +1241,7 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
return true;
TryHoldEntity(collider);
}
if (suplexState == SUPLEX_DASHING && suplex_grab(*this, *collider)) return true;
if (suplexState >= SUPLEX_STATE_PASSING && (collider->IsEnemy() || collider->type == ENTITY_PROJECTILE)) return true;
bool isIgnored = false;
@@ -1191,7 +1251,7 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
bool isBreath = false;
float damage = player_contact_damage(*this, *collider, isBreath);
if (damage > 0 && collider->TakeDamage(damage, DAMAGE_COUNTDOWN, EntityRef(this), CONTACT_COUNTDOWN) && isBreath)
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: Breath of Life's burst");
breath_of_life_burst(*this, *collider);
}
bool isPoisoning = HasCollectible(COLLECTIBLE_VIRUS) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_VIRUS) ||
HasCollectible(COLLECTIBLE_SERPENTS_KISS);
@@ -1202,6 +1262,11 @@ bool Entity_Player::HandleCollision(Entity* collider, bool isLow)
!collider->IsFriendly())
velocity = vector_scale(velocity, SLOW_ON_CONTACT);
if (collider->IsEnemy() && !collider->HasEntityFlags(FLAG_CHARM) && temporaryEffects.HasCollectibleEffect(COLLECTIBLE_MARS))
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: Mars' dash impact");
{
temporaryEffects.RemoveCollectibleEffect(COLLECTIBLE_MARS, -1);
velocity = vector_scale(vector_normalized(vector_sub(pos, collider->pos)), vector_length(velocity));
marsDashDirection = -1;
dash_impact();
}
return isIgnored;
}
+1 -10
View File
@@ -67,7 +67,6 @@ constexpr float PAUSE_VELOCITY_DECAY = 0.6f;
// The variants the behaviour tables can index. Past the last vanilla one (the gun) Init and Update run only their
// shared parts, as the original's switches do for a mod's variants.
constexpr int EFFECT_VARIANT_LIMIT = 256;
constexpr int EFFECT_VANILLA_LAST = EFFECT_GUN;
template <size_t N>
static bool is_listed(const std::array<int, N>& list, int value)
@@ -298,7 +297,6 @@ void Entity_Effect::Init(int entityType, int entityVariant, int entitySubType, u
if (behaviour->init) behaviour->init(*this);
}
else if (is_combat_effect(variant)) combat_effect_init(*this);
else if (variant <= EFFECT_VANILLA_LAST) reconstruction_missing("Entity_Effect::Init 005cdb20: this effect variant");
if (!isExists) return;
sprite.LoadGraphics();
@@ -355,13 +353,12 @@ void Entity_Effect::Update()
if (behaviour->update) end = behaviour->update(*this);
}
else if (is_combat_effect(variant)) end = combat_effect_update(*this);
else if (variant <= EFFECT_VANILLA_LAST) reconstruction_missing("Entity_Effect::Update 005d4380: this effect variant");
if (end == EFFECT_UPDATE_RETURN) return;
if (timeout > 0 && --timeout < 1) isDead = true;
pausePosition = pos;
if (spawnerType == ENTITY_FAMILIAR && spawnerVariant == FAMILIAR_CREEP_WAVE && is_listed(WAVE_CHAIN_CREEPS, variant))
update_wave_chain();
wave_chain_update(*this);
lua_engine_get().PostEffectUpdate(this);
}
@@ -440,12 +437,6 @@ void Entity_Effect::FollowParent(Entity* newParent)
parentOffset = vector_make(pos.x - newParent->pos.x, pos.y - newParent->pos.y);
}
// Lil Spewer's creep wave, written as wave_chain_update in familiar_babies.cpp.
void Entity_Effect::update_wave_chain()
{
wave_chain_update(*this);
}
// 006073f0 Luna's blessing half a second after its moonlight is touched: the timer's player, still alive, flashes
// bright, gains Luna's secondary effect and a soul heart, holding the item up.
void Entity_Effect::moonlight_timer_callback(Entity_Effect* timer)
+8 -2
View File
@@ -50,10 +50,16 @@ constexpr int PULLING_PURPLE = 0;
constexpr int PULLING_GREY = 1;
constexpr int PULLING_RED = 2;
// A blood explosion's subtypes the shots and bosses splash with: a burst, a splash and a big splash.
// A blood explosion's subtypes the shots and bosses splash with: a burst, a splash, a big splash and a flame.
constexpr int BLOOD_EXPLOSION_BURST = 2;
constexpr int BLOOD_EXPLOSION_SPLASH = 3;
constexpr int BLOOD_EXPLOSION_SPLASH_BIG = 4;
constexpr int BLOOD_EXPLOSION_FLAME = 5;
// The dust clouds thrown up by doors, debris and falls: their speed, spread and least spin.
constexpr float DUST_SPEED = 5;
constexpr float DUST_RADIUS = 20;
constexpr float DUST_SPIN_MIN = 2;
// Dogma's blackhole (171): its sparks (subtype 1) and swirls (2), and its states while open and closing.
constexpr int BLACKHOLE_SPARK = 1;
@@ -305,6 +311,7 @@ struct Entity_Effect : Entity
std::shared_ptr<ExtraData> extraData;
std::array<uint32_t, 4> varData{};
std::vector<uint32_t> hitList;
GridEntityDesc gridDesc{};
Vector parentOffset{};
float baseDamage = 0;
float baseScale = 0;
@@ -339,7 +346,6 @@ struct Entity_Effect : Entity
void FollowParent(Entity* parent);
static bool rift_attract_filter(int first, int second);
void update_mr_me();
void update_wave_chain();
static void moonlight_timer_callback(Entity_Effect* timer);
static bool IsPlayerCreep(int effectVariant);
static Entity_Effect* CreateTimer(void* fn, uint32_t delay, uint32_t times, bool isPersistent);
+1 -2
View File
@@ -200,7 +200,6 @@ static void generic_tracer_render(Entity_Effect& tracer, const Vector& offset)
// spawner's colour at its share, which lingers its state's frames after it. An eruption throws up a lava ball from
// the lava's line at 20 a frame, with a blast and a shake.
constexpr int LAVA_PATH_LEVEL = 900;
constexpr float LAVA_LINE_ABOVE = 30;
constexpr float LAVA_BALL_SPEED = -20;
constexpr float LAVA_BALL_ACCEL = 0.5f;
constexpr int LAVA_SHAKE = 6;
@@ -224,7 +223,7 @@ static void lava_spawner_init(Entity_Effect& lava)
// An eruption at the spawner's column: a lava ball thrown up from the lava's line, a blast and a shake.
static void lava_erupt(Entity_Effect& lava)
{
Vector line = vector_make(lava.pos.x, g_game->room->bottomRightPos.y - LAVA_LINE_ABOVE);
Vector line = vector_make(lava.pos.x, g_game->room->get_lava_line_y());
effect_sound_play(SOUND_BEAST_LAVABALL_RISE);
uint32_t seed = Random();
auto* ball = static_cast<Entity_Projectile*>(g_game->Spawn({.position = line,
-2
View File
@@ -30,8 +30,6 @@ constexpr int PORTAL_SWIRL_LAYERS = 3;
constexpr float PORTAL_SWIRL_SPAN = 30;
constexpr float PORTAL_SWIRL_MAX = 1.5f;
// A portal's room: its kind by subtype (PORTAL_ROOM_TYPES, else a normal room), or one room past 1000.
constexpr int PORTAL_ROOM_INDEX_BASE = 1000;
constexpr int PORTAL_GIVEN_ROOM = 900;
// The colours of the portals to a room of a kind, and of the orange womb hole and its wisp.
+3 -5
View File
@@ -112,7 +112,6 @@ enum EntryAchievement : int
ACHIEVEMENT_SHOPKEEPER_SECRET = 243,
ACHIEVEMENT_SHOPKEEPER_SPECIAL = 247,
ACHIEVEMENT_DARK_ROOM_END = 320,
ACHIEVEMENT_SUPER_TINTED_ROCK = 323,
ACHIEVEMENT_HEART_SCARED = 328,
ACHIEVEMENT_KEY_CHARGED = 333,
ACHIEVEMENT_ENEMY_VARIANTS = 348,
@@ -155,7 +154,6 @@ constexpr float ELLIPSE_MINES_SPREAD_Y = 0.5f;
constexpr int ROCK_ROLLS = 1001;
constexpr int ROCK_BOMB_ROLLS = 10;
constexpr int ROCK_ALT_ROLLS = 16;
constexpr int SUPER_TINTED_ODDS = 20;
constexpr int ELLIPSE_ODDS = 10;
constexpr int CORN_ODDS = 40;
constexpr int FIREPLACE_RED_ODDS = 40;
@@ -543,10 +541,10 @@ static void trapdoor_transform(Room& room, RoomEntry& entry, int stage, RNG& rng
if (game.currentRoomIdx == ROOM_GENESIS_IDX && !game.IsNextStageAvailable()) stairs();
return;
}
bool isBackwards = game.gameStateFlags & 1ull << LEVEL_GAME_STATE_BACKWARDS_PATH;
bool isBackwards = game.gameStateFlags & 1ull << GAME_STATE_BACKWARDS_PATH;
if (game.stage >= 1 && game.stage <= STAGE_BACKWARDS_LAST && isBackwards) return heaven();
bool isInChallenge = game.challenge != 0 || game.dailyChallenge._id != 0;
bool isInChallenge = game.challenge != 0 || game.dailyChallenge.id != 0;
bool isCathedralAllowed = !isInChallenge || game.GetChallengeParams().pathType == PATH_TYPE_CATHEDRAL;
bool isCathedralForced = isInChallenge && game.GetChallengeParams().pathType == PATH_TYPE_CATHEDRAL;
if (stage == STAGE_DARK_ROOM && room.roomType == ROOM_ERROR)
@@ -603,7 +601,7 @@ static bool enemy_variant_transform(Room& room, RoomEntry& entry, int stage, int
switch (entry.type)
{
case ENTITY_STONEY:
if (game.dailyChallenge._specialDailyId == SPECIAL_DAILY_GOLDEN_FATTY ||
if (game.dailyChallenge.specialDailyId == SPECIAL_DAILY_GOLDEN_FATTY ||
game.challenge == CHALLENGE_GOLDEN_FATTY)
return roll(true, 5, 1, 10);
return false;
+21 -5
View File
@@ -1,6 +1,7 @@
#include "entity_familiar.h"
#include "active_items.h"
#include "boss_ai.h"
#include "color_stack.h"
#include "entity_effect.h"
#include "entity_list.h"
#include "entity_player.h"
@@ -68,6 +69,11 @@ constexpr float BLUE_BABY_SOUL_DRAG = 0.8f;
constexpr int DRY_BABY_GIANTBOOK = 1;
constexpr int MONGO_MIMIC_DEMON_BABY = 1;
// Tainted Lazarus's hologram draws its familiars faint, their alpha drawn from a generator of their own.
constexpr RNG HOLOGRAM_FLICKER = {0x194fc4ad, 4, 3, 27};
constexpr float HOLOGRAM_FLICKER_SPREAD = 0.15f;
constexpr float HOLOGRAM_FLICKER_MIN = 0.05f;
// The followers that shoot, and the orbitals that only circle.
constexpr int SHOOTER_VARIANTS[] = {1, 4, 5, 6, 7, 9, 10, 11, 12, 54, 81, 92, 97, 209, 220};
constexpr int ORBITAL_VARIANTS[] = {30, 31, 32, 33, 35, 44, 60, 65, 69, 84, 117, 121, 126};
@@ -735,7 +741,7 @@ static void abel_update(Entity_Familiar& abel)
abel.Shoot();
}
// The behaviours of 0061da10 by variant. The familiars not reconstructed yet stop the game.
// The behaviours of 0061da10 by variant. A variant the game does not know (a mod's) does nothing here.
void Entity_Familiar::variant_update()
{
if (familiar_listed(SHOOTER_VARIANTS, variant))
@@ -956,12 +962,15 @@ void Entity_Familiar::variant_update()
case LIL_SPEWER: return lil_spewer_update(*this);
case MINISAAC: return minisaac_update(*this);
case STAR_OF_BETHLEHEM: return star_of_bethlehem_update(*this);
case BUDDY_IN_A_BOX: return buddy_in_a_box_update(*this);
case BABY_PLUM: return baby_plum_update(*this);
case MULTIDIMENSIONAL_BABY: return multidimensional_baby_update(*this);
case ANGELIC_PRISM: return angelic_prism_update(*this);
case BUMBO: return bumbo_update(*this);
case DAMOCLES: return ai_shadow_intruder_damocles(false);
case VANISHING_TWIN: return vanishing_twin_update(*this);
case FRUITY_PLUM:
return fruity_plum_update(*this);
default: reconstruction_missing("Entity_Familiar::Update 0061da10 (this familiar's behaviour)");
}
}
@@ -1051,7 +1060,7 @@ void Entity_Familiar::Interpolate()
// 00624e10 Draws a familiar with its charge bar. Isaac's body draws its parts, a detached head its player's head, Gello
// its cord first, Samson's Chains and Gemini hang their links, a locust its shot sprites and an item wisp its item's
// icon. Tainted Lazarus's hologram stops the game.
// icon. Tainted Lazarus's hologram draws them all faint and flickering.
void Entity_Familiar::Render(const Vector& offset)
{
if (IsLilithBirthrightIncubus())
@@ -1059,8 +1068,14 @@ void Entity_Familiar::Render(const Vector& offset)
Entity* whip = get_incubus_umbilical_whip();
if (!whip || !whip->isVisible) return;
}
if (player && player->IsHologram())
return reconstruction_missing("Entity_Familiar::Render 00624e10 (Tainted Lazarus's hologram)");
bool isHologram = player && player->IsHologram();
if (isHologram)
{
static RNG flicker = HOLOGRAM_FLICKER;
color_stack_push({{1, 1, 1, flicker.RandomFloat() * HOLOGRAM_FLICKER_SPREAD + HOLOGRAM_FLICKER_MIN},
{0, 0, 0, 0},
{0, 0, 0}});
}
if (variant == SAMSONS_CHAINS) samsons_chains_links_place(*this);
else if (variant == GEMINI) gemini_cord_place(*this);
@@ -1073,6 +1088,7 @@ void Entity_Familiar::Render(const Vector& offset)
if (variant == ITEM_WISP) item_wisp_icon_render(*this);
lua_engine_get().PostFamiliarRender(this, offset);
render_charge_indicator(renderPosition);
if (isHologram) color_stack_pop();
sprite.color = saved;
}
+5
View File
@@ -561,6 +561,7 @@ void familiar_sound_play(int sound, SoundPlay play = {});
bool familiar_unicorn_active(Entity_Player& owner);
Entity* spawn_dip_at(int subType, const Vector* position, Entity* spawner, const Vector* targetPosition);
float angle_wrap(float angle);
float orbit_layer_angle_offset(int layer);
Vector direction_unit(int direction);
// Isaac's body and the player's detached head (Guillotine, Scissors, Decap Attack) (familiar_body.cpp).
@@ -580,6 +581,10 @@ void minisaac_update(Entity_Familiar& minisaac);
void star_of_bethlehem_init(Entity_Familiar& star);
void star_of_bethlehem_update(Entity_Familiar& star);
bool multidimensional_knife_copy(Entity_Knife& knife);
void buddy_in_a_box_update(Entity_Familiar& buddy);
void baby_plum_update(Entity_Familiar& plum);
void multidimensional_baby_update(Entity_Familiar& baby);
void angelic_prism_update(Entity_Familiar& prism);
// The variant behaviours of Update written as their own functions (familiar_update.cpp).
void brown_nugget_update(Entity_Familiar& fly);
-6
View File
@@ -165,12 +165,6 @@ constexpr std::array<float, 3> AXE_GLOW_PHASES = {0.5f, 0.25f, 0};
constexpr std::array<float, 3> AXE_GLOW_STRENGTHS = {0.17f, 0.1f, 0.25f};
// Angelic Prism's four colored knives, split 20 degrees apart around a 30 degree turn.
constexpr std::array<ColorMod, 4> PRISM_COLORS = {{
{{1, 1, 1, 1}, {0, 0, 0, 0}, {0.607843f, -0.392157f, -0.392157f}},
{{1, 1, 1, 1}, {0, 0, 0, 0}, {0.541176f, 0.607843f, -0.392157f}},
{{1, 1, 1, 1}, {0, 0, 0, 0}, {-0.392157f, 0.607843f, -0.262745f}},
{{1, 1, 1, 1}, {0, 0, 0, 0}, {-0.392157f, 0.403922f, 0.607843f}},
}};
constexpr float PRISM_STEP = 20;
constexpr float PRISM_TURN = 30;
constexpr float PRISM_SPEED_BONUS = 2;
+2 -10
View File
@@ -122,14 +122,6 @@ constexpr float MULTIDIMENSIONAL_PULSE_STEP = 0.125f;
constexpr float MULTIDIMENSIONAL_COLORIZE_BASE = 0.3f;
constexpr float MULTIDIMENSIONAL_OFFSET_SCALE = 0.4f;
constexpr float MULTIDIMENSIONAL_OFFSET_BASE = 0.2f;
constexpr float PRISM_SPREAD[] = {-30, -10, 10, 30};
constexpr float PRISM_LIGHT = 0.3921569f;
constexpr float PRISM_STRONG = 0.7843138f;
constexpr ColorMod PRISM_COLORS[] = {
COLOR_DEFAULT,
{{1, 2, 1, 1}, {0, 0, 0, 0}, {PRISM_LIGHT, PRISM_STRONG, 0}},
{{1, 2, 1, 1}, {0, 0, 0, 0}, {-PRISM_STRONG, PRISM_STRONG, PRISM_LIGHT}},
{{1, 1, 2, 1}, {0, 0, 0, 0}, {-PRISM_STRONG, PRISM_LIGHT, PRISM_STRONG}}};
constexpr float CONTINUUM_CLAMP = -131;
constexpr float LASER_CONTINUUM_WRAP_MARGIN = -130;
constexpr int CONTINUUM_WRAPS = 4;
@@ -1614,7 +1606,7 @@ void Entity_Laser::prism_update(bool& isRedirected, bool& isCut)
for (size_t i = 0; i < prismLasers.size(); i++)
{
EntityPtr& slot = prismLasers[i];
float splitAngle = angle + PRISM_SPREAD[i];
float splitAngle = angle + PRISM_LASER_SPREAD[i];
if (isMissing)
{
if (slot) continue;
@@ -1637,7 +1629,7 @@ void Entity_Laser::prism_update(bool& isRedirected, bool& isCut)
if (slot->type != ENTITY_LASER) continue;
Entity_Laser& split = static_cast<Entity_Laser&>(*slot);
split.copy_from_parent(*this, LASER_COPY_STATE);
split.SetColor(PRISM_COLORS[i], -1, COLOR_PRIORITY_DEFAULT, false, true);
split.SetColor(PRISM_LASER_COLORS[i], -1, COLOR_PRIORITY_DEFAULT, false, true);
split.set_aim_angle(splitAngle);
split.pos = hitPosition;
}
+85 -4
View File
@@ -1,11 +1,13 @@
#include "entity_laser.h"
#include "entity_tear.h"
#include "fx_layers.h"
#include "game.h"
#include "kage_graphics.h"
#include "log.h"
#include "lua_engine.h"
#include "npc_ai.h"
#include "render_passes.h"
#include "room.h"
#include <algorithm>
#include <cmath>
@@ -20,6 +22,18 @@ constexpr float SHRINK_RENDER_RANGE = 300;
constexpr float SHRINK_RENDER_LOSS = 0.5f;
constexpr float RING_SCROLL_SPEED = 5;
// The hit area's debug display: a line laser's free end reaches 40 further, and a thick beam's start gets a ring 16
// back from it, of two to twelve steps a quarter, one per ten of its circumference.
constexpr float HIT_LINE_REACH = 40;
constexpr float HIT_RING_BACK = 16;
constexpr float HIT_RING_STEP = 10;
constexpr float HIT_RING_MIN = 2;
constexpr float HIT_RING_MAX = 12;
constexpr float RIGHT_ANGLE_RADIANS = 1.5707964f;
constexpr int HIT_RING_VARIANTS[] = {LASER_THICK_RED, LASER_SHOOP, LASER_GIANT_RED, LASER_BRIM_TECH,
LASER_THICKER_RED, LASER_THICK_BROWN, LASER_BEAST, LASER_THICKER_BRIM_TECH,
LASER_GIANT_BRIM_TECH};
// What one beam draw needs: where it lands on screen, its spritesheet and colors, and whether it is the shadow.
struct BeamDraw
{
@@ -271,10 +285,77 @@ bool Entity_Laser::RenderShadowLayer(const Vector& offset)
return true;
}
// 0097eb50 The debug display of the laser's hit area (debug flag 6) is not reconstructed yet.
// A world point as the debug lines draw it: snapped to the screen and moved with the room's scroll.
static Vector debug_point(Vector world)
{
return vector_add(render_position_get(world, RENDER_SNAPPED), g_game->room->renderScrollOffset);
}
// A hit area's debug outline: a line on each side of a stretch of beam between two screen points, as far out as the
// laser's size, sideways to a direction.
static void hit_lines_render(Vector start, Vector end, Vector along, float size, const KColor& color)
{
float cosine = std::cos(RIGHT_ANGLE_RADIANS);
float sine = std::sin(RIGHT_ANGLE_RADIANS);
Vector side = vector_make((cosine * along.x - sine * along.y) * size * ROOM_SCREEN_SCALE,
(sine * along.x + cosine * along.y) * size * ROOM_SCREEN_SCALE);
render_color_quad(vector_sub(start, side), vector_sub(end, side), color, color, 1);
render_color_quad(vector_add(start, side), vector_add(end, side), color, color, 1);
}
// The debug ring at a thick beam's start: a circle of the laser's size, 16 back from its first sample, in two to
// twelve steps a quarter.
static void hit_ring_render(Entity_Laser& laser, const KColor& color)
{
float angle = laser.angleDegrees * DEGREES_TO_RADIANS;
Vector first = laser.homingLaser.samples[0];
Vector centre = debug_point(
vector_make(first.x - std::cos(angle) * HIT_RING_BACK, first.y - std::sin(angle) * HIT_RING_BACK));
Vector previous = vector_make(std::cos(0.0f) * laser.size * ROOM_SCREEN_SCALE + centre.x,
std::sin(0.0f) * laser.size * ROOM_SCREEN_SCALE + centre.y);
int quarter = (int)std::clamp(laser.size * TAU / HIT_RING_STEP, HIT_RING_MIN, HIT_RING_MAX);
for (int segment = 1; segment <= quarter * 4; segment++)
{
float turn = (float)segment * HALF_TURN_DEGREES / (float)(quarter * 2) * DEGREES_TO_RADIANS;
Vector next = vector_make(std::cos(turn) * laser.size * ROOM_SCREEN_SCALE + centre.x,
std::sin(turn) * laser.size * ROOM_SCREEN_SCALE + centre.y);
render_color_quad(previous, next, color, color, 1);
previous = next;
}
}
// 0097eb50 The debug display of the laser's hit area (debug flag 6), colored by what it collides with: lines along a
// straight beam from its position to its end, or along each stretch of a path (the last one 40 longer for a line
// laser that hit nothing), with a ring at a thick beam's start.
void Entity_Laser::PostRender()
{
if ((g_game->debugFlags & DEBUG_HITSPHERES) && size > 0 && entityCollisionClass != ENTCOLL_NONE &&
sampleMode != SAMPLE_UNDECIDED)
reconstruction_missing("Entity_Laser::PostRender 0097eb50: the hit area's debug lines");
if (!(g_game->debugFlags & DEBUG_HITSPHERES) || size <= 0 || entityCollisionClass == ENTCOLL_NONE ||
sampleMode == SAMPLE_UNDECIDED)
return;
static const KColor COLORS[] = {kcolor_argb(0xff000000), kcolor_argb(0xffffa500), kcolor_argb(0xffffc0cb),
kcolor_argb(0xff00ff00), kcolor_argb(0xffff0000)};
bool isKnownClass = entityCollisionClass >= ENTCOLL_PLAYERONLY && entityCollisionClass <= ENTCOLL_ALL;
const KColor& color = COLORS[isKnownClass ? entityCollisionClass : 0];
if (sampleMode == SAMPLE_STRAIGHT)
{
Vector along = vector_from_angle(angleDegrees);
Vector end = vector_add(pos, vector_scale(along, std::abs(posOffset.y) + laserLength));
return hit_lines_render(debug_point(pos), debug_point(end), along, size, color);
}
const std::vector<Vector>& samples = homingLaser.samples;
bool isLine = subtype != LASER_SUBTYPE_RING_LUDOVICO && subtype != LASER_SUBTYPE_RING_PROJECTILE &&
subtype != LASER_SUBTYPE_RING_FOLLOW_PARENT;
for (size_t i = 0; i + 1 < samples.size(); i++)
{
Vector next = samples[i + 1];
if (isLine && i == samples.size() - 2 && !isGridHit && maxDistance <= 0)
next = vector_add(next, vector_resized(vector_sub(next, samples[i]), HIT_LINE_REACH));
Vector start = debug_point(samples[i]);
Vector end = debug_point(next);
hit_lines_render(start, end, vector_normalized(vector_sub(end, start)), size, color);
if (i == 0 && std::ranges::find(HIT_RING_VARIANTS, variant) != std::end(HIT_RING_VARIANTS))
hit_ring_render(*this, color);
}
}
+1 -6
View File
@@ -1,4 +1,5 @@
#include "entity_list.h"
#include "entity_bomb.h"
#include "entity_effect.h"
#include "entity_familiar.h"
#include "entity_npc.h"
@@ -18,8 +19,6 @@ constexpr const char* SHADOW_PNG = "gfx/shadow.png";
// How much lower a walking player's reflection sits in the water.
constexpr float PLAYER_REFLECTION_DROP = 4;
constexpr int BOMB_ROCKET = 19;
constexpr int BOMB_ROCKET_GIGA = 20;
constexpr int KNIFE_MAIN = 0;
// The boss bar flashes for this many frames when the bosses' health changes.
constexpr int BOSS_BAR_FLASH_FRAMES = 8;
@@ -30,10 +29,6 @@ constexpr uint32_t RENDER_Z_NORMAL_START = 10000;
constexpr int RENDER_LIST_CAPACITY = 0x4000;
constexpr int RENDER_SORT_SWAP_BUDGET = (RENDER_LIST_CAPACITY >> 4) + 1;
// The room's render surface, its size and margin, centered on the screen.
constexpr float ROOM_SURFACE_WIDTH = 338;
constexpr float ROOM_SURFACE_HEIGHT = 182;
constexpr float ROOM_SURFACE_MARGIN = 52;
// A surface surfaces_bake draws into: the flag of the entities drawn there, the flags that keep them, and whether any
// is to be drawn.
+49 -42
View File
@@ -59,8 +59,6 @@ constexpr float GFUEL_BIG_SCALE = 1.5f;
constexpr std::string_view GFUEL_BIG_EXPLOSION_ANM2 = "gfx/promo/gfuel/effects/explosion_big.anm2";
constexpr std::array<std::string_view, 2> GFUEL_EXPLOSION_ANM2S = {"gfx/promo/gfuel/effects/explosion.anm2",
"gfx/promo/gfuel/effects/explosion2.anm2"};
constexpr float GFUEL_BLAST_PITCH = 0.9f;
constexpr float GFUEL_BLAST_PITCH_RANGE = 0.2f;
constexpr int GFUEL_BIG_BLAST_SHAKE = 40;
constexpr int GFUEL_BLAST_SHAKE = 20;
@@ -132,7 +130,6 @@ constexpr float CONFUSION_WANDER = 240;
constexpr float FEAR_WANDER = 100;
constexpr int FEAR_RETARGET_RANGE = 15;
constexpr int FEAR_RETARGET_MIN = 5;
constexpr float MOVEMENT_DEADZONE = 0.1f;
constexpr float ATTACK_PREDICT_FRAMES = 5;
constexpr int LINE_BLOCKED_MAX = 8;
// The corners of the band a line check samples around each step.
@@ -174,7 +171,6 @@ constexpr int MARK_SPREAD_COUNTDOWN = 30;
constexpr ColorMod SPREAD_SLOW_COLOR = {{1, 1, 1.3f, 1}, {0, 0, 0, 0}, {40 / 255.0f, 40 / 255.0f, 40 / 255.0f}};
constexpr int SOUND_POOP_DEATH = 237;
constexpr float POOP_DEATH_VOLUME = 0.9f;
constexpr uint64_t FLAG_FRIENDLY_BALL_DYING = 1ull << 60;
// The burst effects a dead NPC leaves besides blood (Lua's EffectVariant).
enum DeathBurst : int
@@ -203,7 +199,6 @@ constexpr int COLLECTIBLE_SPIDER_MOD_ID = 403;
constexpr int COLLECTIBLE_BROKEN_MODEM_ID = 514;
constexpr int COLLECTIBLE_GUPPYS_EYE_ID = 665;
constexpr int COLLECTIBLE_SALVATION_ID = 696;
constexpr int COLLECTIBLE_VANISHING_TWIN_ID = 697;
constexpr int TRINKET_PURPLE_HEART_ID = 5;
constexpr int TRINKET_TICK_ID = 53;
constexpr int TRINKET_SUPER_MAGNET_ID = 68;
@@ -216,8 +211,6 @@ constexpr int ACHIEVEMENT_BOSS_COLORS = 3;
constexpr int ACHIEVEMENT_MORE_BOSS_COLORS = 33;
constexpr int ACHIEVEMENT_REDIRECTS = 348;
constexpr uint32_t ROOM_CONFIG_FLAG_NO_CHAMPIONS = 1 << 2;
constexpr int GRID_CELL = 40;
constexpr float GRID_TOP = 120;
constexpr int SHIELD_FRAMES_DEFAULT = 120;
constexpr int BOSS_ID_NONE_EXCLUDED_FIRST = 46;
constexpr int BOSS_ID_NONE_EXCLUDED_LAST = 52;
@@ -318,7 +311,6 @@ Entity* spawn_at(int type, int variant, int subType, const Vector& position, Ent
// spawn. In a versus match the other players count too.
static bool is_nearest_enemy_candidate(Entity& entity, bool isVersusPlayer)
{
constexpr int CULTIST_BLOOD_SPAWN = 10;
int type = entity.type;
if (g_game->frameCount - entity.spawnFrame <= 1) return false;
@@ -331,10 +323,17 @@ static bool is_nearest_enemy_candidate(Entity& entity, bool isVersusPlayer)
type != ENTITY_GENERIC_PROP && type != ENTITY_MINECART;
}
// 00707370 Game::GetNearestEnemy: the enemy nearest a position within a radius that a source may target, a charmed
// one counted 400 farther. A friendly source passes over the players it may not hurt, and in a versus match over its
// own ancestors. The original's optional distance function is left out, as no caller here passes one.
Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius)
// A candidate's measure in a nearest search: the search's own, or its squared distance from the position.
static float target_distance_get(TargetDistance distance, const Vector& position, Entity* source, Entity& candidate)
{
if (distance) return distance(position, source, candidate);
return vector_length_squared(vector_sub(candidate.pos, position));
}
// 00707370 Game::GetNearestEnemy: the enemy nearest a position (by the search's measure) within a radius that a
// source may target, a charmed one counted 400 farther. A friendly source passes over the players it may not hurt,
// and in a versus match over its own ancestors.
Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius, TargetDistance measure)
{
constexpr float CHARMED_DISTANCE_SQUARED = 160000;
bool isVersus = g_game->deathmatchManager.is_active();
@@ -350,7 +349,7 @@ Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius)
if (source && ((isVersus && source->IsDescendantOf(entity)) || !source->IsValidTarget(entity))) continue;
if (!is_nearest_enemy_candidate(*entity, isVersus && isPlayer)) continue;
float distance = vector_length_squared(vector_sub(position, entity->pos));
float distance = target_distance_get(measure, position, source, *entity);
if (entity->HasEntityFlags(FLAG_CHARM)) distance += CHARMED_DISTANCE_SQUARED;
if (distance >= best) continue;
best = distance;
@@ -412,9 +411,9 @@ static int active_charges_get(Entity_Player& player)
// What a target counts as from a position: its squared distance, pushed back while its player is invincible or (for
// the Blood Puppy) without control, pulled to a twin walking into the other, and for Bulb led by the active charge it holds.
static float target_score_get(const Vector& position, Entity* source, Entity& target, Entity_Player* player,
bool isBulb)
bool isBulb, TargetDistance measure)
{
float distance = vector_length_squared(vector_sub(target.pos, position));
float distance = target_distance_get(measure, position, source, target);
if (!player) return distance;
Entity_Player* twin = player->twin_get();
@@ -426,7 +425,7 @@ static float target_score_get(const Vector& position, Entity* source, Entity& ta
Vector between = vector_sub(twin->pos, player->pos);
bool isMeeting = vector_dot(vector_add(player->velocity, twin->velocity), between) < 0 &&
vector_length_squared(between) < TWIN_NEAR_SQUARED;
if (isMeeting) distance = vector_length_squared(vector_sub(twin->pos, position)) + 1;
if (isMeeting) distance = target_distance_get(measure, position, source, *twin) + 1;
}
if (!isBulb) return distance;
@@ -458,7 +457,7 @@ bool entity_is_prey(Entity& prey)
// it. Isaac's Heart stands in for its player.
// The stand-in target a player keeps at Entity_Player 0x144c waits for Entity_Player to name it.
Entity* game_nearest_target_player(const Vector& position, Entity* source, bool isPlayersOnly, bool isTargetDecoys,
float maxDistance)
float maxDistance, TargetDistance measure)
{
if (!isPlayersOnly && isTargetDecoys && source && source->IsEnemy())
{
@@ -493,7 +492,7 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
player = static_cast<Entity_Familiar*>(target)->player;
if (player && player->IsInvisible()) continue;
float score = target_score_get(position, source, *target, player, isBulb);
float score = target_score_get(position, source, *target, player, isBulb, measure);
if (score >= best) continue;
best = score;
nearest = target;
@@ -503,7 +502,7 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
for (Entity* decoy : g_game->room->entityList.mainEL)
{
if (decoy->type != ENTITY_FAMILIAR || decoy->variant != Entity_Familiar::PUNCHING_BAG) continue;
float distance = vector_length_squared(vector_sub(decoy->pos, position));
float distance = target_distance_get(measure, position, source, *decoy);
if (distance >= best) continue;
best = distance;
nearest = decoy;
@@ -515,7 +514,7 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
{
if (prey_is_friendly(baited, source) || baited->isDead || !baited->HasEntityFlags(FLAG_BAITED)) continue;
if (!source || !source->IsValidTarget(baited)) continue;
float distance = vector_length_squared(vector_sub(baited->pos, position)) * BAITED_DISTANCE_SCALE;
float distance = target_distance_get(measure, position, source, *baited) * BAITED_DISTANCE_SCALE;
if (distance >= best) continue;
best = distance;
nearest = baited;
@@ -532,7 +531,7 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
continue;
if (prey->HasEntityFlags(FLAG_NO_TARGET)) continue;
float distance = vector_length_squared(vector_sub(prey->pos, position));
float distance = target_distance_get(measure, position, source, *prey);
bool isFriendly = prey->HasEntityFlags(FLAG_FRIENDLY);
if (prey->type == ENTITY_BISHOP && !isFriendly) distance *= PUPPY_BISHOP_SCALE;
if (prey->type == ENTITY_BLOOD_PUPPY) distance += PUPPY_KIN_PENALTY;
@@ -575,8 +574,8 @@ void game_encountered_boss_add(int bossType, int bossVariant)
uint32_t room_grid_collision_at(const Vector& position)
{
Room& room = *g_game->room;
int column = (int)((position.x - GRID_CELL) / GRID_CELL + HALF);
int row = (int)((position.y - GRID_TOP) / GRID_CELL + HALF);
int column = (int)((position.x - GRID_ORIGIN_X) / GRID_CELL_SIZE + HALF);
int row = (int)((position.y - GRID_ORIGIN_Y) / GRID_CELL_SIZE + HALF);
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
return room.GetGridCollision(isInside ? room.gridWidth * row + column : -1);
}
@@ -623,10 +622,10 @@ bool room_check_line(const Vector& start, const Vector& end, int mode, int gridP
step = vector_scale(step, LINE_STEP / length);
auto cellOf = [](float value, float origin) {
return (int)((value - origin) / GRID_CELL + HALF);
return (int)((value - origin) / GRID_CELL_SIZE + HALF);
};
int startColumn = cellOf(start.x, GRID_CELL);
int startRow = cellOf(start.y, GRID_TOP);
int startColumn = cellOf(start.x, GRID_ORIGIN_X);
int startRow = cellOf(start.y, GRID_ORIGIN_Y);
bool isStartInside =
startColumn >= 0 && startColumn < room.gridWidth && startRow >= 0 && startRow < room.gridHeight;
int startIndex = isStartInside ? room.gridWidth * startRow + startColumn : -1;
@@ -638,8 +637,8 @@ bool room_check_line(const Vector& start, const Vector& end, int mode, int gridP
at = vector_sub(at, step);
if (mode == LINE_MODE_EXPLOSION)
{
int column = cellOf(at.x, GRID_CELL);
int row = cellOf(at.y, GRID_TOP);
int column = cellOf(at.x, GRID_ORIGIN_X);
int row = cellOf(at.y, GRID_ORIGIN_Y);
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
int cellIndex = isInside ? row * room.gridWidth + column : -1;
if (line_cell_is_blast_wall(room, cellIndex)) return false;
@@ -647,8 +646,8 @@ bool room_check_line(const Vector& start, const Vector& end, int mode, int gridP
}
if (mode == LINE_MODE_CELL)
{
int column = cellOf(at.x, GRID_CELL);
int row = cellOf(at.y, GRID_TOP);
int column = cellOf(at.x, GRID_ORIGIN_X);
int row = cellOf(at.y, GRID_ORIGIN_Y);
bool isInside = column >= 0 && column < room.gridWidth && row >= 0 && row < room.gridHeight;
int cellIndex = isInside ? row * room.gridWidth + column : -1;
if (room.GetGridCollision(cellIndex) != COLLISION_NONE) return false;
@@ -657,8 +656,8 @@ bool room_check_line(const Vector& start, const Vector& end, int mode, int gridP
}
for (const LineCorner& corner : LINE_CORNERS)
{
int column = cellOf(at.x + corner.x, GRID_CELL);
int row = cellOf(at.y + corner.y, GRID_TOP);
int column = cellOf(at.x + corner.x, GRID_ORIGIN_X);
int row = cellOf(at.y + corner.y, GRID_ORIGIN_Y);
int collision = line_cell_collision(room, column, row);
if (mode == LINE_MODE_PROJECTILE && collision == COLLISION_PIT) continue;
if (collision != COLLISION_NONE) return false;
@@ -1905,7 +1904,7 @@ void Entity_NPC::Update()
spawn_damage_numbers();
update_damage_history();
if (aiCallFlags & AI_CALL_PRE_UPDATE) ai_call(AI_PHASE_PRE_UPDATE);
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_FRIENDLY_BALL_DYING)) captured_update();
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_DELIRIUM_FORM)) captured_update();
float healthBefore = health;
if (type == ENTITY_MINECART) update_physics();
@@ -1937,8 +1936,8 @@ void Entity_NPC::Update()
forced_target_update();
}
// Part of 006c4b30: an enemy captured in a Friendly Ball (or dying out of one) wastes a quarter of health every 15
// frames down to 1, greying and shrinking with it. A hit this frame that is not fire, spikes or poop passes on as 1
// Part of 006c4b30: a persistent enemy or a Delirium form (Delirious's friendly boss) wastes a quarter of health every
// 15 frames down to 1, greying and shrinking with it. A hit this frame that is not fire, spikes or poop passes on as 1
// damage from its biggest hit, or as 5 from an explosion.
// The shrink is lost at once, as the frame's scale reset (FUN_006d6650) overwrites it.
void Entity_NPC::captured_update()
@@ -1982,35 +1981,43 @@ void Entity_NPC::captured_update()
// The camouflage seeds: an enemy takes on the floor under it, sampled on its first frames and every 30 after, and
// blends a tenth of the way toward it each frame, nearly black underneath.
void Entity_NPC::camouflage_update()
{
constexpr float CAMO_DARKNESS = 0.02f;
camouflage_blend(*this, floorColor, CAMO_DARKNESS);
}
// The camouflage of an entity on the camo seeds: a color sampled from the floor under it on its first frames and
// every 30 after, which its sprite blends a tenth of the way toward each frame, tinted to a darkness underneath.
void camouflage_blend(Entity& entity, ColorMod& floorColor, float darkness)
{
constexpr float CAMO_ALPHA = 0.7f;
constexpr float CAMO_FLOOR_TONE = 0.9f;
constexpr float CAMO_ALPHA_BLEND = 0.3f;
constexpr float CAMO_FLOOR_BLEND = 0.5f;
constexpr float CAMO_SPRITE_BLEND = 0.1f;
constexpr float CAMO_DARKNESS = 0.02f;
constexpr int CAMO_RESAMPLE_FRAMES = 30;
constexpr int CAMO_SAMPLE_WINDOW = 2;
Room& room = *g_game->room;
if (FrameCount() < CAMO_SAMPLE_WINDOW)
ANM2& sprite = entity.sprite;
if (entity.FrameCount() < CAMO_SAMPLE_WINDOW)
{
KColor floor = room_floor_texel_get(room, pos);
KColor floor = room_floor_texel_get(room, entity.pos);
const float shares[] = {floor._red, floor._green, floor._blue};
std::fill_n(floorColor._tint, 3, 0.0f);
floorColor._tint[3] = CAMO_ALPHA;
for (int i = 0; i < 3; i++) floorColor._offset[i] = shares[i] * CAMO_FLOOR_TONE;
sprite.color = floorColor;
}
if ((uint32_t)(g_game->frameCount + index) % CAMO_RESAMPLE_FRAMES < CAMO_SAMPLE_WINDOW)
if ((uint32_t)(g_game->frameCount + entity.index) % CAMO_RESAMPLE_FRAMES < CAMO_SAMPLE_WINDOW)
{
KColor floor = room_floor_texel_get(room, pos);
KColor floor = room_floor_texel_get(room, entity.pos);
floorColor._tint[3] = std::lerp(floorColor._tint[3], CAMO_ALPHA, CAMO_ALPHA_BLEND);
const float shares[] = {floor._red, floor._green, floor._blue};
for (int i = 0; i < 3; i++)
floorColor._offset[i] = std::lerp(floorColor._offset[i], shares[i] * CAMO_FLOOR_TONE, CAMO_FLOOR_BLEND);
}
ColorMod blended = color_lerp(sprite.color, floorColor, CAMO_SPRITE_BLEND);
std::fill_n(blended._tint, 3, CAMO_DARKNESS);
std::fill_n(blended._tint, 3, darkness);
blended._tint[3] = 1;
sprite.color = blended;
}
@@ -2150,7 +2157,7 @@ float Entity_NPC::compute_speed_multiplier()
if (HasEntityFlags(FLAG_SLOW) && state != NPC_STATE_DEATH) speed *= SPEED_HALF;
if (HasEntityFlags(FLAG_WEAKNESS)) speed *= SPEED_WEAKENED;
if (IsBoss() && !IsFriendly() && room.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_VANISHING_TWIN_ID))
if (IsBoss() && !IsFriendly() && room.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_VANISHING_TWIN))
speed *= SPEED_VANISHING_TWIN;
return speed;
}
+12 -2
View File
@@ -68,6 +68,8 @@ enum ProjectilesMode : int
// The Mulligan that runs from the player, which a champion's health never raises.
constexpr int MULLIGAN_VARIANT_FLEEING = 2;
// Movement or controller input below this length counts as standing still.
constexpr float MOVEMENT_DEADZONE = 0.1f;
// Lua's ChampionColor values the NPC code tests.
enum ChampionColor : int
@@ -404,16 +406,24 @@ enum LineCheckMode : int
};
constexpr int LINE_CHECK_THRESHOLD = 999;
// The pitch of G FUEL!'s explosions and bursts, 0.9 to 1.1.
constexpr float GFUEL_BLAST_PITCH = 0.9f;
constexpr float GFUEL_BLAST_PITCH_RANGE = 0.2f;
// How a nearest search measures a candidate in place of its squared distance from the position (the Slog's lanes).
using TargetDistance = float (*)(const Vector& position, Entity* source, Entity& candidate);
// Game's, Room's and PlayerManager's queries the enemies need, until those classes carry them.
Entity_Player* game_nearest_player(const Vector& position);
Entity_Player* main_player_nearest(const Vector& position);
Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius);
Entity* game_nearest_enemy(const Vector& position, Entity* source, float radius, TargetDistance distance = nullptr);
bool any_player_flying();
Entity* game_nearest_target_player(const Vector& position, Entity* source, bool isPlayersOnly, bool isTargetDecoys,
float maxDistance);
float maxDistance, TargetDistance distance = nullptr);
void game_shake_screen(int timeout);
Entity* spawn_at(int type, int variant, int subType, const Vector& position, Entity* spawner);
Entity* gfuel_explosion_spawn(const Vector& position, float scale);
void camouflage_blend(Entity& entity, ColorMod& floorColor, float darkness);
int poof_size_get(Entity& entity, bool isHugeAllowed);
void game_encountered_boss_add(int bossType, int bossVariant);
bool game_is_hard_mode();
+14 -2
View File
@@ -1,5 +1,6 @@
#include "entity_npc.h"
#include "boss_final.h"
#include "boss_repentance.h"
#include "beam_renderer.h"
#include "entity_config.h"
#include "entity_player.h"
@@ -13,12 +14,16 @@
#include <algorithm>
#include <array>
#include <cmath>
#include <format>
#include <map>
constexpr float NPC_SCREEN_SCALE = 0.65f;
constexpr int SPAWN_BAR_DELAY = 2;
constexpr float HEALTH_BAR_DROP = 10;
// Part of 006d2e50 The dummy shows the damage it took (its v1.x) to two places, centred 28 above it.
constexpr float DUMMY_TEXT_RISE = 28;
// The health bar's sheet: left cap, stretched middle and right cap 8 high in the top row, the fill below the middle.
// Its width grows with the log of the NPC's toughness, from 8 to 48. The fill's hue runs from red (none left) to green,
// blue for the toughest, and greys a little away from green.
@@ -288,7 +293,7 @@ static void npc_body_render(Entity_NPC& npc, const Vector& offset)
case ENTITY_HORNY_BOYS:
return horny_boys_render(npc, offset);
case ENTITY_CLUTCH:
return reconstruction_missing("NpcHelper::clutch_render 00575a10");
return clutch_render(npc, offset);
case ENTITY_BEAST:
return beast_render(npc, offset);
case ENTITY_MINECART:
@@ -440,7 +445,14 @@ void Entity_NPC::Render(const Vector& offset)
bool isMainPass = renderMode == RENDER_NORMAL || renderMode == RENDER_WATER_ABOVE;
if (isMainPass && !isHidden)
{
if (type == ENTITY_DUMMY) reconstruction_missing("Entity_NPC::Render 006d2e50: the dummy's damage text");
if (type == ENTITY_DUMMY)
{
FontSettings settings;
settings.alignment = ALIGN_TOP_CENTER;
g_manager->font6_PFTempestaSevenCondensed.DrawString(std::format("{:.2f}", v1.x),
vector_make(renderPosition.x, renderPosition.y - DUMMY_TEXT_RISE),
vector_make(1, 1), kcolor_rgba(1, 1, 1, 1), settings);
}
status_overlay_render(base);
if (npc_is_health_bar_shown(*this))
health_bar_render(*this, vector_make(renderPosition.x, renderPosition.y + HEALTH_BAR_DROP));
+3 -4
View File
@@ -2,6 +2,7 @@
#include "entity_npc.h"
#include "entity_player.h"
#include "game.h"
#include "grid_entity_door.h"
#include "level_generator.h"
#include "npc_ai.h"
@@ -14,10 +15,8 @@ constexpr float ROOM_STEP_Y = 280;
// The door slot's side when the rooms have no place on the floor: the xorshift (1, 11, 16) of the decoration seed.
constexpr uint32_t DOOR_SIDE_SHIFT_INDEX = 5;
constexpr int DOOR_SIDES = 4;
// A persistent enemy is spared contact damage for its first 20 frames in the new room.
constexpr uint64_t FLAG_FRIENDLY_BALL_DYING = 1ull << 60;
// A persistent enemy or Delirium form is spared contact damage for its first 20 frames in the new room.
constexpr int ROOM_ENTER_DAMAGE_COUNTDOWN = 20;
// How many rooms the players moved, by the rooms' places on the floor, else by the side of the door they came in by
@@ -85,5 +84,5 @@ void Entity_NPC::room_enter()
poof->SetColor(DARK_ESAU_POOF_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
}
}
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_FRIENDLY_BALL_DYING)) damageCountdown = ROOM_ENTER_DAMAGE_COUNTDOWN;
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_DELIRIUM_FORM)) damageCountdown = ROOM_ENTER_DAMAGE_COUNTDOWN;
}
+753 -210
View File
File diff suppressed because it is too large. Load diff
+34 -3
View File
@@ -118,9 +118,36 @@ enum KeySubType : int
KEY_CHARGED
};
// A bomb's subtypes (Lua's BombSubType).
enum BombSubType : int
{
BOMB_SUBTYPE_NORMAL = 1,
BOMB_SUBTYPE_DOUBLEPACK,
BOMB_SUBTYPE_TROLL,
BOMB_SUBTYPE_GOLDEN,
BOMB_SUBTYPE_SUPERTROLL,
BOMB_SUBTYPE_GOLDENTROLL,
BOMB_SUBTYPE_GIGA
};
// The sprite named for its file's question mark, which Curse of the Blind shows on every pedestal.
constexpr std::string_view QUESTION_MARK_GFX = "gfx/Items/Collectibles/questionmark.png";
// The small, sickly blood splat of a rotten heart and a Rotten Beggar.
constexpr ColorMod ROTTEN_SPLAT_COLOR = {{0.7f, 0.9f, 0.65f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr float ROTTEN_SPLAT_MIN = 0.2f;
constexpr float ROTTEN_SPLAT_RANGE = 0.4f;
// The sprite subtype every Cantripped card shows.
constexpr int ITEM_CARD_SPRITE_SUBTYPE = 16;
// Whether a G FUEL! burst greets a pickup appearing or an item pedestal, which order their effects differently.
enum GfuelAppear
{
GFUEL_APPEAR_PICKUP,
GFUEL_APPEAR_PEDESTAL
};
// The game state bit set once a heart, bomb or coin is picked, and Daemon's Tail's 1 in 5 heart chance.
constexpr int GAME_STATE_HEART_BOMB_COIN_PICKED = 41;
constexpr int DAEMONS_TAIL_ODDS = 5;
@@ -185,7 +212,6 @@ struct Entity_Pickup : Entity
bool TryThrow(const EntityRef& source, const Vector& direction, float force) override;
bool HandleCollision(Entity* collider, bool isLow) override;
void GetLootList(const Vector& renderOffset);
bool IsShopItem();
static Vector GetRandomPickupVelocity(const Vector& position, RNG* rng, uint32_t ePickupVelType);
bool TryFlip(Entity_Player* unusedPlayer, uint32_t unusedSeed);
@@ -197,6 +223,7 @@ struct Entity_Pickup : Entity
void Morph(int entityType, int entityVariant, int entitySubType, bool isKeepPrice, bool isKeepSeed,
bool isIgnoreModifiers);
void update_price_sprite(int newPrice);
int sacrifice_item_pick();
void AppearFast();
bool TryOpenChest(Entity_Player* player);
LootList GetChestLoot(PoolDraw draw, Entity_Player* player);
@@ -207,6 +234,7 @@ struct Entity_Pickup : Entity
void TriggerShopPurchase(Entity_Player& player, int spentMoney);
uint8_t empty_pedestal();
void update_magnet_attraction();
void mag_baby_pull();
void update_cycle_collectible(bool isForce);
bool CanReroll();
static bool CanRerollVariant(int variant, int subType);
@@ -222,6 +250,7 @@ private:
void appear_start();
bool keeper_flies_update();
void target_position_update();
void door_push();
void appear_update();
bool heart_collect(Entity_Player& player);
void coin_collect(Entity_Player& player);
@@ -236,14 +265,15 @@ private:
void chest_loot_spawn(const LootList& loot, Entity_Player& player, int chestVariant);
// The shop's parts of Init, Update, update_price_sprite and HandleCollision (entity_pickup_shop.cpp).
void shop_ware_choose(PickupChoice& choice, uint32_t seed);
void shop_ware_choose(PickupChoice& choice, RNG& rng);
void shop_price_assign();
void price_sprite_load();
void price_refresh();
void other_deals_take();
void purchase_finish(Entity_Player& player, int paidPrice);
// The item pedestal's parts of Init, Update, Render, HandleCollision and PlayPickupSound (item_pickup.cpp).
void collectible_choose(int& collectibleId, uint32_t seed);
void collectible_choose(int& collectibleId, RNG& rng);
void pedestal_start();
void pedestal_update();
void pedestal_render(const Vector& offset);
@@ -255,4 +285,5 @@ private:
bool pickup_variant_pick(PickupChoice& choice);
void collectible_subtype_pick(PickupChoice& choice, RNG& rng);
void gfuel_appear_spawn(const Vector& position, GfuelAppear appear);
bool entity_type_is_saved(int type, int variant, uint32_t subType, int spawnerType, bool isRoomEntry);
+3 -5
View File
@@ -49,7 +49,6 @@ constexpr int CHEST_COINS_ROLL = 3;
constexpr int MEGA_CHEST_DRAWS = 5;
constexpr size_t WOODEN_CHEST_TRINKETS = 2;
constexpr int CHEST_TRINKET_ODDS = 100;
constexpr int LUCKY_TOE_ODDS = 3;
// The pickups a chest's own draw gives (the outcome ids of GetChestLoot's first draw).
enum ChestOutcome
@@ -177,7 +176,6 @@ constexpr int LEFT_HAND_NO_SPIDERS = 3;
constexpr int FAMILIAR_BLUE_FLY = 43;
constexpr int FAMILIAR_BLUE_SPIDER = 73;
constexpr int RED_CHEST_TELEPORT = 1;
constexpr int RED_CHEST_BOMB_SUBTYPE = 3;
constexpr float RED_CHEST_SPIDER_STEP = 70;
constexpr float RED_CHEST_SPIDER_HEIGHT = -30;
constexpr uint32_t POKER_QUALITY_BANS = 0x1f0;
@@ -534,8 +532,8 @@ static void red_chest_loot_draw(ChestDraw& draw, bool isChestFloor)
break;
}
case RED_OUTCOME_BOMBS:
loot_add(draw, PICKUP_BOMB, RED_CHEST_BOMB_SUBTYPE);
loot_add(draw, PICKUP_BOMB, RED_CHEST_BOMB_SUBTYPE);
loot_add(draw, PICKUP_BOMB, BOMB_SUBTYPE_TROLL);
loot_add(draw, PICKUP_BOMB, BOMB_SUBTYPE_TROLL);
break;
case RED_OUTCOME_PILLS:
loot_add(draw, PICKUP_PILL);
@@ -575,7 +573,7 @@ static void sack_loot_draw(ChestDraw& draw, int subtype)
static void moms_chest_loot_draw(ChestDraw& draw)
{
bool isLocked = !g_manager->persistentGameData.achievements[ACHIEVEMENT_RED_KEY] &&
(g_manager->state != MANAGER_STATE_GAME || (g_game->dailyChallenge._id == 0 && !g_game->isDebug));
(g_manager->state != MANAGER_STATE_GAME || (g_game->dailyChallenge.id == 0 && !g_game->isDebug));
if (!isLocked) return loot_item_add(draw, POOL_MOMS_CHEST);
uint32_t seed = draw.rng->Next();
+48 -7
View File
@@ -3,6 +3,10 @@
#include "game.h"
#include "log.h"
#include "manager.h"
#include "room_special.h"
#include <algorithm>
#include <array>
#include <span>
constexpr int MORPH_RNG_SHIFT = 7;
@@ -29,10 +33,28 @@ struct MorphKept
bool isUnknown52d = false;
};
// A devil deal's sacrifice item turned into something else stays a sacrifice item: another of the tagged items, not
// one its pedestal cycles through, drawn from its seed. With none tagged it keeps its item.
// The original draws forever when every tagged item is refused. Here it stops after a draw per item and keeps its own.
int Entity_Pickup::sacrifice_item_pick()
{
std::vector<ItemConfig_Item*>& items = g_manager->itemConfig.GetTaggedItems(TAG_DEVIL_SACRIFICE);
RNG rng = rng_make(initSeed, DEFAULT_SHIFT_INDEX);
auto cycle = std::span(cycleCollectibleList).first(cycleCollectibleCount);
for (size_t attempt = 0; attempt < items.size(); attempt++)
{
int pick = items[rng.Next() % items.size()]->id;
if (pick != subtype && std::ranges::count(cycle, (uint32_t)pick) == 0) return pick;
}
return subtype;
}
// 006e30a0 Turns a pickup into another in place (Lua's EntityPickup:Morph): a new seed unless kept, its place, links,
// index, flags and timers kept, its price kept or dropped, an active's initial charge, and its pedestal. Entities
// pointing at it forget it. The deathmatch's swaps, a devil deal keeping its sacrifice item, a priced shop item's
// reroll and a Mega Chest's halves are not written yet. Flip's other item stays while the pickup keeps its kind.
// pointing at it forget it. A devil deal keeps a sacrifice item, a priced item rerolled to nothing gets a new ware of
// its shop slot at its price, a Mega Chest's halves stay paired, and Flip's other item stays while the pickup keeps its
// kind.
void Entity_Pickup::Morph(int entityType, int entityVariant, int entitySubType, bool isKeepPrice, bool isKeepSeed,
bool isIgnoreModifiers)
{
@@ -43,8 +65,7 @@ void Entity_Pickup::Morph(int entityType, int entityVariant, int entitySubType,
}
if (g_game->deathmatchManager.is_active())
reconstruction_missing("Entity_Pickup::Morph 006e30a0 (the deathmatch's blacklist)");
if (megaChestCollectible[0] || megaChestCollectible[1])
reconstruction_missing("Entity_Pickup::Morph 006e30a0 (a Mega Chest's halves)");
std::array<EntityPtr, 2> megaPair = megaChestCollectible;
std::shared_ptr<EntitySaveState> flipOther = flipSaveState;
MorphKept saved = {.child = child,
@@ -70,11 +91,21 @@ void Entity_Pickup::Morph(int entityType, int entityVariant, int entitySubType,
if (itemPoolType == POOL_DEVIL && price == 0 && ItemConfig::is_collectible_tagged(subtype, TAG_DEVIL_SACRIFICE) &&
!ItemConfig::is_collectible_tagged(entitySubType, TAG_DEVIL_SACRIFICE))
reconstruction_missing("Entity_Pickup::Morph 006e30a0 (a devil deal keeping its sacrifice item)");
entitySubType = sacrifice_item_pick();
int newPrice = isKeepPrice ? price : 0;
if (price != 0 && isKeepPrice && entitySubType == 0)
reconstruction_missing("Entity_Pickup::Morph 006e30a0 (a priced shop item's reroll)");
Init(entityType, entityVariant, entitySubType, initSeed);
{
Room& room = *g_game->room;
RNG rng = rng_make(initSeed, DEFAULT_SHIFT_INDEX);
ShopOffer offer = {.shopItemId = shopItemId, .variant = entityVariant};
offer.seed = rng.Next();
if (shopItemId >= 0) shop_offer_pick(room, offer);
entityVariant = offer.variant;
entitySubType = offer.subType;
newPrice = room_shop_discount(room, shopItemId, room_shop_item_price(room, offer, nullptr), nullptr);
Init(entityType, entityVariant, entitySubType, rng.Next());
}
else Init(entityType, entityVariant, entitySubType, initSeed);
itemPoolType = saved.itemPoolType;
g_pickupIgnoreModifiers = savedIgnoreModifiers;
@@ -111,5 +142,15 @@ void Entity_Pickup::Morph(int entityType, int entityVariant, int entitySubType,
if (variant == PICKUP_COLLECTIBLE && subtype != 0 && isBlindChanged) UpdateSprite(false);
for (EntityPtr* referrer : referrers) referrer->forget();
referrers.clear();
if (auto* second = static_cast<Entity_Pickup*>(megaPair[1].get()))
{
megaChestCollectible[1] = second;
second->megaChestCollectible[0] = this;
}
if (auto* first = static_cast<Entity_Pickup*>(megaPair[0].get()))
{
megaChestCollectible[0] = first;
first->megaChestCollectible[1] = this;
}
if (flipOther && flipOther->type == type && flipOther->variant == variant) flipSaveState = flipOther;
}
+11 -2
View File
@@ -60,10 +60,9 @@ constexpr std::array<HeartCost, 10> HEART_COSTS = {
// The ware a shop slot sells, the Init part of 006e02f0: the room rolls the slot's ware and price from the pickup's
// seed, the pick's modifiers may change it (pricing it again), and a devil treasure room's crawlspace ware stands
// higher.
void Entity_Pickup::shop_ware_choose(PickupChoice& choice, uint32_t seed)
void Entity_Pickup::shop_ware_choose(PickupChoice& choice, RNG& rng)
{
Room& room = *g_game->room;
RNG rng = {seed, 5, 9, 7};
ShopOffer offer = {.seed = rng.Next()};
shopItemId = room_shop_ware_roll(room, offer);
@@ -82,6 +81,16 @@ void Entity_Pickup::shop_ware_choose(PickupChoice& choice, uint32_t seed)
if (isRaised) pos.y -= DEVIL_TREASURE_RAISE;
}
// The price the shop would ask for the pickup as it is, outside the shop's wares (Tainted Keeper's pedestals and the
// seed that sells every pickup).
void Entity_Pickup::shop_price_assign()
{
Room& room = *g_game->room;
shopItemId = -1;
ShopOffer offer = {.shopItemId = shopItemId, .subType = subtype, .variant = variant};
price = room_shop_discount(room, shopItemId, room_shop_item_price(room, offer, nullptr), nullptr);
}
// A price on its sprite: hearts by frame, spikes as a spike effect under the ware, free as a struck price, coins as
// two digits and the coin, red while discounted.
void Entity_Pickup::price_sprite_load()
+44 -17
View File
@@ -20,6 +20,7 @@
#include "room.h"
#include "room_grid.h"
#include <algorithm>
#include <deque>
#include <filesystem>
constexpr float PLAYER_START_TEAR_HEIGHT = -23.75f;
@@ -51,20 +52,15 @@ constexpr uint32_t PILL_RNG_SHIFT = 8;
constexpr uint32_t CARD_RNG_SHIFT = 9;
constexpr uint32_t PRE_LEVEL_RNG_SHIFT = 2;
constexpr uint32_t FLOOR_RNG_SHIFT = 12;
constexpr uint32_t JACOBS_CURSE_RNG_SHIFT = 66;
constexpr int JACOBS_CURSE_STEPS = 20;
constexpr int REDEMPTION_LIGHT_FADE = 2;
constexpr int NECROMANCER_OVERLAY_DELAY = 3;
// The step from a door slot (left, up, right, down) into the room.
constexpr float ASCENT_DOOR_STEPS[][2] = {{40, 0}, {0, 40}, {-40, 0}, {0, -40}};
constexpr int JACOBS_CURSE_STEP_FRAMES = 30;
constexpr int JACOBS_CURSE_MIN_FRAMES = 610;
constexpr int ASCENT_HOME_STAGE = 6;
constexpr int CAINS_EYE_CHANCE = 25;
constexpr int CANTRIPPED_CARDS = 3;
constexpr int CARD_START_RUNE_CHANCE = 10;
constexpr int COLOR_PRIORITY_TOP = 255;
constexpr int DAILY_CHRISTMAS = 19;
constexpr int EMPTY_HEART_RED_HEARTS = 3;
constexpr int EVENT_BONUS_ITEMS = 114;
@@ -128,7 +124,7 @@ bool is_run_unlocked(int achievement)
Game* game = g_game;
if (g_manager->persistentGameData.achievements[achievement]) return true;
return g_manager->state == MANAGER_STATE_GAME && game && (game->dailyChallenge._id != 0 || game->isDebug);
return g_manager->state == MANAGER_STATE_GAME && game && (game->dailyChallenge.id != 0 || game->isDebug);
}
// Fills a list of item generators, one per id, each seeded by the next step of a generator of its own.
@@ -820,7 +816,7 @@ void Entity_Player::InitPostLevelInitStats()
isPostLevelInitFinished = true;
return;
}
if (game.dailyChallenge._specialDailyId != 0)
if (game.dailyChallenge.specialDailyId != 0)
reconstruction_missing("Entity_Player::InitPostLevelInitStats 007bc740 (a daily's special start)");
if (playerConfig->card > 0) AddPocketItem(playerConfig->card, POCKET_CARD);
@@ -872,7 +868,7 @@ void Entity_Player::InitPostLevelInitStats()
starting_collectible_add(COLLECTIBLE_KEY_PIECE_1);
starting_collectible_add(COLLECTIBLE_KEY_PIECE_2);
}
if (game.challenge == 0 && game.dailyChallenge._id == 0)
if (game.challenge == 0 && game.dailyChallenge.id == 0)
{
if (startFrame == 0) bonus_items_roll(rng);
}
@@ -931,16 +927,16 @@ void Entity_Player::companions_init()
->Update();
break;
case PLAYER_JACOB_B:
if (game.challenge != CHALLENGE_RED_REDEMPTION) jacobs_curse_add();
if (game.challenge != CHALLENGE_RED_REDEMPTION) jacobs_curse_add(JACOBS_CURSE_FLOOR);
break;
default:
break;
}
}
// Starts the countdown to Dark Esau's next charge on Tainted Jacob: 20 to 600 seconds after 610 frames, drawn from the
// devil room generator.
void Entity_Player::jacobs_curse_add()
// Starts the countdown to Dark Esau's next charge on Tainted Jacob, a number of second-steps after the delay's least,
// drawn from the devil room generator without advancing it.
void Entity_Player::jacobs_curse_add(const JacobsCurseDelay& delay)
{
temporaryEffects.RemoveNullEffect(NULLITEM_JACOBS_CURSE, -1);
ItemConfig_Item* item = g_manager->itemConfig.GetNullItem(NULLITEM_JACOBS_CURSE);
@@ -948,7 +944,7 @@ void Entity_Player::jacobs_curse_add()
RNG rng = rng_make(g_game->devilAngelRoomRNG._seed, JACOBS_CURSE_RNG_SHIFT);
TemporaryEffect effect(item);
effect.cooldown = (int)(rng.Next() % JACOBS_CURSE_STEPS) * JACOBS_CURSE_STEP_FRAMES + JACOBS_CURSE_MIN_FRAMES;
effect.cooldown = (int)(rng.Next() % delay.steps) * JACOBS_CURSE_STEP_FRAMES + delay.minFrames;
temporaryEffects.AddEffect(effect, true, 1);
}
@@ -999,6 +995,37 @@ void Entity_Player::start_position_set()
pos = PlayerManager::get_player_start_position(this, vector_make(START_SPOT_X, startY));
}
// 007e7820 Whether a walk through the room's grid paths leads from one spot to another (not onto a solid cell), no
// longer than half the room's cells, stepping left, up, right and down.
static bool pathfinder_can_reach_pos(const Vector& target, const Vector& start)
{
Room& room = *g_game->room;
int targetIndex = room.GetGridIndex(target);
if (targetIndex >= 0 && targetIndex < ROOM_GRID_CELLS && room.gridPaths[targetIndex] == GRID_PATH_SOLID) return false;
auto cell = [&room](int column, int row) { return room.GetGridIndexByTile(column, row); };
std::array<int, ROOM_GRID_CELLS> paths = room.gridPaths;
std::deque<std::pair<int, int>> open = {{room.GetGridIndex(start), 0}};
int depthLimit = room.gridHeight * room.gridWidth / 2;
while (!open.empty())
{
auto [index, depth] = open.front();
if (depth >= depthLimit) return false;
open.pop_front();
int column = index % room.gridWidth;
int row = index / room.gridWidth;
for (int next : {cell(column - 1, row), cell(column, row - 1), cell(column + 1, row), cell(column, row + 1)})
{
if (next < 0 || paths[next] < 0 || paths[next] >= GRID_PATH_IMPASSABLE) continue;
paths[next] = -(depth + 1);
if (next == targetIndex) return true;
open.push_back({next, depth + 1});
}
}
return false;
}
// The Ascent starts the player a cell inside a door: the room's first, or from a random slot the next one its shape
// allows. A trapdoor reachable from there takes the start instead.
void Entity_Player::ascent_start_set()
@@ -1022,7 +1049,7 @@ void Entity_Player::ascent_start_set()
GridEntity* grid = room.gridEntities[cell];
if (!grid || grid->type != GRID_TRAPDOOR) continue;
Vector trapdoor = room.GetGridPosition(grid->gridIndex);
if (!pathfinder_can_reach_pos(&trapdoor, &start, &room)) continue;
if (!pathfinder_can_reach_pos(trapdoor, start)) continue;
pos = trapdoor;
return;
}
@@ -1048,7 +1075,7 @@ void Entity_Player::level_items_apply(bool isForced)
temporaryEffects.RemoveNullEffect(NULLITEM_JUDAS_BIRTHRIGHT_STAGE, 1);
if (playerType == PLAYER_JACOB2_B) ChangePlayerType(PLAYER_JACOB_B, false);
else if (playerType == PLAYER_LAZARUS2) ChangePlayerType(PLAYER_LAZARUS, false);
if (playerType == PLAYER_JACOB_B && game.challenge != CHALLENGE_RED_REDEMPTION) jacobs_curse_add();
if (playerType == PLAYER_JACOB_B && game.challenge != CHALLENGE_RED_REDEMPTION) jacobs_curse_add(JACOBS_CURSE_FLOOR);
if (HasCollectible(COLLECTIBLE_EMPTY_HEART))
for (Entity_Player* player : {this, subPlayer})
@@ -1319,7 +1346,7 @@ void Entity_Player::spawn_low_health_blood_splat()
splat->sprite.rotation = (float)(Random() & 3) * 90;
splat->sprite.isFlipX = !(Random() & 1);
if (!HasCollectible(COLLECTIBLE_KIDNEY_STONE) && playerType != PLAYER_EVE && playerType != PLAYER_EVE_B)
splat->SetColor(color_from_bytes(0, 0, 0, PEE_ALPHA, PEE_OFFSET, PEE_OFFSET, 0), -1, COLOR_PRIORITY_TOP, false,
splat->SetColor(color_from_bytes(0, 0, 0, PEE_ALPHA, PEE_OFFSET, PEE_OFFSET, 0), -1, COLOR_PRIORITY_DEFAULT, false,
true);
splat->Update();
}
@@ -1462,7 +1489,7 @@ void Entity_Player::update_player_skin()
bool isBombForm = playerType == PLAYER_THEFORGOTTEN_B || playerType == PLAYER_THESOUL_B;
if (variant == PLAYER_VARIANT_PLAYER && !game.GetChallengeParams().isCanShoot && !isBombForm)
AddCostume(items.GetNullItem(NULLITEM_BLINDFOLD), false);
if (game.seedEffects.HasSeedEffect(SEED_CHRISTMAS) || game.dailyChallenge._specialDailyId == DAILY_CHRISTMAS)
if (game.seedEffects.HasSeedEffect(SEED_CHRISTMAS) || game.dailyChallenge.specialDailyId == DAILY_CHRISTMAS)
AddCostume(items.GetNullItem(NULLITEM_CHRISTMAS), false);
if (game.challenge == CHALLENGE_HOT_POTATO && playerType == PLAYER_THEFORGOTTEN_B)
AddCostume(items.GetNullItem(NULLITEM_FORGOTTEN_BOMB), false);
+38 -2
View File
@@ -38,8 +38,24 @@ constexpr int WEAPON_SLOT_COUNT = 5;
constexpr uint32_t QUEUED_TOUCHED = 0x1;
constexpr uint32_t QUEUED_GOLDEN = 0x2;
constexpr uint32_t TRINKET_GOLDEN_FLAG = 0x8000;
// Daemon's Tail lets a heart drop only one time in this many.
constexpr int DAEMONS_TAIL_HEART_ODDS = 5;
// Lucky Toe adds a drop two times in three.
constexpr uint32_t LUCKY_TOE_ODDS = 3;
constexpr uint32_t CARD_ITEM_FLAG = 0x8000;
constexpr int DEAD_CAT_LIVES = 9;
// Tainted Jacob's curse: its generator's shift, and the delays before Dark Esau charges, after a floor starts and
// after becoming Tainted Jacob, in steps of a second after a least.
struct JacobsCurseDelay
{
int minFrames = 0;
int steps = 0;
};
constexpr uint32_t JACOBS_CURSE_RNG_SHIFT = 66;
constexpr int JACOBS_CURSE_STEP_FRAMES = 30;
constexpr JacobsCurseDelay JACOBS_CURSE_FLOOR = {610, 20};
constexpr JacobsCurseDelay JACOBS_CURSE_CHANGE = {100, 3};
constexpr uint8_t WILD_CARD_NONE = 0xff;
constexpr uint8_t WILD_CARD_PILL = 0;
constexpr uint8_t WILD_CARD_CARD = 1;
@@ -142,11 +158,16 @@ enum BabySubType : int
BABY_PSY = 4,
BABY_YBAB = 7,
BABY_SHADOW = 13,
BABY_MAG = 18,
BABY_BEGOTTEN = 21,
BABY_DEAD = 22,
BABY_FIGHTING = 23,
BABY_GLITCH = 25,
BABY_MAGNET = 26,
BABY_BLACK = 27,
BABY_RED = 28,
BABY_WHITE = 29,
BABY_BLUE = 30,
BABY_SUPER_GREED = 54,
BABY_APOLLYON = 56,
BABY_BONE = 57,
@@ -248,6 +269,7 @@ enum Direction : int
// The head animations the player turns to, by direction.
constexpr std::string_view PLAYER_HEAD_ANIMS[] = {"HeadLeft", "HeadUp", "HeadRight", "HeadDown"};
constexpr std::string_view HEAD_SHOOT_ANIMS[] = {"HeadLeftShoot", "HeadUpShoot", "HeadRightShoot", "HeadDownShoot"};
// The layers of the player's sprite, in the order its .anm2 lists them: the glow, the body, the head and the top
// layers costumes can cover.
@@ -340,6 +362,12 @@ enum PlayerItemId : int
COLLECTIBLE_BOOK_OF_BELIAL = 34,
COLLECTIBLE_NECRONOMICON = 35,
COLLECTIBLE_POOP = 36,
COLLECTIBLE_HEART = 15,
COLLECTIBLE_COMMON_COLD = 103,
COLLECTIBLE_BUTT_BOMBS = 209,
COLLECTIBLE_DEAD_TOOTH = 446,
COLLECTIBLE_COMPOUND_FRACTURE = 453,
COLLECTIBLE_SINUS_INFECTION = 459,
COLLECTIBLE_TELEPORT = 44,
COLLECTIBLE_YUM_HEART = 45,
COLLECTIBLE_LUCKY_FOOT = 46,
@@ -507,6 +535,7 @@ enum PlayerItemId : int
COLLECTIBLE_TELEPORT_2 = 419,
COLLECTIBLE_BLACK_POWDER = 420,
COLLECTIBLE_GLOWING_HOUR_GLASS = 422,
COLLECTIBLE_CIRCLE_OF_PROTECTION = 423,
COLLECTIBLE_NIGHT_LIGHT = 425,
COLLECTIBLE_HEAD_OF_THE_KEEPER = 429,
COLLECTIBLE_TAROT_CLOTH = 451,
@@ -634,6 +663,7 @@ enum PlayerItemId : int
COLLECTIBLE_HEARTBREAK = 694,
COLLECTIBLE_BLOODY_GUST = 695,
COLLECTIBLE_SALVATION = 696,
COLLECTIBLE_VANISHING_TWIN = 697,
COLLECTIBLE_TWISTED_PAIR = 698,
COLLECTIBLE_VENGEFUL_SPIRIT = 702,
COLLECTIBLE_HYPERCOAGULATION = 724,
@@ -992,6 +1022,8 @@ enum PlayerItemId : int
COLLECTIBLE_LEO = 302,
COLLECTIBLE_D1 = 476,
COLLECTIBLE_BELT = 28,
COLLECTIBLE_MOMS_UNDERWEAR = 29,
COLLECTIBLE_MOMS_HEELS = 30,
COLLECTIBLE_BLUE_CAP = 342,
COLLECTIBLE_MR_BOOM = 37,
COLLECTIBLE_TAMMYS_HEAD = 38,
@@ -1027,6 +1059,7 @@ enum PlayerItemId : int
COLLECTIBLE_QUARTER = 74,
COLLECTIBLE_GHOST_BABY = 163,
COLLECTIBLE_HIVE_MIND = 248,
COLLECTIBLE_THERES_OPTIONS = 249,
COLLECTIBLE_DRY_BABY = 265,
COLLECTIBLE_EYE_OF_GREED = 450,
COLLECTIBLE_GHOST_PEPPER = 495,
@@ -1427,9 +1460,11 @@ public:
std::array<uint32_t, TRINKET_SLOT_COUNT> trinkets{};
uint32_t grantedCollectibleFlags = 0;
uint32_t playerFormsRewarded = 0;
uint32_t previewTrinket = 0;
int grantedCollectibleCountdown = 0;
int metronomeCollectibleId = 0;
int modelingClayEffect = 0;
int previewCollectible = 0;
int threeDollarBillItem = 0;
std::array<ActiveItemDesc, ACTIVE_SLOT_COUNT> activeItems{};
@@ -1509,7 +1544,7 @@ public:
std::shared_ptr<GameStatePlayer> unlistedRestoreState;
std::shared_ptr<PlayerHUD> playerHUD;
std::vector<Entity*> contactHitList;
std::vector<uint32_t> contactHitList;
std::vector<Entity*> darkArtsHitList;
std::vector<FamiliarData> curseMistFamiliars;
std::vector<int> pendingWisps;
@@ -1559,6 +1594,7 @@ public:
bool hasBabyRoomShield = false;
bool hasCurseMistEffect = false;
bool isCoopGhost = false;
bool isPreviewAdded = true;
bool isGlitchBaby = false;
bool isHeldEntityVisible = false;
@@ -1817,7 +1853,7 @@ private:
void starting_collectible_add(int id);
void starting_trinket_add(int id);
void companions_init();
void jacobs_curse_add();
void jacobs_curse_add(const JacobsCurseDelay& delay);
void start_position_set();
void ascent_start_set();
void level_items_apply(bool isForced);
+147 -13
View File
@@ -1,4 +1,6 @@
#include "entity_player.h"
#include "entity_knife.h"
#include "entity_laser.h"
#include "entity_player_characters.h"
#include "entity_player_crafting.h"
#include "entity_player_trinkets.h"
@@ -28,6 +30,7 @@
#include "npc_basement.h"
#include "npc_fireplace.h"
#include "room.h"
#include "room_state.h"
#include "room_special.h"
#include "tainted_characters.h"
#include <algorithm>
@@ -47,8 +50,6 @@ constexpr int CHARGE_FLASH_MAX = 12;
constexpr int EVENT_BATTERIES_COLLECTED = 195;
constexpr int GLOWING_HOUR_GLASS_LIT_USES = 3;
constexpr float THE_POOP_FART_RADIUS = 120;
constexpr int INPUT_HOOK_PRESSED = 0;
constexpr int INPUT_HOOK_TRIGGERED = 1;
constexpr int INPUT_RAW_ACTION = 33;
constexpr int MECONIUM_CHANCES[] = {33, 66, 100};
constexpr int MIDAS_POOP_CHANCE = 34;
@@ -84,6 +85,15 @@ constexpr float SPIDER_BUTT_SLOW = 0.9f;
constexpr float TAMMY_TEAR_DAMAGE = 25;
constexpr float TAMMY_TEAR_SCALE = 1.355f;
constexpr float TAMMY_TEAR_SPEED = 10;
// Tammy's Head's other rings: a beam's bonus per scale (and Mega Blast's beams: how high, how long, their damage
// scale and the shake), a bomb's, and the step between knives.
constexpr float TAMMY_BEAM_DAMAGE = 3.5f;
constexpr float TAMMY_BEAM_RISE = -30;
constexpr int TAMMY_BEAM_TIMEOUT = 30;
constexpr float TAMMY_BEAM_DAMAGE_SCALE = 5;
constexpr int TAMMY_BEAM_SHAKE = 15;
constexpr float TAMMY_BOMB_DAMAGE = 35;
constexpr float TAMMY_KNIFE_STEP = 36;
constexpr int METRONOME_TRIES = 15;
constexpr uint32_t METRONOME_RNG_SHIFT = 15;
constexpr int METRONOME_EXCLUDED[] = {488, 475, 422, 326, 482, 636, 640};
@@ -830,18 +840,103 @@ static void poop_use(ItemUse& use)
player.ShootCandle(Vector{});
}
// Tammy's Head: a ring of ten tears turned at random, bigger and with bonus damage a data value scales in percent.
// The rings of the other weapons are not written yet.
// One shot of Tammy's Head's ring: its direction, the bonus damage's scale, the ring's turn and the shot's place in it.
struct TammyShot
{
Vector direction{};
float scale = 1;
float turn = 0;
int index = 0;
};
// Tammy's Head with Mega Blast running: a ring of ten giant beams (Technology's when held) with the laser hit params,
// five times their damage and no delay, sounding as they start, and the screen shakes.
static void tammys_head_mega_blast(Entity_Player& player, float turn, float bonus)
{
int variant = player.HasCollectible(COLLECTIBLE_TECHNOLOGY) ? LASER_GIANT_BRIM_TECH : LASER_GIANT_RED;
for (int i = 0; i < TAMMY_TEAR_COUNT; i++)
{
Entity_Laser* laser = Entity_Laser::ShootAngle({.position = player.pos,
.posOffset = vector_make(0, TAMMY_BEAM_RISE),
.source = &player,
.angleDegrees = ((float)i / TAMMY_TEAR_COUNT + turn) * FULL_CIRCLE,
.timeout = TAMMY_BEAM_TIMEOUT,
.variant = variant});
int displacement = (int)(Random() % 2) * 2 - 1;
TearParams params = player.GetTearHitParams(WEAPON_LASER, 1, displacement, nullptr);
laser->SetCollisionDamage(params.tearDamage * TAMMY_BEAM_DAMAGE_SCALE + bonus);
laser->isDisableInitSound = false;
laser->tearFlags = params.tearFlags;
laser->tearFlags.reset(TEAR_WAIT);
laser->SetColor(player.laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
laser->Update();
}
game_shake_screen(TAMMY_BEAM_SHAKE);
}
// One shot of Tammy's Head's ring for another weapon along a direction, the tenth of the ring it is: a Dr. Fetus bomb,
// a Brimstone beam, a Technology laser on the player or a homing knife, each with bonus damage scaled to its weapon.
static void tammys_head_weapon_shot(Entity_Player& player, WeaponType weapon, const TammyShot& shot)
{
if (weapon == WEAPON_BOMBS)
{
Entity_Bomb* bomb = player.FireBomb(player.pos, vector_resized(shot.direction, TAMMY_TEAR_SPEED), nullptr);
bomb->explosionDamage += shot.scale * TAMMY_BOMB_DAMAGE;
bomb->Update();
return;
}
if (weapon == WEAPON_BRIMSTONE)
{
Entity_Laser* beam = player.FireBrimstone(shot.direction, nullptr, 1);
beam->SetCollisionDamage(beam->collisionDamage + shot.scale * TAMMY_BEAM_DAMAGE);
beam->Update();
return;
}
if (weapon == WEAPON_LASER)
{
Entity_Laser* laser = player.FireTechLaser(
{.direction = shot.direction, .position = player.pos, .isLeftEye = true, .isOneHit = true});
laser->SetCollisionDamage(laser->collisionDamage + shot.scale * TAMMY_TEAR_DAMAGE);
laser->posOffset = vector_make(0, laser->posOffset.y);
laser->Update();
return;
}
Entity_Knife* knife = player.FireKnife({.parent = &player, .subType = 1});
knife->rotation = normalize_angle_degrees((float)shot.index * TAMMY_KNIFE_STEP + shot.turn * FULL_CIRCLE);
knife->SetCollisionDamage(knife->collisionDamage + shot.scale * TAMMY_TEAR_DAMAGE);
knife->InitHomingPath(vector_from_angle(knife->rotation), &player, 0);
knife->Update();
}
// Tammy's Head: a ring of ten tears turned at random, bigger and with bonus damage a data value scales in percent, or
// a ring of whatever else the player shoots.
static void tammys_head_use(ItemUse& use)
{
Entity_Player& player = use.player;
float turn = random_unit();
float scale = use.request.varData != 0 ? use.request.varData / (float)PERCENT : 1;
if (player.megaBlastLaser)
{
tammys_head_mega_blast(player, turn, scale * TAMMY_BEAM_DAMAGE);
use.isShowAnimation = false;
return;
}
bool isOtherWeapon = player.HasWeaponType(WEAPON_BOMBS) || player.HasWeaponType(WEAPON_BRIMSTONE) ||
player.HasWeaponType(WEAPON_LASER) || player.HasWeaponType(WEAPON_KNIFE);
if (player.megaBlastLaser || isOtherWeapon)
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Tammy's Head with another weapon)");
if (isOtherWeapon)
{
WeaponType weapon = player.HasWeaponType(WEAPON_BOMBS) ? WEAPON_BOMBS
: player.HasWeaponType(WEAPON_BRIMSTONE) ? WEAPON_BRIMSTONE
: player.HasWeaponType(WEAPON_LASER) ? WEAPON_LASER
: WEAPON_KNIFE;
for (int i = 0; i < TAMMY_TEAR_COUNT; i++)
{
Vector direction = vector_from_angle(((float)i / TAMMY_TEAR_COUNT + turn) * FULL_CIRCLE);
tammys_head_weapon_shot(player, weapon, {.direction = direction, .scale = scale, .turn = turn, .index = i});
}
return;
}
float bonus = TAMMY_TEAR_DAMAGE * scale;
for (int i = 0; i < TAMMY_TEAR_COUNT; i++)
@@ -940,8 +1035,8 @@ static void book_of_revelations_use(ItemUse& use)
g_game->SetStateFlag(REVELATIONS_STATE_FLAG, true);
}
// A pedestal the D6 rerolls: another item from the pools, or none a quarter of the time for the Eternal D6, then a poof.
// The D6's wisps for Book of Virtues are not written yet.
// A pedestal the D6 rerolls: another item from the pools (with a wisp for Book of Virtues), or none a quarter of the
// time for the Eternal D6, then a poof.
static void pedestal_reroll(ItemUse& use, Entity_Pickup& pickup)
{
constexpr int ETERNAL_D6_RNG_SHIFT = 44;
@@ -964,11 +1059,23 @@ static void pedestal_reroll(ItemUse& use, Entity_Pickup& pickup)
pickup.Morph(pickup.type, pickup.variant, 0, true, false, false);
pickup.isTouched = false;
if (use.player.HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES) && use.isWispAllowed && use.id == COLLECTIBLE_D6)
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (the D6's wisps)");
use.player.AddWisp(COLLECTIBLE_D6, pickup.pos, false, false);
}
g_game->Spawn({.position = pickup.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
}
// The Eternal D6's wisps for Book of Virtues: one more, or every one of them dies, a coin flip.
static void eternal_d6_wisps_roll(Entity_Player& player)
{
if (Random() % 2 == 0)
{
player.AddWisp(COLLECTIBLE_ETERNAL_D6, player.pos, false, false);
return;
}
for (Entity* wisp : entity_query(ENTITY_FAMILIAR, Entity_Familiar::WISP))
if (wisp->subtype == COLLECTIBLE_ETERNAL_D6) wisp->Kill(EntityRef());
}
// The D6 and the Eternal D6: every pedestal item of the room rerolled.
static void d6_use(ItemUse& use)
{
@@ -989,7 +1096,7 @@ static void d6_use(ItemUse& use)
pedestal_reroll(use, *pickup);
}
if (use.id == COLLECTIBLE_ETERNAL_D6 && player.HasCollectible(COLLECTIBLE_BOOK_OF_VIRTUES) && use.isWispAllowed)
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (the Eternal D6's wisps)");
eternal_d6_wisps_roll(player);
}
if (!use.isShowAnimation) return;
@@ -1048,7 +1155,7 @@ static int metronome_item_roll(Entity_Player& player)
if (g_game->challenge == CHALLENGE_CANTRIPPED && ItemConfig::is_collectible_tagged(id, TAG_NO_CANTRIP)) continue;
if (id == COLLECTIBLE_DEATH_CERTIFICATE && chances.RandomFloat() >= METRONOME_DEATH_CERTIFICATE_CHANCE) continue;
if (id == COLLECTIBLE_GENESIS && chances.RandomFloat() >= METRONOME_GENESIS_CHANCE) continue;
if (g_game->dailyChallenge._id != 0 && id == COLLECTIBLE_FORGET_ME_NOW) continue;
if (g_game->dailyChallenge.id != 0 && id == COLLECTIBLE_FORGET_ME_NOW) continue;
if (!ItemConfig::IsValidCollectible(id) || !config.GetCollectible(id)) continue;
if (g_game->deathmatchManager.is_active())
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Metronome's pick in a versus match)");
@@ -2485,9 +2592,36 @@ bool active_pedestal_swap(Entity_Pickup& pickup, Entity_Player& player)
return true;
}
// Part of 006e8ae0: a golden battery hurts its taker for a heart and runs off to a random other room of the floor
// (outside the ultra secret room, in the current room's group or none), saved there to be found again.
static void golden_battery_escape(Entity_Pickup& battery, Entity_Player& player)
{
constexpr float GOLDEN_BATTERY_DAMAGE = 2;
constexpr int GOLDEN_BATTERY_COUNTDOWN = 30;
Game& game = *g_game;
player.TakeDamage(GOLDEN_BATTERY_DAMAGE, DAMAGE_INVINCIBLE | DAMAGE_NO_PENALTIES, EntityRef{},
GOLDEN_BATTERY_COUNTDOWN);
RoomDescriptor* current = game.GetCurrentRoomDesc();
std::vector<RoomDescriptor*> rooms;
for (int i = 0; i < game.nbRooms; i++)
{
RoomDescriptor& room = game.roomList[i];
bool isOpen = room.data && room.safeGridIndex >= 0 && room.data->type != ROOM_ULTRASECRET && &room != current;
if (isOpen && (room.group == current->group || room.group == -1)) rooms.push_back(&room);
}
if (rooms.empty()) return;
RoomDescriptor* target = rooms[battery.dropRNG.RandomInt((uint32_t)rooms.size())];
EntitySaveState state;
if (!entity_state_save(*game.room, battery, state, MINECART_REFUSED)) return;
state.targetPosition = {};
target->savedEntities.push_back(state);
}
// The battery part of 006e8ae0: a battery charges the first active slot that takes it (a normal or timed one), six
// charges for a lil' or golden battery and two for a micro one, while a mega battery overcharges every slot twice
// over. Whether it was taken. The golden battery's own effect is not written yet.
// over. Whether it was taken. A golden battery then runs off to another room.
bool battery_collect(Entity_Pickup& battery, Entity_Player& player)
{
bool isMega = battery.subtype == BATTERY_MEGA;
@@ -2507,6 +2641,6 @@ bool battery_collect(Entity_Pickup& battery, Entity_Player& player)
if (!isTaken) return false;
g_manager->persistentGameData.IncreaseEventCounter(EVENT_BATTERIES_COLLECTED, 1);
if (battery.subtype == BATTERY_GOLDEN) reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0 (a golden battery)");
if (battery.subtype == BATTERY_GOLDEN) golden_battery_escape(battery, player);
return true;
}
+1 -1
View File
@@ -184,7 +184,7 @@ constexpr std::array<D12Outcome, 29> D12_OUTCOMES = {
static D12Outcome d12_outcome_allowed(D12Outcome outcome)
{
PersistentGameData& data = g_manager->persistentGameData;
bool isDaily = g_game->dailyChallenge._id != 0;
bool isDaily = g_game->dailyChallenge.id != 0;
if (outcome.type == GRID_POOP && outcome.variant == 6 && !data.Unlocked(D12_ACHIEVEMENT_HOLY_POOP))
return {GRID_POOP, 0};
if (outcome.type == GRID_POOP && outcome.variant == 11 && !data.Unlocked(D12_ACHIEVEMENT_CHARMING_POOP))
+2 -1
View File
@@ -21,6 +21,7 @@
#include "pocket_items.h"
#include "room.h"
#include "room_grid.h"
#include "room_special.h"
#include "sfx_manager.h"
#include <array>
#include <map>
@@ -533,7 +534,7 @@ static void d20_use(ItemUse& use)
if (player.variant == PLAYER_VARIANT_PLAYER)
{
if (g_game->room->roomType == ROOM_SHOP)
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (the D20 in a shop: Room::ShopReshuffle 00816000)");
room_shop_reshuffle(*g_game->room, RESHUFFLE_KEEP_ITEMS);
for (Entity* entity : entity_query(ENTITY_PICKUP, -1))
{
if (entity->isDead || entity->variant == PICKUP_COLLECTIBLE) continue;
+6 -26
View File
@@ -123,11 +123,7 @@ constexpr float JAR_OF_WISPS_VIRTUES_CHANCE = 0.67f;
constexpr ColorMod MYSTERY_GIFT_COAL_COLOR = {{0.05f, 0.05f, 0.05f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr int GLOWING_HOUR_GLASS_REWINDS = 3;
constexpr int DOOR_SLOT_LAST = 7;
constexpr int D7_DUNGEON_GIDEON = 2;
constexpr int D7_DUNGEON_ROTGUT = 3;
constexpr int GENESIS_ROOM_SUBTYPE = 99;
constexpr int GENESIS_WISPS = 3;
constexpr RNG GENESIS_RNG_SHIFTS = {0, 3, 3, 26};
constexpr int R_KEY_RAISE_DELAY = 3;
constexpr int PEELER_BLOOD_SUBTYPE = 3;
constexpr int PEELER_GORE_MIN = 2;
@@ -1237,8 +1233,8 @@ static void glowing_hour_glass_use(ItemUse& use)
sound_play(SOUND_GLOWING_HOURGLASS_ACTIVATE);
}
// D7: the room's enemies come back to fight again, never in a boss room, the Beast's dungeon, Gideon's or Rotgut's
// crawl space, or at Home.
// D7: the room's enemies come back to fight again, never in a boss room, the Beast's dungeon, Rotgut's two crawl
// spaces (subtypes 2 and 3) or at Home.
static void d7_use(ItemUse& use)
{
Entity_Player& player = use.player;
@@ -1251,8 +1247,9 @@ static void d7_use(ItemUse& use)
use_animate(use);
}
RoomConfig_Room* data = room.descriptor->data;
bool isBossDungeon = room.roomType == ROOM_DUNGEON && data && (data->subtype == D7_DUNGEON_GIDEON || data->subtype == D7_DUNGEON_ROTGUT);
if (room.roomType == ROOM_BOSS || room.IsBeastDungeon() || isBossDungeon || g_game->stage == STAGE_HOME) return;
bool isRotgutDungeon = room.roomType == ROOM_DUNGEON && data &&
(data->subtype == DUNGEON_ROTGUT || data->subtype == DUNGEON_ROTGUT_HEART);
if (room.roomType == ROOM_BOSS || room.IsBeastDungeon() || isRotgutDungeon || g_game->stage == STAGE_HOME) return;
room.RespawnEnemies();
g_game->isRoomRespawned = true;
}
@@ -1273,22 +1270,6 @@ static void stitches_use(ItemUse& use)
stitches->Update();
}
// 0074bce0 The Genesis room made anew: a fresh descriptor with an Isaac's room of the special rooms' subtype 99,
// seeded from the devil room's generator.
static void genesis_room_prepare()
{
Game& game = *g_game;
RoomDescriptor* genesis = game.GetRoomByIdx(ROOM_GENESIS_IDX);
*genesis = RoomDescriptor{};
genesis->listIndex = ROOM_GENESIS_IDX;
RNG rng = GENESIS_RNG_SHIFTS;
rng._seed = game.devilAngelRoomRNG._seed;
genesis->InitSeeds(rng);
RoomQuery query = {.stageId = STAGE_ID_SPECIAL_ROOMS, .subtype = GENESIS_ROOM_SUBTYPE, .type = ROOM_ISAACS};
genesis->data = game.roomConfig.GetRandomRoom(rng.Next(), WEIGHT_KEEP, query);
}
// Genesis' three Book of Virtues wisps, once the player stands in the Genesis room.
static void genesis_wisps_add(Entity_Effect* timer)
{
@@ -1304,7 +1285,7 @@ static void genesis_use(ItemUse& use)
if (player.variant != PLAYER_VARIANT_PLAYER) return;
single_use_remove(use);
genesis_room_prepare();
g_game->InitializeGenesisRoom();
g_game->leaveDoor = -1;
g_game->StartRoomTransition({.player = player.GetMainTwin(), .animation = TRANSITION_TELEPORT, .dimension = 0,
.roomIndex = ROOM_GENESIS_IDX});
@@ -1320,7 +1301,6 @@ static void genesis_use(ItemUse& use)
static void r_key_restart(Entity_Effect*)
{
constexpr int STAGE_LAST_SAVED = 8;
constexpr int GREED_STAGE_ICON = -3;
constexpr int BOSS_RUSH_PAR = 36000;
constexpr int BOSS_RUSH_ALT_PAR = 45000;
constexpr float R_KEY_FADE_SPEED = 0.04f;
-1
View File
@@ -16,7 +16,6 @@
// The items a player's bombs ask about (Lua's CollectibleType and TrinketType).
constexpr int COLLECTIBLE_BOBBY_BOMB = 125;
constexpr int COLLECTIBLE_BUTT_BOMBS = 209;
constexpr int COLLECTIBLE_SAD_BOMBS = 220;
constexpr int COLLECTIBLE_BOMBER_BOY = 353;
constexpr int COLLECTIBLE_SCATTER_BOMBS = 366;
-4
View File
@@ -38,7 +38,6 @@ constexpr int WHEEL_CRANE_GAME_ACHIEVEMENT = 607;
constexpr int JUDGEMENT_ROTTEN_BEGGAR_ACHIEVEMENT = 614;
constexpr int BERKANO_LOCUSTS = 3;
constexpr int BERKANO_LOCUST_SUBTYPE = 25;
constexpr int DAEMONS_TAIL_HEART_ODDS = 5;
constexpr int DAGAZ_EVIL_CHARM_FRAMES = 600;
constexpr int DEATH_EVENT_COUNTER = 7;
constexpr int EMERGENCY_HANDS = 2;
@@ -70,9 +69,6 @@ constexpr float SUN_DAMAGE = 100;
constexpr float WHEEL_VOLUME = 1.2f;
constexpr int REVERSE_DEVIL_SOUND = 266;
// The bomb pickup subtypes IX - The Hermit? values higher (Lua's BombSubType, which entity_pickup.cpp keeps).
constexpr int BOMB_SUBTYPE_DOUBLEPACK = 2;
constexpr int BOMB_SUBTYPE_GOLDEN = 4;
constexpr int BOMB_SUBTYPE_GIGA = 7;
constexpr int BLANK_RUNE_KEEP_ODDS = 4;
constexpr int REVERSE_TOWER_RNG_SHIFT = 45;
constexpr int REVERSE_TOWER_FREE_WEIGHT = 5;
+233 -13
View File
@@ -3,6 +3,7 @@
#include "entity_effect.h"
#include "entity_familiar.h"
#include "entity_knife.h"
#include "entity_pickup.h"
#include "entity_player_tainted.h"
#include "game.h"
#include "hud.h"
@@ -19,6 +20,7 @@
#include <algorithm>
#include <array>
#include <cmath>
#include <ranges>
constexpr int CHARGE_STORE_MAX = 99;
constexpr int SOUL_CHARGE_CONSUMABLE = 0x20;
@@ -29,6 +31,8 @@ constexpr int DEATHMATCH_WHORE_RED_HEARTS = 16;
constexpr int NULLITEM_SLOW_A = 62;
constexpr int NULLITEM_SLOW_B = 65;
constexpr float AZAZELS_STUMP_DAMAGE_SCALE = 1.5f;
// The shift Esau's share of Jacob's hearts and items is rolled with, from Clicker's seed.
constexpr uint32_t ESAU_SPLIT_RNG_SHIFT = 59;
constexpr int MAGGY_HEART_LIMIT = 4;
constexpr int MAGGY_BIRTHRIGHT_HEART_LIMIT = 6;
constexpr int MAGGY_DRAIN_FRAMES = 300;
@@ -695,7 +699,7 @@ void Entity_Player::Revive()
// 007cf610 Lets go of what the old character brought once the player became another: a twin it had (Jacob's Esau,
// Tainted Forgotten's soul, Tainted Lazarus' other form) unless the twin is that character, Tainted Isaac's inventory
// and Tainted Jacob's curse (not reconstructed yet), Tainted Forgotten's flight, and its pocket active for the new
// and Tainted Jacob's curse, Tainted Forgotten's flight, and its pocket active for the new
// one's.
void Entity_Player::player_type_change_prepare(int oldType)
{
@@ -714,7 +718,7 @@ void Entity_Player::player_type_change_prepare(int oldType)
if (playerType == PLAYER_ISAAC_B) tainted_isaac_inventory_trim(*this);
if ((playerType == PLAYER_JACOB_B || playerType == PLAYER_JACOB2_B) &&
!temporaryEffects.HasNullEffect(NULLITEM_JACOBS_CURSE))
reconstruction_missing("Entity_Player::player_type_change_prepare 007cf610 (Tainted Jacob's curse)");
jacobs_curse_add(JACOBS_CURSE_CHANGE);
if (oldType == PLAYER_THEFORGOTTEN_B)
{
cacheFlags |= CACHE_FLYING;
@@ -831,6 +835,130 @@ static void health_type_apply(Entity_Player& player, HealthType health)
}
}
// The hearts Esau takes from Jacob: about half of each kind, rolled from a copy of Clicker's generator.
struct EsauHearts
{
int black = 0;
int bone = 0;
int golden = 0;
int max = 0;
int red = 0;
int rotten = 0;
int soul = 0;
};
// Half of an amount, its odd half rolled up or down.
static int esau_half_roll(RNG& rng, int amount)
{
return (int)rng.RandomInt((uint32_t)(amount % 2 + 1)) + amount / 2;
}
// Esau's share of Jacob's hearts: whole heart containers, bone hearts, red hearts as far as his containers hold them
// (and whatever Jacob's own can no longer hold), rotten hearts as far as his red hearts hold them, soul and golden
// hearts.
static EsauHearts esau_hearts_roll(Entity_Player& jacob, RNG& rng)
{
EsauHearts esau;
esau.max = esau_half_roll(rng, (jacob.maxHearts + 1) / 2) * 2;
esau.bone = esau_half_roll(rng, jacob.boneHearts);
esau.red = std::min(esau_half_roll(rng, jacob.redHearts), esau.max + esau.bone * 2);
esau.red += std::max(0, esau.max + (esau.bone - jacob.boneHearts) * 2 - jacob.maxHearts - esau.red + jacob.redHearts);
esau.rotten = std::min(esau_half_roll(rng, jacob.rottenHearts), (esau.red + 1) / 2);
esau.rotten += std::max(0, jacob.rottenHearts - (jacob.redHearts - esau.red) / 2 - esau.rotten);
esau.soul = esau_half_roll(rng, jacob.soulHearts);
esau.golden = esau_half_roll(rng, jacob.goldenHearts);
return esau;
}
// Whether Esau takes a history entry of Jacob's: a passive collectible Jacob still has or a smelted trinket, on an even
// roll.
static bool esau_item_takes(Entity_Player& jacob, const HistoryItem& entry, RNG& rng)
{
if (entry.isTrinket)
{
SmeltedTrinket& smelted = jacob.smeltedTrinkets[entry.id & TRINKET_ID_MASK];
return (smelted.count > 0 || smelted.goldenCount > 0) && (rng.Next() & 1) == 0;
}
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(entry.id);
return jacob.CanRerollCollectible(entry.id, false) && item->type != ITEM_ACTIVE &&
jacob.collectibleCounts[entry.id] > 0 && (rng.Next() & 1) == 0;
}
// Moves a history entry from Jacob to Esau: a collectible with its costume when it shows one, or a smelted trinket with
// its costume when Esau had none of it.
static void esau_item_take(Entity_Player& jacob, Entity_Player& esau, size_t index)
{
HistoryItem entry = jacob.history.historyItems[index];
ItemConfig& config = g_manager->itemConfig;
if (!entry.isTrinket)
{
ItemConfig_Item* item = config.GetCollectible(entry.id);
esau.collectibleCounts[entry.id]++;
if (item->isAddCostumeOnPickup) esau.AddCostume(item, false);
esau.history.AddHistoryItem(entry);
jacob.history.historyItems.erase(jacob.history.historyItems.begin() + (long)index);
jacob.history.remove_index_refs((int)index);
jacob.RemoveCollectible(entry.id, true, ACTIVE_SLOT_PRIMARY, true);
return;
}
int id = entry.id & TRINKET_ID_MASK;
SmeltedTrinket& smelted = esau.smeltedTrinkets[id];
if (smelted.count < 1 && smelted.goldenCount < 1) esau.AddCostume(config.GetTrinket(id), false);
if (entry.id & TRINKET_GOLDEN_FLAG) smelted.goldenCount++;
else smelted.count++;
esau.history.AddHistoryItem(entry);
jacob.TryRemoveSmeltedTrinket((uint32_t)entry.id);
jacob.history.historyItems.erase(jacob.history.historyItems.begin() + (long)index);
jacob.history.remove_index_refs((int)index);
}
// The ChangePlayerType part that makes a player Jacob: Esau joins with about half of each kind of heart and every other
// passive collectible and smelted trinket Jacob picked up, both keep at least half a heart, and Jacob drops his pocket
// items.
static void esau_split(Entity_Player& jacob)
{
Entity_Player* esau = jacob.InitTwin(PLAYER_ESAU);
esau->InitPostLevelInitStats();
RNG rng = rng_make(jacob.collectibleRNGs[COLLECTIBLE_CLICKER]._seed, ESAU_SPLIT_RNG_SHIFT);
EsauHearts share = esau_hearts_roll(jacob, rng);
esau->maxHearts = share.max;
esau->AddBoneHearts(share.bone);
esau->soulHearts = share.soul;
esau->redHearts = share.red;
esau->blackHearts |= jacob.blackHearts << ((jacob.soulHearts - share.soul) / 2 & 31);
esau->goldenHearts = share.golden;
esau->rottenHearts = share.rotten;
esau->brokenHearts = jacob.brokenHearts;
if (share.soul > 0) jacob.AddSoulHearts(-share.soul, false);
if (share.red > 0) jacob.AddHearts(-share.red, false, false);
if (share.bone > 0) jacob.AddBoneHearts(-share.bone);
if (share.max > 0) jacob.AddMaxHearts(-share.max, false);
jacob.goldenHearts -= share.golden;
jacob.rottenHearts -= share.rotten;
for (Entity_Player* each : {&jacob, esau})
if (each->soulHearts + each->redHearts + each->boneHearts < 1) each->AddSoulHearts(1, false);
for (Entity_Player* each : {&jacob, esau})
{
each->ClampGoldenHearts(false);
each->update_bone_hearts();
each->UpdateHeartDependentEffects();
}
jacob.history.isLocked = true;
for (size_t i = 0; i < jacob.history.historyItems.size();)
{
if (esau_item_takes(jacob, jacob.history.historyItems[i], rng)) esau_item_take(jacob, *esau, i);
else i++;
}
jacob.history.isLocked = false;
esau->cacheFlags = CACHE_ALL;
esau->EvaluateItems();
g_game->hud.mark_all_slots_dirty(HISTORY_KEEP_ICONS, HISTORY_KEEP_ITEMS);
for (uint32_t slot = 0; slot < jacob.GetMaxPocketItems(); slot++)
jacob.DropPocketItem((int)slot, room_free_pickup_position_find({.position = jacob.pos}));
}
// The ChangePlayerType part that takes a twin's hearts into the player that no longer needs it: the most broken hearts,
// then its containers, bone, eternal, red, soul and golden hearts, its black ones after the player's soul hearts, and
// its rotten ones as far as the red hearts hold them.
@@ -914,8 +1042,7 @@ void Entity_Player::ChangePlayerType(int newType, bool isKeepState)
AddEternalHearts(0);
if (playerType == PLAYER_JACOB)
{
if (!isKeepState)
reconstruction_missing("Entity_Player::ChangePlayerType 007ce6e0 (Jacob splitting his hearts with Esau)");
if (!isKeepState) esau_split(*this);
}
else if (Entity_Player* twin = twin_get(); twin && !isKeepState) twin_hearts_take(*this, *twin);
if (playerType == PLAYER_BETHANY && soulHearts > 0)
@@ -1219,10 +1346,98 @@ constexpr int BIRTHRIGHT_HEARTS = 2;
constexpr int BIRTHRIGHT_RED_STEW_FRAMES = 1800;
constexpr int BIRTHRIGHT_RECALL_SLOT = 2;
constexpr int BIRTHRIGHT_BETHANY_EFFECTS = 4;
// Eden's Birthright offers three collectibles, each rolled up to a hundred times. The twins share three.
constexpr int EDEN_BIRTHRIGHT_ITEMS = 3;
constexpr int EDEN_BIRTHRIGHT_TRIES = 100;
constexpr size_t TWINS_BIRTHRIGHT_ITEMS = 3;
// Part of 0075f0e0: what Birthright does as it is picked up, by character. Judas's Book of Belial swap, Eden's three
// items and Jacob and Esau's shared items are not reconstructed yet.
void birthright_gain(Entity_Player& player, bool isFirstTime)
// Judas' Birthright: a Book of Belial held in either active slot (the second first) turns into the kept Book of
// Belial, keeping its charges.
static void judas_belial_keep(Entity_Player& player)
{
for (int slot = ACTIVE_SLOT_SECONDARY; slot >= ACTIVE_SLOT_PRIMARY; slot--)
{
ActiveItemDesc& active = player.activeItems[slot];
if (active.item != COLLECTIBLE_BOOK_OF_BELIAL) continue;
ActiveItemDesc kept = active;
player.RemoveCollectible(COLLECTIBLE_BOOK_OF_BELIAL, true, slot, false);
if (active.item != COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE) continue;
active = kept;
active.item = COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE;
}
}
// A random passive collectible Eden's Birthright offers: any available one Eden may roll, else the room's pool draw,
// taken out of the pools. None after a hundred misses and an empty pool.
static int eden_birthright_roll(RNG& rng)
{
ItemConfig& config = g_manager->itemConfig;
for (int tries = 0; tries < EDEN_BIRTHRIGHT_TRIES; tries++)
{
int id = (int)rng.RandomInt((uint32_t)config.collectibles.size() - 1) + 1;
ItemConfig_Item* item = config.GetCollectible(id);
if (!ItemConfig::IsValidCollectible(id) || (item->tags & TAG_NO_EDEN) || !item->IsAvailable(UNLOCK_CHECKED) ||
item->type == ITEM_ACTIVE)
continue;
g_game->itemPool.RemoveCollectible(id, REMOVE_ANY, REMOVE_APPLY);
return id;
}
int id = g_game->itemPool.GetSeededCollectible(rng._seed, 0, *g_game->room->descriptor);
if (id != 0) g_game->itemPool.RemoveCollectible(id, REMOVE_ANY, REMOVE_APPLY);
return id;
}
// Eden's Birthright: three collectibles to choose one of, each by its first pool.
static void eden_birthright_offer(Entity_Player& player, RNG& rng)
{
int optionsIndex = -1;
for (int i = 0; i < EDEN_BIRTHRIGHT_ITEMS; i++)
{
Vector position = room_free_pickup_position_find({.position = player.pos, .step = PICKUP_SPOT_STEP});
int id = eden_birthright_roll(rng);
auto* item = static_cast<Entity_Pickup*>(g_game->Spawn({.position = position,
.subType = id,
.type = ENTITY_PICKUP,
.variant = PICKUP_COLLECTIBLE,
.seed = rng.Next()}));
item->itemPoolType = g_game->itemPool.GetFirstItemPoolForCollectible(id);
if (optionsIndex < 0) optionsIndex = item->AssignOptionsIndex();
else item->optionsPickupIndex = optionsIndex;
}
}
// Jacob's and Esau's Birthright: the lead twin takes copies of the last three passive collectibles or trinkets its twin
// picked up, the oldest first (trinkets straight into its smelted ones).
static void twins_birthright_share(Entity_Player& player)
{
Entity_Player* twin = player.twin_get();
if (!twin || player.parent) return;
std::vector<int> shared;
std::vector<HistoryItem>& items = twin->history.historyItems;
for (int i = (int)items.size() - 1; i >= 0 && shared.size() < TWINS_BIRTHRIGHT_ITEMS; i--)
{
const HistoryItem& entry = items[i];
if (entry.isTrinket) shared.push_back(-entry.id);
else if (player.CanRerollCollectible(entry.id, false) &&
g_manager->itemConfig.GetCollectible(entry.id)->type != ITEM_ACTIVE &&
twin->collectibleCounts[entry.id] > 0)
shared.push_back(entry.id);
}
for (int id : std::views::reverse(shared))
{
if (id > 0) player.AddCollectible(id, 0, false, ACTIVE_SLOT_PRIMARY, 0, 0);
if (id >= 0) continue;
uint32_t trinket = (uint32_t)-id;
player.history.AddHistoryItem({g_game->frameCount, true, (int)trinket, 1, 0, 1, 0});
SmeltedTrinket& smelted = player.smeltedTrinkets[trinket & TRINKET_ID_MASK];
if (trinket & TRINKET_GOLDEN_FLAG) smelted.goldenCount++;
else smelted.count++;
}
}
// Part of 0075f0e0: what Birthright does as it is picked up, by character.
void birthright_gain(Entity_Player& player, RNG& rng, bool isFirstTime)
{
switch (player.playerType)
{
@@ -1233,21 +1448,26 @@ void birthright_gain(Entity_Player& player, bool isFirstTime)
player.AddMaxHearts(BIRTHRIGHT_HEARTS, false);
player.AddHearts(BIRTHRIGHT_HEARTS, false, false);
return;
case PLAYER_JUDAS:
case PLAYER_BLACKJUDAS: return judas_belial_keep(player);
case PLAYER_EVE: return player.UpdateHeartDependentEffects();
case PLAYER_EDEN:
if (isFirstTime) eden_birthright_offer(player, rng);
return;
case PLAYER_LAZARUS2:
if (isFirstTime) player.redStewBonusDuration = BIRTHRIGHT_RED_STEW_FRAMES;
return;
case PLAYER_JACOB:
case PLAYER_ESAU:
if (isFirstTime) twins_birthright_share(player);
return;
case PLAYER_EDEN_B: player.edenBirthrightFrame = g_game->frameCount + 1; return;
case PLAYER_THEFORGOTTEN_B: return player.SetPocketActiveItem(COLLECTIBLE_RECALL, BIRTHRIGHT_RECALL_SLOT, false);
case PLAYER_BETHANY_B:
if (isFirstTime) player.temporaryEffects.AddNullEffect(NULLITEM_BETHANY_B_BIRTHRIGHT, false, BIRTHRIGHT_BETHANY_EFFECTS);
return;
case PLAYER_JUDAS:
case PLAYER_BLACKJUDAS:
case PLAYER_EDEN:
case PLAYER_JACOB:
case PLAYER_ESAU:
reconstruction_missing("Entity_Player::AddCollectible 0075f0e0 (this character's Birthright)");
default:
return;
}
}
+1 -1
View File
@@ -58,7 +58,7 @@ ButtonAction twin_button_action(Entity_Player& player, TwinButton button);
bool is_twin_button_blocked(Entity_Player& player, TwinButton button);
// Birthright's pickup effect by character (part of 0075f0e0).
void birthright_gain(Entity_Player& player, bool isFirstTime);
void birthright_gain(Entity_Player& player, RNG& rng, bool isFirstTime);
// Cambion Conception's count of hits (part of 007729d0).
void cambion_conception_hit(Entity_Player& player);
+64 -2
View File
@@ -1,4 +1,8 @@
#include "entity_player.h"
#include "item_config.h"
#include "seeds.h"
#include "npc_ai.h"
#include "entity_bomb.h"
#include "game.h"
#include "log.h"
#include "manager.h"
@@ -10,6 +14,14 @@
#include <set>
#include <string>
// Hot Potato's bomb head: its blast's damage (more for a big bomb), radius, and the throw it gives the player.
constexpr float HOT_POTATO_DAMAGE = 60;
constexpr float HOT_POTATO_BIG_DAMAGE = 110;
constexpr float HOT_POTATO_BIG_SCALE = 1.5f;
constexpr float HOT_POTATO_RADIUS = 1.25f;
constexpr float HOT_POTATO_KNOCK_MIN = 2;
constexpr float HOT_POTATO_KNOCK_RANGE = 3;
constexpr float HOT_POTATO_KNOCK_HEIGHT = 8;
constexpr float BLEED_OUT_TINT_HEALTH = 150;
constexpr int REVERSE_CHARIOT_FLASH_FRAMES = 90;
constexpr float HEAD_LIFT_PER_HEAD_SCALE = 2.5f;
@@ -197,10 +209,60 @@ static void squash_look_read(Entity_Player& player, LayerLook& look)
look.offsetX = REVERSE_CHARIOT_SHAKE[std::min(player.reverseChariotMoveCooldown, REVERSE_CHARIOT_SHAKE_LAST)];
}
// Hot Potato's bomb head blowing up: an explosion of the player's own bomb near him (stronger for a big bomb) that
// knocks him into the air.
static void hot_potato_explode(Entity_Player& player)
{
TearFlags flags = player.GetBombFlags(false);
bool isBig = player.check_bomb_tearflags(flags) >= HOT_POTATO_BIG_SCALE;
float damage = isBig ? HOT_POTATO_BIG_DAMAGE : HOT_POTATO_DAMAGE;
explosion_effects({.tearFlags = flags,
.color = player.color,
.position = vector_add(player.pos, random_direction()),
.source = &player,
.damage = damage,
.radiusMultiplier = HOT_POTATO_RADIUS,
.isDamageSource = true});
player.velocity = {};
Vector knock = vector_scale(random_direction(), random_unit() * HOT_POTATO_KNOCK_RANGE + HOT_POTATO_KNOCK_MIN);
player.TryThrow(EntityRef(), knock, HOT_POTATO_KNOCK_HEIGHT);
}
// Hot Potato's bomb head on Tainted Forgotten: its pulse starts, and each pulse that ends outside his extra and item
// animations blows up and pulses again. Those animations stop it. The pulse's HeadAnim null moves, sizes and tints his
// head and body.
static void hot_potato_head_update(Entity_Player& player, LayerLook& look)
{
ItemConfig_Item* bombHead = g_manager->itemConfig.GetNullItem(NULLITEM_FORGOTTEN_BOMB);
for (PlayerCostumeMap& map : player.playerCostumeMap)
{
if (map.index < 0 || map.isBodyLayer) continue;
ANM2& sprite = player.costumeSpriteDescs[map.index].sprite;
if (player.costumeSpriteDescs[map.index].item != bombHead) continue;
if (!sprite.overlayAnimState.animData) sprite.PlayOverlay("Pulse");
else if (player.isPlayingExtraAnimation || player.isPlayingItemAnimation) sprite.RemoveOverlay();
else if (sprite.IsOverlayFinished())
{
sprite.PlayOverlay("Pulse", PLAY_FORCED);
hot_potato_explode(player);
}
if (!sprite.overlayAnimState.animData) return;
if (const NullFrame* pulse = sprite.overlayAnimState.GetNullFrame("HeadAnim"))
{
look.headSize = vector_mul(look.headSize, pulse->scale);
look.headOffset = vector_add(look.headOffset, pulse->pos);
color_multiply(look.headColor, pulse->color);
color_multiply(look.bodyColor, pulse->color);
}
return;
}
}
// Reads how the player's layers draw this frame: the head's size from the head costume's frame (Pluto's and Inner
// Child's heads keep theirs), Adrenaline's heartbeat, the head's offset and size from the body costume's HeadTransform
// null (lower under Tainted Lilith's Gello, riding Tainted Forgotten's height), the effects' tints and squashes, and a
// bleeding out player reddening. Hot Potato's bomb head and a remote player's fading stop the game until reached.
// bleeding out player reddening, and Hot Potato's bomb head. A remote player's fading stops the game until reached.
static void layer_look_read(Entity_Player& player, LayerLook& look)
{
PlayerCostumeMap& head = player.playerCostumeMap[PLAYER_LAYER_HEAD];
@@ -230,7 +292,7 @@ static void layer_look_read(Entity_Player& player, LayerLook& look)
tint_look_read(player, look);
squash_look_read(player, look);
if (g_game->challenge == CHALLENGE_HOT_POTATO && player.playerType == PLAYER_THEFORGOTTEN_B)
reconstruction_missing("Entity_Player::Update 00782af0 (Hot Potato's bomb head)");
hot_potato_head_update(player, look);
if (player.playerType == PLAYER_THEFORGOTTEN_B) look.headOffset.y += player.forgottenBHeight;
bool isBleeding = player.HasEntityFlags(FLAG_BLEED_OUT) && player.bleedSource.entity == &player &&
+50 -3
View File
@@ -4,6 +4,8 @@
#include "entity_knife.h"
#include "entity_pickup.h"
#include "game.h"
#include "game_state.h"
#include "game_state_player.h"
#include "hud.h"
#include "item_pool.h"
#include "manager.h"
@@ -509,16 +511,61 @@ void Entity_Player::tainted_cain_pedestal_burst(Vector position, uint32_t seed,
}
}
// The Glowing Hourglass' state a rewind would go back to: the other slot's when it is kept, else the current one's.
// None before a slot was saved.
static GlowingHourglassState* glowing_hourglass_state_find()
{
Game& game = *g_game;
int slot = game.currentGlowingHourglassSlot;
if (slot < 0) return nullptr;
GlowingHourglassState* state = &game.glowingHourglassStates[1 - slot];
if (!state->isUsable) state = &game.glowingHourglassStates[slot];
return state->isUsable ? state : nullptr;
}
// The Cantripped bag's oldest item card: shown, counted among the room's temporary collectibles, then used as its
// active or picked up as its passive with its name shown. A Glowing Hourglass card is also struck from the rewind's
// saved cards, so a rewind cannot bring it back.
static void cantripped_card_play(Entity_Player& player)
{
int card = player.itemCards.front();
player.AnimateCollectible(card, "UseItem", "PlayerPickupSparkle");
player.roomTemporaryCollectibles[card]++;
if (ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(card))
{
GlowingHourglassState* state = glowing_hourglass_state_find();
int index = player.glowingHourglassIndex;
if (item->id == COLLECTIBLE_GLOWING_HOUR_GLASS && state && index >= 0 &&
index < (int)state->gameState.players.size())
{
std::vector<int>& saved = state->gameState.players[index].itemCards;
if (auto found = std::ranges::find(saved, (int)COLLECTIBLE_GLOWING_HOUR_GLASS); found != saved.end())
saved.erase(found);
}
if (item->type == ITEM_ACTIVE) player.UseActiveItem({.item = item->id, .flags = USE_OWNED});
else player.AddCollectible(item->id, 0, true, ACTIVE_SLOT_PRIMARY, 0, 0);
g_game->hud.ShowItemText(&player, item);
}
npc_sound_play(SOUND_POWERUP1, 1, 2, 1);
player.itemCards.erase(player.itemCards.begin());
g_game->hud.mark_all_slots_dirty(HISTORY_KEEP_ICONS, HISTORY_KEEP_ITEMS);
}
// The Bag of Crafting part of 005b39d0: used from a main slot with a craft ready, the bag drops the crafted item on a
// pedestal (counted from its pool, with a wisp under Book of Virtues) and empties with a thumbs up. From the pocket it
// is lifted to swing. The animation the player shows, none for a co-op baby. The Cantripped challenge's card bag is not
// written yet.
// is lifted to swing. In Cantripped it plays its oldest item card instead. The animation the player shows, none for a
// co-op baby or an empty card bag.
const char* bag_of_crafting_use(Entity_Player& player, int slot)
{
if (player.variant != PLAYER_VARIANT_PLAYER) return nullptr;
crafting_sound_play(SOUND_BAG_OF_CRAFTING);
if (g_game->challenge == CHALLENGE_CANTRIPPED)
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (the Cantripped bag's cards)");
{
if (player.itemCards.empty()) return nullptr;
cantripped_card_play(player);
return nullptr;
}
if ((slot != ACTIVE_SLOT_PRIMARY && slot != ACTIVE_SLOT_SECONDARY) || player.bagOfCraftingOutput == 0)
{
player.SetItemState(COLLECTIBLE_BAG_OF_CRAFTING);
+1 -1
View File
@@ -859,7 +859,7 @@ bool Entity_Player::TakeDamage(float damage, uint64_t damageFlags, const EntityR
bool isGhost = playerType == PLAYER_THELOST || playerType == PLAYER_THELOST_B || playerType == PLAYER_THESOUL_B;
if (isGhost || HasInstantDeathCurse() || isDead) return false;
spawn_ghost_corpse();
if (!temporaryEffects.HasNullEffect(NULLITEM_LOST_CURSE)) game.playerManager.add_lost_curse(NULLITEM_LOST_CURSE);
if (!temporaryEffects.HasNullEffect(NULLITEM_LOST_CURSE)) game.playerManager.add_lost_curse();
sound_play(SOUND_FIREDEATH_HISS);
// The controllers' rumble is not wired here.
return true;
+138 -8
View File
@@ -6,6 +6,14 @@
#include "entity_list.h"
#include "entity_npc.h"
#include "entity_player.h"
#include "fx_layers.h"
#include "active_items.h"
#include "npc_ai.h"
#include "npc_basement.h"
#include "entity_tear.h"
#include "entity_pickup.h"
#include "entity_config.h"
#include "entity_bomb.h"
#include "entity_player_characters.h"
#include "game.h"
#include "item_config.h"
@@ -28,6 +36,31 @@ constexpr int SPECIAL_DAILY_SHUFFLED_ITEMS = 7;
constexpr float DEATH_FRICTION = 0.6f;
constexpr int DEATH_FRAME_TWIN_FALLS = 7;
constexpr int DEATH_FRAME_BONES_BREAK = 19;
// Tainted Forgotten's bones: the Hot Potato giga bomb's damage, and how many bones scatter how far.
constexpr float HOT_POTATO_DEATH_DAMAGE = 60;
constexpr int FORGOTTEN_BONES = 6;
constexpr float FORGOTTEN_BONES_SPREAD = 40;
// Tainted ???'s last poops: the fart and poop behind him, his brown splashes (their speed, growth and color), the
// poop pickups' speed and at most 19 of them, all within an arc behind him.
constexpr float BLUE_BABY_POOP_BEHIND = 10;
constexpr float BLUE_BABY_FART_RADIUS = 120;
constexpr float BLUE_BABY_SPRAY_BEHIND = 4;
constexpr float BLUE_BABY_SCATTER_ARC = 40;
constexpr int BLUE_BABY_SPLASHES = 6;
constexpr float BLUE_BABY_SPLASH_SPEED_MIN = 6;
constexpr float BLUE_BABY_SPLASH_SPEED_RANGE = 20;
constexpr float BLUE_BABY_SPLASH_GROWTH = 1.5f;
constexpr ColorMod BLUE_BABY_SPLASH_COLOR = {{0.4f, 0.33f, 0.25f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr float BLUE_BABY_POOP_SPEED_MIN = 3;
constexpr float BLUE_BABY_POOP_SPEED_RANGE = 6;
constexpr int BLUE_BABY_POOPS_MAX = 18;
// The ghost a dead player's Vade Retro releases: its size, damage, cry and shake.
constexpr float VADE_RETRO_GHOST_SCALE = 1.5f;
constexpr float VADE_RETRO_GHOST_DAMAGE = 200;
constexpr float VADE_RETRO_GHOST_VOLUME = 1.25f;
constexpr float VADE_RETRO_GHOST_PITCH_MIN = 0.9f;
constexpr float VADE_RETRO_GHOST_PITCH_RANGE = 0.2f;
constexpr int VADE_RETRO_GHOST_SHAKE = 14;
constexpr int PAPER_FRAME_PERIOD = 4;
constexpr int PAPER_FRAME_SINGLE = 3;
constexpr int PAPER_FRAME_DOUBLE = 2;
@@ -155,7 +188,7 @@ static bool is_missing_poster_unlocked()
{
Manager& manager = *g_manager;
bool isExemptRun =
manager.state == MANAGER_STATE_GAME && g_game && (g_game->dailyChallenge._id != 0 || g_game->isDebug);
manager.state == MANAGER_STATE_GAME && g_game && (g_game->dailyChallenge.id != 0 || g_game->isDebug);
return manager.persistentGameData.achievements[ACHIEVEMENT_THE_LOST] || isExemptRun;
}
@@ -757,6 +790,104 @@ static bool is_run_lost(Entity_Player& dying)
return true;
}
// Tainted Forgotten's bones break as he dies: his weapons go, and in Hot Potato he blows up as a giga bomb, else his
// bones scatter in a cloud of dust.
static void forgotten_bones_break(Entity_Player& player)
{
for (size_t slot = 1; slot <= player.weapons.size(); slot++) player.weapons[slot % player.weapons.size()].reset();
if (g_game->challenge == CHALLENGE_HOT_POTATO)
{
TearFlags giga;
giga.set(TEAR_GIGA_BOMB);
explosion_effects({.tearFlags = giga, .position = player.pos, .source = &player,
.damage = HOT_POTATO_DEATH_DAMAGE, .isDamageSource = true});
return;
}
gibs_spawn({.color = player.color,
.position = player.pos,
.spawner = &player,
.spread = FORGOTTEN_BONES_SPREAD,
.amount = FORGOTTEN_BONES,
.gibFlags = GIB_FLAG_BONE | GIB_FLAG_SOUND_BONE | GIB_FLAG_DUST});
npc_sound_play(SOUND_DEATH_BURST_BONE, 1, 2, 1);
}
// The flight of a bit Tainted ??? leaves behind: backwards, turned up to 20 degrees either way, at a random speed.
static Vector blue_baby_scatter_velocity(float speedMin, float speedRange)
{
float turn = random_unit() * BLUE_BABY_SCATTER_ARC - BLUE_BABY_SCATTER_ARC / 2;
Vector direction = vector_rotated(vector_make(-1, 0), turn);
return vector_scale(direction, random_unit() * speedRange + speedMin);
}
// Tainted ???'s death: a last fart and a poop behind him, a spray of brown splashes, and his spare poop mana falling out
// as poop pickups (fewer the more falls), one frame apart.
static void blue_baby_last_poops(Entity_Player& player)
{
Vector behind = vector_make(player.pos.x - BLUE_BABY_POOP_BEHIND, player.pos.y);
game_butter_bean_fart({.position = behind, .source = &player, .radius = BLUE_BABY_FART_RADIUS});
g_game->Spawn({.position = behind, .type = ENTITY_POOP, .seed = Random()});
Vector spray = vector_make(player.pos.x - BLUE_BABY_SPRAY_BEHIND, player.pos.y);
for (int i = 0; i < BLUE_BABY_SPLASHES; i++)
{
uint32_t seed = Random();
Vector velocity = blue_baby_scatter_velocity(BLUE_BABY_SPLASH_SPEED_MIN, BLUE_BABY_SPLASH_SPEED_RANGE);
Entity* splash = g_game->Spawn({.position = spray, .velocity = velocity, .subType = 1,
.type = ENTITY_EFFECT, .variant = EFFECT_WATER_SPLASH, .seed = seed});
splash->sprite.scale = vector_scale(splash->sprite.scale, random_unit() * BLUE_BABY_SPLASH_GROWTH + 1);
splash->sprite.color = BLUE_BABY_SPLASH_COLOR;
splash->Update();
}
for (int i = 0; i < player.poopMana && i <= BLUE_BABY_POOPS_MAX; i++)
{
uint32_t seed = Random();
Vector velocity = blue_baby_scatter_velocity(BLUE_BABY_POOP_SPEED_MIN, BLUE_BABY_POOP_SPEED_RANGE);
auto* poop = static_cast<Entity_Pickup*>(g_game->Spawn({.position = spray, .velocity = velocity,
.type = ENTITY_PICKUP, .variant = PICKUP_POOP,
.seed = seed}));
poop->dropDelay = i;
poop->Update();
player.AddPoopMana(-1);
}
}
// Where the dying player's ghost layer shows, from the player: the middle of its keyframe's quad, in world units. None
// when the animation has no track for it.
static Vector ghost_layer_offset(Entity_Player& player, const LayerState& ghost, const AnimationFrame& frame)
{
const AnimationData* data = player.sprite.animState.animData;
int layerId = ghost.layerData->id;
if (!data || data->layerMap[layerId] < 0) return {};
DestinationQuad quad = AnimationLayer::GetDestQuad(frame, ghost, SpriteDraw{}, player.sprite);
Vector middle = vector_scale(vector_add(quad._topLeft, quad._bottomRight), HALF);
return vector_scale(middle, 1 / ROOM_SCREEN_SCALE);
}
// A dead player holding Vade Retro lets its ghost go with the item button: the ghost layer, while shown, leaves as a
// big enemy ghost that hurts, with a demon's cry and a shake.
static void vade_retro_ghost_release(Entity_Player& player)
{
LayerState* ghost = player.sprite.GetLayer("ghost");
if (!ghost || !ghost->layerData || !ghost->isVisible) return;
const AnimationFrame* frame = player.sprite.animState.GetLayerFrame(ghost->layerData->id);
if (!frame || !frame->isVisible) return;
Vector offset = ghost_layer_offset(player, *ghost, *frame);
Entity* released = g_game->Spawn({.position = player.pos, .subType = 2, .type = ENTITY_EFFECT,
.variant = EFFECT_ENEMY_GHOST, .seed = Random()});
released->posOffset = offset;
released->sprite.rotation = random_unit() * FULL_TURN_DEGREES;
released->sprite.scale = vector_make(VADE_RETRO_GHOST_SCALE, VADE_RETRO_GHOST_SCALE);
released->SetCollisionDamage(VADE_RETRO_GHOST_DAMAGE);
released->Update();
npc_sound_play(SOUND_DEMON_HIT, VADE_RETRO_GHOST_VOLUME, 2,
random_unit() * VADE_RETRO_GHOST_PITCH_RANGE + VADE_RETRO_GHOST_PITCH_MIN);
game_shake_screen(VADE_RETRO_GHOST_SHAKE);
ghost->isVisible = false;
}
// The death part of the player's frame, Update 00782af0: outside transitions the death animation starts once (with
// Mysterious Paper's chance of Missing Poster), the held entity is thrown, the ghost shows, and a run lost forgets its
// save. The player slows to a halt, cries out on the animation's DeathSound, takes its twin down with it once the
@@ -790,18 +921,17 @@ void Entity_Player::death_update()
}
friction *= DEATH_FRICTION;
if (activeItems[0].item == COLLECTIBLE_VADE_RETRO && sprite.IsPlaying())
reconstruction_missing("Entity_Player::Update 00782af0 (Vade Retro used by a dead player's ghost)");
if (activeItems[0].item == COLLECTIBLE_VADE_RETRO && sprite.IsPlaying() &&
input_is_action_triggered(twin_button_action(*this, TWIN_BUTTON_ITEM), controllerIndex, nullptr))
vade_retro_ghost_release(*this);
if (playerType == PLAYER_THEFORGOTTEN_B)
{
if (sprite.IsPlaying(animation) && sprite.GetFrame() == DEATH_FRAME_BONES_BREAK)
reconstruction_missing("Entity_Player::Update 00782af0 (Tainted Forgotten's bones break)");
if (sprite.IsPlaying(animation) && sprite.GetFrame() == DEATH_FRAME_BONES_BREAK) forgotten_bones_break(*this);
}
else if (sprite.IsPlaying(animation) && sprite.IsEventTriggered("DeathSound"))
{
if (!IsHologram()) effect_sound_play(SOUND_ISAACDIES, {.pitch = get_voice_pitch()});
if (playerType == PLAYER_BLUEBABY_B)
reconstruction_missing("Entity_Player::Update 00782af0 (Tainted Blue Baby's last poops)");
if (playerType == PLAYER_BLUEBABY_B) blue_baby_last_poops(*this);
}
bool isDeathShown = (sprite.IsPlaying(animation) &&
@@ -915,7 +1045,7 @@ bool Entity_Player::FlushQueueItem()
queuedItem.charge = 0;
queuedItem.varData = 0;
bool isFirstTime = !(queued.flags & QUEUED_TOUCHED);
bool isShuffledDaily = g_game->dailyChallenge._specialDailyId == SPECIAL_DAILY_SHUFFLED_ITEMS;
bool isShuffledDaily = g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_SHUFFLED_ITEMS;
if (queued.item->type == ITEM_TRINKET)
{
+50 -3
View File
@@ -28,6 +28,10 @@
// The Ladder's reach: how near a player must stand to a laid ladder to keep it, and the turn of a ladder laid across.
constexpr float LADDER_KEEP_DISTANCE_SQUARED = 3249;
constexpr float LADDER_ACROSS_ROTATION = 90;
// Azazel's Rage's beam: its damage scale, how high over the player it starts and how long it lasts.
constexpr float RAGE_DAMAGE_SCALE = 1.5f;
constexpr float RAGE_LASER_RISE = -30;
constexpr int RAGE_LASER_TIMEOUT = 90;
// The pit at a cell, or null off the grid or on any other grid entity.
static GridEntity_Pit* pit_at(Room& room, int gridIndex)
@@ -478,14 +482,42 @@ static void empty_vessel_update(Entity_Player& player)
effects.AddEffect(shield, true, 1);
}
// Azazel's Rage's beam: a thicker red Brimstone at one and a half times the damage, three seconds long, the way the
// player aims (else faces), in the laser color with its hit flags but no delay, and the rage costume's head shooting
// along it.
static void azazels_rage_fire(Entity_Player& player)
{
int displacement = (int)(Random() % 2) * 2 - 1;
TearParams params = player.GetTearHitParams(WEAPON_LASER, RAGE_DAMAGE_SCALE, displacement, nullptr);
Vector direction = vector_from_direction(player.headDirection);
if (player.aimDirection.x != 0 || player.aimDirection.y != 0) direction = player.aimDirection;
Entity_Laser* laser = Entity_Laser::ShootAngle({.position = player.pos,
.posOffset = vector_make(0, RAGE_LASER_RISE),
.source = &player,
.angleDegrees = vector_angle(direction),
.timeout = RAGE_LASER_TIMEOUT,
.variant = LASER_THICKER_RED});
laser->SetCollisionDamage(player.damage);
player.azazelsRageLaser = laser;
laser->tearFlags = params.tearFlags;
laser->tearFlags.reset(TEAR_WAIT);
laser->SetColor(player.laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
laser->Update();
player.AddCostume(g_manager->itemConfig.GetNullItem(NULLITEM_AZAZELS_RAGE_4), false);
player.play_null_costume_anim(NULLITEM_AZAZELS_RAGE_4, HEAD_SHOOT_ANIMS[vector_to_direction(direction)], -1);
}
// Azazel's Rage: on a room's third frame (or once its beam is spent) the rage ends with the item gone. With four
// rooms gathered, a room still fighting (an ambush not yet over) unleashes its beam, which is not written yet. A
// spent beam's rage settles back into the item's costume.
// rooms gathered, a room still fighting (an ambush not yet over) unleashes its beam. A spent beam's rage settles back
// into the item's costume.
static void azazels_rage_update(Entity_Player& player)
{
constexpr int RAGE_ROOM_FRAME = 3;
constexpr int RAGE_READY = 4;
constexpr int RAGE_FIRING = 5;
constexpr int RAGE_FIRED = 6;
TemporaryEffects& effects = player.temporaryEffects;
ItemConfig& config = g_manager->itemConfig;
Room& room = *g_game->room;
@@ -504,7 +536,10 @@ static void azazels_rage_update(Entity_Player& player)
bool isAmbush = room.roomType == ROOM_CHALLENGE || room.roomType == ROOM_BOSSRUSH;
bool isCalm = isAmbush ? room.IsAmbushDone() : room.IsClear();
if (!isCalm && (rooms == RAGE_READY || rooms == RAGE_FIRING))
reconstruction_missing("Entity_Player::update_effects 00794e50 (Azazel's Rage's beam)");
{
effects.AddCollectibleEffect(COLLECTIBLE_AZAZELS_RAGE, false, RAGE_FIRED - rooms);
azazels_rage_fire(player);
}
}
}
if (effects.GetCollectibleEffectNum(COLLECTIBLE_AZAZELS_RAGE) <= RAGE_FIRING || player.azazelsRageLaser) return;
@@ -748,6 +783,17 @@ static void reverse_empress_blink_update(Entity_Player& player)
else if (phase >= 4 && !isShown) player.AddCostume(costume, false);
}
// Reverse Sun keeps the room dark for a second at a time while it lasts (in versus only for the local main player).
static void reverse_sun_update(Entity_Player& player)
{
constexpr int REVERSE_SUN_DARKNESS_FRAMES = 60;
if (!player.temporaryEffects.HasNullEffect(NULLITEM_REVERSE_SUN)) return;
if (g_game->deathmatchManager.is_active())
reconstruction_missing("Entity_Player::update_effects 00794e50 (Reverse Sun in versus)");
g_game->darknessStrength = 1;
g_game->darknessTimeout = REVERSE_SUN_DARKNESS_FRAMES;
}
// IBS charges with the damage enemies took this frame, up to full. A spent charge (negative) drains back to zero
// over a second.
static void ibs_charge_update(Entity_Player& player)
@@ -1030,6 +1076,7 @@ void items_frame_update(Entity_Player& player)
divine_intervention_recharge(player);
tooth_and_nail_update(player);
reverse_empress_blink_update(player);
reverse_sun_update(player);
if (effects.HasNullEffect(NULLITEM_REVERSE_STARS) && player.IsExtraAnimationFinished())
effects.RemoveNullEffect(NULLITEM_REVERSE_STARS, 1);
ibs_charge_update(player);
+4 -4
View File
@@ -152,7 +152,7 @@ static void bulbs_apply(Entity_Player& p, float& stat, float dimScale, float vib
// but do not run yet: collectible effects and null effects. An effect the frame never asks about only counts down
// there. The frame's own part (00782af0) runs or stops on its own.
constexpr int FRAME_COLLECTIBLE_EFFECTS[] = {130, 181, 593, 705, 714};
constexpr int FRAME_NULL_EFFECTS[] = {60, 66, 69, 111, 114, 116, 122, 128};
constexpr int FRAME_NULL_EFFECTS[] = {60, 69, 111, 114, 116, 122, 128};
// Whether the frame runs a temporary effect: the effects written for it, and those it never asks about.
static bool is_frame_effect_known(const TemporaryEffect& effect)
@@ -886,7 +886,7 @@ static void speed_evaluate(Entity_Player& p, const StatBonuses& bonus)
else if (effects.HasCollectibleEffect(COLLECTIBLE_CAMO_UNDIES)) p.moveSpeed = p.moveSpeed + 0.5f;
p.moveSpeed = p.d8SpeedModifier * p.moveSpeed;
if (crownScale != 1 && p.moveSpeed > 1) p.moveSpeed = (p.moveSpeed - 1) * (crownScale - 1) + p.moveSpeed;
if (g_game->dailyChallenge._id == DAILY_SLOW) p.moveSpeed = p.moveSpeed - 1;
if (g_game->dailyChallenge.id == DAILY_SLOW) p.moveSpeed = p.moveSpeed - 1;
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_SPEED);
}
@@ -919,7 +919,7 @@ static void luck_evaluate(Entity_Player& p, const StatBonuses& bonus)
bulbs_apply(p, p.luck, 2, 0);
if (p.HasCollectible(492)) p.luck = p.luck + 1;
bulbs_apply(p, p.luck, 0, 1);
if (g_game->dailyChallenge._id == DAILY_LUCKY) p.luck = p.luck + DAILY_LUCK_BONUS;
if (g_game->dailyChallenge.id == DAILY_LUCKY) p.luck = p.luck + DAILY_LUCK_BONUS;
if (g_game->debugFlags & DEBUG_HIGH_LUCK) p.luck = p.luck + DEBUG_LUCK_BONUS;
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_LUCK);
@@ -1223,7 +1223,7 @@ static void size_evaluate(Entity_Player& p)
float head = (float)(effect(121) + ((n(121) - n(120)) - effect(120))) * 0.152f + 0;
if (game.seedEffects.HasSeedEffect(SEED_BIG_HEAD)) head = head + BIG_HEAD_BONUS;
if (game.seedEffects.HasSeedEffect(SEED_SMALL_HEAD)) head = head - 1;
if (game.dailyChallenge._id == DAILY_BIG_SIZE) body = body + DAILY_BIG_SIZE_BONUS;
if (game.dailyChallenge.id == DAILY_BIG_SIZE) body = body + DAILY_BIG_SIZE_BONUS;
float bodyScale = size_scale(body);
float headScale = size_scale(head);
+2 -2
View File
@@ -50,7 +50,7 @@ Entity* Entity_Player::AddBoneOrbital(Vector position)
}
// 00759bf0 Spawns a Swarm fly orbital at a position from the Swarm's RNG, first removing the player's flies past 15
// (the last in the room's list first).
// (the first in the room's list first).
Entity* Entity_Player::AddSwarmFlyOrbital(Vector position)
{
std::deque<Entity*> flies;
@@ -58,7 +58,7 @@ Entity* Entity_Player::AddSwarmFlyOrbital(Vector position)
for (Entity* entity : g_game->room->entityList.updateEL)
{
bool isFly = entity && entity->type == ENTITY_FAMILIAR && entity->variant == Entity_Familiar::SWARM_FLY_ORBITAL;
if (isFly && static_cast<Entity_Familiar*>(entity)->player == this) flies.push_front(entity);
if (isFly && static_cast<Entity_Familiar*>(entity)->player == this) flies.push_back(entity);
}
for (; flies.size() > SWARM_FLIES_MAX; flies.pop_front()) flies.front()->Remove();
+1 -1
View File
@@ -503,7 +503,7 @@ void Entity_Player::pockets_rotate()
actionHoldDrop = 0;
return;
}
if ((uint32_t)++actionHoldDrop > DROP_HOLD_FRAMES && game.dailyChallenge._specialDailyId != SPECIAL_DAILY_NO_DROP)
if ((uint32_t)++actionHoldDrop > DROP_HOLD_FRAMES && game.dailyChallenge.specialDailyId != SPECIAL_DAILY_NO_DROP)
drop_hold_update(*this);
}
+280 -43
View File
@@ -5,6 +5,7 @@
#include "entity_player_passives.h"
#include "tainted_characters.h"
#include "boss_ai.h"
#include "color_stack.h"
#include "entity_bomb.h"
#include "entity_effect.h"
#include "sfx_manager.h"
@@ -30,6 +31,7 @@
#include "hud.h"
#include "room.h"
#include "weapon_lasers.h"
#include <SDL3/SDL_mouse.h>
#include <algorithm>
#include <cmath>
@@ -83,7 +85,6 @@ constexpr int BLINK_CLOSED_FROM = 9;
constexpr int HELD_ITEM_STATE_SUPLEX = 709;
constexpr float HELD_DROP_SPEED = 0.1f;
// The head animations of a shot out of the mouth, left, up, right and down (Maw of the Void's and Hemoptysis's).
constexpr std::string_view HEAD_SHOOT_ANIMS[] = {"HeadLeftShoot", "HeadUpShoot", "HeadRightShoot", "HeadDownShoot"};
constexpr int KIDNEY_BURST_HOLD = 5;
constexpr float REVERSE_CHARIOT_DEAD_ZONE = 0.25f;
constexpr float REVERSE_CHARIOT_LUNGE = 2;
@@ -126,6 +127,8 @@ constexpr float CANDLE_FLAME_DAMAGE = 23;
constexpr float BOBS_HEAD_DAMAGE = 185;
constexpr float BOBS_HEAD_FALL_BASE = 1.2f;
constexpr float BOBS_HEAD_FALL_SPREAD = 0.2f;
// How far toward the cursor the mouse aims, from what the camera follows.
constexpr float MOUSE_AIM_SCALE = 0.2f;
constexpr float BOBS_HEAD_HEIGHT = -33;
constexpr int SHOOP_STATE_FRAMES = 30;
constexpr int SHOOP_LASER_TIMEOUT = 15;
@@ -675,12 +678,26 @@ void Entity_Player::head_turn(Vector toward)
headAnim = PLAYER_HEAD_ANIMS[headDirection];
}
// 007b9f60 Where the mouse aims the player's shots, offline only the keyboard player's while the option is on. Mouse
// aiming (the left button held) is not written yet.
bool Entity_Player::GetMouseAimTarget(Vector&, bool)
// 007b9f60 Where the mouse aims the player's shots while its left button is held, offline only the keyboard player's
// with the option on: the cursor in the world (mirrored in the mirror world), a fifth of the way from what the camera
// follows. An online player's cursor is not reconstructed.
bool Entity_Player::GetMouseAimTarget(Vector& target, bool)
{
if (!g_manager->optionsConfig.isMouseControlEnabled || controllerIndex != 0) return false;
reconstruction_missing("Entity_Player::GetMouseAimTarget 007b9f60 (mouse aiming)");
Vector cursor = {};
if (!(SDL_GetMouseState(&cursor.x, &cursor.y) & SDL_BUTTON_LMASK)) return false;
Room& room = *g_game->room;
if (Room::IsMirrorWorld()) cursor.x = (float)platform.windowSize.width - cursor.x;
float pixelScale = (float)platform.windowSize.height / KAGE::Graphics::manager.orthographicHeight;
target.x = (cursor.x / pixelScale - room.renderScrollOffset.x - (g_screenWidth - ROOM_VIEW_WIDTH) * HALF) /
ROOM_SCREEN_SCALE + ROOM_ORIGIN_X;
target.y = (cursor.y / pixelScale - room.renderScrollOffset.y - (g_screenHeight - ROOM_VIEW_HEIGHT) * HALF) /
ROOM_SCREEN_SCALE + ROOM_ORIGIN_Y;
Entity* focus = GetFocusEntity();
target = vector_scale(vector_sub(target, focus ? focus->pos : pos), MOUSE_AIM_SCALE);
return true;
}
// Reads the shoot actions, or the movement ones under the seeds that shoot with movement: whether any is held,
@@ -1166,6 +1183,34 @@ struct ChargeShot
// The charged shots' timings: a full charge, the room's first frames that only reset it, and the shot's block.
constexpr uint32_t CHARGE_FULL = 150;
// The charge bars over the player: which bar each charge fills, its full percent and the least shown of a charging
// item's, how far above and beside the player they start, each shown bar's offset, the Bag of Crafting's hold before
// and while its bar fills, Sumptorium's charge, and Tainted Lazarus' second form's faint flicker.
enum ChargeBar
{
CHARGE_BAR_WEAPON,
CHARGE_BAR_WEAPON_SECOND,
CHARGE_BAR_MAW,
CHARGE_BAR_REVELATION,
CHARGE_BAR_MONTEZUMA,
CHARGE_BAR_BERSERK,
CHARGE_BAR_SUMPTORIUM
};
constexpr int CHARGE_BAR_PERCENT_FULL = 100;
constexpr int CHARGE_BAR_MIN = 5;
constexpr float CHARGE_BAR_SIDE = 12;
constexpr float CHARGE_BAR_RISE = -35;
constexpr std::array<std::array<float, 2>, 4> CHARGE_BAR_OFFSETS = {{{0, 0}, {7, 11}, {14, 0}, {21, 11}}};
constexpr int CRAFT_BAR_DELAY = 5;
constexpr float CRAFT_BAR_FRAMES = 25;
constexpr float SUMPTORIUM_BAR_FRAMES = 60;
constexpr uint32_t CHARGE_BAR_FLICKER_SHIFT = 10;
constexpr float CHARGE_BAR_FLICKER = 0.15f;
constexpr float CHARGE_BAR_FLICKER_MIN = 0.05f;
// Tainted Lazarus' hologram flickers as faintly from its own generator, fading in over its first second.
constexpr uint32_t HOLOGRAM_FLICKER_SEED = 0x194fc4ad;
constexpr uint32_t HOLOGRAM_FLICKER_SHIFT = 31;
constexpr float HOLOGRAM_FADE_FRAMES = 30;
constexpr int CHARGE_ROOM_FRAMES = 5;
constexpr int CHARGE_FIRE_BLOCK = 30;
constexpr int NO_2_FRAMES = 150;
@@ -1706,7 +1751,7 @@ void Entity_Player::update_shooting()
if (HasCollectible(COLLECTIBLE_NO_2) && game.stageTransition.state == 0 && isInputAllowed && fireBlockCooldown < 1)
number_two_update(*this, isShootHeld);
bool isButterBeanDaily = game.dailyChallenge._specialDailyId == SPECIAL_DAILY_BUTTER_BEAN;
bool isButterBeanDaily = game.dailyChallenge.specialDailyId == SPECIAL_DAILY_BUTTER_BEAN;
if (isButterBeanDaily && game.stageTransition.state == 0 && isInputAllowed && isShootHeld &&
IsFrame(BUTTER_BEAN_DAILY_PERIOD, 0) && (Random() & BUTTER_BEAN_DAILY_ODDS_MASK) == 0)
game_butter_bean_fart({.position = pos, .source = this, .radius = BUTTER_BEAN_DAILY_RADIUS});
@@ -1919,46 +1964,134 @@ void Entity_Player::Render(const Vector& offset)
reconstruction_missing("Entity_Player::Render 0078ca00 (the deathmatch overlay)");
}
// The reflection Tainted Lazarus casts on water: his other form, shown and posed as he is, its layers and costumes
// rescaled to its own body and head, drawn where he stands.
static void lazarus_reflection_render(Entity_Player& player, const Vector& offset, RenderPass pass)
{
Entity_Player& other = *player.backupPlayer;
bool wasVisible = other.isVisible;
bool wasExisting = other.isExists;
other.isVisible = true;
other.isExists = true;
if (!player.bodySprite.isLoaded)
{
if (other.bodySprite.isLoaded) other.bodySprite.Reset();
}
else if (!other.bodySprite.isLoaded) other.bodySprite = other.sprite;
int bodyFrame = player.sprite.GetFrame();
const AnimationState& head = player.sprite.overlayAnimState;
int headFrame = head.animData ? (int)head.animFrame : -1;
std::string bodyAnim = player.sprite.GetAnimation();
player.sprite.animation_copy(other.sprite);
other.sprite.scale = vector_div(vector_mul(player.sprite.scale, other.playerSpriteScale), player.playerSpriteScale);
other.isPlayingExtraAnimation = player.isPlayingExtraAnimation;
other.isPlayingItemAnimation = player.isPlayingItemAnimation;
player.bodySprite.animation_copy(other.bodySprite);
for (int layerId = 0; layerId < COSTUME_LAYER_COUNT && !player.IsFullSpriteRendering(); layerId++)
{
PlayerCostumeMap& map = other.playerCostumeMap[layerId];
Vector to = map.isBodyLayer ? other.bodyScale : other.headScale;
Vector from = map.isBodyLayer ? player.bodyScale : player.headScale;
LayerState* own = player.sprite.GetLayer(layerId);
LayerState* copy = other.sprite.GetLayer(layerId);
if (!own || !copy) continue;
Vector layerPos = vector_div(vector_mul(own->pos, to), from);
Vector layerSize = vector_div(vector_mul(own->size, to), from);
copy->pos = layerPos;
copy->size = layerSize;
if (map.index < 0) continue;
CostumeSpriteDesc& costume = other.costumeSpriteDescs[map.index];
costume.sprite.SetFrame(map.isBodyLayer ? bodyAnim : player.headAnim, map.isBodyLayer ? bodyFrame : headFrame);
costume.sprite.offset = layerPos;
costume.sprite.scale = layerSize;
if (map.isBodyLayer || !costume.isHasOverlay) continue;
std::string overlay = player.headAnim + "_Overlay";
if (costume.sprite.GetAnimationData(overlay) && costume.sprite.SetOverlayAnimation(overlay) &&
costume.sprite.overlayAnimState.animData)
costume.sprite.overlayAnimState.SetFrameFloat((float)headFrame);
}
other.pos = player.pos;
other.render_pass(offset, pass);
other.isVisible = wasVisible;
other.isExists = wasExisting;
}
// Tainted Lilith's body while she lifts an item: her lower body, head and extra layers with the body costumes, then the
// held item on the main pass, without the head's overlay, where she stands.
static void lilith_lift_render(Entity_Player& player, RenderPass pass, const Vector& offset)
{
Vector heldOffset = player.posOffset;
player.posOffset = {};
player.sprite.overlayAnimState.SetAnimationData(nullptr);
player.renderPosition = vector_add(render_position_get(player.pos, RENDER_SNAPPED), offset);
SpriteDraw draw{player.renderPosition, {}, {}};
for (int layer : {PLAYER_LAYER_BODY0, PLAYER_LAYER_HEAD, PLAYER_LAYER_EXTRA}) player.sprite.RenderLayer(layer, draw);
for (int layer = PLAYER_LAYER_BODY; layer <= PLAYER_LAYER_BODY1; layer++)
if (PlayerCostumeMap& map = player.playerCostumeMap[layer]; map.index >= 0)
player.costumeSpriteDescs[map.index].sprite.RenderLayer(map.layerId, draw);
if (pass == RENDER_PASS_MAIN && player.IsHoldingItem()) player.heldSprite.Render(draw);
player.posOffset = heldOffset;
}
// The faint, flickering colour Tainted Lazarus' hologram draws in, fading in over its first second.
static ColorMod hologram_color_get(Entity_Player& player)
{
static RNG flicker = rng_make(HOLOGRAM_FLICKER_SEED, HOLOGRAM_FLICKER_SHIFT);
float alpha = flicker.RandomFloat() * CHARGE_BAR_FLICKER + CHARGE_BAR_FLICKER_MIN;
if (player.updateTime < HOLOGRAM_FADE_FRAMES) alpha *= player.updateTime / HOLOGRAM_FADE_FRAMES;
return {{1, 1, 1, alpha}, {0, 0, 0, 0}, {0, 0, 0}};
}
// 0078b640 Draws the player's body: the glow, body, head and top layers of its sprite and costumes at its snapped
// position, or the whole sprite during extra animations. Co-op babies and ghosts draw as plain entities, Tainted
// Lazarus's hologram in a shimmer, and the twin behind Tainted Lazarus as its backup.
// position, or the whole sprite during extra animations, then its emote. Co-op babies and ghosts draw as plain
// entities, Tainted Lazarus's hologram in a faint flicker, Tainted Lilith's lifting body on its own, and on water
// Tainted Lazarus reflects as his other form. The online outlines and names are not reconstructed.
void Entity_Player::render_pass(const Vector& offset, RenderPass pass)
{
if (g_game->room->entityList.renderMode == RENDER_WATER_REFLECT && variant == PLAYER_VARIANT_PLAYER &&
!isCoopGhost && (playerType == PLAYER_LAZARUS_B || playerType == PLAYER_LAZARUS2_B) && backupPlayer && isValid)
reconstruction_missing("Entity_Player::render_pass 0078b640 (Tainted Lazarus's reflection)");
if (variant == PLAYER_VARIANT_COOP_BABY || isCoopGhost)
return lazarus_reflection_render(*this, offset, pass);
if (variant == PLAYER_VARIANT_COOP_BABY || isCoopGhost) Entity::Render(offset);
else
{
Entity::Render(offset);
return;
}
if (IsHologram()) reconstruction_missing("Entity_Player::render_pass 0078b640 (Tainted Lazarus's hologram)");
if (IsHoldingItem() && bodySprite.animState.animData)
if (const NullFrame* held = bodySprite.animState.GetNullFrameById(0);
held && held->isVisible && playerType == PLAYER_LILITH_B)
reconstruction_missing("Entity_Player::render_pass 0078b640 (Tainted Lilith's held item)");
if (IsFullSpriteRendering())
{
Vector heldOffset = posOffset;
posOffset = {};
sprite.overlayAnimState.SetAnimationData(nullptr);
Entity::Render(offset);
if (pass == RENDER_PASS_MAIN && IsHoldingItem()) heldSprite.Render(SpriteDraw{renderPosition, {}, {}});
posOffset = heldOffset;
return;
bool isHologram = IsHologram();
if (isHologram) color_stack_push(hologram_color_get(*this));
const NullFrame* held = IsHoldingItem() && bodySprite.animState.animData
? bodySprite.animState.GetNullFrameById(0)
: nullptr;
if (held && held->isVisible && playerType == PLAYER_LILITH_B) lilith_lift_render(*this, pass, offset);
else if (IsFullSpriteRendering())
{
Vector heldOffset = posOffset;
posOffset = {};
sprite.overlayAnimState.SetAnimationData(nullptr);
Entity::Render(offset);
if (pass == RENDER_PASS_MAIN && IsHoldingItem()) heldSprite.Render(SpriteDraw{renderPosition, {}, {}});
posOffset = heldOffset;
}
else
{
renderPosition = vector_add(render_position_get(pos, RENDER_SNAPPED), offset);
bool isHeaded = !IsHeadless();
if (isHeaded)
{
RenderGlow(renderPosition);
render_back(renderPosition);
}
RenderBody(renderPosition);
if (isHeaded) RenderHead(renderPosition);
RenderTop(renderPosition);
}
if (isHologram) color_stack_pop();
}
renderPosition = vector_add(render_position_get(pos, RENDER_SNAPPED), offset);
bool isHeaded = !IsHeadless();
if (isHeaded)
{
RenderGlow(renderPosition);
render_back(renderPosition);
}
RenderBody(renderPosition);
if (isHeaded) RenderHead(renderPosition);
RenderTop(renderPosition);
(void)pass;
bool isMoving = velocity.x * velocity.x + velocity.y * velocity.y > EMOTE_MOVING_SPEED;
if (!emotes.isActive || emotes.emote != EMOTE_TYPING || !isMoving)
emotes.Render(vector_make(renderPosition.x, renderPosition.y - bodyScale.y * EMOTE_HEIGHT));
@@ -2062,10 +2195,114 @@ bool Entity_Player::RenderShadowLayer(const Vector& offset)
return Entity::RenderShadowLayer(offset);
}
// 0075ea40 Draws the charge bars over the player when the options show them: the weapons' charge, the crafting bag and
// the charging items. Only the hidden case is reconstructed: shown bars stop the game until reached.
void Entity_Player::render_charge_bars(Vector)
// The charge bars shown this frame, in the order they were updated.
struct ChargeBars
{
if (!g_manager->optionsConfig.isChargeBarsEnabled) return;
reconstruction_missing("Entity_Player::render_charge_bars 0075ea40 (the charge bars)");
std::array<ANM2*, CHARGE_BAR_COUNT> shown{};
int count = 0;
void update(ANM2& bar, int percent);
};
// (0075ef20) Moves a bar to a percent: an empty bar disappears, a partial one stops on its frame of "Charging", a full
// one plays "StartCharged" once and then "Charged". A bar still playing or not empty is shown.
void ChargeBars::update(ANM2& bar, int percent)
{
if (percent == 0)
{
if (bar.animState.animData) bar.Play("Disappear");
}
else if (percent < CHARGE_BAR_PERCENT_FULL) bar.SetFrame("Charging", percent);
else
{
const AnimationData* data = bar.animState.animData;
if (!data || (!data->isLooping && !bar.animState.isPlaying))
{
bar.Play("StartCharged");
if (!bar.animState.animData || !bar.animState.isPlaying) bar.Play("Charged");
}
}
if ((bar.animState.animData && bar.animState.isPlaying) || percent >= 1) shown[count++] = &bar;
}
// The percent a charging item's bar shows of a timer that fills at CHARGE_FULL, empty below a few percent.
static int item_charge_percent(uint32_t timer)
{
float full = CHARGE_BAR_PERCENT_FULL;
int percent = (int)std::clamp((float)timer * full / CHARGE_FULL, 0.0f, full);
return percent > CHARGE_BAR_MIN ? percent : 0;
}
// The first charge a weapon of slots 1 to 4 reports through a getter, as a percent.
template <class Getter> static int weapons_charge_percent(Entity_Player& player, Getter getCharge)
{
for (size_t slot = 1; slot < WEAPON_SLOT_COUNT; slot++)
if (Weapon* weapon = player.weapons[slot].get(); weapon && getCharge(*weapon) > 0)
return (int)(getCharge(*weapon) * CHARGE_BAR_PERCENT_FULL);
return 0;
}
// 0075ea40 Draws the charge bars over a local player when the options show them: the held Bag of Crafting's, or the
// weapons' two bars, Tainted Samson's Berserk, Tainted Eve's Sumptorium, Maw of the Void, Revelation and Montezuma's
// Revenge. The shown bars stack in the order updated, a Tainted Lazarus' second form's flickering faintly.
void Entity_Player::render_charge_bars(Vector renderPos)
{
if (!g_manager->optionsConfig.isChargeBarsEnabled || !IsLocalPlayer()) return;
ChargeBars bars;
Vector anchor = vector_make(renderPos.x + playerSpriteScale.y * CHARGE_BAR_SIDE,
renderPos.y + playerSpriteScale.y * CHARGE_BAR_RISE);
if (itemState == COLLECTIBLE_BAG_OF_CRAFTING && bagOfCraftingHoldFrames > CRAFT_BAR_DELAY)
{
float held = (float)(bagOfCraftingHoldFrames - CRAFT_BAR_DELAY) / CRAFT_BAR_FRAMES;
bars.update(chargeBarSprites[CHARGE_BAR_WEAPON], (int)(held * CHARGE_BAR_PERCENT_FULL));
}
else
{
if (playerType == PLAYER_SAMSON_B)
{
TemporaryEffect* berserk = temporaryEffects.GetCollectibleEffect(COLLECTIBLE_BERSERK);
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_BERSERK);
float percent = 0;
if (berserk && item) percent = (float)berserk->cooldown * CHARGE_BAR_PERCENT_FULL / (float)item->maxCooldown;
bars.update(chargeBarSprites[CHARGE_BAR_BERSERK], (int)percent);
}
if (HasCollectible(COLLECTIBLE_SUMPTORIUM) && playerType == PLAYER_EVE_B)
bars.update(chargeBarSprites[CHARGE_BAR_SUMPTORIUM],
(int)((float)eveSumptoriumCharge / SUMPTORIUM_BAR_FRAMES * CHARGE_BAR_PERCENT_FULL));
bars.update(chargeBarSprites[CHARGE_BAR_WEAPON],
weapons_charge_percent(*this, [](Weapon& weapon) { return weapon.GetChargeBarAmount(); }));
// The weapons' second bar (vtable slot 8), which every weapon leaves empty.
bars.update(chargeBarSprites[CHARGE_BAR_WEAPON_SECOND],
weapons_charge_percent(*this, [](Weapon&) { return 0.0f; }));
if (HasCollectible(COLLECTIBLE_MAW_OF_THE_VOID))
bars.update(chargeBarSprites[CHARGE_BAR_MAW], item_charge_percent(mawOfTheVoidChargeTimer));
if (HasCollectible(COLLECTIBLE_REVELATION))
bars.update(chargeBarSprites[CHARGE_BAR_REVELATION], item_charge_percent(revelationChargeTimer));
if (HasCollectible(COLLECTIBLE_MONTEZUMAS_REVENGE))
bars.update(chargeBarSprites[CHARGE_BAR_MONTEZUMA], item_charge_percent(montezumaChargeTimer));
}
float alpha = 1;
Entity_Player* twin = twin_get();
bool isLazarus = playerType == PLAYER_LAZARUS_B || playerType == PLAYER_LAZARUS2_B;
if (isExists && isLazarus && twin && twin->playerIndex != -1 && twin->playerIndex < playerIndex && twin != this)
alpha = rng_make(g_game->frameCount + 1, CHARGE_BAR_FLICKER_SHIFT).RandomFloat() * CHARGE_BAR_FLICKER +
CHARGE_BAR_FLICKER_MIN;
// Past the fourth bar the original reads beyond its offsets table, so the offsets repeat.
for (int i = bars.count - 1; i >= 0; i--)
{
ANM2& bar = *bars.shown[i];
bar.color._tint[3] = alpha;
auto [x, y] = CHARGE_BAR_OFFSETS[i % CHARGE_BAR_OFFSETS.size()];
SpriteDraw draw{vector_make(anchor.x + x, anchor.y + y), {}, {}};
if (bar.isLoaded)
{
(bar.isOverlayRenderFirst ? bar.overlayAnimState : bar.animState).Render(draw, bar);
(bar.isOverlayRenderFirst ? bar.animState : bar.overlayAnimState).Render(draw, bar);
}
bar.color._tint[3] = 1;
}
}
+63 -3
View File
@@ -2,6 +2,8 @@
#include "entity_effect.h"
#include "entity_familiar.h"
#include "entity_player.h"
#include "entity_tear.h"
#include "grid_entity_poop.h"
#include "game.h"
#include "log.h"
#include "manager.h"
@@ -43,9 +45,68 @@ static void bomb_throw(Entity_Bomb& bomb, Vector throwVelocity)
bomb.rocketSpeed = THROWN_ROCKET_SPEED;
}
// Part of 007d2470: Mom's Bracelet's lifted grid entity flies off from the player as a tear that looks like it, its
// type and variant in its subtype: 40 damage (15 in a versus match), a poop's by how whole it is (eight times a Giga
// Poop's, at triple scale, a poop that drops nothing keeping that), 80 for an armed spiked rock. Its index is the
// backdrop it was lifted from. The carrying effect goes.
static Entity_Tear* lifted_grid_throw(Entity_Player& player, Entity_Effect& lifted, Vector throwVelocity)
{
constexpr float GRID_TEAR_DAMAGE = 40;
constexpr float GRID_TEAR_DAMAGE_VERSUS = 15;
constexpr float POOP_WHOLE = 1000;
constexpr float GIGA_POOP_SCALE = 3;
constexpr float GIGA_POOP_DAMAGE_SCALE = 8;
constexpr int SPIKED_ROCK_ARMED = 4;
constexpr float SPIKED_ROCK_TEAR_DAMAGE = 80;
constexpr int POOP_NO_DROPS = 1;
constexpr float GRID_TEAR_HEIGHT = -30;
constexpr float GRID_TEAR_FALL_ACCEL = 0.8f;
constexpr float GRID_TEAR_FALL_SPEED = -5;
const GridEntityDesc& desc = lifted.gridDesc;
int subType = desc._type << 16 | (desc._variant & 0xffff);
auto* tear = static_cast<Entity_Tear*>(g_game->Spawn({.position = player.pos,
.velocity = throwVelocity,
.spawner = &player,
.subType = subType,
.type = ENTITY_TEAR,
.variant = TEAR_GRIDENT,
.seed = desc._spawnSeed}));
tear->SetCollisionDamage(g_game->deathmatchManager.is_active() ? GRID_TEAR_DAMAGE_VERSUS : GRID_TEAR_DAMAGE);
if (desc._type == GRID_POOP)
{
tear->health = (float)desc._state;
float wholeShare = (float)((int)POOP_WHOLE - desc._state) / POOP_WHOLE;
if (desc._variant >= POOP_GIGA_TOP_LEFT && desc._variant <= POOP_GIGA_BOTTOM_RIGHT)
{
tear->baseScale = GIGA_POOP_SCALE;
tear->fScale = GIGA_POOP_SCALE;
tear->ResetSpriteScale();
wholeShare *= GIGA_POOP_DAMAGE_SCALE;
}
tear->SetCollisionDamage(wholeShare * GRID_TEAR_DAMAGE);
if (desc._varData == POOP_NO_DROPS) tear->AddEntityFlags(FLAG_NO_DEATH_TRIGGER);
}
if (desc._type == GRID_ROCK_SPIKED && desc._state == SPIKED_ROCK_ARMED) tear->SetCollisionDamage(SPIKED_ROCK_TEAR_DAMAGE);
tear->tearIdx = lifted.state;
tear->SetHeight(GRID_TEAR_HEIGHT);
tear->fallingAccel = GRID_TEAR_FALL_ACCEL;
tear->fallingSpeed = GRID_TEAR_FALL_SPEED;
tear->isPrismTouched = true;
tear->sprite = lifted.sprite;
for (LayerState& layer : tear->sprite.layerStates)
{
layer.pos = {};
layer.size = vector_make(1, 1);
}
tear->Update();
lifted.Remove();
return tear;
}
// 007d2470 Lets go of the held entity at a velocity, giving back its visibility and collision classes. An entity that
// takes the throw flies off (a thrown player regains control and flies over the grid, a poop farts), a bomb leaves the
// hands, a small rocket vanishes. Returns what was let go.
// hands, a lifted grid entity becomes a tear, a small rocket vanishes. Returns what was let go, or the grid's tear.
Entity* Entity_Player::ThrowHeldEntity(Vector throwVelocity)
{
Entity* held = heldEntity;
@@ -74,8 +135,7 @@ Entity* Entity_Player::ThrowHeldEntity(Vector throwVelocity)
}
else if (held->type == ENTITY_BOMB) bomb_throw(*static_cast<Entity_Bomb*>(held), throwVelocity);
else if (held->type == ENTITY_EFFECT && held->variant == EFFECT_GRID_ENTITY_PROJECTILE_HELPER)
reconstruction_missing("Entity_Player::ThrowHeldEntity 007d2470: a lifted grid entity's tear (Entity_Effect "
"lacks the GridEntityDesc fields 0x430 to 0x43c Room::PickupGridEntity stores)");
held = lifted_grid_throw(*this, *static_cast<Entity_Effect*>(held), throwVelocity);
else if (held->type == ENTITY_EFFECT && held->variant == EFFECT_SMALL_ROCKET) held->Remove();
heldEntity = nullptr;
+23 -9
View File
@@ -83,7 +83,8 @@ static bool is_quest_item(ItemConfig_Item* item)
// 007706e0 Whether the player has a collectible: owned, or lent by a trinket, a seed, a character, a temporary effect,
// a wisp, Modeling Clay, a $3 Bill, Metronome or a conception. ITEM_CHECK_OWNED only looks at what it owns.
// Co-op babies ask their owner. Negative ids are procedural items.
// Co-op babies ask their owner. Negative ids are procedural items. An info panel's preview counts as one more copy, or
// one less.
bool Entity_Player::HasCollectible(int collectibleType, ItemCheck check)
{
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleType);
@@ -92,6 +93,8 @@ bool Entity_Player::HasCollectible(int collectibleType, ItemCheck check)
Entity_Player& owner = *item_owner_get(this);
Game& game = *g_game;
if (owner.isCoopGhost && !game.deathmatchManager.is_active() && !is_quest_item(item)) return false;
bool isPreviewed = owner.previewCollectible != 0 && collectibleType == owner.previewCollectible;
if (isPreviewed && owner.isPreviewAdded) return true;
if (collectibleType < 0)
{
auto found = owner.proceduralItems.find(collectibleType);
@@ -99,7 +102,7 @@ bool Entity_Player::HasCollectible(int collectibleType, ItemCheck check)
}
if (check == ITEM_CHECK_MODIFIED)
if (std::optional<bool> lent = owner.collectible_lent(collectibleType, *item)) return *lent;
return owner.collectibleCounts[collectibleType] > 0;
return owner.collectibleCounts[collectibleType] > (isPreviewed ? 1 : 0);
}
// Whether something other than owning it decides that the player has a collectible, as HasCollectible checks after
@@ -204,6 +207,8 @@ int Entity_Player::GetCollectibleNum(int collectibleId, ItemCheck check)
ItemConfig_Item* item = g_manager->itemConfig.GetCollectible(collectibleId);
int count = item && item->type == ITEM_ACTIVE ? 0 : collectibleCounts[collectibleId];
if (previewCollectible != 0 && previewCollectible == collectibleId)
count = isPreviewAdded ? count + 1 : std::max(count - 1, 0);
if (isCoopGhost && !is_quest_item(item)) return 0;
for (ActiveItemDesc& active : activeItems)
if (active.item != 0 && active.item == collectibleId) count++;
@@ -337,10 +342,13 @@ void Entity_Player::apply_innate_collectibles()
}
// 00771550 Whether the player has a trinket: held or smelted, or lent by the items that copy trinkets. ITEM_CHECK_OWNED
// only looks at the held slots, the second one only with Mom's Purse or Belly Button.
// only looks at the held slots, the second one only with Mom's Purse or Belly Button. An info panel's preview counts as
// one more copy, or one less.
bool Entity_Player::HasTrinket(uint32_t trinketType, ItemCheck check)
{
if (check == ITEM_CHECK_MODIFIED) return GetTrinketMultiplier(trinketType) > 0;
bool isPreviewed = previewTrinket != 0 && previewTrinket == trinketType;
if (isPreviewed && isPreviewAdded) return true;
if (check == ITEM_CHECK_MODIFIED) return GetTrinketMultiplier(trinketType) > (isPreviewed ? 1 : 0);
int slots = HasCollectible(COLLECTIBLE_MOMS_PURSE) || HasCollectible(COLLECTIBLE_BELLY_BUTTON) ? 2 : 1;
for (int i = 0; i < slots; i++)
@@ -360,7 +368,7 @@ int Entity_Player::GetTrinketMultiplier(uint32_t trinketType)
int multiplier = trinketType == TRINKET_LIL_LARVA && owner.playerType == PLAYER_BLUEBABY ? 1 : 0;
if (owner.hasCurseMistEffect || owner.isCoopGhost) return multiplier;
if (game.dailyChallenge._specialDailyId == DAILY_RAINBOW_TRINKETS &&
if (game.dailyChallenge.specialDailyId == DAILY_RAINBOW_TRINKETS &&
std::ranges::find(RAINBOW_WORM_TRINKETS, (int)id) != RAINBOW_WORM_TRINKETS.end())
multiplier++;
@@ -372,11 +380,17 @@ int Entity_Player::GetTrinketMultiplier(uint32_t trinketType)
for (int i = 0; i < slots; i++)
if ((owner.trinkets[i] & TRINKET_ID_MASK) == id) multiplier += owner.trinkets[i] & TRINKET_GOLDEN_FLAG ? 2 : 1;
ItemConfig_Item* queued = owner.queuedItem.item;
if (queued && queued->type == ITEM_TRINKET && (uint32_t)queued->id == id)
bool isQueuedCounted = owner.previewTrinket == 0 || owner.previewTrinket == id;
if (queued && queued->type == ITEM_TRINKET && (uint32_t)queued->id == id && isQueuedCounted)
multiplier += owner.queuedItem.flags & QUEUED_GOLDEN ? 2 : 1;
if (id < owner.smeltedTrinkets.size())
multiplier += owner.smeltedTrinkets[id].count + owner.smeltedTrinkets[id].goldenCount * 2;
if (id < owner.extraTrinketCounts.size() && owner.extraTrinketCounts[id] != 0) multiplier++;
if (owner.previewTrinket != 0 && (owner.previewTrinket & TRINKET_ID_MASK) == id)
{
int copies = owner.previewTrinket & TRINKET_GOLDEN_FLAG ? 2 : 1;
multiplier = owner.isPreviewAdded ? multiplier + copies : std::max(multiplier - copies, 0);
}
if (multiplier > 0 && owner.HasCollectible(COLLECTIBLE_MOMS_BOX)) multiplier++;
return multiplier;
}
@@ -1388,7 +1402,7 @@ static void collectible_effect_apply(Entity_Player& p, const CollectibleGain& ga
game.ApplyBlueMapEffect();
return;
case 381:
if (isFirst && game.challenge == 0 && game.dailyChallenge._id == 0)
if (isFirst && game.challenge == 0 && game.dailyChallenge.id == 0)
g_manager->persistentGameData.eventCounters[EVENT_EDENS_BLESSING]++;
return;
case 412:
@@ -1471,7 +1485,7 @@ static void collectible_effect_apply(Entity_Player& p, const CollectibleGain& ga
case 721:
late_collectible_gain(p, gain.type, isFirst);
return;
case 619: return birthright_gain(p, isFirst);
case 619: return birthright_gain(p, rng, isFirst);
case 644:
if (isFirst) consolation_prize_gain(p, rng);
return;
@@ -1687,7 +1701,7 @@ void Entity_Player::AddCostume(ItemConfig_Item* item, bool isItemStateOnly)
costume.isOverwriteColor = item->costume.isOverwriteColor;
costume.isItemStateOnly = isItemStateOnly;
costume.playerType = -1;
if (g_game->dailyChallenge._specialDailyId == SPECIAL_DAILY_COSTUME_PRIORITY && item->IsCollectible() &&
if (g_game->dailyChallenge.specialDailyId == SPECIAL_DAILY_COSTUME_PRIORITY && item->IsCollectible() &&
item->id == COLLECTIBLE_SACK_HEAD_COSTUME)
costume.priority += DAILY_COSTUME_PRIORITY_BONUS;
costume.sprite.Load(item->costume.anm2Path, GRAPHICS_DEFER);
+38 -26
View File
@@ -236,9 +236,9 @@ void Entity_Player::AnimateCard(int cardId, std::string_view animName)
reconstruction_missing("Entity_Player::AnimateCard 007ab6b0 (a mod's card front)");
heldSprite.Reset();
heldSprite.Load("gfx/ui/ui_cardspills.anm2", GRAPHICS_LOAD);
heldSprite.Load(CARDS_PILLS_ANM2, GRAPHICS_LOAD);
heldSprite.Play("Sparkle");
overlay_frame_set(heldSprite, "CardFronts", (float)cardId);
overlay_frame_set(heldSprite, ANIMATION_CARD_FRONTS, (float)cardId);
bool isFrontShown = false;
for (int layer = 0; layer < (int)heldSprite.layerStates.size(); layer++)
{
@@ -252,7 +252,7 @@ void Entity_Player::AnimateCard(int cardId, std::string_view animName)
{
heldSprite.Load(pickup->anm2Path, GRAPHICS_LOAD);
heldSprite.Play("Sparkle");
overlay_frame_set(heldSprite, "HUD", 0);
overlay_frame_set(heldSprite, ANIMATION_HUD, 0);
}
heldSprite.offset = vector_make(0, CARD_HELD_RISE);
PlayExtraAnimation(animName);
@@ -266,22 +266,35 @@ void Entity_Player::AnimatePill(int pillColor, std::string_view animName)
{
heldSprite.Load(pill->anm2Path, GRAPHICS_LOAD);
heldSprite.Play("Sparkle");
overlay_frame_set(heldSprite, "HUD", 0);
overlay_frame_set(heldSprite, ANIMATION_HUD, 0);
}
heldSprite.offset = vector_make(0, CARD_HELD_RISE);
PlayExtraAnimation(animName);
}
// The pocket part of 006e8ae0: a free hand takes a card (its name and description shown, but for Jacob and Esau) or a
// pill, holding it up. Whether it was taken. The challenge that turns cards into items and the seeds that hide or
// scramble the text are not written yet.
// A pocket item's name or description as the HUD shows it, its #keys looked up in the "PocketItems" string table.
static std::string pocket_text(std::string_view text)
{
bool isMissing = false;
if (text.empty() || text[0] != '#') return std::string(text);
StringTable& table = g_manager->stringTable;
std::string_view localized = table.get_string("PocketItems", table.language, text.substr(1), &isMissing);
return std::string(isMissing ? text : localized);
}
// The pocket part of 006e8ae0: a free hand takes a card (its name and description shown, but for Jacob and Esau,
// hidden or scrambled by the seeds) or a pill, holding it up. Cantripped's cards are items, put in front of the hand.
// Whether it was taken.
bool pocket_item_collect(Entity_Pickup& pocket, Entity_Player& player)
{
constexpr int CHALLENGE_CARDS_AS_ITEMS = 43;
if (player.IsHoldingItem()) return false;
if (g_game->challenge == CHALLENGE_CARDS_AS_ITEMS)
reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0 (a card as an item)");
if (g_game->challenge == CHALLENGE_CANTRIPPED)
{
uint32_t item = player.AddItemCard((uint32_t)pocket.subtype & ~CARD_ITEM_FLAG);
if (item != 0) player.AnimateCollectible((int)item, "UseItem", "PlayerPickupSparkle");
return item != 0;
}
if (pocket.variant == PICKUP_PILL)
{
player.AddPocketItem(pocket.subtype, POCKET_PILL);
@@ -295,9 +308,19 @@ bool pocket_item_collect(Entity_Pickup& pocket, Entity_Player& player)
if (player.playerType == PLAYER_JACOB || player.playerType == PLAYER_ESAU || !card) return true;
Seeds& seeds = g_game->seedEffects;
if (seeds.HasSeedEffect(SEED_MYSTERY_TAROT_CARDS) || seeds.HasSeedEffect(SEED_DYSLEXIA))
reconstruction_missing("Entity_Pickup::HandleCollision 006e8ae0 (a card's hidden or scrambled text)");
g_game->hud.show_pill_name(&player, card->GetName().c_str(), card->description_get().c_str());
std::string name = card->GetName();
std::string description = card->description_get();
if (seeds.HasSeedEffect(SEED_MYSTERY_TAROT_CARDS))
{
name = pocket_text("#QUESTION_MARKS_NAME");
description.clear();
}
if (seeds.HasSeedEffect(SEED_DYSLEXIA))
{
name = string_scramble_seeded(name);
description = string_scramble_seeded(description);
}
g_game->hud.show_pill_name(&player, name.c_str(), description.c_str());
return true;
}
@@ -340,17 +363,6 @@ void tears_up_unlock_check(Entity_Player& player)
if (tearsUps >= TEARS_UP_UNLOCK_COUNT) g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_TEARS_UP_ITEMS);
}
// The pill's name and description as the HUD shows them, its #keys looked up in the "PocketItems" string table.
static std::string pocket_text(std::string_view text)
{
bool isMissing = false;
if (text.empty() || text[0] != '#') return std::string(text);
StringTable& table = g_manager->stringTable;
std::string_view localized = table.get_string("PocketItems", table.language, text.substr(1), &isMissing);
return std::string(isMissing ? text : localized);
}
// 007c4180 Uses a pill effect: the screen blooms, the pill color is identified (a golden pill changes the pools
// instead), its name shows and its use counts, its effect runs, the announcer names it now and then and the mods see
// it. A horse pill doubles the count and swaps the thumbs' sounds for louder ones. False PHD turns a bad pill into a
@@ -549,7 +561,7 @@ uint32_t Entity_Player::AddItemCard(uint32_t itemId)
}
if (itemCards.size() >= item_cards_max(*this)) return 0;
if (itemId == 0) reconstruction_missing("ItemPool::GetCardImpl 007376c0 (the item card pool)");
if (itemId == 0) itemId = (uint32_t)ItemPool::GetCardImpl(GetCollectibleRNG(COLLECTIBLE_BAG_OF_CRAFTING).Next());
itemCards.insert(itemCards.begin(), (int)itemId);
g_game->hud.mark_all_slots_dirty(HISTORY_KEEP_ICONS, HISTORY_KEEP_ITEMS);
return itemId;
-1
View File
@@ -41,7 +41,6 @@ constexpr int DOOR_STOP_UNLOCK_COPIES = 3;
constexpr int DOOR_STOP_BOSS_RUSH_COPIES = 2;
constexpr float DOOR_STOP_REACH_SQUARED = 10000;
constexpr float DOOR_ENTER_OFFSET = 40;
constexpr uint32_t DOOR_SIDES = 4;
// The grid entities Dog Tooth howls at when the floor's crawlspace rock hides there.
constexpr GridEntityType DOG_TOOTH_ROCKS[] = {GRID_ROCK, GRID_ROCKT, GRID_ROCK_BOMB,
-3
View File
@@ -114,7 +114,6 @@ constexpr int COLLECTIBLE_CUPIDS_ARROW = 48;
constexpr int COLLECTIBLE_PACT = 80;
constexpr int COLLECTIBLE_SPIDER_BITE = 89;
constexpr int COLLECTIBLE_SMALL_ROCK = 90;
constexpr int COLLECTIBLE_COMMON_COLD = 103;
constexpr int COLLECTIBLE_MOMS_CONTACTS = 110;
constexpr int COLLECTIBLE_STIGMATA = 138;
constexpr int COLLECTIBLE_TOUGH_LOVE = 150;
@@ -135,8 +134,6 @@ constexpr int COLLECTIBLE_HOLY_LIGHT = 374;
constexpr int COLLECTIBLE_PUPULA_DUPLEX = 379;
constexpr int COLLECTIBLE_GODS_FLESH = 398;
constexpr int COLLECTIBLE_EXPLOSIVO = 401;
constexpr int COLLECTIBLE_COMPOUND_FRACTURE = 453;
constexpr int COLLECTIBLE_SINUS_INFECTION = 459;
constexpr int COLLECTIBLE_PARASITOID = 461;
constexpr int COLLECTIBLE_EYE_OF_BELIAL = 462;
constexpr int COLLECTIBLE_SULFURIC_ACID = 463;
+4 -4
View File
@@ -98,13 +98,13 @@ void Entity_Player::remove_wooden_cross_mantles()
holyMantleStacks = (uint8_t)((holyMantleStacks & MANTLE_STACK_LOW) | (lent << MANTLE_STACK_HIGH_SHIFT));
}
// 00771620 Whether the player holds the trinket golden, in a slot or smelted.
// The original also reads a trinket slot only the constructor writes, always empty.
// 00771620 Whether the player holds the trinket golden, in a slot or smelted, or previews it golden.
bool Entity_Player::HasGoldenTrinket(uint32_t trinketId)
{
for (int i = 0; i < GetMaxTrinkets(); i++)
if ((trinkets[i] & TRINKET_ID_MASK) == trinketId && (trinkets[i] & TRINKET_GOLDEN_FLAG)) return true;
return trinketId < smeltedTrinkets.size() && smeltedTrinkets[trinketId].goldenCount > 0;
if (trinketId < smeltedTrinkets.size() && smeltedTrinkets[trinketId].goldenCount > 0) return true;
return (previewTrinket & TRINKET_ID_MASK) == trinketId && (previewTrinket & TRINKET_GOLDEN_FLAG);
}
// 007716f0 Whether the player can take a trinket: a free slot, or one holding a trinket that may be swapped out. The
@@ -662,7 +662,7 @@ static void divorce_papers_gain(Entity_Player& player, RNG& rng)
player.AddBoneHearts(1);
Game& game = *g_game;
bool isAllowed = g_manager->persistentGameData.achievements[ACHIEVEMENT_MYSTERIOUS_PAPER] ||
(g_manager->state == MANAGER_STATE_GAME && (game.dailyChallenge._id != 0 || game.isDebug));
(g_manager->state == MANAGER_STATE_GAME && (game.dailyChallenge.id != 0 || game.isDebug));
if (!isAllowed || !game.itemPool.RemoveTrinket(TRINKET_MYSTERIOUS_PAPER)) return;
Vector position = room_free_pickup_position_find({.position = player.pos, .step = GAIN_PICKUP_STEP});
game.Spawn({.position = position, .subType = TRINKET_MYSTERIOUS_PAPER, .type = ENTITY_PICKUP,
+29 -2
View File
@@ -132,6 +132,8 @@ constexpr int ACHIEVEMENT_HALF_HEART_FLOORS = 329;
constexpr int TRAIL_FRAMES_MAX = 900;
constexpr int VOID_STAGE = 12;
constexpr int VOID_HALLUCINATION_PERIOD = 150;
// An extra player rides up to the enemy it controls this much of the way more each frame.
constexpr float EXTRA_PLAYER_RIDE_STEP = 0.1f;
constexpr int VOID_HALLUCINATION_ODDS = 75;
constexpr int VOID_HALLUCINATION_ODDS_PER_ROOM = 105;
constexpr int VOID_HALLUCINATION_FRAMES = 30;
@@ -573,7 +575,7 @@ static void how_to_jump_update(Entity_Player& player)
Vector leap = vector_scale(vector_sub(player.targetPosition, player.pos), progress * progress);
player.pos = vector_add(player.pos, leap);
player.velocity = {};
if (g_game->dailyChallenge._specialDailyId != HOW_TO_JUMP_SPECIAL_DAILY || jump->cooldown != 1) return;
if (g_game->dailyChallenge.specialDailyId != HOW_TO_JUMP_SPECIAL_DAILY || jump->cooldown != 1) return;
auto* wave = static_cast<Entity_Effect*>(g_game->Spawn({.position = player.pos,
.spawner = &player,
@@ -1048,6 +1050,31 @@ static void living_frame_update(Entity_Player& player)
moms_hand_player_release_update(player);
}
// An extra player's frame: offline it rides the enemy it controls, closing in over ten frames, or takes the first valid
// enemy of the room and jumps onto it. Online the original first checks its controller's device, not reconstructed.
static void extra_player_update(Entity_Player& player)
{
if (g_manager->netplayManager.is_online())
reconstruction_missing("Entity_Player::Update 00782af0 (an online extra player)");
if (Entity* ridden = player.target.get())
{
player.targetPosition.x = std::min(player.targetPosition.x + EXTRA_PLAYER_RIDE_STEP, 1.0f);
vector_lerp(player.pos, ridden->pos, player.targetPosition.x);
player.velocity = {};
return;
}
for (Entity* entity : g_game->room->entityList.updateEL)
{
Entity* enemy = entity->to_npc_or_coop_player();
if (!enemy || !enemy->is_valid_target()) continue;
player.target = enemy;
player.pos = enemy->pos;
player.velocity = {};
player.targetPosition.x = 1;
return;
}
}
// 00782af0 The player's frame. It rides along with what it carries, catches up with the room's mist and pending floor
// starts, falls, builds up poison, moves as an entity, reacts to hurts, then runs its living frame or its death, its
// items' animations, footprints, sounds, bleeding, status effect and the Void's hallucination, and calls
@@ -1069,7 +1096,7 @@ void Entity_Player::Update()
}
curse_mist_update(*this);
equality_update(*this);
if (variant == PLAYER_VARIANT_EXTRA) reconstruction_missing("Entity_Player::Update 00782af0 (an extra player)");
if (variant == PLAYER_VARIANT_EXTRA) return extra_player_update(*this);
if (!isExists) return;
riders_update(*this);
+3 -3
View File
@@ -70,7 +70,6 @@ constexpr float TECH_X_RING_LIFT = -20;
constexpr int COLLECTIBLE_BRIMSTONE_WEAPON = 118;
constexpr int COLLECTIBLE_CURSED_EYE_WEAPON = 316;
constexpr int COLLECTIBLE_DEAD_TOOTH = 446;
constexpr float DEAD_TOOTH_RING_SCALE = 0.8f;
constexpr int LARGE_ZIT_INTERVAL = 30;
constexpr uint32_t LARGE_ZIT_ODDS = 3;
@@ -544,7 +543,7 @@ Vector Entity_Player::GetLaserOffset(int laserOffsetId, const Vector& shootDirec
// 007aab70 Fires a Technology laser from the player: from an eye's offset along a direction, lasting three frames,
// in the player's laser color with its laser hit params (Technology 2's with the player's damage, one of Tech.5's in
// twenty with a random flag of its own), drawn behind the head when it fires up or away from the eye.
// twenty with a random flag of the first 64 only), drawn behind the head when it fires up or away from the eye.
Entity_Laser* Entity_Player::FireTechLaser(const TechLaserShot& shot)
{
Vector offset = GetLaserOffset(shot.offsetId, shot.direction);
@@ -563,7 +562,8 @@ Entity_Laser* Entity_Player::FireTechLaser(const TechLaserShot& shot)
if (shot.offsetId == LASER_OFFSET_TECH5 && Random() % TECH5_FLAG_ROLL < TECH5_FLAG_CHANCE)
{
flags.reset();
flags.set(Random() % TECH5_FLAG_COUNT);
uint32_t bit = Random() % TECH5_FLAG_COUNT;
if (bit < TECH5_FLAG_REACH) flags.set(bit);
}
laser->tearFlags = flags;
laser->SetColor(laserColor, -1, COLOR_PRIORITY_DEFAULT, false, true);
+252 -26
View File
@@ -1,4 +1,5 @@
#include "entity_projectile.h"
#include "boss_ai.h"
#include "boss_repentance.h"
#include "entity_bomb.h"
#include "entity_combat.h"
@@ -6,8 +7,10 @@
#include "entity_effect_combat.h"
#include "entity_familiar.h"
#include "entity_knife.h"
#include "entity_laser.h"
#include "entity_pickup.h"
#include "entity_player.h"
#include "entity_tear.h"
#include "game.h"
#include "grid_entity.h"
#include "lua_callbacks.h"
@@ -49,8 +52,7 @@ constexpr uint64_t CHANGE_BOTH_FLAGS =
PROJECTILE_CHANGE_FLAGS_AFTER_TIMEOUT | PROJECTILE_CHANGE_VELOCITY_AFTER_TIMEOUT;
constexpr uint64_t BURST3_CHILD_CLEARED = PROJECTILE_CURVE_LEFT | PROJECTILE_CURVE_RIGHT | PROJECTILE_SINE_VELOCITY;
// The flags whose effects belong to the late bosses and items, and are not reconstructed.
constexpr uint64_t UNRECONSTRUCTED_FLAGS = PROJECTILE_STASIS | PROJECTILE_LASER_SHOT;
// The flags whose shots leave fire waves or fires where they land.
constexpr uint64_t FIRE_FLAGS = PROJECTILE_FIRE_WAVE | PROJECTILE_FIRE_WAVE_X | PROJECTILE_FIRE_SPAWN;
// The glow a fiery, Heretic's, blue fire or side wave shot carries.
@@ -372,7 +374,6 @@ constexpr int SOUND_BEAST_FIRE = 700;
constexpr int COLLECTIBLE_SOUL = 335;
constexpr int COLLECTIBLE_BETRAYAL = 391;
constexpr int COLLECTIBLE_CIRCLE_OF_PROTECTION = 423;
constexpr uint32_t CHALLENGE_BROKEN_WATCH = 22;
// The familiars shots hurt (the two Infamy guards as the player does), and the subtype of the one that is spared.
@@ -753,19 +754,14 @@ static void fly_ball_update(Entity_Projectile& ball)
if (ball.GetIntervalTicks(4, 0) && fly_ball_flies(ball).empty()) ball.Remove();
}
// and its splash once it has died. A shot the Broken Modem froze waits, then vanishes.
// 00653070 A shot's frame: its look, trails, homing, steering, speed and fall, what its flags do on the way and its
// splash once it has died. A shot the Broken Modem froze waits, then vanishes, and one held in stasis floats by its
// parent.
void Entity_Projectile::Update()
{
speedMultiplier = time_scale_get();
if (pauseTimer > 0) pauseTimer--;
if (projectileFlags & GRID_PASS_FLAGS) isCollidesWithGrid = false;
if (projectileFlags & UNRECONSTRUCTED_FLAGS)
{
char name[96];
std::snprintf(name, sizeof(name), "Entity_Projectile::Update 00653070: the projectile flags %llx",
(unsigned long long)(projectileFlags & UNRECONSTRUCTED_FLAGS));
reconstruction_missing(name);
}
if (modem_freeze_update()) return;
animation_update();
@@ -790,6 +786,7 @@ void Entity_Projectile::Update()
fly_orbit_update(*this);
trails_update();
if (isDead) return death_update();
if ((projectileFlags & PROJECTILE_STASIS) && stasis_update()) return lua_engine_get().PostProjectileUpdate(this);
if (motionHook) motionHook(*this, PROJECTILE_STEP_UPDATE);
homing_update();
@@ -801,6 +798,51 @@ void Entity_Projectile::Update()
lua_engine_get().PostProjectileUpdate(this);
}
// Stasis: a shot held by its parent drifts back toward 50 from it, carried along with it, settling to its usual
// height and flashing every 8 frames, until its timed change. It then flies off the way it last faced from the parent
// at its changed speed. Whether it was held, which ends its frame.
bool Entity_Projectile::stasis_update()
{
constexpr float HOLD_DISTANCE = 50;
constexpr float HOLD_PULL = 0.1f;
constexpr float HOLD_EASE = 0.3f;
constexpr float HEIGHT_EASE = 0.4f;
constexpr int STASIS_FLASH_FRAMES = 8;
constexpr int STASIS_FLASH_DURATION = 4;
constexpr float RELEASE_CURVE = 0.015f;
constexpr ColorMod STASIS_FLASH_COLOR = {{1, 1, 1, 1}, {0, 0, 0, 0}, {0.35f, 0.45f, 0.5f}};
bool isChangeDue = changeTimeout < 1 || GetIntervalTicks((float)changeTimeout, 0) != 0;
bool isReleased = (projectileFlags & PROJECTILE_CHANGE_FLAGS_AFTER_TIMEOUT) && FrameCount() > 0 && isChangeDue;
if (!parent || isReleased)
{
velocity = vector_scale(vector_from_angle(curvingStrength), changeVelocity);
curvingStrength = RELEASE_CURVE;
return false;
}
Vector away = vector_sub(vector_add(pos, velocity), parent->pos);
float distance = vector_length(away);
if (distance != 0)
{
Vector direction = vector_scale(away, 1 / distance);
curvingStrength = vector_angle(direction);
velocity = vector_sub(velocity, targetPosition);
vector_lerp(velocity, vector_scale(direction, (HOLD_DISTANCE - distance) * HOLD_PULL), HOLD_EASE);
velocity = vector_add(velocity, parent->velocity);
targetPosition = parent->velocity;
}
height = lerp(height, HEIGHT_START, HEIGHT_EASE);
update_height_collision();
if (IsFrame(STASIS_FLASH_FRAMES, 0))
{
ColorMod flash = STASIS_FLASH_COLOR;
color_multiply(flash, color);
SetColor(flash, STASIS_FLASH_DURATION, COLOR_PRIORITY, true, true);
}
return true;
}
// The Broken Modem's freeze: a frozen shot vanishes after a while, and waits in place until then. Whether it did.
bool Entity_Projectile::modem_freeze_update()
{
@@ -1200,11 +1242,53 @@ void Entity_Projectile::death_update()
death_bursts_spawn();
if (projectileFlags & PROJECTILE_BLUE_FIRE_SPAWN) blue_fire_spawn();
if (projectileFlags & PROJECTILE_FIRE_SPAWN) fire_spawn();
if (projectileFlags & PROJECTILE_LASER_SHOT) laser_shot_dot_spawn();
if (projectileFlags & PROJECTILE_SIDE_WAVE) side_wave_burst();
if (variant == PROJECTILE_HEAD) head_splash();
Remove();
if (variant == PROJECTILE_FIRE && spawnerType == ENTITY_BEAST) npc_sound_play(SOUND_BEAST_FIRE, 1, 2, 1);
}
// Part of 00653070: a dead laser shot leaves a Tech dot shining toward its target (found anywhere when it had none),
// or back the way it came.
void Entity_Projectile::laser_shot_dot_spawn()
{
constexpr float LASER_SHOT_RANGE = 5000;
constexpr int TECH_DOT_SHOT = 1;
constexpr ColorMod TECH_DOT_COLOR = {{1, 1, 1, 1}, {2.5f, 2.5f, 2.5f, 1}, {0, 0, 0}};
if (!target) target_find(LASER_SHOT_RANGE);
Entity_Effect* dot = effect_spawn(EFFECT_TECH_DOT, pos, spawnerEntity, TECH_DOT_SHOT);
dot->sprite.color = TECH_DOT_COLOR;
dot->targetPosition = target ? vector_normalized(vector_sub(target->pos, pos))
: vector_scale(vector_normalized(velocity), -1);
dot->Update();
}
// Part of 00653070: a dead side wave shot bursts in a splash into five shots fanned back the way it came, 24 apart,
// aimed at it and tinted its color.
void Entity_Projectile::side_wave_burst()
{
constexpr int SIDE_FAN_SIDE = 2;
constexpr float SIDE_FAN_TURN = 24;
constexpr float SIDE_FAN_SPEED = 10;
Vector back = vector_scale(vector_normalized(velocity), -1);
npc_sound_play(SOUND_DEATH_BURST_SMALL, 1, 2, 1);
effect_spawn(EFFECT_BLOOD_EXPLOSION, pos, nullptr, BLOOD_EXPLOSION_SPLASH)->Update();
for (int i = -SIDE_FAN_SIDE; i <= SIDE_FAN_SIDE; i++)
{
uint32_t seed = Random();
Vector shotVelocity = vector_scale(vector_rotated(back, (float)i * SIDE_FAN_TURN), SIDE_FAN_SPEED);
Entity* shot = g_game->Spawn({.position = pos, .velocity = shotVelocity, .spawner = spawnerEntity,
.type = ENTITY_PROJECTILE, .seed = seed});
shot->target = this;
shot->parent = parent.get();
shot->SetColor(color, -1, COLOR_PRIORITY_DEFAULT, false, true);
shot->Update();
}
}
// Part of 00653070: whether the shot is on the players' side, which its fires take.
bool Entity_Projectile::is_friendly_fire()
{
@@ -1289,6 +1373,98 @@ void Entity_Projectile::fire_spawn()
.timeoutRange = RED_FLAME_TIMEOUT_RANGE});
}
// 0065ad30 (misnamed reroll_entity_to_free_tile) A tick of the lava the Beast's fire ball raised: a pair of glowing
// lava shots thrown up either side, as far out as its state counts in cells and slower the farther, then the next.
static void beast_lava_tick(Entity_Effect* timer)
{
constexpr float RISE_PER_STEP = 3;
constexpr float RISE_BASE = -30;
constexpr float LAVA_SHOT_SCALE = 1.5f;
constexpr ColorMod LAVA_SHOT_COLOR = {{2, 2, 2, 1}, {0, 0, 0, 0}, {0.4f, 0.12f, -0.3f}};
for (int side = -1; side <= 1; side += 2)
{
Vector position = vector_make((float)side * (float)timer->state * GRID_CELL_SIZE + timer->pos.x, timer->pos.y);
float jitter = random_unit();
float rise = (float)timer->state * RISE_PER_STEP + RISE_BASE + (jitter + jitter);
auto* shot = static_cast<Entity_Projectile*>(g_game->Spawn(
{.position = position, .velocity = vector_make(0, rise), .type = ENTITY_PROJECTILE, .seed = Random()}));
shot->scale = LAVA_SHOT_SCALE;
shot->spawnerEntity = timer->spawnerEntity;
shot->spawnerType = timer->spawnerType;
shot->spawnerVariant = timer->spawnerVariant;
shot->SetColor(LAVA_SHOT_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
shot->fallingSpeed = 0;
shot->fallingAccel = 1;
shot->Update();
}
timer->state++;
}
// Part of 00653070: the Beast's fire ball bursts with a shake into fourteen rising smoke clouds and as many lava shots
// thrown up around it. Over the lava, the lava rises either side in four ticks.
void Entity_Projectile::beast_fire_ball_burst()
{
constexpr int FIRE_BALL_SHAKE = 8;
constexpr int FIRE_BALL_BURSTS = 14;
constexpr float SMOKE_RISE = -2;
constexpr float SMOKE_RISE_STEP = 7;
constexpr float SMOKE_SPREAD = 10;
constexpr float FIRE_BALL_SMOKE_SCALE_MIN = 1.2f;
constexpr float SMOKE_SCALE_RANGE = 0.3f;
constexpr int SMOKE_TIMEOUT = 360;
constexpr float SHOT_RISE_MIN = -10;
constexpr float SHOT_RISE_RANGE = 28;
constexpr float SHOT_SPREAD_X = 60;
constexpr float SHOT_SPREAD_Y = 20;
constexpr float FIRE_BALL_SHOT_SCALE_MIN = 1;
constexpr float SHOT_SCALE_RANGE = 0.7f;
constexpr uint32_t LAVA_TICK_DELAY = 5;
constexpr uint32_t LAVA_TICKS = 4;
game_shake_screen(FIRE_BALL_SHAKE);
for (int i = 0; i < FIRE_BALL_BURSTS; i++)
{
uint32_t smokeSeed = Random();
Vector smokeVelocity = vector_make(0, SMOKE_RISE - (float)i * SMOKE_RISE_STEP);
Vector smokePosition = vector_add(pos, vector_scale(random_direction(), SMOKE_SPREAD));
Entity* smoke = g_game->Spawn({.position = smokePosition, .velocity = smokeVelocity, .spawner = spawnerEntity,
.type = ENTITY_EFFECT, .variant = EFFECT_SMOKE_CLOUD, .seed = smokeSeed});
smoke->spawnerType = spawnerType;
smoke->spawnerVariant = spawnerVariant;
float smokeScale = random_unit() * SMOKE_SCALE_RANGE + FIRE_BALL_SMOKE_SCALE_MIN;
smoke->sprite.scale = vector_make(smokeScale, smokeScale);
smoke->Update();
static_cast<Entity_Effect*>(smoke)->SetTimeout(SMOKE_TIMEOUT);
uint32_t shotSeed = Random();
Vector shotVelocity = vector_make(0, SHOT_RISE_MIN - random_unit() * SHOT_RISE_RANGE);
float offsetY = random_unit() * SHOT_SPREAD_Y - SHOT_SPREAD_Y * HALF;
float offsetX = random_unit() * SHOT_SPREAD_X - SHOT_SPREAD_X * HALF;
Vector shotPosition = vector_add(pos, vector_make(offsetX, offsetY));
auto* shot = static_cast<Entity_Projectile*>(g_game->Spawn(
{.position = shotPosition, .velocity = shotVelocity, .type = ENTITY_PROJECTILE, .seed = shotSeed}));
shot->scale = random_unit() * SHOT_SCALE_RANGE + FIRE_BALL_SHOT_SCALE_MIN;
shot->spawnerEntity = spawnerEntity.get();
shot->spawnerType = spawnerType;
shot->spawnerVariant = spawnerVariant;
shot->SetColor(color, -1, COLOR_PRIORITY_DEFAULT, false, true);
shot->fallingSpeed = 0;
shot->fallingAccel = 1;
shot->Update();
}
float lavaLine = g_game->room->get_lava_line_y();
if (pos.y < lavaLine) return;
Entity_Effect* lava =
Entity_Effect::CreateTimer(reinterpret_cast<void*>(&beast_lava_tick), LAVA_TICK_DELAY, LAVA_TICKS, false);
lava->spawnerEntity = spawnerEntity.get();
lava->spawnerType = spawnerType;
lava->spawnerVariant = spawnerVariant;
lava->pos = vector_make(pos.x, lavaLine);
lava->state = 1;
}
// Part of 00653070: a Heretic's fireball bursts into six purple fire shots.
void Entity_Projectile::heretic_burst_spawn()
{
@@ -1323,8 +1499,7 @@ void Entity_Projectile::death_poof_spawn()
.radius = EXPLOSION_RADIUS});
projectileFlags &= ~PROJECTILE_EXPLODE;
if (spawnerType == ENTITY_HERETIC) heretic_burst_spawn();
if (spawnerType == ENTITY_BEAST && spawnerVariant == BEAST_FIRE_BALL)
reconstruction_missing("Entity_Projectile::Update 00653070: the Beast's exploding shot");
if (spawnerType == ENTITY_BEAST && spawnerVariant == BEAST_FIRE_BALL) beast_fire_ball_burst();
}
else if (is_listed(POOF_VARIANTS, variant))
{
@@ -1626,20 +1801,20 @@ void Entity_Projectile::death_bursts_spawn()
}
}
// The shot's next target within a range: the nearest enemy for a friendly shot (charmed shooter or one that cannot
// hit the player), else the player its shooter would go after.
void Entity_Projectile::target_find(float range)
{
bool isFriendly = (spawnerEntity && spawnerEntity->HasEntityFlags(FLAG_CHARM)) ||
(projectileFlags & PROJECTILE_CANT_HIT_PLAYER);
target = isFriendly ? game_nearest_enemy(pos, spawnerEntity, range)
: game_nearest_target_player(pos, spawnerEntity, false, true, range);
}
// Homing: SMART_PERFECT turns straight at its target, SMART pulls toward a near one (purple while it does). A
// friendly shot goes after enemies.
void Entity_Projectile::homing_update()
{
auto target_find = [this](float range)
{
bool isFriendly = (spawnerEntity && spawnerEntity->HasEntityFlags(FLAG_CHARM)) ||
(projectileFlags & PROJECTILE_CANT_HIT_PLAYER);
if (isFriendly)
reconstruction_missing("Entity_Projectile::Update 00653070: a friendly shot's nearest enemy "
"(Game::GetNearestEnemy 00707370)");
target = game_nearest_target_player(pos, spawnerEntity, false, true, range);
};
if (projectileFlags & PROJECTILE_SMART_PERFECT)
{
if (!target) target_find(PERFECT_RANGE);
@@ -1922,8 +2097,7 @@ void Entity_Projectile::fall_update()
{
RNG rng;
rng.SetSeed(initSeed, CIRCLE_RNG_SHIFT);
if ((int)rng.RandomInt(CIRCLE_CHANCE) <= CIRCLE_PROC_MAX)
reconstruction_missing("Entity_Projectile::Update 00653070: the Circle of Protection's reflection");
if ((int)rng.RandomInt(CIRCLE_CHANCE) <= CIRCLE_PROC_MAX) circle_reflect();
}
fallingSpeed = speedMultiplier * fallingAccel + speedMultiplier * GRAVITY_PULL +
@@ -1939,7 +2113,59 @@ void Entity_Projectile::fall_update()
Vector clamped = room.GetClampedPositionImpl(pos, CRAWLSPACE_MARGIN_TOP, CRAWLSPACE_MARGIN, CRAWLSPACE_MARGIN,
CRAWLSPACE_MARGIN);
if ((clamped.x != pos.x || clamped.y != pos.y) && vector_dot(vector_sub(clamped, pos), velocity) < 0) Remove();
if (room.IsBeastDungeon()) reconstruction_missing("Entity_Projectile::Update 00653070: the Beast's lava");
if (room.IsBeastDungeon() && FrameCount() > 2 && velocity.y > 0 && pos.y > room.get_lava_line_y()) lava_sink();
}
// Circle of Protection: a shot inside a player's light ring becomes that player's homing tear (a plain one's without
// a player), flying back the way it came at its height and fall, purple.
void Entity_Projectile::circle_reflect()
{
constexpr int LIGHT_RING_CIRCLE = 3;
constexpr ColorMod CIRCLE_TEAR_COLOR = {{0.4f, 0.15f, 0.38f, 1}, {0, 0, 0, 0}, {0.2784314f, 0, 0.454902f}};
for (Entity* entity : entity_query(ENTITY_LASER, LASER_LIGHT_RING))
{
auto& ring = *static_cast<Entity_Laser*>(entity);
Vector offset = vector_sub(pos, ring.pos);
if (ring.subtype != LIGHT_RING_CIRCLE || vector_length_squared(offset) >= ring.radius * ring.radius) continue;
Remove();
Entity* spawner = ring.spawnerEntity;
auto* player = spawner && spawner->is_player() ? static_cast<Entity_Player*>(spawner) : nullptr;
TearParams params =
player ? player->GetTearHitParams(WEAPON_TEARS, 1, random_below(2) * 2 - 1, nullptr) : TearParams{};
auto* tear = static_cast<Entity_Tear*>(g_game->Spawn({.position = pos,
.velocity = vector_scale(velocity, -1),
.spawner = player,
.type = ENTITY_TEAR,
.seed = Random()}));
tear->SetHeight(height);
tear->fallingSpeed = fallingSpeed;
tear->SetCollisionDamage(params.tearDamage);
tear->SetTearFlags(TearFlags().set(TEAR_HOMING));
tear->SetScale(params.tearScale);
tear->fallingAccel = fallingAccel;
tear->SetColor(CIRCLE_TEAR_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
tear->parent = player;
tear->Update();
}
}
// The Beast's lava swallows a falling shot past its line with a splash (a big one with a sound for the Beast's lava
// ball). An exploding shot dies there instead.
void Entity_Projectile::lava_sink()
{
if (projectileFlags & PROJECTILE_EXPLODE)
{
isDead = true;
return;
}
Remove();
bool isLavaBall = variant == PROJECTILE_LAVA && spawnerType == ENTITY_BEAST;
if (isLavaBall) npc_sound_play(SOUND_BEAST_LAVA_BALL_SPLASH, 1, 2, 1);
int splash = isLavaBall ? POOF02_LAVA_SPLASH_LARGE : POOF02_LAVA_SPLASH;
effect_spawn(EFFECT_POOF02, pos, nullptr, splash)->Update();
}
// The rest of its frame: the slowdown's tint, the timed changes, the bounces, its height's collision, The Soul's
+7
View File
@@ -212,6 +212,13 @@ private:
bool wiggles_update();
void speed_update();
void fall_update();
void lava_sink();
void circle_reflect();
void beast_fire_ball_burst();
void target_find(float range);
void laser_shot_dot_spawn();
void side_wave_burst();
bool stasis_update();
void ground_update();
void late_update();
bool player_hit(Entity_Player& player);
+1 -1
View File
@@ -65,7 +65,7 @@ void Entity::DestroyRockGridAt(const Vector& position, GridEntityDesc* desc, Ent
explosion_effects({.position = position, .source = source, .damage = LANDED_BLAST_DAMAGE});
if (type == GRID_ROCK_BOMB) return;
wood_particles_spawn(position);
return trinket_drop_try(desc->_spawnSeed);
return trinket_drop_try(desc->_spawnSeed, position);
}
if (is_landed_rock(type))
+206 -14
View File
@@ -23,6 +23,13 @@
#include <array>
// The run's state flags of a broken or jammed donation machine, and of one blown up.
// The tainted character Home's closet holds for each regular character.
constexpr std::array<int, 21> TAINTED_TWINS = {
PLAYER_ISAAC_B, PLAYER_MAGDALENE_B, PLAYER_CAIN_B, PLAYER_JUDAS_B, PLAYER_BLUEBABY_B,
PLAYER_EVE_B, PLAYER_SAMSON_B, PLAYER_AZAZEL_B, PLAYER_LAZARUS_B, PLAYER_EDEN_B,
PLAYER_THELOST_B, PLAYER_LAZARUS_B, PLAYER_JUDAS_B, PLAYER_LILITH_B, PLAYER_KEEPER_B,
PLAYER_APOLLYON_B, PLAYER_THEFORGOTTEN_B, PLAYER_THEFORGOTTEN_B, PLAYER_BETHANY_B, PLAYER_JACOB_B,
PLAYER_JACOB_B};
constexpr int GAME_STATE_DONATION_SLOT_BROKEN = 17;
constexpr int GAME_STATE_DONATION_SLOT_JAMMED = 18;
constexpr int GAME_STATE_DONATION_SLOT_BLOWN = 30;
@@ -100,7 +107,6 @@ constexpr int SLOT_MACHINE_PEDESTAL = 3;
constexpr int CONFESSIONAL_PEDESTAL = 15;
constexpr int REVIVE_MACHINE_EXCLUDED_ROOM = -20;
constexpr int DIGIT_BASE = 10;
constexpr int HUNDREDS = 100;
constexpr int COUNTER_LIMIT = 1000;
constexpr int COUNTER_FULL = 999;
@@ -174,6 +180,18 @@ constexpr int CRANE_WIN = 25;
constexpr int CRANE_LUCK = 5;
constexpr int CRANE_PRIZES = 3;
constexpr int BETHS_ESSENCE_ODDS = 4;
// Mom's dresser broken: one time in 100 an item of Mom's clothes on the dresser's pedestal, else one to four pills.
constexpr uint32_t DRESSER_DROP_SHIFT = 31;
constexpr uint32_t DRESSER_ITEM_ODDS = 100;
constexpr uint32_t DRESSER_PILLS_MAX = 4;
constexpr int PEDESTAL_DRESSER = 9;
constexpr std::array<int, 10> DRESSER_ITEMS = {29, 30, 31, 39, 41, 200, 110, 217, 228, 355};
// The Revive Machine broken on a first visit: nothing to 32 of 100, a soul heart to 65, an eternal heart to 94, 1up!
// above, the hearts thrown slowly.
constexpr uint32_t REVIVE_DROP_NOTHING = 32;
constexpr uint32_t REVIVE_DROP_SOUL_MAX = 66;
constexpr uint32_t REVIVE_DROP_HEART_MAX = 94;
constexpr float REVIVE_DROP_SPEED = 0.4f;
constexpr int DONATION_JAM_ODDS = 3000;
constexpr int DONATION_LIMIT = 7;
constexpr int DONATION_LIMIT_RANGE = 9;
@@ -202,9 +220,6 @@ constexpr float BLOOD_SPLASH_RISE = -2;
constexpr int BLOOD_EXPLOSION_MACHINE = 4;
constexpr int SLOT_BLOOD_SPLASH = 3;
constexpr ColorMod ROTTEN_SPLAT_COLOR = {{0.7f, 0.9f, 0.65f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
constexpr float ROTTEN_SPLAT_MIN = 0.2f;
constexpr float ROTTEN_SPLAT_RANGE = 0.4f;
constexpr float ROTTEN_PARTICLE_SPEED = 2;
constexpr float ROTTEN_PARTICLE_HEIGHT = 100000;
@@ -403,7 +418,6 @@ Vector collectible_spawn_position(Vector target)
// 0065d200 Starts a slot from its config's sprite, sized and offset for its kind. The donation machines show their
// save's count and break or jam as the run left them, the dresser appears on a first visit, and the Revive Machine
// only stays in co-op. In Greed mode the blood donation machine is a devil beggar.
// Isaac's secret closet and the Revive Machine's setup are not reconstructed yet.
void Entity_Slot::Init(int entityType, int entityVariant, int entitySubType, uint32_t seed)
{
bool isGreed = g_game->difficulty == DIFFICULTY_GREED || g_game->difficulty == DIFFICULTY_GREEDIER;
@@ -463,7 +477,7 @@ void Entity_Slot::Init(int entityType, int entityVariant, int entitySubType, uin
bool isOnline = g_manager->netplayManager.is_online();
bool isBroken =
g_game->GetStateFlag((GameStateFlag)GAME_STATE_DONATION_SLOT_BROKEN) ||
(isOnline ? g_game->challenge != 0 || g_game->dailyChallenge._id != 0 : achievements_disallowed());
(isOnline ? g_game->challenge != 0 || g_game->dailyChallenge.id != 0 : achievements_disallowed());
if (isBroken) Remove();
if (g_game->GetStateFlag((GameStateFlag)GAME_STATE_DONATION_SLOT_JAMMED))
{
@@ -499,16 +513,44 @@ void Entity_Slot::Init(int entityType, int entityVariant, int entitySubType, uin
}
break;
case SLOT_ISAAC_SECRET:
reconstruction_missing("Entity_Slot::Init 0065d200: Isaac's secret closet");
{
if (g_manager->netplayManager.is_online())
reconstruction_missing("Entity_Slot::Init 0065d200: the closet of the online local player");
int playerType = g_game->GetPlayer(0)->playerType;
bool isRegular = playerType >= 0 && playerType < (int)TAINTED_TWINS.size();
EntityConfig_Player* tainted = g_manager->entityConfig.GetPlayer(isRegular ? TAINTED_TWINS[playerType]
: playerType);
if (!tainted) break;
for (int layer = 0; layer < (int)sprite.layerStates.size(); layer++)
sprite.ReplaceSpritesheet(layer, tainted->skinPath);
sprite.LoadGraphics();
break;
}
case SLOT_REVIVE_MACHINE:
// 006655e0 The Revive Machine stands only in co-op, out of the excluded room, showing its price.
if (!g_game->playerManager.IsCoopPlay() || g_game->currentRoomIdx == REVIVE_MACHINE_EXCLUDED_ROOM) Remove();
else reconstruction_missing("Entity_Slot::Init 0065d200: the Revive Machine in co-op (FUN_006655e0)");
else
{
posOffset.y = MACHINE_OFFSET_Y;
sizeMulti = vector_make(MACHINE_WIDTH, MACHINE_DEPTH);
revive_counter_show();
AddEntityFlags(FLAG_NO_KNOCKBACK);
}
break;
}
entityGridCollisionClass = GRIDCOLL_NONE;
timeout = 0;
}
// 00665630 Shows the coins the Revive Machine still asks for on its two digit layers.
void Entity_Slot::revive_counter_show()
{
int coins = g_game->reviveMachineCoinsLeft;
sprite.SetFrame("Prize", 0);
sprite.SetLayerFrame(1, coins / DIGIT_BASE % DIGIT_BASE);
sprite.SetLayerFrame(2, coins % DIGIT_BASE);
}
// Shows a donation count on the machine's three digit layers.
void Entity_Slot::counter_show(int count)
{
@@ -815,7 +857,7 @@ void Entity_Slot::idle_update()
if (state == SLOT_STATE_REWARD)
{
if (isMachine && sprite.IsFinished()) sprite.Play("Wiggle");
if (variant == SLOT_ISAAC_SECRET) reconstruction_missing("Entity_Slot::Update 0065d950: Isaac's secret closet");
if (variant == SLOT_ISAAC_SECRET) closet_effects_update();
}
else if (state == SLOT_STATE_BROKEN)
{
@@ -1567,7 +1609,9 @@ void Entity_Slot::payout(Entity_Player& player)
battery_bum_pay(player, prizeRng, count);
break;
case SLOT_ISAAC_SECRET:
reconstruction_missing("Entity_Slot::Update 0065d950: Isaac's secret closet");
Remove();
PlayerManager::unlock_completion_mark(COMPLETION_TAINTED);
return;
case SLOT_CRANE_GAME:
case SLOT_CONFESSIONAL:
break;
@@ -1591,6 +1635,33 @@ void Entity_Slot::payout(Entity_Player& player)
sprite.Play("Idle");
}
// Part of 0065d950: freeing the tainted character from Home's closet shows a burst over the closet (its "FX" event)
// and a poof (its "Poof" event).
void Entity_Slot::closet_effects_update()
{
constexpr int CLOSET_FX_SUBTYPE = 10;
constexpr float CLOSET_FX_DEPTH = -10;
constexpr float CLOSET_FX_RISE = -20;
if (sprite.IsEventTriggered("FX"))
{
auto* burst = static_cast<Entity_Effect*>(g_game->Spawn({.position = pos,
.subType = CLOSET_FX_SUBTYPE,
.type = ENTITY_EFFECT,
.variant = EFFECT_TEAR_POOF_A,
.seed = Random()}));
burst->FollowParent(this);
burst->renderDepthOffset = CLOSET_FX_DEPTH;
burst->sprite.scale = sprite.scale;
burst->sprite.offset = vector_mul(burst->sprite.scale, vector_make(0, CLOSET_FX_RISE));
burst->AddEntityFlags(FLAG_TRANSITION_UPDATE);
burst->Update();
burst->rotation = 0;
}
if (sprite.IsEventTriggered("Poof"))
g_game->Spawn({.position = pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()});
}
// 0065d950 Runs a slot each frame: its appearance, its spot, a Rotten Beggar's first splat, a Bomb Bum's Troll Bombs,
// the slot machine's roll once its spin ends, the Crane Game and Confessional prizes, and the payout once a payment's
// animation is done. A shell game shuffles with a sound, and touches count while a player keeps touching it.
@@ -1947,6 +2018,92 @@ void Entity_Slot::payment_react(Entity_Player& player, Entity* collider)
npc_anim_restart(sprite, animation);
}
// Part of 006627e0: Beth's Essence gives a beggar's payer a wisp of a random active item that has one (Book of
// Virtues' otherwise). Two or three copies draw again among every active with a wisp, and more give none.
// The original reads past an empty list of such actives. Here it gives no wisp.
static void beths_essence_wisp_add(Entity_Player& player, const Vector& position)
{
ItemConfig& items = g_manager->itemConfig;
RNG& rng = player.GetTrinketRNG(TRINKET_BETHS_ESSENCE);
auto isWispActive = [](ItemConfig_Item* item)
{ return item && item->type == ITEM_ACTIVE && item->wispConfig && item->wispConfig->count >= 1; };
int id = (int)rng.RandomInt((uint32_t)items.collectibles.size() - 1) + 1;
ItemConfig_Item* item = items.GetCollectible(id);
if (!ItemConfig::IsValidCollectible(id) || !isWispActive(item))
item = items.GetCollectible(COLLECTIBLE_BOOK_OF_VIRTUES);
int copies = player.GetTrinketMultiplier(TRINKET_BETHS_ESSENCE);
if (copies == 1) player.AddWisp(item->id, position, true, false);
if (copies != 2 && copies != 3) return;
std::vector<int> actives;
for (int each = 0; each < (int)items.collectibles.size(); each++)
if (isWispActive(items.GetCollectible(each))) actives.push_back(each);
if (!actives.empty()) player.AddWisp(actives[rng.RandomInt((uint32_t)actives.size())], position, true, false);
}
// 0075d9f0 Mom's dresser shuffles the player's costumes: each costume, from the first, swaps with a random later one, a
// head and its body (the same item's costumes side by side) moving as a pair. A lone costume before a pair first moves
// behind the pair when it is to swap with another pair. The costumes are then rebuilt.
static void costumes_shuffle(Entity_Player& player, uint32_t seed)
{
constexpr uint32_t DRESSER_SHUFFLE_SHIFT = 19;
std::vector<CostumeSpriteDesc>& costumes = player.costumeSpriteDescs;
int count = (int)costumes.size();
RNG rng = rng_make(seed, DRESSER_SHUFFLE_SHIFT);
auto isPairAt = [&](int at) { return at < count - 1 && costumes[at].item == costumes[at + 1].item; };
log_printf(LOG_INFO, "costume map:\n");
for (int i = 0; i < count; i++) log_printf(LOG_INFO, "%d: %s\n", i, costumes[i].sprite.filename.c_str());
for (int i = 0; i < count - 1; i++)
{
bool isPair = isPairAt(i);
uint32_t range = (uint32_t)(isPair ? count - 1 - i : count - i);
uint32_t roll = rng.Next();
int other = (range ? (int)(roll % range) : 0) + i;
if (i < other && costumes[other - 1].item == costumes[other].item) other--;
else if (isPair && other < count - 2 && isPairAt(other + 1)) other++;
bool isOtherPair = isPairAt(other);
if (other == i)
{
if (isPair || isOtherPair) i++;
continue;
}
if (isOtherPair && !isPair && i < count - 2 && isPairAt(i + 1))
{
log_printf(LOG_INFO, "swap (src body) %d %d\n", i, i + 1);
log_printf(LOG_INFO, "swap (src body) %d %d\n", i + 1, i + 2);
std::swap(costumes[i], costumes[i + 1]);
std::swap(costumes[i + 1], costumes[i + 2]);
isPair = true;
if (other == i + 1)
{
i++;
continue;
}
}
log_printf(LOG_INFO, "swap %d %d\n", i, other);
std::swap(costumes[i], costumes[other]);
if (!isPair && !isOtherPair) continue;
log_printf(LOG_INFO, "swap (body) %d %d\n", i + 1, other + 1);
std::swap(costumes[i + 1], costumes[other + 1]);
i++;
}
player.UpdateCostumes();
}
// 006653e0 Opening Mom's dresser: it plays its use, a poof rises at the player with the chest's sound, and the player's
// costumes are shuffled.
void Entity_Slot::dresser_open(Entity_Player& player)
{
sprite.Play("Use", PLAY_FORCED);
EntitySpawn poof = {.position = player.pos, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01, .seed = Random()};
g_game->Spawn(poof)->Update();
npc_sound_play(SOUND_CHEST_OPEN, 1, 2, 1);
costumes_shuffle(player, dropRNG.Next());
}
// 006627e0 A player touching an idle slot pays it, which makes it the slot's target, may give Beth's Essence a wisp
// for a beggar, and starts the slot's payment. A player touching Mom's dresser opens it. Touches are counted while a
// player keeps touching. Enemies and bombs pass through a slot.
@@ -1955,7 +2112,7 @@ bool Entity_Slot::HandleCollision(Entity* collider, bool)
bool isPlayer = collider->type == ENTITY_PLAYER;
if (variant == SLOT_MOMS_DRESSER && isPlayer && collider->variant == PLAYER_VARIANT_PLAYER &&
state != SLOT_STATE_BROKEN && (!sprite.animState.animData || !sprite.animState.isPlaying))
reconstruction_missing("Entity_Slot::HandleCollision 006627e0: Mom's dresser (FUN_006653e0, FUN_0075d9f0)");
dresser_open(*collider->ToPlayer());
bool isShellGame = variant == SLOT_SHELL_GAME || variant == SLOT_HELL_GAME;
const AnimationData* animation = sprite.animState.animData;
@@ -1977,7 +2134,7 @@ bool Entity_Slot::HandleCollision(Entity* collider, bool)
target = &player;
if (is_beggar(variant) && player.HasTrinket(TRINKET_BETHS_ESSENCE) &&
player.GetTrinketRNG(TRINKET_BETHS_ESSENCE).RandomInt(BETHS_ESSENCE_ODDS) == 0)
reconstruction_missing("Entity_Slot::HandleCollision 006627e0: Beth's Essence's wisp");
beths_essence_wisp_add(player, pos);
payment_react(player, collider);
}
}
@@ -2181,9 +2338,44 @@ void Entity_Slot::spawn_break_drops()
}
return;
case SLOT_MOMS_DRESSER:
reconstruction_missing("Entity_Slot::spawn_break_drops 00663aa0: Mom's dresser");
{
RNG rng = rng_make(initSeed, DRESSER_DROP_SHIFT);
if (rng.RandomInt(DRESSER_ITEM_ODDS) != 0)
{
for (int pills = (int)rng.RandomInt(DRESSER_PILLS_MAX) + 1; pills > 0; pills--)
drop(PICKUP_PILL, 0, rng.Next(), 1);
return;
}
ItemPool& pool = g_game->itemPool;
int item =
pool.GetCollectibleFromList(DRESSER_ITEMS, rng.Next(), COLLECTIBLE_MOMS_HEELS, LIST_PICK_BLACKLIST);
auto* pedestal = static_cast<Entity_Pickup*>(g_game->Spawn({.position = pos,
.subType = item,
.type = ENTITY_PICKUP,
.variant = PICKUP_COLLECTIBLE,
.seed = rng.Next()}));
pedestal->SetAlternatePedestal(PEDESTAL_DRESSER);
pedestal->Update();
return Remove();
}
case SLOT_REVIVE_MACHINE:
reconstruction_missing("Entity_Slot::spawn_break_drops 00663aa0: the Revive Machine");
{
if (!g_game->room->isFirstVisit) return;
uint32_t roll = dropRNG.RandomInt(100);
if (roll <= REVIVE_DROP_NOTHING) return;
if (roll > REVIVE_DROP_HEART_MAX)
{
g_game->Spawn({.position = pos,
.subType = COLLECTIBLE_1UP,
.type = ENTITY_PICKUP,
.variant = PICKUP_COLLECTIBLE,
.seed = dropRNG.Next()});
return;
}
uint32_t seed = dropRNG.Next();
int heart = roll < REVIVE_DROP_SOUL_MAX ? (int)HEART_SOUL : (int)HEART_ETERNAL;
return drop(PICKUP_HEART, heart, seed, REVIVE_DROP_SPEED);
}
default:
break;
}
+3
View File
@@ -80,6 +80,7 @@ struct Entity_Slot : Entity
private:
void counter_show(int count);
void revive_counter_show();
void drops_spawn(const SlotDrop& drop);
void explode();
void leave();
@@ -107,6 +108,8 @@ private:
void payment_react(Entity_Player& player, Entity* collider);
void shell_game_start(Entity_Player& player);
void blood_trails_spawn();
void closet_effects_update();
void dresser_open(Entity_Player& player);
};
Vector room_pickup_position_random(bool isAvoidActiveEntities, bool isAllowPits);
+88 -6
View File
@@ -10,6 +10,9 @@
#include "entity_player.h"
#include "game.h"
#include "grid_entity.h"
#include "persistent_game_data.h"
#include "grid_entity_poop.h"
#include "grid_entity_rock.h"
#include "log.h"
#include "lua_engine.h"
#include "manager.h"
@@ -28,6 +31,20 @@ constexpr float TEAR_DAMAGE_DEFAULT = 3.5f;
constexpr float TEAR_HOMING_FRICTION = 0.85f;
constexpr float DEFLECT_REBOUND = 0.85f;
constexpr float TEAR_KNOCKBACK_MULTIPLIER = 1.7f;
// A teleporting tear's hit: the tries for a spot, how far the enemy must move and stay from the nearest target within
// range, and the blue of its poofs.
constexpr int TEAR_TELEPORT_TRIES = 33;
// A rerolled rock's kinds, and where a roll for a poop turns from plain to corny, red, black, rainbow and golden.
constexpr uint32_t ROCK_REROLL_KINDS = 6;
constexpr float ROCK_REROLL_POOP_NORMAL = 0.6f;
constexpr float ROCK_REROLL_POOP_CORNY = 0.8f;
constexpr float ROCK_REROLL_POOP_RED = 0.95f;
constexpr float ROCK_REROLL_POOP_BLACK = 0.97f;
constexpr float ROCK_REROLL_POOP_RAINBOW = 0.98f;
constexpr float TELEPORT_MOVE_SQUARED = 400;
constexpr float TELEPORT_TARGET_DISTANCE_SQUARED = 6400;
constexpr float TELEPORT_TARGET_RANGE = 5000;
constexpr ColorMod TELEPORT_POOF_COLOR = {{1, 1, 1, 1}, {0, 0, 0, 0}, {0.2509804f, 0.34901962f, 0.5019608f}};
constexpr float TEAR_RANGE_DEFAULT = 260;
constexpr float TEAR_GRID_HIT_HEIGHT = -60;
// A Chaos Card on the floor lies upside down, and a water tear bounces off the floor a little faster than it fell.
@@ -635,8 +652,7 @@ void Entity_Tear::flight_update(float verticalMotion)
bool isBouncing = tearFlags[TEAR_BOUNCE] || tearFlags[TEAR_BOUNCE_WALLSONLY] || variant == TEAR_FIRE;
if (isOnFloor && !isLudovico) floor_hit();
else if ((isBouncing && !g_game->room->IsBeastDungeon()) || (isLudovico && (subtype & LUDOVICO_FAST))) bounce_hit();
else if (tearFlags[TEAR_REROLL_ROCK_WISP])
reconstruction_missing("Entity_Tear::Update 006670f0: a rock rerolling tear");
else if (tearFlags[TEAR_REROLL_ROCK_WISP]) rock_reroll();
else grid_hit();
if (variant == TEAR_CHAOS_CARD) chaos_card_stick();
key_open();
@@ -1138,6 +1154,54 @@ void Entity_Tear::floor_hit()
}
}
// The rock a rerolled rock becomes: a poop of some kind, a block, a bomb rock, an alternate rock, TNT, or the rock of
// its cell (tinted on the tinted rock's cell, now and then super tinted once unlocked).
static std::pair<GridEntityType, int> rock_reroll_roll(RNG& rng, int gridIndex)
{
uint32_t roll = rng.RandomInt(ROCK_REROLL_KINDS);
bool isTinted = gridIndex == g_game->room->tintedRockIdx;
GridEntityType rock = isTinted ? GRID_ROCKT : GRID_ROCK;
if (isTinted && rng.RandomInt(SUPER_TINTED_ODDS) == 0 &&
g_manager->persistentGameData.Unlocked(ACHIEVEMENT_SUPER_TINTED_ROCK))
rock = GRID_ROCK_SS;
switch (roll)
{
case 0:
{
float poop = rng.RandomFloat();
if (poop < ROCK_REROLL_POOP_NORMAL) return {GRID_POOP, POOP_NORMAL};
if (poop < ROCK_REROLL_POOP_CORNY) return {GRID_POOP, POOP_CORNY};
if (poop < ROCK_REROLL_POOP_RED) return {GRID_POOP, POOP_RED};
if (poop < ROCK_REROLL_POOP_BLACK) return {GRID_POOP, POOP_BLACK};
return {GRID_POOP, poop < ROCK_REROLL_POOP_RAINBOW ? POOP_RAINBOW : POOP_GOLDEN};
}
case 1: return {GRID_ROCKB, 0};
case 2: return {GRID_ROCK_BOMB, 0};
case 3: return {GRID_ROCK_ALT, 0};
case 4: return {GRID_TNT, 0};
default: return {rock, 0};
}
}
// The rock rerolling tear: a breakable rock it flies over breaks, without drops, into another obstacle rolled from the
// tear's drop generator, and the tear rerolls no more.
void Entity_Tear::rock_reroll()
{
Room& room = *g_game->room;
int gridIndex = room.GetGridIndex(pos);
if (gridIndex < 0) return;
GridEntity* grid = room.GetGridEntity((uint32_t)gridIndex);
if (!grid || !grid->IsBreakableRock()) return;
tearFlags.reset(TEAR_REROLL_ROCK_WISP);
grid->state = ROCK_STATE_BROKEN;
static_cast<GridEntity_Rock*>(grid)->UpdateNeighbors();
auto [type, variant] = rock_reroll_roll(dropRNG, gridIndex);
room.SetGridPath(gridIndex, 0);
room.SpawnGridEntity(gridIndex, type, variant, dropRNG.Next(), 0);
}
// The tear hit the grid, or stands on a wall: it dies, hurting the rocks and poop it touches, unless it is spectral
// or stuck in an enemy (a Chaos Card sticks in the wall instead). Missing anything but poop or TNT ends its player's
// streak.
@@ -1291,7 +1355,7 @@ void Entity_Tear::ludovico_interpolate()
pos = vector_add(main->pos, vector_resized(offset, vector_length(offset) * (sway * LUDOVICO_SWAY + 1)));
}
if (!tearFlags[TEAR_HYDROBOUNCE]) return;
float bob = std::sin(((float)(g_game->frameCount - spawnFrame) + HALF_FRAME) * (PI_F / fallingSpeed));
float bob = std::sin(((float)(g_game->frameCount - spawnFrame) + HALF_FRAME) * (PI_F / hydrobounce_period_get()));
posOffset.y = std::fabs(bob) * height;
}
@@ -2174,8 +2238,26 @@ void Entity_Tear::ChangeVariant(int newVariant)
entityGridCollisionClass = gridCollision;
}
// 006b5320
void Entity_Tear::reroll_hit_entity(int)
// 006b5320 Teleports an enemy a teleporting tear hit: to a free tile at least 20 away from it and 80 from the nearest
// target, tried 33 times, leaving a blue poof where it was and one where it lands. It stays when no spot fits.
// The original reads a missing nearest target and crashes. Without one, any spot fits.
void tear_hit_teleport(Entity& entity)
{
reconstruction_missing("Entity_Tear::reroll_hit_entity 006b5320");
Room& room = *g_game->room;
Vector spot = {};
for (int tries = 0; tries < TEAR_TELEPORT_TRIES; tries++)
{
spot = room_free_tile_position_find(room.GetRandomPosition(0), 0);
Entity* target = game_nearest_target_player(spot, &entity, false, false, TELEPORT_TARGET_RANGE);
bool isFarFromTarget = !target || vector_length_squared(vector_sub(target->pos, spot)) > TELEPORT_TARGET_DISTANCE_SQUARED;
if (vector_length_squared(vector_sub(spot, entity.pos)) > TELEPORT_MOVE_SQUARED && isFarFromTarget) break;
spot = {};
}
if (spot.x == 0 && spot.y == 0) return;
for (Vector at : {entity.pos, spot})
if (Entity* poof = g_game->Spawn({.position = at, .type = ENTITY_EFFECT, .variant = EFFECT_POOF01,
.seed = Random()}))
poof->sprite.color = TELEPORT_POOF_COLOR;
entity.pos = spot;
}
+9 -1
View File
@@ -2,6 +2,7 @@
#include "entity.h"
#include "anm2.h"
#include <algorithm>
#include <array>
#include <vector>
@@ -11,6 +12,12 @@ constexpr std::array<float, 13> TEAR_ANIMATION_SCALES = {0.25f, 0.5f, 0.625f,
1.375f, 1.625f, 1.875f, 2.125f, 2.5f, 2.75f};
constexpr float TEAR_ANIMATION_MARGIN = 0.05f;
// FUN_0067af30: the scale of a RegularTear animation by its number, held inside 1 to 13.
inline float tear_size_scale(int size)
{
return TEAR_ANIMATION_SCALES[std::clamp(size, 1, (int)TEAR_ANIMATION_SCALES.size()) - 1];
}
// Lua's TearFlags bits the game reads. Bits 84 and 101 to 103 have no Lua name: It Hurts' creep on death, flags
// swapped in on an interval, a speed reset on an interval, and steering back toward the parent.
enum TearFlagBit : int
@@ -348,7 +355,6 @@ struct Entity_Tear : Entity
void apply_link_spring_forces();
bool try_make_bridges(const Vector& position);
void bridge_beyond(GridEntity& rock);
void reroll_hit_entity(int unused);
static void ApplyTearFlagEffects(Entity* entity, const Vector& position, const TearFlags& flags, Entity* source,
float damage);
@@ -396,6 +402,7 @@ private:
bool is_popping();
void floor_hit();
void grid_hit();
void rock_reroll();
void bounce_hit();
void chaos_card_stick();
void key_open();
@@ -431,6 +438,7 @@ Vector tear_vector_rotate(Vector v, float degrees);
Entity* homing_target_find(Entity_Tear& tear, bool isFetus);
float dead_eye_glow_get(Entity_Player& player);
int tear_variant_blood(int variant);
void tear_hit_teleport(Entity& entity);
// Game::AttractEntities' arguments: where everything is pulled to, how hard and how far, and the one entity spared.
struct Attraction
+91 -6
View File
@@ -3,6 +3,7 @@
#include "entity_effect_combat.h"
#include "entity_familiar.h"
#include "entity_knife.h"
#include "entity_laser.h"
#include "entity_player.h"
#include "entity_effect.h"
#include "game.h"
@@ -143,6 +144,19 @@ constexpr float HAEMO_BURST_HEIGHT = -6;
constexpr float HAEMO_BURST_FALL_ACCEL = 1.3f;
constexpr float HAEMO_BURST_FALL_MIN = 0.5f;
constexpr float HAEMO_BURST_FALL_SPREAD = 0.75f;
// Haemolacria's Dr. Fetus bombs: their throw speed, how far from the tear they start (around 3.14 for pi), their blast,
// rise and fuse, and its Tech X rings' radius.
constexpr float HAEMO_BOMB_SPEED_MIN = 3;
constexpr float HAEMO_BOMB_SPEED_RANGE = 4;
constexpr float HAEMO_BOMB_PI = 3.14f;
constexpr float HAEMO_BOMB_SPREAD = 10;
constexpr float HAEMO_BOMB_RADIUS = 0.65f;
constexpr float HAEMO_BOMB_RISE_MIN = 3;
constexpr float HAEMO_BOMB_RISE_RANGE = 5;
constexpr uint32_t HAEMO_BOMB_FUSE_RANGE = 14;
constexpr int HAEMO_BOMB_FUSE_MIN = 10;
constexpr float HAEMO_RING_RADIUS_MIN = 20;
constexpr float HAEMO_RING_RADIUS_RANGE = 60;
constexpr float BURST_CRAWLSPACE_OFFSET = -18;
// The flags Haemolacria's burst keeps of its tear.
@@ -656,6 +670,82 @@ static int burst_count_get(Entity_Player* player, bool isHalved)
return isHalved ? (count + 1) / 2 : count;
}
// A laser of Haemolacria's burst: where the tear died, not following its player, in the tear's color and touched by
// what touched it.
static void haemo_laser_finish(Entity_Tear& tear, Entity_Laser& laser)
{
laser.pos = tear.pos;
laser.isDisableFollowParent = true;
laser.SetColor(tear.sprite.color, -1, TEAR_COLOR_PRIORITY, false, true);
laser.isPrismTouched = tear.isPrismTouched;
laser.isMultidimensionalTouched = tear.isMultidimensionalTouched;
laser.Update();
}
// A Dr. Fetus bomb of Haemolacria's burst: thrown at random from near the tear, half size and damage with a smaller
// blast, without Sad Bombs unless the tear may end a streak, popping up with a short random fuse unless a rocket.
static void haemo_bomb_throw(Entity_Tear& tear, Entity_Player& player)
{
float speed = (random_unit() * HAEMO_BOMB_SPEED_RANGE + HAEMO_BOMB_SPEED_MIN) * player.shotSpeed;
Vector velocity = vector_scale(vector_from_angle(random_unit() * TEAR_FULL_TURN), speed);
float angle = random_unit() * HAEMO_BOMB_PI * 2;
float reach = random_unit() * HAEMO_BOMB_SPREAD;
Vector position = vector_make(std::cos(angle) * reach + tear.pos.x, std::sin(angle) * reach + tear.pos.y);
Entity_Bomb& bomb = *player.FireBomb(position, velocity, nullptr);
bomb.SetColor(tear.sprite.color, -1, TEAR_COLOR_PRIORITY, false, true);
bomb.isPrismTouched = tear.isPrismTouched;
if (!tear.isCanTriggerStreakEnd) bomb.tearFlags.reset(TEAR_SAD_BOMB);
bomb.isLoadCostumes = true;
bomb.scale *= HALF;
bomb.explosionDamage *= HALF;
bomb.radiusMultiplier *= HAEMO_BOMB_RADIUS;
bomb.SetSize(bomb.size * HALF, vector_make(-1, -1), -1);
if (!bomb.IsRocket())
{
bomb.fallSpeed = -HAEMO_BOMB_RISE_MIN - random_unit() * HAEMO_BOMB_RISE_RANGE;
int fuse = (int)(bomb.dropRNG.Next() % HAEMO_BOMB_FUSE_RANGE) + HAEMO_BOMB_FUSE_MIN;
bomb.posOffset = vector_make(0, -HAEMO_BOMB_RISE_MIN);
bomb.explosionCountdown = fuse;
bomb.explosionCountdown2 = fuse;
}
bomb.AddEntityFlags(FLAG_NO_KNOCKBACK | FLAG_NO_REWARD);
}
// A piece of Haemolacria's burst for a player with a weapon: a delayed Brimstone beam, a Dr. Fetus bomb, a Tech X ring
// or a Technology laser at a random angle, in that order of preference. False for a player with none.
static bool haemo_weapon_burst(Entity_Tear& tear, Entity_Player& player)
{
if (player.HasCollectible(COLLECTIBLE_BRIMSTONE))
{
haemo_laser_finish(tear, *player.FireDelayedBrimstone(random_unit() * TEAR_FULL_TURN, &player));
return true;
}
if (player.HasCollectible(COLLECTIBLE_DR_FETUS))
{
haemo_bomb_throw(tear, player);
return true;
}
if (player.HasCollectible(COLLECTIBLE_TECH_X))
{
float radius = random_unit() * HAEMO_RING_RADIUS_RANGE + HAEMO_RING_RADIUS_MIN;
Vector velocity = vector_scale(vector_from_angle(random_unit() * TEAR_FULL_TURN), player.shotSpeed * HAEMO_BURST_SPEED);
Entity_Laser* ring = player.FireTechXLaser({.position = tear.pos, .velocity = velocity, .radius = radius});
ring->isPrismTouched = tear.isPrismTouched;
ring->isMultidimensionalTouched = tear.isMultidimensionalTouched;
ring->Update();
return true;
}
if (!player.HasCollectible(COLLECTIBLE_TECHNOLOGY)) return false;
Vector direction = vector_from_angle(random_unit() * TEAR_FULL_TURN);
Entity_Laser* laser =
player.FireTechLaser({.direction = direction, .position = tear.pos, .offsetId = LASER_OFFSET_TECH2});
laser->SetCollisionDamage(laser->collisionDamage / HAEMO_BURST_DAMAGE_SHARE);
haemo_laser_finish(tear, *laser);
return true;
}
// 00678080 Haemolacria: the dying tear bursts into blood tears flying off at random at ten times its player's shot
// speed, keeping most of its flags, smaller and weaker by a random share, falling back from the burst's height.
// A player with Brimstone, Dr. Fetus, Tech X or Technology bursts into those weapons instead.
@@ -674,12 +764,7 @@ void Entity_Tear::fire_split_projectiles(bool isHalved)
if (tearFlags[flag]) kept.set(flag);
for (int i = 0; i < count; i++)
{
bool isWeapon = player && (player->HasCollectible(COLLECTIBLE_BRIMSTONE) ||
player->HasCollectible(COLLECTIBLE_DR_FETUS) ||
player->HasCollectible(COLLECTIBLE_TECH_X) ||
player->HasCollectible(COLLECTIBLE_TECHNOLOGY));
if (isWeapon)
reconstruction_missing("Entity_Tear::fire_split_projectiles 00678080: Haemolacria's burst of a weapon");
if (player && haemo_weapon_burst(*this, *player)) continue;
uint32_t seed = Random();
Vector burstVelocity = vector_scale(vector_from_angle(random_unit() * TEAR_FULL_TURN), shotSpeed * HAEMO_BURST_SPEED);
+3 -3
View File
@@ -366,13 +366,13 @@ void Entity_Tear::lasershot_update()
laserShotLaser = nullptr;
}
// (006670f0's Ludovico water bounce) A Ludovico water tear bobs on a sine of its height over its fall, splashing on
// the floor each time the bob turns. The vertical motion its sprite turns with, its fall speed otherwise.
// (006670f0's Ludovico water bounce) A Ludovico water tear bobs on a sine of its height over its player's fire delay,
// splashing on the floor each time the bob turns. The vertical motion its sprite turns with, its fall speed otherwise.
float Entity_Tear::ludovico_hydrobounce_update()
{
if (!tearFlags[TEAR_LUDOVICO] || !tearFlags[TEAR_HYDROBOUNCE]) return fallingSpeed;
float rate = PI_F / fallingSpeed;
float rate = PI_F / hydrobounce_period_get();
float before = std::sin((float)(FrameCount() - 1) * rate);
float now = std::sin((float)FrameCount() * rate);
posOffset.y = std::fabs(now) * height;
Loaded 100 of 232 files, more files were not shown because too many files have changed in this diff. Show more