#include "classes.h" // 0091e980 void Camera::UpdateUltrasmooth(uint32_t *param_2, int *param_3) { uint8_t bVar1; code *pcVar2; uint8_t *puVar3; char cVar4; uint32_t securityCookie; uint8_t *match; uint32_t extraout_ECX; uint32_t extraout_ECX_00; uint32_t extraout_ECX_01; uint32_t uVar5; uint32_t extraout_ECX_02; uint32_t securityCookie; uint32_t *message; int *profanityNode; uint8_t *haystack; uint32_t uVar7; uint8_t **stream; uint8_t local_3c [8]; int foundNode; uint64_t local_30; Camera *self; uint32_t local_24; uint8_t *puStack_20; void *local_1c; uint8_t *puStack_18; uint32_t local_14; Manager *manager; Camera *self2; message = param_2; puStack_20 = local_3c + 0x38; puStack_18 = &LAB_00b0a4c8; local_1c = ExceptionList; securityCookie = __security_cookie ^ GHIDRA_UINT((local_3c + 0x2c)); ExceptionList = &local_1c; local_14 = 0; self = this; puVar3 = local_3c + 0x38; if ((g_manager->_optionsConfig)._onlineChatEnabled != 0) { local_30 = *GHIDRA_CAST(param_2); FUN_00731ee0(local_3c,&local_30); self2 = self; if (*GHIDRA_CAST((foundNode + 0xd)) == '\0') { if ((*GHIDRA_CAST((foundNode + 0x14)) <= message[1]) && (((*GHIDRA_CAST((foundNode + 0x14)) < message[1] || (*GHIDRA_CAST((foundNode + 0x10)) <= *message)) && (puVar3 = puStack_20, foundNode != *GHIDRA_CAST((this[10]._focusPositionBuffer + 8)))))) goto LAB_0091ec0a; } local_24 = **GHIDRA_CAST(self->_aimOffsetBuffer); if (GHIDRA_CAST(local_24) != *GHIDRA_CAST(self->_aimOffsetBuffer)) { uVar7 = 0x80000000; do { if (*GHIDRA_CAST((local_24 + 0x3c)) < *GHIDRA_CAST((*GHIDRA_CAST((local_24 + 0x18)) + 0x5f8))) { *GHIDRA_CAST((local_24 + 0x38)) = *GHIDRA_CAST(self2[10]._shakeOffsetBuffer) ^ uVar7; } *GHIDRA_CAST((local_24 + 0x3c)) = *GHIDRA_CAST((local_24 + 0x3c)) + 1; msvc:: _Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,msvc::_Iterator_base0> *)&local_24); } while (local_24 != *GHIDRA_CAST(self2->_aimOffsetBuffer)); message = param_2; } if (message[3] != 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("This function should only be called on consolidated messages")); message = param_2; } if (message[3] != 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("This function should only be called on consolidated messages")); } stream = KAGE::Filesys::BufferedStream::vftable; local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); local_30 = 0; memory_stream_read(&stream,&local_30,8,1); local_24 = 0; if ((code *)stream[5] == memory_stream_read) { memory_stream_read(&stream,&local_24,2,1); } else { (*(code *)stream[5])(&local_24); } uVar7 = local_24 & 0xffff; memory_stream_read(&stream,&DAT_00c93050,1,uVar7); manager = g_manager; if (0x7ff < uVar7) { FUN_00aef86f(); pcVar2 = (code *)swi(3); (*pcVar2)(); return; } (&DAT_00c93050)[uVar7] = 0; securityCookie = extraout_ECX; if ((manager->_optionsConfig)._onlineFilterEnabled != 0) { profanity_list_load(); profanityNode = GHIDRA_CAST(*DAT_00c7986c); securityCookie = extraout_ECX_00; if (profanityNode != DAT_00c7986c) { do { haystack = &DAT_00c93050; match = stristr(&DAT_00c93050,GHIDRA_CAST((profanityNode + 2))); securityCookie = extraout_ECX_01; while (match != GHIDRA_CAST(0x0)) { bVar1 = *GHIDRA_CAST((profanityNode + 10)); uVar7 = GHIDRA_UINT(bVar1); if (match == &DAT_00c93050) { uVar5 = GHIDRA_UINT(CONCAT11((&DAT_00c93050)[uVar7],bVar1)); LAB_0091ebb0: cVar4 = (char)(uVar5 >> 8); if ((cVar4 == ' ') || (cVar4 == '\0')) { strncpy(GHIDRA_CAST(match),"********************************",uVar7); uVar5 = GHIDRA_UINT(*GHIDRA_CAST((profanityNode + 10))); } } else { uVar5 = GHIDRA_UINT(CONCAT11(match[uVar7],bVar1)); if (match[-1] == 0x20) goto LAB_0091ebb0; } haystack = haystack + (uVar5 & 0xff); match = stristr(haystack,GHIDRA_CAST((profanityNode + 2))); securityCookie = extraout_ECX_02; } profanityNode = GHIDRA_CAST(*profanityNode); } while (profanityNode != DAT_00c7986c); } } OnlineChat::add_message(securityCookie,(uint32_t)local_30,(*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x4))),*param_2,param_2[1]); FUN_00a58200(); puVar3 = puStack_20; } LAB_0091ec0a: puStack_20 = puVar3; local_14 = 2; if (((param_3 != GHIDRA_CAST(0x0)) && (cVar4 = (**(code **)(*param_3 + 0xc))(securityCookie), cVar4 != '\0')) && (g_multiplayerRelease != (void *)0x0)) { (*g_multiplayerRelease)(¶m_2); } ExceptionList = local_1c; return; } // 009428d0 void Camera::constructor(Room *room) { void *pvVar1; Vector position; Vector position_00; Vector *resultPos; int iVar2; int writeSlot; float fVar3; Vector scratchPos; Camera *local_3c; Vector local_38; Vector local_30; Vector softClampOut; uint8_t *puStack_20; void *local_1c; uint8_t *puStack_18; uint32_t local_14; Room *currentRoom; uint32_t enterDoor; Game *game; puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); local_14 = 0xffffffff; puStack_18 = &LAB_00b0b454; local_1c = ExceptionList; ExceptionList = &local_1c; local_3c = this; CircularBuffer::constructor(0x3c); local_14 = 0; CircularBuffer::constructor(0x5a); (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; CircularBuffer::constructor(300); (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 2; CircularBuffer::constructor(0xf); (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 3; CircularBuffer::constructor(4); (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 4; CircularBuffer::constructor(0x78); local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),5); (this->_playersCenter).y = 0.0; (this->_playersCenter).x = 0.0; (this->_position).y = 0.0; (this->_position).x = 0.0; (this->_screenAnchor).y = 0.0; (this->_screenAnchor).x = 0.0; (this->_unk7c).y = 0.0; (this->_unk7c).x = 0.0; (this->_unk84).y = 0.0; (this->_unk84).x = 0.0; this->_room = room; fVar3 = g_vectorOne.y * 0.5; (this->_screenAnchor).x = g_vectorOne.x * 0.5; (this->_screenAnchor).y = fVar3; position.y = g_vectorZero.y; position.x = g_vectorZero.x; resultPos = ClampedToRoom(this,&scratchPos,position); (this->_position).x = resultPos->x; (this->_position).y = resultPos->y; (this->_unk7c).x = g_vectorZero.x; (this->_unk7c).y = g_vectorZero.y; (this->_unk84).x = g_vectorZero.x; (this->_unk84).y = g_vectorZero.y; fVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); while (GHIDRA_INT(fVar3) < 0x3c) { softClampOut.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); if (fVar3 == softClampOut.y) { if (GHIDRA_INT(fVar3) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); softClampOut.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); fVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); } iVar2 = (*GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); fVar3 = (float)(GHIDRA_INT(fVar3) + -1); *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) = iVar2; *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = fVar3; } else { iVar2 = *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)); } writeSlot = (GHIDRA_INT(fVar3) + iVar2) % GHIDRA_INT(softClampOut.y); iVar2 = *GHIDRA_CAST(this->_aimOffsetBuffer); *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) + 1; fVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); } if (*GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) < 0x5a) { local_30.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); do { softClampOut.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); if (local_30.y == softClampOut.y) { if (GHIDRA_INT(local_30.y) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); softClampOut.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); local_30.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); } iVar2 = (*GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); local_30.y = (float)(GHIDRA_INT(local_30.y) + -1); *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) = iVar2; *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = local_30.y; } else { iVar2 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)); } writeSlot = (GHIDRA_INT(local_30.y) + iVar2) % GHIDRA_INT(softClampOut.y); iVar2 = *GHIDRA_CAST(this->_velocityOffsetBuffer); *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) + 1; local_30.y = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); } while (*GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) < 0x5a); } if (*GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) < 300) { local_30.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); do { softClampOut.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); if (local_30.y == softClampOut.y) { if (GHIDRA_INT(local_30.y) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); softClampOut.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); local_30.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); } iVar2 = (*GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); local_30.y = (float)(GHIDRA_INT(local_30.y) + -1); *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) = iVar2; *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = local_30.y; } else { iVar2 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)); } writeSlot = (GHIDRA_INT(local_30.y) + iVar2) % GHIDRA_INT(softClampOut.y); iVar2 = *GHIDRA_CAST(this->_enemyOffsetBuffer); *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) + 1; local_30.y = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); } while (*GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) < 300); } if (*GHIDRA_CAST((this->_playerSpreadBuffer + 8)) < 0xf) { local_30.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); do { softClampOut.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); if (local_30.y == softClampOut.y) { if (GHIDRA_INT(local_30.y) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); softClampOut.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); local_30.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); } iVar2 = (*GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); local_30.y = (float)(GHIDRA_INT(local_30.y) + -1); *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) = iVar2; *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = local_30.y; } else { iVar2 = *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)); } writeSlot = (GHIDRA_INT(local_30.y) + iVar2) % GHIDRA_INT(softClampOut.y); iVar2 = *GHIDRA_CAST(this->_playerSpreadBuffer); *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) + 1; local_30.y = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); } while (*GHIDRA_CAST((this->_playerSpreadBuffer + 8)) < 0xf); } if (*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) < 4) { fVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); do { softClampOut.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); if (fVar3 == softClampOut.y) { if (GHIDRA_INT(fVar3) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); softClampOut.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); fVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); } iVar2 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); fVar3 = (float)(GHIDRA_INT(fVar3) + -1); *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = iVar2; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = fVar3; } else { iVar2 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); } writeSlot = (iVar2 + GHIDRA_INT(fVar3)) % GHIDRA_INT(softClampOut.y); iVar2 = *GHIDRA_CAST(this->_shakeOffsetBuffer); *GHIDRA_CAST((iVar2 + writeSlot * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; fVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); } while (GHIDRA_INT(fVar3) < 4); } if (*GHIDRA_CAST((this->_focusPositionBuffer + 8)) < 0x78) { fVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); do { local_30.y = -g_vectorOne.x; softClampOut.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); local_38.y = -g_vectorOne.y; if (fVar3 == softClampOut.y) { if (GHIDRA_INT(fVar3) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); softClampOut.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); fVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); } iVar2 = (*GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + 1) % GHIDRA_INT(softClampOut.y); fVar3 = (float)(GHIDRA_INT(fVar3) + -1); *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) = iVar2; *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = fVar3; } else { iVar2 = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); } writeSlot = (GHIDRA_INT(fVar3) + iVar2) % GHIDRA_INT(softClampOut.y); iVar2 = *GHIDRA_CAST(this->_focusPositionBuffer); *GHIDRA_CAST((iVar2 + writeSlot * 8)) = local_30.y; *GHIDRA_CAST((iVar2 + 4 + writeSlot * 8)) = local_38.y; *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = *GHIDRA_CAST((this->_focusPositionBuffer + 8)) + 1; fVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); } while (GHIDRA_INT(fVar3) < 0x78); } game = g_game; this->_shouldOverride = 0; this->_followLerp = 0.1; enterDoor = game->_enterDoor; if (enterDoor != 0xffffffff) { currentRoom = this->_room; if (enterDoor < 8) { local_38.x = (float)(currentRoom->_doorGridPositions[enterDoor] % currentRoom->_gridWidth) * 40.0 + 40.0; local_38.y = (float)(currentRoom->_doorGridPositions[enterDoor] / currentRoom->_gridWidth) * 40.0 + 120.0; } else { local_38.x = g_vectorZero.x; local_38.y = g_vectorZero.y; } Room::GetClampedPositionImpl(currentRoom,&local_30,&local_38,20.0,20.0,20.0,20.0); local_38.x = local_30.x; local_38.y = local_30.y; position_00.y = local_30.y; position_00.x = local_30.x; resultPos = ClampedToRoom(this,&local_38,position_00); (this->_position).x = resultPos->x; (this->_position).y = resultPos->y; } resultPos = (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetEnterPosition(&local_30); if ((resultPos->x != g_vectorZero.x) || (resultPos->y != g_vectorZero.y)) { resultPos = (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetEnterPosition(&scratchPos); resultPos = ClampedToRoom(this,&local_38,*resultPos); resultPos = soft_clamp_position(this,&softClampOut,resultPos->x,resultPos->y); (this->_position).x = resultPos->x; (this->_position).y = resultPos->y; } pvVar1 = this->_room; *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1204)) = (this->_position).x; *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1208)) = (this->_position).y; ExceptionList = local_1c; return; } // 00942f20 Vector * Camera::get_enemy_focus_offset(Vector *outOffset) { Vector *pVVar1; char cVar2; uint32_t uVar3; uint32_t entityCount; int entityData; float fVar4; float zeroY; Vector *totalWeight; Vector playersCenter; float local_30; uint32_t i; float local_28; float dy; float dx; int local_1c; uint32_t local_18; void *local_10; uint8_t *puStack_c; uint32_t local_8; Entity *enemy; pVVar1 = outOffset; zeroY = g_vectorZero.y; fVar4 = g_vectorZero.x; puStack_c = &LAB_00b0b48d; local_10 = ExceptionList; uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; ExceptionList = &local_10; totalWeight = GHIDRA_CAST(0x0); entityData = *GHIDRA_CAST((GHIDRA_CAST(this->_room) + 0x125c)); entityCount = *GHIDRA_CAST((GHIDRA_CAST(this->_room) + 0x1264)); outOffset->x = g_vectorZero.x; outOffset->y = zeroY; outOffset = GHIDRA_CAST(0x0); local_8 = 0; i = 0; if (entityCount != 0) { local_1c = entityData; local_18 = entityCount; do { enemy = *GHIDRA_CAST((entityData + i * 4)); if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (enemy->_type != 1)) { if (enemy->_type - 10U < 0x3de) goto LAB_00942fe8; } else { LAB_00942fe8: cVar2 = enemy->CanShutDoors(uVar3); if ((cVar2 != '\0') && (enemy->_visible != 0)) { dx = (enemy->_pos).x; dy = (enemy->_pos).y; players_center_position(&g_game->_playerManager,&playersCenter,1); dx = dx - playersCenter.x; dy = dy - playersCenter.y; fVar4 = sqrtf(dx * dx + dy * dy); if (fVar4 < 550.0) { local_30 = (fVar4 - 550.0) / -550.0; cVar2 = enemy->IsBoss(); if (cVar2 == '\0') { local_28 = 1.0; } else { local_28 = 0.6; } if (((enemy->_type == 0x112) || (enemy->_type == 0x197)) && (enemy->_variant == 0)) { (GHIDRA_CAST((enemy)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); } outOffset = GHIDRA_CAST((local_28 + (float)outOffset)); pVVar1->x = dx * local_30 * 0.4 + pVVar1->x; pVVar1->y = dy * local_30 * 0.4 + pVVar1->y; } } entityCount = local_18; entityData = local_1c; totalWeight = outOffset; } i = i + 1; } while (i < entityCount); fVar4 = g_vectorZero.x; zeroY = g_vectorZero.y; } if ((float)totalWeight == 0.0) { pVVar1->y = zeroY; } else { fVar4 = (1.0 / (float)totalWeight) * pVVar1->x; pVVar1->y = (1.0 / (float)totalWeight) * pVVar1->y; } pVVar1->x = fVar4; ExceptionList = local_10; return pVVar1; } // 009432f0 void Camera::get_clamp_bounds(Vector *outMax, Vector *outMin) { void *pvVar1; float fVar2; float maxX; float fVar3; float minX; float marginY; float screenOffsetX; float marginX; float screenOffsetY; int *roomConfig; pvVar1 = this->_room; marginX = g_vectorOne.x * 80.0; marginY = g_vectorOne.y * 80.0; fVar3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x11fc)); fVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1200)); roomConfig = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 4)) + 0x10)); screenOffsetX = fVar3; screenOffsetY = fVar2; if (((roomConfig != GHIDRA_CAST(0x0)) && (roomConfig[2] == 0x10)) && (*roomConfig == 0x23)) { marginX = g_vectorZero.x; marginY = g_vectorZero.y; screenOffsetX = g_vectorZero.x; screenOffsetY = g_vectorZero.y; } minX = -fVar3 - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x14)) - -20.0) - marginX) * 0.65 - screenOffsetX); fVar3 = -fVar2 - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x18)) - 60.0) - marginY) * 0.65 - screenOffsetY); maxX = (g_screenWidth - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x11fc))) - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1c)) - -20.0) + marginX) * 0.65 + screenOffsetX); fVar2 = (g_screenHeight - *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1200))) - (((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x20)) - 60.0) + marginY) * 0.65 + screenOffsetY); if (minX < maxX) { maxX = (minX + maxX) * 0.5; minX = maxX; } if (fVar3 < fVar2) { fVar2 = (fVar3 + fVar2) * 0.5; fVar3 = fVar2; } outMax->x = maxX; outMax->y = fVar2; outMin->x = minX; outMin->y = fVar3; return; } // 00943490 Vector * Camera::ClampedToRoom(Vector *outPosition, Vector position) { Vector *pVVar1; int extraout_EDX; float clampedY; float clampedX; Vector maxBounds; Vector minBounds; Vector target; int *roomConfig; minBounds.y = 0.0; minBounds.x = 0.0; maxBounds.y = 0.0; maxBounds.x = 0.0; get_clamp_bounds(this,&minBounds,&maxBounds); target.x = g_screenWidth * *GHIDRA_CAST((extraout_EDX + 0x74)) - ((g_screenWidth - 338.0) * 0.5 + (position.x - 60.0) * 0.65); target.y = g_screenHeight * *GHIDRA_CAST((extraout_EDX + 0x78)) - ((g_screenHeight - 182.0) * 0.5 + (position.y - 140.0) * 0.65); if ((*GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((extraout_EDX + 0x68)) + 4)) + 0x44)) >> 0xf & 1) != 0) { outPosition->x = target.x; outPosition->y = target.y; return outPosition; } pVVar1 = ⌖ if (maxBounds.x <= target.x) { pVVar1 = &maxBounds; } clampedX = pVVar1->x; if (clampedX <= minBounds.x) { clampedX = minBounds.x; } pVVar1 = ⌖ if (maxBounds.y <= target.y) { pVVar1 = &maxBounds; } clampedY = pVVar1->y; if (clampedY <= minBounds.y) { clampedY = minBounds.y; } roomConfig = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x10)); if ((((roomConfig != GHIDRA_CAST(0x0)) && (roomConfig[2] == 0x10)) && (*roomConfig == 0x23)) && ((*GHIDRA_CAST((extraout_EDX + 0x8c)) != '\0' && (0 < *GHIDRA_CAST((extraout_EDX + 0x58)))))) { clampedX = target.x; } outPosition->x = clampedX; outPosition->y = clampedY; return outPosition; } // 00943610 Vector * Camera::soft_clamp_position(Vector *outPosition, float x, float y) { float fVar1; Vector maxX; Vector minX; minX.y = 0.0; minX.x = 0.0; maxX.y = 0.0; maxX.x = 0.0; get_clamp_bounds(this,&minX,&maxX); if (x <= minX.x) { fVar1 = minX.x; } else { fVar1 = maxX.x; if (x < maxX.x) { if (minX.x == maxX.x) { KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); } fVar1 = (x - minX.x) / (maxX.x - minX.x); fVar1 = (maxX.x - minX.x) * (((fVar1 * 6.0 * fVar1 * fVar1 - fVar1 * 15.0 * fVar1) + fVar1 * 14.0) - 6.0) * -(fVar1 * fVar1) + minX.x; } } if (y <= minX.y) { maxX.y = minX.y; } else if (y < maxX.y) { if (minX.y == maxX.y) { KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); } outPosition->x = fVar1; fVar1 = (y - minX.y) / (maxX.y - minX.y); outPosition->y = (maxX.y - minX.y) * (((fVar1 * 4.0 * fVar1 * fVar1 - fVar1 * 10.0 * fVar1) + fVar1 * 10.0) - 5.0) * -(fVar1 * fVar1) + minX.y; return outPosition; } outPosition->x = fVar1; outPosition->y = maxX.y; return outPosition; } // 009437e0 void Camera::DoUpdate(uint8_t unk) { int cameraStyle; cameraStyle = (g_manager->_optionsConfig)._cameraStyle; if ((cameraStyle == 1) || (cameraStyle != 2)) { update_focus_position(this,unk); this->_shouldOverride = 0; } else { update_follow(this); if (unk != 0) { this->_shouldOverride = 0; return; } } return; } // 009439d0 void Camera::update_focus_position(uint8_t isSkipFocusBuffer) { float *pfVar1; Vector position; uint64_t qVar2; uint8_t isLudovico; Entity_Player *local_EAX_76; int iVar3; int *playerSlot; Vector *pVVar4; void *pvVar5; uint32_t *puVar6; int iVar7; int bufferHead; uint64_t *allocCounter; uint32_t uVar8; Game *game; PlayerManager *playerManager; float fVar9; float fVar10; uint8_t auVar11 [12]; uint32_t *focusCopy; int focusCopyCapacity; float focusCopyCount; int focusCopyHead; Vector playersCenter; uint8_t local_54 [8]; Vector local_4c; Vector local_44; Vector enemyOffsetX; Camera *local_34; Vector spreadOffsetX; float local_28; float local_24; uint8_t *puStack_20; void *local_1c; uint8_t *puStack_18; uint32_t local_14; int enemyBufferData; uint8_t *shakeBuffer; puStack_20 = local_54 + 0x50; local_14 = 0xffffffff; puStack_18 = &LAB_00b0b4e6; local_1c = ExceptionList; ExceptionList = &local_1c; local_34 = this; local_EAX_76 = PlayerManager::get_first_local_main_player(&g_game->_playerManager); if (local_EAX_76 == GHIDRA_CAST(0x0)) { KAGE_LogMessage(8,GHIDRA_CAST("No main player detected when trying to update camera \n")); ExceptionList = local_1c; return; } players_center_position(&g_game->_playerManager,&playersCenter,1); if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 1) { spreadOffsetX.y = 35.0; } else { spreadOffsetX.y = 0.0; } local_24 = spreadOffsetX.y * (local_EAX_76->_aimDirection).x; local_28 = spreadOffsetX.y * (local_EAX_76->_aimDirection).y; local_4c.y = (float)(GHIDRA_CAST((local_EAX_76)))->Entity_Player::GetFocusEntity(); if (GHIDRA_CAST(local_4c.y) != GHIDRA_CAST(0x0)) { local_44.y = (((GHIDRA_CAST(local_4c.y))->_pos).y - (local_EAX_76->_pos).y) * 0.2; enemyOffsetX.y = (((GHIDRA_CAST(local_4c.y))->_pos).x - (local_EAX_76->_pos).x) * 0.2; fVar9 = sqrtf(local_44.y * local_44.y + enemyOffsetX.y * enemyOffsetX.y); if ((spreadOffsetX.y < fVar9) && (fVar9 = sqrtf(local_24 * local_24 + local_28 * local_28), 0.0 < fVar9)) { local_28 = (spreadOffsetX.y / fVar9) * local_28; local_24 = (spreadOffsetX.y / fVar9) * local_24; } if (((*GHIDRA_CAST((GHIDRA_CAST((local_EAX_76)) + 0x13f4))) == '\0') || (isLudovico = (GHIDRA_CAST((local_EAX_76)))->Entity_Player::HasCollectible(0x149,0), isLudovico != 0)) { local_24 = enemyOffsetX.y; local_28 = local_44.y; } else { iVar3 = __RTDynamicCast(local_4c.y,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Knife::RTTI_Type_Descriptor,0); if ((iVar3 != 0) && (*GHIDRA_CAST((iVar3 + 0x464)) != '\0')) { local_24 = enemyOffsetX.y + spreadOffsetX.y * (local_EAX_76->_lastDirection).x; local_28 = local_44.y + spreadOffsetX.y * (local_EAX_76->_lastDirection).y; } } } if ((local_EAX_76->_itemState == 0x31) || (((((*GHIDRA_CAST((GHIDRA_CAST((local_EAX_76)) + 0x13f2))) != '\0' && (isLudovico = (GHIDRA_CAST((local_EAX_76)))->Entity_Player::HasCollectible(0x149,0), isLudovico == 0)) && (local_EAX_76->_isPlayingExtraAnimation == 0)) && (local_EAX_76->_isPlayingItemAnimation == 0)))) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_54),7,-1,-1,0,0); local_14 = 0; if (GHIDRA_CAST(local_4c.y) != GHIDRA_CAST(0x0)) { uVar8 = 0; do { iVar3 = __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_54)) + 0x4))) + uVar8 * 4)),0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Laser::RTTI_Type_Descriptor,0); if ((((iVar3 != 0) && ((*GHIDRA_CAST((iVar3 + 0x2c)) == 1 || (*GHIDRA_CAST((iVar3 + 0x2c)) == 3)))) && (*GHIDRA_CAST((iVar3 + 0x34)) == 1)) && (*GHIDRA_CAST((iVar3 + 0x38)) == 0)) { local_24 = spreadOffsetX.y * (local_EAX_76->_lastDirection).x; local_28 = spreadOffsetX.y * (local_EAX_76->_lastDirection).y; } uVar8 = uVar8 + 1; } while (uVar8 < GHIDRA_UINT(local_4c.y)); this = local_34; } local_14 = 0xffffffff; if (local_54[0] == '\0') { local_14 = 1; tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_54)) + 0x4))),0); local_14 = 0xffffffff; } } spreadOffsetX.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); fVar9 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); if (fVar9 == spreadOffsetX.y) { if (GHIDRA_INT(fVar9) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); spreadOffsetX.y = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); fVar9 = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); } iVar3 = (*GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(spreadOffsetX.y); fVar9 = (float)(GHIDRA_INT(fVar9) + -1); *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) = iVar3; *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = fVar9; } else { iVar3 = *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)); } iVar7 = (iVar3 + GHIDRA_INT(fVar9)) % GHIDRA_INT(spreadOffsetX.y); iVar3 = *GHIDRA_CAST(this->_aimOffsetBuffer); *GHIDRA_CAST((iVar3 + iVar7 * 8)) = local_24; *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_28; game = g_game; *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) + 1; if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((game->_playerManager)._playerList._begin) >> 2 == 1) { fVar9 = 4.5; } else { fVar9 = 0.0; } iVar3 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); iVar7 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); local_4c.y = (local_EAX_76->_velocity).x * fVar9; local_44.y = (local_EAX_76->_velocity).y * fVar9; if (iVar3 == iVar7) { if (iVar3 < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar7 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); iVar3 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); } bufferHead = (*GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) + 1) % iVar7; iVar3 = iVar3 + -1; *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) = bufferHead; *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = iVar3; } else { bufferHead = *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)); } iVar7 = (bufferHead + iVar3) % iVar7; iVar3 = *GHIDRA_CAST(this->_velocityOffsetBuffer); *GHIDRA_CAST((iVar3 + iVar7 * 8)) = local_4c.y; *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_44.y; *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) + 1; local_44.y = (float)get_enemy_focus_offset(this,&enemyOffsetX); iVar3 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); iVar7 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); if (iVar3 == iVar7) { if (iVar3 < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar7 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); iVar3 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); } bufferHead = (*GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) + 1) % iVar7; iVar3 = iVar3 + -1; *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) = bufferHead; *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = iVar3; } else { bufferHead = *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)); } enemyBufferData = *GHIDRA_CAST(this->_enemyOffsetBuffer); iVar7 = (bufferHead + iVar3) % iVar7; *GHIDRA_CAST((enemyBufferData + iVar7 * 8)) = *GHIDRA_CAST(local_44.y); *GHIDRA_CAST((enemyBufferData + 4 + iVar7 * 8)) = *GHIDRA_CAST((GHIDRA_CAST(local_44.y) + 4)); *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) + 1; spreadOffsetX.y = g_vectorZero.x; local_28 = g_vectorZero.y; players_center_position(&g_game->_playerManager,&local_4c,1); playerManager = &g_game->_playerManager; local_24 = 0.0; local_44.y = 0.0; if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { game = g_game; do { pvVar5 = (playerManager->_playerList)._end; if (GHIDRA_INT(pvVar5) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); pvVar5 = (playerManager->_playerList)._end; game = g_game; } playerSlot = (playerManager->_playerList)._begin; if (GHIDRA_UINT(local_44.y) < GHIDRA_UINT((GHIDRA_INT(pvVar5) - GHIDRA_INT(playerSlot) >> 2))) { playerSlot = playerSlot + GHIDRA_INT(local_44.y); } iVar3 = *playerSlot; if (*GHIDRA_CAST((iVar3 + 0x2c)) == 1) { local_24 = (float)(GHIDRA_INT(local_24) + 1); local_28 = (*GHIDRA_CAST((iVar3 + 0x340)) - local_4c.y) * 0.25 + local_28; spreadOffsetX.y = spreadOffsetX.y + (*GHIDRA_CAST((iVar3 + 0x33c)) - local_4c.x) * 0.25; } playerManager = &game->_playerManager; local_44.y = (float)(GHIDRA_INT(local_44.y) + 1); } while (GHIDRA_UINT(local_44.y) < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); this = local_34; if (0 < GHIDRA_INT(local_24)) { local_28 = (1.0 / (float)GHIDRA_INT(local_24)) * local_28; spreadOffsetX.y = (1.0 / (float)GHIDRA_INT(local_24)) * spreadOffsetX.y; } } local_24 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); iVar3 = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); if ((float)iVar3 == local_24) { if (iVar3 < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); local_24 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); iVar3 = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); } iVar7 = (*GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) + 1) % GHIDRA_INT(local_24); iVar3 = iVar3 + -1; *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) = iVar7; *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = iVar3; } else { iVar7 = *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)); } iVar7 = (iVar7 + iVar3) % GHIDRA_INT(local_24); iVar3 = *GHIDRA_CAST(this->_playerSpreadBuffer); *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_28; *GHIDRA_CAST((iVar3 + iVar7 * 8)) = spreadOffsetX.y; *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) + 1; if (isSkipFocusBuffer == 0) { if (this->_shouldOverride == 0) { local_4c.y = -g_vectorOne.x; spreadOffsetX.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); local_44.y = -g_vectorOne.y; fVar9 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); if (fVar9 == spreadOffsetX.y) { if (GHIDRA_INT(fVar9) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); spreadOffsetX.y = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); fVar9 = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); } iVar3 = (*GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + 1) % GHIDRA_INT(spreadOffsetX.y); fVar9 = (float)(GHIDRA_INT(fVar9) + -1); *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) = iVar3; *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = fVar9; } else { iVar3 = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); } iVar7 = (iVar3 + GHIDRA_INT(fVar9)) % GHIDRA_INT(spreadOffsetX.y); iVar3 = *GHIDRA_CAST(this->_focusPositionBuffer); *GHIDRA_CAST((iVar3 + iVar7 * 8)) = local_4c.y; *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = local_44.y; *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = *GHIDRA_CAST((this->_focusPositionBuffer + 8)) + 1; this->_shouldOverride = 1; } } else if (this->_shouldOverride == 0) { ring_buffer_push(this->_focusPositionBuffer, (Vector *) (*GHIDRA_CAST(this->_focusPositionBuffer) + ((*GHIDRA_CAST((this->_focusPositionBuffer + 8)) + *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + -1) % *GHIDRA_CAST((this->_focusPositionBuffer + 4))) * 8)); } vector_ring_buffer_weighted_average(&local_4c,this,0.75); vector_ring_buffer_weighted_average(&local_44,this->_velocityOffsetBuffer,0.85); vector_ring_buffer_weighted_average(&enemyOffsetX,this->_enemyOffsetBuffer,0.75); vector_ring_buffer_weighted_average(&spreadOffsetX,this->_playerSpreadBuffer,0.5); fVar10 = playersCenter.y + local_4c.y; fVar9 = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); local_4c.y = spreadOffsetX.x + enemyOffsetX.x + local_44.x + playersCenter.x + local_4c.x; enemyOffsetX.y = spreadOffsetX.y + enemyOffsetX.y + local_44.y + fVar10; local_44.y = fVar9; spreadOffsetX.y = (float)operator_new_tracked (-GHIDRA_UINT((GHIDRA_INT(((uint64_t)GHIDRA_UINT(fVar9) * 8 >> 0x20)) != 0)) | GHIDRA_UINT(((uint64_t)GHIDRA_UINT(fVar9) * 8))); puVar6 = GHIDRA_CAST(spreadOffsetX.y); if (GHIDRA_CAST(spreadOffsetX.y) == GHIDRA_CAST(0x0)) { spreadOffsetX.y = 0.0; } else { for (; fVar9 != 0.0; fVar9 = (float)(GHIDRA_INT(fVar9) - 1)) { puVar6[1] = 0; *puVar6 = 0; puVar6 = puVar6 + 2; } } focusCopyCapacity = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); focusCopyCount = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); focusCopyHead = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); focusCopy = GHIDRA_CAST(spreadOffsetX.y); local_44.y = focusCopyCount; local_28 = (float)focusCopyHead; local_24 = (float)focusCopyCapacity; memcpy((void *)spreadOffsetX.y,*(void **)this->_focusPositionBuffer,focusCopyCapacity * 8); iVar3 = 0; local_14 = 3; if (0 < GHIDRA_INT(local_44.y)) { do { pfVar1 = GHIDRA_CAST((GHIDRA_INT(spreadOffsetX.y) + ((GHIDRA_INT(local_28) + iVar3) % GHIDRA_INT(local_24)) * 2 * 4)); if ((*pfVar1 == -g_vectorOne.x) && (pfVar1[1] == -g_vectorOne.y)) { *pfVar1 = local_4c.y; pfVar1[1] = enemyOffsetX.y; } iVar3 = iVar3 + 1; } while (iVar3 < GHIDRA_INT(local_44.y)); this = local_34; } vector_ring_buffer_weighted_average(&local_4c,&focusCopy,0.5); if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (GHIDRA_CAST(spreadOffsetX.y) != GHIDRA_CAST(0x0)) { uVar8 = *GHIDRA_CAST((GHIDRA_CAST(spreadOffsetX.y) + -4)); qVar2 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar8)); free(GHIDRA_CAST((GHIDRA_INT(spreadOffsetX.y) + -4))); } local_14 = 0xffffffff; fVar9 = g_screenHeight - 182.0; fVar10 = g_screenHeight * (this->_screenAnchor).y; (this->_position).x = g_screenWidth * (this->_screenAnchor).x - ((g_screenWidth - 338.0) * 0.5 + (local_4c.x - 60.0) * 0.65); (this->_position).y = fVar10 - (fVar9 * 0.5 + (local_4c.y - 140.0) * 0.65); pVVar4 = soft_clamp_position(this,&local_4c,(this->_position).x,(this->_position).y); shakeBuffer = this->_shakeOffsetBuffer; (this->_position).x = pVVar4->x; (this->_position).y = pVVar4->y; if (g_game->_screenShakeTimer < 1) { spreadOffsetX.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); puVar6 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); if (puVar6 == GHIDRA_CAST(spreadOffsetX.y)) { if (GHIDRA_INT(puVar6) < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); spreadOffsetX.y = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); puVar6 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); } iVar3 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % GHIDRA_INT(spreadOffsetX.y); puVar6 = GHIDRA_CAST((GHIDRA_INT(puVar6) + -1)); *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = iVar3; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = puVar6; } else { iVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); } iVar7 = (iVar3 + GHIDRA_INT(puVar6)) % GHIDRA_INT(spreadOffsetX.y); iVar3 = *GHIDRA_CAST(shakeBuffer); *GHIDRA_CAST((iVar3 + iVar7 * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar3 + 4 + iVar7 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; } else { if (g_game->_frameCount % 3 == 0) { uVar8 = Random(); fVar9 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_4c.y = fVar9 + fVar9; local_44.x = cos(local_4c.y); local_44.x = local_44.x * 10.0; fVar9 = sin(local_4c.y); local_44.y = fVar9 * 10.0; pVVar4 = &local_44; } else { iVar3 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + -1) % *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); enemyOffsetX.y = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar3 * 8)); local_34 = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar3 * 8 + 4)); uVar8 = Random(); fVar9 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_4c.y = fVar9 + fVar9; local_44.y = cos(local_4c.y); fVar9 = sin(local_4c.y); pVVar4 = &local_4c; local_4c.y = (fVar9 + fVar9) - (float)local_34; local_4c.x = (local_44.y + local_44.y) - enemyOffsetX.y; } ring_buffer_push(shakeBuffer,pVVar4); pfVar1 = GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + ((*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + -1 + *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc))) % *GHIDRA_CAST((this->_shakeOffsetBuffer + 4))) * 8)); fVar9 = ((float)g_game->_screenShakeTimer - 0.0) / 11.0; if (fVar9 <= 0.0) { fVar9 = 0.0; } if (1.0 <= fVar9) { fVar9 = 1.0; } pfVar1[1] = fVar9 * pfVar1[1]; *pfVar1 = fVar9 * *pfVar1; } vector_ring_buffer_weighted_average(&local_4c,shakeBuffer,0.9); game = g_game; iVar3 = 0x744; (g_game->_screenShakeOffset).x = local_4c.x; (game->_screenShakeOffset).y = local_4c.y; fVar9 = 0.0; do { local_4c.y = (float)(GHIDRA_INT(fVar9) + 1); if (GHIDRA_UINT(local_4c.y) < 9) { pvVar5 = this->_room; if (*GHIDRA_CAST((iVar3 + -0x20 + GHIDRA_INT(pvVar5))) != 0) { if (GHIDRA_UINT(fVar9) < 8) { local_44.y = (float)(*GHIDRA_CAST((iVar3 + GHIDRA_INT(pvVar5))) / *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xc))) * 40.0 + 120.0; local_44.x = (float)(*GHIDRA_CAST((iVar3 + GHIDRA_INT(pvVar5))) % *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0xc))) * 40.0 + 40.0; } else { local_44.y = g_vectorZero.y; local_44.x = g_vectorZero.x; } fVar9 = sqrtf((local_44.y - playersCenter.y) * (local_44.y - playersCenter.y) + (local_44.x - playersCenter.x) * (local_44.x - playersCenter.x)); if (fVar9 < 30.0) { auVar11 = ZEXT812(0x3f800000); fVar9 = (fVar9 - 30.0) / -20.0; if (fVar9 <= (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0)))) { (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))) = fVar9; } local_4c.y = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar11)) + 0x0))); position.y = local_44.y; position.x = local_44.x; ClampedToRoom(this,&local_44,position); fVar9 = (3.0 - (local_4c.y + local_4c.y)) * local_4c.y * local_4c.y; (this->_position).x = (local_44.x - (this->_position).x) * fVar9 + (this->_position).x; (this->_position).y = (local_44.y - (this->_position).y) * fVar9 + (this->_position).y; goto LAB_00944696; } } } fVar9 = local_4c.y; iVar3 = iVar3 + 4; if (7 < GHIDRA_INT(fVar9)) { LAB_00944696: pvVar5 = this->_room; *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1204)) = (this->_position).x; *GHIDRA_CAST((GHIDRA_CAST(pvVar5) + 0x1208)) = (this->_position).y; (this->_playersCenter).x = playersCenter.x; (this->_playersCenter).y = playersCenter.y; ExceptionList = local_1c; return; } } while( true ); } // 009446e0 void Camera::update_follow() { Vector position; uint32_t rngResult; Vector *pVVar1; int iVar2; int iVar3; int iVar4; bool bVar5; bool bVar6; float fVar7; float fVar8; Vector local_24; Vector local_1c; Vector local_14; float shakeCos; float shakeAngle; Game *game; float *newestShake; void *room; uint8_t *shakeBuffer; players_center_position(&g_game->_playerManager,&local_24,1); if ((this->_shouldOverride != 0) && (0 < *GHIDRA_CAST((this->_focusPositionBuffer + 8)))) { iVar2 = (*GHIDRA_CAST((this->_focusPositionBuffer + 8)) + -1 + *GHIDRA_CAST((this->_focusPositionBuffer + 0xc))) % *GHIDRA_CAST((this->_focusPositionBuffer + 4)); local_24.x = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + iVar2 * 8)); local_24.y = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + iVar2 * 8 + 4)); } shakeBuffer = this->_shakeOffsetBuffer; if (g_game->_screenShakeTimer < 1) { iVar2 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); iVar4 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); if (iVar2 == iVar4) { if (iVar2 < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar4 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); iVar2 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); } iVar3 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % iVar4; iVar2 = iVar2 + -1; *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = iVar3; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = iVar2; } else { iVar3 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); } iVar4 = (iVar2 + iVar3) % iVar4; iVar2 = *GHIDRA_CAST(shakeBuffer); *GHIDRA_CAST((iVar2 + iVar4 * 8)) = g_vectorZero.x; *GHIDRA_CAST((iVar2 + 4 + iVar4 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; } else { if (g_game->_frameCount % 3 == 0) { rngResult = Random(); shakeAngle = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; shakeAngle = shakeAngle + shakeAngle; local_1c.x = cos(shakeAngle); local_1c.x = local_1c.x * 10.0; local_1c.y = sin(shakeAngle); local_1c.y = local_1c.y * 10.0; pVVar1 = &local_1c; } else { iVar2 = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + -1) % *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); local_14.y = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar2 * 8)); local_1c.y = *GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + iVar2 * 8 + 4)); rngResult = Random(); shakeAngle = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; shakeAngle = shakeAngle + shakeAngle; shakeCos = cos(shakeAngle); fVar7 = sin(shakeAngle); pVVar1 = &local_14; local_14.x = (shakeCos + shakeCos) - local_14.y; local_14.y = (fVar7 + fVar7) - local_1c.y; } ring_buffer_push(shakeBuffer,pVVar1); newestShake = GHIDRA_CAST((*GHIDRA_CAST(shakeBuffer) + ((*GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + -1 + *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc))) % *GHIDRA_CAST((this->_shakeOffsetBuffer + 4))) * 8)); fVar7 = ((float)g_game->_screenShakeTimer - 0.0) / 11.0; if (fVar7 <= 0.0) { fVar7 = 0.0; } if (1.0 <= fVar7) { fVar7 = 1.0; } newestShake[1] = fVar7 * newestShake[1]; *newestShake = fVar7 * *newestShake; } vector_ring_buffer_weighted_average(&local_1c,shakeBuffer,0.9); game = g_game; (g_game->_screenShakeOffset).x = local_1c.x; (game->_screenShakeOffset).y = local_1c.y; position.y = local_24.y; position.x = local_24.x; ClampedToRoom(this,&local_24,position); fVar7 = (this->_position).x; local_24.y = local_24.y - (this->_position).y; local_24.x = local_24.x - fVar7; fVar8 = local_24.y * local_24.y + local_24.x * local_24.x; if (fVar8 <= 676.0) { if (338.0 <= fVar8) goto LAB_009449f3; local_1c.y = this->_followLerp - 0.01; local_14.y = 0.1; bVar6 = local_1c.y == 0.1; bVar5 = local_1c.y < 0.1; } else { local_1c.y = this->_followLerp + 0.01; local_14.y = 0.5; bVar6 = local_1c.y == 0.5; bVar5 = 0.5 < local_1c.y; } pVVar1 = &local_1c; if (bVar5 || bVar6) { pVVar1 = &local_14; } this->_followLerp = pVVar1->y; LAB_009449f3: fVar8 = this->_followLerp; room = this->_room; fVar7 = fVar8 * local_24.x + fVar7; (this->_position).x = fVar7; (this->_position).y = fVar8 * local_24.y + (this->_position).y; *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1204)) = fVar7; *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1208)) = (this->_position).y; return; } // 00944a40 uint8_t Camera::IsPosVisible(Vector *Pos) { int *playerSlot; void *pvVar1; int lastFocusIdx; PlayerManager *playerManager; uint32_t playerIdx; float fVar2; float clampedX; float fVar3; float fVar4; float focusY; float maxCameraX; float maxCameraY; float posY; if (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1))) { fVar3 = -(this->_position).x * 1.5384616 - ((g_screenWidth - 338.0) * 0.5 + (g_vectorZero.x - 60.0) * 0.65) / 0.65; fVar2 = -(this->_position).y * 1.5384616 - ((g_screenHeight - 182.0) * 0.5 + (g_vectorZero.y - 140.0) * 0.65) / 0.65; if ((((fVar3 < Pos->x) && (Pos->x < g_screenWidth * 1.5384616 + fVar3)) && (fVar2 < Pos->y)) && (Pos->y < g_screenHeight * 1.5384616 + fVar2)) { return 1; } } else { playerIdx = 0; playerManager = &g_game->_playerManager; pvVar1 = g_game->_room; fVar2 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x14)) - 80.0) + 369.23077; fVar3 = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x18)) - 80.0) + 207.6923; maxCameraX = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1c)) + 80.0) - 369.23077; maxCameraY = (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x20)) + 80.0) - 207.6923; if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { do { pvVar1 = (playerManager->_playerList)._end; if (GHIDRA_INT(pvVar1) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("PlayerManager::GetPlayer() : There are no players! \n")); pvVar1 = (playerManager->_playerList)._end; } playerSlot = (playerManager->_playerList)._begin; if (playerIdx < GHIDRA_UINT((GHIDRA_INT(pvVar1) - GHIDRA_INT(playerSlot) >> 2))) { playerSlot = playerSlot + playerIdx; } fVar4 = *GHIDRA_CAST((*playerSlot + 0x33c)); focusY = *GHIDRA_CAST((*playerSlot + 0x340)); if ((this->_shouldOverride != 0) && (0 < *GHIDRA_CAST((this->_focusPositionBuffer + 8)))) { lastFocusIdx = (*GHIDRA_CAST((this->_focusPositionBuffer + 8)) + -1 + *GHIDRA_CAST((this->_focusPositionBuffer + 0xc))) % *GHIDRA_CAST((this->_focusPositionBuffer + 4)); fVar4 = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + lastFocusIdx * 8)); focusY = *GHIDRA_CAST((*GHIDRA_CAST(this->_focusPositionBuffer) + lastFocusIdx * 8 + 4)); } if (fVar4 <= fVar2) { fVar4 = fVar2; } if (focusY <= fVar3) { focusY = fVar3; } if (maxCameraX <= fVar4) { fVar4 = maxCameraX; } posY = Pos->y; if (maxCameraY <= focusY) { focusY = maxCameraY; } clampedX = Pos->x; if (Pos->x <= fVar4 - 369.23077) { clampedX = fVar4 - 369.23077; } if (fVar4 + 369.23077 <= clampedX) { clampedX = fVar4 + 369.23077; } fVar4 = posY; if (posY <= focusY - 207.6923) { fVar4 = focusY - 207.6923; } if (focusY + 207.6923 <= fVar4) { fVar4 = focusY + 207.6923; } if ((clampedX == Pos->x) && (fVar4 == posY)) { return 1; } playerIdx = playerIdx + 1; playerManager = &g_game->_playerManager; } while (playerIdx < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); } } return 0; } // 00944d10 void Camera::SetFocusPosition(Vector *pos) { if (this->_shouldOverride == 0) { ring_buffer_push(this->_focusPositionBuffer,pos); this->_shouldOverride = 1; } return; } // 00944d40 void Camera::SnapToPosition(Vector *pos) { int ringStart; int iVar1; int ringStart; Vector local_20; float local_18; int entriesLeft; void *room; entriesLeft = 0x3c; ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); do { iVar1 = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); if (ringStart == iVar1) { if (ringStart < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar1 = *GHIDRA_CAST((this->_aimOffsetBuffer + 4)); ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); } ringStart = (*GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) + 1) % iVar1; ringStart = ringStart + -1; *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)) = ringStart; *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = ringStart; } else { ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 0xc)); } iVar1 = (ringStart + ringStart) % iVar1; ringStart = *GHIDRA_CAST(this->_aimOffsetBuffer); *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)) + 1; entriesLeft = entriesLeft + -1; ringStart = *GHIDRA_CAST((this->_aimOffsetBuffer + 8)); } while (entriesLeft != 0); ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); entriesLeft = 0x5a; do { iVar1 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); if (ringStart == iVar1) { if (ringStart < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar1 = *GHIDRA_CAST((this->_velocityOffsetBuffer + 4)); ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); } ringStart = (*GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) + 1) % iVar1; ringStart = ringStart + -1; *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)) = ringStart; *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = ringStart; } else { ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 0xc)); } iVar1 = (ringStart + ringStart) % iVar1; ringStart = *GHIDRA_CAST(this->_velocityOffsetBuffer); *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)) + 1; entriesLeft = entriesLeft + -1; ringStart = *GHIDRA_CAST((this->_velocityOffsetBuffer + 8)); } while (entriesLeft != 0); ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); entriesLeft = 300; do { iVar1 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); if (ringStart == iVar1) { if (ringStart < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar1 = *GHIDRA_CAST((this->_enemyOffsetBuffer + 4)); ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); } ringStart = (*GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) + 1) % iVar1; ringStart = ringStart + -1; *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)) = ringStart; *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = ringStart; } else { ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 0xc)); } iVar1 = (ringStart + ringStart) % iVar1; ringStart = *GHIDRA_CAST(this->_enemyOffsetBuffer); *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)) + 1; entriesLeft = entriesLeft + -1; ringStart = *GHIDRA_CAST((this->_enemyOffsetBuffer + 8)); } while (entriesLeft != 0); ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); entriesLeft = 0xf; do { iVar1 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); if (ringStart == iVar1) { if (ringStart < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar1 = *GHIDRA_CAST((this->_playerSpreadBuffer + 4)); ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); } ringStart = (*GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) + 1) % iVar1; ringStart = ringStart + -1; *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)) = ringStart; *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = ringStart; } else { ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 0xc)); } iVar1 = (ringStart + ringStart) % iVar1; ringStart = *GHIDRA_CAST(this->_playerSpreadBuffer); *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)) + 1; entriesLeft = entriesLeft + -1; ringStart = *GHIDRA_CAST((this->_playerSpreadBuffer + 8)); } while (entriesLeft != 0); ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); entriesLeft = 4; do { iVar1 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); if (ringStart == iVar1) { if (ringStart < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar1 = *GHIDRA_CAST((this->_shakeOffsetBuffer + 4)); ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); } ringStart = (*GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) + 1) % iVar1; ringStart = ringStart + -1; *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)) = ringStart; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = ringStart; } else { ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 0xc)); } iVar1 = (ringStart + ringStart) % iVar1; ringStart = *GHIDRA_CAST(this->_shakeOffsetBuffer); *GHIDRA_CAST((ringStart + iVar1 * 8)) = g_vectorZero.x; *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = g_vectorZero.y; *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)) + 1; entriesLeft = entriesLeft + -1; ringStart = *GHIDRA_CAST((this->_shakeOffsetBuffer + 8)); } while (entriesLeft != 0); ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); entriesLeft = 0x78; do { local_18 = -g_vectorOne.x; iVar1 = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); local_20.y = -g_vectorOne.y; if (ringStart == iVar1) { if (ringStart < 1) { KAGE_LogMessage(0x10,GHIDRA_CAST("Cannot erase from empty buffer")); iVar1 = *GHIDRA_CAST((this->_focusPositionBuffer + 4)); ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); } ringStart = (*GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) + 1) % iVar1; ringStart = ringStart + -1; *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)) = ringStart; *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = ringStart; } else { ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 0xc)); } iVar1 = (ringStart + ringStart) % iVar1; ringStart = *GHIDRA_CAST(this->_focusPositionBuffer); *GHIDRA_CAST((ringStart + iVar1 * 8)) = local_18; *GHIDRA_CAST((ringStart + 4 + iVar1 * 8)) = local_20.y; *GHIDRA_CAST((this->_focusPositionBuffer + 8)) = *GHIDRA_CAST((this->_focusPositionBuffer + 8)) + 1; entriesLeft = entriesLeft + -1; ringStart = *GHIDRA_CAST((this->_focusPositionBuffer + 8)); } while (entriesLeft != 0); this->_shouldOverride = 0; ClampedToRoom(this,&local_20,*pos); room = this->_room; (this->_position).x = local_20.x; (this->_position).y = local_20.y; *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1204)) = (this->_position).x; *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1208)) = (this->_position).y; return; }