
Changelog : Classic Blades of Exile version 1.0 : - Added a new item ability : Call a scenario special when using the item. The special called is specified by the ability strength. The type of scenario to call depends of the magic_use_type (the boxes from help pc (0) to harm all (4)) : 0 is only local, 1 is town local and out global, 2 is town global and out local and 3 is only global. If the number of charge is greater than 0, then using the item takes one charge. If not, the item can be used at will. - Changed the "Set SDF" debug command to display the value of the specified SDF if value to set it to is -1 (BoA style). - Added a missing compatibility switch from the introduced "Specials interrupt wait/rest" feature. - Misc. battlefield adjustment (forest battlefield doesn't show a road anymore, road battlefields appear correctly, cave bridge now has cave trims, ...) - Fixed a bug where an absent boat or horse could prevent a pc from entering a square while in outdoor combat. - Trims now use the next terrain type (cave, grass, mountain) when drawn. - Fixed a potential negative pointer to an array. - Readded Spidweb logo intro sound. - Event Timers will now triggers even when resting (compatibility switch available) - Stairway can now be called in any mode except outdoor : town, looking, talking, even fighting (put in fight mode at destination). - The three basics scenarios are no longer listed in the custom scenario list. - Talking mode : fixed a typo which would prevent the keyword "name" from giving the name dialogue. Added the keywords "buy" (for purchase) and "bye" to end conversation. - Time for event timers is now taken into account correctly while resting Outdoor/ in Inn / via "Have a Rest Node". The "Change Time" node is unchanged. - Added a preference to show a talk entry field next to "Ask About" (like in older Exiles) for direct typing. - Fixed clipping error in the main menu screen for high resolutions. - Added the Ctrl+N shortcut who was advertised but not working. - Gold is now updated after training. - If not using special messages, a "Move Party" node won't mess with talking responses anymore. - Affect Gold/Food nodes could give more gold/food than the maximum allowed. Fixed. - Deleted a check that was destroying items with "type Flag" 15 first. - Calling add_string_to_buf() with an empty string now does nothing. Classic Scenario Editor version 1.0 : - Added a switch to the Scenario Details to bypass the automatic difficulty adjust - Added the ability to play sound asynchronously (use -sound_number instead of sound_number). - If a custom monster pic was shown in the monster dialog and a non-custom monster was loaded via the arrows, the pic was always drawn from the custom sheet. Fixed. - Cancelling while choosing an item ability won't reset the item ability to "No ability" anymore. - Added a "Change Town Lightning" node. (StarEye a.k.a *i) - Loading a town in the main menu won't get into editing mode automatically anymore. - Added an option in the Town Advanced details to prevent the mapping (like in older Exiles). - Added a "Display picture" node, that living up to its name, displays a picture. Bitmaps (BMP) are the only supported format but image can be of any size (be warned that if the image is larger/wider than the screen, it will be streched to fit, meaning a (potentially substancial) loss of quality). The name of the file is search in the scenario special strings (160 to 259) as specified in the node ex1a field. The format must be "[eventual path]filename.bmp". The base search folder is "[folder_the_scenario_is_in]/scenario_name.exr/". - Corrected the "Type Flag" description text (is between 0 and 255). - Modified the "Has Enough Mage Lore?" node into a general statistic check node. (StarEye a.k.a *i) Here is a description of fields : ex1a: how much of skill ex1b: special to call if enough ex2a: skill index (-1 defaults to mage lore to preserve compatibility) 0 - 18 corresponding skill, 19 - Current Health, 20 - Max Health, 21 - Current Spell Points, 22 - Max Spell Points, 23 - Experience, 24 - Skill points, 25 - Level. ex2b: 0, others - cumulative, 1 - highest, 2 - average, 3 - lowest, 10 + x - that PC. (-1 defaults to mage lore to preserve compatibility) - Added a "Has enough species ?" node, which checks if the party has (at least) a specified number of character with a given race. (StarEye a.k.a *i) - Modified the "Give ... spells" nodes to either take (spec.1b = 0) or give (spec.1b = 1) spells and have access to low level spells (spec.1a = 100 + spell_number, with 0 <= spell_number <= 29 ) (StarEye a.k.a *i) - Added an option in Town Advanced Details to prevent Magic Mapping from being cast (already included in the Map Unavailable option). - Added an option in Town Advanced Details that specifies a town special to call if the town becomes hostile (for compatibility reasons the special 0 can't be called in legacy scenarios). - Added a "Change Creature Attitude" node in Town specs : spec.ex1a is the number of the monster in the current town and ex.1b is the attitude to set it to (0 - Friendly, Docile, 1 - Hostile, Type A, 2 - Friendly, Will fight, 3 - Hostile, Type B). - Modified the "Make town hostile" node to "Set Town Attitude". Spec.ex1a is 0 for hostile, 1 for friendly. The dead part (2) is currently non functionnal. Classic Character Editor version 1.1 : - The party is in info bar has been extended an placed under the main window (now that subfolders can used, the scen_name can be pretty long) - In Edit skill, you could decrease health and spell points to negative values. Fixed. Chokboyz git-svn-id: http://openexile.googlecode.com/svn/trunk@113 4ebdad44-0ea0-11de-aab3-ff745001d230
478 lines
11 KiB
C++
478 lines
11 KiB
C++
#ifndef _GLOBAL_H
|
|
#define _GLOBAL_H
|
|
|
|
#include <windows.h>
|
|
#include <stdio.h> /* for sprintf */
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
|
|
#include "consts.h"
|
|
#include "item.h"
|
|
#include "location.h"
|
|
#include "pc.h"
|
|
|
|
#define huge
|
|
|
|
|
|
|
|
/*GK+*/
|
|
typedef unsigned char BYTE;
|
|
|
|
POINT MAKEPOINT(LONG lparam);
|
|
extern HINSTANCE store_hInstance;
|
|
void DebugQuit(char * msg);
|
|
|
|
struct RECT16
|
|
{
|
|
short left;
|
|
short top;
|
|
short right;
|
|
short bottom;
|
|
|
|
RECT rect32();
|
|
RECT16 () {}
|
|
RECT16 (const RECT & );
|
|
RECT16 & operator=(const RECT &);
|
|
};
|
|
|
|
#define T_M 60
|
|
|
|
#define NUM_TOWN_ITEMS 115
|
|
|
|
#define BITMAP_WIDTH 28
|
|
#define BITMAP_HEIGHT 36
|
|
|
|
#define PC_WIN_UL_X 291
|
|
#define PC_WIN_UL_Y 5
|
|
#define ITEM_WIN_UL_X 291
|
|
#define ITEM_WIN_UL_Y 130
|
|
#define TEXT_WIN_UL_X 291
|
|
#define TEXT_WIN_UL_Y 283
|
|
#define NUM_BUTTONS 15
|
|
#define ASB add_string_to_buf
|
|
#define PSD party.stuff_done
|
|
#define FCD fancy_choice_dialog
|
|
#define NUM_MONST_G 173
|
|
|
|
typedef char Boolean;
|
|
|
|
struct shortloc { short x, y; };
|
|
|
|
struct special_node_type
|
|
{
|
|
short type,sd1,sd2,pic,m1,m2,ex1a,ex1b,ex2a,ex2b,jumpto;
|
|
|
|
void flip(); /* reverse byte order */
|
|
};
|
|
|
|
typedef struct {
|
|
short personality,type;
|
|
char link1[4],link2[4];
|
|
short extras[4];
|
|
} talking_node_type;
|
|
|
|
typedef struct {
|
|
unsigned char strlens[200];
|
|
talking_node_type talk_nodes[60];
|
|
} talking_record_type;
|
|
|
|
typedef struct {
|
|
short picture;
|
|
unsigned char blockage,flag1,flag2,special,trans_to_what,fly_over,boat_over;
|
|
unsigned char block_horse,light_radius,step_sound,shortcut_key,res1,res2,res3;
|
|
} terrain_type_type;
|
|
|
|
struct wandering_type
|
|
{
|
|
unsigned char monst[4];
|
|
|
|
bool isNull() const;
|
|
};
|
|
|
|
struct out_wandering_type
|
|
{
|
|
unsigned char monst[7];
|
|
unsigned char friendly[3];
|
|
short spec_on_meet,spec_on_win,spec_on_flee,cant_flee;
|
|
short end_spec1,end_spec2;
|
|
|
|
bool isNull() const;
|
|
};
|
|
|
|
struct outdoor_record_type
|
|
{
|
|
unsigned char terrain[48][48];
|
|
location special_locs[18];
|
|
unsigned char special_id[18];
|
|
location exit_locs[8];
|
|
char exit_dests[8];
|
|
location sign_locs[8];
|
|
out_wandering_type wandering[4],special_enc[4];
|
|
location wandering_locs[4];
|
|
RECT16 info_rect[8];
|
|
unsigned char strlens[180];
|
|
special_node_type specials[60];
|
|
|
|
void flip(); /* reverse byte order */
|
|
};
|
|
|
|
typedef struct {
|
|
unsigned char number;
|
|
unsigned char start_attitude;
|
|
location start_loc;
|
|
unsigned char mobile;
|
|
unsigned char time_flag;
|
|
unsigned char extra1,extra2;
|
|
short spec1, spec2;
|
|
char spec_enc_code, time_code;
|
|
short monster_time,personality;
|
|
short special_on_kill,facial_pic;
|
|
} creature_start_type;
|
|
|
|
typedef struct {
|
|
location item_loc;
|
|
short item_code,ability;
|
|
unsigned char charges,always_there,property,contained;
|
|
} preset_item_type;
|
|
|
|
typedef struct {
|
|
location field_loc;
|
|
short field_type;
|
|
} preset_field_type;
|
|
|
|
struct town_record_type
|
|
{
|
|
short town_chop_time,town_chop_key;
|
|
wandering_type wandering[4];
|
|
location wandering_locs[4];
|
|
location special_locs[50];
|
|
unsigned char spec_id[50];
|
|
location sign_locs[15];
|
|
short lighting;
|
|
location start_locs[4];
|
|
location exit_locs[4];
|
|
short exit_specs[4];
|
|
RECT16 in_town_rect;
|
|
preset_item_type preset_items[64];
|
|
short max_num_monst;
|
|
preset_field_type preset_fields[50];
|
|
short spec_on_entry,spec_on_entry_if_dead;
|
|
short timer_spec_times[8];
|
|
short timer_specs[8];
|
|
unsigned char strlens[180];
|
|
special_node_type specials[100];
|
|
unsigned char defy_mapping,defy_scrying;
|
|
char hostile_spec_to_call,res2;
|
|
/* bool strong_barriers : 1;
|
|
bool defy_mapping : 1;
|
|
char reserved_bits : 6;*/
|
|
short difficulty;
|
|
|
|
/* functions */
|
|
location getSpecLoc(int spec);
|
|
};
|
|
|
|
struct big_tr_type
|
|
{
|
|
unsigned char terrain[64][64];
|
|
RECT16 room_rect[16];
|
|
creature_start_type creatures[60];
|
|
unsigned char lighting[8][64];
|
|
};
|
|
|
|
typedef struct {
|
|
unsigned char terrain[48][48];
|
|
RECT16 room_rect[16];
|
|
creature_start_type creatures[40];
|
|
unsigned char lighting[6][48];
|
|
} ave_tr_type;
|
|
|
|
typedef struct {
|
|
unsigned char terrain[32][32];
|
|
RECT16 room_rect[16];
|
|
creature_start_type creatures[30];
|
|
unsigned char lighting[4][32];
|
|
} tiny_tr_type;
|
|
|
|
typedef struct {
|
|
item_record_type scen_items[400];
|
|
char monst_names[256][20];
|
|
char ter_names[256][30];
|
|
} scen_item_data_type;
|
|
|
|
typedef struct {
|
|
short ter_type,item_num[10],item_odds[10],property;
|
|
} item_storage_shortcut_type;
|
|
|
|
typedef struct {
|
|
unsigned char m_num,level,m_name[26];
|
|
short health,m_health,mp,max_mp;
|
|
unsigned char armor,skill;
|
|
short a[3];
|
|
unsigned char a1_type,a23_type,m_type,speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison;
|
|
short morale,m_morale;
|
|
short corpse_item,corpse_item_chance;
|
|
short status[15];
|
|
unsigned char direction,immunities,x_width,y_width,radiate_1,radiate_2;
|
|
unsigned char default_attitude,summon_type,default_facial_pic,res1,res2,res3;
|
|
short picture_num;
|
|
} monster_record_type;
|
|
|
|
/* CREATURE_DATA_TYPE */
|
|
class creature_data_type
|
|
{
|
|
/* variables */
|
|
public:
|
|
short active,attitude;
|
|
unsigned char number;
|
|
location m_loc;
|
|
monster_record_type m_d;
|
|
Boolean mobile;
|
|
short summoned;
|
|
creature_start_type monst_start;
|
|
|
|
/* functions */
|
|
private:
|
|
void adjustMagic(short *how_much);
|
|
public:
|
|
void poison(short how_much);
|
|
void acid(short how_much);
|
|
void slow(short how_much);
|
|
void curse(short how_much);
|
|
void web(short how_much);
|
|
void scare(short how_much);
|
|
void disease(short how_much);
|
|
void dumbfound(short how_much);
|
|
void charm(short penalty, short which_status, short amount);
|
|
void record();
|
|
};
|
|
|
|
typedef struct {
|
|
location horse_loc,horse_loc_in_sec,horse_sector;
|
|
short which_town;
|
|
Boolean exists,property;
|
|
} horse_record_type;
|
|
|
|
typedef struct {
|
|
location boat_loc,boat_loc_in_sec,boat_sector;
|
|
short which_town;
|
|
Boolean exists,property;
|
|
} boat_record_type;
|
|
|
|
typedef struct {
|
|
unsigned char flag1, flag2, flag3, flag4;
|
|
unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns;
|
|
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
|
|
} scen_header_type;
|
|
|
|
typedef struct {
|
|
unsigned char flag1, flag2, flag3, flag4;
|
|
unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns;
|
|
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
|
|
unsigned char town_size[200];
|
|
unsigned char town_hidden[200],a;
|
|
short flag_a;
|
|
short intro_mess_pic,intro_mess_len;
|
|
location where_start,out_sec_start,out_start;
|
|
short which_town_start;
|
|
short flag_b;
|
|
short town_data_size[200][5];
|
|
short town_to_add_to[10];
|
|
short flag_to_add_to_town[10][2];
|
|
short flag_c;
|
|
short out_data_size[100][2];
|
|
RECT16 store_item_rects[3];
|
|
short store_item_towns[3];
|
|
short flag_e;
|
|
short special_items[50];
|
|
short special_item_special[50];
|
|
short rating,uses_custom_graphics;
|
|
short flag_f;
|
|
monster_record_type scen_monsters[256];
|
|
boat_record_type scen_boats[30];
|
|
horse_record_type scen_horses[30];
|
|
short flag_g;
|
|
terrain_type_type ter_types[256];
|
|
short scenario_timer_times[20];
|
|
short scenario_timer_specs[20];
|
|
short flag_h;
|
|
special_node_type scen_specials[256];
|
|
item_storage_shortcut_type storage_shortcuts[10];
|
|
short flag_d;
|
|
unsigned char scen_str_len[300];
|
|
// short flag_i;
|
|
short adjust_diff;
|
|
location last_out_edited;
|
|
short last_town_edited;
|
|
} scenario_data_type;
|
|
|
|
// for game
|
|
typedef struct {
|
|
short personality;
|
|
short town_num;
|
|
short str1,str2;
|
|
} talk_save_type;
|
|
|
|
typedef struct {
|
|
creature_data_type dudes[60];
|
|
short which_town;
|
|
short friendly;
|
|
} creature_list_type;
|
|
|
|
struct current_town_type
|
|
{
|
|
short town_num, difficulty;
|
|
town_record_type town;
|
|
char explored[64][64];
|
|
Boolean hostile;
|
|
creature_list_type monst;
|
|
Boolean in_boat;
|
|
location p_loc;
|
|
|
|
/* functions */
|
|
short placeMonster(unsigned char which, location where);
|
|
short countMonsters();
|
|
void activateMonsters(short code);
|
|
};
|
|
|
|
struct outdoor_creature_type
|
|
{
|
|
Boolean exists;
|
|
short direction;
|
|
out_wandering_type what_monst;
|
|
location which_sector,m_loc;
|
|
};
|
|
|
|
struct party_record_type
|
|
{
|
|
long age;
|
|
unsigned short gold,food;
|
|
unsigned char stuff_done[310][10],item_taken[200][8]; //stuff_done[309] is compatibility switches
|
|
short light_level;
|
|
location outdoor_corner,i_w_c,p_loc,loc_in_sec;
|
|
boat_record_type boats[30];
|
|
horse_record_type horses[30];
|
|
creature_list_type creature_save[4];
|
|
short in_boat,in_horse;
|
|
outdoor_creature_type out_c[10];
|
|
item_record_type magic_store_items[5][10];
|
|
short imprisoned_monst[4];
|
|
char m_seen[256];
|
|
char journal_str[50];
|
|
short journal_day[50];
|
|
short special_notes_str[140][2];
|
|
talk_save_type talk_save[120];
|
|
short direction,at_which_save_slot;
|
|
char alchemy[20];
|
|
Boolean can_find_town[200];
|
|
short key_times[100];
|
|
short party_event_timers[30];
|
|
short global_or_town[30];
|
|
short node_to_call[30];
|
|
char spec_items[50],help_received[120];
|
|
short m_killed[200];
|
|
unsigned long total_m_killed,total_dam_done,total_xp_gained,total_dam_taken;
|
|
char scen_name[256];
|
|
|
|
/* functions */
|
|
bool isFlying() { return (bool) stuff_done[305][1]; }
|
|
|
|
void giveGold(short amount, bool print_result);
|
|
bool takeGold(short amount, bool print_result);
|
|
void giveFood(short amount, bool print_result);
|
|
short takeFood(short amount, bool print_result);
|
|
};
|
|
|
|
typedef struct { char town_maps[200][8][64]; } stored_town_maps_type;
|
|
typedef struct { char town_strs[180][256]; } piles_of_stuff_dumping_type;
|
|
|
|
typedef struct {
|
|
char scen_header_strs[3][80];
|
|
char scen_names[256];
|
|
} piles_of_stuff_dumping_type2;
|
|
|
|
typedef struct { char talk_strs[170][256]; } piles_of_stuff_dumping_type3;
|
|
typedef struct { char out_strs[9][256]; } outdoor_strs_type;
|
|
typedef struct { outdoor_strs_type outdoor_text[2][2]; } piles_of_stuff_dumping_type4;
|
|
typedef struct { char scen_strs[160][256]; } piles_of_stuff_dumping_type5;
|
|
|
|
class pc_array
|
|
{
|
|
private:
|
|
//pc_record_type pc[6];
|
|
pc_record_type pc[NUM_OF_PCS];
|
|
|
|
public:
|
|
pc_record_type & operator[](int num) { return pc[num]; }
|
|
|
|
/* remember - all this functions refer to all PCs */
|
|
void affect(short type, short how_much);
|
|
void cure(short how_much); /* cure all */
|
|
void disease(short how_much); /* disease all */
|
|
void dumbfound(short how_much); /* dumb all */
|
|
void damage(short how_much, short damage_type); /* damage all */
|
|
void heal(short how_much); /* heal all */
|
|
void kill(short mode); /* kill all */
|
|
void poison(short how_much); /* poison all */
|
|
|
|
void drainXP(short how_much); // drain experience points
|
|
|
|
void giveXP(short how_much); // give experience points
|
|
|
|
void restoreSP(short how_much); // restore spell points
|
|
|
|
bool hasAbil(short ability);
|
|
|
|
bool isPoisoned(); /* is someone posioned? */
|
|
|
|
short getMageLore(); /* count total mage lore */
|
|
short getTotalLevel();
|
|
short getTotalLuck();
|
|
|
|
bool checkClass(short item_class,short mode);
|
|
};
|
|
|
|
typedef struct { unsigned char setup[4][64][64]; } setup_save_type;
|
|
typedef struct { unsigned char pattern[9][9]; } effect_pat_type;
|
|
typedef struct { item_record_type items[NUM_TOWN_ITEMS]; } stored_items_list;
|
|
typedef struct { char outdoor_maps[100][6][48]; } stored_outdoor_maps_type;
|
|
|
|
short s_pow(short x,short y);
|
|
short get_ran (short times, short min, short max);
|
|
Boolean same_point(location p1,location p2);
|
|
void pause(short length);
|
|
void Delay(short val,long *dummy);
|
|
void alter_rect(RECT *r) ;
|
|
void alter_rect(RECT16 *r) ;
|
|
Boolean sd_legit(short a, short b);
|
|
|
|
template <class T>
|
|
T minmax(T min, T max, T k)
|
|
{
|
|
return (k < min)? min : (k > max)? max : k;
|
|
};
|
|
|
|
template <class T>
|
|
T ex_abs(T value)
|
|
{
|
|
return (value < 0)? (-value) : value;
|
|
};
|
|
|
|
template <class T>
|
|
void move_to_zero(T & value)
|
|
{
|
|
if (value > 0) --value;
|
|
else if (value < 0) ++value;
|
|
};
|
|
|
|
typedef struct {
|
|
|
|
short queued_special;
|
|
long trigger_time;
|
|
unsigned short mode;
|
|
unsigned char type; // 0 - scen, 1 - out, 2 - town
|
|
location where;
|
|
}pending_special_type;
|
|
|
|
#endif
|