Curation round 7: Game::Start, level generation, Room, Camera, the Entity hierarchy, Entity_Player, the run frame
Six agents took over Game::Start, Level::SetNextStage, BossPool, save_game_state, level generation to the first room (place_special_rooms, RoomDescriptor, load_room), Room, Camera, Entity/EntityList/EntityRef with a curated skeleton of every Entity_* subclass, Entity_Player, Game::Render, Manager::Update's run branch, RoomTransition, ItemInfoHUD and StatHUD. Integration wrote FirstTrinketOwner and room_shape_get_door_grid_index (checked against the decompile for every shape and slot) and folded the duplicated constants. A run now generates its floor, loads the start room and draws the HUD (under gdb); Isaac renders correctly when drawn, the room itself waits for Room::Render. 2479 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
addd027977
commit
b85591bdf4
146 files changed
+20124
-200863
No files matched your search
+48
-145
@@ -1,4 +1,5 @@
|
||||
#include "hud.h"
|
||||
#include "entity_player.h"
|
||||
#include "game.h"
|
||||
#include "level.h"
|
||||
#include "log.h"
|
||||
@@ -6,14 +7,13 @@
|
||||
#include "minimap.h"
|
||||
#include "platform.h"
|
||||
#include "render_passes.h"
|
||||
#include "room.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
constexpr const char* MPLUS_FONT = "font/MPlus_12b.fnt";
|
||||
constexpr const char* KOREAN_FONT = "font/KR_Font14.fnt";
|
||||
constexpr const char* ITEM_INFO_FONT = "font/TeamMeatEx/TeamMeatEx12.fnt";
|
||||
constexpr const char* STREAK_ANM2 = "gfx/ui/ui_streak.anm2";
|
||||
constexpr const char* HEARTS_ANM2 = "gfx/ui/ui_hearts.anm2";
|
||||
constexpr const char* PICKUPS_ANM2 = "gfx/ui/hudpickups.anm2";
|
||||
@@ -27,8 +27,6 @@ constexpr const char* COOP_MENU_ANM2 = "gfx/ui/coop menu.anm2";
|
||||
constexpr const char* INVENTORY_ANM2 = "gfx/ui/ui_inventory.anm2";
|
||||
constexpr const char* CRAFTING_ANM2 = "gfx/ui/ui_crafting.anm2";
|
||||
constexpr const char* POOPS_ANM2 = "gfx/ui/ui_poops.anm2";
|
||||
constexpr const char* CHARGE_ICONS_ANM2 = "gfx/ui/ui_charge_icons.anm2";
|
||||
constexpr const char* MINIMAP_ICONS_ANM2 = "gfx/ui/minimap_icons.anm2";
|
||||
constexpr const char* BOSS_BAR_PNG = "gfx/ui/ui_bosshealthbar.png";
|
||||
constexpr const char* BOSS_BAR_MINI_PNG = "gfx/ui/ui_bosshealthbar_mini.png";
|
||||
constexpr const char* BOSS_BAR_STATIC_PNG = "gfx/ui/ui_bosshealthbar_static.png";
|
||||
@@ -48,7 +46,6 @@ constexpr const char* ANIMATION_TEXT = "Text";
|
||||
constexpr const char* ANIMATION_TEXT_IN = "TextIn";
|
||||
constexpr const char* ANIMATION_TEXT_STAY = "TextStay";
|
||||
constexpr const char* ANIMATION_TEXT_OUT = "TextOut";
|
||||
constexpr const char* ANIMATION_CHARGE_ICON = "ChargeIcon";
|
||||
constexpr const char* ANIMATION_DESTINATION = "Destination";
|
||||
constexpr const char* EVENT_SLIDE_IN = "SlideIn";
|
||||
constexpr const char* EVENT_SLIDE_OUT = "SlideOut";
|
||||
@@ -72,26 +69,9 @@ constexpr int CHARGE_BAR_FLASH_FRAMES = 8;
|
||||
constexpr int SOUND_FORTUNE_PAPER = 252;
|
||||
constexpr float FORTUNE_SOUND_VOLUME = 0.5f;
|
||||
constexpr float FORTUNE_SLIDE_IN_PITCH = 1.5f;
|
||||
constexpr float ITEM_INFO_LINE_SPACING = 0.9f;
|
||||
constexpr float ITEM_INFO_ICON_SCALE = 4;
|
||||
constexpr float STATS_ALPHA = 0.5f;
|
||||
|
||||
constexpr int PLAYER_ISAAC_B = 21;
|
||||
constexpr int PLAYER_CAIN_B = 23;
|
||||
constexpr int PLAYER_BLUEBABY_B = 25;
|
||||
constexpr int PLAYER_LAZARUS_B = 29;
|
||||
constexpr int PLAYER_LAZARUS2_B = 38;
|
||||
constexpr int PLAYER_JACOB2_B = 40;
|
||||
constexpr int PLAYER_BETHANY = 18;
|
||||
constexpr int PLAYER_JACOB = 19;
|
||||
constexpr int PLAYER_ESAU = 20;
|
||||
constexpr int PLAYER_BETHANY_B = 36;
|
||||
constexpr int COLLECTIBLE_DEEP_POCKETS = 416;
|
||||
constexpr int COLOR_INDEX_NONE = 5;
|
||||
constexpr int ROOM_BOSS = 5;
|
||||
constexpr int ROOM_CHALLENGE = 11;
|
||||
constexpr int ROOM_DUNGEON = 16;
|
||||
constexpr int ROOM_BOSSRUSH = 17;
|
||||
constexpr int STB_HOME = 35;
|
||||
constexpr int BOSS_MEGA_SATAN = 55;
|
||||
constexpr int BOSS_GREAT_GIDEON = 83;
|
||||
@@ -156,26 +136,17 @@ static Vector at_make(float x, float y)
|
||||
return vector_make(x, y);
|
||||
}
|
||||
|
||||
// The entity an EntityPtr member of a generated entity points to, read as PlayerManager reads it.
|
||||
static Entity_Player* entity_ptr_get(const uint8_t* slot)
|
||||
{
|
||||
EntityPtr pointer;
|
||||
|
||||
std::memcpy(&pointer, slot, sizeof(pointer));
|
||||
return pointer;
|
||||
}
|
||||
|
||||
// Whether a player leads its pair of twins (Jacob over Esau), as one with no twin does.
|
||||
static bool is_main_twin(Entity_Player& player)
|
||||
{
|
||||
Entity_Player* twin = entity_ptr_get(player._twinPlayer);
|
||||
return !twin || twin->_playerIndex == -1 || player._playerIndex <= twin->_playerIndex;
|
||||
Entity_Player* twin = player.twin_get();
|
||||
return !twin || twin->playerIndex == -1 || player.playerIndex <= twin->playerIndex;
|
||||
}
|
||||
|
||||
// Whether a player is Jacob or Esau.
|
||||
static bool is_jacob_or_esau(Entity_Player* player)
|
||||
{
|
||||
return player && (player->_playerType == PLAYER_JACOB || player->_playerType == PLAYER_ESAU);
|
||||
return player && (player->playerType == PLAYER_JACOB || player->playerType == PLAYER_ESAU);
|
||||
}
|
||||
|
||||
// The online HUD style (009a84c0): the options' while online and out of a versus match, else compact or offline.
|
||||
@@ -487,55 +458,6 @@ std::shared_ptr<PlayerHUD> PlayerHUD::make_ref(HUD* owner, Entity_Player* shown)
|
||||
return corner;
|
||||
}
|
||||
|
||||
// 0084d6b0 Sets a stat, showing its change when animated.
|
||||
void StatTracker::set(float, bool)
|
||||
{
|
||||
reconstruction_missing("StatTracker::set 0084d6b0");
|
||||
}
|
||||
|
||||
// 0084bfd0 Forgets both players' stats. The room chances (the last four) only show changes of a tenth.
|
||||
void StatHUD::reset()
|
||||
{
|
||||
for (StatHUDPlayer& slot : players)
|
||||
{
|
||||
slot.player = nullptr;
|
||||
for (int i = 0; i < STAT_TRACKER_COUNT; i++)
|
||||
{
|
||||
StatTracker& stat = slot.stats[i];
|
||||
stat.value = 0;
|
||||
stat.change = 0;
|
||||
stat.previous = 0;
|
||||
stat.changeTimer = 0;
|
||||
if (i >= STAT_TRACKER_FINE_COUNT) stat.threshold = STAT_THRESHOLD_COARSE;
|
||||
}
|
||||
}
|
||||
isDualityOwned = false;
|
||||
}
|
||||
|
||||
// 0084c170 Recomputes the shown stats when the found HUD is on and counts their changes down.
|
||||
void StatHUD::Update()
|
||||
{
|
||||
reconstruction_missing("StatHUD::Update 0084c170");
|
||||
}
|
||||
|
||||
// 0084c2c0 Draws the stats at a position.
|
||||
void StatHUD::Render(Vector)
|
||||
{
|
||||
reconstruction_missing("StatHUD::Render 0084c2c0");
|
||||
}
|
||||
|
||||
// 0084ca00 Recomputes the stats a set of flags names.
|
||||
void StatHUD::RecomputeStats(int, uint32_t, bool)
|
||||
{
|
||||
reconstruction_missing("StatHUD::RecomputeStats 0084ca00");
|
||||
}
|
||||
|
||||
// 0084cc40 Moves a player's stats to the player replacing it.
|
||||
void StatHUD::update_player(Entity_Player*, Entity_Player*)
|
||||
{
|
||||
reconstruction_missing("StatHUD::update_player 0084cc40");
|
||||
}
|
||||
|
||||
// 0083abb0 Forgets both players' recent items.
|
||||
void HistoryHUD::clear()
|
||||
{
|
||||
@@ -561,24 +483,6 @@ void HistoryHUD::RecomputeAll(bool)
|
||||
reconstruction_missing("HistoryHUD::RecomputeAll 0083b850");
|
||||
}
|
||||
|
||||
// 0083c5f0 Loads the panel's font (without redirection), charge icon and map icons.
|
||||
void ItemInfoHUD::load_graphics()
|
||||
{
|
||||
text.load_font(ITEM_INFO_FONT);
|
||||
text.lineSpacing = ITEM_INFO_LINE_SPACING;
|
||||
iconSprite.Reset();
|
||||
chargeIconSprite.Load(CHARGE_ICONS_ANM2, GRAPHICS_LOAD);
|
||||
chargeIconSprite.Play(ANIMATION_CHARGE_ICON);
|
||||
iconScale = ITEM_INFO_ICON_SCALE;
|
||||
mapIconsSprite.Load(MINIMAP_ICONS_ANM2, GRAPHICS_LOAD);
|
||||
}
|
||||
|
||||
// 0083c8d0 Describes the pickup the player stands next to.
|
||||
void ItemInfoHUD::Update()
|
||||
{
|
||||
reconstruction_missing("ItemInfoHUD::Update 0083c8d0");
|
||||
}
|
||||
|
||||
// 009a1970 Loads the graphics again, empties the HUD and loads the item info panel.
|
||||
void HUD::graphics_reload()
|
||||
{
|
||||
@@ -888,7 +792,7 @@ void HUD::Render()
|
||||
Game& game = *g_game;
|
||||
if (game.seedEffects.HasSeedEffect(SEED_NO_HUD)) return;
|
||||
|
||||
const RoomConfig_Room* roomData = game.room->_descriptor->Data;
|
||||
const RoomConfig_Room* roomData = game.room->descriptor->data;
|
||||
bool isHomeDungeon = roomData && roomData->type == ROOM_DUNGEON && roomData->stageId == STB_HOME;
|
||||
Vector shake = game.screenShakeOffset;
|
||||
update_hud_offset();
|
||||
@@ -910,7 +814,7 @@ void HUD::Render()
|
||||
if (!game.deathmatchManager.is_active())
|
||||
{
|
||||
game.minimap.Render();
|
||||
if (game.ambush._isActive && game.room->_roomType == ROOM_BOSSRUSH)
|
||||
if (game.ambush._isActive && game.room->roomType == ROOM_BOSSRUSH)
|
||||
{
|
||||
constexpr float WAVE_BOX_WIDTH = 64;
|
||||
constexpr float WAVE_BOX_HEIGHT = 32;
|
||||
@@ -975,7 +879,7 @@ void HUD::render_counters(Vector& cursor, Vector shake)
|
||||
Entity_Player* player = players.playerList.empty() ? nullptr : players.playerList[0];
|
||||
if (!player) return;
|
||||
|
||||
if (player->_playerType == PLAYER_JACOB) cursor.y += JACOB_SHIFT;
|
||||
if (player->playerType == PLAYER_JACOB) cursor.y += JACOB_SHIFT;
|
||||
Entity_Player* bethany = players.FirstPlayerByType(PLAYER_BETHANY);
|
||||
Entity_Player* bethanyB = players.FirstPlayerByType(PLAYER_BETHANY_B);
|
||||
bool isAllBlueBabyB = players.are_all_players_tainted_blue_baby();
|
||||
@@ -999,30 +903,30 @@ void HUD::render_counters(Vector& cursor, Vector shake)
|
||||
|
||||
pickupHUDSprite.SetFrame(ANIMATION_IDLE, FRAME_COIN);
|
||||
bool isDeepPockets = players.FirstCollectibleOwner(COLLECTIBLE_DEEP_POCKETS, LAZARUS_SHARE_CHECK);
|
||||
row(isDeepPockets ? "%03d" : "%02d", player->_numCoins);
|
||||
row(isDeepPockets ? "%03d" : "%02d", player->numCoins);
|
||||
if (!isAllBlueBabyB)
|
||||
{
|
||||
pickupHUDSprite.SetFrame((float)(player->_numGigaBombs ? FRAME_GIGA_BOMB
|
||||
: player->_hasGoldenBomb ? FRAME_GOLDEN_BOMB
|
||||
pickupHUDSprite.SetFrame((float)(player->numGigaBombs ? FRAME_GIGA_BOMB
|
||||
: player->hasGoldenBomb ? FRAME_GOLDEN_BOMB
|
||||
: FRAME_BOMB));
|
||||
row("%02d", player->_numBombs);
|
||||
row("%02d", player->numBombs);
|
||||
}
|
||||
if (blueBabyB)
|
||||
{
|
||||
pickupHUDSprite.SetFrame((float)FRAME_POOP);
|
||||
row(players.FirstBirthrightOwner(PLAYER_BLUEBABY_B) ? "%02d" : "%d", player->_poopMana);
|
||||
row(players.FirstBirthrightOwner(PLAYER_BLUEBABY_B) ? "%02d" : "%d", player->poopMana);
|
||||
}
|
||||
pickupHUDSprite.SetFrame((float)(player->_hasGoldenKey ? FRAME_GOLDEN_KEY : FRAME_KEY));
|
||||
row("%02d", player->_numKeys);
|
||||
pickupHUDSprite.SetFrame((float)(player->hasGoldenKey ? FRAME_GOLDEN_KEY : FRAME_KEY));
|
||||
row("%02d", player->numKeys);
|
||||
if (bethanyB)
|
||||
{
|
||||
pickupHUDSprite.SetFrame((float)FRAME_BLOOD_CHARGE);
|
||||
row("%02d", player->_effectiveBloodCharge);
|
||||
row("%02d", player->effectiveBloodCharge);
|
||||
}
|
||||
if (bethany)
|
||||
{
|
||||
pickupHUDSprite.SetFrame((float)FRAME_SOUL_CHARGE);
|
||||
row("%02d", player->_effectiveSoulCharge);
|
||||
row("%02d", player->effectiveSoulCharge);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,8 +956,8 @@ void HUD::render_run_icons(Vector& cursor, Vector shake, float& statsX)
|
||||
{
|
||||
// Rebirth's Level is the front of Game, and Game declares none of its methods yet.
|
||||
RoomDescriptor* room = game.GetRoomByIdx(game.currentRoomIdx, -1);
|
||||
isGreedBossCleared = room->ListIndex == game.lastBossRoomListIdx &&
|
||||
(game.room->_descriptor->Flags & ROOM_FLAG_CLEAR) && game.stage == STAGE_ULTRA_GREED;
|
||||
isGreedBossCleared = room->listIndex == game.lastBossRoomListIdx &&
|
||||
(game.room->descriptor->flags & ROOM_FLAG_CLEAR) && game.stage == STAGE_ULTRA_GREED;
|
||||
}
|
||||
|
||||
std::vector<int> icons;
|
||||
@@ -1095,7 +999,7 @@ void HUD::render_run_icons(Vector& cursor, Vector shake, float& statsX)
|
||||
{
|
||||
// Online the original reads the donations of the lobby host's profile. Netplay is offline.
|
||||
PersistentGameData& data = g_manager->persistentGameData;
|
||||
float jamChance = game.GetPlayer(0)->GetGreedDonationJamChance(&data);
|
||||
float jamChance = game.GetPlayer(0)->GetGreedDonationJamChance(data);
|
||||
std::snprintf(text, sizeof(text), "%d%%", (int)(jamChance + ROUNDING));
|
||||
}
|
||||
else isShown = false;
|
||||
@@ -1249,7 +1153,7 @@ void HUD::render_streak_texts()
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
int colorIndex = COLOR_INDEX_NONE;
|
||||
for (int j = 0; j < COOP_SLOT_COUNT; j++)
|
||||
if (players.colorControllers[j] == player->_controllerIndex)
|
||||
if (players.colorControllers[j] == player->controllerIndex)
|
||||
{
|
||||
colorIndex = j;
|
||||
break;
|
||||
@@ -1302,14 +1206,14 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout)
|
||||
if (isOnline && !g_game->deathmatchManager.is_active() && g_manager->optionsConfig.onlineHud == ONLINE_HUD_HIDDEN &&
|
||||
!isMainCorner)
|
||||
return;
|
||||
if (player->_variant != 0) return;
|
||||
if (player->variant != 0) return;
|
||||
|
||||
float activeAlpha = 1;
|
||||
float pocketAlpha = 1;
|
||||
if (is_jacob_or_esau(player))
|
||||
{
|
||||
float fade = hud.dropHoldFade * TWIN_FADE;
|
||||
Entity_Player* twin = entity_ptr_get(player->_twinPlayer);
|
||||
Entity_Player* twin = player->twin_get();
|
||||
if (g_manager->optionsConfig.jacobEsauControls == 0)
|
||||
{
|
||||
if (twin)
|
||||
@@ -1324,7 +1228,7 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout)
|
||||
pocketAlpha = activeAlpha;
|
||||
}
|
||||
}
|
||||
if (player->_hasCurseMistEffect) activeAlpha = MIST_ALPHA;
|
||||
if (player->hasCurseMistEffect) activeAlpha = MIST_ALPHA;
|
||||
bool isNetCompact = isOnline && online_hud_mode() == ONLINE_HUD_COMPACT && !isMainCorner;
|
||||
|
||||
if (layout == HUD_LAYOUT_NORMAL)
|
||||
@@ -1334,9 +1238,9 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout)
|
||||
Vector corner = cornerOffsets[2];
|
||||
hud.RenderTrinket(1, at_make(corner.x + 20, g_screenHeight - 52 - 16 + corner.y), 1, false);
|
||||
hud.RenderTrinket(0, at_make(corner.x + 44, g_screenHeight - 28 - 16 + corner.y), 1, false);
|
||||
if (player->_playerType == PLAYER_ISAAC_B)
|
||||
if (player->playerType == PLAYER_ISAAC_B)
|
||||
hud.render_inventory(at_make(cornerOffsets[0].x + 58, cornerOffsets[0].y + 45), 1);
|
||||
else if (player->_playerType == PLAYER_BLUEBABY_B)
|
||||
else if (player->playerType == PLAYER_BLUEBABY_B)
|
||||
hud.RenderSpellQueue(at_make(cornerOffsets[0].x + 58, cornerOffsets[0].y + 49), 1);
|
||||
Vector pockets = at_make(g_screenWidth - 28 + cornerOffsets[3].x, g_screenHeight - 18 + cornerOffsets[3].y);
|
||||
hud.RenderPocketItems(pockets, layout, pocketAlpha, 1);
|
||||
@@ -1356,9 +1260,8 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout)
|
||||
cursor.x -= TRINKET_STEP;
|
||||
}
|
||||
cursor.x += 0;
|
||||
int pocketId = player->_pocketSlots[0];
|
||||
int pocketKind = player->_pocketSlots[1];
|
||||
if ((pocketKind == 0 || pocketKind == 1) && pocketId == 0) return;
|
||||
PocketItem& pocket = player->pocketItems[0];
|
||||
if (pocket.type != POCKET_ACTIVE && pocket.id == 0) return;
|
||||
}
|
||||
else if (layout == HUD_LAYOUT_JACOB_ESAU_COMPACT)
|
||||
{
|
||||
@@ -1394,9 +1297,9 @@ void HUD::render_player_hud(int playerHudIndex, PlayerHudLayout layout)
|
||||
cursor.x += TRINKET_STEP;
|
||||
isAnyTrinket = true;
|
||||
}
|
||||
if (player->_playerType == PLAYER_ISAAC_B)
|
||||
if (player->playerType == PLAYER_ISAAC_B)
|
||||
hud.render_inventory(at_make(left + cornerOffsets[0].x, hudPos.y + 33 + cornerOffsets[0].y), 1);
|
||||
else if (player->_playerType == PLAYER_BLUEBABY_B)
|
||||
else if (player->playerType == PLAYER_BLUEBABY_B)
|
||||
hud.RenderSpellQueue(at_make(left + cornerOffsets[0].x, hudPos.y + 39 + cornerOffsets[0].y), 1);
|
||||
cursor.x -= POCKET_GAP;
|
||||
if (isAnyTrinket) cursor.x -= POCKET_GAP;
|
||||
@@ -1428,9 +1331,9 @@ void HUD::render_boss_health_bar(Vector barPos)
|
||||
constexpr int STATIC_STEPS = 256;
|
||||
|
||||
Room& room = *g_game->room;
|
||||
const RoomConfig_Room* roomData = room._descriptor->Data;
|
||||
const RoomConfig_Room* roomData = room.descriptor->data;
|
||||
bool isHomeDungeon = roomData && roomData->type == ROOM_DUNGEON && roomData->stageId == STB_HOME;
|
||||
if (bossHPBarFill < 0 || room._bossId == BOSS_MEGA_SATAN || room._bossId == BOSS_MOTHER || isHomeDungeon)
|
||||
if (bossHPBarFill < 0 || room.bossId == BOSS_MEGA_SATAN || room.bossId == BOSS_MOTHER || isHomeDungeon)
|
||||
{
|
||||
isBossBarBottom = false;
|
||||
return;
|
||||
@@ -1438,7 +1341,7 @@ void HUD::render_boss_health_bar(Vector barPos)
|
||||
|
||||
bool isBottom = isBossBarBottom || g_manager->optionsConfig.isBossHpOnBottom;
|
||||
barPos.y = isBottom ? g_screenHeight - BAR_HEIGHT - BAR_MARGIN + bossBarOffset : BAR_MARGIN - bossBarOffset;
|
||||
if (room._bossId == BOSS_GREAT_GIDEON)
|
||||
if (room.bossId == BOSS_GREAT_GIDEON)
|
||||
{
|
||||
barPos.x = (g_screenWidth - STONE_WIDTH) * 0.5f;
|
||||
Vector stoneSize = at_make(STONE_WIDTH, BAR_HEIGHT);
|
||||
@@ -1463,12 +1366,12 @@ void HUD::render_boss_health_bar(Vector barPos)
|
||||
|
||||
ColorMod barColor = COLOR_DEFAULT;
|
||||
KAGE::Graphics::ImagePtr barImage = bossHealthBarImage;
|
||||
int roomType = (int)room._roomType;
|
||||
int roomType = (int)room.roomType;
|
||||
if (roomType != ROOM_BOSS && roomType != ROOM_BOSSRUSH && roomType != ROOM_CHALLENGE &&
|
||||
g_game->GetStageID() != STB_HOME)
|
||||
barImage = bossHealthBarMiniImage;
|
||||
|
||||
bool isDogma = room._backdropType == BACKDROP_DOGMA;
|
||||
bool isDogma = room.backdropType == BACKDROP_DOGMA;
|
||||
KAGE::Graphics::Manager& graphics = KAGE::Graphics::manager;
|
||||
bool isShaderPushed = graphics.shader_push(isDogma ? COLOR_OFFSET_DOGMA_SHADER : COLOR_OFFSET_SHADER);
|
||||
if (isDogma)
|
||||
@@ -1543,7 +1446,7 @@ Vector HUD::get_player_hud_position(int hudIndex, PlayerHudLayout layout)
|
||||
|
||||
PlayerHUD& hud = playerHUD[hudIndex];
|
||||
Entity_Player* player = hud.player;
|
||||
bool isGhost = player && player->_isCoopGhost;
|
||||
bool isGhost = player && player->isCoopGhost;
|
||||
Vector at = playerHudPositions[hudIndex];
|
||||
bool isPlaced = false;
|
||||
if (hud.playerHudIndex >= MAIN_PLAYER_HUD_COUNT && !isGhost)
|
||||
@@ -1568,8 +1471,8 @@ Vector HUD::get_player_hud_position(int hudIndex, PlayerHudLayout layout)
|
||||
if (isVersus) at.x += hudIndex & 1 ? -VERSUS_SPREAD : VERSUS_SPREAD;
|
||||
|
||||
if (!player || hudIndex < 2 || isGhost) return at;
|
||||
if (player->_playerType == PLAYER_ISAAC_B || player->_playerType == PLAYER_BLUEBABY_B) at.y -= INVENTORY_RISE;
|
||||
else if (player->_playerType == PLAYER_CAIN_B) at.y -= CRAFTING_RISE;
|
||||
if (player->playerType == PLAYER_ISAAC_B || player->playerType == PLAYER_BLUEBABY_B) at.y -= INVENTORY_RISE;
|
||||
else if (player->playerType == PLAYER_CAIN_B) at.y -= CRAFTING_RISE;
|
||||
return at;
|
||||
}
|
||||
|
||||
@@ -1582,7 +1485,7 @@ int HUD::GetPlayerHudIndex(Entity_Player* player)
|
||||
return -1;
|
||||
}
|
||||
|
||||
Entity_Player* shown = is_main_twin(*player) ? player : entity_ptr_get(player->_twinPlayer);
|
||||
Entity_Player* shown = is_main_twin(*player) ? player : player->twin_get();
|
||||
for (int i = 0; i < MAIN_PLAYER_HUD_COUNT; i++)
|
||||
if (playerHUD[i].player == shown) return i;
|
||||
|
||||
@@ -1632,7 +1535,7 @@ void HUD::AssignPlayerHUDs()
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
auto is_assigned = [](Entity_Player& player)
|
||||
{ return is_main_twin(player) && !entity_ptr_get(player._parent) && player._exists; };
|
||||
{ return is_main_twin(player) && !player.parent && player.isExists; };
|
||||
if (!players.playerList.empty())
|
||||
{
|
||||
for (CoopJoinSlot& slot : players.coopSlots)
|
||||
@@ -1643,7 +1546,7 @@ void HUD::AssignPlayerHUDs()
|
||||
slot.playerType = 0;
|
||||
}
|
||||
for (Entity_Player* player : players.playerList)
|
||||
if (is_assigned(*player)) players.GetPlayerSlotFromController(player->_controllerIndex);
|
||||
if (is_assigned(*player)) players.GetPlayerSlotFromController(player->controllerIndex);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < players.playerList.size(); i++)
|
||||
@@ -1651,27 +1554,27 @@ void HUD::AssignPlayerHUDs()
|
||||
Entity_Player* player = players.playerList[i];
|
||||
if (!is_assigned(*player)) continue;
|
||||
|
||||
int seat = players.GetPlayerSlotFromController(player->_controllerIndex);
|
||||
int seat = players.GetPlayerSlotFromController(player->controllerIndex);
|
||||
if (seat < 0)
|
||||
{
|
||||
log_printf(LOG_ERROR,
|
||||
"((()))->HUD::AssignPlayerHUDs() could not determine player HUD slot for player entity %d "
|
||||
"(ControlerIndex = %d) \n",
|
||||
(int)i, player->_controllerIndex);
|
||||
(int)i, player->controllerIndex);
|
||||
continue;
|
||||
}
|
||||
|
||||
log_printf(LOG_INFO, "Assinging player entity %d (ControlerIndex = %d) to HUD slot %d \n", (int)i,
|
||||
player->_controllerIndex, seat);
|
||||
player->controllerIndex, seat);
|
||||
corner_assign(playerHUD[seat], player);
|
||||
|
||||
Entity_Player* twin = entity_ptr_get(player->_twinPlayer);
|
||||
if (!twin || !twin->_exists || twin->_playerType == PLAYER_JACOB2_B) continue;
|
||||
bool isLazarusB = twin->_playerType == PLAYER_LAZARUS_B || twin->_playerType == PLAYER_LAZARUS2_B;
|
||||
Entity_Player* twin = player->twin_get();
|
||||
if (!twin || !twin->isExists || twin->playerType == PLAYER_THESOUL_B) continue;
|
||||
bool isLazarusB = twin->playerType == PLAYER_LAZARUS_B || twin->playerType == PLAYER_LAZARUS2_B;
|
||||
if (isLazarusB && !is_main_twin(*twin)) continue;
|
||||
|
||||
log_printf(LOG_INFO, "Assinging player entity %d's twin (ControlerIndex = %d) to HUD slot %d \n", (int)i,
|
||||
twin->_controllerIndex, seat);
|
||||
twin->controllerIndex, seat);
|
||||
corner_assign(playerHUD[seat + MAIN_PLAYER_HUD_COUNT], twin);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user