diff --git a/Blades of Exile/Blades of Exile.dev b/Blades of Exile/Blades of Exile.dev index 9cbaf97b..098ba38e 100644 --- a/Blades of Exile/Blades of Exile.dev +++ b/Blades of Exile/Blades of Exile.dev @@ -34,7 +34,7 @@ SupportXPThemes=0 CompilerSet=0 [Unit1] -FileName=ACTIONS.CPP +FileName=boe.actions.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -44,7 +44,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit2] -FileName=BLADES.CPP +FileName=boe.main.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -54,7 +54,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit3] -FileName=COMBAT.CPP +FileName=boe.combat.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -64,7 +64,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit4] -FileName=DLGUTILS.CPP +FileName=boe.dlgutil.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -84,7 +84,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit6] -FileName=EXLSOUND.CPP +FileName=sountool.CPP CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -94,7 +94,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit7] -FileName=FIELDS.CPP +FileName=boe.fields.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -104,7 +104,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit8] -FileName=FILEIO.CPP +FileName=boe.fileio.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -124,7 +124,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit10] -FileName=GRAPHICS.CPP +FileName=boe.graphics.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -134,17 +134,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit11] -FileName=GRAPHUTL.CPP -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit12] -FileName=GUTILS.CPP +FileName=boe.graphutil.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -154,7 +144,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit13] -FileName=INFODLGS.CPP +FileName=boe.infodlg.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -164,7 +154,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit14] -FileName=ITEMDATA.CPP +FileName=boe.itemdata.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -174,7 +164,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit15] -FileName=ITEMS.CPP +FileName=boe.items.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -184,7 +174,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit16] -FileName=LOCUTILS.CPP +FileName=boe.locutils.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -194,7 +184,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit17] -FileName=MONSTER.CPP +FileName=boe.monster.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -204,7 +194,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit18] -FileName=NEWGRAPH.CPP +FileName=boe.newgraph.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -214,7 +204,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit19] -FileName=PARTY.CPP +FileName=boe.party.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -224,7 +214,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit20] -FileName=SPECIALS.CPP +FileName=boe.specials.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -234,7 +224,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit22] -FileName=TOWN.CPP +FileName=boe.town.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -274,7 +264,7 @@ AutoIncBuildNrOnCompile=0 AutoIncBuildNr=0 [Unit26] -FileName=ACTIONS.H +FileName=boe.actions.h Folder=Blades of Exile Compile=1 Link=1 @@ -293,7 +283,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit27] -FileName=COMBAT.H +FileName=boe.combat.h Folder=Blades of Exile Compile=1 Link=1 @@ -303,7 +293,7 @@ BuildCmd= CompileCpp=1 [Unit28] -FileName=DLGUTILS.H +FileName=boe.dlgutil.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -323,7 +313,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit30] -FileName=EXLSOUND.H +FileName=soundtool.H CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -333,7 +323,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit31] -FileName=FIELDS.H +FileName=boe.fields.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -343,7 +333,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit32] -FileName=FILEIO.H +FileName=boe.fileio.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -363,7 +353,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit34] -FileName=GRAPHICS.H +FileName=boe.graphics.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -373,17 +363,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit35] -FileName=GRAPHUTL.H -CompileCpp=1 -Folder=Blades of Exile -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit36] -FileName=GUTILS.H +FileName=boe.graphutil.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -393,7 +373,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit37] -FileName=INFODLGS.H +FileName=boe.infodlg.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -403,7 +383,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit38] -FileName=ITEMDATA.H +FileName=boe.itemdata.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -413,7 +393,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit39] -FileName=ITEMS.H +FileName=boe.items.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -423,7 +403,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit40] -FileName=LOCUTILS.H +FileName=boe.locutils.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -433,7 +413,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit41] -FileName=MONSTER.H +FileName=boe.monster.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -443,7 +423,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit42] -FileName=NEWGRAPH.H +FileName=boe.newgraph.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -453,7 +433,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit45] -FileName=TEXT.H +FileName=boe.text.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -463,7 +443,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit46] -FileName=TOWN.H +FileName=boe.town.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -523,7 +503,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit43] -FileName=PARTY.H +FileName=boe.party.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -533,7 +513,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit44] -FileName=SPECIALS.H +FileName=boe.specials.h CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -630,7 +610,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit60] +[Unit36] FileName=GLOBVAR.H CompileCpp=1 Folder= @@ -640,7 +620,7 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit61] +[Unit12] FileName=CONSTS.H CompileCpp=1 Folder= @@ -651,7 +631,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit21] -FileName=TEXT.CPP +FileName=boe.text.cpp CompileCpp=1 Folder=Blades of Exile Compile=1 @@ -661,7 +641,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit47] -FileName=BLADES.H +FileName=boe.main.h CompileCpp=1 Folder= Compile=1 diff --git a/Blades of Exile/EXLSOUND.CPP b/Blades of Exile/EXLSOUND.CPP deleted file mode 100644 index e3a22efc..00000000 --- a/Blades of Exile/EXLSOUND.CPP +++ /dev/null @@ -1,262 +0,0 @@ -#include "math.h" -#include -#include - -#include "stdio.h" - -#include "global.h" -#include "exlsound.h" -#include "text.h" -#include "fields.h" - -#include "globvar.h" - -#define NUM_SOUNDS 100 - -void load_sounds(HMODULE handle) -{ - short i,t,err; - HRSRC h; - char snd_name[20]; - WAVEOUTCAPS wavecaps; - - hModule = handle; - - t = waveOutGetNumDevs(); - if (t == 0) { - sounds_fucked = TRUE; - return; - } - err = waveOutGetDevCaps(0,&wavecaps,sizeof(WAVEOUTCAPS)); -if (err != 0) { - sounds_fucked = TRUE; - switch (err) { - case MMSYSERR_BADDEVICEID: - MessageBox(mainPtr,"Cannot initialize sounds - No sound device detected. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_NODRIVER: - MessageBox(mainPtr,"Cannot initialize sounds - No driver installed. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_NOMEM : - MessageBox(mainPtr,"Cannot initialize sounds - can't find enough memory. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_ALLOCATED: - MessageBox(mainPtr,"Cannot initialize sounds - sound card already allocated. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - case MMSYSERR_ERROR: - MessageBox(mainPtr,"Cannot initialize sounds - internal error. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - default: - MessageBox(mainPtr,"Cannot initialize sounds - unidentified error. Game can still be played, but quietly.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - return; - - } - - } - - for (i = 0; i < NUM_SOUNDS; i++) { - sound_handles[i] = NULL; - if (load_when_play[i] == FALSE) { - sprintf((char *)snd_name,"#%d",i + 1); - h = FindResource(handle,snd_name,"#100"); - - sound_handles[i] = LoadResource(handle,h); - snds[i] = (char*) LockResource(sound_handles[i]); - } - } - -} - -void play_sound(short which) // if < 0, play asynch -{ - if (play_sounds == TRUE) - force_play_sound(which); -} - - -void force_play_sound(short which) -{ - short i,num_fails = 0; - char snd_name[30]; - Boolean asyn = FALSE,a_sound_did_get_played = FALSE; - Boolean not_asyn = FALSE,check_sound; - HRSRC h; - - if ((sounds_fucked == TRUE) || (play_sounds == FALSE)) - return; - if (which < 0) { - asyn = TRUE; - which = which * -1; - } - if (which >= 1000) { - which -= 1000; - not_asyn = TRUE; - } - - if (which >= 100) - return; - - if ((always_asynch[which] == TRUE) && - ((can_ignore[which] == 1) || (can_ignore[which] >= 3))) - asyn = TRUE; - if ((can_ignore[which] > 0) && (can_ignore[which] < 5) && (party.stuff_done[305][5] == 1)) - return; - if ((can_ignore[which] != 1) && (can_ignore[which] < 3)) - asyn = FALSE; - if ((party.stuff_done[305][5] == 1) && (can_ignore[which] < 5)) - asyn = FALSE; - if (not_asyn == TRUE) - asyn = FALSE; - - if ((load_when_play[which] == TRUE) && (sound_handles[which] == NULL)) { - asyn = FALSE; - sprintf((char *)snd_name,"#%d",which + 1); - h = FindResource(hModule,snd_name,"#100"); - - sound_handles[which] = LoadResource(hModule,h); - snds[which] = (char *) LockResource(sound_handles[which]); - - } - - if (store_last_sound_played == 6) - sndPlaySound(NULL,0); - - if (asyn == TRUE) { - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); - - while (check_sound == FALSE) { - - if (can_ignore[store_last_sound_played] == 4) {// then sound goes away - return; - } - - - num_fails++; - if (num_fails < 40) - sound_pause(25); - else { - MessageBox(mainPtr,"Cannot play sounds - Sounds stuck error a. Game can still be played, but quietly. Check to make sure your sound drivers are up to date and not corrupted.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - print_nums(111,which,num_fails); - sounds_fucked = TRUE; - return; - } - sndPlaySound(NULL,0); - - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); - } - a_sound_did_get_played = TRUE; - } - else { - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); - while (check_sound == FALSE) { - if (can_ignore[store_last_sound_played] == 4) {// then sound goes away - return; - } - - - num_fails++; - if (num_fails < 40) - sound_pause(25); - else { - MessageBox(mainPtr,"Cannot play sounds - Sounds stuck error b. Game can still be played, but quietly. Check to make sure your sound drivers are up to date and not corrupted.", - "Sound Error",MB_OK | MB_ICONEXCLAMATION); - print_nums(222,which,num_fails); - sounds_fucked = TRUE; - return; - } - sndPlaySound(NULL,0); - - if (can_ignore[which] >= 4) - check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); - else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); - } - a_sound_did_get_played = TRUE; - } - - store_last_sound_played = which; - - if ((load_when_play[which] == TRUE) && (asyn == FALSE)) - sound_handles[which] = NULL; - - for (i = 0; i < NUM_SOUNDS; i++) - if ((load_when_play[which] == TRUE) && (sound_handles[which] != NULL) - && (a_sound_did_get_played == TRUE) && (i != which)) - { - sound_handles[i] = NULL; - } - -} - -void kill_sound() -{ - sndPlaySound(NULL,0); -} - -void one_sound(short which) -{ - if (which == last_played) - return; - play_sound(which); - last_played = which; -} - -void sound_pause(long len) { - long t1,t2; - - t1 = (long) GetCurrentTime(); - t2 = t1; - while (t2 - t1 < len) { - t2 = (long)GetCurrentTime(); - } -} -void move_sound(unsigned char ter,short step) -{ - short spec; - - spec = scenario.ter_types[ter].special; - - if ((monsters_going == FALSE) && (overall_mode < 10) && (party.in_boat >= 0)) { - if (spec == 21) - return; - play_sound(48); - } - else if ((monsters_going == FALSE) && (overall_mode < 10) && (party.in_horse >= 0)) {//// - play_sound(85); - } - else if(spec == 5) //if poisoned land don't play squish sound : BoE legacy behavior, can be removed safely - return; -// else if(spec == 6) //if diseased land do the same -// return; - else switch(scenario.ter_types[ter].step_sound){ - case 0: - if (step % 2 == 0) //footsteps alternate sound - play_sound(49); - else play_sound(50); - break; - case 1: - play_sound(55); //squish - break; - case 2: - play_sound(47); //crunch - break; - case 3: - break; //silence : do nothing - default: - if (step % 2 == 0) //safety footsteps valve - play_sound(49); - else play_sound(50); - } -} diff --git a/Blades of Exile/EXLSOUND.H b/Blades of Exile/EXLSOUND.H deleted file mode 100644 index 75d1e3f5..00000000 --- a/Blades of Exile/EXLSOUND.H +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _EXLSOUND_H - #define _EXLSOUND_H - -#include // for HMODULE - -void move_sound(unsigned char ter,short step); -void one_sound(short which); -void force_play_sound(short which); -void play_sound(short which) ; -void load_sounds (HMODULE handle); -void sound_pause(long len); -void kill_sound(); - -#endif diff --git a/Blades of Exile/GLOBAL.CPP b/Blades of Exile/GLOBAL.CPP index 55f22fd9..d2150bab 100644 --- a/Blades of Exile/GLOBAL.CPP +++ b/Blades of Exile/GLOBAL.CPP @@ -1,6 +1,6 @@ -#include +#include #include "global.h" -#include "math.h" +#include #include "globvar.h" RECT RECT16::rect32() diff --git a/Blades of Exile/GLOBAL.H b/Blades of Exile/GLOBAL.H index 44e8f820..5cd09f2b 100644 --- a/Blades of Exile/GLOBAL.H +++ b/Blades of Exile/GLOBAL.H @@ -2,14 +2,14 @@ #define _GLOBAL_H #include -#include /* for sprintf */ -#include -#include +#include /* for sprintf */ +#include +#include #include "consts.h" -#include "item.h" -#include "location.h" -#include "pc.h" +#include "classes/item.h" +#include "classes/location.h" +#include "classes/pc.h" #define huge diff --git a/Blades of Exile/GLOBVAR.CPP b/Blades of Exile/GLOBVAR.CPP index 2287d90b..8c673fff 100644 --- a/Blades of Exile/GLOBVAR.CPP +++ b/Blades of Exile/GLOBVAR.CPP @@ -474,64 +474,7 @@ LRESULT CALLBACK fresh_edit_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM DLGPROC d_proc; WNDPROC edit_proc; WNDPROC old_edit_proc; -#define NUM_SOUNDS 100 -HGLOBAL sound_handles[NUM_SOUNDS]; -char * snds[NUM_SOUNDS]; -short last_played = 10000; -short store_last_sound_played = 0; HMODULE hModule; -Boolean always_asynch[100] = {FALSE,FALSE,FALSE,FALSE,FALSE, - TRUE,TRUE,FALSE,FALSE,FALSE, - TRUE,FALSE,FALSE,FALSE,FALSE, // 10 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,TRUE,FALSE,TRUE, // 20 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,TRUE, // 30 - FALSE,FALSE,TRUE,FALSE,TRUE, - FALSE,TRUE,TRUE,TRUE,TRUE, // 40 - TRUE,TRUE,TRUE,TRUE,TRUE, - TRUE,FALSE,FALSE,TRUE,FALSE, // 50 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 60 - FALSE,FALSE,FALSE,FALSE,FALSE, - FALSE,FALSE,FALSE,FALSE,FALSE, // 70 - FALSE,TRUE,TRUE,TRUE,TRUE, - TRUE,TRUE,TRUE,TRUE,FALSE, // 80 - TRUE,FALSE,FALSE,FALSE,FALSE, - FALSE,TRUE,FALSE,FALSE,FALSE, // 90 - FALSE,FALSE,FALSE,FALSE,FALSE}; -Boolean load_when_play[100] = { - 0,0,1,1,1,0,0,1,1,1, - 0,0,0,1,0,1,1,1,1,1, - 1,1,0,1,1,1,1,0,1,1, - 1,1,1,1,0,1,1,0,1,1, - 1,1,1,1,1,1,1,0,0,0, - 0,1,1,0,1,0,1,1,1,1, // 50 - 1,0,1,1,1,1,1,1,1,0, - 0,0,0,0,0,0,0,0,0,0, // 70 - 1,1,1,1,1,0,0,0,0,0, - 1,0,1,1,1,1,1,1,1,0 -}; -short can_ignore[100] = { - 0,0,0,0,0,5,3,0,0,0, - 5,5,5,0,5,0,0,0,0,0, - 0,0,5,0,0,0,0,0,0,2, - 2,2,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,1,1,1, - 1,0,0,5,0,1,0,0,0,0, // 50 - 0,0,0,0,5,0,0,0,0,0, - 0,0,0,0,0, 0,5,5,5,5, // 70 - 4,4,4,4,0,0,0,0,0,0, - 0,5,5,0,0,0,0,0,0,0}; -// 1 - polite asych, 1 or 2 or 3- lose easily when pref is set for fewer snds -// 3 can be async -// 4 - nostop asynch ... when 4, this sound is NOSTOP, i.e. when played, is played -// asynch, and refuses all other sounds. Sounds that come in are ignored, and -// disappear into the ether -// 5 - finally, bold asynch ... when 5, this sound is NOSTOP, i.e. when played, is played -// asynch, and refuses all other sounds. When a sound is played on top of this, game -// hangs on until sound is done, and then and only then plays later sound. -Boolean sounds_fucked = FALSE; long intro_music_start_time = -1; HBITMAP spec_scen_g ; typedef struct { diff --git a/Blades of Exile/GLOBVAR.H b/Blades of Exile/GLOBVAR.H index 58631d8e..cf9ace7f 100644 --- a/Blades of Exile/GLOBVAR.H +++ b/Blades of Exile/GLOBVAR.H @@ -3,7 +3,7 @@ #include #include "global.h" -#include "newgraph.h" +#include "boe.newgraph.h" extern RECT bottom_buttons[7]; extern RECT town_buttons[10]; @@ -295,7 +295,6 @@ extern char * snds[NUM_SOUNDS]; extern short last_played; extern short store_last_sound_played; -extern HMODULE hModule; extern Boolean always_asynch[100]; extern Boolean load_when_play[100]; diff --git a/Blades of Exile/GRAPHUTL.CPP b/Blades of Exile/GRAPHUTL.CPP deleted file mode 100644 index b4ce4a88..00000000 --- a/Blades of Exile/GRAPHUTL.CPP +++ /dev/null @@ -1,374 +0,0 @@ -#define xmin(a,b) ((a) < (b) ? (a) : (b)) - -#include -#include -#include -#include -#include -#include "global.h" -#include "text.h" -#include "string.h" -#include "exlsound.h" -#include "infodlgs.h" - -#include "graphutl.h" -#include "globvar.h" - -void rect_draw_some_item(HBITMAP src, RECT16 src_rect,HBITMAP dest, RECT16 dest_rect, - short trans, short main_win) -{ - HDC hdcMem,hdcMem2,hdcMem3,destDC; - HBITMAP transbmp; - COLORREF white = RGB(255,255,255),oldcolor; - HBRUSH hbrush,old_brush; - COLORREF x = RGB(17,17,17); - HBITMAP store,store2; - Boolean dlog_draw = FALSE; - - if (main_win == 2) - { - destDC = (HDC) dest; - main_win = 1; - dlog_draw = TRUE; - hdcMem = CreateCompatibleDC(destDC); - SelectObject(hdcMem, src); - SetMapMode(hdcMem,GetMapMode((HDC) mainPtr)); - } - else - { - destDC = main_dc; - hdcMem = main_dc2; - store = (HBITMAP) SelectObject(hdcMem,src); - } - - if (trans != 1) - { - if (main_win == 0) - { // Not transparent, into bitmap - hdcMem2 = main_dc3; - store2 = (HBITMAP) SelectObject(hdcMem2, dest); - StretchBlt(hdcMem2,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,(trans >= 0) ? SRCCOPY : SRCAND); - SelectObject(hdcMem2,store2); - } - else - { // Not transparent, onto screen - - if (trans == 2) - { - hbrush = CreateSolidBrush(x); - old_brush = (HBRUSH) SelectObject(destDC,hbrush); - } - - if (dlog_draw == FALSE) SetViewportOrgEx(destDC,ulx,uly,NULL); - - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,(trans == 0) ? SRCCOPY : MERGECOPY); - if (trans == 2) - { - SelectObject(destDC,old_brush); - if (DeleteObject(hbrush) == 0) play_sound(1); - } - - if (dlog_draw == FALSE) SetViewportOrgEx(destDC,0,0,NULL); - } - - } // end of non-transparent draws - else - { - if (main_win == 0) - { - hdcMem3 = CreateCompatibleDC(hdcMem); - SelectObject(hdcMem3, dest); - SetMapMode(hdcMem3,GetMapMode((HDC) mainPtr)); - if ((src_rect.right - src_rect.left < 72) && - (src_rect.bottom - src_rect.top < 72)) - transbmp = bw_bitmap; - else transbmp = CreateBitmap(src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,1,1,NULL); - - hdcMem2 = CreateCompatibleDC(destDC); - SelectObject(hdcMem2, transbmp); - oldcolor = SetBkColor(hdcMem, white); - StretchBlt(hdcMem2,0,0,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCCOPY); - SetBkColor(hdcMem, oldcolor); - - StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem2,0,0,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top,SRCAND); - StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - DeleteDC(hdcMem3); - DeleteDC(hdcMem2); - if (transbmp != bw_bitmap) DeleteObject(transbmp); - } - else - { - if (dlog_draw == FALSE) SetViewportOrgEx(destDC,ulx,uly,NULL); - if ((src_rect.right - src_rect.left < 72) && - (src_rect.bottom - src_rect.top < 72)) - transbmp = bw_bitmap; - else transbmp = CreateBitmap(src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,1,1,NULL); - - hdcMem2 = CreateCompatibleDC(destDC); - - SelectObject(hdcMem2, transbmp); - - oldcolor = SetBkColor(hdcMem, white); - - StretchBlt(hdcMem2,0,0,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCCOPY); - - SetBkColor(hdcMem, oldcolor); - - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem2,0,0,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top,SRCAND); - - StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, - dest_rect.bottom - dest_rect.top, - hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, - src_rect.bottom - src_rect.top,SRCINVERT); - - if (dlog_draw == FALSE) SetViewportOrgEx(destDC,0,0,NULL); - - DeleteDC(hdcMem2); - - if (transbmp != bw_bitmap) DeleteObject(transbmp); - } - } - if (dlog_draw == TRUE) DeleteDC(hdcMem); - else SelectObject(hdcMem,store); -} - -void fry_dc(HWND hwnd,HDC dc) -{ - if (ReleaseDC(hwnd,dc) == 0) - DebugQuit("Cannot release DC in fry_dc"); -} - -// which_mode is 0 ... dest is a bitmap -// is 1 ... ignore dest ... paint on mainPtr -// is 2 ... dest is a dialog, use the dialog pattern -// both pattern gworlds are 192 x 256 -void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern) -{ - HBITMAP source_pat; - RECT pattern_source = {32,168,96,232}, pat_dest_orig = {0,0,64,64},pat_dest; - short i,j; - - RECT draw_from_orig = {0,0,192,256},draw_from,draw_to; - short store_ulx,store_uly; - - if (which_mode == 2) { - source_pat = dialog_pattern_gworld; - if (dlog_pat_placed == 0) { - dlog_pat_placed = 1; - OffsetRect(&pattern_source, 64 * 2,0); - for (i = 0; i < 3; i++) - for (j = 0; j < 4; j++) { - pat_dest = pat_dest_orig; - OffsetRect(&pat_dest,64 * i, 64 * j); - rect_draw_some_item(mixed_gworld,pattern_source, - dialog_pattern_gworld,pat_dest,0,0); - } - } - } - else { - source_pat = pattern_gworld; - if (current_pattern != which_pattern) { - current_pattern = which_pattern; - OffsetRect(&pattern_source, 64 * (which_pattern % 5), - 64 * (which_pattern / 5)); - for (i = 0; i < 3; i++) - for (j = 0; j < 4; j++) { - pat_dest = pat_dest_orig; - OffsetRect(&pat_dest,64 * i, 64 * j); - rect_draw_some_item(mixed_gworld,pattern_source, - pattern_gworld,pat_dest,0,0); - } - } - } - - // now patterns are loaded, so have fun - // first nullify ul shifting - store_ulx = ulx; - store_uly = uly; - ulx = uly = 0; - for (i = 0; i < (dest_rect.right / 192) + 1; i++) - for (j = 0; j < (dest_rect.bottom / 256) + 1; j++) { - draw_to = draw_from_orig; - OffsetRect(&draw_to,192 * i, 256 * j); - IntersectRect(&draw_to,&draw_to,&dest_rect); - if (draw_to.right != 0) { - draw_from = draw_to; - OffsetRect(&draw_from, -192 * i, -256 * j); - switch (which_mode) { - case 0: - rect_draw_some_item(source_pat,draw_from, - dest,draw_to,0,0); break; - case 1: - rect_draw_some_item(source_pat,draw_from, - source_pat,draw_to,0,1); break; - case 2: - rect_draw_some_item(source_pat,draw_from, - dest,draw_to,0,2); break; - } - } - } - ulx = store_ulx; - uly = store_uly; -} - -HBITMAP load_pict(short pict_num,HDC) -{ - HBITMAP got_bitmap; - - switch(pict_num) { - case 700: - case 701: - case 702: got_bitmap = ReadBMP("images/STATAREA.BMP"); break; - case 703: got_bitmap = ReadBMP("images/TEXTBAR.BMP"); break; - case 704: got_bitmap = ReadBMP("images/BUTTONS.BMP"); break; - case 705: got_bitmap = ReadBMP("images/TERSCRN.BMP"); break; - case 800: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TER1.BMP"); - else - got_bitmap = ReadBMP("images/TER1_D.BMP"); - break; - case 801: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TER2.BMP"); - else - got_bitmap = ReadBMP("images/TER2_D.BMP"); - break; - case 802: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TER3.BMP"); - else - got_bitmap = ReadBMP("images/TER3_D.BMP"); - break; - case 803: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TER4.BMP"); - else - got_bitmap = ReadBMP("images/TER4_D.BMP"); - break; - case 804: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TER5.BMP"); - else - got_bitmap = ReadBMP("images/TER5_D.BMP"); - break; - case 805: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TER6.BMP"); - else - got_bitmap = ReadBMP("images/TER6_D.BMP"); - break; - case 820: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TERANIM.BMP"); - else - got_bitmap = ReadBMP("images/TERANIM_D.BMP"); - break; - case 821: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/FIELDS.BMP"); - else - got_bitmap = ReadBMP("images/FIELDS_D.BMP"); - break; - case 830: got_bitmap = ReadBMP("images/STARTUP.BMP"); break; - case 831: got_bitmap = ReadBMP("images/STANIM.BMP"); break; - case 832: got_bitmap = ReadBMP("images/STARTBUT.BMP"); break; - case 850: got_bitmap = ReadBMP("images/DLOGPICS.BMP"); break; - case 851: got_bitmap = ReadBMP("images/SCENPICS.BMP"); break; - case 860: got_bitmap = ReadBMP("images/TALKPORT.BMP"); break; -// case 875: got_bitmap = ReadBMP("images/DLOGMAPS.BMP"); break; => Exile III maps - case 880: got_bitmap = ReadBMP("images/MISSILES.BMP"); break; - case 900: got_bitmap = ReadBMP("images/TINYOBJ.BMP"); break; - case 901: got_bitmap = ReadBMP("images/OBJECTS.BMP"); break; - case 902: - case 905: got_bitmap = ReadBMP("images/PCS.BMP"); break; - case 903: - case 904: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/MIXED.BMP"); - else - got_bitmap = ReadBMP("images/MIXED_D.BMP"); - break; - case 910: - case 911: - case 912: got_bitmap = ReadBMP("images/BIGSCEN.BMP"); break; - case 1100: case 1200: got_bitmap = ReadBMP("images/MONST1.BMP"); break; - case 1101: case 1201: got_bitmap = ReadBMP("images/MONST2.BMP"); break; - case 1102: case 1202: got_bitmap = ReadBMP("images/MONST3.BMP"); break; - case 1103: case 1203: got_bitmap = ReadBMP("images/MONST4.BMP"); break; - case 1104: case 1204: got_bitmap = ReadBMP("images/MONST5.BMP"); break; - case 1105: case 1205: got_bitmap = ReadBMP("images/MONST6.BMP"); break; - case 1106: case 1206: got_bitmap = ReadBMP("images/MONST7.BMP"); break; - case 1107: case 1207: got_bitmap = ReadBMP("images/MONST8.BMP"); break; - case 1108: case 1208: got_bitmap = ReadBMP("images/MONST9.BMP"); break; - case 1109: case 1209: got_bitmap = ReadBMP("images/MONST10.BMP"); break; - case 1400: got_bitmap = ReadBMP("images/STSCICON.BMP"); break; - case 1401: got_bitmap = ReadBMP("images/HELPPICS.BMP"); break; - case 1402: got_bitmap = ReadBMP("images/APPIC.BMP"); break; -/* case 1500: - case 1501: - case 1502: - case 1503: - case 1504: - case 1505: - case 1506: - case 1507: - got_bitmap = ReadBMP("images/BIGMAPS.BMP"); break;*/ // <= doesn't exists - case 2000: got_bitmap = ReadBMP("images/DLOGBTNS.BMP"); break; - case 3000: got_bitmap = ReadBMP("images/START.BMP"); break; - case 3001: got_bitmap = ReadBMP("images/SPIDLOGO.BMP"); break; - case 4000: if(party.stuff_done[307][0] == 0) - got_bitmap = ReadBMP("images/TRIMS.BMP"); - else - got_bitmap = ReadBMP("images/TRIMS_D.BMP"); - break; - - default: got_bitmap = NULL; - } - return got_bitmap; -} - -/* GK */ - -HBITMAP ReadBMP(char * fileName) -{ - return (HBITMAP) LoadImage(0, fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); -} - -HBITMAP ReadScenFile(char* filename){ //like ReadBMP but in the current scenario folder only. - - short store_val; - char str[256]= "scenarios/"; - store_val= strlen(party.scen_name)-1; - while(party.scen_name[store_val] != '.'){ // get rid of the .exs part - store_val--; - } - strncat(str, party.scen_name, store_val + 1); // the scenario is in a subfolder so add that to the filepath - strcat(str,"exr/"); - strcat(str,filename); - - return (HBITMAP) LoadImage(0, str, IMAGE_BITMAP, 0 ,0 , LR_LOADFROMFILE); -} diff --git a/Blades of Exile/GRAPHUTL.H b/Blades of Exile/GRAPHUTL.H deleted file mode 100644 index 5c03039f..00000000 --- a/Blades of Exile/GRAPHUTL.H +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _GRAPHUTIL_H - #define _GRAPHUTIL_H - -void rect_draw_some_item(HBITMAP src, RECT16 src_rect, HBITMAP dest, RECT16 dest_rect, - short trans, short main_win); -void fry_dc(HWND hwnd,HDC dc); - -void DisposeGWorld(HBITMAP bitmap); -HBITMAP load_pict(short pict_num,HDC); -void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern); - -/* GK */ -extern HBITMAP ReadBMP(char * fileName); -extern HBITMAP ReadScenFile(char* filename); - -#endif diff --git a/Blades of Exile/ACTIONS.CPP b/Blades of Exile/boe.actions.cpp similarity index 96% rename from Blades of Exile/ACTIONS.CPP rename to Blades of Exile/boe.actions.cpp index d4c265e9..27e2af89 100644 --- a/Blades of Exile/ACTIONS.CPP +++ b/Blades of Exile/boe.actions.cpp @@ -1,30 +1,29 @@ #include -#include /* for sprintf */ -#include -#include +#include /* for sprintf */ +#include +#include #include "global.h" -#include "blades.h" -#include "gutils.h" -#include "graphics.h" -#include "fileio.h" -#include "dlgutils.h" -#include "locutils.h" -#include "fields.h" -#include "town.h" -#include "math.h" -#include "text.h" -#include "party.h" -#include "monster.h" -#include "specials.h" -#include "newgraph.h" -#include "combat.h" -#include "items.h" -#include "exlsound.h" -#include "infodlgs.h" -#include "itemdata.h" -#include "dlogtool.h" -#include "graphutl.h" -#include "actions.h" +#include "boe.main.h" +#include "boe.graphics.h" +#include "boe.fileio.h" +#include "boe.dlgutil.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.town.h" +#include +#include "boe.text.h" +#include "boe.party.h" +#include "boe.monster.h" +#include "boe.specials.h" +#include "boe.newgraph.h" +#include "boe.combat.h" +#include "boe.items.h" +#include "tools/exlsound.h" +#include "boe.infodlg.h" +#include "boe.itemdata.h" +#include "tools/dlogtool.h" +#include "boe.graphutil.h" +#include "boe.actions.h" #include "globvar.h" diff --git a/Blades of Exile/ACTIONS.H b/Blades of Exile/boe.actions.h similarity index 100% rename from Blades of Exile/ACTIONS.H rename to Blades of Exile/boe.actions.h diff --git a/Blades of Exile/COMBAT.CPP b/Blades of Exile/boe.combat.cpp similarity index 96% rename from Blades of Exile/COMBAT.CPP rename to Blades of Exile/boe.combat.cpp index f48d4562..ed6571af 100644 --- a/Blades of Exile/COMBAT.CPP +++ b/Blades of Exile/boe.combat.cpp @@ -1,20 +1,20 @@ #include -#include "stdio.h" +#include #include "global.h" -#include "monster.h" -#include "graphics.h" -#include "locutils.h" -#include "newgraph.h" -#include "infodlgs.h" -#include "fields.h" -#include "text.h" -#include "items.h" -#include "party.h" -#include "combat.h" -#include "exlsound.h" -#include "town.h" -#include "specials.h" -#include "gutils.h" +#include "boe.monster.h" +#include "boe.graphics.h" +#include "boe.locutils.h" +#include "boe.newgraph.h" +#include "boe.infodlg.h" +#include "boe.fields.h" +#include "boe.text.h" +#include "boe.items.h" +#include "boe.party.h" +#include "boe.combat.h" +#include "tools/exlsound.h" +#include "boe.town.h" +#include "boe.specials.h" +#include "boe.graphutil.h" #include "globvar.h" diff --git a/Blades of Exile/COMBAT.H b/Blades of Exile/boe.combat.h similarity index 98% rename from Blades of Exile/COMBAT.H rename to Blades of Exile/boe.combat.h index 1963352a..f0a852d1 100644 --- a/Blades of Exile/COMBAT.H +++ b/Blades of Exile/boe.combat.h @@ -1,7 +1,7 @@ #ifndef _COMBAT_H #define _COMBAT_H -#include "location.h" +#include "classes/location.h" #include "global.h" void start_outdoor_combat(outdoor_creature_type encounter,unsigned char in_which_terrain,short num_walls); diff --git a/Blades of Exile/CONSTS.H b/Blades of Exile/boe.consts.h similarity index 100% rename from Blades of Exile/CONSTS.H rename to Blades of Exile/boe.consts.h diff --git a/Blades of Exile/DLGUTILS.CPP b/Blades of Exile/boe.dlgutil.cpp similarity index 95% rename from Blades of Exile/DLGUTILS.CPP rename to Blades of Exile/boe.dlgutil.cpp index 89359d4d..1acbb32d 100644 --- a/Blades of Exile/DLGUTILS.CPP +++ b/Blades of Exile/boe.dlgutil.cpp @@ -1,23 +1,23 @@ #include -#include "string.h" +#include #include "global.h" -#include "dlgutils.h" -#include "text.h" -#include "town.h" -#include "itemdata.h" -#include "locutils.h" -#include "fields.h" -#include "party.h" -#include "specials.h" -#include "fileio.h" -#include "graphics.h" -#include "items.h" -#include "exlsound.h" -#include "stdio.h" -#include "dlogtool.h" -#include "newgraph.h" -#include "infodlgs.h" -#include "graphutl.h" +#include "boe.dlgutil.h" +#include "boe.text.h" +#include "boe.town.h" +#include "boe.itemdata.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.party.h" +#include "boe.specials.h" +#include "boe.fileio.h" +#include "boe.graphics.h" +#include "boe.items.h" +#include "tools/exlsound.h" +#include +#include "tools/dlogtool.h" +#include "boe.newgraph.h" +#include "boe.infodlg.h" +#include "boe.graphutil.h" #include "globvar.h" diff --git a/Blades of Exile/DLGUTILS.H b/Blades of Exile/boe.dlgutil.h similarity index 100% rename from Blades of Exile/DLGUTILS.H rename to Blades of Exile/boe.dlgutil.h diff --git a/Blades of Exile/FIELDS.CPP b/Blades of Exile/boe.fields.cpp similarity index 94% rename from Blades of Exile/FIELDS.CPP rename to Blades of Exile/boe.fields.cpp index 18e0ab19..2b6fdefe 100644 --- a/Blades of Exile/FIELDS.CPP +++ b/Blades of Exile/boe.fields.cpp @@ -1,8 +1,8 @@ #include #include "global.h" -#include "locutils.h" -#include "fields.h" +#include "boe.locutils.h" +#include "boe.fields.h" #include "globvar.h" Boolean is_explored(short i,short j) diff --git a/Blades of Exile/FIELDS.H b/Blades of Exile/boe.fields.h similarity index 100% rename from Blades of Exile/FIELDS.H rename to Blades of Exile/boe.fields.h diff --git a/Blades of Exile/FILEIO.CPP b/Blades of Exile/boe.fileio.cpp similarity index 97% rename from Blades of Exile/FILEIO.CPP rename to Blades of Exile/boe.fileio.cpp index 621f2710..6d52900d 100644 --- a/Blades of Exile/FILEIO.CPP +++ b/Blades of Exile/boe.fileio.cpp @@ -2,22 +2,21 @@ #include #include -#include +#include #include "global.h" -#include "stdio.h" -#include "fileio.h" -#include "text.h" -#include "town.h" -#include "items.h" -#include "graphics.h" -#include "locutils.h" -#include "fields.h" -#include "newgraph.h" -#include "dlgutils.h" -#include "gutils.h" -#include "infodlgs.h" -#include "graphutl.h" -#include "exlsound.h" +#include +#include "boe.fileio.h" +#include "boe.text.h" +#include "boe.town.h" +#include "boe.items.h" +#include "boe.graphics.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.newgraph.h" +#include "boe.dlgutil.h" +#include "boe.infodlg.h" +#include "boe.graphutil.h" +#include "tools/exlsound.h" #include "globvar.h" diff --git a/Blades of Exile/FILEIO.H b/Blades of Exile/boe.fileio.h similarity index 100% rename from Blades of Exile/FILEIO.H rename to Blades of Exile/boe.fileio.h diff --git a/Blades of Exile/GRAPHICS.CPP b/Blades of Exile/boe.graphics.cpp similarity index 96% rename from Blades of Exile/GRAPHICS.CPP rename to Blades of Exile/boe.graphics.cpp index df83846f..95444d91 100644 --- a/Blades of Exile/GRAPHICS.CPP +++ b/Blades of Exile/boe.graphics.cpp @@ -1,20 +1,19 @@ #include -#include "string.h" -#include "stdio.h" +#include +#include #include "global.h" -#include "graphics.h" -#include "newgraph.h" -#include "gutils.h" -#include "monster.h" -#include "dlogtool.h" -#include "locutils.h" -#include "fields.h" -#include "text.h" -#include "exlsound.h" -#include "graphutl.h" +#include "boe.graphics.h" +#include "boe.newgraph.h" +#include "boe.monster.h" +#include "tools/dlogtool.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.text.h" +#include "tools/exlsound.h" +#include "boe.graphutil.h" -#include "infodlgs.h" +#include "boe.infodlg.h" #include "globvar.h" diff --git a/Blades of Exile/GRAPHICS.H b/Blades of Exile/boe.graphics.h similarity index 100% rename from Blades of Exile/GRAPHICS.H rename to Blades of Exile/boe.graphics.h diff --git a/Blades of Exile/GUTILS.CPP b/Blades of Exile/boe.graphutil.cpp similarity index 67% rename from Blades of Exile/GUTILS.CPP rename to Blades of Exile/boe.graphutil.cpp index 5f4e1068..c21b683d 100644 --- a/Blades of Exile/GUTILS.CPP +++ b/Blades of Exile/boe.graphutil.cpp @@ -1,21 +1,378 @@ +#define xmin(a,b) ((a) < (b) ? (a) : (b)) #include - +#include +#include +#include +#include #include "global.h" -#include "gutils.h" -#include "text.h" -#include "fields.h" -#include "locutils.h" -#include "graphics.h" -#include "infodlgs.h" -#include "monster.h" -#include "dlogtool.h" -#include "exlsound.h" -#include "graphutl.h" -#include "stdio.h" +#include "boe.text.h" +#include +#include "tools/exlsound.h" +#include "boe.infodlg.h" +#include "boe.graphutil.h" #include "globvar.h" +void rect_draw_some_item(HBITMAP src, RECT16 src_rect,HBITMAP dest, RECT16 dest_rect, + short trans, short main_win) +{ + HDC hdcMem,hdcMem2,hdcMem3,destDC; + HBITMAP transbmp; + COLORREF white = RGB(255,255,255),oldcolor; + HBRUSH hbrush,old_brush; + COLORREF x = RGB(17,17,17); + HBITMAP store,store2; + Boolean dlog_draw = FALSE; + + if (main_win == 2) + { + destDC = (HDC) dest; + main_win = 1; + dlog_draw = TRUE; + hdcMem = CreateCompatibleDC(destDC); + SelectObject(hdcMem, src); + SetMapMode(hdcMem,GetMapMode((HDC) mainPtr)); + } + else + { + destDC = main_dc; + hdcMem = main_dc2; + store = (HBITMAP) SelectObject(hdcMem,src); + } + + if (trans != 1) + { + if (main_win == 0) + { // Not transparent, into bitmap + hdcMem2 = main_dc3; + store2 = (HBITMAP) SelectObject(hdcMem2, dest); + StretchBlt(hdcMem2,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,(trans >= 0) ? SRCCOPY : SRCAND); + SelectObject(hdcMem2,store2); + } + else + { // Not transparent, onto screen + + if (trans == 2) + { + hbrush = CreateSolidBrush(x); + old_brush = (HBRUSH) SelectObject(destDC,hbrush); + } + + if (dlog_draw == FALSE) SetViewportOrgEx(destDC,ulx,uly,NULL); + + StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,(trans == 0) ? SRCCOPY : MERGECOPY); + if (trans == 2) + { + SelectObject(destDC,old_brush); + if (DeleteObject(hbrush) == 0) play_sound(1); + } + + if (dlog_draw == FALSE) SetViewportOrgEx(destDC,0,0,NULL); + } + + } // end of non-transparent draws + else + { + if (main_win == 0) + { + hdcMem3 = CreateCompatibleDC(hdcMem); + SelectObject(hdcMem3, dest); + SetMapMode(hdcMem3,GetMapMode((HDC) mainPtr)); + if ((src_rect.right - src_rect.left < 72) && + (src_rect.bottom - src_rect.top < 72)) + transbmp = bw_bitmap; + else transbmp = CreateBitmap(src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,1,1,NULL); + + hdcMem2 = CreateCompatibleDC(destDC); + SelectObject(hdcMem2, transbmp); + oldcolor = SetBkColor(hdcMem, white); + StretchBlt(hdcMem2,0,0,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,SRCCOPY); + SetBkColor(hdcMem, oldcolor); + + StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,SRCINVERT); + StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem2,0,0,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top,SRCAND); + StretchBlt(hdcMem3,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,SRCINVERT); + DeleteDC(hdcMem3); + DeleteDC(hdcMem2); + if (transbmp != bw_bitmap) DeleteObject(transbmp); + } + else + { + if (dlog_draw == FALSE) SetViewportOrgEx(destDC,ulx,uly,NULL); + if ((src_rect.right - src_rect.left < 72) && + (src_rect.bottom - src_rect.top < 72)) + transbmp = bw_bitmap; + else transbmp = CreateBitmap(src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,1,1,NULL); + + hdcMem2 = CreateCompatibleDC(destDC); + + SelectObject(hdcMem2, transbmp); + + oldcolor = SetBkColor(hdcMem, white); + + StretchBlt(hdcMem2,0,0,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,SRCCOPY); + + SetBkColor(hdcMem, oldcolor); + + StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,SRCINVERT); + + StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem2,0,0,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top,SRCAND); + + StretchBlt(destDC,dest_rect.left,dest_rect.top,dest_rect.right - dest_rect.left, + dest_rect.bottom - dest_rect.top, + hdcMem,src_rect.left,src_rect.top,src_rect.right - src_rect.left, + src_rect.bottom - src_rect.top,SRCINVERT); + + if (dlog_draw == FALSE) SetViewportOrgEx(destDC,0,0,NULL); + + DeleteDC(hdcMem2); + + if (transbmp != bw_bitmap) DeleteObject(transbmp); + } + } + if (dlog_draw == TRUE) DeleteDC(hdcMem); + else SelectObject(hdcMem,store); +} + +void fry_dc(HWND hwnd,HDC dc) +{ + if (ReleaseDC(hwnd,dc) == 0) + DebugQuit("Cannot release DC in fry_dc"); +} + +// which_mode is 0 ... dest is a bitmap +// is 1 ... ignore dest ... paint on mainPtr +// is 2 ... dest is a dialog, use the dialog pattern +// both pattern gworlds are 192 x 256 +void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern) +{ + HBITMAP source_pat; + RECT pattern_source = {32,168,96,232}, pat_dest_orig = {0,0,64,64},pat_dest; + short i,j; + + RECT draw_from_orig = {0,0,192,256},draw_from,draw_to; + short store_ulx,store_uly; + + if (which_mode == 2) { + source_pat = dialog_pattern_gworld; + if (dlog_pat_placed == 0) { + dlog_pat_placed = 1; + OffsetRect(&pattern_source, 64 * 2,0); + for (i = 0; i < 3; i++) + for (j = 0; j < 4; j++) { + pat_dest = pat_dest_orig; + OffsetRect(&pat_dest,64 * i, 64 * j); + rect_draw_some_item(mixed_gworld,pattern_source, + dialog_pattern_gworld,pat_dest,0,0); + } + } + } + else { + source_pat = pattern_gworld; + if (current_pattern != which_pattern) { + current_pattern = which_pattern; + OffsetRect(&pattern_source, 64 * (which_pattern % 5), + 64 * (which_pattern / 5)); + for (i = 0; i < 3; i++) + for (j = 0; j < 4; j++) { + pat_dest = pat_dest_orig; + OffsetRect(&pat_dest,64 * i, 64 * j); + rect_draw_some_item(mixed_gworld,pattern_source, + pattern_gworld,pat_dest,0,0); + } + } + } + + // now patterns are loaded, so have fun + // first nullify ul shifting + store_ulx = ulx; + store_uly = uly; + ulx = uly = 0; + for (i = 0; i < (dest_rect.right / 192) + 1; i++) + for (j = 0; j < (dest_rect.bottom / 256) + 1; j++) { + draw_to = draw_from_orig; + OffsetRect(&draw_to,192 * i, 256 * j); + IntersectRect(&draw_to,&draw_to,&dest_rect); + if (draw_to.right != 0) { + draw_from = draw_to; + OffsetRect(&draw_from, -192 * i, -256 * j); + switch (which_mode) { + case 0: + rect_draw_some_item(source_pat,draw_from, + dest,draw_to,0,0); break; + case 1: + rect_draw_some_item(source_pat,draw_from, + source_pat,draw_to,0,1); break; + case 2: + rect_draw_some_item(source_pat,draw_from, + dest,draw_to,0,2); break; + } + } + } + ulx = store_ulx; + uly = store_uly; +} + +HBITMAP load_pict(short pict_num,HDC) +{ + HBITMAP got_bitmap; + + switch(pict_num) { + case 700: + case 701: + case 702: got_bitmap = ReadBMP("images/STATAREA.BMP"); break; + case 703: got_bitmap = ReadBMP("images/TEXTBAR.BMP"); break; + case 704: got_bitmap = ReadBMP("images/BUTTONS.BMP"); break; + case 705: got_bitmap = ReadBMP("images/TERSCRN.BMP"); break; + case 800: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TER1.BMP"); + else + got_bitmap = ReadBMP("images/TER1_D.BMP"); + break; + case 801: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TER2.BMP"); + else + got_bitmap = ReadBMP("images/TER2_D.BMP"); + break; + case 802: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TER3.BMP"); + else + got_bitmap = ReadBMP("images/TER3_D.BMP"); + break; + case 803: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TER4.BMP"); + else + got_bitmap = ReadBMP("images/TER4_D.BMP"); + break; + case 804: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TER5.BMP"); + else + got_bitmap = ReadBMP("images/TER5_D.BMP"); + break; + case 805: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TER6.BMP"); + else + got_bitmap = ReadBMP("images/TER6_D.BMP"); + break; + case 820: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TERANIM.BMP"); + else + got_bitmap = ReadBMP("images/TERANIM_D.BMP"); + break; + case 821: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/FIELDS.BMP"); + else + got_bitmap = ReadBMP("images/FIELDS_D.BMP"); + break; + case 830: got_bitmap = ReadBMP("images/STARTUP.BMP"); break; + case 831: got_bitmap = ReadBMP("images/STANIM.BMP"); break; + case 832: got_bitmap = ReadBMP("images/STARTBUT.BMP"); break; + case 850: got_bitmap = ReadBMP("images/DLOGPICS.BMP"); break; + case 851: got_bitmap = ReadBMP("images/SCENPICS.BMP"); break; + case 860: got_bitmap = ReadBMP("images/TALKPORT.BMP"); break; +// case 875: got_bitmap = ReadBMP("images/DLOGMAPS.BMP"); break; => Exile III maps + case 880: got_bitmap = ReadBMP("images/MISSILES.BMP"); break; + case 900: got_bitmap = ReadBMP("images/TINYOBJ.BMP"); break; + case 901: got_bitmap = ReadBMP("images/OBJECTS.BMP"); break; + case 902: + case 905: got_bitmap = ReadBMP("images/PCS.BMP"); break; + case 903: + case 904: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/MIXED.BMP"); + else + got_bitmap = ReadBMP("images/MIXED_D.BMP"); + break; + case 910: + case 911: + case 912: got_bitmap = ReadBMP("images/BIGSCEN.BMP"); break; + case 1100: case 1200: got_bitmap = ReadBMP("images/MONST1.BMP"); break; + case 1101: case 1201: got_bitmap = ReadBMP("images/MONST2.BMP"); break; + case 1102: case 1202: got_bitmap = ReadBMP("images/MONST3.BMP"); break; + case 1103: case 1203: got_bitmap = ReadBMP("images/MONST4.BMP"); break; + case 1104: case 1204: got_bitmap = ReadBMP("images/MONST5.BMP"); break; + case 1105: case 1205: got_bitmap = ReadBMP("images/MONST6.BMP"); break; + case 1106: case 1206: got_bitmap = ReadBMP("images/MONST7.BMP"); break; + case 1107: case 1207: got_bitmap = ReadBMP("images/MONST8.BMP"); break; + case 1108: case 1208: got_bitmap = ReadBMP("images/MONST9.BMP"); break; + case 1109: case 1209: got_bitmap = ReadBMP("images/MONST10.BMP"); break; + case 1400: got_bitmap = ReadBMP("images/STSCICON.BMP"); break; + case 1401: got_bitmap = ReadBMP("images/HELPPICS.BMP"); break; + case 1402: got_bitmap = ReadBMP("images/APPIC.BMP"); break; +/* case 1500: + case 1501: + case 1502: + case 1503: + case 1504: + case 1505: + case 1506: + case 1507: + got_bitmap = ReadBMP("images/BIGMAPS.BMP"); break;*/ // <= doesn't exist + case 2000: got_bitmap = ReadBMP("images/DLOGBTNS.BMP"); break; + case 3000: got_bitmap = ReadBMP("images/START.BMP"); break; + case 3001: got_bitmap = ReadBMP("images/SPIDLOGO.BMP"); break; + case 4000: if(party.stuff_done[307][0] == 0) + got_bitmap = ReadBMP("images/TRIMS.BMP"); + else + got_bitmap = ReadBMP("images/TRIMS_D.BMP"); + break; + + default: got_bitmap = NULL; + } + return got_bitmap; +} + +/* GK */ + +HBITMAP ReadBMP(char * fileName) +{ + return (HBITMAP) LoadImage(0, fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); +} + +HBITMAP ReadScenFile(char* filename){ //like ReadBMP but in the current scenario folder only. + + short store_val; + char str[256]= "scenarios/"; + store_val= strlen(party.scen_name)-1; + while(party.scen_name[store_val] != '.'){ // get rid of the .exs part + store_val--; + } + strncat(str, party.scen_name, store_val + 1); // the scenario is in a subfolder so add that to the filepath + strcat(str,"exr/"); + strcat(str,filename); + + return (HBITMAP) LoadImage(0, str, IMAGE_BITMAP, 0 ,0 , LR_LOADFROMFILE); +} + void draw_one_terrain_spot (short i,short j,short terrain_to_draw,short dest) //short dest; // 0 - terrain gworld 1 - screen // if terrain_to_draw is -1, do black diff --git a/Blades of Exile/GUTILS.H b/Blades of Exile/boe.graphutil.h similarity index 73% rename from Blades of Exile/GUTILS.H rename to Blades of Exile/boe.graphutil.h index 77bd692e..b59f99ea 100644 --- a/Blades of Exile/GUTILS.H +++ b/Blades of Exile/boe.graphutil.h @@ -1,5 +1,5 @@ -#ifndef _GUTILS_H - #define _GUTILS_H +#ifndef _GRAPHUTIL_H + #define _GRAPHUTIL_H void draw_one_terrain_spot (short i,short j,short terrain_to_draw,short dest); void draw_monsters(); @@ -31,4 +31,17 @@ void frame_space(location where,short mode,short width,short height); char add_trim_to_array(int x, int y, unsigned char ter_type); char add_trim_to_array(location where,unsigned char ter_type); + +void rect_draw_some_item(HBITMAP src, RECT16 src_rect, HBITMAP dest, RECT16 dest_rect, + short trans, short main_win); +void fry_dc(HWND hwnd,HDC dc); + +void DisposeGWorld(HBITMAP bitmap); +HBITMAP load_pict(short pict_num,HDC); +void paint_pattern(HBITMAP dest,short which_mode,RECT dest_rect,short which_pattern); + +/* GK */ +extern HBITMAP ReadBMP(char * fileName); +extern HBITMAP ReadScenFile(char* filename); + #endif diff --git a/Blades of Exile/INFODLGS.CPP b/Blades of Exile/boe.infodlg.cpp similarity index 95% rename from Blades of Exile/INFODLGS.CPP rename to Blades of Exile/boe.infodlg.cpp index 027c2138..64660786 100644 --- a/Blades of Exile/INFODLGS.CPP +++ b/Blades of Exile/boe.infodlg.cpp @@ -1,21 +1,21 @@ #include -#include "stdio.h" +#include #include "global.h" -#include "graphics.h" -#include "newgraph.h" -#include "items.h" -#include "string.h" -#include "monster.h" -#include "dlogtool.h" -#include "party.h" -#include "fields.h" -#include "locutils.h" -#include "text.h" -#include "exlsound.h" -#include "infodlgs.h" -#include "fileio.h" +#include "boe.graphics.h" +#include "boe.newgraph.h" +#include "boe.items.h" +#include +#include "boe.monster.h" +#include "tools/dlogtool.h" +#include "boe.party.h" +#include "boe.fields.h" +#include "boe.locutils.h" +#include "boe.text.h" +#include "tools/exlsound.h" +#include "boe.infodlg.h" +#include "boe.fileio.h" #include "globvar.h" diff --git a/Blades of Exile/INFODLGS.H b/Blades of Exile/boe.infodlg.h similarity index 100% rename from Blades of Exile/INFODLGS.H rename to Blades of Exile/boe.infodlg.h diff --git a/Blades of Exile/ITEMDATA.CPP b/Blades of Exile/boe.itemdata.cpp similarity index 94% rename from Blades of Exile/ITEMDATA.CPP rename to Blades of Exile/boe.itemdata.cpp index 7915f8f6..0a4763f9 100644 --- a/Blades of Exile/ITEMDATA.CPP +++ b/Blades of Exile/boe.itemdata.cpp @@ -2,9 +2,9 @@ #include #include "global.h" -#include "itemdata.h" -#include "stdio.h" -#include "string.h" +#include "boe.itemdata.h" +#include +#include #include "globvar.h" diff --git a/Blades of Exile/ITEMDATA.H b/Blades of Exile/boe.itemdata.h similarity index 100% rename from Blades of Exile/ITEMDATA.H rename to Blades of Exile/boe.itemdata.h diff --git a/Blades of Exile/ITEMS.CPP b/Blades of Exile/boe.items.cpp similarity index 94% rename from Blades of Exile/ITEMS.CPP rename to Blades of Exile/boe.items.cpp index 96b2676c..2512bfaa 100644 --- a/Blades of Exile/ITEMS.CPP +++ b/Blades of Exile/boe.items.cpp @@ -2,23 +2,22 @@ #include "global.h" -#include "graphics.h" -#include "text.h" -#include "dlogtool.h" -#include "items.h" -#include "party.h" -#include "fields.h" -#include "locutils.h" -#include "newgraph.h" -#include "dlogtool.h" -#include "itemdata.h" -#include "infodlgs.h" -#include "exlsound.h" -#include "stdio.h" -#include "string.h" -#include "graphutl.h" -#include "monster.h" -#include "specials.h" +#include "boe.graphics.h" +#include "boe.text.h" +#include "tools/dlogtool.h" +#include "boe.items.h" +#include "boe.party.h" +#include "boe.fields.h" +#include "boe.locutils.h" +#include "boe.newgraph.h" +#include "boe.itemdata.h" +#include "boe.infodlg.h" +#include "tools/exlsound.h" +#include +#include +#include "boe.graphutil.h" +#include "boe.monster.h" +#include "boe.specials.h" #include "globvar.h" diff --git a/Blades of Exile/ITEMS.H b/Blades of Exile/boe.items.h similarity index 96% rename from Blades of Exile/ITEMS.H rename to Blades of Exile/boe.items.h index 869a8f32..eab73b13 100644 --- a/Blades of Exile/ITEMS.H +++ b/Blades of Exile/boe.items.h @@ -1,8 +1,8 @@ #ifndef _ITEMS_H #define _ITEMS_H -#include "location.h" -#include "item.h" +#include "classes/location.h" +#include "classes/item.h" #include "global.h" Boolean give_to_party(item_record_type item,short print_result); diff --git a/Blades of Exile/LOCUTILS.CPP b/Blades of Exile/boe.locutils.cpp similarity index 95% rename from Blades of Exile/LOCUTILS.CPP rename to Blades of Exile/boe.locutils.cpp index bf693574..3f6525a2 100644 --- a/Blades of Exile/LOCUTILS.CPP +++ b/Blades of Exile/boe.locutils.cpp @@ -1,10 +1,10 @@ #include -#include "math.h" +#include #include "global.h" -#include "locutils.h" -#include "text.h" -#include "monster.h" -#include "fields.h" +#include "boe.locutils.h" +#include "boe.text.h" +#include "boe.monster.h" +#include "boe.fields.h" #include "globvar.h" diff --git a/Blades of Exile/LOCUTILS.H b/Blades of Exile/boe.locutils.h similarity index 98% rename from Blades of Exile/LOCUTILS.H rename to Blades of Exile/boe.locutils.h index d009b84b..34db7699 100644 --- a/Blades of Exile/LOCUTILS.H +++ b/Blades of Exile/boe.locutils.h @@ -1,7 +1,7 @@ #ifndef _LOCUTILS_H #define _LOCUTILS_H -#include "location.h" +#include "classes/location.h" #include "global.h" short dist(location p1,location p2); diff --git a/Blades of Exile/BLADES.CPP b/Blades of Exile/boe.main.cpp similarity index 89% rename from Blades of Exile/BLADES.CPP rename to Blades of Exile/boe.main.cpp index 99cdd26e..a011c798 100644 --- a/Blades of Exile/BLADES.CPP +++ b/Blades of Exile/boe.main.cpp @@ -1,20 +1,20 @@ #include #include "global.h" -#include "graphics.h" -#include "newgraph.h" -#include "fileio.h" -#include "actions.h" -#include "text.h" -#include "party.h" -#include "exlsound.h" -#include "items.h" -#include "fields.h" -#include "town.h" -#include "dlogtool.h" -#include "dlgutils.h" -#include "infodlgs.h" -#include "graphutl.h" -#include "blades.h" +#include "boe.graphics.h" +#include "boe.newgraph.h" +#include "boe.fileio.h" +#include "boe.actions.h" +#include "boe.text.h" +#include "boe.party.h" +#include "tools/exlsound.h" +#include "boe.items.h" +#include "boe.fields.h" +#include "boe.town.h" +#include "tools/dlogtool.h" +#include "boe.dlgutil.h" +#include "boe.infodlg.h" +#include "boe.graphutil.h" +#include "boe.main.h" #include "globvar.h" @@ -914,3 +914,42 @@ void cursor_stay() showcursor(TRUE); } } + +void move_sound(unsigned char ter,short step) +{ + short spec; + + spec = scenario.ter_types[ter].special; + + if ((monsters_going == false) && (overall_mode < 10) && (party.in_boat >= 0)) { + if (spec == 21) + return; + play_sound(48); + } + else if ((monsters_going == false) && (overall_mode < 10) && (party.in_horse >= 0)) {//// + play_sound(85); + } + else if(spec == 5) //if poisoned land don't play squish sound : BoE legacy behavior, can be removed safely + return; +// else if(spec == 6) //if diseased land do the same +// return; + else switch(scenario.ter_types[ter].step_sound){ + case 0: + if (step % 2 == 0) //footsteps alternate sound + play_sound(49); + else play_sound(50); + break; + case 1: + play_sound(55); //squish + break; + case 2: + play_sound(47); //crunch + break; + case 3: + break; //silence : do nothing + default: + if (step % 2 == 0) //safety footsteps valve + play_sound(49); + else play_sound(50); + } +} diff --git a/Blades of Exile/BLADES.H b/Blades of Exile/boe.main.h similarity index 73% rename from Blades of Exile/BLADES.H rename to Blades of Exile/boe.main.h index 73184db5..d145f9b6 100644 --- a/Blades of Exile/BLADES.H +++ b/Blades of Exile/boe.main.h @@ -1,9 +1,10 @@ #ifndef _BLADES_H #define _BLADES_H -#include "pc.h" // party_record_type +#include "classes/pc.h" // party_record_type #include "global.h" // structs +void move_sound(unsigned char ter,short step); void check_game_done(); Boolean handle_menu (short item, HMENU menu); void load_cursors(); diff --git a/Blades of Exile/MONSTER.CPP b/Blades of Exile/boe.monster.cpp similarity index 96% rename from Blades of Exile/MONSTER.CPP rename to Blades of Exile/boe.monster.cpp index aee6788d..b9249c49 100644 --- a/Blades of Exile/MONSTER.CPP +++ b/Blades of Exile/boe.monster.cpp @@ -1,16 +1,16 @@ #include -#include "stdio.h" +#include #include "global.h" -#include "locutils.h" -#include "fields.h" -#include "monster.h" -#include "text.h" -#include "specials.h" -#include "exlsound.h" -#include "graphics.h" -#include "newgraph.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.monster.h" +#include "boe.text.h" +#include "boe.specials.h" +#include "tools/exlsound.h" +#include "boe.graphics.h" +#include "boe.newgraph.h" -#include "infodlgs.h" +#include "boe.infodlg.h" #include "globvar.h" diff --git a/Blades of Exile/MONSTER.H b/Blades of Exile/boe.monster.h similarity index 100% rename from Blades of Exile/MONSTER.H rename to Blades of Exile/boe.monster.h diff --git a/Blades of Exile/NEWGRAPH.CPP b/Blades of Exile/boe.newgraph.cpp similarity index 96% rename from Blades of Exile/NEWGRAPH.CPP rename to Blades of Exile/boe.newgraph.cpp index 77b86ec0..824e1ba4 100644 --- a/Blades of Exile/NEWGRAPH.CPP +++ b/Blades of Exile/boe.newgraph.cpp @@ -1,20 +1,19 @@ #include -#include "string.h" -#include "stdio.h" +#include +#include #include "global.h" -#include "graphics.h" -#include "gutils.h" -#include "monster.h" -#include "dlogtool.h" -#include "newgraph.h" -#include "fileio.h" -#include "itemdata.h" -#include "locutils.h" -#include "fields.h" -#include "text.h" -#include "exlsound.h" -#include "graphutl.h" +#include "boe.graphics.h" +#include "boe.monster.h" +#include "tools/dlogtool.h" +#include "boe.newgraph.h" +#include "boe.fileio.h" +#include "boe.itemdata.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.text.h" +#include "tools/exlsound.h" +#include "boe.graphutil.h" #include "globvar.h" diff --git a/Blades of Exile/NEWGRAPH.H b/Blades of Exile/boe.newgraph.h similarity index 100% rename from Blades of Exile/NEWGRAPH.H rename to Blades of Exile/boe.newgraph.h diff --git a/Blades of Exile/PARTY.CPP b/Blades of Exile/boe.party.cpp similarity index 96% rename from Blades of Exile/PARTY.CPP rename to Blades of Exile/boe.party.cpp index a49a4ac0..70372f5d 100644 --- a/Blades of Exile/PARTY.CPP +++ b/Blades of Exile/boe.party.cpp @@ -1,25 +1,24 @@ #include -#include "stdio.h" +#include #include "global.h" -#include "fileio.h" -#include "graphics.h" -#include "gutils.h" -#include "newgraph.h" -#include "specials.h" -#include "itemdata.h" -#include "infodlgs.h" -#include "items.h" -#include "string.h" -#include "party.h" -#include "monster.h" -#include "dlogtool.h" -#include "town.h" -#include "combat.h" -#include "locutils.h" -#include "fields.h" -#include "text.h" -#include "exlsound.h" -#include "graphutl.h" +#include "boe.fileio.h" +#include "boe.graphics.h" +#include "boe.newgraph.h" +#include "boe.specials.h" +#include "boe.itemdata.h" +#include "boe.infodlg.h" +#include "boe.items.h" +#include +#include "boe.party.h" +#include "boe.monster.h" +#include "tools/dlogtool.h" +#include "boe.town.h" +#include "boe.combat.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "boe.text.h" +#include "tools/exlsound.h" +#include "boe.graphutil.h" #include "globvar.h" void draw_caster_buttons(); diff --git a/Blades of Exile/PARTY.H b/Blades of Exile/boe.party.h similarity index 100% rename from Blades of Exile/PARTY.H rename to Blades of Exile/boe.party.h diff --git a/Blades of Exile/SPECIALS.CPP b/Blades of Exile/boe.specials.cpp similarity index 96% rename from Blades of Exile/SPECIALS.CPP rename to Blades of Exile/boe.specials.cpp index 826d1b32..a343ef2b 100644 --- a/Blades of Exile/SPECIALS.CPP +++ b/Blades of Exile/boe.specials.cpp @@ -1,26 +1,26 @@ #include -#include "stdio.h" -#include "string.h" +#include +#include #include "global.h" -#include "party.h" -#include "town.h" -#include "text.h" -#include "infodlgs.h" -#include "items.h" -#include "itemdata.h" -#include "combat.h" -#include "monster.h" -#include "locutils.h" -#include "fields.h" -#include "exlsound.h" -#include "graphics.h" -#include "fileio.h" -#include "specials.h" -#include "newgraph.h" -#include "dlgutils.h" -#include "actions.h" -#include "graphutl.h" -#include "dlogtool.h" +#include "boe.party.h" +#include "boe.town.h" +#include "boe.text.h" +#include "boe.infodlg.h" +#include "boe.items.h" +#include "boe.itemdata.h" +#include "boe.combat.h" +#include "boe.monster.h" +#include "boe.locutils.h" +#include "boe.fields.h" +#include "tools/exlsound.h" +#include "boe.graphics.h" +#include "boe.fileio.h" +#include "boe.specials.h" +#include "boe.newgraph.h" +#include "boe.dlgutil.h" +#include "boe.actions.h" +#include "boe.graphutil.h" +#include "tools/dlogtool.h" #include "globvar.h" diff --git a/Blades of Exile/SPECIALS.H b/Blades of Exile/boe.specials.h similarity index 100% rename from Blades of Exile/SPECIALS.H rename to Blades of Exile/boe.specials.h diff --git a/Blades of Exile/TEXT.CPP b/Blades of Exile/boe.text.cpp similarity index 96% rename from Blades of Exile/TEXT.CPP rename to Blades of Exile/boe.text.cpp index a1ce912d..10ad5dd0 100644 --- a/Blades of Exile/TEXT.CPP +++ b/Blades of Exile/boe.text.cpp @@ -2,13 +2,13 @@ #define TEXT_BUF_LEN 70 #include "global.h" -#include "stdio.h" -#include "text.h" -#include "string.h" -#include "locutils.h" -#include "fields.h" -#include "exlsound.h" -#include "graphutl.h" +#include +#include "boe.text.h" +#include +#include "boe.locutils.h" +#include "boe.fields.h" +#include "tools/exlsound.h" +#include "boe.graphutil.h" #include "globvar.h" diff --git a/Blades of Exile/TEXT.H b/Blades of Exile/boe.text.h similarity index 94% rename from Blades of Exile/TEXT.H rename to Blades of Exile/boe.text.h index 1ceea15c..c3aa1b89 100644 --- a/Blades of Exile/TEXT.H +++ b/Blades of Exile/boe.text.h @@ -2,8 +2,8 @@ #define _TEXT_H #include // RECT, HDC etc. -#include "location.h" // location -#include "pc.h" // pc_record_type +#include "classes/location.h" // location +#include "classes/pc.h" // pc_record_type #include "global.h" // structs diff --git a/Blades of Exile/TOWN.CPP b/Blades of Exile/boe.town.cpp similarity index 96% rename from Blades of Exile/TOWN.CPP rename to Blades of Exile/boe.town.cpp index c6bb7335..f6379828 100644 --- a/Blades of Exile/TOWN.CPP +++ b/Blades of Exile/boe.town.cpp @@ -1,23 +1,21 @@ #include -#include "stdio.h" +#include #include "global.h" -#include "gutils.h" -#include "graphics.h" -#include "newgraph.h" -#include "fileio.h" -#include "items.h" -#include "itemdata.h" -#include "monster.h" -#include "town.h" -#include "combat.h" -#include "party.h" -#include "text.h" -#include "exlsound.h" -#include "fields.h" -#include "locutils.h" -#include "dlogtool.h" -#include "infodlgs.h" -#include "graphutl.h" +#include "boe.graphics.h" +#include "boe.newgraph.h" +#include "boe.fileio.h" +#include "boe.items.h" +#include "boe.itemdata.h" +#include "boe.monster.h" +#include "boe.town.h" +#include "boe.combat.h" +#include "boe.party.h" +#include "boe.text.h" +#include "tools/exlsound.h" +#include "boe.fields.h" +#include "boe.locutils.h" +.#include "boe.infodlg.h" +#include "boe.graphutil.h" #include "globvar.h" diff --git a/Blades of Exile/TOWN.H b/Blades of Exile/boe.town.h similarity index 100% rename from Blades of Exile/TOWN.H rename to Blades of Exile/boe.town.h diff --git a/Blades of Exile/LOCATION.CPP b/Blades of Exile/classes/LOCATION.CPP similarity index 93% rename from Blades of Exile/LOCATION.CPP rename to Blades of Exile/classes/LOCATION.CPP index d2dd9301..c4a47a44 100644 --- a/Blades of Exile/LOCATION.CPP +++ b/Blades of Exile/classes/LOCATION.CPP @@ -1,9 +1,9 @@ #include "location.h" // location #include "exlsound.h" // play_sound -#include "blades.h" // out -#include "text.h" // add_string_to_buf -#include "locutils.h" // alter_space -#include "items.h" // fancy_choice_dialog +#include "boe.main.h" // out +#include "boe.text.h" // add_string_to_buf +#include "boe.locutils.h" // alter_space +#include "boe.items.h" // fancy_choice_dialog #include "global.h" #include "globvar.h" diff --git a/Blades of Exile/LOCATION.H b/Blades of Exile/classes/LOCATION.H similarity index 100% rename from Blades of Exile/LOCATION.H rename to Blades of Exile/classes/LOCATION.H diff --git a/Blades of Exile/PC.CPP b/Blades of Exile/classes/PC.CPP similarity index 89% rename from Blades of Exile/PC.CPP rename to Blades of Exile/classes/PC.CPP index 9a1db89e..3a4bd48b 100644 --- a/Blades of Exile/PC.CPP +++ b/Blades of Exile/classes/PC.CPP @@ -1,17 +1,17 @@ #include "pc.h" // party_record_type #include "location.h" // location -#include "text.h" // add_string_to_buf -#include "blades.h" // globals -#include "exlsound.h" // play_sound -#include "combat.h" // hit_chance -#include "items.h" // place_item -#include "fields.h" // make_sfx -#include "global.h" // get_ran -#include "infodlgs.h" // give_help -#include "party.h" // adjust_spell_menu -#include "itemdata.h" // return_dummy_item -#include "locutils.h" // is_container -#include "globvar.h" +//#include "boe.text.h" // add_string_to_buf +//#include "boe.main.h" // globals +#include "tools/soundtool.h" // play_sound +//#include "boe.combat.h" // hit_chance +//#include "boe.items.h" // place_item +//#include "boe.fields.h" // make_sfx +#include "tools/mathutil.h" // get_ran +//#include "boe.infodlg.h" // give_help +//#include "boe.party.h" // adjust_spell_menu +//#include "boe.itemdata.h" // return_dummy_item +//#include "boe.locutils.h" // is_container +//#include "globvar.h" void pc_record_type::kill(short type) { @@ -42,7 +42,7 @@ void pc_record_type::kill(short type) combat_active_pc = 6; for (i = 0; i < 24; i++) - equip[i] = FALSE; + equip[i] = false; item_loc = (overall_mode >= MODE_COMBAT) ? pc_pos[which_pc] : c_town.p_loc; @@ -54,7 +54,7 @@ void pc_record_type::kill(short type) if (overall_mode != 0) for (i = 0; i < 24; i++) if (items[i].variety != 0) { - dummy = place_item(items[i],item_loc,TRUE); + dummy = place_item(items[i],item_loc,true); items[i].variety = 0; } if ((type == 2) || (type == 3)) @@ -69,7 +69,7 @@ void pc_record_type::kill(short type) } else { if (type == 4) { - sprintf ((char *) create_line, " %s is immuned to petrification. ",(char *) name); + sprintf ((char *) create_line, " %s is immune to petrification. ",(char *) name); add_string_to_buf((char*) create_line); //inform of what has happened } else{ @@ -115,7 +115,7 @@ bool pc_record_type::runTrap(short trap_type, short trap_level, short diff) r1 = get_ran(1,0,100) + diff; // Nimble? - if (traits[TRAIT_NIMBLE] == TRUE) r1 -= 6; + if (traits[TRAIT_NIMBLE] == true) r1 -= 6; if (r1 < trap_odds[skill]) { @@ -204,12 +204,12 @@ short pc_record_type::statAdj(short which) tr = skill_bonus[skills[which]]; if (which == 2) { - if (traits[1] == TRUE) tr++; + if (traits[1] == true) tr++; if (hasAbilEquip(40) < 24) tr++; } if (which == 0) - if (traits[8] == TRUE) tr++; + if (traits[8] == true) tr++; if (hasAbilEquip(38) < 24) tr++; @@ -395,8 +395,8 @@ void pc_record_type::disease(short how_much) if ((tlevel = getProtLevel(62)) > 0) how_much -= tlevel / 2; - if ((traits[12] == TRUE) && (how_much > 1)) how_much++; - if ((traits[12] == TRUE) && (how_much == 1) && (get_ran(1,0,1) == 0)) how_much++; + if ((traits[12] == true) && (how_much > 1)) how_much++; + if ((traits[12] == true) && (how_much == 1) && (get_ran(1,0,1) == 0)) how_much++; status[STATUS_DISEASE] = min(status[STATUS_DISEASE] + how_much,8); sprintf ((char *) c_line, " %s diseased.",(char *) name); @@ -585,7 +585,7 @@ bool pc_record_type::giveToPC(item_record_type item, bool print_result) if (stat_window == getNum()) put_item_screen(stat_window,0); } - if (in_startup_mode == FALSE) { + if (in_startup_mode == false) { if (item.isIdent() == false) sprintf((char *) announce_string," %s gets %s.",name,item.name); else sprintf((char *) announce_string," %s gets %s.",name,item.full_name); @@ -604,7 +604,7 @@ bool pc_record_type::giveToPC(item_record_type item, bool print_result) short pc_record_type::getProtLevel(short abil) { for (int i = 0; i < 24; i++) - if ((items[i].variety != 0) && (items[i].ability == abil) && (equip[i] == TRUE)) + if ((items[i].variety != 0) && (items[i].ability == abil) && (equip[i] == true)) return items[i].ability_strength; return (-1); } @@ -614,7 +614,7 @@ short pc_record_type::hasAbilEquip(short abil) short i = 0; while (((items[i].variety == 0) || (items[i].ability != abil) - || (equip[i] == FALSE)) && (i < 24)) + || (equip[i] == false)) && (i < 24)) i++; return i; } @@ -711,7 +711,7 @@ void pc_record_type::takeItem(short which_item) equip[i] = equip[i + 1]; } items[23] = return_dummy_item(); - equip[23] = FALSE; + equip[23] = false; if ((stat_window == getNum()) && (do_print)) put_item_screen(stat_window,1); @@ -801,12 +801,12 @@ void pc_record_type::equipItem(short item_num) add_string_to_buf("Equip: Not in combat"); else { // unequip - if (equip[item_num] == TRUE) { - if ((equip[item_num] == TRUE) && + if (equip[item_num] == true) { + if ((equip[item_num] == true) && (items[item_num].isCursed())) add_string_to_buf("Equip: Item is cursed. "); else { - equip[item_num] = FALSE; + equip[item_num] = false; add_string_to_buf("Equip: Unequipped"); if ((weap_poisoned == item_num) && (status[0] > 0)) { add_string_to_buf(" Poison lost. "); @@ -816,11 +816,11 @@ void pc_record_type::equipItem(short item_num) } else { // equip - if (equippable[items[item_num].variety] == FALSE) + if (equippable[items[item_num].variety] == false) add_string_to_buf("Equip: Can't equip this item."); else { for (i = 0; i < 24; i++) - if (equip[i] == TRUE) { + if (equip[i] == true) { if (items[i].variety == items[item_num].variety) num_equipped_of_this_type++; num_hands_occupied = num_hands_occupied + num_hands_to_use[items[i].variety]; @@ -831,7 +831,7 @@ void pc_record_type::equipItem(short item_num) // Now if missile is already equipped, no more missiles if (equip_item_type > 0) { for (i = 0; i < 24; i++) - if ((equip[i] == TRUE) && (excluding_types[items[i].variety] == equip_item_type)) { + if ((equip[i] == true) && (excluding_types[items[i].variety] == equip_item_type)) { add_string_to_buf("Equip: You have something of"); add_string_to_buf(" this type equipped."); return; @@ -845,7 +845,7 @@ void pc_record_type::equipItem(short item_num) else if (num_that_can_equip[items[item_num].variety] <= num_equipped_of_this_type) add_string_to_buf("Equip: Can't equip another"); else { - equip[item_num] = TRUE; + equip[item_num] = true; add_string_to_buf("Equip: OK"); } } @@ -867,7 +867,7 @@ void pc_record_type::dropItem(short item_num, location where_drop) item_store = items[item_num]; - if ((equip[item_num] == TRUE) && (items[item_num].isCursed())) + if ((equip[item_num] == true) && (items[item_num].isCursed())) add_string_to_buf("Drop: Item is cursed. "); else switch (overall_mode) { case 0: @@ -894,9 +894,9 @@ void pc_record_type::dropItem(short item_num, location where_drop) take_given_item = false; item_store.charges = how_many; } - if (is_container(loc) == TRUE) + if (is_container(loc) == true) item_store.item_properties = item_store.item_properties | 8; - if (place_item(item_store,loc,FALSE) == FALSE) { + if (place_item(item_store,loc,false) == false) { add_string_to_buf("Drop: Too many items on ground"); item_store.item_properties = item_store.item_properties & 247; // not contained } @@ -918,18 +918,18 @@ void pc_record_type::giveThing(short item_num) bool take_given_item = true; short pc_num = getNum(); - if ((equip[item_num] == TRUE) && (items[item_num].isCursed())) + if ((equip[item_num] == true) && (items[item_num].isCursed())) add_string_to_buf("Give: Item is cursed. "); else { item_store = items[item_num]; who_to = char_select_pc(1,1,"Give item to who?"); - if ((overall_mode == MODE_COMBAT) && (adjacent(pc_pos[pc_num],pc_pos[who_to]) == FALSE)) { + if ((overall_mode == MODE_COMBAT) && (adjacent(pc_pos[pc_num],pc_pos[who_to]) == false)) { add_string_to_buf("Give: Must be adjacent."); who_to = 6; } if ((who_to < 6) && (who_to != pc_num) - && ((overall_mode != MODE_COMBAT) || (adjacent(pc_pos[pc_num],pc_pos[who_to]) == TRUE))) { + && ((overall_mode != MODE_COMBAT) || (adjacent(pc_pos[pc_num],pc_pos[who_to]) == true))) { if ((item_store.type_flag > 0) && (item_store.charges > 1)) { how_many = get_num_of_items(item_store.charges); if (how_many == 0) @@ -970,9 +970,9 @@ void pc_record_type::combineThings() ASB("(Can have at most 125 of any item."); } else items[i].charges += items[j].charges; - if (equip[j] == TRUE) { - equip[i] = TRUE; - equip[j] = FALSE; + if (equip[j] == true) { + equip[i] = true; + equip[j] = false; } takeItem(30 + j); } diff --git a/Blades of Exile/PC.H b/Blades of Exile/classes/PC.H similarity index 95% rename from Blades of Exile/PC.H rename to Blades of Exile/classes/PC.H index ca86c6bb..b0839392 100644 --- a/Blades of Exile/PC.H +++ b/Blades of Exile/classes/PC.H @@ -1,8 +1,9 @@ #ifndef _PC_H #define _PC_H -#include "item.h" //item_record_type #include "consts.h" +#include "item.h" //item_record_type +//#include "consts.h" /* do not change */ /* dummy_pc_record_type is temporarily used in file reading/writing operations */ diff --git a/Blades of Exile/classes/consts.h b/Blades of Exile/classes/consts.h new file mode 100644 index 00000000..43d1749e --- /dev/null +++ b/Blades of Exile/classes/consts.h @@ -0,0 +1,711 @@ +/* + * simpletypes.h + * BoE + * + * Created by Celtic Minstrel on 01/06/09. + * + */ + +typedef unsigned short m_num_t; +typedef unsigned short ter_num_t; +typedef signed short spec_num_t; +typedef signed short item_num_t; +typedef unsigned short str_num_t; + +enum eMainStatus { + MAIN_STATUS_ABSENT = 0, // absent, empty slot + MAIN_STATUS_ALIVE = 1, + MAIN_STATUS_DEAD = 2, + MAIN_STATUS_DUST = 3, + MAIN_STATUS_STONE = 4, + MAIN_STATUS_FLED = 5, + MAIN_STATUS_SURFACE = 6, // fled to surface? + MAIN_STATUS_WON = 7, + MAIN_STATUS_SPLIT = 10, + // The rest are not really necessary, but are here for completeness so that all valid values have a name. + MAIN_STATUS_SPLIT_ABSENT = MAIN_STATUS_SPLIT + MAIN_STATUS_ABSENT, + MAIN_STATUS_SPLIT_ALIVE = MAIN_STATUS_SPLIT + MAIN_STATUS_ALIVE, + MAIN_STATUS_SPLIT_DEAD = MAIN_STATUS_SPLIT + MAIN_STATUS_DEAD, + MAIN_STATUS_SPLIT_DUST = MAIN_STATUS_SPLIT + MAIN_STATUS_DUST, + MAIN_STATUS_SPLIT_STONE = MAIN_STATUS_SPLIT + MAIN_STATUS_STONE, + MAIN_STATUS_SPLIT_FLED = MAIN_STATUS_SPLIT + MAIN_STATUS_FLED, + MAIN_STATUS_SPLIT_SURFACE = MAIN_STATUS_SPLIT + MAIN_STATUS_SURFACE, + MAIN_STATUS_SPLIT_WON = MAIN_STATUS_SPLIT + MAIN_STATUS_WON, +}; + +/* adven[i].race */ //complete +enum eRace { + RACE_UNKNOWN = -1, // for parameters to some functions; not valid in the class + RACE_HUMAN = 0, + RACE_NEPHIL = 1, + RACE_SLITH = 2, + RACE_VAHNATAI = 3, + RACE_REPTILE = 4, + RACE_BEAST = 5, + RACE_IMPORTANT = 6, + RACE_MAGE = 7, + RACE_PRIEST = 8, + RACE_HUMANOID = 9, + RACE_DEMON = 10, + RACE_UNDEAD = 11, + RACE_GIANT = 12, + RACE_SLIME = 13, + RACE_STONE = 14, + RACE_BUG = 15, + RACE_DRAGON = 16, + RACE_MAGICAL = 17, + RACE_PLANT = 18, + RACE_BIRD = 19, +}; // TODO: Expand and merge with eMonsterType + +/* adven[i].status*/ //complete - assign a positive value for a help pc effect, a negative for harm pc +enum eStatus { + STATUS_POISONED_WEAPON = 0, + STATUS_BLESS_CURSE = 1, + STATUS_POISON = 2, + STATUS_HASTE_SLOW = 3, + STATUS_INVULNERABLE = 4, + STATUS_MAGIC_RESISTANCE = 5, + STATUS_WEBS = 6, + STATUS_DISEASE = 7, + STATUS_INVISIBLE = 8, //sanctuary + STATUS_DUMB = 9, + STATUS_MARTYRS_SHIELD = 10, + STATUS_ASLEEP = 11, + STATUS_PARALYZED = 12, + STATUS_ACID = 13, +}; + +/* Monster Type */ +enum eMonsterType { + MONSTER_TYPE_UNKNOWN = -1, // for parameters to some functions; not valid in the class + MONSTER_TYPE_HUMAN = 0, + MONSTER_TYPE_REPTILE = 1, + MONSTER_TYPE_BEAST = 2, + MONSTER_TYPE_IMPORTANT = 3, + MONSTER_TYPE_MAGE = 4, + MONSTER_TYPE_PRIEST = 5, + MONSTER_TYPE_HUMANOID = 6, + MONSTER_TYPE_DEMON = 7, + MONSTER_TYPE_UNDEAD = 8, + MONSTER_TYPE_GIANT = 9, + MONSTER_TYPE_SLIME = 10, + MONSTER_TYPE_STONE = 11, + MONSTER_TYPE_BUG = 12, + MONSTER_TYPE_DRAGON = 13, + MONSTER_TYPE_MAGICAL = 14, +}; + + +/* Special Ability a.k.a spec_skill */ + +enum eMonstAbil { + MONST_NO_ABIL = 0, + // Missile abilities (extra1 = number of sided dice; extra2 = number of sides) + MONST_THROWS_DARTS = 10, + MONST_SHOOTS_ARROWS, + MONST_THROWS_SPEARS, + MONST_THROWS_ROCKS, + MONST_THROWS_RAZORDISKS, + MONST_GOOD_ARCHER, + MONST_SHOOTS_SPINES, + MONST_THROWS_KNIVES, + // Ray abilities (extra1 = type of damage / status where applicable) + MONST_DAMAGE_RAY = 20, + MONST_STATUS_RAY, + MONST_PETRIFY_RAY, + MONST_DRAIN_SP_RAY, + MONST_DRAIN_XP_RAY, + MONST_DRAIN_XP_DAMAGE_RAY, + MONST_KILL_RAY, + MONST_STEAL_FOOD_RAY, + MONST_STEAL_GOLD_RAY, + // Touch abilities (extra1 = type of damage / status where applicable) + MONST_DAMAGE_TOUCH = 30, + MONST_STATUS_TOUCH, + MONST_PETRIFY_TOUCH, + MONST_DRAIN_SP_TOUCH, + MONST_DRAIN_XP_TOUCH, + MONST_DRAIN_XP_DAMAGE_TOUCH, + MONST_KILL_TOUCH, + MONST_STEAL_FOOD_TOUCH, + MONST_STEAL_GOLD_TOUCH, + // Summon abilities (extra1 = which monster / type / species; extra2 = % chance) + MONST_SUMMON_ONE = 40, + MONST_SUMMON_TYPE, + MONST_SUMMON_SPECIES, + MONST_SUMMON_RANDOM, + MONST_MASS_SUMMON, + // Misc abilities (extra1 = field / special #; extra2 = % chance for radiate only) + MONST_SPLITS = 50, + MONST_FIELD_MISSILE, + MONST_MARTYRS_SHIELD, + MONST_ABSORB_SPELLS, + MONST_INVULNERABLE, + MONST_RADIATE, + MONST_CALL_LOCAL_SPECIAL, + MONST_CALL_GLOBAL_SPECIAL, +}; + + +/* Terrains Special Properties : scenario.ter_types[i].special */ //complete + +enum eTerSpec { + // TER_SPEC_NONE = 0, + // TER_SPEC_CHANGE_WHEN_STEP_ON = 1, + // TER_SPEC_DOES_FIRE_DAMAGE = 2, + // TER_SPEC_DOES_COLD_DAMAGE = 3, + // TER_SPEC_DOES_MAGIC_DAMAGE = 4, + // TER_SPEC_POISON_LAND = 5, + // TER_SPEC_DISEASED_LAND = 6, + // TER_SPEC_CRUMBLING_TERRAIN = 7, + // TER_SPEC_LOCKABLE_TERRAIN = 8, + // TER_SPEC_UNLOCKABLE_TERRAIN = 9, + // TER_SPEC_UNLOCKABLE_BASHABLE = 10, + // TER_SPEC_IS_A_SIGN = 11, + // TER_SPEC_CALL_LOCAL_SPECIAL = 12, + // TER_SPEC_CALL_SCENARIO_SPECIAL = 13, + // TER_SPEC_IS_A_CONTAINER = 14, + // TER_SPEC_WATERFALL = 15, + // TER_SPEC_CONVEYOR_NORTH = 16, + // TER_SPEC_CONVEYOR_EAST = 17, + // TER_SPEC_CONVEYOR_SOUTH = 18, + // TER_SPEC_CONVEYOR_WEST = 19, + // TER_SPEC_BLOCKED_TO_MONSTERS = 20, + // TER_SPEC_TOWN_ENTRANCE = 21, + // TER_SPEC_CHANGE_WHEN_USED = 22, + // TER_SPEC_CALL_SPECIAL_WHEN_USED = 23, + TER_SPEC_NONE = 0, + TER_SPEC_CHANGE_WHEN_STEP_ON = 1, + TER_SPEC_DAMAGING = 2, + TER_SPEC_BRIDGE = 3, // new + TER_SPEC_BED = 4, // new + TER_SPEC_DANGEROUS = 5, + TER_SPEC_UNUSED1 = 6, + TER_SPEC_CRUMBLING = 7, + TER_SPEC_LOCKABLE = 8, + TER_SPEC_UNLOCKABLE = 9, + TER_SPEC_UNUSED2 = 10, + TER_SPEC_IS_A_SIGN = 11, + TER_SPEC_CALL_SPECIAL = 12, + TER_SPEC_UNUSED3 = 13, + TER_SPEC_IS_A_CONTAINER = 14, + TER_SPEC_WATERFALL = 15, + TER_SPEC_CONVEYOR = 16, + TER_SPEC_UNUSED4 = 17, + TER_SPEC_UNUSED5 = 18, + TER_SPEC_UNUSED6 = 19, + TER_SPEC_BLOCKED_TO_MONSTERS = 20, + TER_SPEC_TOWN_ENTRANCE = 21, + TER_SPEC_CHANGE_WHEN_USED = 22, + TER_SPEC_CALL_SPECIAL_WHEN_USED = 23, + // 1. Change when step on (What to change to, number of sound, Unused) + // 2. Damaging terrain; can't rest here (Amount of damage done, multiplier, damage type) + // 3. Reserved + // 4. Reserved + // 5. Dangerous land; can't rest here; percentage chance may be 0 (Strength, Percentage chance, status type) + // 6. Reserved + // 7. Crumbling terrain (Terrain to change to, strength?, destroyed by what - quickfire, shatter/move mountains, or both) + // 8. Lockable terrain (Terrain to change to when locked, Unused, Unused) + // 9. Unlockable terrain (Terrain to change to when locked, Difficulty, can be bashed) + // 10. Reserved + // 11. Sign (Unused, Unused, Unused) + // 12. Call special (Special to call, local or scenario?, Unused) + // 13. Reserved + // 14. Container (Unused, Unused, Unused) + // 15. Waterfall (Direction, Unused, Unused) + // 16. Conveyor Belt (Direction, Unused, Unused) + // 17. Reserved + // 18. Reserved + // 19. Reserved + // 20. Blocked to Monsters (Unused, Unused, Unused) + // 21. Town entrance (Terrain type if hidden, Unused, Unused) + // 22. Change when Used (Terrain to change to when used, Number of sound, Unused) + // 23. Call special when used (Special to call, local or scenario?, Unused) + // 24. Bridge - if the party boats over it, they get the option to land. (Unused, Unused, Unused) +}; + +enum eTrimType { + TRIM_NONE = 0, + TRIM_WALL = 1, // not a trim, but trims will conform to it as if it's the same ground type (eg stone wall) + TRIM_S, TRIM_SE, TRIM_E, TRIM_NE, TRIM_N, TRIM_NW, TRIM_W, TRIM_SW, + TRIM_NE_INNER, TRIM_SE_INNER, TRIM_SW_INNER, TRIM_NW_INNER, + TRIM_FRILLS = 14, // like on lava and underground water; no trim_ter required + TRIM_ROAD = 15, // the game will treat it like a road space and draw roads; no trim_ter required + TRIM_WALKWAY = 16, // the game will draw walkway corners; trim_ter is base terrain to draw on + TRIM_WATERFALL = 17, // special case for waterfalls + TRIM_CITY = 18, // the game will join roads up to this space but not draw roads on the space +}; + + +/* items[i].type a.k.a type of weapon */ +enum eWeapType { + ITEM_NOT_MELEE = 0, + ITEM_EDGED = 1, + ITEM_BASHING = 2, + ITEM_POLE = 3, +}; + +/* items[i].variety a.k.a item type (in editor) */ +enum eItemType { + ITEM_TYPE_NO_ITEM = 0, + ITEM_TYPE_ONE_HANDED = 1, + ITEM_TYPE_TWO_HANDED = 2, + ITEM_TYPE_GOLD = 3, + ITEM_TYPE_BOW = 4, + ITEM_TYPE_ARROW = 5, + ITEM_TYPE_THROWN_MISSILE = 6, + ITEM_TYPE_POTION = 7, // potion/magic item + ITEM_TYPE_SCROLL = 8, // scroll/magic item + ITEM_TYPE_WAND = 9, + ITEM_TYPE_TOOL = 10, + ITEM_TYPE_FOOD = 11, + ITEM_TYPE_SHIELD = 12, + ITEM_TYPE_ARMOR = 13, + ITEM_TYPE_HELM = 14, + ITEM_TYPE_GLOVES = 15, + ITEM_TYPE_SHIELD_2 = 16, + // don't know why a second type of shield is used ; it is actually checked + // in the armor code (item >= 12 and <= 17) + // and you can't equip another (12) shield while wearing it ... I didn't + // find a single item with this property in the bladbase.exs ... + ITEM_TYPE_BOOTS = 17, + ITEM_TYPE_RING = 18, + ITEM_TYPE_NECKLACE = 19, + ITEM_TYPE_WEAPON_POISON = 20, + ITEM_TYPE_NON_USE_OBJECT = 21, + ITEM_TYPE_PANTS = 22, + ITEM_TYPE_CROSSBOW = 23, + ITEM_TYPE_BOLTS = 24, + ITEM_TYPE_MISSILE_NO_AMMO = 25, //e.g slings + ITEM_TYPE_UNUSED1 = 26, // these are here solely because they are options in the editor + ITEM_TYPE_UNUSED2 = 27, +}; + +/* items[i].ability */ +enum eItemAbil { + // Weapon abilities + ITEM_NO_ABILITY = 0, + ITEM_FLAMING_WEAPON = 1, + ITEM_DEMON_SLAYER = 2, + ITEM_UNDEAD_SLAYER = 3, + ITEM_LIZARD_SLAYER = 4, + ITEM_GIANT_SLAYER = 5, + ITEM_MAGE_SLAYER = 6, + ITEM_PRIEST_SLAYER = 7, + ITEM_BUG_SLAYER = 8, + ITEM_ACIDIC_WEAPON = 9, + ITEM_SOULSUCKER = 10, + ITEM_DRAIN_MISSILES = 11, + ITEM_WEAK_WEAPON = 12, + ITEM_CAUSES_FEAR = 13, + ITEM_POISONED_WEAPON = 14, + // General abilities + ITEM_PROTECTION = 30, + ITEM_FULL_PROTECTION = 31, + ITEM_FIRE_PROTECTION = 32, + ITEM_COLD_PROTECTION = 33, + ITEM_POISON_PROTECTION = 34, + ITEM_MAGIC_PROTECTION = 35, + ITEM_ACID_PROTECTION = 36, + ITEM_SKILL = 37, + ITEM_STRENGTH = 38, + ITEM_DEXTERITY = 39, + ITEM_INTELLIGENCE = 40, + ITEM_ACCURACY = 41, + ITEM_THIEVING = 42, + ITEM_GIANT_STRENGTH = 43, + ITEM_LIGHTER_OBJECT = 44, + ITEM_HEAVIER_OBJECT = 45, + ITEM_OCCASIONAL_BLESS = 46, + ITEM_OCCASIONAL_HASTE = 47, + ITEM_LIFE_SAVING = 48, + ITEM_PROTECT_FROM_PETRIFY = 49, + ITEM_REGENERATE = 50, + ITEM_POISON_AUGMENT = 51, + ITEM_DISEASE_PARTY = 52, + ITEM_WILL = 53, + ITEM_FREE_ACTION = 54, + ITEM_SPEED = 55, + ITEM_SLOW_WEARER = 56, + ITEM_PROTECT_FROM_UNDEAD = 57, + ITEM_PROTECT_FROM_DEMONS = 58, + ITEM_PROTECT_FROM_HUMANOIDS = 59, + ITEM_PROTECT_FROM_REPTILES = 60, + ITEM_PROTECT_FROM_GIANTS = 61, + ITEM_PROTECT_FROM_DISEASE = 62, + // Nonspell Usable + ITEM_POISON_WEAPON = 70, //put poison on weapon + ITEM_BLESS_CURSE = 71, + ITEM_AFFECT_POISON = 72, + ITEM_HASTE_SLOW = 73, + ITEM_AFFECT_INVULN = 74, + ITEM_AFFECT_MAGIC_RES = 75, + ITEM_AFFECT_WEB = 76, + ITEM_AFFECT_DISEASE = 77, + ITEM_AFFECT_SANCTUARY = 78, + ITEM_AFFECT_DUMBFOUND = 79, + ITEM_AFFECT_MARTYRS_SHIELD = 80, + ITEM_AFFECT_SLEEP = 81, + ITEM_AFFECT_PARALYSIS = 82, + ITEM_AFFECT_ACID = 83, + ITEM_BLISS = 84, + ITEM_AFFECT_EXPERIENCE = 85, + ITEM_AFFECT_SKILL_POINTS = 86, + ITEM_AFFECT_HEALTH = 87, + ITEM_AFFECT_SPELL_POINTS = 88, + ITEM_DOOM = 89, + ITEM_LIGHT = 90, + ITEM_STEALTH = 91, + ITEM_FIREWALK = 92, + ITEM_FLYING = 93, + ITEM_MAJOR_HEALING = 94, + // Spell Usable + ITEM_SPELL_FLAME = 110, + ITEM_SPELL_FIREBALL = 111, + ITEM_SPELL_FIRESTORM = 112, + ITEM_SPELL_KILL = 113, + ITEM_SPELL_ICE_BOLT = 114, + ITEM_SPELL_SLOW = 115, + ITEM_SPELL_SHOCKWAVE = 116, + ITEM_SPELL_DISPEL_UNDEAD = 117, + ITEM_SPELL_DISPEL_SPIRIT = 118, + ITEM_SPELL_SUMMONING = 119, + ITEM_SPELL_MASS_SUMMONING = 120, + ITEM_SPELL_ACID_SPRAY = 121, + ITEM_SPELL_STINKING_CLOUD = 122, + ITEM_SPELL_SLEEP_FIELD = 123, + ITEM_SPELL_VENOM = 124, + ITEM_SPELL_SHOCKSTORM = 125, + ITEM_SPELL_PARALYSIS = 126, + ITEM_SPELL_WEB_SPELL = 127, + ITEM_SPELL_STRENGTHEN_TARGET = 128, //wand of carrunos effect + ITEM_SPELL_QUICKFIRE = 129, + ITEM_SPELL_MASS_CHARM = 130, + ITEM_SPELL_MAGIC_MAP = 131, + ITEM_SPELL_DISPEL_BARRIER = 132, + ITEM_SPELL_MAKE_ICE_WALL = 133, + ITEM_SPELL_CHARM_SPELL = 134, + ITEM_SPELL_ANTIMAGIC_CLOUD = 135, + // Reagents + ITEM_HOLLY = 150, // Holly/Toadstool + ITEM_COMFREY_ROOT = 151, + ITEM_GLOWING_NETTLE = 152, + ITEM_WORMGRASS = 153, // Crypt Shroom/Wormgr. + ITEM_ASPTONGUE_MOLD = 154, + ITEM_EMBER_FLOWERS = 155, + ITEM_GRAYMOLD = 156, + ITEM_MANDRAKE = 157, + ITEM_SAPPHIRE = 158, + ITEM_SMOKY_CRYSTAL = 159, + ITEM_RESSURECTION_BALM = 160, + ITEM_LOCKPICKS = 161, + // Missile Abilities + ITEM_MISSILE_RETURNING = 170, + ITEM_MISSILE_LIGHTNING = 171, + ITEM_MISSILE_EXPLODING = 172, + ITEM_MISSILE_ACID = 173, + ITEM_MISSILE_SLAY_UNDEAD = 174, + ITEM_MISSILE_SLAY_DEMON = 175, + ITEM_MISSILE_HEAL_TARGET = 176, +}; + + +/* adven[i].skills */ //complete +enum eSkill { + SKILL_STRENGTH = 0, + SKILL_DEXTERITY = 1, + SKILL_INTELLIGENCE = 2, + SKILL_EDGED_WEAPONS = 3, + SKILL_BASHING_WEAPONS = 4, + SKILL_POLE_WEAPONS = 5, + SKILL_THROWN_MISSILES = 6, + SKILL_ARCHERY = 7, + SKILL_DEFENSE = 8, + SKILL_MAGE_SPELLS = 9, + SKILL_PRIEST_SPELLS = 10, + SKILL_MAGE_LORE = 11, + SKILL_ALCHEMY = 12, + SKILL_ITEM_LORE = 13, + SKILL_DISARM_TRAPS = 14, + SKILL_LOCKPICKING = 15, + SKILL_ASSASSINATION = 16, + SKILL_POISON = 17, + SKILL_LUCK = 18, +}; + +/* adven[i].traits */ //complete +enum eTrait { + TRAIT_TOUGHNESS = 0, + TRAIT_MAGICALLY_APT = 1, + TRAIT_AMBIDEXTROUS = 2, + TRAIT_NIMBLE = 3, + TRAIT_CAVE_LORE = 4, + TRAIT_WOODSMAN = 5, + TRAIT_GOOD_CONST = 6, + TRAIT_HIGHLY_ALERT = 7, + TRAIT_STRENGTH = 8, + TRAIT_RECUPERATION = 9, + TRAIT_SLUGGISH = 10, + TRAIT_MAGICALLY_INEPT = 11, + TRAIT_FRAIL = 12, + TRAIT_CHRONIC_DISEASE = 13, + TRAIT_BAD_BACK = 14, + TRAIT_PACIFIST = 15, +}; + + +/* damage type*/ +/* used as parameter to some functions */ +enum eDamageType { + DAMAGE_WEAPON = 0, + DAMAGE_FIRE = 1, + DAMAGE_POISON = 2, + DAMAGE_MAGIC = 3, + DAMAGE_UNBLOCKABLE = 4, //from the source files - the display is the same as the magic one (damage_monst in SPECIALS.cpp) + DAMAGE_COLD = 5, + DAMAGE_UNDEAD = 6, //from the source files - the display is the same as the weapon one + DAMAGE_DEMON = 7, //from the source files - the display is the same as the weapon one + // 8 and 9 aren't defined : doesn't print any damage. According to the source files the 9 is DAMAGE_MARKED though. Wrong ? + DAMAGE_MARKED = 10, // usage: DAMAGE_MARKED + damage_type + DAMAGE_WEAPON_MARKED = 10, + DAMAGE_FIRE_MARKED = 11, + DAMAGE_POISON_MARKED = 12, + DAMAGE_MAGIC_MARKED = 13, + DAMAGE_UNBLOCKABLE_MARKED = 14, + DAMAGE_COLD_MARKED = 15, + DAMAGE_UNDEAD_MARKED = 16, + DAMAGE_DEMON_MARKED = 17, + DAMAGE_NO_PRINT = 30, // usage: DAMAGE_NO_PRINT + damage_type + DAMAGE_WEAPON_NO_PRINT = 30, + DAMAGE_FIRE_NO_PRINT = 31, + DAMAGE_POISON_NO_PRINT = 32, + DAMAGE_MAGIC_NO_PRINT = 33, + DAMAGE_UNBLOCKABLE_NO_PRINT = 34, + DAMAGE_COLD_NO_PRINT = 35, + DAMAGE_UNDEAD_NO_PRINT = 36, + DAMAGE_DEMON_NO_PRINT = 37, + // What about both NO_PRINT and MARKED? +}; + +inline void operator -= (eDamageType& cur, eDamageType othr){ + if((othr == DAMAGE_MARKED && cur >= DAMAGE_MARKED && cur < DAMAGE_NO_PRINT) || + (othr == DAMAGE_NO_PRINT && cur >= DAMAGE_NO_PRINT)) + cur = (eDamageType) ((int)cur - (int)othr); +} + +inline void operator += (eDamageType& cur, eDamageType othr){ + if((othr == DAMAGE_MARKED || othr == DAMAGE_NO_PRINT) && cur < DAMAGE_MARKED) + cur = (eDamageType) ((int)cur + (int)othr); +} + +//class sbyte { +// signed char c; +//public: +// operator int() {return c;} +// sbyte(signed char k) : c(k) {} +//} + +enum eSpecContext { + SPEC_OUT_MOVE = 0, + SPEC_TOWN_MOVE = 1, + SPEC_COMBAT_MOVE = 2, + SPEC_OUT_LOOK = 3, + SPEC_TOWN_LOOK = 4, + SPEC_ENTER_TOWN = 5, + SPEC_LEAVE_TOWN = 6, + SPEC_TALK = 7, + SPEC_USE_SPEC_ITEM = 8, + SPEC_TOWN_TIMER = 9, + SPEC_SCEN_TIMER = 10, + SPEC_PARTY_TIMER = 11, + SPEC_KILL_MONST = 12, + SPEC_OUTDOOR_ENC = 13, + SPEC_WIN_ENCOUNTER = 14, + SPEC_FLEE_ENCOUNTER = 15, + SPEC_TARGET = 16, + SPEC_USE_SPACE = 17, + SPEC_SEE_MONST = 18, +}; + +enum eSpecNodeType { + SPEC_NULL = 0, + SPEC_SET_SDF = 1, + SPEC_INC_SDF = 2, + SPEC_DISPLAY_MSG = 3, + SPEC_SECRET_PASSAGE = 4, + SPEC_DISPLAY_SM_MSG = 5, + SPEC_FLIP_SDF = 6, + SPEC_OUT_BLOCK = 7, + SPEC_TOWN_BLOCK = 8, + SPEC_FIGHT_BLOCK = 9, + SPEC_LOOK_BLOCK = 10, + SPEC_CANT_ENTER = 11, + SPEC_CHANGE_TIME = 12, + SPEC_SCEN_TIMER_START = 13, + SPEC_PLAY_SOUND = 14, + SPEC_CHANGE_HORSE_OWNER = 15, + SPEC_CHANGE_BOAT_OWNER = 16, + SPEC_SET_TOWN_VISIBILITY = 17, + SPEC_MAJOR_EVENT_OCCURRED = 18, + SPEC_FORCED_GIVE = 19, + SPEC_BUY_ITEMS_OF_TYPE = 20, + SPEC_CALL_GLOBAL = 21, + SPEC_SET_SDF_ROW = 22, + SPEC_COPY_SDF = 23, + SPEC_SANCTIFY = 24, + SPEC_REST = 25, + SPEC_WANDERING_WILL_FIGHT = 26, + SPEC_END_SCENARIO = 27, + SPEC_ONCE_GIVE_ITEM = 50, + SPEC_ONCE_GIVE_SPEC_ITEM = 51, + SPEC_ONCE_NULL = 52, + SPEC_ONCE_SET_SDF = 53, + SPEC_ONCE_DISPLAY_MSG = 54, + SPEC_ONCE_DIALOG = 55, + SPEC_ONCE_DIALOG_TERRAIN = 56, + SPEC_ONCE_DIALOG_MONSTER = 57, + SPEC_ONCE_GIVE_ITEM_DIALOG = 58, + SPEC_ONCE_GIVE_ITEM_TERRAIN = 59, + SPEC_ONCE_GIVE_ITEM_MONSTER = 60, + SPEC_ONCE_OUT_ENCOUNTER = 61, + SPEC_ONCE_TOWN_ENCOUNTER = 62, + SPEC_ONCE_TRAP = 63, + SPEC_SELECT_PC = 80, + SPEC_DAMAGE = 81, + SPEC_AFFECT_HP = 82, + SPEC_AFFECT_SP = 83, + SPEC_AFFECT_XP = 84, + SPEC_AFFECT_SKILL_PTS = 85, + SPEC_AFFECT_DEADNESS = 86, + SPEC_AFFECT_POISON = 87, + SPEC_AFFECT_SPEED = 88, + SPEC_AFFECT_INVULN = 89, + SPEC_AFFECT_MAGIC_RES = 90, + SPEC_AFFECT_WEBS = 91, + SPEC_AFFECT_DISEASE = 92, + SPEC_AFFECT_SANCTUARY = 93, + SPEC_AFFECT_CURSE_BLESS = 94, + SPEC_AFFECT_DUMBFOUND = 95, + SPEC_AFFECT_SLEEP = 96, + SPEC_AFFECT_PARALYSIS = 97, + SPEC_AFFECT_STAT = 98, + SPEC_AFFECT_MAGE_SPELL = 99, + SPEC_AFFECT_PRIEST_SPELL = 100, + SPEC_AFFECT_GOLD = 101, + SPEC_AFFECT_FOOD = 102, + SPEC_AFFECT_ALCHEMY = 103, + SPEC_AFFECT_STEALTH = 104, + SPEC_AFFECT_FIREWALK = 105, + SPEC_AFFECT_FLIGHT = 106, + SPEC_IF_SDF = 130, + SPEC_IF_TOWN_NUM = 131, + SPEC_IF_RANDOM = 132, + SPEC_IF_HAVE_SPECIAL_ITEM = 133, + SPEC_IF_SDF_COMPARE = 134, + SPEC_IF_TOWN_TER_TYPE = 135, + SPEC_IF_OUT_TER_TYPE = 136, + SPEC_IF_HAS_GOLD = 137, + SPEC_IF_HAS_FOOD = 138, + SPEC_IF_ITEM_CLASS_ON_SPACE = 139, + SPEC_IF_HAVE_ITEM_CLASS = 140, + SPEC_IF_EQUIP_ITEM_CLASS = 141, + SPEC_IF_HAS_GOLD_AND_TAKE = 142, + SPEC_IF_HAS_FOOD_AND_TAKE = 143, + SPEC_IF_ITEM_CLASS_ON_SPACE_AND_TAKE = 144, + SPEC_IF_HAVE_ITEM_CLASS_AND_TAKE = 145, + SPEC_IF_EQUIP_ITEM_CLASS_AND_TAKE = 146, + SPEC_IF_DAY_REACHED = 147, + SPEC_IF_BARRELS = 148, + SPEC_IF_CRATES = 149, + SPEC_IF_EVENT_OCCURRED = 150, + SPEC_IF_HAS_CAVE_LORE = 151, + SPEC_IF_HAS_WOODSMAN = 152, + SPEC_IF_ENOUGH_MAGE_LORE = 153, + SPEC_IF_TEXT_RESPONSE = 154, + SPEC_IF_SDF_EQ = 155, + SPEC_MAKE_TOWN_HOSTILE = 170, + SPEC_TOWN_CHANGE_TER = 171, + SPEC_TOWN_SWAP_TER = 172, + SPEC_TOWN_TRANS_TER = 173, + SPEC_TOWN_MOVE_PARTY = 174, + SPEC_TOWN_HIT_SPACE = 175, + SPEC_TOWN_EXPLODE_SPACE = 176, + SPEC_TOWN_LOCK_SPACE = 177, + SPEC_TOWN_UNLOCK_SPACE = 178, + SPEC_TOWN_SFX_BURST = 179, + SPEC_TOWN_CREATE_WANDERING = 180, + SPEC_TOWN_PLACE_MONST = 181, + SPEC_TOWN_DESTROY_MONST = 182, + SPEC_TOWN_NUKE_MONSTS = 183, + SPEC_TOWN_GENERIC_LEVER = 184, + SPEC_TOWN_GENERIC_PORTAL = 185, + SPEC_TOWN_GENERIC_BUTTON = 186, + SPEC_TOWN_GENERIC_STAIR = 187, + SPEC_TOWN_LEVER = 188, + SPEC_TOWN_PORTAL = 189, + SPEC_TOWN_STAIR = 190, + SPEC_TOWN_RELOCATE = 191, // Relocate outdoors + SPEC_TOWN_PLACE_ITEM = 192, + SPEC_TOWN_SPLIT_PARTY = 193, + SPEC_TOWN_REUNITE_PARTY = 194, + SPEC_TOWN_TIMER_START = 195, + SPEC_RECT_PLACE_FIRE = 200, + SPEC_RECT_PLACE_FORCE = 201, + SPEC_RECT_PLACE_ICE = 202, + SPEC_RECT_PLACE_BLADE = 203, + SPEC_RECT_PLACE_SCLOUD = 204, + SPEC_RECT_PLACE_SLEEP = 205, + SPEC_RECT_PLACE_QUICKFIRE = 206, + SPEC_RECT_PLACE_FIRE_BARR = 207, + SPEC_RECT_PLACE_FORCE_BARR = 208, + SPEC_RECT_CLEANSE = 209, + SPEC_RECT_PLACE_SFX = 210, + SPEC_RECT_PLACE_OBJECT = 211, // place barrels, etc + SPEC_RECT_MOVE_ITEMS = 212, + SPEC_RECT_DESTROY_ITEMS = 213, + SPEC_RECT_CHANGE_TER = 214, + SPEC_RECT_SWAP_TER = 215, + SPEC_RECT_TRANS_TER = 216, + SPEC_RECT_LOCK = 217, + SPEC_RECT_UNLOCK = 218, + SPEC_OUT_MAKE_WANDER = 225, + SPEC_OUT_CHANGE_TER = 226, + SPEC_OUT_PLACE_ENCOUNTER = 227, + SPEC_OUT_MOVE_PARTY = 228, + SPEC_OUT_STORE = 229, +}; + +enum eTalkNodeType { + TALK_REGULAR = 0, + TALK_DEP_ON_SDF = 1, + TALK_SET_SDF = 2, + TALK_INN = 3, + TALK_DEP_ON_TIME = 4, + TALK_DEP_ON_TIME_AND_EVENT = 5, + TALK_DEP_ON_TOWN = 6, + TALK_BUY_ITEMS = 7, + TALK_TRAINING = 8, + TALK_BUY_MAGE = 9, + TALK_BUY_PRIEST = 10, + TALK_BUY_ALCHEMY = 11, + TALK_BUY_HEALING = 12, + TALK_SELL_WEAPONS = 13, + TALK_SELL_ARMOR = 14, + TALK_SELL_ITEMS = 15, + TALK_IDENTIFY = 16, + TALK_ENCHANT = 17, + TALK_BUY_INFO = 18, + TALK_BUY_SDF = 19, + TALK_BUY_SHIP = 20, + TALK_BUY_HORSE = 21, + TALK_BUY_SPEC_ITEM = 22, + TALK_BUY_JUNK = 23, + TALK_BUY_TOWN_LOC = 24, + TALK_END_FORCE = 25, + TALK_END_FIGHT = 26, + TALK_END_ALARM = 27, // Town hostile + TALK_END_DIE = 28, + TALK_CALL_TOWN_SPEC = 29, + TALK_CALL_SCEN_SPEC = 30, +}; diff --git a/Blades of Exile/ITEM.CPP b/Blades of Exile/classes/item.cpp similarity index 100% rename from Blades of Exile/ITEM.CPP rename to Blades of Exile/classes/item.cpp diff --git a/Blades of Exile/ITEM.H b/Blades of Exile/classes/item.h similarity index 100% rename from Blades of Exile/ITEM.H rename to Blades of Exile/classes/item.h diff --git a/Blades of Exile/DLOGTOOL.CPP b/Blades of Exile/tools/DLOGTOOL.CPP similarity index 96% rename from Blades of Exile/DLOGTOOL.CPP rename to Blades of Exile/tools/DLOGTOOL.CPP index c3c9cd98..c7b143f8 100644 --- a/Blades of Exile/DLOGTOOL.CPP +++ b/Blades of Exile/tools/DLOGTOOL.CPP @@ -1,14 +1,14 @@ #include -#include "string.h" +#include #include "global.h" -#include "graphutl.h" -#include "stdio.h" +#include "boe.graphutil.h" +#include #include "exlsound.h" #include "dlogtool.h" -#include "text.h" -#include "locutils.h" -#include "dlgutils.h" -#include "infodlgs.h" +#include "boe.text.h" +#include "boe.locutils.h" +#include "boe.dlgutil.h" +#include "boe.infodlg.h" #include "globvar.h" diff --git a/Blades of Exile/DLOGTOOL.H b/Blades of Exile/tools/DLOGTOOL.H similarity index 99% rename from Blades of Exile/DLOGTOOL.H rename to Blades of Exile/tools/DLOGTOOL.H index 083e15eb..72111081 100644 --- a/Blades of Exile/DLOGTOOL.H +++ b/Blades of Exile/tools/DLOGTOOL.H @@ -2,7 +2,7 @@ #define _DLOGTOOL_H #include "globvar.h" -#include "graphutl.h" +//#include "boe.graphutil.h" void cd_set_flag(short dlog_num,short item_num,short flag); short cd_get_led(short dlog_num,short item_num); diff --git a/Blades of Exile/tools/mathutil.cpp b/Blades of Exile/tools/mathutil.cpp new file mode 100644 index 00000000..9aaa7466 --- /dev/null +++ b/Blades of Exile/tools/mathutil.cpp @@ -0,0 +1,70 @@ +/* + * mathutil.cpp + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#include +#include "mathutil.h" + +short get_ran (short times,short min,short max){ + long int store; + short i, to_ret = 0; + + if(max < min) max = min; + + for (i = 1; i < times + 1; i++) { + store = rand(); + to_ret += min + (store % (max - min + 1));//min + (((store + 32767) * (max - min + 1)) / 65536); + } + return to_ret; +} + +short s_pow(short x,short y){ + return (short) pow((double) x, (double) y); +} + +short s_sqrt(short val) +{ + return (short) sqrt((double)(val)); +} + +short max(short a,short b){ + if (a > b) + return a; + else return b; +} + +short min(short a,short b){ + if (a < b) + return a; + else return b; +} + +short minmax(short min,short max,short k){ + if (k < min) + return min; + if (k > max) + return max; + return k; +} + +short move_to_zero(short val){ + if (val < 0) + return val + 1; + if (val > 0) + return val - 1; + return val; +} + +short gcd(short a, short b){ // Grabbed from Wikipedia and translated to C code + short t; + while(b != 0){ + t = b; + b = a % b; + a = t; + } + return a; +} \ No newline at end of file diff --git a/Blades of Exile/tools/mathutil.h b/Blades of Exile/tools/mathutil.h new file mode 100644 index 00000000..e4d2ac9d --- /dev/null +++ b/Blades of Exile/tools/mathutil.h @@ -0,0 +1,27 @@ +/* + * mathutil.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#include +using std::abs; + +#ifdef max +#undef max +#endif + +#ifdef min +#undef min +#endif + +short get_ran (short times,short min,short max); +short s_pow(short x,short y); +short s_sqrt(short val); +short max(short a,short b); +short min(short a,short b); +short minmax(short min,short max,short k); +short move_to_zero(short val); +short gcd(short a, short b); diff --git a/Blades of Exile/tools/soundtool.cpp b/Blades of Exile/tools/soundtool.cpp new file mode 100644 index 00000000..e280aef7 --- /dev/null +++ b/Blades of Exile/tools/soundtool.cpp @@ -0,0 +1,351 @@ +/* + * soundtool.cpp + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ +#include + +#if defined(__APPLE__) +#include +#elif defined(WIN32) +#include +#include +#endif + +#include + +#include "soundtool.h" + +bool sound_going(short which_s) { + short i; + + for (i = 0; i < 4; i++) + if (snd_played[i] == which_s) + return true; + return false; +} + +#ifdef __APPLE__ +pascal void snd_channel_callback(SndChannelPtr theChannel,SndCommand* theCommand) { + long theA5; + short channel = -1,i,which_sound; + +#ifndef EXILE_BIG_GUNS + theA5 = SetA5(theCommand->param2); +#endif + + for (i = 0; i < 4; i++) + if (chan[i] == theChannel) + channel = i; + which_sound = snd_played[channel]; + snd_played[channel] = -1; + //if (in_startup_mode == false) + // print_num(0,snd_played[channel],channel); + if ((sound_going(which_sound) == false) && (load_when_play[which_sound] == true)) { + HUnlock(sound_handles[which_sound]); + //if (in_startup_mode == false) + // print_num(99,snd_played[channel],channel); + } + +#ifndef EXILE_BIG_GUNS + theA5 = SetA5(theA5); +#endif +} +#endif + +void init_snd_tool(){ +#ifdef __APPLE__ + short i,t; + SndCallBackUPP callback; + + for (i = 0; i < NUM_SOUNDS; i++) { + if (!load_when_play[i]) { + sound_handles[i] = GetResource('snd ', 20000 + i); + } + } + + callback = NewSndCallBackUPP(snd_channel_callback); + + for(t=0;t<4;t++){ // set up 4 sound channels + SndNewChannel(&chan[t], sampledSynth, initMono + initNoDrop, callback); + chan[t]->qLength = 128; + } +#endif +} + +void play_sound(short which, short how_many_times) { // if < 0, play asynch +#if defined(__APPLE__) + Handle sndhandle; + unsigned long dummy; + OSErr err; + SndCommand theCommand; + if (!play_sounds || how_many_times == 0) return; + + if (abs(which) > NUM_SOUNDS) { + //char msg[50]; + /*s*/printf(/*msg,*/"Error: Sound #%i does not exist.\n",abs(which)); + //give_error(msg,"",0); + return; + } + + channel++; + + if (channel > numchannel) channel = 0; + + if (!sound_going(abs(which)) && load_when_play[abs(which)]) + sndhandle = GetResource('snd ',20000 + abs(which)); + else sndhandle = sound_handles[abs(which)]; + + if (which > 0) + if (always_asynch[which]) + which *= -1; + + if (sndhandle != NULL) + { + HLock(sndhandle); + + if (which < 0) err = SndPlay(chan[channel],(SndListHandle) sndhandle,true); // Normal SndPlay + else { + err = SndPlay(chan[channel],(SndListHandle) sndhandle,false); + } + if (err != 0) { + printf("Sound error.\n"); + //add_string_to_buf("Sound Error. Error codes:"); + //print_nums(channel,which,err); + //add_string_to_buf("Your system could not play a sound."); + //add_string_to_buf("Make sure editor isn't running."); + //add_string_to_buf("Turn off sounds if necessary."); + } + HUnlock(sndhandle); + snd_played[channel] = abs(which); + theCommand.cmd = callBackCmd; + theCommand.param1 = 0; +#ifndef EXILE_BIG_GUNS + theCommand.param2 = SetCurrentA5(); +#endif +#ifdef EXILE_BIG_GUNS + theCommand.param2 = 0; +#endif + SndDoCommand(chan[channel],&theCommand,true); + } + else SysBeep(20); + if (which < 0) + Delay(sound_delay[-1 * which],&dummy); + if(how_many_times > 1) + play_sound(which, how_many_times - 1); +#elif defined(WIN32) + short i,num_fails = 0; + char snd_name[30]; + bool asyn = false,a_sound_did_get_played = false; + bool not_asyn = false,check_sound; + HRSRC h; + if ((sounds_missing) || (!play_sounds) || (how_many_times == 0)) + return; + + if (which < 0) { + asyn = true; + which = which * -1; + } + if (which >= 1000) { + which -= 1000; + not_asyn = true; + } + + if (which >= 100) + return; + + if ((always_async[which] == true) && + ((can_ignore[which] == 1) || (can_ignore[which] >= 3))) + asyn = true; + if ((can_ignore[which] > 0) && (can_ignore[which] < 5) && (party.stuff_done[305][5] == 1)) + return; + if ((can_ignore[which] != 1) && (can_ignore[which] < 3)) + asyn = false; + if ((party.stuff_done[305][5] == 1) && (can_ignore[which] < 5)) + asyn = false; + if (not_asyn == true) + asyn = false; + + if ((load_when_play[which] == true) && (sound_handles[which] == NULL)) { + asyn = false; + sprintf((char *)snd_name,"#%d",which + 1); + h = FindResource(hModule,snd_name,"#100"); + + sound_handles[which] = LoadResource(hModule,h); + snds[which] = (char *) LockResource(sound_handles[which]); + + } + + if (store_last_sound_played == 6) + sndPlaySound(NULL,0); + + if (asyn == true) { + if (can_ignore[which] >= 4) + check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); + else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); + + while (check_sound == false) { + + if (can_ignore[store_last_sound_played] == 4) {// then sound goes away + return; + } + + + num_fails++; + if (num_fails < 40) + sound_pause(25); + else { + MessageBox(mainPtr,"Cannot play sounds - Sounds stuck error a. Game can still be played, but quietly. Check to make sure your sound drivers are up to date and not corrupted.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + print_nums(111,which,num_fails); + sounds_missing = true; + return; + } + sndPlaySound(NULL,0); + + if (can_ignore[which] >= 4) + check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY | SND_NOSTOP); + else check_sound = sndPlaySound(snds[which],SND_ASYNC | SND_MEMORY); + } + a_sound_did_get_played = true; + } + else { + if (can_ignore[which] >= 4) + check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); + else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); + while (check_sound == false) { + if (can_ignore[store_last_sound_played] == 4) {// then sound goes away + return; + } + + + num_fails++; + if (num_fails < 40) + sound_pause(25); + else { + MessageBox(mainPtr,"Cannot play sounds - Sounds stuck error b. Game can still be played, but quietly. Check to make sure your sound drivers are up to date and not corrupted.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + print_nums(222,which,num_fails); + sounds_missing = true; + return; + } + sndPlaySound(NULL,0); + + if (can_ignore[which] >= 4) + check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY | SND_NOSTOP); + else check_sound = sndPlaySound(snds[which],SND_SYNC | SND_MEMORY); + } + a_sound_did_get_played = true; + } + + store_last_sound_played = which; + + if ((load_when_play[which] == true) && (asyn == false)) + sound_handles[which] = NULL; + + for (i = 0; i < NUM_SOUNDS; i++) + if ((load_when_play[which] == true) && (sound_handles[which] != NULL) + && (a_sound_did_get_played == true) && (i != which)) + { + sound_handles[i] = NULL; + } +#endif +} + +#ifdef WIN32 +void kill_sound() +{ + sndPlaySound(NULL,0); +} +#endif + +void one_sound(short which) +{ + if (which == last_played) + return; + play_sound(which); + last_played = which; +} + +void clear_sound_memory(){ + last_played = 100; +} + +void flip_sound() +{ + play_sounds = (play_sounds == true) ? false : true; +} + + +#ifdef WIN32 +void sound_pause(long len) { + long t1,t2; + + t1 = (long) GetCurrentTime(); + t2 = t1; + while (t2 - t1 < len) { + t2 = (long)GetCurrentTime(); + } +} + +void load_sounds(HMODULE handle) +{ + short i,t,err; + HRSRC h; + char snd_name[20]; + WAVEOUTCAPS wavecaps; + + hModule = handle; + + t = waveOutGetNumDevs(); + if (t == 0) { + sounds_missing = true; + return; + } + err = waveOutGetDevCaps(0,&wavecaps,sizeof(WAVEOUTCAPS)); + if (err != 0) { + sounds_missing = true; + switch (err) { + case MMSYSERR_BADDEVICEID: + MessageBox(mainPtr,"Cannot initialize sounds - No sound device detected. Game can still be played, but quietly.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + return; + case MMSYSERR_NODRIVER: + MessageBox(mainPtr,"Cannot initialize sounds - No driver installed. Game can still be played, but quietly.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + return; + case MMSYSERR_NOMEM : + MessageBox(mainPtr,"Cannot initialize sounds - can't find enough memory. Game can still be played, but quietly.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + return; + case MMSYSERR_ALLOCATED: + MessageBox(mainPtr,"Cannot initialize sounds - sound card already allocated. Game can still be played, but quietly.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + return; + case MMSYSERR_ERROR: + MessageBox(mainPtr,"Cannot initialize sounds - internal error. Game can still be played, but quietly.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + return; + default: + MessageBox(mainPtr,"Cannot initialize sounds - unidentified error. Game can still be played, but quietly.", + "Sound Error",MB_OK | MB_ICONEXCLAMATION); + return; + + } + + } + + for (i = 0; i < NUM_SOUNDS; i++) { + sound_handles[i] = NULL; + if (load_when_play[i] == false) { + sprintf((char *)snd_name,"#%d",i + 1); + h = FindResource(handle,snd_name,"#100"); + + sound_handles[i] = LoadResource(handle,h); + snds[i] = (char*) LockResource(sound_handles[i]); + } + } +} +#endif \ No newline at end of file diff --git a/Blades of Exile/tools/soundtool.h b/Blades of Exile/tools/soundtool.h new file mode 100644 index 00000000..e1fcf2aa --- /dev/null +++ b/Blades of Exile/tools/soundtool.h @@ -0,0 +1,49 @@ +/* + * soundtool.h + * BoE + * + * Created by Celtic Minstrel on 16/04/09. + * + */ + +#ifndef _SOUNDTOOL_H +#define _SOUNDTOOL_H +const int NUM_SOUNDS = 100; + +typedef unsigned short snd_num_t; +void init_snd_tool(); +void play_sound(short which, short how_many_times = 1); +void one_sound(short which); + +#if defined(__APPLE__) +void clear_sound_memory(); +void flip_sound(); + +extern Handle sound_handles[NUM_SOUNDS]; +extern SndChannelPtr chan[4]; +extern char numchannel; +extern char channel; +#elif defined(WIN32) +#include // for HMODULE +void load_sounds (HMODULE handle); +void sound_pause(long len); +void kill_sound(); + +extern HMODULE hModule; +extern short can_ignore[100]; +extern bool sounds_missing; +HGLOBAL sound_handles[NUM_SOUNDS]; +char* snds[NUM_SOUNDS]; +#else +#error Invalid platform +#endif + +extern short snd_played[4]; +extern bool play_sounds; +extern short last_played; +extern bool always_async[100]; +extern bool load_when_play[100]; +extern short sound_delay[100]; +extern short store_last_sound_played; + +#endif diff --git a/Blades of Exile/tools/soundvars.cpp b/Blades of Exile/tools/soundvars.cpp new file mode 100644 index 00000000..c3b3ca05 --- /dev/null +++ b/Blades of Exile/tools/soundvars.cpp @@ -0,0 +1,130 @@ +#ifdef __APPLE__ +#include +Handle sound_handles[NUM_SOUNDS]; +#else +#include +#endif + +bool play_sounds = true; +short last_played = 10000; +short store_last_sound_played = 0; + +#ifdef __APPLE__ // TODO: should go over these to decide how to merge them +bool always_asynch[100] = { + false,false,false,false,false, + false,true,false,false,false, + false,false,false,false,false, // 10 + false,false,false,false,false, + false,false,false,false,true, // 20 + true,false,false,false,false, + false,false,false,false,true, // 30 + false,false,true,false,true, + false,true,true,true,true, // 40 + true,true,true,true,true, + true,false,false,false,false, // 50 + true,false,false,false,false, + false,true,false,false,false, // 60 + false,false,false,false,false, + false,false,false,false,false, // 70 + false,true,true,true,true, + true,true,true,true,false, // 80 + true,false,false,false,false, + false,true,false,false,false, // 90 + false,false,false,false,false +}; +bool load_when_play[100] = { + 0,0,1,1,1,1,0,1,1,1, + 0,0,0,1,0,1,1,1,1,1, + 1,1,1,1,1,1,1,0,1,1, + 1,1,1,1,0,1,1,0,1,1, + 1,1,1,1,1,1,1,0,0,0, + 0,1,1,1,1,0,1,1,1,1, + 1,0,1,1,1,1,1,1,1,0, + 0,0,0,0,0,0,1,1,1,1, + 1,1,1,1,1,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,0 +}; +#else +bool always_asynch[100] = { + FALSE,FALSE,FALSE,FALSE,FALSE, + TRUE,TRUE,FALSE,FALSE,FALSE, + TRUE,FALSE,FALSE,FALSE,FALSE, // 10 + FALSE,FALSE,FALSE,FALSE,FALSE, + FALSE,FALSE,TRUE,FALSE,TRUE, // 20 + TRUE,FALSE,FALSE,FALSE,FALSE, + FALSE,FALSE,FALSE,FALSE,TRUE, // 30 + FALSE,FALSE,TRUE,FALSE,TRUE, + FALSE,TRUE,TRUE,TRUE,TRUE, // 40 + TRUE,TRUE,TRUE,TRUE,TRUE, + TRUE,FALSE,FALSE,TRUE,FALSE, // 50 + TRUE,FALSE,FALSE,FALSE,FALSE, + FALSE,TRUE,FALSE,FALSE,FALSE, // 60 + FALSE,FALSE,FALSE,FALSE,FALSE, + FALSE,FALSE,FALSE,FALSE,FALSE, // 70 + FALSE,TRUE,TRUE,TRUE,TRUE, + TRUE,TRUE,TRUE,TRUE,FALSE, // 80 + TRUE,FALSE,FALSE,FALSE,FALSE, + FALSE,TRUE,FALSE,FALSE,FALSE, // 90 + FALSE,FALSE,FALSE,FALSE,FALSE}; +bool load_when_play[100] = { + 0,0,1,1,1,0,0,1,1,1, + 0,0,0,1,0,1,1,1,1,1, + 1,1,0,1,1,1,1,0,1,1, + 1,1,1,1,0,1,1,0,1,1, + 1,1,1,1,1,1,1,0,0,0, + 0,1,1,0,1,0,1,1,1,1, // 50 + 1,0,1,1,1,1,1,1,1,0, + 0,0,0,0,0,0,0,0,0,0, // 70 + 1,1,1,1,1,0,0,0,0,0, + 1,0,1,1,1,1,1,1,1,0 +}; +#endif + +short sound_delay[100] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,25,25,0,0,0,0, + 0,0,0,0,8,0,0,8,0,0, + 0,0,0,10,20,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,13,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0 +}; +bool sounds_missing = false; + +short can_ignore[100] = { + 0,0,0,0,0,5,3,0,0,0, + 5,5,5,0,5,0,0,0,0,0, + 0,0,5,0,0,0,0,0,0,2, + 2,2,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,1,1,1, + 1,0,0,5,0,1,0,0,0,0, // 50 + 0,0,0,0,5,0,0,0,0,0, + 0,0,0,0,0, 0,5,5,5,5, // 70 + 4,4,4,4,0,0,0,0,0,0, + 0,5,5,0,0,0,0,0,0,0 +}; // currently windows-only? +// 1 - polite asych, 1 or 2 or 3- lose easily when pref is set for fewer snds +// 3 can be async +// 4 - nostop asynch ... when 4, this sound is NOSTOP, i.e. when played, is played +// asynch, and refuses all other sounds. Sounds that come in are ignored, and +// disappear into the ether +// 5 - finally, bold asynch ... when 5, this sound is NOSTOP, i.e. when played, is played +// asynch, and refuses all other sounds. When a sound is played on top of this, game +// hangs on until sound is done, and then and only then plays later sound. + +//Allocate SndChannelPtr chan[4] as a global variable. +//Allocate char numchannel = 3; (This gives 4 channels, = 2 gives 3 etc... +//Allocate char channel; This is just used as a counter so each sound is played by the next +//channel in line. You can have up to 4 sounds playing at once. + +#ifdef __APPLE__ +SndChannelPtr chan[4]; +char numchannel = 3; +char channel; +#else +HMODULE hModule; +#endif +short snd_played[4] = {-1,-1,-1,-1};