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

@@ -1509,6 +1509,22 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
for (k = 0; k < (short) LOWORD(lParam); k++)
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':
if (in_scen_debug)
{
@@ -1523,6 +1539,16 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
print_buf();
break;
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_town()) FCD(1080,0);
if (is_combat()) FCD(1081,0);
@@ -1741,6 +1767,10 @@ Boolean handle_keystroke(WPARAM wParam, LPARAM lParam)
add_string_to_buf(" Not while in boat. ");
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);
start_town_mode(scenario.which_town_start,9);
position_party(scenario.out_sec_start.x,scenario.out_sec_start.y,

View File

@@ -30,6 +30,7 @@
#include "mathutil.h"
#include "fileio.h"
#include "dlgutil.h"
#include "dlgconsts.h"
Rect bottom_buttons[7];
Rect town_buttons[10];
@@ -52,6 +53,7 @@ Rect pc_buttons[6][5];
short num_chirps_played = 0;
extern Rect startup_button[6];
bool ghost_mode;
Rect startup_top;
// For menu spell casting, some info needs to be stored up here.
@@ -85,14 +87,13 @@ cOutdoors::cWandering store_wandering_special;
long dummy;
short store_shop_type;
short debug_ok = 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 eGameMode overall_mode;
extern Point to_create;
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
@@ -1551,11 +1552,12 @@ void initiate_outdoor_combat(short i)
draw_terrain();
}
bool handle_keystroke(char chr,char chr2,EventRecord event)
{
bool handle_keystroke(char chr,char chr2,EventRecord event){
bool are_done = false;
Point pass_point;
short i,j;
std::ostringstream sout;
char response[255];
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},
@@ -1589,10 +1591,10 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
ObscureCursor();
SetPort(GetWindowPort(mainPtr));
// DEBUG
// sprintf((char *) debug, "%d ",(short) chr2);
// add_string_to_buf((char *) debug);
// print_buf();
// DEBUG
// sprintf((char *) debug, "%d ",(short) chr2);
// add_string_to_buf((char *) debug);
// print_buf();
if (overall_mode == MODE_TALKING) {
if (chr2 == 53)
chr = 'd';
@@ -1663,21 +1665,19 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
break;
case '?':
if (is_out()) FCD(1079,0);
if (is_town()) FCD(1080,0);
if (is_combat()) FCD(1081,0);
if (overall_mode == MODE_SHOPPING) {
univ.party.help_received[26] = 0;
give_help(226,27,0);
}
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_town()) FCD(1080,0);
if (is_combat()) FCD(1081,0);
break;
case '1': case '2': case '3': case '4': case '5': case '6':
@@ -1711,13 +1711,10 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
case 'D':
if (in_scen_debug == true) {
if (in_scen_debug) {
in_scen_debug = false;
ASB("Debug mode OFF.");
}
else if (/*enter_password() == */false)
ASB("Password incorrect.");
else {
} else {
in_scen_debug = true;
ASB("Debug mode ON.");
}
@@ -1727,23 +1724,14 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
if (((overall_mode >= MODE_COMBAT) && (overall_mode < MODE_TALKING)) || (overall_mode == MODE_LOOK_COMBAT)) {
set_stat_window(current_pc);
put_item_screen(stat_window,0);
}
else {
} else {
set_stat_window(0);
put_item_screen(stat_window,0);
}
break;
case '=':
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;
}
if(!in_scen_debug) break;
univ.party.gold += 100;
univ.party.food += 100;
for (i = 0; i < 6; i++) {
@@ -1758,13 +1746,98 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
univ.party[i].mage_spells[j] = 1;
}
refresh_store_items();
add_string_to_buf("Debug: Add stuff and heal. ");
add_string_to_buf("Debug: Add stuff and heal.");
print_buf();
put_pc_screen();
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':
if (debug_on) {
if (!in_scen_debug) break;
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))
univ.town.monst[i].active = 0;
@@ -1773,15 +1846,112 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
&& (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);
// kill_monst(&univ.town.monst[i],6);
draw_terrain();
add_string_to_buf("Debug: Kill things. ");
print_buf();
}
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':
refresh_store_items();
@@ -1789,33 +1959,20 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
print_buf();
break;
case '`':
break;
case '[':
// case '`':
// break;
// case '[':
// break;
// case '+':
// break;
case '<':
//break;
debug_ok = 1;
return false;
break;
case '+':
//break;
if (debug_on == true) {
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)) {
if (!in_scen_debug) break;
ASB("Debug: Increase age.");
ASB(" It is now 1 day later.");
print_buf();
univ.party.age += 3700;
put_pc_screen();
}
break;
case '>':
ASB("DEBUG: Towns have short memory.");
@@ -1824,6 +1981,30 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
for (i = 0; i < 4; i++)
univ.party.creature_save[i].which_town = 200;
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':
if (overall_mode < MODE_TALK_TOWN) {
pass_point.h = (overall_mode == MODE_OUTDOORS) ? 170 : 221;
@@ -1832,7 +2013,6 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
event.where = pass_point;
are_done = handle_action(event);
}
break;
case 'b': case 'u': case 'L':
@@ -1923,10 +2103,6 @@ bool handle_keystroke(char chr,char chr2,EventRecord event)
}
break;
}
debug_ok = 0;
spell_forced = false;
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);
if (check_f == true)
forced = true;
if (debug_on == true)
if (in_scen_debug && ghost_mode)
forced = true;
if (spec_num == 50)
forced = true;
@@ -2782,7 +2958,7 @@ bool town_move_party(location destination,short forced)////
ter_num_t ter;
bool check_f = false;
if (debug_on == true)
if (in_scen_debug && ghost_mode)
forced = true;
// 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};
bool game_run_before = false;
bool debug_on = false;
bool give_intro_hint = true;
bool in_scen_debug = false;
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);
victim->health = victim->health - how_much - how_much_spec;
if (in_scen_debug == true)
if (in_scen_debug)
victim->health = -1;
// splitting monsters
@@ -1649,7 +1649,7 @@ void kill_monst(cCreature *which_m,short who_killed)
if (which_m->radiate_1 == 15)
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;
if (who_killed < 6)
award_xp(who_killed,xp);
@@ -1664,7 +1664,7 @@ void kill_monst(cCreature *which_m,short who_killed)
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);
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;
// str_label_1 & str_label_2 uysed for saving button for journal
// 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,
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;
@@ -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,
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 = "";
if ((a1 > 0) && (a2 > 0))
@@ -315,8 +315,8 @@ short fancy_choice_dialog(short which_dlog,short parent)
return i;
}
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){
short item_hit;
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]);
void oops_error(short error,short code = 0, short mode = 0);
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(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(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, const char *title,short sound_num,short graphic_num,short graphic_type,short parent_num);
void display_strings_event_filter (short item_hit);
void fancy_choice_dialog_event_filter (short item_hit);
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);