Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add endless night on title screen #89

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/boot/include/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void GZ_handleTurbo();

void GZ_renderMenuTitle();
void GZ_renderPlayPause();
void GZ_endlessNightOnTitle();

extern "C" {
void game_loop();
Expand Down
10 changes: 8 additions & 2 deletions modules/boot/src/gz_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
#include "libtp_c/include/JSystem/JUtility/JUTGamePad.h"
#include "libtp_c/include/m_Do/m_Re_controller_pad.h"
#include "libtp_c/include/f_op/f_op_scene_req.h"
#include "libtp_c/include/f_op/f_op_actor_iter.h"
#include "rels/include/defines.h"
#include "libtp_c/include/d/d_procname.h"
#include <boot.h>

bool g_framePaused = false;

Expand All @@ -38,7 +41,7 @@ KEEP_FUNC void GZFlg_addFlag(GZFlag* flag) {

KEEP_FUNC GZFlag* GZFlg_removeFlag(GZFlags flag_id) {
auto it = g_gzFlags.begin();
for (;it != g_gzFlags.end(); ++it) {
for (; it != g_gzFlags.end(); ++it) {
if ((*it)->id == flag_id) {
break;
}
Expand Down Expand Up @@ -124,6 +127,10 @@ void GZ_execute(int phase) {
gSaveManager.mPracticeFileOpts.inject_options_after_load();
gSaveManager.mPracticeFileOpts.inject_options_after_load = nullptr;
}
void* titleScreen = fopAcM_SearchByName(PROC_TITLE);
if (titleScreen != NULL) {
GZ_endlessNightOnTitle();
}
}

// normally oxygen doesn't get set until going to the file select screen
Expand All @@ -134,7 +141,6 @@ void GZ_execute(int phase) {
dComIfGs_setMaxOxygen(600);
}
}

#define ACTIVE_FLAG_FUNC(name, stngId) \
KEEP_FUNC bool name() { return GZStng_getData(stngId, false); }

Expand Down
11 changes: 11 additions & 0 deletions modules/boot/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ KEEP_FUNC void GZ_renderMenuTitle() {
Texture l_framePauseTex;
Texture l_framePlayTex;



KEEP_FUNC void GZ_renderPlayPause() {
if (GZStng_getData(STNG_TOOLS_FRAME_ADVANCE, false)) {
if (l_framePauseTex.loadCode == TexCode::TEX_UNLOADED) {
Expand All @@ -222,4 +224,13 @@ KEEP_FUNC void GZ_renderPlayPause() {
free_texture(&l_framePlayTex);
}
}

}

KEEP_FUNC void GZ_endlessNightOnTitle() {
g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusB().mTime = 1.0f;
g_env_light.mDarkDaytime = 1.0f;
g_env_light.field_0x12c3 = 1;
g_env_light.field_0xef4.field_0x4 = 1;
g_env_light.mRainCheck = 250;
}
4 changes: 2 additions & 2 deletions modules/boot/src/utils/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,14 @@ int saveInjectHook(void* i_scene) {
// Hook to disable save inject flags after dScnPly phase_4 is run
int endSaveInjectHook(void* i_scene) {
int rt = dScnPly__phase_4Trampoline(i_scene);

if (SaveManager::s_injectSave || SaveManager::s_injectMemfile) {
SaveManager::s_injectSave = false;
SaveManager::s_injectMemfile = false;
}

return rt;
}

void dCcSDrawHook(dCcS* i_this) {
GZ_drawCc(i_this);
return dCcS__drawTrampoline(i_this);
Expand Down Expand Up @@ -500,6 +499,7 @@ KEEP_FUNC void applyHooks() {
APPLY_HOOK(dScnPly__phase_1, &f_dScnPly__phase_1, saveInjectHook);
APPLY_HOOK(dScnPly__phase_4, &f_dScnPly__phase_4, endSaveInjectHook);


APPLY_HOOK(dCcS__draw, &f_dCcS__Draw, dCcSDrawHook);
APPLY_HOOK(BeforeOfPaint, &f_dScnPly_BeforeOfPaint, beforeOfPaintHook);
APPLY_HOOK(dCcS__MoveAfterCheck, &f_dCcS__MoveAfterCheck, dCcSMoveAfterCheckHook);
Expand Down