From b2b8a4d75b18e876558aab3932d83b6de30de9b1 Mon Sep 17 00:00:00 2001 From: Chokboyz Date: Mon, 22 Mar 2010 02:27:00 +0000 Subject: [PATCH] *Added a custom makefile for DevCpp which solves the ressources multiple-definitions problem (Game and Editor, the Character Editor wasn't affected). Following requests/reports : Blades of Exile : *Corrected the Skill and Giant Strength abilities handling so that they actually increase the chances of hitting instead of decreasing it (damages were correctly handled). *Now trying to enter a blocked space multiple times won't produce a lot of message but add a (xX) suffix to the "blocked:" message (X number of tries to enter the space) Minor Editor changes : *When opening a new town or assigning a new town to a town entry on outdoor map, the input field is already selected (extended the basic function for flexibility). Code-wise : *Readded legacy monster skill constants in CONSTS.h, to make the original code easier to understand for newcomers. Chokboyz git-svn-id: http://openexile.googlecode.com/svn/trunk@145 4ebdad44-0ea0-11de-aab3-ff745001d230 --- Blades of Exile/Blades of Exile.dev | 8 +- Blades of Exile/GLOBAL.H | 5 + Blades of Exile/Makefile-DevCpp.win | 111 ++++++++++++++++++ Blades of Exile/boe.actions.cpp | 45 ++++++- Blades of Exile/boe.combat.cpp | 85 +++++++------- Blades of Exile/boe.fileio.cpp | 1 + Blades of Exile/boe.specials.cpp | 4 +- Blades of Exile/boe.text.cpp | 7 +- Blades of Exile/boe.text.h | 2 + Blades of Exile/classes/consts.h | 61 ++++++++++ .../Blades of Exile Scenario Editor.dev | 6 +- Scenario Editor/DLOGTOOL.CPP | 11 +- Scenario Editor/DLOGTOOL.H | 3 +- Scenario Editor/Makefile-DevCpp.win | 66 +++++++++++ Scenario Editor/townout.cpp | 8 +- 15 files changed, 351 insertions(+), 72 deletions(-) create mode 100644 Blades of Exile/Makefile-DevCpp.win create mode 100644 Scenario Editor/Makefile-DevCpp.win diff --git a/Blades of Exile/Blades of Exile.dev b/Blades of Exile/Blades of Exile.dev index 1aff940e..84ea7e17 100644 --- a/Blades of Exile/Blades of Exile.dev +++ b/Blades of Exile/Blades of Exile.dev @@ -7,7 +7,7 @@ Ver=1 IsCpp=1 Folders=Classes,Tools CommandLine= -CompilerSettings=0000000000001000000000 +CompilerSettings=0000000000010000000000 PchHead=-1 PchSource=-1 ProfilesCount=1 @@ -19,7 +19,7 @@ PrivateResource=Blades_of_Exile_private.rc ResourceIncludes= MakeIncludes= Compiler= -CppCompiler=-Wall_@@_ +CppCompiler=-Wall_@@__@@_ Linker=-lwinmm_@@_ Icon= ExeOutput= @@ -27,8 +27,8 @@ ObjectOutput= OverrideOutput=0 OverrideOutputName=Blades of Exile.exe HostApplication= -UseCustomMakefile=0 -CustomMakefile= +UseCustomMakefile=1 +CustomMakefile=Makefile-DevCpp.win IncludeVersionInfo=0 SupportXPThemes=0 CompilerSet=0 diff --git a/Blades of Exile/GLOBAL.H b/Blades of Exile/GLOBAL.H index ae10bf3b..ed9a41c3 100644 --- a/Blades of Exile/GLOBAL.H +++ b/Blades of Exile/GLOBAL.H @@ -474,4 +474,9 @@ typedef struct { location where; }pending_special_type; +//text buffer struct (i.e bottom right window's content) +typedef struct { + char line[50]; + } buf_line; + #endif diff --git a/Blades of Exile/Makefile-DevCpp.win b/Blades of Exile/Makefile-DevCpp.win new file mode 100644 index 00000000..42cd4c4e --- /dev/null +++ b/Blades of Exile/Makefile-DevCpp.win @@ -0,0 +1,111 @@ +# Project: Blades of Exile Win32 +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = Blades_of_Exile_private.res +OBJ = boe.actions.o boe.main.o boe.combat.o boe.dlgutil.o boe.fields.o boe.fileio.o GLOBAL.o boe.graphics.o boe.graphutil.o boe.infodlg.o boe.itemdata.o boe.items.o boe.locutils.o boe.monster.o boe.newgraph.o boe.party.o boe.specials.o boe.text.o boe.town.o GLOBVAR.o tools/soundtool.o tools/soundvars.o tools/DLOGTOOL.o tools/mathutil.o classes/item.o classes/LOCATION.o classes/PC.o $(RES) +LINKOBJ = boe.actions.o boe.main.o boe.combat.o boe.dlgutil.o boe.fields.o boe.fileio.o GLOBAL.o boe.graphics.o boe.graphutil.o boe.infodlg.o boe.itemdata.o boe.items.o boe.locutils.o boe.monster.o boe.newgraph.o boe.party.o boe.specials.o boe.text.o boe.town.o GLOBVAR.o tools/soundtool.o tools/soundvars.o tools/DLOGTOOL.o tools/mathutil.o classes/item.o classes/LOCATION.o classes/PC.o $(RES) +LIBS = -L"C:/Dev-Cpp/lib/GTK+" -mwindows -lwinmm +INCS = -I"include" +CXXINCS = +BIN = "Blades of Exile.exe" +CXXFLAGS = $(CXXINCS) -Wall -O2 +CFLAGS = $(INCS) -O2 +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before "Blades of Exile.exe" all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(CPP) $(LINKOBJ) -o "Blades of Exile.exe" $(LIBS) + +boe.actions.o: boe.actions.cpp + $(CPP) -c boe.actions.cpp -o boe.actions.o $(CXXFLAGS) + +boe.main.o: boe.main.cpp + $(CPP) -c boe.main.cpp -o boe.main.o $(CXXFLAGS) + +boe.combat.o: boe.combat.cpp + $(CPP) -c boe.combat.cpp -o boe.combat.o $(CXXFLAGS) + +boe.dlgutil.o: boe.dlgutil.cpp + $(CPP) -c boe.dlgutil.cpp -o boe.dlgutil.o $(CXXFLAGS) + +boe.fields.o: boe.fields.cpp + $(CPP) -c boe.fields.cpp -o boe.fields.o $(CXXFLAGS) + +boe.fileio.o: boe.fileio.cpp + $(CPP) -c boe.fileio.cpp -o boe.fileio.o $(CXXFLAGS) + +GLOBAL.o: GLOBAL.CPP + $(CPP) -c GLOBAL.CPP -o GLOBAL.o $(CXXFLAGS) + +boe.graphics.o: boe.graphics.cpp + $(CPP) -c boe.graphics.cpp -o boe.graphics.o $(CXXFLAGS) + +boe.graphutil.o: boe.graphutil.cpp + $(CPP) -c boe.graphutil.cpp -o boe.graphutil.o $(CXXFLAGS) + +boe.infodlg.o: boe.infodlg.cpp + $(CPP) -c boe.infodlg.cpp -o boe.infodlg.o $(CXXFLAGS) + +boe.itemdata.o: boe.itemdata.cpp + $(CPP) -c boe.itemdata.cpp -o boe.itemdata.o $(CXXFLAGS) + +boe.items.o: boe.items.cpp + $(CPP) -c boe.items.cpp -o boe.items.o $(CXXFLAGS) + +boe.locutils.o: boe.locutils.cpp + $(CPP) -c boe.locutils.cpp -o boe.locutils.o $(CXXFLAGS) + +boe.monster.o: boe.monster.cpp + $(CPP) -c boe.monster.cpp -o boe.monster.o $(CXXFLAGS) + +boe.newgraph.o: boe.newgraph.cpp + $(CPP) -c boe.newgraph.cpp -o boe.newgraph.o $(CXXFLAGS) + +boe.party.o: boe.party.cpp + $(CPP) -c boe.party.cpp -o boe.party.o $(CXXFLAGS) + +boe.specials.o: boe.specials.cpp + $(CPP) -c boe.specials.cpp -o boe.specials.o $(CXXFLAGS) + +boe.text.o: boe.text.cpp + $(CPP) -c boe.text.cpp -o boe.text.o $(CXXFLAGS) + +boe.town.o: boe.town.cpp + $(CPP) -c boe.town.cpp -o boe.town.o $(CXXFLAGS) + +GLOBVAR.o: GLOBVAR.CPP + $(CPP) -c GLOBVAR.CPP -o GLOBVAR.o $(CXXFLAGS) + +tools/soundtool.o: tools/soundtool.cpp + $(CPP) -c tools/soundtool.cpp -o tools/soundtool.o $(CXXFLAGS) + +tools/soundvars.o: tools/soundvars.cpp + $(CPP) -c tools/soundvars.cpp -o tools/soundvars.o $(CXXFLAGS) + +tools/DLOGTOOL.o: tools/DLOGTOOL.CPP + $(CPP) -c tools/DLOGTOOL.CPP -o tools/DLOGTOOL.o $(CXXFLAGS) + +tools/mathutil.o: tools/mathutil.cpp + $(CPP) -c tools/mathutil.cpp -o tools/mathutil.o $(CXXFLAGS) + +classes/item.o: classes/item.cpp + $(CPP) -c classes/item.cpp -o classes/item.o $(CXXFLAGS) + +classes/LOCATION.o: classes/LOCATION.CPP + $(CPP) -c classes/LOCATION.CPP -o classes/LOCATION.o $(CXXFLAGS) + +classes/PC.o: classes/PC.CPP + $(CPP) -c classes/PC.CPP -o classes/PC.o $(CXXFLAGS) + +Blades_of_Exile_private.res: Blades_of_Exile_private.rc BLADES.RC GAMEDLOG.RC GAMESTR.RC + $(WINDRES) -i Blades_of_Exile_private.rc --input-format=rc -o Blades_of_Exile_private.res -O coff -D_INCLUDED_RC diff --git a/Blades of Exile/boe.actions.cpp b/Blades of Exile/boe.actions.cpp index 75f8fc2a..cbe7466c 100644 --- a/Blades of Exile/boe.actions.cpp +++ b/Blades of Exile/boe.actions.cpp @@ -31,6 +31,10 @@ extern short store_flags[3]; //extern BOOL timed_special_happened; +unsigned char previous_blocked_direction = 50;//no previous block on initialisation +unsigned short times_blocked=0; +extern buf_line text_buffer[TEXT_BUF_LEN]; + void init_screen_locs() { short i,j,k,l; @@ -2521,6 +2525,7 @@ Boolean outd_move_party(location destination,Boolean forced) Boolean keep_going = TRUE,check_f; location store_corner,store_iwc; unsigned char ter; + short buffer_ptr; keep_going = check_special_terrain(destination,0,0,&spec_num,&check_f); if (check_f == TRUE) forced = TRUE; @@ -2712,8 +2717,19 @@ Boolean outd_move_party(location destination,Boolean forced) return TRUE; } else { - sprintf ((char *) create_line, "Blocked: %s",dir_string[set_direction(party.p_loc, destination)]); - add_string_to_buf((char *) create_line); + if(set_direction(party.p_loc, destination) == previous_blocked_direction){ + times_blocked++; + buffer_ptr = ((buf_pointer - 1) == -1) ? (TEXT_BUF_LEN - 1) : buf_pointer - 1; + sprintf(text_buffer[buffer_ptr].line, "Blocked: %s (x%d)",dir_string[set_direction(party.p_loc, destination)], times_blocked); + string_added = true; + print_buf(); + } + else{ + sprintf (create_line, "Blocked: %s",dir_string[set_direction(party.p_loc, destination)]); + add_string_to_buf(create_line); + previous_blocked_direction = set_direction(party.p_loc, destination); + times_blocked = 1; + } return FALSE; } } @@ -2728,6 +2744,7 @@ Boolean town_move_party(location destination,short forced) short boat_there,horse_there,spec_num; unsigned char ter; Boolean check_f = FALSE; + short buffer_ptr; if (in_scen_debug && ghost_mode) forced = TRUE; @@ -2854,10 +2871,26 @@ Boolean town_move_party(location destination,short forced) return TRUE; } else { - if (destination.isDoor()) - sprintf ((char *) create_line, "Door locked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); - else sprintf ((char *) create_line, "Blocked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); - add_string_to_buf((char *) create_line); + if (destination.isDoor()){ + sprintf (create_line, "Door locked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); + add_string_to_buf(create_line); + } + else{ + if(set_direction(c_town.p_loc, destination) == previous_blocked_direction){ + times_blocked++; + buffer_ptr = ((buf_pointer - 1) == -1) ? (TEXT_BUF_LEN - 1) : buf_pointer - 1; + sprintf (text_buffer[buffer_ptr].line, "Blocked: %s (x%d)",dir_string[set_direction(c_town.p_loc, destination)], times_blocked); + string_added = true; + print_buf(); + } + else{ + sprintf (create_line, "Blocked: %s ",dir_string[set_direction(c_town.p_loc, destination)]); + add_string_to_buf(create_line); + previous_blocked_direction = set_direction(c_town.p_loc, destination); + times_blocked = 1; + } + } + return FALSE; } } diff --git a/Blades of Exile/boe.combat.cpp b/Blades of Exile/boe.combat.cpp index e8b6d259..57a47fe5 100644 --- a/Blades of Exile/boe.combat.cpp +++ b/Blades of Exile/boe.combat.cpp @@ -16,6 +16,7 @@ #include "boe.town.h" #include "boe.specials.h" #include "boe.graphutil.h" +#include "classes/consts.h" #include "globvar.h" @@ -249,8 +250,8 @@ Boolean pc_combat_move(location destination) return TRUE; } else { - sprintf ((char *) create_line, "Blocked: %s ",d_string[dir]); - add_string_to_buf((char *) create_line); + sprintf (create_line, "Blocked: %s ",d_string[dir]); + add_string_to_buf(create_line); return FALSE; } } @@ -279,38 +280,38 @@ void pc_attack(short who_att,short target) // slice out bad attacks if (adven[who_att].isAlive() == false) return; - if ((adven[who_att].status[11] > 0) || (adven[who_att].status[12] > 0)) + if ((adven[who_att].status[STATUS_ASLEEP] > 0) || (adven[who_att].status[STATUS_PARALYZED] > 0)) return; last_attacked[who_att] = target; which_m = &c_town.monst.dudes[target]; for (i = 0; i < 24; i++) - if (((adven[who_att].items[i].variety == 1) || (adven[who_att].items[i].variety == 2)) && + if (((adven[who_att].items[i].variety == ITEM_TYPE_ONE_HANDED) || (adven[who_att].items[i].variety == ITEM_TYPE_TWO_HANDED)) && (adven[who_att].equip[i] == TRUE)) if (weap1 == 24) weap1 = i; else weap2 = i; - hit_adj = (-5 * minmax(-8,8,(int)adven[who_att].status[1])) + 5 * minmax(-8,8,(int)which_m->m_d.status[1]) - - adven[who_att].statAdj(1) * 5 + (get_encumberance(who_att)) * 5; + hit_adj = (-5 * minmax(-8,8,(int)adven[who_att].status[STATUS_BLESS_CURSE])) + 5 * minmax(-8,8,(int)which_m->m_d.status[STATUS_BLESS_CURSE]) + - adven[who_att].statAdj(SKILL_DEXTERITY) * 5 + (get_encumberance(who_att)) * 5; - dam_adj = minmax(-8,8,(int)adven[who_att].status[1]) - minmax(-8,8,(int)which_m->m_d.status[1]) - + adven[who_att].statAdj(0); + dam_adj = minmax(-8,8,(int)adven[who_att].status[STATUS_BLESS_CURSE]) - minmax(-8,8,(int)which_m->m_d.status[STATUS_BLESS_CURSE]) + + adven[who_att].statAdj(SKILL_STRENGTH); - if ((which_m->m_d.status[11] > 0) || (which_m->m_d.status[12] > 0)) { + if ((which_m->m_d.status[STATUS_ASLEEP] > 0) || (which_m->m_d.status[STATUS_PARALYZED] > 0)) { hit_adj -= 80; dam_adj += 10; } - if ((skill_item = text_pc_has_abil_equip(who_att,37)) < 24) { - hit_adj += 5 * (adven[who_att].items[skill_item].ability_strength / 2 + 1); + if ((skill_item = text_pc_has_abil_equip(who_att,ITEM_SKILL)) < 24) { + hit_adj -= 5 * (adven[who_att].items[skill_item].ability_strength / 2 + 1); dam_adj += adven[who_att].items[skill_item].ability_strength / 2; } - if ((skill_item = text_pc_has_abil_equip(who_att,43)) < 24) { + if ((skill_item = text_pc_has_abil_equip(who_att,ITEM_GIANT_STRENGTH)) < 24) { + hit_adj -= adven[who_att].items[skill_item].ability_strength * 2; dam_adj += adven[who_att].items[skill_item].ability_strength; - hit_adj += adven[who_att].items[skill_item].ability_strength * 2; } void_sanctuary(who_att); @@ -321,11 +322,11 @@ void pc_attack(short who_att,short target) if (weap1 == 24) { - sprintf ((char *) create_line, "%s punches. ",(char *) adven[who_att].name);//,hit_adj, dam_adj); + sprintf (create_line, "%s punches. ", adven[who_att].name);//,hit_adj, dam_adj); add_string_to_buf((char *) create_line); r1 = get_ran(1,0,100) + hit_adj - 20; - r1 += 5 * (adven[current_pc].status[6] / 3); + r1 += 5 * (adven[current_pc].status[STATUS_WEBS] / 3); r2 = get_ran(1,1,4) + dam_adj; if (r1 <= hit_chance[adven[who_att].skills[what_skill1]]) { @@ -333,8 +334,8 @@ void pc_attack(short who_att,short target) } else { draw_terrain(2); - sprintf ((char *) create_line, "%s misses. ",(char *) adven[who_att].name); - add_string_to_buf((char *) create_line); + sprintf (create_line, "%s misses. ",adven[who_att].name); + add_string_to_buf(create_line); play_sound(2); } } @@ -347,8 +348,8 @@ void pc_attack(short who_att,short target) if (what_skill1 == 2) what_skill1 = 3; - sprintf ((char *) create_line, "%s swings. ",(char *) adven[who_att].name);//,hit_adj, dam_adj); - add_string_to_buf((char *) create_line); + sprintf (create_line, "%s swings. ",adven[who_att].name);//,hit_adj, dam_adj); + add_string_to_buf(create_line); r1 = get_ran(1,0,100) - 5 + hit_adj - 5 * adven[who_att].items[weap1].bonus; @@ -358,11 +359,11 @@ void pc_attack(short who_att,short target) r1 += 25; // race adj. - if ((adven[who_att].race == RACE_SLITH) && (adven[who_att].items[weap1].type == 3)) + if ((adven[who_att].race == RACE_SLITH) && (adven[who_att].items[weap1].type == ITEM_POLE)) r1 -= 10; r2 = get_ran(1,1,adven[who_att].items[weap1].item_level) + dam_adj + 2 + adven[who_att].items[weap1].bonus; - if (adven[who_att].items[weap1].ability == 12) + if (adven[who_att].items[weap1].ability == ITEM_WEAK_WEAPON) r2 = (r2 * (10 - adven[who_att].items[weap1].ability_strength)) / 10; if (r1 <= hit_chance[adven[who_att].skills[what_skill1]]) { @@ -372,9 +373,9 @@ void pc_attack(short who_att,short target) // assassinate r1 = get_ran(1,0,100); if ((adven[who_att].level >= which_m->m_d.level - 1) - && (adven[who_att].skills[16] >= which_m->m_d.level / 2) + && (adven[who_att].skills[SKILL_ASSASSINATION] >= which_m->m_d.level / 2) && (which_m->m_d.spec_skill != 12)) // Can't assassinate splitters - if (r1 < hit_chance[max(adven[who_att].skills[16] - which_m->m_d.level,0)]) { + if (r1 < hit_chance[max(adven[who_att].skills[SKILL_ASSASSINATION] - which_m->m_d.level,0)]) { add_string_to_buf(" You assassinate. "); spec_dam += r2; } @@ -393,30 +394,30 @@ void pc_attack(short who_att,short target) break; } // poison - if ((adven[who_att].status[0] > 0) && (adven[who_att].weap_poisoned == weap1)) { - poison_amt = adven[who_att].status[0]; - if (adven[who_att].hasAbilEquip(51) < 24) + if ((adven[who_att].status[STATUS_POISONED_WEAPON] > 0) && (adven[who_att].weap_poisoned == weap1)) { + poison_amt = adven[who_att].status[STATUS_POISONED_WEAPON]; + if (adven[who_att].hasAbilEquip(ITEM_POISON_AUGMENT) < 24) poison_amt += 2; which_m->poison(poison_amt); - move_to_zero(adven[who_att].status[0]); + move_to_zero(adven[who_att].status[STATUS_POISONED_WEAPON]); } - if ((adven[who_att].items[weap1].ability == 14) && (get_ran(1,0,1) == 1)) { + if ((adven[who_att].items[weap1].ability == ITEM_POISONED_WEAPON) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drips venom. "); which_m->poison(adven[who_att].items[weap1].ability_strength / 2); } - if ((adven[who_att].items[weap1].ability == 9) && (get_ran(1,0,1) == 1)) { + if ((adven[who_att].items[weap1].ability == ITEM_ACIDIC_WEAPON) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drips acid. "); which_m->acid(adven[who_att].items[weap1].ability_strength / 2); } - if ((adven[who_att].items[weap1].ability == 10) && (get_ran(1,0,1) == 1)) { + if ((adven[who_att].items[weap1].ability == ITEM_SOULSUCKER) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drains life. "); adven[who_att].heal(adven[who_att].items[weap1].ability_strength / 2); } } else { draw_terrain(2); - sprintf ((char *) create_line, " %s misses. ",(char *) adven[who_att].name); - add_string_to_buf((char *) create_line); + sprintf (create_line, " %s misses. ", adven[who_att].name); + add_string_to_buf(create_line); if (what_skill1 == 5) play_sound(19); else play_sound(2); @@ -430,17 +431,17 @@ void pc_attack(short who_att,short target) what_skill2 = 3; - sprintf ((char *) create_line, "%s swings. ",(char *) adven[who_att].name);//,hit_adj, dam_adj); - add_string_to_buf((char *) create_line); + sprintf (create_line, "%s swings. ", adven[who_att].name);//,hit_adj, dam_adj); + add_string_to_buf(create_line); r1 = get_ran(1,0,100) + hit_adj - 5 * adven[who_att].items[weap2].bonus; // Ambidextrous? if (adven[who_att].traits[TRAIT_AMBIDEXTROUS] == FALSE) r1 += 25; - r1 += 5 * (adven[current_pc].status[6] / 3); + r1 += 5 * (adven[current_pc].status[STATUS_WEBS] / 3); r2 = get_ran(1,1,adven[who_att].items[weap2].item_level) + dam_adj - 1 + adven[who_att].items[weap2].bonus; - if (adven[who_att].items[weap2].ability == 12) + if (adven[who_att].items[weap2].ability == ITEM_WEAK_WEAPON) r2 = (r2 * (10 - adven[who_att].items[weap2].ability_strength)) / 10; if (r1 <= hit_chance[adven[who_att].skills[what_skill2]]) { @@ -460,15 +461,15 @@ void pc_attack(short who_att,short target) break; } - if ((adven[who_att].items[weap2].ability == 14) && (get_ran(1,0,1) == 1)) { + if ((adven[who_att].items[weap2].ability == ITEM_POISONED_WEAPON) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drips venom. "); which_m->poison(adven[who_att].items[weap2].ability_strength / 2); } - if ((adven[who_att].items[weap2].ability == 9) && (get_ran(1,0,1) == 1)) { + if ((adven[who_att].items[weap2].ability == ITEM_ACIDIC_WEAPON) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drips acid. "); which_m->acid(adven[who_att].items[weap2].ability_strength / 2); } - if ((adven[who_att].items[weap2].ability == 10) && (get_ran(1,0,1) == 1)) { + if ((adven[who_att].items[weap2].ability == ITEM_SOULSUCKER) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drains life. "); adven[who_att].heal(adven[who_att].items[weap2].ability_strength / 2); } @@ -476,8 +477,8 @@ void pc_attack(short who_att,short target) } else { draw_terrain(2); - sprintf ((char *) create_line, "%s misses. ",(char *) adven[who_att].name); - add_string_to_buf((char *) create_line); + sprintf (create_line, "%s misses. ", adven[who_att].name); + add_string_to_buf( create_line); if (what_skill2 == 5) play_sound(19); else play_sound(2); @@ -486,7 +487,7 @@ void pc_attack(short who_att,short target) move_to_zero(adven[who_att].status[0]); take_ap(4); - if (((c_town.monst.dudes[target].m_d.status[10] > 0) || (c_town.monst.dudes[target].m_d.spec_skill == 22)) + if (((c_town.monst.dudes[target].m_d.status[STATUS_MARTYRS_SHIELD] > 0) || (c_town.monst.dudes[target].m_d.spec_skill == 22)) && (store_hp - c_town.monst.dudes[target].m_d.health > 0)) { add_string_to_buf(" Shares damage! "); adven[who_att].damage(store_hp - c_town.monst.dudes[target].m_d.health, 3,-1); diff --git a/Blades of Exile/boe.fileio.cpp b/Blades of Exile/boe.fileio.cpp index c620412c..ec8a01fb 100644 --- a/Blades of Exile/boe.fileio.cpp +++ b/Blades of Exile/boe.fileio.cpp @@ -1876,6 +1876,7 @@ void oops_error(short error) give_error("The program encountered an error while loading/saving/creating the scenario. To prevent future problems, the program will now terminate. Trying again may solve the problem.",(char *) error_str,0); } +//called recursively if a sub-directory is founded void ListFiles(char *path, HWND listbox){ short len; diff --git a/Blades of Exile/boe.specials.cpp b/Blades of Exile/boe.specials.cpp index 5f71cc44..3258ab84 100644 --- a/Blades of Exile/boe.specials.cpp +++ b/Blades of Exile/boe.specials.cpp @@ -182,8 +182,8 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho } if((mode == 2) && town_boat_there(where_check) < 30){//can't enter boats while in combat mode - sprintf ((char *) create_line, "Blocked: %s",dir_string[set_direction(pc_pos[current_pc], where_check)]); - add_string_to_buf((char *) create_line); + sprintf (create_line, "Blocked: %s",dir_string[set_direction(pc_pos[current_pc], where_check)]); + add_string_to_buf(create_line); can_enter = FALSE; } if (can_enter == FALSE) diff --git a/Blades of Exile/boe.text.cpp b/Blades of Exile/boe.text.cpp index 668b26da..e2811934 100644 --- a/Blades of Exile/boe.text.cpp +++ b/Blades of Exile/boe.text.cpp @@ -1,5 +1,4 @@ #define LINES_IN_TEXT_WIN 11 -#define TEXT_BUF_LEN 70 #include "global.h" #include @@ -13,10 +12,6 @@ #include "globvar.h" -typedef struct { - char line[50]; - } buf_line; - buf_line text_buffer[TEXT_BUF_LEN]; void InsetRect(RECT *rect,short x, short y); @@ -1212,7 +1207,7 @@ void add_string_to_buf(char *string) print_buf(); through_sending(); } - sprintf((char *)text_buffer[buf_pointer].line, "%-49.49s", string); + sprintf(text_buffer[buf_pointer].line, "%-49.49s", string); text_buffer[buf_pointer].line[49] = 0; if (buf_pointer == (TEXT_BUF_LEN - 1)) buf_pointer = 0; diff --git a/Blades of Exile/boe.text.h b/Blades of Exile/boe.text.h index c3aa1b89..3a56cf21 100644 --- a/Blades of Exile/boe.text.h +++ b/Blades of Exile/boe.text.h @@ -7,6 +7,8 @@ #include "global.h" // structs +#define TEXT_BUF_LEN 70 + short text_pc_has_abil_equip(short pc_num,short abil); void put_pc_screen(); void place_buy_button(short position,short pc_num,short item_num,HDC hdc); diff --git a/Blades of Exile/classes/consts.h b/Blades of Exile/classes/consts.h index b074bd3b..92362761 100644 --- a/Blades of Exile/classes/consts.h +++ b/Blades of Exile/classes/consts.h @@ -171,6 +171,7 @@ enum eMonsterType { }; +//future spec_skill !!! /* Special Ability a.k.a spec_skill */ enum eMonstAbil { @@ -221,6 +222,66 @@ enum eMonstAbil { MONST_CALL_GLOBAL_SPECIAL, }; +//at least for proper code comprehension +//legacy spec_skill +/* Special Ability a.k.a spec_skill */ + +/* #define MONSTER_NO_SPECIAL_ABILITY 0 + #define MONSTER_THROWS_DARTS 1 + #define MONSTER_SHOOTS_ARROWS 2 + #define MONSTER_THROWS_SPEARS 3 + #define MONSTER_THROWS_ROCKS1 4 //4-24 damages + #define MONSTER_THROWS_ROCKS2 5 //5-30 damages + #define MONSTER_THROWS_ROCKS3 6 //6-36 damages + #define MONSTER_THROWS_RAZORDISKS 7 + #define MONSTER_PETRIFICATION_RAY 8 + #define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray + #define MONSTER_HEAT_RAY 10 + #define MONSTER_INVISIBLE 11 + #define MONSTER_SPLITS 12 + #define MONSTER_MINDLESS 13 + #define MONSTER_BREATHES_STINKING_CLOUDS 14 + #define MONSTER_ICY_TOUCH 15 + #define MONSTER_XP_DRAINING_TOUCH 16 + #define MONSTER_ICY_AND_DRAINING_TOUCH 17 + #define MONSTER_SLOWING_TOUCH 18 + #define MONSTER_SHOOTS_WEB 19 + #define MONSTER_GOOD_ARCHER 20 + #define MONSTER_STEALS_FOOD 21 + #define MONSTER_PERMANENT_MARTYRS_SHIELD 22 + #define MONSTER_PARALYSIS_RAY 23 + #define MONSTER_DUMBFOUNDING_TOUCH 24 + #define MONSTER_DISEASE_TOUCH 25 + #define MONSTER_ABSORB_SPELLS 26 + #define MONSTER_WEB_TOUCH 27 + #define MONSTER_SLEEP_TOUCH 28 + #define MONSTER_PARALYSIS_TOUCH 29 + #define MONSTER_PETRIFICATION_TOUCH 30 + #define MONSTER_ACID_TOUCH 31 + #define MONSTER_BREATHES_SLEEP_CLOUDS 32 + #define MONSTER_ACID_SPIT 33 + #define MONSTER_SHOOTS_SPINES 34 + #define MONSTER_DEATH_TOUCH 35 + #define MONSTER_INVULNERABILITY 36 + #define MONSTER_GUARD 37 */ + + /* Create Monsters/Fields */ + +/* #define MONSTER_NO_RADIATE 0 + #define MONSTER_RADIATE_FIRE_FIELDS 1 + #define MONSTER_RADIATE_ICE_FIELDS 2 + #define MONSTER_RADIATE_SHOCK_FIELDS 3 + #define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4 + #define MONSTER_RADIATE_SLEEP_FIELDS 5 + #define MONSTER_RADIATE_STINKING_CLOUDS 6 + //as said 7,8 and 9 are unused + #define MONSTER_SUMMON1 10 //5 percent chance + #define MONSTER_SUMMON2 11 //20 percent chance + #define MONSTER_SUMMON3 12 //50 percent chance + //as said 13 and 14 are unused + #define MONSTER_DEATH_TRIGGERS 15 //death triggers global special + */ + /* Terrains Special Properties : scenario.ter_types[i].special */ //complete diff --git a/Scenario Editor/Blades of Exile Scenario Editor.dev b/Scenario Editor/Blades of Exile Scenario Editor.dev index 15d88da0..d29b79a9 100644 --- a/Scenario Editor/Blades of Exile Scenario Editor.dev +++ b/Scenario Editor/Blades of Exile Scenario Editor.dev @@ -22,12 +22,12 @@ OverrideOutputName=Blades of Exile Scenario Editor.exe HostApplication= Folders= CommandLine= -UseCustomMakefile=0 -CustomMakefile= +UseCustomMakefile=1 +CustomMakefile=Makefile-DevCpp.win IncludeVersionInfo=0 SupportXPThemes=0 CompilerSet=0 -CompilerSettings=0000000000000000000000 +CompilerSettings=0000000000010000000000 [Unit3] FileName=DLOGTOOL.CPP diff --git a/Scenario Editor/DLOGTOOL.CPP b/Scenario Editor/DLOGTOOL.CPP index e57a3760..8091eb3d 100644 --- a/Scenario Editor/DLOGTOOL.CPP +++ b/Scenario Editor/DLOGTOOL.CPP @@ -814,8 +814,10 @@ void cd_set_text_edit_str(short dlog_num, short item_num, char *str) SetWindowText(edit_box[i],str); } + // NOTE!!! Expects a c string -void cd_set_text_edit_num(short dlog_num, short item_num, short num) +//highlight is to select the dialog text +void cd_set_text_edit_num(short dlog_num, short item_num, short num, bool highlight) { short i; char store_ptr[256]; @@ -823,14 +825,18 @@ void cd_set_text_edit_num(short dlog_num, short item_num, short num) sprintf(store_ptr,"%d",num); for (i = 0; i < 80; i++) if ((store_edit_parent_num[i] == dlog_num) && (store_edit_item[i] == item_num) - && (edit_box[i] != NULL)) + && (edit_box[i] != NULL)){ SetWindowText(edit_box[i],store_ptr); + if(highlight) + SendMessage(edit_box[i],EM_SETSEL,0,-1); + } } void cdsin(short dlog_num, short item_num, short num) { cd_set_item_num( dlog_num, item_num, num); } + void csit(short dlog_num, short item_num, char *str) { cd_set_item_text( dlog_num, item_num, str); @@ -840,7 +846,6 @@ void csp(short dlog_num, short item_num, short pict_num) cd_set_pict( dlog_num, item_num, pict_num); } - void cd_set_item_text(short dlog_num, short item_num, char *str) { short dlg_index,item_index,i; diff --git a/Scenario Editor/DLOGTOOL.H b/Scenario Editor/DLOGTOOL.H index 390ebd0e..d88a9fb1 100644 --- a/Scenario Editor/DLOGTOOL.H +++ b/Scenario Editor/DLOGTOOL.H @@ -47,7 +47,6 @@ void draw_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,s void showcursor(Boolean a); void cd_get_text_edit_str(short dlog_num, char *str); -void cd_set_text_edit_str(short dlog_num, char *str); void cdsin(short dlog_num, short item_num, short num); void csit(short dlog_num, short item_num, char *str); void csp(short dlog_num, short item_num, short pict_num); @@ -58,6 +57,6 @@ RECT calc_rect(short i, short j); void cd_retrieve_text_edit_str(short dlog_num, short item_num, char *str); short cd_retrieve_text_edit_num(short dlog_num, short item_num) ; void cd_set_text_edit_str(short dlog_num, short item_num, char *str) ; -void cd_set_text_edit_num(short dlog_num, short item_num, short num); +void cd_set_text_edit_num(short dlog_num, short item_num, short num, bool highlight = false); void InsetRect(RECT *rect,short x, short y); void draw_custom_dialog_graphic(HWND hDlg, RECT rect, short which_g, Boolean do_frame,short win_or_gworld); diff --git a/Scenario Editor/Makefile-DevCpp.win b/Scenario Editor/Makefile-DevCpp.win new file mode 100644 index 00000000..c9af9e1c --- /dev/null +++ b/Scenario Editor/Makefile-DevCpp.win @@ -0,0 +1,66 @@ +# Project: Blades of Exile Scenario Editor +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = Blades_of_Exile_Scenario_Editor_private.res +OBJ = BUTTONMG.o DLOGTOOL.o GLOBAL.o GRAPHUTL.o KEYDLGS.o TFILEIO.o townout.o EDSOUND.o GRAPHICS.o SCENARIO.o BLSCENED.o TACTIONS.o $(RES) +LINKOBJ = BUTTONMG.o DLOGTOOL.o GLOBAL.o GRAPHUTL.o KEYDLGS.o TFILEIO.o townout.o EDSOUND.o GRAPHICS.o SCENARIO.o BLSCENED.o TACTIONS.o $(RES) +LIBS = -L"C:/Dev-Cpp/lib/GTK+" -mwindows -lwinmm --strip-all +INCS = -I"include" +CXXINCS = +BIN = "Blades of Exile Scenario Editor.exe" +CXXFLAGS = $(CXXINCS) -fno-exceptions -fno-rtti +CFLAGS = $(INCS) +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before "Blades of Exile Scenario Editor.exe" all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(CPP) $(LINKOBJ) -o "Blades of Exile Scenario Editor.exe" $(LIBS) + +BUTTONMG.o: BUTTONMG.CPP + $(CPP) -c BUTTONMG.CPP -o BUTTONMG.o $(CXXFLAGS) + +DLOGTOOL.o: DLOGTOOL.CPP + $(CPP) -c DLOGTOOL.CPP -o DLOGTOOL.o $(CXXFLAGS) + +GLOBAL.o: GLOBAL.CPP + $(CPP) -c GLOBAL.CPP -o GLOBAL.o $(CXXFLAGS) + +GRAPHUTL.o: GRAPHUTL.CPP + $(CPP) -c GRAPHUTL.CPP -o GRAPHUTL.o $(CXXFLAGS) + +KEYDLGS.o: KEYDLGS.CPP + $(CPP) -c KEYDLGS.CPP -o KEYDLGS.o $(CXXFLAGS) + +TFILEIO.o: TFILEIO.CPP + $(CPP) -c TFILEIO.CPP -o TFILEIO.o $(CXXFLAGS) + +townout.o: townout.cpp + $(CPP) -c townout.cpp -o townout.o $(CXXFLAGS) + +EDSOUND.o: EDSOUND.CPP + $(CPP) -c EDSOUND.CPP -o EDSOUND.o $(CXXFLAGS) + +GRAPHICS.o: GRAPHICS.CPP + $(CPP) -c GRAPHICS.CPP -o GRAPHICS.o $(CXXFLAGS) + +SCENARIO.o: SCENARIO.CPP + $(CPP) -c SCENARIO.CPP -o SCENARIO.o $(CXXFLAGS) + +BLSCENED.o: BLSCENED.CPP + $(CPP) -c BLSCENED.CPP -o BLSCENED.o $(CXXFLAGS) + +TACTIONS.o: TACTIONS.CPP + $(CPP) -c TACTIONS.CPP -o TACTIONS.o $(CXXFLAGS) + +Blades_of_Exile_Scenario_Editor_private.res: Blades_of_Exile_Scenario_Editor_private.rc STRINGS.RC BLSCENED.RC GAMEDLOG.RC + $(WINDRES) -i Blades_of_Exile_Scenario_Editor_private.rc --input-format=rc -o Blades_of_Exile_Scenario_Editor_private.res -O coff -D_INCLUDED_RC diff --git a/Scenario Editor/townout.cpp b/Scenario Editor/townout.cpp index ae62f3c8..bf70df9b 100644 --- a/Scenario Editor/townout.cpp +++ b/Scenario Editor/townout.cpp @@ -723,10 +723,10 @@ short pick_town_num(short which_dlog,short def) cd_create_dialog_parent_num(store_whigh_dlog,0); - CDSN(store_whigh_dlog,2,def); - cd_get_item_text(which_dlog,7,(char *) temp_str); - sprintf((char *) str2,"%s (0 - %d)",(char *) temp_str,scenario.num_towns - 1); - csit(which_dlog,7,(char *) str2); + CDSN(store_whigh_dlog,2,def,true); + cd_get_item_text(which_dlog,7, temp_str); + sprintf(str2,"%s (0 - %d)", temp_str,scenario.num_towns - 1); + csit(which_dlog,7, str2); while (dialog_not_toast) ModalDialog();