The extended debug mode is now fully implemented, though it may be slightly different than the Windows version's debug mode.

I also added a ghost mode (shift-G) which allows you to pass through walls.

In the Windows code, I added three small things:
- the "&*()" Easter egg
- typing ? should now give shopping and talking help as well
- the Return to Start debug option shouldn't work when you're on a horse

git-svn-id: http://openexile.googlecode.com/svn/trunk@101 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-06-28 20:05:31 +00:00
parent 6af129c277
commit b90130c425
6 changed files with 431 additions and 226 deletions

View File

@@ -1508,7 +1508,23 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
for (k = 0; k < (short) LOWORD(lParam); k++) for (k = 0; k < (short) LOWORD(lParam); k++)
switch(chr) switch(chr)
{ {
case '&':
add_string_to_buf("If Valorim ...");
print_buf();
break;
case '*':
add_string_to_buf("You want to save ...");
print_buf();
break;
case '(':
add_string_to_buf("Back up your save files ...");
print_buf();
break;
case ')':
add_string_to_buf("Burma Shave.");
print_buf();
break;
case 'D': case 'D':
if (in_scen_debug) if (in_scen_debug)
{ {
@@ -1523,8 +1539,18 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
print_buf(); print_buf();
break; break;
case '?': case '?':
if (overall_mode == MODE_SHOPPING) {
univ.party.help_received[26] = 0;
give_help(226,27,0);
break;
}
if (overall_mode == MODE_TALKING) {
univ.party.help_received[5] = 0;
give_help(205,6,0);
break;
}
if (is_out()) FCD(1079,0); if (is_out()) FCD(1079,0);
if (is_town()) FCD(1080,0); if (is_town()) FCD(1080,0);
if (is_combat()) FCD(1081,0); if (is_combat()) FCD(1081,0);
break; break;
@@ -1594,7 +1620,7 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
// case 'A': Alchemy // case 'A': Alchemy
case 'B': // Leave town case 'B': // Leave town
if (in_scen_debug) { if (in_scen_debug) {
party.stuff_done[304][0] = 0; party.stuff_done[304][0] = 0;
if(overall_mode == MODE_OUTDOORS){ if(overall_mode == MODE_OUTDOORS){
add_string_to_buf("Debug - Leave Town: You're not in town !"); add_string_to_buf("Debug - Leave Town: You're not in town !");
print_buf(); print_buf();
@@ -1737,18 +1763,22 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
break; break;
case 'R': // Return to Start case 'R': // Return to Start
if (in_scen_debug) { if (in_scen_debug) {
if (party.in_boat >= 0) { if (party.in_boat >= 0) {
add_string_to_buf(" Not while in boat. "); add_string_to_buf(" Not while in boat. ");
break; break;
}
if (party.in_horse >= 0) {
add_string_to_buf(" Not while on horse. ");
break;
} }
force_town_enter(scenario.which_town_start,scenario.where_start); force_town_enter(scenario.which_town_start,scenario.where_start);
start_town_mode(scenario.which_town_start,9); start_town_mode(scenario.which_town_start,9);
position_party(scenario.out_sec_start.x,scenario.out_sec_start.y, position_party(scenario.out_sec_start.x,scenario.out_sec_start.y,
scenario.out_start.x,scenario.out_start.y); scenario.out_start.x,scenario.out_start.y);
center = c_town.p_loc = scenario.where_start; center = c_town.p_loc = scenario.where_start;
redraw_screen(0); redraw_screen(0);
add_string_to_buf("Debug: You are moved... "); add_string_to_buf("Debug: You are moved... ");
print_buf(); print_buf();
} }
break; break;
case 'S': // Set a SDF <= can't set the SDF 0 (it's the default return value if the first character of the string is not a number) case 'S': // Set a SDF <= can't set the SDF 0 (it's the default return value if the first character of the string is not a number)

View File

@@ -30,6 +30,7 @@
#include "mathutil.h" #include "mathutil.h"
#include "fileio.h" #include "fileio.h"
#include "dlgutil.h" #include "dlgutil.h"
#include "dlgconsts.h"
Rect bottom_buttons[7]; Rect bottom_buttons[7];
Rect town_buttons[10]; Rect town_buttons[10];
@@ -52,6 +53,7 @@ Rect pc_buttons[6][5];
short num_chirps_played = 0; short num_chirps_played = 0;
extern Rect startup_button[6]; extern Rect startup_button[6];
bool ghost_mode;
Rect startup_top; Rect startup_top;
// For menu spell casting, some info needs to be stored up here. // For menu spell casting, some info needs to be stored up here.
@@ -85,14 +87,13 @@ cOutdoors::cWandering store_wandering_special;
long dummy; long dummy;
short store_shop_type; short store_shop_type;
short debug_ok = 0;
short store_selling_values[8] = {0,0,0,0,0,0,0,0}; short store_selling_values[8] = {0,0,0,0,0,0,0,0};
extern short cen_x, cen_y, stat_window,give_delays;//,pc_moves[6]; extern short cen_x, cen_y, stat_window,give_delays;//,pc_moves[6];
extern eGameMode overall_mode; extern eGameMode overall_mode;
extern Point to_create; extern Point to_create;
extern bool in_startup_mode,All_Done,play_sounds,frills_on,spell_forced,save_maps,monsters_going; extern bool in_startup_mode,All_Done,play_sounds,frills_on,spell_forced,save_maps,monsters_going;
extern bool debug_on,cartoon_happening,party_in_memory,in_scen_debug; extern bool cartoon_happening,party_in_memory,in_scen_debug;
// game info globals // game info globals
@@ -1551,16 +1552,17 @@ void initiate_outdoor_combat(short i)
draw_terrain(); draw_terrain();
} }
bool handle_keystroke(char chr,char chr2,EventRecord event) bool handle_keystroke(char chr,char chr2,EventRecord event){
{
bool are_done = false; bool are_done = false;
Point pass_point; Point pass_point;
short i,j; short i,j;
std::ostringstream sout;
char response[255];
char keypad[10] = {82,83,84,85,86,87,88,89,91,92}; char keypad[10] = {82,83,84,85,86,87,88,89,91,92};
Point terrain_click[10] = {{150,185},{120,215},{150,215},{180,215}, Point terrain_click[10] = {{150,185},{120,215},{150,215},{180,215},
{120,185},{150,185},{180,185}, {120,185},{150,185},{180,185},
{120,155},{150,155},{180,135}}; {120,155},{150,155},{180,135}};
char talk_chars[9] = {'l','n','j','b','s','r','d','g','a'}; char talk_chars[9] = {'l','n','j','b','s','r','d','g','a'};
bool dialog_grabbed_key = false; bool dialog_grabbed_key = false;
@@ -1569,30 +1571,30 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
if (modeless_exists[i] == true) if (modeless_exists[i] == true)
if ((FrontWindow() == GetDialogWindow(modeless_dialogs[i])) && ((chr == 13) || (chr2 == 76)|| (chr2 == 53)) if ((FrontWindow() == GetDialogWindow(modeless_dialogs[i])) && ((chr == 13) || (chr2 == 76)|| (chr2 == 53))
&& (overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) { && (overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) {
//GetDialogItem(modeless_dialogs[i], 1, &the_type, &the_handle, &the_rect); //GetDialogItem(modeless_dialogs[i], 1, &the_type, &the_handle, &the_rect);
//HiliteControl((ControlHandle)the_handle,inButton); //HiliteControl((ControlHandle)the_handle,inButton);
//Delay(8,&dummy); //Delay(8,&dummy);
//HiliteControl((ControlHandle)the_handle,0); //HiliteControl((ControlHandle)the_handle,0);
HideWindow(GetDialogWindow(modeless_dialogs[i])); HideWindow(GetDialogWindow(modeless_dialogs[i]));
modeless_exists[i] = false; modeless_exists[i] = false;
SelectWindow(mainPtr); SelectWindow(mainPtr);
SetPort(GetWindowPort(mainPtr)); SetPort(GetWindowPort(mainPtr));
dialog_grabbed_key = true; dialog_grabbed_key = true;
} }
if (dialog_grabbed_key == true) if (dialog_grabbed_key == true)
return false; return false;
} }
if (in_startup_mode == true) if (in_startup_mode == true)
return false; return false;
ObscureCursor(); ObscureCursor();
SetPort(GetWindowPort(mainPtr)); SetPort(GetWindowPort(mainPtr));
// DEBUG // DEBUG
// sprintf((char *) debug, "%d ",(short) chr2); // sprintf((char *) debug, "%d ",(short) chr2);
// add_string_to_buf((char *) debug); // add_string_to_buf((char *) debug);
// print_buf(); // print_buf();
if (overall_mode == MODE_TALKING) { if (overall_mode == MODE_TALKING) {
if (chr2 == 53) if (chr2 == 53)
chr = 'd'; chr = 'd';
@@ -1605,16 +1607,16 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
} }
else if (overall_mode == MODE_SHOPPING) { // shopping keystrokes else if (overall_mode == MODE_SHOPPING) { // shopping keystrokes
if (chr2 == 53) { if (chr2 == 53) {
pass_point.h = 222; pass_point.h = 222;
pass_point.v = 398; pass_point.v = 398;
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
if (chr == 97 + i) { if (chr == 97 + i) {
pass_point.h = shopping_rects[i][1].left + 9; pass_point.h = shopping_rects[i][1].left + 9;
@@ -1622,29 +1624,29 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
} }
if ((overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) { if ((overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) {
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
if (chr2 == keypad[i]) { if (chr2 == keypad[i]) {
if (i == 0) { if (i == 0) {
chr = 'z'; chr = 'z';
} }
else { else {
pass_point.h = terrain_click[i].v; pass_point.h = terrain_click[i].v;
pass_point.v = terrain_click[i].h; pass_point.v = terrain_click[i].h;
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
return are_done; return are_done;
}
} }
} }
}
switch(chr)
{
switch(chr)
{
case '&': case '&':
add_string_to_buf("If Valorim ..."); add_string_to_buf("If Valorim ...");
print_buf(); print_buf();
@@ -1661,161 +1663,316 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
add_string_to_buf("Burma Shave."); add_string_to_buf("Burma Shave.");
print_buf(); print_buf();
break; break;
case '?': case '?':
if (is_out()) FCD(1079,0);
if (is_town()) FCD(1080,0);
if (is_combat()) FCD(1081,0);
if (overall_mode == MODE_SHOPPING) { if (overall_mode == MODE_SHOPPING) {
univ.party.help_received[26] = 0; univ.party.help_received[26] = 0;
give_help(226,27,0); give_help(226,27,0);
} break;
if (overall_mode == MODE_SHOPPING) { }
univ.party.help_received[26] = 0;
give_help(226,27,0);
}
if (overall_mode == MODE_TALKING) { if (overall_mode == MODE_TALKING) {
univ.party.help_received[5] = 0; univ.party.help_received[5] = 0;
give_help(205,6,0); give_help(205,6,0);
} break;
}
if (is_out()) FCD(1079,0);
if (is_town()) FCD(1080,0);
if (is_combat()) FCD(1081,0);
break; break;
case '1': case '2': case '3': case '4': case '5': case '6': case '1': case '2': case '3': case '4': case '5': case '6':
pass_point.h = pc_buttons[((short) chr) - 49][0].left + 1 + PC_WIN_UL_X; pass_point.h = pc_buttons[((short) chr) - 49][0].left + 1 + PC_WIN_UL_X;
pass_point.v = pc_buttons[((short) chr) - 49][0].top + PC_WIN_UL_Y; pass_point.v = pc_buttons[((short) chr) - 49][0].top + PC_WIN_UL_Y;
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
break; break;
case '9': case '9':
pass_point.h = item_screen_button_rects[6].left + ITEM_WIN_UL_X; pass_point.h = item_screen_button_rects[6].left + ITEM_WIN_UL_X;
pass_point.v = item_screen_button_rects[6].top + ITEM_WIN_UL_Y; pass_point.v = item_screen_button_rects[6].top + ITEM_WIN_UL_Y;
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
break; break;
case ' ': case ' ':
if (overall_mode == MODE_FANCY_TARGET) { // cast multi-target spell, set # targets to 0 so that if (overall_mode == MODE_FANCY_TARGET) { // cast multi-target spell, set # targets to 0 so that
// space clicked doesn't matter // space clicked doesn't matter
num_targets_left = 0; num_targets_left = 0;
pass_point = terrain_click[5]; pass_point = terrain_click[5];
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
if (overall_mode == MODE_SPELL_TARGET) if (overall_mode == MODE_SPELL_TARGET)
spell_cast_hit_return(); spell_cast_hit_return();
break; break;
case 'D': case 'D':
if (in_scen_debug == true) { if (in_scen_debug) {
in_scen_debug = false; in_scen_debug = false;
ASB("Debug mode OFF."); ASB("Debug mode OFF.");
} } else {
else if (/*enter_password() == */false) in_scen_debug = true;
ASB("Password incorrect."); ASB("Debug mode ON.");
else { }
in_scen_debug = true;
ASB("Debug mode ON.");
}
print_buf(); print_buf();
break; break;
case 'z': case 'z':
if (((overall_mode >= MODE_COMBAT) && (overall_mode < MODE_TALKING)) || (overall_mode == MODE_LOOK_COMBAT)) { if (((overall_mode >= MODE_COMBAT) && (overall_mode < MODE_TALKING)) || (overall_mode == MODE_LOOK_COMBAT)) {
set_stat_window(current_pc); set_stat_window(current_pc);
put_item_screen(stat_window,0); put_item_screen(stat_window,0);
} } else {
else { set_stat_window(0);
set_stat_window(0); put_item_screen(stat_window,0);
put_item_screen(stat_window,0); }
} break;
break;
case '=': case '=':
if(!in_scen_debug) break;
for (i = 0; i < 6; i++)
for (j = 0; j < 30; j++) {
univ.party[i].priest_spells[j] = 1;
univ.party[i].mage_spells[j] = 1;
}
if (debug_on == false) {
break;
}
univ.party.gold += 100; univ.party.gold += 100;
univ.party.food += 100; univ.party.food += 100;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
univ.party[i].main_status = MAIN_STATUS_ALIVE; univ.party[i].main_status = MAIN_STATUS_ALIVE;
univ.party[i].cur_health = univ.party[i].max_health; univ.party[i].cur_health = univ.party[i].max_health;
univ.party[i].cur_sp = 100; univ.party[i].cur_sp = 100;
} }
award_party_xp(25); award_party_xp(25);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
for (j = 0; j < 62; j++) { for (j = 0; j < 62; j++) {
univ.party[i].priest_spells[j] = 1; univ.party[i].priest_spells[j] = 1;
univ.party[i].mage_spells[j] = 1; univ.party[i].mage_spells[j] = 1;
} }
refresh_store_items(); refresh_store_items();
add_string_to_buf("Debug: Add stuff and heal. "); add_string_to_buf("Debug: Add stuff and heal.");
print_buf(); print_buf();
put_pc_screen(); put_pc_screen();
break; break;
case 'B':
if(!in_scen_debug) break;
PSD[SDF_IS_PARTY_SPLIT] = 0;
if(overall_mode == MODE_OUTDOORS){
add_string_to_buf("Debug - Leave Town: You're not in town!");
print_buf();
break;
}
overall_mode = MODE_OUTDOORS;
position_party(univ.party.outdoor_corner.x,univ.party.outdoor_corner.y,univ.party.p_loc.x,univ.party.p_loc.y);
clear_map();
add_string_to_buf("Debug: Reunite party and leave town.");
print_buf();
redraw_screen();
break;
case 'C':
if(!in_scen_debug) break;
for (i = 0; i < 6; i++) {
univ.party[i].status[STATUS_POISON] = 0;
if(univ.party[i].status[STATUS_BLESS_CURSE] < 0)
univ.party[i].status[STATUS_BLESS_CURSE] = 0;
if (univ.party[i].status[STATUS_HASTE_SLOW] < 0)
univ.party[i].status[STATUS_HASTE_SLOW] = 0;
univ.party[i].status[STATUS_WEBS] = 0;
univ.party[i].status[STATUS_DISEASE] = 0;
univ.party[i].status[STATUS_DUMB] = 0;
univ.party[i].status[STATUS_ASLEEP] = 0;
univ.party[i].status[STATUS_PARALYZED] = 0;
univ.party[i].status[STATUS_ACID] = 0;
}
add_string_to_buf("Debug: You get cleaned up!");
print_buf();
put_pc_screen();
break;
case 'E':
if(!in_scen_debug) break;
PSD[SDF_PARTY_STEALTHY] += 10;
PSD[SDF_PARTY_DETECT_LIFE] += 10;
PSD[SDF_PARTY_FIREWALK] += 10;
add_string_to_buf("Debug: Stealth, Detect Life, Firewalk!");
print_buf();
put_pc_screen();
break;
case 'F':
if(!in_scen_debug) break;
if(overall_mode != MODE_OUTDOORS){
add_string_to_buf("Debug: Can only fly outdoors.");
}else{
PSD[SDF_PARTY_FLIGHT] += 10;
add_string_to_buf("Debug: You start flying!");
}
print_buf();
put_pc_screen();
break;
case 'G':
if(!in_scen_debug) break;
if(ghost_mode){
ghost_mode = false;
ASB("Debug: Ghost mode OFF.");
}else{
ghost_mode = true;
ASB("Debug:Ghost mode ON.");
}
print_buf();
break;
case 'H':
if(!in_scen_debug) break;
univ.party.gold += 100;
univ.party.food += 100;
for (i = 0; i < 6; i++) {
if ((univ.party[i].main_status > MAIN_STATUS_ALIVE) && (univ.party[i].main_status < MAIN_STATUS_FLED))
univ.party[i].main_status = MAIN_STATUS_ALIVE;
}
heal_party(250);
restore_sp_party(100);
add_string_to_buf("Debug: Heal party.");
print_buf();
put_pc_screen();
break;
case 'K': case 'K':
if (debug_on) { if (!in_scen_debug) break;
for (i = 0; i < univ.town->max_monst(); i++) { for (i = 0; i < univ.town->max_monst(); i++) {
if ((is_combat()) && (univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 1)) if ((is_combat()) && (univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 1))
univ.town.monst[i].active = 0; univ.town.monst[i].active = 0;
if ((univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 1)
&& (dist(univ.town.monst[i].cur_loc,univ.town.p_loc) <= 10) )
damage_monst(i, 7,1000,0, DAMAGE_UNBLOCKABLE,0);
}
// kill_monst(&c_town.monst[i],6);
draw_terrain();
add_string_to_buf("Debug: Kill things. ");
print_buf();
}
if ((univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 1)
&& (dist(univ.town.monst[i].cur_loc,univ.town.p_loc) <= 10) )
damage_monst(i, 7,1000,0, DAMAGE_UNBLOCKABLE,0);
}
// kill_monst(&univ.town.monst[i],6);
draw_terrain();
add_string_to_buf("Debug: Kill things. ");
print_buf();
break; break;
case 'N':
if(!in_scen_debug) break;
end_scenario = true;
in_scen_debug = false;
break;
case 'O':
if(!in_scen_debug) break;
if (is_town()) {
sout << "Debug: You're at x " << (short) univ.town.p_loc.x << ", y " << (short) univ.town.p_loc.y
<< " in town " << univ.town.num << '.';
} else if (is_out()) {
short x = univ.party.p_loc.x;
short y = univ.party.p_loc.y;
x += 48 * univ.party.outdoor_corner.x;
y += 48 * univ.party.outdoor_corner.y;
sout << "Debug: You're outside at x " << x << ", y " << y << ',';
}
add_string_to_buf(sout.str());
print_buf();
break;
case 'I': // TODO: Seems useless?
if(!in_scen_debug) break;
sout << "Debug: The party's age is " << univ.party.age;
add_string_to_buf(sout.str());
add_string_to_buf("Debug: Reset map."); // Surely this won't work?
print_buf();
break;
case 'Q':
if(!in_scen_debug) break;
if (overall_mode == MODE_OUTDOORS) {
for (i = 0; i < 96; i++)
for (j = 0; j < 96; j++)
make_explored(i,j);
} else {
for (i = 0; i < 64; i++)
for (j = 0; j < 64; j++)
make_explored(i,j);
}
clear_map();
add_string_to_buf("Debug: Magic Map.");
print_buf();
break;
case 'R':
if(!in_scen_debug) break;
if (univ.party.in_boat >= 0) {
add_string_to_buf(" Not while in boat. ");
break;
}
if (univ.party.in_horse >= 0) {
add_string_to_buf(" Not while on horse. ");
break;
}
force_town_enter(scenario.which_town_start,scenario.where_start);
start_town_mode(scenario.which_town_start,9);
position_party(scenario.out_sec_start.x,scenario.out_sec_start.y,
scenario.out_start.x,scenario.out_start.y);
center = univ.town.p_loc = scenario.where_start;
redraw_screen();
add_string_to_buf("Debug: You return to the start.");
print_buf();
break;
case 'S': // TODO: Create a dedicated dialog for this.
if(!in_scen_debug) break;
display_strings("Enter Stuff Done Flag Part A (between 1 and 299)","","Which SDFa ?",-1,130,PICT_DLG,0);
get_text_response(873,(unsigned char*) response,0);
i = atoi(response);
if(i > 0 && i < 300){
display_strings("Enter Stuff Done Flag Part B (between 0 and 49)","","Which SDFb ?",-1,130,PICT_DLG,0);
get_text_response(873,(unsigned char*) response,0);
j = atoi(response);
if(j >= 0 && j < 50){
display_strings("Enter Stuff Done Flag Value (up to 255)","","Which value ?",-1,130,PICT_DLG,0);
get_text_response(873,(unsigned char*) response,0);
int x = atoi(response);
if(x < 256 && x >= 0)
PSD[i][j] = x;
}
}
break;
case 'T':
if(!in_scen_debug) break;
short find_direction_from;
sout << "Enter Town Number (between 0 and " << scenario.num_towns - 1 << ')';
display_strings(sout.str().c_str(),"","Which Town ?",-1,130,PICT_DLG,0);
get_text_response(873,(unsigned char*) response,0);
i = atoi(response);
if(i >= 0 && i < scenario.num_towns ){
if (univ.party.direction == 0) find_direction_from = 2;
else if (univ.party.direction == 4) find_direction_from = 0;
else if (univ.party.direction < 4) find_direction_from = 3;
else find_direction_from = 1;
start_town_mode(i, find_direction_from);
}
break;
case 'W': case 'W':
refresh_store_items(); refresh_store_items();
add_string_to_buf("Debug: Refreshed jobs/shops. "); add_string_to_buf("Debug: Refreshed jobs/shops. ");
print_buf(); print_buf();
break; break;
case '`': // case '`':
break; // break;
case '[': // case '[':
// break;
// case '+':
// break;
case '<':
//break; //break;
debug_ok = 1; if (!in_scen_debug) break;
return false; ASB("Debug: Increase age.");
break; ASB(" It is now 1 day later.");
case '+': print_buf();
//break; univ.party.age += 3700;
if (debug_on == true) { put_pc_screen();
print_nums(-999,-999,-999);
debug_on = false;
}
if (debug_ok == 1) {
print_nums(999,999,999);
debug_on = true;
}
break;
case '/':
//break;
if ((debug_on == true) || (in_scen_debug == true)) {
ASB("Debug: Increase age.");
ASB(" It is now 1 day later.");
print_buf();
univ.party.age += 3700;
put_pc_screen();
}
break; break;
case '>': case '>':
ASB("DEBUG: Towns have short memory."); ASB("DEBUG: Towns have short memory.");
@@ -1823,7 +1980,31 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
print_buf(); print_buf();
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
univ.party.creature_save[i].which_town = 200; univ.party.creature_save[i].which_town = 200;
break; break;
case '/':
if(!in_scen_debug) break;
ASB("Debug hot keys");
ASB(" B Leave town");
ASB(" C Get cleaned up");
ASB(" D Toggle Debug mode");
ASB(" E Stealth, Detect Life, Firewalk");
ASB(" F Flight");
ASB(" G Ghost");
ASB(" H Heal");
ASB(" K Kill things");
ASB(" N End Scenario");
ASB(" O Location");
ASB(" Q Magic map");
ASB(" R Return to Start");
ASB(" S Set a SDF");
ASB(" T Enter Town");
ASB(" W Refresh jobs/shops");
ASB(" = Heal, increase magic skills");
ASB(" < Make one day pass");
ASB(" > Towns forgive you");
ASB(" / Bring up this list");
print_buf();
break;
case 'a': case 'a':
if (overall_mode < MODE_TALK_TOWN) { if (overall_mode < MODE_TALK_TOWN) {
pass_point.h = (overall_mode == MODE_OUTDOORS) ? 170 : 221; pass_point.h = (overall_mode == MODE_OUTDOORS) ? 170 : 221;
@@ -1831,10 +2012,9 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
break; break;
case 'b': case 'u': case 'L': case 'b': case 'u': case 'L':
if (overall_mode == MODE_TOWN) { if (overall_mode == MODE_TOWN) {
pass_point.h = (chr == 'u') ? 220 : 205; pass_point.h = (chr == 'u') ? 220 : 205;
@@ -1842,9 +2022,9 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
break; break;
case 's': case 'x': case 'e': case 's': case 'x': case 'e':
if ((overall_mode == MODE_COMBAT) || if ((overall_mode == MODE_COMBAT) ||
((overall_mode == MODE_FIRING) && (chr == 's')) || ((overall_mode == MODE_FIRING) && (chr == 's')) ||
@@ -1854,10 +2034,10 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
break; break;
case 'm': case 'p': case 'l': case 'r': case 'w': case 't': case 'd': case 'g': case 'f': case 'm': case 'p': case 'l': case 'r': case 'w': case 't': case 'd': case 'g': case 'f':
case 'M': case 'P': case 'A': case 'M': case 'P': case 'A':
j = 50; j = 50;
@@ -1866,67 +2046,63 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
if ((chr == 'p') && ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FANCY_TARGET))) // cancel spell if ((chr == 'p') && ((overall_mode == MODE_SPELL_TARGET) || (overall_mode == MODE_FANCY_TARGET))) // cancel spell
j = 1; j = 1;
if ((overall_mode == MODE_OUTDOORS) || (overall_mode == MODE_TOWN) || (overall_mode == MODE_COMBAT)) { if ((overall_mode == MODE_OUTDOORS) || (overall_mode == MODE_TOWN) || (overall_mode == MODE_COMBAT)) {
switch (chr) { switch (chr) {
case 'M': spell_forced = true; j = 0; break; case 'M': spell_forced = true; j = 0; break;
case 'm': j = 0; break; case 'm': j = 0; break;
case 'P': spell_forced = true; j = 1; break; case 'P': spell_forced = true; j = 1; break;
case 'p': j = 1; break; case 'p': j = 1; break;
case 'l': j = 2; break; case 'l': j = 2; break;
case 'r': if (overall_mode != MODE_OUTDOORS) return false; case 'r': if (overall_mode != MODE_OUTDOORS) return false;
j = 3; j = 3;
break; break;
case 't': if (overall_mode == MODE_TOWN) case 't': if (overall_mode == MODE_TOWN)
j = 3; j = 3;
else return false; else return false;
break; break;
case 'A':if (overall_mode == MODE_TOWN) { case 'A':if (overall_mode == MODE_TOWN) {
pass_point.h = 1000 + ul.h; pass_point.h = 1000 + ul.h;
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
else { else {
add_string_to_buf("Alchemy: In town only."); add_string_to_buf("Alchemy: In town only.");
print_buf(); print_buf();
return false; return false;
} }
break; break;
case 'w':if (overall_mode == MODE_COMBAT) case 'w':if (overall_mode == MODE_COMBAT)
j = 5; j = 5;
else if (overall_mode == MODE_TOWN) { else if (overall_mode == MODE_TOWN) {
pass_point.h = 1001 + ul.h; pass_point.h = 1001 + ul.h;
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
} }
else { else {
add_string_to_buf("Wait: In town only."); add_string_to_buf("Wait: In town only.");
print_buf(); print_buf();
return false; return false;
} }
break; break;
case 'd': if (overall_mode != MODE_COMBAT) return false; case 'd': if (overall_mode != MODE_COMBAT) return false;
j = 3; j = 3;
break; break;
case 'g': if (overall_mode == MODE_OUTDOORS) return false; case 'g': if (overall_mode == MODE_OUTDOORS) return false;
j = 4; j = 4;
break; break;
case 'f': if (overall_mode != MODE_TOWN) return false; case 'f': if (overall_mode != MODE_TOWN) return false;
j = 6; j = 6;
break; break;
}
} }
}
if (j < 50) { if (j < 50) {
pass_point.h = bottom_buttons[j].left + 5; pass_point.h = bottom_buttons[j].left + 5;
pass_point.v = bottom_buttons[j].top + 5; pass_point.v = bottom_buttons[j].top + 5;
AddPt(ul,&pass_point); AddPt(ul,&pass_point);
event.where = pass_point; event.where = pass_point;
are_done = handle_action(event); are_done = handle_action(event);
}
break;
} }
break;
}
debug_ok = 0;
spell_forced = false; spell_forced = false;
return are_done; return are_done;
} }
@@ -2588,7 +2764,7 @@ bool outd_move_party(location destination,bool forced)
keep_going = check_special_terrain(destination,0,0,&spec_num,&check_f); keep_going = check_special_terrain(destination,0,0,&spec_num,&check_f);
if (check_f == true) if (check_f == true)
forced = true; forced = true;
if (debug_on == true) if (in_scen_debug && ghost_mode)
forced = true; forced = true;
if (spec_num == 50) if (spec_num == 50)
forced = true; forced = true;
@@ -2782,7 +2958,7 @@ bool town_move_party(location destination,short forced)////
ter_num_t ter; ter_num_t ter;
bool check_f = false; bool check_f = false;
if (debug_on == true) if (in_scen_debug && ghost_mode)
forced = true; forced = true;
// remove if not registered // remove if not registered

View File

@@ -66,7 +66,6 @@ signed char dir_x_dif[9] = {0,1,1,1,0,-1,-1,-1,0};
signed char dir_y_dif[9] = {-1,-1,0,1,1,1,0,-1,0}; signed char dir_y_dif[9] = {-1,-1,0,1,1,1,0,-1,0};
bool game_run_before = false; bool game_run_before = false;
bool debug_on = false;
bool give_intro_hint = true; bool give_intro_hint = true;
bool in_scen_debug = false; bool in_scen_debug = false;
bool show_startup_splash = true; bool show_startup_splash = true;

View File

@@ -1543,7 +1543,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s
monst_damaged_mes(which_m,how_much,how_much_spec); monst_damaged_mes(which_m,how_much,how_much_spec);
victim->health = victim->health - how_much - how_much_spec; victim->health = victim->health - how_much - how_much_spec;
if (in_scen_debug == true) if (in_scen_debug)
victim->health = -1; victim->health = -1;
// splitting monsters // splitting monsters
@@ -1649,7 +1649,7 @@ void kill_monst(cCreature *which_m,short who_killed)
if (which_m->radiate_1 == 15) if (which_m->radiate_1 == 15)
run_special(12,0,which_m->radiate_2,which_m->cur_loc,&s1,&s2,&s3); run_special(12,0,which_m->radiate_2,which_m->cur_loc,&s1,&s2,&s3);
if ((in_scen_debug == false) && ((which_m->summoned >= 100) || (which_m->summoned == 0))) { // no xp for party-summoned monsters if ((!in_scen_debug) && ((which_m->summoned >= 100) || (which_m->summoned == 0))) { // no xp for party-summoned monsters
xp = which_m->level * 2; xp = which_m->level * 2;
if (who_killed < 6) if (who_killed < 6)
award_xp(who_killed,xp); award_xp(who_killed,xp);
@@ -1664,7 +1664,7 @@ void kill_monst(cCreature *which_m,short who_killed)
place_glands(l,which_m->number); place_glands(l,which_m->number);
} }
if ((in_scen_debug == false) && (which_m->summoned == 0)) if ((!in_scen_debug) && (which_m->summoned == 0))
place_treasure(which_m->cur_loc, which_m->level / 2, which_m->treasure, 0); place_treasure(which_m->cur_loc, which_m->level / 2, which_m->treasure, 0);
i = which_m->cur_loc.x; i = which_m->cur_loc.x;

View File

@@ -217,9 +217,9 @@ void give_error(char *text1, char *text2,short parent_num){
short store_str_label_1, store_str_label_2, store_str_label_1b, store_str_label_2b; short store_str_label_1, store_str_label_2, store_str_label_1b, store_str_label_2b;
// str_label_1 & str_label_2 uysed for saving button for journal // str_label_1 & str_label_2 uysed for saving button for journal
// 1000 + x scen 2000 + x out 3000 + x town // 1000 + x scen 2000 + x out 3000 + x town
void display_strings(char *text1, char *text2,short str_label_1,short str_label_2,short str_label_1b, void display_strings(const char *text1, const char *text2,short str_label_1,short str_label_2,short str_label_1b,
short str_label_2b, short str_label_2b,
char *title,short sound_num,short graphic_num,short graphic_type,short parent_num){ const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num){
short item_hit; short item_hit;
@@ -264,7 +264,7 @@ void display_strings(char *text1, char *text2,short str_label_1,short str_label_
} }
void display_strings(short a1,short a2, short b1, short b2, void display_strings(short a1,short a2, short b1, short b2,
char *title,short sound_num,short graphic_num,short graphic_type,short parent_num){ const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num){
Str255 str1 = "", str2 = ""; Str255 str1 = "", str2 = "";
if ((a1 > 0) && (a2 > 0)) if ((a1 > 0) && (a2 > 0))
@@ -315,8 +315,8 @@ short fancy_choice_dialog(short which_dlog,short parent)
return i; return i;
} }
void display_strings(char *text1, char *text2, void display_strings(const char *text1, const char *text2,
char *title,short sound_num,short graphic_num,short graphic_type,short parent_num){ const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num){
short item_hit; short item_hit;
location view_loc; location view_loc;

View File

@@ -11,9 +11,9 @@
short cd_create_custom_dialog(WindowPtr parent, Str255 strs[6],short pic_num,short btns[3]); short cd_create_custom_dialog(WindowPtr parent, Str255 strs[6],short pic_num,short btns[3]);
void oops_error(short error,short code = 0, short mode = 0); void oops_error(short error,short code = 0, short mode = 0);
void give_error(char *text1, char *text2,short parent_num); void give_error(char *text1, char *text2,short parent_num);
void display_strings(char *text1, char *text2,short str_label_1,short str_label_2,short str_label_1b, short str_label_2b, char *title,short sound_num,short graphic_num,short graphic_type,short parent_num) __attribute__((deprecated)); void display_strings(const char *text1, const char *text2,short str_label_1,short str_label_2,short str_label_1b, short str_label_2b, const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num) __attribute__((deprecated));
void display_strings(short a1,short a2, short b1, short b2, char *title,short sound_num,short graphic_num,short graphic_type,short parent_num); void display_strings(short a1,short a2, short b1, short b2, const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num);
void display_strings_event_filter (short item_hit); void display_strings_event_filter (short item_hit);
void fancy_choice_dialog_event_filter (short item_hit); void fancy_choice_dialog_event_filter (short item_hit);
short fancy_choice_dialog(short which_dlog,short parent); short fancy_choice_dialog(short which_dlog,short parent);
void display_strings(char *text1, char *text2, char *title,short sound_num,short graphic_num,short graphic_type,short parent_num); void display_strings(const char *text1, const char *text2,const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num);