[jak2] fix missing drill crane center part (#2692)

We were forcing the drill crane to draw at lod 0, but we should have
listened to the game and drawn it at lod 1.
This commit is contained in:
water111
2023-06-05 18:56:26 -04:00
committed by GitHub
parent e9f9869849
commit 3bb6bd0e3a
18 changed files with 50 additions and 38 deletions
+1
View File
@@ -37,6 +37,7 @@ class FormatterTreeNode;
// "world")
class FormattingRule {
public:
virtual ~FormattingRule() = default;
virtual void append_newline(std::string& curr_text,
const FormatterTreeNode& node,
const FormatterTreeNode& containing_node,
@@ -270,7 +270,9 @@ void parse_text_json(const nlohmann::json& json,
* Each scene should be (scene-name <entry 1> <entry 2> ... )
* This adds the subtitle to each of the specified languages.
*/
void parse_subtitle(const goos::Object& data, GameSubtitleDB& db, const std::string& file_path) {
void parse_subtitle(const goos::Object& data,
GameSubtitleDB& db,
const std::string& /*file_path*/) {
const GameTextFontBank* font = nullptr;
std::map<int, std::shared_ptr<GameSubtitleBank>> banks;
@@ -485,7 +487,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f
} else {
if (lines_file.speakers.find(line.speaker) == lines_file.speakers.end() ||
lines_file.cutscenes.find(cutscene_name) == lines_file.cutscenes.end() ||
lines_file.cutscenes.at(cutscene_name).size() < line_idx) {
int(lines_file.cutscenes.at(cutscene_name).size()) < line_idx) {
lg::warn(
"{} Couldn't find {} in line file, or line list is too small, or speaker could not "
"be resolved {}!",
@@ -504,7 +506,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f
}
}
// Verify we added the amount of lines we expected to
if (lines_added != cutscene_lines.size()) {
if (lines_added != int(cutscene_lines.size())) {
throw std::runtime_error(
fmt::format("Cutscene: '{}' has a mismatch in metadata lines vs text lines. Expected {} "
"only added {} lines",
@@ -540,7 +542,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f
} else {
if (lines_file.speakers.find(line.speaker) == lines_file.speakers.end() ||
lines_file.hints.find(hint_name) == lines_file.hints.end() ||
lines_file.hints.at(hint_name).size() < line_idx) {
int(lines_file.hints.at(hint_name).size()) < line_idx) {
lg::warn(
"{} Couldn't find {} in line file, or line list is too small, or speaker could not "
"be resolved {}!",
@@ -558,7 +560,7 @@ void parse_subtitle_json(GameSubtitleDB& db, const GameSubtitleDefinitionFile& f
}
}
// Verify we added the amount of lines we expected to
if (lines_added != hint_info.lines.size()) {
if (lines_added != int(hint_info.lines.size())) {
throw std::runtime_error(
fmt::format("Hint: '{}' has a mismatch in metadata lines vs text lines. Expected {} "
"only added {} lines",
+3 -4
View File
@@ -183,7 +183,6 @@ static void init_imgui(SDL_Window* window,
}
// set up to get inputs for this window
auto test = SDL_GetCurrentVideoDriver();
ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
// NOTE: imgui's setup calls functions that may fail intentionally, and attempts to disable error
@@ -198,7 +197,7 @@ static void init_imgui(SDL_Window* window,
static std::shared_ptr<GfxDisplay> gl_make_display(int width,
int height,
const char* title,
GfxGlobalSettings& settings,
GfxGlobalSettings& /*settings*/,
GameVersion game_version,
bool is_main) {
// Setup the window
@@ -291,8 +290,8 @@ static std::shared_ptr<GfxDisplay> gl_make_display(int width,
GLDisplay::GLDisplay(SDL_Window* window, SDL_GLContext gl_context, bool is_main)
: m_window(window),
m_gl_context(gl_context),
m_input_manager(std::make_shared<InputManager>()),
m_display_manager(std::make_shared<DisplayManager>(window)) {
m_display_manager(std::make_shared<DisplayManager>(window)),
m_input_manager(std::make_shared<InputManager>()) {
m_main = is_main;
// Register commands
+1 -1
View File
@@ -424,7 +424,7 @@ void pc_memmove(u32 dst, u32 src, u32 size) {
memmove(Ptr<u8>(dst).c(), Ptr<u8>(src).c(), size);
}
void send_gfx_dma_chain(u32 bank, u32 chain) {
void send_gfx_dma_chain(u32 /*bank*/, u32 chain) {
if (Gfx::GetCurrentRenderer()) {
Gfx::GetCurrentRenderer()->send_chain(g_ee_main_mem, chain);
}
+1 -1
View File
@@ -606,7 +606,7 @@ u32 alloc_vagdir_names(u32 heap_sym) {
*alloced_heap = gVagDir.count;
// use entry -1 to get the amount
alloced_heap = alloced_heap + 8;
for (int i = 0; i < gVagDir.count; ++i) {
for (size_t i = 0; i < gVagDir.count; ++i) {
char vagname_temp[9];
memcpy(vagname_temp, gVagDir.vag[i].name, 8);
for (int j = 0; j < 8; ++j) {
+2 -2
View File
@@ -76,13 +76,13 @@ int scePadRead(int port, int /*slot*/, u8* rdata) {
std::tie(cpad->leftx, cpad->lefty) = pad_data.value()->analog_left();
// pressure sensitivity. ignore for now.
for (int i = 0; i < PAD_DATA_PRESSURE_INDEX_ORDER.size(); i++) {
for (size_t i = 0; i < PAD_DATA_PRESSURE_INDEX_ORDER.size(); i++) {
cpad->abutton[i] =
pad_data.value()->button_data.at(PAD_DATA_PRESSURE_INDEX_ORDER.at(i)) * 255;
}
cpad->button0 = 0;
for (int i = 0; i < pad_data.value()->button_data.size(); i++) {
for (size_t i = 0; i < pad_data.value()->button_data.size(); i++) {
cpad->button0 |= pad_data.value()->button_data.at(i) << i;
}
}
+3 -3
View File
@@ -56,10 +56,10 @@ void GameController::process_event(const SDL_Event& event,
const CommandBindingGroups& commands,
std::shared_ptr<PadData> data,
std::optional<InputBindAssignmentMeta>& bind_assignment,
bool ignore_inputs) {
bool /*ignore_inputs*/) {
if (event.type == SDL_CONTROLLERAXISMOTION && event.caxis.which == m_sdl_instance_id) {
// https://wiki.libsdl.org/SDL2/SDL_GameControllerAxis
if (event.caxis.axis <= SDL_CONTROLLER_AXIS_INVALID ||
if ((int)event.caxis.axis <= SDL_CONTROLLER_AXIS_INVALID ||
event.caxis.axis >= SDL_CONTROLLER_AXIS_MAX) {
return;
}
@@ -98,7 +98,7 @@ void GameController::process_event(const SDL_Event& event,
auto& binds = m_settings->controller_binds.at(m_guid);
// https://wiki.libsdl.org/SDL2/SDL_GameControllerButton
if (event.cbutton.button <= SDL_CONTROLLER_BUTTON_INVALID ||
if ((int)event.cbutton.button <= SDL_CONTROLLER_BUTTON_INVALID ||
event.cbutton.button >= SDL_CONTROLLER_BUTTON_MAX) {
return;
}
+1 -1
View File
@@ -19,7 +19,7 @@ void KeyboardDevice::process_event(const SDL_Event& event,
if (key_event.repeat != 0) {
return;
}
if (m_ignore_key_on_keyup && m_ignore_key_on_keyup.value() == key_event.keysym.sym &&
if (m_ignore_key_on_keyup && m_ignore_key_on_keyup.value() == (u32)key_event.keysym.sym &&
event.type == SDL_KEYUP) {
m_ignore_key_on_keyup = std::nullopt;
return;
+2 -2
View File
@@ -94,7 +94,7 @@ int DisplayManager::get_screen_height() {
}
Resolution DisplayManager::get_resolution(int id) {
if (id < m_available_resolutions.size()) {
if (id < (int)m_available_resolutions.size()) {
return m_available_resolutions.at(id);
}
return {0, 0, 0.0};
@@ -199,7 +199,7 @@ void DisplayManager::set_window_display_mode(WindowDisplayMode mode) {
}
void DisplayManager::set_fullscreen_display_id(int display_id) {
if (display_id >= m_current_display_modes.size()) {
if (display_id >= (int)m_current_display_modes.size()) {
display_id = 0;
}
bool update_fullscreen = m_window_display_mode != WindowDisplayMode::Windowed &&
+2 -2
View File
@@ -205,7 +205,7 @@ void InputBindingGroups::assign_analog_bind(u32 sdl_idx,
analog_axii[sdl_idx] = {InputBinding((PadData::AnalogIndex)bind_meta.pad_idx,
bind_meta.for_analog_minimum, modifiers)};
// there already a bind, so swap (as long as it's not the same key)
if (!current_binds.empty() && current_binds.front().sdl_idx != sdl_idx) {
if (!current_binds.empty() && (u32)current_binds.front().sdl_idx != sdl_idx) {
analog_axii[current_binds.front().sdl_idx] = existing_binds;
}
} else {
@@ -254,7 +254,7 @@ void InputBindingGroups::assign_button_bind(u32 sdl_idx,
buttons[sdl_idx] = {InputBinding((PadData::ButtonIndex)bind_meta.pad_idx, modifiers)};
}
// there already a bind, so swap (as long as it's not the same key)
if (!current_binds.empty() && current_binds.front().sdl_idx != sdl_idx) {
if (!current_binds.empty() && current_binds.front().sdl_idx != (s32)sdl_idx) {
if (current_binds.front().analog_button) {
button_axii[current_binds.front().sdl_idx] = existing_binds;
} else {
+4 -6
View File
@@ -1,7 +1,5 @@
#pragma once
#pragma once
#include <algorithm>
#include <array>
#include <functional>
#include <optional>
@@ -129,15 +127,15 @@ struct PadData {
}
void clear() {
for (int i = 0; i < button_data.size(); i++) {
button_data[i] = 0;
for (auto& x : button_data) {
x = 0;
}
clear_analogs();
}
void clear_analogs() {
for (int i = 0; i < analog_data.size(); i++) {
analog_data[i] = ANALOG_NEUTRAL;
for (auto& x : analog_data) {
x = ANALOG_NEUTRAL;
}
analog_sim_tracker = 0;
}
+8 -8
View File
@@ -85,7 +85,7 @@ void InputManager::refresh_device_list() {
}
// If the controller that was last selected to be port 0 is around, prioritize it
if (!m_settings->last_selected_controller_guid.empty()) {
for (int i = 0; i < m_available_controllers.size(); i++) {
for (size_t i = 0; i < m_available_controllers.size(); i++) {
const auto& controller_guid = m_available_controllers.at(i)->get_guid();
if (controller_guid == m_settings->last_selected_controller_guid) {
m_controller_port_mapping[0] = i;
@@ -148,7 +148,7 @@ void InputManager::process_sdl_event(const SDL_Event& event,
// Send event to active controller device
// This goes last so it takes precedence
for (const auto& [port, controller_idx] : m_controller_port_mapping) {
if (m_data.find(port) != m_data.end() && m_available_controllers.size() > controller_idx) {
if (m_data.find(port) != m_data.end() && (int)m_available_controllers.size() > controller_idx) {
m_available_controllers.at(controller_idx)
->process_event(event, m_command_binds, m_data.at(port), m_waiting_for_bind);
}
@@ -211,7 +211,7 @@ void InputManager::register_command(const CommandBinding::Source source,
}
std::string InputManager::get_controller_name(const int controller_id) {
if (controller_id >= m_available_controllers.size()) {
if ((size_t)controller_id >= m_available_controllers.size()) {
return "";
}
return m_available_controllers.at(controller_id)->get_name();
@@ -226,7 +226,7 @@ std::string InputManager::get_current_bind(const int port,
switch (device_type) {
case InputDeviceType::CONTROLLER:
if (m_controller_port_mapping.find(port) != m_controller_port_mapping.end() &&
m_controller_port_mapping.at(port) < m_available_controllers.size() &&
m_controller_port_mapping.at(port) < (int)m_available_controllers.size() &&
m_settings->controller_binds.find(
m_available_controllers.at(m_controller_port_mapping.at(port))->get_guid()) !=
m_settings->controller_binds.end()) {
@@ -256,7 +256,7 @@ std::string InputManager::get_current_bind(const int port,
}
void InputManager::set_controller_for_port(const int controller_id, const int port) {
if (controller_id < m_available_controllers.size()) {
if (controller_id < (int)m_available_controllers.size()) {
// Reset inputs as this device won't be able to be read from again!
clear_inputs();
auto& controller = m_available_controllers.at(controller_id);
@@ -275,7 +275,7 @@ bool InputManager::controller_has_led(const int port) {
return false;
}
const auto id = m_controller_port_mapping.at(port);
if (id >= m_available_controllers.size()) {
if (id >= (int)m_available_controllers.size()) {
return false;
}
return m_available_controllers.at(id)->has_led();
@@ -286,7 +286,7 @@ void InputManager::set_controller_led(const int port, const u8 red, const u8 gre
return;
}
const auto id = m_controller_port_mapping.at(port);
if (id >= m_available_controllers.size()) {
if (id >= (int)m_available_controllers.size()) {
return;
}
m_available_controllers.at(id)->set_led(red, green, blue);
@@ -342,7 +342,7 @@ void InputManager::reset_input_bindings_to_defaults(const int port,
switch (device_type) {
case InputDeviceType::CONTROLLER:
if (m_controller_port_mapping.find(port) != m_controller_port_mapping.end() &&
m_controller_port_mapping.at(port) < m_available_controllers.size() &&
m_controller_port_mapping.at(port) < (int)m_available_controllers.size() &&
m_settings->controller_binds.find(
m_available_controllers.at(m_controller_port_mapping.at(port))->get_guid()) !=
m_settings->controller_binds.end()) {
@@ -1249,6 +1249,7 @@
(.mov v1-37 vf16)
)
(suspend)
(init-vf0-vector)
)
(none)
)
@@ -287,6 +287,7 @@
(eco-blue-glow gp-1)
)
(suspend)
(init-vf0-vector)
)
(none)
)
+6 -3
View File
@@ -844,7 +844,6 @@
;; - does bone calcs for merc
;; - does VU0/CPU stuff for generic/shadow/lightning
(defun dma-add-process-drawable ((pd process-drawable) (dc draw-control) (flag symbol) (dma-buf dma-buffer))
"Draw a normal process-drawable. Set up lighting/shadow settings, then pass on to foreground renderer."
(local-vars
@@ -1143,8 +1142,12 @@
)
;; lod hacks!
(with-pc
(if (not (-> *pc-settings* ps2-lod-dist?))
(set! lod-idx (minmax (-> *pc-settings* lod-force-actor) 0 (-> dc lod-set max-lod))))
(when (not (-> *pc-settings* ps2-lod-dist?))
(set! lod-idx (minmax (-> *pc-settings* lod-force-actor) 0 (-> dc lod-set max-lod)))
(when (> (-> dc force-lod) -1)
(set! lod-idx (-> dc force-lod))
)
)
)
(if (#if (not PC_PORT)
(and (< (-> dc lod-set lod lod-idx dist) dist-w) (< (-> dc force-lod) 0))
@@ -500,6 +500,7 @@
)
)
)
(init-vf0-vector)
(.svf (&-> (-> gp-0 accel-array) 0 quad) vf0)
)
(go target-pilot-stance)
@@ -1881,6 +1881,8 @@ This commonly includes things such as:
(sound-play "tomb-lasr-loop" :id (the-as sound-id (-> self sound-id)) :position s3-1)
)
(suspend)
;; WORKAROUND for GOAL bug - vf0 is clobbered on suspend.
(init-vf0-vector)
)
)
)
@@ -1963,6 +1965,8 @@ This commonly includes things such as:
(s2-0 s1-0 sv-112)
)
(suspend)
;; WORKAROUND for GOAL bug - vf0 is clobbered on suspend.
(init-vf0-vector)
)
)
)
@@ -1421,6 +1421,8 @@
)
)
(suspend)
;; WORKAROUND for GOAL bug - vf0 is clobbered on suspend.
(init-vf0-vector)
)
)
#f