- Tidied scenario editor code – proper indentation applied, no more multiple statements on one line, etc
- Changed various terrain arrays from unsigned char to unsigned short to support more than 256 terrain types. git-svn-id: http://openexile.googlecode.com/svn/trunk@42 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
@@ -1093,39 +1093,13 @@
|
|||||||
GCC_INPUT_FILETYPE = sourcecode.cpp.cpp;
|
GCC_INPUT_FILETYPE = sourcecode.cpp.cpp;
|
||||||
GCC_MODEL_TUNING = G4;
|
GCC_MODEL_TUNING = G4;
|
||||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
||||||
|
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO;
|
||||||
|
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||||
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
|
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_MISSING_PARENTHESES = YES;
|
||||||
GCC_WARN_UNUSED_LABEL = YES;
|
GCC_WARN_PROTOTYPE_CONVERSION = YES;
|
||||||
GCC_WARN_UNUSED_PARAMETER = YES;
|
|
||||||
GCC_WARN_UNUSED_VALUE = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
HEADER_SEARCH_PATHS = "/usr/include/c++/4.0.0/";
|
|
||||||
LIBRARY_SEARCH_PATHS = "";
|
|
||||||
LINK_WITH_STANDARD_LIBRARIES = YES;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
|
|
||||||
OTHER_LDFLAGS_QUOTED_FOR_PROJECT_1 = "\"$(PROJECT_DIR)/misc/\"";
|
|
||||||
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
|
|
||||||
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
|
|
||||||
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
|
|
||||||
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
|
|
||||||
STRIP_INSTALLED_PRODUCT = NO;
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
2BF04AA40BF51845006C0831 /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ARCHS = (
|
|
||||||
i386,
|
|
||||||
ppc,
|
|
||||||
);
|
|
||||||
COPY_PHASE_STRIP = YES;
|
|
||||||
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
|
|
||||||
GCC_INPUT_FILETYPE = sourcecode.cpp.cpp;
|
|
||||||
GCC_ONE_BYTE_BOOL = YES;
|
|
||||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
|
||||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
|
|
||||||
GCC_WARN_SIGN_COMPARE = YES;
|
GCC_WARN_SIGN_COMPARE = YES;
|
||||||
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
|
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
@@ -1143,7 +1117,56 @@
|
|||||||
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
|
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||||
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
|
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||||
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
|
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
|
||||||
WARNING_CFLAGS = "float-equal";
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
|
WARNING_CFLAGS = (
|
||||||
|
"-Wfloat-equal",
|
||||||
|
"-Wpadded",
|
||||||
|
"-Wno-long-long",
|
||||||
|
);
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
2BF04AA40BF51845006C0831 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ARCHS = (
|
||||||
|
i386,
|
||||||
|
ppc,
|
||||||
|
);
|
||||||
|
COPY_PHASE_STRIP = YES;
|
||||||
|
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
|
||||||
|
GCC_INPUT_FILETYPE = sourcecode.cpp.cpp;
|
||||||
|
GCC_ONE_BYTE_BOOL = YES;
|
||||||
|
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
|
||||||
|
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO;
|
||||||
|
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||||
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
|
||||||
|
GCC_WARN_MISSING_PARENTHESES = YES;
|
||||||
|
GCC_WARN_PROTOTYPE_CONVERSION = YES;
|
||||||
|
GCC_WARN_SIGN_COMPARE = YES;
|
||||||
|
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_LABEL = YES;
|
||||||
|
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||||
|
GCC_WARN_UNUSED_VALUE = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
HEADER_SEARCH_PATHS = "/usr/include/c++/4.0.0/";
|
||||||
|
LIBRARY_SEARCH_PATHS = "";
|
||||||
|
LINK_WITH_STANDARD_LIBRARIES = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
|
||||||
|
OTHER_LDFLAGS_QUOTED_FOR_PROJECT_1 = "\"$(PROJECT_DIR)/misc/\"";
|
||||||
|
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
|
||||||
|
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||||
|
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||||
|
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
|
||||||
|
WARNING_CFLAGS = (
|
||||||
|
"-Wfloat-equal",
|
||||||
|
"-Wpadded",
|
||||||
|
"-Wno-long-long",
|
||||||
|
);
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
|||||||
#include "scen.btnmg.h"
|
#include "scen.btnmg.h"
|
||||||
|
|
||||||
//extern piles_of_stuff_dumping_type *data_store;
|
//extern piles_of_stuff_dumping_type *data_store;
|
||||||
extern Rect right_sbar_rect;
|
extern Rect right_sbar_rect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ char strings_rs[NRS][40];
|
|||||||
|
|
||||||
bool left_buttons_active = 1,right_buttons_active = 0;
|
bool left_buttons_active = 1,right_buttons_active = 0;
|
||||||
extern short left_button_status[NLS]; // 0 - clear, 1 - text, 2 - title text, 3 - tabbed text, +10 - button
|
extern short left_button_status[NLS]; // 0 - clear, 1 - text, 2 - title text, 3 - tabbed text, +10 - button
|
||||||
extern short right_button_status[NRS];
|
extern short right_button_status[NRS];
|
||||||
extern ControlHandle right_sbar;
|
extern ControlHandle right_sbar;
|
||||||
// 0 - clear
|
// 0 - clear
|
||||||
// 1000 + x - terrain type x
|
// 1000 + x - terrain type x
|
||||||
@@ -49,21 +49,20 @@ void init_lb() {
|
|||||||
for (i = 0; i < NLS; i++) {
|
for (i = 0; i < NLS; i++) {
|
||||||
left_button_status[i] = 0;
|
left_button_status[i] = 0;
|
||||||
sprintf((char *) strings_ls[i], "");
|
sprintf((char *) strings_ls[i], "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_lb() {
|
void reset_lb() {
|
||||||
short i;
|
short i;
|
||||||
for (i = 0; i < NLS; i++) {
|
for (i = 0; i < NLS; i++) {
|
||||||
left_button_status[i] = 0;
|
left_button_status[i] = 0;
|
||||||
draw_lb_slot(i,0);
|
draw_lb_slot(i,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// is slot >= 0, force that slot
|
// is slot >= 0, force that slot
|
||||||
// if -1, use 1st free slot
|
// if -1, use 1st free slot
|
||||||
void set_lb(short slot, short mode, char *label, short do_draw)
|
void set_lb(short slot, short mode, char *label, short do_draw) {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
if (slot < 0) {
|
if (slot < 0) {
|
||||||
@@ -71,23 +70,22 @@ void set_lb(short slot, short mode, char *label, short do_draw)
|
|||||||
if (left_button_status[i] == 0) {
|
if (left_button_status[i] == 0) {
|
||||||
slot = i;
|
slot = i;
|
||||||
i = NLS + 5000;
|
i = NLS + 5000;
|
||||||
}
|
}
|
||||||
if (i < NLS + 5000)
|
if (i < NLS + 5000)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
left_button_status[slot] = mode;
|
left_button_status[slot] = mode;
|
||||||
//sprintf((char *)strings_ls[slot], "%-39.39s", label);
|
//sprintf((char *)strings_ls[slot], "%-39.39s", label);
|
||||||
sprintf((char *)strings_ls[slot], "%-50.50s", label);
|
sprintf((char *)strings_ls[slot], "%-50.50s", label);
|
||||||
strings_ls[slot][39] = 0;
|
strings_ls[slot][39] = 0;
|
||||||
if (do_draw > 0)
|
if (do_draw > 0)
|
||||||
draw_lb_slot(slot,0);
|
draw_lb_slot(slot,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void init_rb()
|
void init_rb() {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
SetControlMinimum(right_sbar,0);
|
SetControlMinimum(right_sbar,0);
|
||||||
@@ -95,16 +93,15 @@ void init_rb()
|
|||||||
for (i = 0; i < NRS; i++) {
|
for (i = 0; i < NRS; i++) {
|
||||||
right_button_status[i] = 0;
|
right_button_status[i] = 0;
|
||||||
sprintf((char *) strings_rs[i], "");
|
sprintf((char *) strings_rs[i], "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_rb()
|
void reset_rb() {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
for (i = 0; i < NRS; i++) {
|
for (i = 0; i < NRS; i++) {
|
||||||
right_button_status[i] = 0;
|
right_button_status[i] = 0;
|
||||||
}
|
}
|
||||||
draw_rb();
|
draw_rb();
|
||||||
SetControlMaximum(right_sbar,0);
|
SetControlMaximum(right_sbar,0);
|
||||||
SetControlValue(right_sbar,0);
|
SetControlValue(right_sbar,0);
|
||||||
@@ -112,8 +109,7 @@ void reset_rb()
|
|||||||
|
|
||||||
// is slot >= 0, force that slot
|
// is slot >= 0, force that slot
|
||||||
// if -1, use 1st free slot
|
// if -1, use 1st free slot
|
||||||
void set_rb(short slot, short mode, char *label, short do_draw)
|
void set_rb(short slot, short mode, char *label, short do_draw) {
|
||||||
{
|
|
||||||
short i,highest_used = 0;
|
short i,highest_used = 0;
|
||||||
|
|
||||||
if (slot < 0) {
|
if (slot < 0) {
|
||||||
@@ -121,10 +117,10 @@ void set_rb(short slot, short mode, char *label, short do_draw)
|
|||||||
if (right_button_status[i] == 0) {
|
if (right_button_status[i] == 0) {
|
||||||
slot = i;
|
slot = i;
|
||||||
i = NRS + 5000;
|
i = NRS + 5000;
|
||||||
}
|
}
|
||||||
if (i < NRS + 5000)
|
if (i < NRS + 5000)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
right_button_status[slot] = mode;
|
right_button_status[slot] = mode;
|
||||||
//sprintf((char *)strings_rs[slot], "%-39.39s", label);
|
//sprintf((char *)strings_rs[slot], "%-39.39s", label);
|
||||||
sprintf((char *)strings_rs[slot], "%s", label);
|
sprintf((char *)strings_rs[slot], "%s", label);
|
||||||
@@ -134,16 +130,16 @@ void set_rb(short slot, short mode, char *label, short do_draw)
|
|||||||
strings_rs[slot][i] = ' ';
|
strings_rs[slot][i] = ' ';
|
||||||
if (do_draw > 0)
|
if (do_draw > 0)
|
||||||
draw_rb_slot(slot,0);
|
draw_rb_slot(slot,0);
|
||||||
/* for (i = 0; i < NRS; i++)
|
/* for (i = 0; i < NRS; i++)
|
||||||
if (right_button_status[i] != 0)
|
if (right_button_status[i] != 0)
|
||||||
highest_used = i;
|
highest_used = i;
|
||||||
if (highest_used < NRSONPAGE - 1) {
|
if (highest_used < NRSONPAGE - 1) {
|
||||||
SetControlMaximum(right_sbar,0);
|
SetControlMaximum(right_sbar,0);
|
||||||
current_rs_top = 0;
|
current_rs_top = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SetControlMaximum(right_sbar,highest_used - NRSONPAGE - 1);
|
SetControlMaximum(right_sbar,highest_used - NRSONPAGE - 1);
|
||||||
//SetControlValue(right_sbar,new_setting);
|
//SetControlValue(right_sbar,new_setting);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -3,20 +3,18 @@
|
|||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
#include "scen.dlgutil.h"
|
#include "scen.dlgutil.h"
|
||||||
|
|
||||||
DialogPtr make_dialog(int resource_num)
|
DialogPtr make_dialog(int resource_num) {
|
||||||
{
|
|
||||||
DialogPtr the_dialog;
|
DialogPtr the_dialog;
|
||||||
|
|
||||||
the_dialog = GetNewDialog (resource_num, 0, IN_FRONT);
|
the_dialog = GetNewDialog (resource_num, 0, IN_FRONT);
|
||||||
if (the_dialog == NULL)
|
if (the_dialog == NULL)
|
||||||
SysBeep(50);
|
SysBeep(50);
|
||||||
ShowWindow (GetDialogWindow(the_dialog));
|
ShowWindow (GetDialogWindow(the_dialog));
|
||||||
|
|
||||||
return the_dialog;
|
return the_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_num_in_text(short num_to_put,DialogPtr the_dialog, short item_num)
|
void put_num_in_text(short num_to_put,DialogPtr the_dialog, short item_num) {
|
||||||
{
|
|
||||||
Str255 text_entry;
|
Str255 text_entry;
|
||||||
short the_type;
|
short the_type;
|
||||||
Handle the_handle = NULL;
|
Handle the_handle = NULL;
|
||||||
@@ -24,26 +22,25 @@ void put_num_in_text(short num_to_put,DialogPtr the_dialog, short item_num)
|
|||||||
|
|
||||||
NumToString ((long) num_to_put , text_entry);
|
NumToString ((long) num_to_put , text_entry);
|
||||||
GetDialogItem( the_dialog, item_num, &the_type, &the_handle, &the_rect );
|
GetDialogItem( the_dialog, item_num, &the_type, &the_handle, &the_rect );
|
||||||
SetDialogItemText ( the_handle, text_entry);
|
SetDialogItemText ( the_handle, text_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
long get_text_item_num(short item_num,DialogPtr the_dialog)
|
long get_text_item_num(short item_num,DialogPtr the_dialog) {
|
||||||
{
|
|
||||||
long storage;
|
long storage;
|
||||||
long number_given = 0;
|
long number_given = 0;
|
||||||
|
|
||||||
short the_type;
|
short the_type;
|
||||||
Handle the_handle = NULL;
|
Handle the_handle = NULL;
|
||||||
Rect the_rect;
|
Rect the_rect;
|
||||||
Str255 the_string;
|
Str255 the_string;
|
||||||
|
|
||||||
GetDialogItem( the_dialog, item_num, &the_type, &the_handle, &the_rect );
|
GetDialogItem( the_dialog, item_num, &the_type, &the_handle, &the_rect );
|
||||||
|
|
||||||
GetDialogItemText ( the_handle, the_string);
|
GetDialogItemText ( the_handle, the_string);
|
||||||
|
|
||||||
StringToNum( the_string, &number_given);
|
StringToNum( the_string, &number_given);
|
||||||
storage = number_given;
|
storage = number_given;
|
||||||
|
|
||||||
return storage;
|
return storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ cUniverse univ; // not needed; just to silence the compiler
|
|||||||
Rect windRect, Drag_Rect;
|
Rect windRect, Drag_Rect;
|
||||||
bool All_Done = false; // delete play_sounds
|
bool All_Done = false; // delete play_sounds
|
||||||
EventRecord event;
|
EventRecord event;
|
||||||
WindowPtr mainPtr;
|
WindowPtr mainPtr;
|
||||||
cTown* town = NULL;
|
cTown* town = NULL;
|
||||||
//big_tr_type t_d;
|
//big_tr_type t_d;
|
||||||
bool diff_depth_ok = false,mouse_button_held = false,editing_town = false;
|
bool diff_depth_ok = false,mouse_button_held = false,editing_town = false;
|
||||||
@@ -85,15 +85,14 @@ bool mac_is_intel;
|
|||||||
//
|
//
|
||||||
|
|
||||||
//Changed to ISO C specified argument and return type.
|
//Changed to ISO C specified argument and return type.
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
|
|
||||||
short j,k;
|
short j,k;
|
||||||
long i;
|
long i;
|
||||||
size_t size;
|
size_t size;
|
||||||
//outdoor_record_type dummy_outdoor, *store2;
|
//outdoor_record_type dummy_outdoor, *store2;
|
||||||
|
|
||||||
|
|
||||||
//data_store = (piles_of_stuff_dumping_type *) NewPtr(sizeof(piles_of_stuff_dumping_type));
|
//data_store = (piles_of_stuff_dumping_type *) NewPtr(sizeof(piles_of_stuff_dumping_type));
|
||||||
init_current_terrain();
|
init_current_terrain();
|
||||||
//create_file();
|
//create_file();
|
||||||
@@ -107,9 +106,10 @@ int main(void)
|
|||||||
init_dialogs();
|
init_dialogs();
|
||||||
Point p = {0,0};
|
Point p = {0,0};
|
||||||
init_graph_tool(redraw_screen,NULL);
|
init_graph_tool(redraw_screen,NULL);
|
||||||
|
|
||||||
cen_x = 18; cen_y = 18;
|
cen_x = 18;
|
||||||
|
cen_y = 18;
|
||||||
|
|
||||||
run_startup_g();
|
run_startup_g();
|
||||||
init_lb();
|
init_lb();
|
||||||
init_rb();
|
init_rb();
|
||||||
@@ -123,36 +123,38 @@ int main(void)
|
|||||||
|
|
||||||
Set_up_win();
|
Set_up_win();
|
||||||
init_screen_locs();
|
init_screen_locs();
|
||||||
|
|
||||||
//create_basic_scenario();
|
//create_basic_scenario();
|
||||||
|
|
||||||
menu_bar_handle = GetNewMBar(128);
|
menu_bar_handle = GetNewMBar(128);
|
||||||
if (menu_bar_handle == NULL) {
|
if (menu_bar_handle == NULL) {
|
||||||
SysBeep(50); SysBeep(50); SysBeep(50);
|
SysBeep(50);
|
||||||
|
SysBeep(50);
|
||||||
|
SysBeep(50);
|
||||||
ExitToShell();
|
ExitToShell();
|
||||||
}
|
}
|
||||||
SetMenuBar(menu_bar_handle);
|
SetMenuBar(menu_bar_handle);
|
||||||
DisposeHandle(menu_bar_handle);
|
DisposeHandle(menu_bar_handle);
|
||||||
|
|
||||||
apple_menu = GetMenuHandle(500);
|
apple_menu = GetMenuHandle(500);
|
||||||
/*file_menu = GetMenuHandle(550);
|
/*file_menu = GetMenuHandle(550);
|
||||||
options_menu = GetMenuHandle(600);
|
options_menu = GetMenuHandle(600);
|
||||||
create_menu = GetMenuHandle(650);
|
create_menu = GetMenuHandle(650);
|
||||||
items_menu = GetMenuHandle(700);*/
|
items_menu = GetMenuHandle(700);*/
|
||||||
|
|
||||||
AppendResMenu(apple_menu, 'DRVR');
|
AppendResMenu(apple_menu, 'DRVR');
|
||||||
shut_down_menus(0);
|
shut_down_menus(0);
|
||||||
DrawMenuBar();
|
DrawMenuBar();
|
||||||
|
|
||||||
//update_item_menu();
|
//update_item_menu();
|
||||||
|
|
||||||
// to_create = get_town_to_edit();
|
// to_create = get_town_to_edit();
|
||||||
|
|
||||||
// load_terrain(to_create);
|
// load_terrain(to_create);
|
||||||
|
|
||||||
// modify_lists();
|
// modify_lists();
|
||||||
set_up_start_screen();
|
set_up_start_screen();
|
||||||
|
|
||||||
TextFace(bold);
|
TextFace(bold);
|
||||||
check_for_intel();
|
check_for_intel();
|
||||||
redraw_screen();
|
redraw_screen();
|
||||||
@@ -161,7 +163,7 @@ int main(void)
|
|||||||
Handle_One_Event();
|
Handle_One_Event();
|
||||||
|
|
||||||
close_program();
|
close_program();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -169,16 +171,15 @@ int main(void)
|
|||||||
//
|
//
|
||||||
|
|
||||||
//MW specified argument and return type.
|
//MW specified argument and return type.
|
||||||
void Initialize(void)
|
void Initialize(void) {
|
||||||
{
|
|
||||||
|
|
||||||
Str255 tit = " ";
|
Str255 tit = " ";
|
||||||
OSErr error;
|
OSErr error;
|
||||||
|
|
||||||
|
|
||||||
/* Initialize all the needed managers. */
|
/* Initialize all the needed managers. */
|
||||||
InitCursor();
|
InitCursor();
|
||||||
|
|
||||||
//
|
//
|
||||||
// To make the Random sequences truly random, we need to make the seed start
|
// To make the Random sequences truly random, we need to make the seed start
|
||||||
// at a different number. An easy way to do this is to put the current time
|
// at a different number. An easy way to do this is to put the current time
|
||||||
@@ -190,7 +191,7 @@ void Initialize(void)
|
|||||||
//GetDateTime(&time);
|
//GetDateTime(&time);
|
||||||
//SetQDGlobalsRandomSeed(time);
|
//SetQDGlobalsRandomSeed(time);
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make a new window for drawing in, and it must be a color window.
|
// Make a new window for drawing in, and it must be a color window.
|
||||||
// The window is full screen size, made smaller to make it more visible.
|
// The window is full screen size, made smaller to make it more visible.
|
||||||
@@ -198,15 +199,15 @@ void Initialize(void)
|
|||||||
BitMap bmap;
|
BitMap bmap;
|
||||||
GetQDGlobalsScreenBits(&bmap);
|
GetQDGlobalsScreenBits(&bmap);
|
||||||
windRect = bmap.bounds;
|
windRect = bmap.bounds;
|
||||||
|
|
||||||
find_quickdraw();
|
find_quickdraw();
|
||||||
set_pixel_depth();
|
set_pixel_depth();
|
||||||
|
|
||||||
//InsetRect(&windRect, 5, 34);
|
//InsetRect(&windRect, 5, 34);
|
||||||
InsetRect(&windRect,(windRect.right - 584) / 2,(windRect.bottom - 420) / 2);
|
InsetRect(&windRect,(windRect.right - 584) / 2,(windRect.bottom - 420) / 2);
|
||||||
OffsetRect(&windRect,0,18);
|
OffsetRect(&windRect,0,18);
|
||||||
mainPtr = NewCWindow(nil, &windRect, "\pBlades of Exile Scenario Editor", true, documentProc,
|
mainPtr = NewCWindow(nil, &windRect, "\pBlades of Exile Scenario Editor", true, documentProc,
|
||||||
(WindowPtr) -1, false, 0);
|
(WindowPtr) -1, false, 0);
|
||||||
GetWindowPortBounds(mainPtr,&windRect);
|
GetWindowPortBounds(mainPtr,&windRect);
|
||||||
SetPortWindowPort(mainPtr); /* set window to current graf port */
|
SetPortWindowPort(mainPtr); /* set window to current graf port */
|
||||||
right_sbar_rect.top = RIGHT_AREA_UL_Y;
|
right_sbar_rect.top = RIGHT_AREA_UL_Y;
|
||||||
@@ -214,7 +215,7 @@ void Initialize(void)
|
|||||||
right_sbar_rect.bottom = RIGHT_AREA_UL_Y + RIGHT_AREA_HEIGHT;
|
right_sbar_rect.bottom = RIGHT_AREA_UL_Y + RIGHT_AREA_HEIGHT;
|
||||||
right_sbar_rect.right = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH - 1;
|
right_sbar_rect.right = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH - 1;
|
||||||
right_sbar = NewControl(mainPtr,&right_sbar_rect,tit,true,0,0,0,scrollBarProc,1);
|
right_sbar = NewControl(mainPtr,&right_sbar_rect,tit,true,0,0,0,scrollBarProc,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_for_intel(){
|
void check_for_intel(){
|
||||||
@@ -229,53 +230,51 @@ void check_for_intel(){
|
|||||||
else mac_is_intel = false;
|
else mac_is_intel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Set_Window_Drag_Bdry()
|
void Set_Window_Drag_Bdry() {
|
||||||
{
|
|
||||||
BitMap bmap;
|
BitMap bmap;
|
||||||
GetQDGlobalsScreenBits(&bmap);
|
GetQDGlobalsScreenBits(&bmap);
|
||||||
Drag_Rect = bmap.bounds;
|
Drag_Rect = bmap.bounds;
|
||||||
// Drag_Rect = (**(GrayRgn)).rgnBBox;
|
// Drag_Rect = (**(GrayRgn)).rgnBBox;
|
||||||
Drag_Rect.left += DRAG_EDGE;
|
Drag_Rect.left += DRAG_EDGE;
|
||||||
Drag_Rect.right -= DRAG_EDGE;
|
Drag_Rect.right -= DRAG_EDGE;
|
||||||
Drag_Rect.bottom -= DRAG_EDGE;
|
Drag_Rect.bottom -= DRAG_EDGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Handle_One_Event()
|
void Handle_One_Event() {
|
||||||
{
|
|
||||||
short chr,chr2;
|
short chr,chr2;
|
||||||
long menu_choice;
|
long menu_choice;
|
||||||
|
|
||||||
|
|
||||||
WaitNextEvent(everyEvent, &event, SLEEP_TICKS, MOUSE_REGION);
|
WaitNextEvent(everyEvent, &event, SLEEP_TICKS, MOUSE_REGION);
|
||||||
if ((mouse_button_held == true) && (event.what != 23) && (FrontWindow() == mainPtr)) {
|
if ((mouse_button_held == true) && (event.what != 23) && (FrontWindow() == mainPtr)) {
|
||||||
GlobalToLocal(&event.where);
|
GlobalToLocal(&event.where);
|
||||||
handle_action(event.where,event);
|
handle_action(event.where,event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (event.what)
|
switch (event.what)
|
||||||
{
|
{
|
||||||
case keyDown: case autoKey:
|
case keyDown: case autoKey:
|
||||||
chr = event.message & charCodeMask;
|
chr = event.message & charCodeMask;
|
||||||
chr2 = (char) ((event.message & keyCodeMask) >> 8);
|
chr2 = (char) ((event.message & keyCodeMask) >> 8);
|
||||||
if ((event.modifiers & cmdKey) != 0) {
|
if ((event.modifiers & cmdKey) != 0) {
|
||||||
if (event.what != autoKey) {
|
if (event.what != autoKey) {
|
||||||
BringToFront(mainPtr);
|
BringToFront(mainPtr);
|
||||||
SetPortWindowPort(mainPtr);
|
SetPortWindowPort(mainPtr);
|
||||||
menu_choice = MenuKey(chr);
|
menu_choice = MenuKey(chr);
|
||||||
handle_menu_choice(menu_choice);
|
handle_menu_choice(menu_choice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (chr == 'Q')
|
else if (chr == 'Q')
|
||||||
All_Done = true;
|
All_Done = true;
|
||||||
else handle_keystroke(chr,chr2,event);
|
else handle_keystroke(chr,chr2,event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mouseDown:
|
case mouseDown:
|
||||||
Mouse_Pressed();
|
Mouse_Pressed();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case mouseUp:
|
case mouseUp:
|
||||||
mouse_button_held = false;
|
mouse_button_held = false;
|
||||||
break;
|
break;
|
||||||
@@ -283,21 +282,19 @@ void Handle_One_Event()
|
|||||||
case activateEvt:
|
case activateEvt:
|
||||||
Handle_Activate();
|
Handle_Activate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case updateEvt:
|
case updateEvt:
|
||||||
Handle_Update();
|
Handle_Update();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Handle_Activate()
|
void Handle_Activate() {
|
||||||
{
|
|
||||||
restore_cursor();
|
restore_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Handle_Update()
|
void Handle_Update() {
|
||||||
{
|
|
||||||
WindowPtr the_window;
|
WindowPtr the_window;
|
||||||
GrafPtr old_port;
|
GrafPtr old_port;
|
||||||
|
|
||||||
@@ -315,14 +312,13 @@ void Handle_Update()
|
|||||||
restore_cursor();
|
restore_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_menu_choice(long choice)
|
void handle_menu_choice(long choice) {
|
||||||
{
|
|
||||||
int menu,menu_item;
|
int menu,menu_item;
|
||||||
|
|
||||||
if (choice != 0) {
|
if (choice != 0) {
|
||||||
menu = HiWord(choice);
|
menu = HiWord(choice);
|
||||||
menu_item = LoWord(choice);
|
menu_item = LoWord(choice);
|
||||||
|
|
||||||
set_cursor(0);
|
set_cursor(0);
|
||||||
switch (menu) {
|
switch (menu) {
|
||||||
case 500:
|
case 500:
|
||||||
@@ -349,14 +345,13 @@ void handle_menu_choice(long choice)
|
|||||||
case 750: case 751: case 752: case 753:
|
case 750: case 751: case 752: case 753:
|
||||||
handle_monst_menu(menu_item + 64 * (menu - 750) - 1);
|
handle_monst_menu(menu_item + 64 * (menu - 750) - 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_apple_menu(int item_hit)
|
void handle_apple_menu(int item_hit) {
|
||||||
{
|
|
||||||
Str255 desk_acc_name;
|
Str255 desk_acc_name;
|
||||||
short desk_acc_num;
|
short desk_acc_num;
|
||||||
|
|
||||||
@@ -365,15 +360,14 @@ void handle_apple_menu(int item_hit)
|
|||||||
fancy_choice_dialog(1062,0);
|
fancy_choice_dialog(1062,0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// GetItem (apple_menu,item_hit,desk_acc_name);
|
// GetItem (apple_menu,item_hit,desk_acc_name);
|
||||||
// desk_acc_num = OpenDeskAcc(desk_acc_name);
|
// desk_acc_num = OpenDeskAcc(desk_acc_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handle_file_menu(int item_hit)
|
void handle_file_menu(int item_hit) {
|
||||||
{
|
|
||||||
short create;
|
short create;
|
||||||
|
|
||||||
switch (item_hit) {
|
switch (item_hit) {
|
||||||
@@ -401,31 +395,30 @@ void handle_file_menu(int item_hit)
|
|||||||
if (overall_mode == MODE_MAIN_SCREEN)
|
if (overall_mode == MODE_MAIN_SCREEN)
|
||||||
set_up_main_screen();
|
set_up_main_screen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // quit
|
case 5: // quit
|
||||||
if (save_check(869) == false)
|
if (save_check(869) == false)
|
||||||
break;
|
break;
|
||||||
ExitToShell();
|
ExitToShell();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_scenario_menu(int item_hit)
|
void handle_scenario_menu(int item_hit) {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
switch (item_hit) {
|
switch (item_hit) {
|
||||||
case 1: // Create new town
|
case 1: // Create new town
|
||||||
if (change_made == true) {
|
if (change_made == true) {
|
||||||
give_error("You need to save the changes made to your scenario before you can add a new town.",
|
give_error("You need to save the changes made to your scenario before you can add a new town.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (scenario.num_towns >= 200) {
|
if (scenario.num_towns >= 200) {
|
||||||
give_error("You have reached the limit of 200 towns you can have in one scenario.",
|
give_error("You have reached the limit of 200 towns you can have in one scenario.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (new_town(scenario.num_towns) == true)
|
if (new_town(scenario.num_towns) == true)
|
||||||
set_up_main_screen();
|
set_up_main_screen();
|
||||||
break;
|
break;
|
||||||
@@ -446,17 +439,19 @@ void handle_scenario_menu(int item_hit)
|
|||||||
//give_error("Passwords have been disabled; they are no longer necessary.","",0);
|
//give_error("Passwords have been disabled; they are no longer necessary.","",0);
|
||||||
break;
|
break;
|
||||||
case 9: // Edit Special Nodes
|
case 9: // Edit Special Nodes
|
||||||
SetControlValue(right_sbar,0); start_special_editing(0,0);
|
SetControlValue(right_sbar,0);
|
||||||
|
start_special_editing(0,0);
|
||||||
break;
|
break;
|
||||||
case 10: // Edit Scenario Text
|
case 10: // Edit Scenario Text
|
||||||
SetControlValue(right_sbar,0); start_string_editing(0,0);
|
SetControlValue(right_sbar,0);
|
||||||
|
start_string_editing(0,0);
|
||||||
break;
|
break;
|
||||||
case 11: // Import Town
|
case 11: // Import Town
|
||||||
if (change_made == true) {
|
if (change_made == true) {
|
||||||
give_error("You need to save the changes made to your scenario before you can add a new town.",
|
give_error("You need to save the changes made to your scenario before you can add a new town.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FSSpec file;
|
FSSpec file;
|
||||||
i = pick_import_town(0,&file);
|
i = pick_import_town(0,&file);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
@@ -486,24 +481,24 @@ void handle_scenario_menu(int item_hit)
|
|||||||
case 18: // Delete Last Town
|
case 18: // Delete Last Town
|
||||||
if (change_made == true) {
|
if (change_made == true) {
|
||||||
give_error("You need to save the changes made to your scenario before you can delete a town.",
|
give_error("You need to save the changes made to your scenario before you can delete a town.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (scenario.num_towns == 1) {
|
if (scenario.num_towns == 1) {
|
||||||
give_error("You can't delete the last town in a scenario. All scenarios must have at least 1 town.",
|
give_error("You can't delete the last town in a scenario. All scenarios must have at least 1 town.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (scenario.num_towns - 1 == cur_town) {
|
if (scenario.num_towns - 1 == cur_town) {
|
||||||
give_error("You can't delete the last town in a scenario while you're working on it. Load a different town, and try this again.",
|
give_error("You can't delete the last town in a scenario while you're working on it. Load a different town, and try this again.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (scenario.num_towns - 1 == scenario.which_town_start) {
|
if (scenario.num_towns - 1 == scenario.which_town_start) {
|
||||||
give_error("You can't delete the last town in a scenario while it's the town the party starts the scenario in. Change the parties starting point and try this again.",
|
give_error("You can't delete the last town in a scenario while it's the town the party starts the scenario in. Change the parties starting point and try this again.",
|
||||||
"",0);
|
"",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fancy_choice_dialog(865,0) == 1)
|
if (fancy_choice_dialog(865,0) == 1)
|
||||||
delete_last_town();
|
delete_last_town();
|
||||||
break;
|
break;
|
||||||
@@ -516,101 +511,147 @@ void handle_scenario_menu(int item_hit)
|
|||||||
scen_text_dump();
|
scen_text_dump();
|
||||||
redraw_screen();
|
redraw_screen();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((item_hit != 18) && (item_hit != 19))
|
if ((item_hit != 18) && (item_hit != 19))
|
||||||
change_made = true;
|
change_made = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_town_menu(int item_hit)
|
void handle_town_menu(int item_hit) {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
change_made = true;
|
change_made = true;
|
||||||
switch (item_hit) {
|
switch (item_hit) {
|
||||||
case 1: edit_town_details(); break;
|
case 1:
|
||||||
case 2: edit_town_wand(); break;
|
edit_town_details();
|
||||||
case 3: overall_mode = MODE_SET_TOWN_RECT;
|
break;
|
||||||
|
case 2:
|
||||||
|
edit_town_wand();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
overall_mode = MODE_SET_TOWN_RECT;
|
||||||
mode_count = 2;
|
mode_count = 2;
|
||||||
set_cursor(5);
|
set_cursor(5);
|
||||||
set_string("Set town boundary","Select upper left corner");
|
set_string("Set town boundary","Select upper left corner");
|
||||||
break;
|
break;
|
||||||
case 4: frill_up_terrain(); break;
|
case 4:
|
||||||
case 5: unfrill_terrain(); break;
|
frill_up_terrain();
|
||||||
case 6: edit_town_strs(); break;
|
break;
|
||||||
case 8: if (fancy_choice_dialog(863,0) == 2)
|
case 5:
|
||||||
break;
|
unfrill_terrain();
|
||||||
place_items_in_town();
|
break;
|
||||||
break; // add random
|
case 6:
|
||||||
case 9: for (i = 0; i < 64; i++)
|
edit_town_strs();
|
||||||
town->preset_items[i].property = 0;
|
break;
|
||||||
fancy_choice_dialog(861,0);
|
case 8:
|
||||||
draw_terrain();
|
if (fancy_choice_dialog(863,0) == 2)
|
||||||
break; // set not prop
|
break;
|
||||||
case 10: if (fancy_choice_dialog(862,0) == 2)
|
place_items_in_town();
|
||||||
break;
|
break; // add random
|
||||||
for (i = 0; i < 64; i++)
|
case 9:
|
||||||
town->preset_items[i].code = -1;
|
for (i = 0; i < 64; i++)
|
||||||
draw_terrain();
|
town->preset_items[i].property = 0;
|
||||||
break; // clear all items
|
fancy_choice_dialog(861,0);
|
||||||
case 13: SetControlValue(right_sbar,0); start_special_editing(2,0); break;
|
draw_terrain();
|
||||||
case 14: SetControlValue(right_sbar,0); start_string_editing(2,0); break;
|
break; // set not prop
|
||||||
case 15: edit_advanced_town(); break;
|
case 10:
|
||||||
case 16: edit_town_events(); break;
|
if (fancy_choice_dialog(862,0) == 2)
|
||||||
}
|
break;
|
||||||
|
for (i = 0; i < 64; i++)
|
||||||
|
town->preset_items[i].code = -1;
|
||||||
|
draw_terrain();
|
||||||
|
break; // clear all items
|
||||||
|
case 13:
|
||||||
|
SetControlValue(right_sbar,0);
|
||||||
|
start_special_editing(2,0);
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
SetControlValue(right_sbar,0);
|
||||||
|
start_string_editing(2,0);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
edit_advanced_town();
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
edit_town_events();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void handle_outdoor_menu(int item_hit)
|
void handle_outdoor_menu(int item_hit) {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
change_made = true;
|
change_made = true;
|
||||||
switch (item_hit) {
|
switch (item_hit) {
|
||||||
case 1: outdoor_details(); break;
|
case 1:
|
||||||
case 2: edit_out_wand(0); break;
|
outdoor_details();
|
||||||
case 3: edit_out_wand(1); break;
|
break;
|
||||||
case 4: frill_up_terrain(); break;
|
case 2:
|
||||||
case 5: unfrill_terrain(); break;
|
edit_out_wand(0);
|
||||||
case 6: edit_out_strs(); break;
|
break;
|
||||||
case 8: overall_mode = MODE_SET_OUT_START;
|
case 3:
|
||||||
set_string("Select party starting location.",""); break;
|
edit_out_wand(1);
|
||||||
case 11: SetControlValue(right_sbar,0); start_special_editing(1,0); break;
|
break;
|
||||||
case 12: SetControlValue(right_sbar,0); start_string_editing(1,0); break;
|
case 4:
|
||||||
}
|
frill_up_terrain();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
unfrill_terrain();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
edit_out_strs();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
overall_mode = MODE_SET_OUT_START;
|
||||||
|
set_string("Select party starting location.","");
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
SetControlValue(right_sbar,0);
|
||||||
|
start_special_editing(1,0);
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
SetControlValue(right_sbar,0);
|
||||||
|
start_string_editing(1,0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_help_menu(int item_hit)
|
void handle_help_menu(int item_hit) {
|
||||||
{
|
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
switch (item_hit) {
|
switch (item_hit) {
|
||||||
case 1: fancy_choice_dialog(986,0); break; // started
|
case 1:
|
||||||
case 2: fancy_choice_dialog(1000,0); break; // testing
|
fancy_choice_dialog(986,0);
|
||||||
case 3: fancy_choice_dialog(1001,0); break; // distributing
|
break; // started
|
||||||
case 5: fancy_choice_dialog(1002,0); break; // contest
|
case 2:
|
||||||
}
|
fancy_choice_dialog(1000,0);
|
||||||
|
break; // testing
|
||||||
|
case 3:
|
||||||
|
fancy_choice_dialog(1001,0);
|
||||||
|
break; // distributing
|
||||||
|
case 5:
|
||||||
|
fancy_choice_dialog(1002,0);
|
||||||
|
break; // contest
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_item_menu(int item_hit)
|
void handle_item_menu(int item_hit) {
|
||||||
{
|
|
||||||
if (scenario.scen_items[item_hit].variety == 0) {
|
if (scenario.scen_items[item_hit].variety == 0) {
|
||||||
give_error("This item has its Variety set to No Item. You can only place items with a Variety set to an actual item type.","",0);
|
give_error("This item has its Variety set to No Item. You can only place items with a Variety set to an actual item type.","",0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
overall_mode = MODE_PLACE_ITEM;
|
overall_mode = MODE_PLACE_ITEM;
|
||||||
set_string("Place the item.","Select item location");
|
set_string("Place the item.","Select item location");
|
||||||
mode_count = item_hit;
|
mode_count = item_hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_monst_menu(int item_hit)
|
void handle_monst_menu(int item_hit) {
|
||||||
{
|
overall_mode = MODE_PLACE_CREATURE;
|
||||||
overall_mode = MODE_PLACE_CREATURE;
|
set_string("Place the monster.","Select monster location");
|
||||||
set_string("Place the monster.","Select monster location");
|
mode_count = item_hit;
|
||||||
mode_count = item_hit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pascal void right_sbar_action(ControlHandle bar, short part)
|
pascal void right_sbar_action(ControlHandle bar, short part) {
|
||||||
{
|
|
||||||
short old_setting,new_setting,max,i;
|
short old_setting,new_setting,max,i;
|
||||||
|
|
||||||
if (part == 0)
|
if (part == 0)
|
||||||
@@ -621,19 +662,26 @@ pascal void right_sbar_action(ControlHandle bar, short part)
|
|||||||
max = GetControlMaximum(bar);
|
max = GetControlMaximum(bar);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case kControlUpButtonPart: new_setting--; break;
|
case kControlUpButtonPart:
|
||||||
case kControlDownButtonPart: new_setting++; break;
|
new_setting--;
|
||||||
case kControlPageUpPart: new_setting -= NRSONPAGE - 1; break;
|
break;
|
||||||
case kControlPageDownPart: new_setting += NRSONPAGE - 1; break;
|
case kControlDownButtonPart:
|
||||||
}
|
new_setting++;
|
||||||
|
break;
|
||||||
|
case kControlPageUpPart:
|
||||||
|
new_setting -= NRSONPAGE - 1;
|
||||||
|
break;
|
||||||
|
case kControlPageDownPart:
|
||||||
|
new_setting += NRSONPAGE - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
new_setting = minmax(0,max,new_setting);
|
new_setting = minmax(0,max,new_setting);
|
||||||
SetControlValue(bar,new_setting);
|
SetControlValue(bar,new_setting);
|
||||||
if (new_setting != old_setting)
|
if (new_setting != old_setting)
|
||||||
draw_rb();
|
draw_rb();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse_Pressed()
|
void Mouse_Pressed() {
|
||||||
{
|
|
||||||
WindowPtr the_window;
|
WindowPtr the_window;
|
||||||
short the_part,content_part,i;
|
short the_part,content_part,i;
|
||||||
long menu_choice;
|
long menu_choice;
|
||||||
@@ -648,58 +696,57 @@ void Mouse_Pressed()
|
|||||||
menu_choice = MenuSelect(event.where);
|
menu_choice = MenuSelect(event.where);
|
||||||
handle_menu_choice(menu_choice);
|
handle_menu_choice(menu_choice);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case inSysWindow:
|
case inSysWindow:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case inDrag:
|
case inDrag:
|
||||||
GetQDGlobalsScreenBits(&bmap);
|
GetQDGlobalsScreenBits(&bmap);
|
||||||
DragWindow(the_window, event.where, &(bmap.bounds));
|
DragWindow(the_window, event.where, &(bmap.bounds));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case inGoAway:
|
case inGoAway:
|
||||||
All_Done = true;
|
All_Done = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case inContent:
|
case inContent:
|
||||||
SetPortWindowPort(mainPtr);
|
SetPortWindowPort(mainPtr);
|
||||||
GlobalToLocal(&event.where);
|
GlobalToLocal(&event.where);
|
||||||
content_part = FindControl(event.where,the_window,&control_hit); // hit sbar?
|
content_part = FindControl(event.where,the_window,&control_hit); // hit sbar?
|
||||||
if (content_part != 0) {
|
if (content_part != 0) {
|
||||||
switch (content_part) {
|
switch (content_part) {
|
||||||
case kControlIndicatorPart:
|
case kControlIndicatorPart:
|
||||||
content_part = TrackControl(control_hit,event.where,NULL);
|
content_part = TrackControl(control_hit,event.where,NULL);
|
||||||
if (control_hit == right_sbar)
|
if (control_hit == right_sbar)
|
||||||
if (content_part == kControlIndicatorPart) {
|
if (content_part == kControlIndicatorPart) {
|
||||||
draw_rb();
|
draw_rb();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case kControlUpButtonPart: case kControlPageUpPart: case kControlDownButtonPart: case kControlPageDownPart:
|
case kControlUpButtonPart: case kControlPageUpPart:
|
||||||
if (control_hit == right_sbar)
|
case kControlDownButtonPart: case kControlPageDownPart:
|
||||||
content_part = TrackControl(control_hit,event.where,(ControlActionUPP)right_sbar_action);
|
if (control_hit == right_sbar)
|
||||||
break;
|
content_part = TrackControl(control_hit,event.where,(ControlActionUPP)right_sbar_action);
|
||||||
|
break;
|
||||||
}
|
|
||||||
|
}
|
||||||
} // a control hit
|
|
||||||
else // ordinary click
|
} // a control hit
|
||||||
All_Done = handle_action(event.where,event);
|
else // ordinary click
|
||||||
|
All_Done = handle_action(event.where,event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_program()
|
void close_program() {
|
||||||
{
|
|
||||||
restore_depth();
|
restore_depth();
|
||||||
if(town != NULL) delete town;
|
if(town != NULL) delete town;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ding()
|
void ding() {
|
||||||
{
|
|
||||||
SysBeep(1);
|
SysBeep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//pascal bool cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit)
|
//pascal bool cd_event_filter (DialogPtr hDlg, EventRecord *event, short *dummy_item_hit)
|
||||||
//{
|
//{
|
||||||
// char chr,chr2;
|
// char chr,chr2;
|
||||||
@@ -826,8 +873,8 @@ void set_pixel_depth() {
|
|||||||
OSErr err;
|
OSErr err;
|
||||||
short choice;
|
short choice;
|
||||||
|
|
||||||
cur_device = GetGDevice();
|
cur_device = GetGDevice();
|
||||||
|
|
||||||
|
|
||||||
screen_pixmap_handle = (**(cur_device)).gdPMap;
|
screen_pixmap_handle = (**(cur_device)).gdPMap;
|
||||||
pixel_depth = (**(screen_pixmap_handle)).pixelSize;
|
pixel_depth = (**(screen_pixmap_handle)).pixelSize;
|
||||||
@@ -840,23 +887,22 @@ void set_pixel_depth() {
|
|||||||
old_depth = pixel_depth;
|
old_depth = pixel_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void restore_depth()
|
void restore_depth() {
|
||||||
{
|
|
||||||
GDHandle cur_device;
|
GDHandle cur_device;
|
||||||
PixMapHandle screen_pixmap_handle;
|
PixMapHandle screen_pixmap_handle;
|
||||||
OSErr err;
|
OSErr err;
|
||||||
short choice;
|
short choice;
|
||||||
|
|
||||||
cur_device = GetGDevice();
|
cur_device = GetGDevice();
|
||||||
|
|
||||||
screen_pixmap_handle = (**(cur_device)).gdPMap;
|
screen_pixmap_handle = (**(cur_device)).gdPMap;
|
||||||
|
|
||||||
if (old_depth != 8) {
|
if (old_depth != 8) {
|
||||||
|
|
||||||
err = SetDepth(cur_device,old_depth,1,1);
|
err = SetDepth(cur_device,old_depth,1,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void find_quickdraw() {
|
void find_quickdraw() {
|
||||||
@@ -870,11 +916,11 @@ void find_quickdraw() {
|
|||||||
choice = choice_dialog(0,1070);
|
choice = choice_dialog(0,1070);
|
||||||
if (choice == 2)
|
if (choice == 2)
|
||||||
ExitToShell();
|
ExitToShell();
|
||||||
else diff_depth_ok = true;
|
else diff_depth_ok = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
SysBeep(2);
|
else {
|
||||||
ExitToShell();
|
SysBeep(2);
|
||||||
}
|
ExitToShell();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ public:
|
|||||||
|
|
||||||
cCreature& operator = (legacy::outdoor_creature_type old);
|
cCreature& operator = (legacy::outdoor_creature_type old);
|
||||||
};
|
};
|
||||||
unsigned char terrain[48][48];
|
unsigned short terrain[48][48];
|
||||||
location special_locs[18];
|
location special_locs[18];
|
||||||
unsigned char special_id[18];
|
unsigned char special_id[18];
|
||||||
location exit_locs[8];
|
location exit_locs[8];
|
||||||
|
@@ -114,7 +114,7 @@ void cBigTown::append(legacy::big_tr_type& old){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char& cTinyTown::terrain(size_t x, size_t y){
|
unsigned short& cTinyTown::terrain(size_t x, size_t y){
|
||||||
return _terrain[x][y];
|
return _terrain[x][y];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ unsigned char& cTinyTown::lighting(size_t i, size_t r){
|
|||||||
return _lighting[i][r];
|
return _lighting[i][r];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char& cMedTown::terrain(size_t x, size_t y){
|
unsigned short& cMedTown::terrain(size_t x, size_t y){
|
||||||
return _terrain[x][y];
|
return _terrain[x][y];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ unsigned char& cMedTown::lighting(size_t i, size_t r){
|
|||||||
return _lighting[i][r];
|
return _lighting[i][r];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char& cBigTown::terrain(size_t x, size_t y){
|
unsigned short& cBigTown::terrain(size_t x, size_t y){
|
||||||
return _terrain[x][y];
|
return _terrain[x][y];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,13 +13,13 @@ namespace legacy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class cBigTown : public cTown { // formerly big_tr_type
|
class cBigTown : public cTown { // formerly big_tr_type
|
||||||
unsigned char _terrain[64][64];
|
unsigned short _terrain[64][64];
|
||||||
rectangle _room_rect[16];
|
rectangle _room_rect[16];
|
||||||
cCreature _creatures[60];
|
cCreature _creatures[60];
|
||||||
unsigned char _lighting[8][64];
|
unsigned char _lighting[8][64];
|
||||||
public:
|
public:
|
||||||
void append(legacy::big_tr_type& old);
|
void append(legacy::big_tr_type& old);
|
||||||
unsigned char& terrain(size_t x, size_t y);
|
unsigned short& terrain(size_t x, size_t y);
|
||||||
rectangle& room_rect(size_t i);
|
rectangle& room_rect(size_t i);
|
||||||
cCreature& creatures(size_t i);
|
cCreature& creatures(size_t i);
|
||||||
unsigned char& lighting(size_t i, size_t r);
|
unsigned char& lighting(size_t i, size_t r);
|
||||||
@@ -30,13 +30,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class cMedTown : public cTown { // formerly ave_tr_type
|
class cMedTown : public cTown { // formerly ave_tr_type
|
||||||
unsigned char _terrain[48][48];
|
unsigned short _terrain[48][48];
|
||||||
rectangle _room_rect[16];
|
rectangle _room_rect[16];
|
||||||
cCreature _creatures[40];
|
cCreature _creatures[40];
|
||||||
unsigned char _lighting[6][48];
|
unsigned char _lighting[6][48];
|
||||||
public:
|
public:
|
||||||
void append(legacy::ave_tr_type& old);
|
void append(legacy::ave_tr_type& old);
|
||||||
unsigned char& terrain(size_t x, size_t y);
|
unsigned short& terrain(size_t x, size_t y);
|
||||||
rectangle& room_rect(size_t i);
|
rectangle& room_rect(size_t i);
|
||||||
cCreature& creatures(size_t i);
|
cCreature& creatures(size_t i);
|
||||||
unsigned char& lighting(size_t i, size_t r);
|
unsigned char& lighting(size_t i, size_t r);
|
||||||
@@ -47,13 +47,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class cTinyTown : public cTown { // formerly tiny_tr_type
|
class cTinyTown : public cTown { // formerly tiny_tr_type
|
||||||
unsigned char _terrain[32][32];
|
unsigned short _terrain[32][32];
|
||||||
rectangle _room_rect[16];
|
rectangle _room_rect[16];
|
||||||
cCreature _creatures[30];
|
cCreature _creatures[30];
|
||||||
unsigned char _lighting[4][32];
|
unsigned char _lighting[4][32];
|
||||||
public:
|
public:
|
||||||
void append(legacy::tiny_tr_type& old);
|
void append(legacy::tiny_tr_type& old);
|
||||||
unsigned char& terrain(size_t x, size_t y);
|
unsigned short& terrain(size_t x, size_t y);
|
||||||
rectangle& room_rect(size_t i);
|
rectangle& room_rect(size_t i);
|
||||||
cCreature& creatures(size_t i);
|
cCreature& creatures(size_t i);
|
||||||
unsigned char& lighting(size_t i, size_t r);
|
unsigned char& lighting(size_t i, size_t r);
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
|
|
||||||
unsigned char& cTemplTown::terrain(size_t x, size_t y){
|
unsigned short& cTemplTown::terrain(size_t x, size_t y){
|
||||||
return _lighting[0][0]; // will need to calculate the terrain somehow
|
return _terrain[0][0]; // will need to calculate the terrain somehow
|
||||||
}
|
}
|
||||||
|
|
||||||
rectangle& cTemplTown::room_rect(size_t i){
|
rectangle& cTemplTown::room_rect(size_t i){
|
||||||
|
@@ -24,13 +24,13 @@ public:
|
|||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
cCreature _creatures[30];
|
cCreature _creatures[30];
|
||||||
// unsigned char _terrain[?][?];
|
unsigned short _terrain[64][64];
|
||||||
rectangle _room_rect[16];
|
rectangle _room_rect[16];
|
||||||
unsigned char _lighting[4][32];
|
unsigned char _lighting[4][32];
|
||||||
cCityBlock blocks[15];
|
cCityBlock blocks[15];
|
||||||
cTerRect ter_rects[10];
|
cTerRect ter_rects[10];
|
||||||
public:
|
public:
|
||||||
unsigned char& terrain(size_t x, size_t y);
|
unsigned short& terrain(size_t x, size_t y);
|
||||||
rectangle& room_rect(size_t i);
|
rectangle& room_rect(size_t i);
|
||||||
cCreature& creatures(size_t i);
|
cCreature& creatures(size_t i);
|
||||||
unsigned char& lighting(size_t i, size_t r);
|
unsigned char& lighting(size_t i, size_t r);
|
||||||
|
@@ -89,7 +89,7 @@ public:
|
|||||||
virtual void append(legacy::big_tr_type& old);
|
virtual void append(legacy::big_tr_type& old);
|
||||||
virtual void append(legacy::ave_tr_type& old);
|
virtual void append(legacy::ave_tr_type& old);
|
||||||
virtual void append(legacy::tiny_tr_type& old);
|
virtual void append(legacy::tiny_tr_type& old);
|
||||||
virtual unsigned char& terrain(size_t x, size_t y) = 0;
|
virtual unsigned short& terrain(size_t x, size_t y) = 0;
|
||||||
virtual rectangle& room_rect(size_t i) = 0;
|
virtual rectangle& room_rect(size_t i) = 0;
|
||||||
virtual cCreature& creatures(size_t i) = 0;
|
virtual cCreature& creatures(size_t i) = 0;
|
||||||
virtual unsigned char& lighting(size_t i, size_t r) = 0;
|
virtual unsigned char& lighting(size_t i, size_t r) = 0;
|
||||||
|
@@ -30,11 +30,11 @@ public:
|
|||||||
cSpeech* cur_talk; // my addition
|
cSpeech* cur_talk; // my addition
|
||||||
short cur_talk_loaded; // my addition
|
short cur_talk_loaded; // my addition
|
||||||
|
|
||||||
unsigned char setup[4][64][64]; // formerly setup_save_type
|
unsigned short setup[4][64][64]; // formerly setup_save_type
|
||||||
cItemRec items[115]; // formerly town_item_list type
|
cItemRec items[115]; // formerly town_item_list type
|
||||||
char maps[200][8][64]; // formerly stored_town_maps_type
|
char maps[200][8][64]; // formerly stored_town_maps_type
|
||||||
|
|
||||||
unsigned char template_terrain[64][64];
|
unsigned short template_terrain[64][64];
|
||||||
|
|
||||||
void append(legacy::current_town_type& old,short which_size);
|
void append(legacy::current_town_type& old,short which_size);
|
||||||
void append(legacy::town_item_list& old);
|
void append(legacy::town_item_list& old);
|
||||||
@@ -48,7 +48,8 @@ class cCurOut {
|
|||||||
public:
|
public:
|
||||||
char expl[96][96]; // formerly out_info_type
|
char expl[96][96]; // formerly out_info_type
|
||||||
char maps[100][6][48]; // formerly stored_outdoor_maps_type
|
char maps[100][6][48]; // formerly stored_outdoor_maps_type
|
||||||
unsigned char out[96][96],out_e[96][96];
|
unsigned short out[96][96];
|
||||||
|
unsigned char out_e[96][96];
|
||||||
cOutdoors outdoors[2][2];
|
cOutdoors outdoors[2][2];
|
||||||
|
|
||||||
unsigned char sfx[64][64];
|
unsigned char sfx[64][64];
|
||||||
|
Reference in New Issue
Block a user