Skip to content

Commit

Permalink
refactor(zc): rename the "ZScript Debugger" to "ZC Console"
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed May 16, 2024
1 parent 7e52830 commit 719738e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 36 deletions.
2 changes: 1 addition & 1 deletion resources/base_config/zc.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ jit_precompile = 0
jit_threads = -2

[CONSOLE]
enabled = 0
print_ZASM = 0
ZScript_Debugger = 0
console_on_top = 0
monochrome_debuggers = 0
clear_console_on_load = 1
Expand Down
4 changes: 2 additions & 2 deletions src/dialog/quest_rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ static GUI::ListData miscRulesList
{ "Special Room Guys Don't Create A Puff When Appearing", qr_NOGUYPOOF,
"If enabled, Special Room Guys and their Fires will not make a spawn poof when entering the screen."},
{ "Log Game Events To Allegro.log And Console", qr_LOG,
"Enables the logging of certain Game Events to both allegro.log and the ZScript Debug Console."
"Enables the logging of certain Game Events to both allegro.log and the ZC Console."
" Note that turning this on can result in slower performance. Logging includes:"
"\n- Whether or not a 'Hit All Triggers' has been fulfilled and, if not, how many are left;"
"\n- The Screen and Map number whenever screens are changed, along with the current Screen States of that screen;"
Expand All @@ -1226,7 +1226,7 @@ static GUI::ListData miscRulesList
"\n- Any time a script creates an object, including the object's name and its UID (not to be confused with ID);"
"\n- and lastly, any time a script tries to reference a nonexistent object."},
{ "Log Script Errors To Allegro.log And Console", qr_SCRIPTERRLOG,
"If enabled, various script errors are logged to Allegro.log and the ZScript Debug Console."
"If enabled, various script errors are logged to Allegro.log and the ZC Console."
" The list of what exactly is logged is too long to list here, but it includes errors like"
" arrays being too small, invalid arguments being passed, ZASM overflow, etc."},
{ "Draining Rupees Can Still Be Spent", qr_SHOPCHEAT,
Expand Down
30 changes: 15 additions & 15 deletions src/zc/ffscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47662,7 +47662,7 @@ void clearConsole()
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK," /____/\\___\\_\\__,_/\\___/____/\\__/\n\n");

zscript_coloured_console.cprintf( CConsoleLoggerEx::COLOR_BLUE | CConsoleLoggerEx::COLOR_INTENSITY |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK,"Quest Data Logging & ZScript Debug Console\n");
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK,"ZC Console\n");

zscript_coloured_console.cprintf( CConsoleLoggerEx::COLOR_BLUE |CConsoleLoggerEx::COLOR_GREEN | CConsoleLoggerEx::COLOR_INTENSITY |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK,"Running: %s\n", getProgramVerStr());
Expand Down Expand Up @@ -47701,16 +47701,16 @@ void FFScript::ZScriptConsole(bool open)
{
if ( open )
{
zscript_coloured_console.Create("ZScript Debug Console", 600, 200, NULL, NULL);
zscript_coloured_console.Create("ZC Console", 600, 200, NULL, NULL);
clearConsole();
zscript_debugger = 1;
console_enabled = 1;
}
else
{
zscript_coloured_console.Close();
zscript_debugger = 0;
console_enabled = 0;
}
zc_set_config("CONSOLE","ZScript_Debugger",zscript_debugger);
zc_set_config("CONSOLE","enabled",console_enabled);
}

void FFScript::ZASMPrint(bool open)
Expand Down Expand Up @@ -47865,7 +47865,7 @@ void FFScript::do_trace(bool v)
// For now, only prevent tracing to allegro log for Web version. Some quests may expect players to
// look in the logs for spoiler/secret stuff.
#ifdef __EMSCRIPTEN__
bool should_trace = zscript_debugger || should_replay_trace;
bool should_trace = console_enabled || should_replay_trace;
if (!should_trace) return;
#endif

Expand All @@ -47880,7 +47880,7 @@ void FFScript::do_trace(bool v)
if (should_replay_trace)
replay_step_comment("trace: " + s2);

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_WHITE |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),s2.c_str());
Expand All @@ -47897,7 +47897,7 @@ void FFScript::do_tracel(bool v)
if (replay_is_active() && replay_get_meta_bool("script_trace"))
replay_step_comment(fmt::format("trace: {}", temp));

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_WHITE |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),tmp);
Expand All @@ -47913,7 +47913,7 @@ void FFScript::do_tracebool(const bool v)
if (replay_is_active() && replay_get_meta_bool("script_trace"))
replay_step_comment(fmt::format("trace: {}", (bool)temp));

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_WHITE |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),str);
Expand All @@ -47927,7 +47927,7 @@ void traceStr(string const& str)
if (replay_is_active() && replay_get_meta_bool("script_trace"))
replay_step_comment("trace: " + str);

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_WHITE |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),str.c_str());
Expand Down Expand Up @@ -48452,7 +48452,7 @@ void FFScript::do_breakpoint()
TraceScriptIDs();
al_trace("%s", str.c_str());

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_RED |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),str.c_str());
Expand All @@ -48469,7 +48469,7 @@ void FFScript::do_tracenl()
{
safe_al_trace("\n");

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_WHITE |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),"\n");
Expand All @@ -48483,7 +48483,7 @@ void FFScript::TraceScriptIDs(bool zasm_console)
{
if(!zasm_debugger && zasm_console) return;
CConsoleLoggerEx console = (zasm_console ? coloured_console : zscript_coloured_console);
bool cond = (zasm_console ? zasm_debugger : zscript_debugger);
bool cond = (zasm_console ? zasm_debugger : console_enabled);

char buf[256] = {0};
//Calculate timestamp
Expand All @@ -48503,7 +48503,7 @@ void FFScript::TraceScriptIDs(bool zasm_console)
{
if(!zasm_debugger && zasm_console) return;
CConsoleLoggerEx console = (zasm_console ? coloured_console : zscript_coloured_console);
bool cond = (zasm_console ? zasm_debugger : zscript_debugger);
bool cond = (zasm_console ? zasm_debugger : console_enabled);
char buf[256] = {0};
if(script_funcrun)
{
Expand Down Expand Up @@ -48691,7 +48691,7 @@ void FFScript::do_tracetobase()
s2 += "\n";
al_trace("%s", s2.c_str());

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.safeprint((CConsoleLoggerEx::COLOR_WHITE |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),s2.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/zc/script_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void ScriptDebugHandle::_print(int32_t attributes, const char *str)
al_fputs(file, str);
}

if (debug_to_console && zscript_debugger)
if (debug_to_console && console_enabled)
{
zscript_coloured_console.safeprint(attributes, str);
}
Expand Down
21 changes: 10 additions & 11 deletions src/zc/zc_sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void load_game_configs()
info_opacity = zc_get_config("zc","debug_info_opacity",255);
#ifdef _WIN32
zasm_debugger = (byte) zc_get_config("CONSOLE","print_ZASM",0);
zscript_debugger = (byte) zc_get_config("CONSOLE","ZScript_Debugger",0);
console_enabled = (byte) zc_get_config("CONSOLE", "enabled", 0);
//use_win7_keyboard_fix = (byte) zc_get_config(cfg_sect,"use_win7_key_fix",0);
use_win32_proc = (byte) zc_get_config(cfg_sect,"zc_win_proc_fix",0); //buggy

Expand All @@ -438,7 +438,7 @@ void load_game_configs()
monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0);
#else //UNIX
zasm_debugger = (byte) zc_get_config("CONSOLE","print_ZASM",0);
zscript_debugger = (byte) zc_get_config("CONSOLE","ZScript_Debugger",0);
console_enabled = (byte) zc_get_config("CONSOLE", "enabled", 0);
monochrome_console = (byte) zc_get_config("CONSOLE","monochrome_debuggers",0);
#endif
clearConsoleOnLoad = zc_get_config("CONSOLE","clear_console_on_load",1)!=0;
Expand Down Expand Up @@ -5177,15 +5177,14 @@ int32_t OnnClearQuestDir()
else return D_O_K;
}

int32_t onConsoleZScript()
int32_t onConsole()
{
if ( !zscript_debugger )
if ( !console_enabled )
{
AlertDialog("ZScript Debugger",
"Enabling this will open the ZScript Debugger Console"
AlertDialog("ZC Console",
"Open the ZC Console?"
"\nThis will display any messages logged by scripts,"
" including script errors."
"\nAre you sure that you wish to open the ZScript Debugger?",
" including errors.",
[&](bool ret,bool)
{
if(ret)
Expand Down Expand Up @@ -7401,7 +7400,7 @@ enum
MENUID_MISC_QUEST_INFO,
MENUID_MISC_QUEST_DIR,
MENUID_MISC_ZASM_DEBUGGER,
MENUID_MISC_ZSCRIPT_DEBUGGER,
MENUID_MISC_CONSOLE,
MENUID_MISC_CLEAR_CONSOLE_ON_LOAD,
};
static NewMenu misc_menu
Expand All @@ -7419,7 +7418,7 @@ static NewMenu misc_menu
{ "Take &Snapshot F12", onSnapshot },
{ "Sc&reen Saver...", onScreenSaver },
{ "Save ZC Configuration", OnSaveZCConfig },
{ "Show ZScript Debugger", onConsoleZScript, MENUID_MISC_ZSCRIPT_DEBUGGER },
{ "Show Console", onConsole, MENUID_MISC_CONSOLE },
{ "Clear Console on Qst Load", onClrConsoleOnLoad, MENUID_MISC_CLEAR_CONSOLE_ON_LOAD },
{ "Clear Directory Cache", OnnClearQuestDir },
};
Expand Down Expand Up @@ -7839,7 +7838,7 @@ void System()
name_entry_mode_menu.select_only_index(NameEntryMode);

misc_menu.select_uid(MENUID_MISC_ZASM_DEBUGGER, zasm_debugger);
misc_menu.select_uid(MENUID_MISC_ZSCRIPT_DEBUGGER, zscript_debugger);
misc_menu.select_uid(MENUID_MISC_CONSOLE, console_enabled);
misc_menu.select_uid(MENUID_MISC_CLEAR_CONSOLE_ON_LOAD, clearConsoleOnLoad);

bool nocheat = (replay_is_replaying() || !Playing
Expand Down
10 changes: 5 additions & 5 deletions src/zc/zelda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ extern int32_t jwin_pal[jcMAX];
int32_t gui_colorset=99;
int32_t fullscreen = 0;
byte forceExit=0,zc_vsync=0;
byte use_win32_proc=1, zasm_debugger = 0, zscript_debugger = 0; //windows-build configs
byte use_win32_proc=1, zasm_debugger = 0, console_enabled = 0; //windows-build configs
int32_t homescr,currscr,frame=0,currmap=0,dlevel,warpscr,worldscr,scrolling_scr=0,scrolling_map=0;
int32_t newscr_clk=0,opendoors=0,currdmap=0,fadeclk=-1,listpos=0;
int32_t lastentrance=0,lastentrance_dmap=0,prices[3]= {0},loadside = 0, Bwpn = -1, Awpn = -1, Xwpn = -1, Ywpn = -1;
Expand Down Expand Up @@ -1004,7 +1004,7 @@ void Z_eventlog(const char *format,...)
va_end(ap);
al_trace("%s",buf);

if ( zscript_debugger ) {zscript_coloured_console.cprintf((CConsoleLoggerEx::COLOR_GREEN | CConsoleLoggerEx::COLOR_RED | CConsoleLoggerEx::COLOR_INTENSITY |
if ( console_enabled ) {zscript_coloured_console.cprintf((CConsoleLoggerEx::COLOR_GREEN | CConsoleLoggerEx::COLOR_RED | CConsoleLoggerEx::COLOR_INTENSITY |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),"%s",buf); }
}
}
Expand All @@ -1023,7 +1023,7 @@ void Z_scripterrlog(const char * const format,...)
va_end(ap);
al_trace("%s",buf);

if ( zscript_debugger )
if ( console_enabled )
{
zscript_coloured_console.cprintf((CConsoleLoggerEx::COLOR_RED | CConsoleLoggerEx::COLOR_INTENSITY |
CConsoleLoggerEx::COLOR_BACKGROUND_BLACK),"%s",buf);
Expand Down Expand Up @@ -4401,7 +4401,7 @@ int main(int argc, char **argv)
load_game_configs();

if(used_switch(argc, argv, "-no_console"))
zscript_debugger = false;
console_enabled = false;

//Set up MODULES: This must occur before trying to load the default quests, as the
//data for quest names and so forth is set by the MODULE file!
Expand All @@ -4412,7 +4412,7 @@ int main(int argc, char **argv)
Z_error_fatal("ZC Player I/O Error: No module definitions found. Please check your settings in %s.cfg.\n", "zc");
}

if ( zscript_debugger )
if ( console_enabled )
{
FFCore.ZScriptConsole(true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/zc/zelda.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ extern int32_t jwin_pal[jcMAX];
extern int32_t gui_colorset;
extern int32_t fullscreen;
extern byte forceExit, zc_vsync;
extern byte use_win32_proc, zasm_debugger, zscript_debugger; //windows only
extern byte use_win32_proc, zasm_debugger, console_enabled;

extern PALETTE tempbombpal;
extern bool usebombpal;
Expand Down

0 comments on commit 719738e

Please sign in to comment.