- Merged two classes (cPopulation::cCreature and cTown::cCreature)

- Changes some C-strings to STL-strings
- Fixed the problem where the spiderweb logo would not fully appear if ShowStartupSplash is disabled

git-svn-id: http://openexile.googlecode.com/svn/trunk@54 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-07 02:50:16 +00:00
parent 68dcf3cdef
commit 4dc75d51c0
46 changed files with 932 additions and 831 deletions

View File

@@ -9,20 +9,6 @@
#include "classes.h"
#include "oldstructs.h"
__attribute__((deprecated))
cPopulation::cCreature& cPopulation::cCreature::operator = (legacy::creature_data_type old){
active = old.active;
attitude = old.attitude;
number = old.number;
m_loc.x = old.m_loc.x;
m_loc.y = old.m_loc.y;
m_d = old.m_d;
mobile = old.mobile;
summoned = old.summoned;
monst_start = old.monst_start;
return *this;
}
__attribute__((deprecated))
cPopulation& cPopulation::operator = (legacy::creature_list_type old){
for(int i = 0; i < 60; i++)

View File

@@ -13,18 +13,18 @@ namespace legacy {
class cPopulation { // formerly creature_list_type
public:
class cCreature { // formerly creature_data_type
public:
short active, attitude;
unsigned char number;
location m_loc;
cMonster m_d;
bool mobile;
short summoned;
cTown::cCreature monst_start;
cCreature& operator = (legacy::creature_data_type old);
};
// class cCreature { // formerly creature_data_type
// public:
// short active, attitude;
// unsigned char number;
// location m_loc;
// cMonster m_d;
// bool mobile;
// short summoned;
// cTown::cCreature monst_start;
//
// cCreature& operator = (legacy::creature_data_type old);
// };
cCreature dudes[60];
short which_town;
short friendly;

View File

@@ -118,8 +118,8 @@ cItemRec::cItemRec(){
special_class = 0;
item_loc.x = 0;
item_loc.y = 0;
strcpy(full_name,"");
strcpy(name,"");
full_name = "";
name = "";
treas_class = 0;
item_properties = 0;
reserved1 = 0;
@@ -150,8 +150,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 45;
value = 2;
weight = 7;
strcpy(full_name,"Bronze Knife");
strcpy(name,"Knife");
full_name = "Bronze Knife";
name = "Knife";
set_ident(true);
break;
case 'buck':
@@ -166,8 +166,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 65;
value = 2;
weight = 20;
strcpy(full_name,"Crude Buckler");
strcpy(name,"Buckler");
full_name = "Crude Buckler";
name = "Buckler";
set_ident(true);
break;
case 'bow ':
@@ -182,8 +182,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 10;
value = 15;
weight = 20;
strcpy(full_name,"Cavewood Bow");
strcpy(name,"Bow");
full_name = "Cavewood Bow";
name = "Bow";
set_ident(true);
break;
case 'arrw':
@@ -198,8 +198,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 47;
value = 1;
weight = 1;
strcpy(full_name,"Arrows");
strcpy(name,"Arrows");
full_name = "Arrows";
name = "Arrows";
set_ident(true);
break;
case 'pole':
@@ -214,8 +214,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 4;
value = 10;
weight = 20;
strcpy(full_name,"Stone Spear");
strcpy(name,"Spear");
full_name = "Stone Spear";
name = "Spear";
set_ident(true);
break;
case 'helm':
@@ -230,8 +230,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 66;
value = 6;
weight = 15;
strcpy(full_name,"Leather Helm");
strcpy(name,"Helm");
full_name = "Leather Helm";
name = "Helm";
set_ident(true);
break;
case 'food':
@@ -246,8 +246,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 62;
value = 0;
weight = 0;
strcpy(full_name,"Food");
strcpy(name,"Food");
full_name = "Food";
name = "Food";
set_ident(false);
break;
case 'spel':
@@ -262,8 +262,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 53;
value = 0;
weight = 0;
strcpy(full_name,"");
strcpy(name,"");
full_name = "";
name = "";
set_ident(false);
break;
case 'alch':
@@ -278,8 +278,8 @@ cItemRec::cItemRec(long preset){
graphic_num = 50;
value = 0;
weight = 8;
strcpy(full_name,"Potion");
strcpy(name,"Potion");
full_name = "Potion";
name = "Potion";
set_ident(false);
set_magic(true);
break;
@@ -310,8 +310,8 @@ cItemRec& cItemRec::operator = (legacy::item_record_type& old){
special_class = old.special_class;
item_loc.x = old.item_loc.x;
item_loc.y = old.item_loc.y;
strcpy(full_name,old.full_name);
strcpy(name,old.name);
full_name = old.full_name;
name = old.name;
treas_class = old.treas_class;
item_properties = old.item_properties;
reserved1 = old.reserved1;
@@ -369,10 +369,10 @@ void cItemRec::readAttrFrom(string cur, istream& sin){
else if(cur == "AT") sin >> item_loc.x >> item_loc.y;
else if(cur == "FULLNAME"){
getline(sin,cur);
strcpy(full_name,cur.c_str());
full_name = cur;
}else if(cur == "NAME"){
getline(sin,cur);
strcpy(name,cur.c_str());
name = cur;
}
else if(cur == "TREASURE") sin >> treas_class;
else if(cur == "IDENTIFIED") set_ident(true);

View File

@@ -201,8 +201,8 @@ public:
unsigned char weight;
unsigned char special_class;
location item_loc;
char full_name[25];
char name[15];
string full_name;
string name;
unsigned char treas_class;
unsigned char item_properties;
private:

View File

@@ -14,7 +14,7 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
int i;
m_num = old.m_num;
level = old.level;
strcpy((char*)m_name,(char*)old.m_name);
//m_name = old.m_name;
health = old.health;
m_health = old.m_health;
mp = old.mp;
@@ -54,3 +54,65 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
picture_num = old.picture_num;
return *this;
}
cCreature::cCreature(){
// short personality;
// short special_on_kill,facial_pic;
//{-1,-1,-1}
id = number = active = attitude = start_attitude = 0;
start_loc.x = start_loc.y = cur_loc.x = cur_loc.y = targ_loc.x = targ_loc.y = 80;
mobility = 1;
time_flag = summoned = extra1 = extra2 = 0;
spec1 = spec2 = spec_enc_code = time_code = monster_time = 0;
personality = special_on_kill = facial_pic = -1;
target = 6;
}
cCreature& cCreature::operator = (legacy::creature_start_type old){
number = old.number;
start_attitude = old.start_attitude;
start_loc.x = old.start_loc.x;
start_loc.y = old.start_loc.y;
mobility = old.mobile;
time_flag = old.time_flag;
extra1 = old.extra1;
extra2 = old.extra2;
spec1 = old.spec1;
spec2 = old.spec2;
spec_enc_code = old.spec_enc_code;
time_code = old.time_code;
monster_time = old.monster_time;
personality = old.personality;
special_on_kill = old.special_on_kill;
facial_pic = old.facial_pic;
return *this;
}
__attribute__((deprecated))
cCreature& cCreature::operator = (legacy::creature_data_type old){
active = old.active;
attitude = old.attitude;
number = old.number;
cur_loc.x = old.m_loc.x;
cur_loc.y = old.m_loc.y;
m_d = old.m_d;
mobility = old.mobile;
summoned = old.summoned;
number = old.monst_start.number;
start_attitude = old.monst_start.start_attitude;
start_loc.x = old.monst_start.start_loc.x;
start_loc.y = old.monst_start.start_loc.y;
mobility = old.monst_start.mobile;
time_flag = old.monst_start.time_flag;
extra1 = old.monst_start.extra1;
extra2 = old.monst_start.extra2;
spec1 = old.monst_start.spec1;
spec2 = old.monst_start.spec2;
spec_enc_code = old.monst_start.spec_enc_code;
time_code = old.monst_start.time_code;
monster_time = old.monst_start.monster_time;
personality = old.monst_start.personality;
special_on_kill = old.monst_start.special_on_kill;
facial_pic = old.monst_start.facial_pic;
return *this;
}

View File

@@ -6,7 +6,11 @@
*
*/
namespace legacy { struct monster_record_type; };
namespace legacy {
struct monster_record_type;
struct creature_data_type;
struct creature_start_type;
};
/* Monsters Stuff */
/* Skills Same as PC */
@@ -103,7 +107,8 @@ enum eMonsterType {
class cMonster {
public:
unsigned char m_num,level,m_name[26];
unsigned char m_num,level;
string m_name;
short health,m_health,mp,max_mp;
unsigned char armor,skill;
short a[3];
@@ -120,3 +125,28 @@ public:
cMonster& operator = (legacy::monster_record_type& old);
void writeTo(ostream& file, string prefix);
};
class cCreature {
public:
cMonster m_d;
unsigned long id;
unsigned short number;
short active, attitude;
unsigned char start_attitude;
location start_loc, cur_loc;
unsigned char mobility; // Was a bool, but am making it a char to allow for additional mobility states
unsigned char time_flag;
short summoned;
unsigned char extra1, extra2;
short spec1, spec2;
char spec_enc_code, time_code;
short monster_time, personality;
short special_on_kill, facial_pic;
short target;
location targ_loc;
cCreature();
cCreature& operator = (legacy::creature_data_type old);
cCreature& operator = (legacy::creature_start_type old);
};

View File

@@ -13,7 +13,7 @@ __attribute__((deprecated))
cPlayer& cPlayer::operator = (legacy::pc_record_type old){
int i;
main_status = (eMainStatus) old.main_status;
strcpy(name,old.name);
name = old.name;
for(i = 0; i < 20; i++)
skills[i] = old.skills[i];
max_health = old.max_health;
@@ -62,7 +62,7 @@ short cPlayer::get_tnl(){
cPlayer::cPlayer(){
short i;
main_status = MAIN_STATUS_ABSENT;
sprintf ((char *) name, "\n");
name = "\n";
for (i = 0; i < 30; i++)
skills[i] = (i < 3) ? 1 : 0;
@@ -102,22 +102,22 @@ cPlayer::cPlayer(long key,short slot){
if(key == 'dbug'){
switch (slot) {
case 0:
sprintf ((char *) name, "Gunther");
name = "Gunther";
break;
case 1:
sprintf ((char *) name, "Yanni");
name = "Yanni";
break;
case 2:
sprintf ((char *) name, "Mandolin");
name = "Mandolin";
break;
case 3:
sprintf ((char *) name, "Pete");
name = "Pete";
break;
case 4:
sprintf ((char *) name, "Vraiment");
name = "Vraiment";
break;
case 5:
sprintf ((char *) name, "Goo");
name = "Goo";
break;
}
for (i = 0; i < 30; i++)
@@ -177,22 +177,22 @@ cPlayer::cPlayer(long key,short slot){
main_status = MAIN_STATUS_ALIVE;
switch (slot) {
case 0:
sprintf ((char *) name, "Jenneke");
name = "Jenneke";
break;
case 1:
sprintf ((char *) name, "Thissa");
name = "Thissa";
break;
case 2:
sprintf ((char *) name, "Frrrrrr");
name = "Frrrrrr";
break;
case 3:
sprintf ((char *) name, "Adrianna");
name = "Adrianna";
break;
case 4:
sprintf ((char *) name, "Feodoric");
name = "Feodoric";
break;
case 5:
sprintf ((char *) name, "Michael");
name = "Michael";
break;
}

View File

@@ -33,7 +33,7 @@ enum eMainStatus {
class cPlayer {
public:
eMainStatus main_status;
char name[20];
string name;
short skills[30];
unsigned short max_health;
short cur_health;
@@ -54,6 +54,7 @@ public:
short race;
//short exp_adj;
short direction;
short ap;
cPlayer& operator = (legacy::pc_record_type old);
cPlayer();

View File

@@ -122,7 +122,7 @@ rectangle& cTinyTown::room_rect(size_t i){
return _room_rect[i];
}
cTown::cCreature& cTinyTown::creatures(size_t i){
cCreature& cTinyTown::creatures(size_t i){
return _creatures[i];
}
@@ -138,7 +138,7 @@ rectangle& cMedTown::room_rect(size_t i){
return _room_rect[i];
}
cTown::cCreature& cMedTown::creatures(size_t i){
cCreature& cMedTown::creatures(size_t i){
return _creatures[i];
}
@@ -154,7 +154,7 @@ rectangle& cBigTown::room_rect(size_t i){
return _room_rect[i];
}
cTown::cCreature& cBigTown::creatures(size_t i){
cCreature& cBigTown::creatures(size_t i){
return _creatures[i];
}
@@ -164,7 +164,7 @@ unsigned char& cBigTown::lighting(size_t i, size_t r){
cBigTown::cBigTown(){
int i;
cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0};
cCreature dummy_creature;// = {0,0,loc(),0,0,0,0,0,0,0};
Rect d_rect = {0,0,0,0};
for (i = 0; i < 16; i++) {
_room_rect[i].top = d_rect.top;
@@ -179,7 +179,7 @@ cBigTown::cBigTown(){
cMedTown::cMedTown(){
int i;
cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0};
cCreature dummy_creature;// = {0,0,loc(),0,0,0,0,0,0,0};
Rect d_rect = {0,0,0,0};
for (i = 0; i < 16; i++) {
_room_rect[i].top = d_rect.top;
@@ -194,7 +194,7 @@ cMedTown::cMedTown(){
cTinyTown::cTinyTown(){
int i;
cCreature dummy_creature = {0,0,loc(),0,0,0,0,0,0,0};
cCreature dummy_creature;// = {0,0,loc(),0,0,0,0,0,0,0};
Rect d_rect = {0,0,0,0};
for (i = 0; i < 16; i++) {
_room_rect[i].top = d_rect.top;

View File

@@ -102,7 +102,7 @@ void cScenario::append(legacy::scen_item_data_type& old){
for(i = 0; i < 400; i++)
scen_items[i] = old.scen_items[i];
for(i = 0; i < 256; i++)
strcpy((char*)scen_monsters[i].m_name,(char*)old.monst_names[i]);
scen_monsters[i].m_name = old.monst_names[i];
for(i = 0; i < 256; i++)
ter_types[i].name = old.ter_names[i];
}

View File

@@ -16,7 +16,7 @@ rectangle& cBigTemplTown::room_rect(size_t i){
return _room_rect[i];
}
cTown::cCreature& cBigTemplTown::creatures(size_t i){
cCreature& cBigTemplTown::creatures(size_t i){
return _creatures[i];
}

View File

@@ -151,26 +151,6 @@ char(& cTown::town_strs(short i))[256]{
return comment[1]; // random unused string
}
cTown::cCreature& cTown::cCreature::operator = (legacy::creature_start_type old){
number = old.number;
start_attitude = old.start_attitude;
start_loc.x = old.start_loc.x;
start_loc.y = old.start_loc.y;
mobile = old.mobile;
time_flag = old.time_flag;
extra1 = old.extra1;
extra2 = old.extra2;
spec1 = old.spec1;
spec2 = old.spec2;
spec_enc_code = old.spec_enc_code;
time_code = old.time_code;
monster_time = old.monster_time;
personality = old.personality;
special_on_kill = old.special_on_kill;
facial_pic = old.facial_pic;
return *this;
}
cTown::cWandering& cTown::cWandering::operator = (legacy::wandering_type old){
monst[0] = old.monst[0];
monst[1] = old.monst[1];

View File

@@ -19,21 +19,21 @@ namespace legacy {
class cTown { // formerly town_record_type
public:
class cCreature { // formerly creature_start_type
public:
unsigned short 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;
cCreature& operator = (legacy::creature_start_type old);
};
// class cCreature { // formerly creature_start_type
// public:
// unsigned short 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;
//
// cCreature& operator = (legacy::creature_start_type old);
// };
class cWandering { // formerly wandering_type
public:
unsigned char monst[4];