Adds give text
This commit is contained in:
parent
84316be6da
commit
43303995e0
|
@ -0,0 +1,54 @@
|
|||
#include "types.h"
|
||||
|
||||
typedef enum AILMENT
|
||||
{
|
||||
CONSCIOUS = 0,
|
||||
UNCONSCIOUS = 1,
|
||||
DIAMONDIZED = 2,
|
||||
PARALYZED = 3,
|
||||
NAUSEOUS = 4,
|
||||
POISONED = 5,
|
||||
SUNSTROKE = 6,
|
||||
SNIFFLING = 7,
|
||||
MASHROOMIZED = 8,
|
||||
POSSESSED = 9,
|
||||
HOMESICK = 0xA,
|
||||
} AILMENT;
|
||||
|
||||
typedef struct CHARACTER_DATA {
|
||||
// 0x00
|
||||
unsigned short inventory[14];
|
||||
//0x1C
|
||||
unsigned int experience;
|
||||
byte unknown[0xC];
|
||||
unsigned int level;
|
||||
unsigned short maxHp;
|
||||
unsigned short currentHp;
|
||||
unsigned short unknown2;
|
||||
unsigned short scrollingHp;
|
||||
unsigned short maxPp;
|
||||
unsigned short currentPp;
|
||||
unsigned short unknown3;
|
||||
unsigned short scrollingPp;
|
||||
AILMENT ailment;
|
||||
byte flag[5];
|
||||
byte unknown4[2];
|
||||
byte base_atk;
|
||||
byte base_def;
|
||||
byte base_speed;
|
||||
byte base_guts;
|
||||
byte base_luck;
|
||||
byte base_vitality;
|
||||
byte base_iq;
|
||||
byte atk;
|
||||
byte def;
|
||||
byte speed;
|
||||
byte guts;
|
||||
byte luck;
|
||||
byte vitality;
|
||||
byte iq;
|
||||
byte unknown5[0xB];
|
||||
byte equipment[4];
|
||||
byte unknown6[0x7];
|
||||
} CHARACTER_DATA;
|
||||
|
518
src/c/goods.c
518
src/c/goods.c
|
@ -550,3 +550,521 @@ void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int it
|
|||
}
|
||||
}
|
||||
|
||||
//Load proper give text into str and then go to it
|
||||
//It's based on the party's status, whether the target's inventory is full or not and whether the source is the target
|
||||
void give_print(byte item, byte target, byte source, WINDOW *window, byte *str)
|
||||
{
|
||||
bool notFullInventory = false;
|
||||
int index;
|
||||
struct CHARACTER_DATA *user_data = (&m2_ness_data[source]);
|
||||
struct CHARACTER_DATA *target_data = (&m2_ness_data[target]);
|
||||
bool incapable_user = false;
|
||||
bool incapable_target = false;
|
||||
|
||||
for(index = 0; index < 0xE; index++)
|
||||
if(target_data->inventory[index] == 0)
|
||||
{
|
||||
notFullInventory = true;
|
||||
break;
|
||||
}
|
||||
if((user_data->ailment == UNCONSCIOUS) ||(user_data->ailment == DIAMONDIZED))
|
||||
incapable_user = true;
|
||||
if((target_data->ailment == UNCONSCIOUS) ||(target_data->ailment == DIAMONDIZED))
|
||||
incapable_target = true;
|
||||
index = 0;
|
||||
if(source == target)
|
||||
{
|
||||
if(incapable_user)
|
||||
setupSelf_Dead(str, &index, source, item);
|
||||
else
|
||||
setupSelf_Alive(str, &index, source, item);
|
||||
}
|
||||
else if(!notFullInventory)
|
||||
{
|
||||
if(!incapable_target && !incapable_user)
|
||||
setupFull_Both_Alive(str, &index, source, target, item);
|
||||
else if(incapable_target && incapable_user)
|
||||
setupFull_Both_Dead(str, &index, source, target, item);
|
||||
else if(incapable_target && !incapable_user)
|
||||
setupFull_Target_Dead(str, &index, source, target, item);
|
||||
else
|
||||
setupFull_User_Dead(str, &index, source, target, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!incapable_target && !incapable_user)
|
||||
setup_Both_Alive(str, &index, source, target, item);
|
||||
else if(incapable_target && !incapable_user)
|
||||
setup_Target_Dead(str, &index, source, target, item);
|
||||
else if(!incapable_target && incapable_user)
|
||||
setup_User_Dead(str, &index, source, target, item);
|
||||
else
|
||||
setup_Both_Dead(str, &index, source, target, item);
|
||||
}
|
||||
str[index++] = 0x1D;
|
||||
str[index++] = 0xFF; //END
|
||||
str[index++] = 0;
|
||||
str[index++] = 0xFF; //END
|
||||
|
||||
window->text_start = str;
|
||||
window->text_start2 = str;
|
||||
}
|
||||
|
||||
void setupSelf_Alive(byte *String, int *index, byte user, byte item)
|
||||
{
|
||||
char rearranged[] = " rearranged ";
|
||||
char own[] = " own";
|
||||
char items[] = " items and the ";
|
||||
char moved[] = " moved.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(rearranged) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(rearranged[i]);
|
||||
|
||||
getPossessive(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(own) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(own[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(items) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(items[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
String[(*index)++] = encode_ascii(' '); //Format
|
||||
String[(*index)++] = encode_ascii(' ');
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
for (int i = 0; i < (sizeof(moved) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(moved[i]);
|
||||
}
|
||||
|
||||
void setupSelf_Dead(byte *String, int *index, byte user, byte item)
|
||||
{
|
||||
struct CHARACTER_DATA *tmp; //Get alive character
|
||||
byte alive = 0;
|
||||
while((alive == user))
|
||||
alive++;
|
||||
for(int i = alive; i < 4; i++)
|
||||
{
|
||||
tmp = &(m2_ness_data[i]);
|
||||
if((tmp->ailment != UNCONSCIOUS) && (tmp->ailment != DIAMONDIZED))
|
||||
{
|
||||
alive = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char rearranged[] = " rearranged";
|
||||
char items[] = "'s items and the";
|
||||
char moved[] = " moved.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(alive, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(rearranged) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(rearranged[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
String[(*index)++] = encode_ascii(' ');
|
||||
String[(*index)++] = encode_ascii(' '); //Format
|
||||
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(items) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(items[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
String[(*index)++] = encode_ascii(' ');
|
||||
String[(*index)++] = encode_ascii(' '); //Format
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
for (int i = 0; i < (sizeof(moved) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(moved[i]);
|
||||
}
|
||||
|
||||
void setupFull_Both_Alive(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
char tried[] = " tried to give";
|
||||
char the[] = " the ";
|
||||
char to[] = " to ";
|
||||
char but[] = "but ";
|
||||
char was[] = " was already";
|
||||
char carrying[] = " carrying too much stuff.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(tried) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(tried[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(the) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(the[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(to) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(to[i]);
|
||||
|
||||
getCharName(target, String, index);
|
||||
|
||||
String[(*index)++] = encode_ascii(',');
|
||||
|
||||
String[(*index)++] = 0x2;
|
||||
String[(*index)++] = 0xFF; //prompt + newline
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
|
||||
for (int i = 0; i < (sizeof(but) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(but[i]);
|
||||
|
||||
getPronoun(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(was) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(was[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(carrying) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(carrying[i]);
|
||||
}
|
||||
|
||||
void setupFull_Target_Dead(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
char tried[] = " tried to add";
|
||||
char the[] = " the ";
|
||||
char to[] = " to ";
|
||||
char s_stuff[]= "'s stuff,";
|
||||
char but[] = "but there was no room for it.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(tried) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(tried[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(the) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(the[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(to) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(to[i]);
|
||||
|
||||
getCharName(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_stuff[i]);
|
||||
|
||||
String[(*index)++] = 0x2;
|
||||
String[(*index)++] = 0xFF; //prompt + newline
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
|
||||
for (int i = 0; i < (sizeof(but) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(but[i]);
|
||||
}
|
||||
|
||||
void setupFull_User_Dead(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
char tried[] = " tried to take";
|
||||
char the[] = " the ";
|
||||
char from[] = " from ";
|
||||
char s_stuff[]= "'s stuff,";
|
||||
char but[] = "but ";
|
||||
char was[] = " was already";
|
||||
char carrying[] = " carrying too much stuff.";
|
||||
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(tried) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(tried[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(the) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(the[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(from) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(from[i]);
|
||||
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_stuff[i]);
|
||||
|
||||
String[(*index)++] = 0x2;
|
||||
String[(*index)++] = 0xFF; //prompt + newline
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
|
||||
for (int i = 0; i < (sizeof(but) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(but[i]);
|
||||
|
||||
getPronoun(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(was) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(was[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(carrying) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(carrying[i]);
|
||||
}
|
||||
|
||||
void setupFull_Both_Dead(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
struct CHARACTER_DATA *tmp; //Get alive character
|
||||
byte alive = 0;
|
||||
while((alive == user) || (alive == target))
|
||||
alive++;
|
||||
for(int i = alive; i < 4; i++)
|
||||
{
|
||||
tmp = &(m2_ness_data[i]);
|
||||
if((tmp->ailment != UNCONSCIOUS) && (tmp->ailment != DIAMONDIZED))
|
||||
{
|
||||
alive = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char tried[] = " tried to add";
|
||||
char s_[] = "'s ";
|
||||
char to[] = " to ";
|
||||
char s_stuff[]= "'s stuff,";
|
||||
char but[] = "but there was no room for it.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(alive, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(tried) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(tried[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
String[(*index)++] = encode_ascii(' ');
|
||||
String[(*index)++] = encode_ascii(' '); //Format
|
||||
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(to) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(to[i]);
|
||||
|
||||
getCharName(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_stuff[i]);
|
||||
|
||||
String[(*index)++] = 0x2;
|
||||
String[(*index)++] = 0xFF; //prompt + newline
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
|
||||
for (int i = 0; i < (sizeof(but) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(but[i]);
|
||||
}
|
||||
|
||||
void setup_Both_Alive(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
char gave[] = " gave";
|
||||
char the[] = " the ";
|
||||
char to[] = " to ";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(gave) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(gave[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(the) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(the[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(to) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(to[i]);
|
||||
|
||||
getCharName(target, String, index);
|
||||
|
||||
String[(*index)++] = encode_ascii('.');
|
||||
}
|
||||
|
||||
void setup_Target_Dead(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
char added[] = " added";
|
||||
char the[] = " the ";
|
||||
char to[] = " to ";
|
||||
char s_stuff[] = "'s stuff.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(added) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(added[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(the) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(the[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(to) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(to[i]);
|
||||
|
||||
getCharName(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_stuff[i]);
|
||||
}
|
||||
|
||||
void setup_User_Dead(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
char took[] = " took";
|
||||
char the[] = " the ";
|
||||
char from[] = " from ";
|
||||
char s_stuff[] = "'s stuff.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(took) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(took[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(the) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(the[i]);
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
for (int i = 0; i < (sizeof(from) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(from[i]);
|
||||
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_stuff[i]);
|
||||
}
|
||||
|
||||
void setup_Both_Dead(byte *String, int *index, byte user, byte target, byte item)
|
||||
{
|
||||
struct CHARACTER_DATA *tmp; //Get alive character
|
||||
byte alive = 0;
|
||||
while((alive == user) || (alive == target))
|
||||
alive++;
|
||||
for(int i = alive; i < 4; i++)
|
||||
{
|
||||
tmp = &(m2_ness_data[i]);
|
||||
if((tmp->ailment != UNCONSCIOUS) && (tmp->ailment != DIAMONDIZED))
|
||||
{
|
||||
alive = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char added[] = " added ";
|
||||
char _s[] = "'s";
|
||||
char to[] = " to";
|
||||
char s_stuff[] = "'s stuff.";
|
||||
|
||||
String[(*index)++] = 0x70; //Initial bullet
|
||||
getCharName(alive, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(added) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(added[i]);
|
||||
|
||||
getCharName(user, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(_s) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(_s[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
String[(*index)++] = encode_ascii(' '); //Format
|
||||
String[(*index)++] = encode_ascii(' ');
|
||||
|
||||
byte *item_str = m2_strlookup(m2_items_offsets, m2_items_strings, item);
|
||||
copy_name(String, item_str, index, 0);
|
||||
|
||||
for (int i = 0; i < (sizeof(to) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(to[i]);
|
||||
|
||||
String[(*index)++] = 1;
|
||||
String[(*index)++] = 0xFF; //newline
|
||||
|
||||
String[(*index)++] = encode_ascii(' '); //Format
|
||||
String[(*index)++] = encode_ascii(' ');
|
||||
|
||||
getCharName(target, String, index);
|
||||
|
||||
for (int i = 0; i < (sizeof(s_stuff) - 1); i++)
|
||||
String[(*index)++] = encode_ascii(s_stuff[i]);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define HEADER_GOODS_INCLUDED
|
||||
|
||||
#include "window.h"
|
||||
#include "character.h"
|
||||
#include "input.h"
|
||||
|
||||
typedef enum DIRECTION_MOVED
|
||||
|
@ -22,6 +23,17 @@ int goods_outer_process(WINDOW* window, int y_offset, bool give);
|
|||
int goods_inner_process(WINDOW *window, unsigned short *items);
|
||||
void goods_print_items(WINDOW *window, unsigned short *items, int y_offset);
|
||||
void shop_print_items(WINDOW *window, unsigned char *items, int y_offset, int itemsnum);
|
||||
void setupSelf_Alive(byte *String, int *index, byte user, byte item);
|
||||
void setupSelf_Dead(byte *String, int *index, byte user, byte item);
|
||||
void setupFull_Both_Alive(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setupFull_Target_Dead(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setupFull_User_Dead(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setupFull_Both_Dead(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setup_Both_Alive(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setup_Target_Dead(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setup_User_Dead(byte *String, int *index, byte user, byte target, byte item);
|
||||
void setup_Both_Dead(byte *String, int *index, byte user, byte target, byte item);
|
||||
void give_print(byte item, byte target, byte source, WINDOW *window, byte *str);
|
||||
|
||||
extern bool m2_isequipped(int item_index);
|
||||
extern void m2_soundeffect(int index);
|
||||
|
@ -30,6 +42,8 @@ extern int m2_sub_a334c(int value);
|
|||
extern int m2_sub_a3384(int value);
|
||||
extern void m2_clearwindowtiles(WINDOW* window);
|
||||
extern int bin_to_bcd(int value, int* digit_count);
|
||||
|
||||
extern int m2_items;
|
||||
extern CHARACTER_DATA m2_ness_data[];
|
||||
|
||||
#endif
|
||||
|
|
40
src/c/vwf.c
40
src/c/vwf.c
|
@ -52,6 +52,46 @@ byte reduce_bit_depth(int row, int foreground)
|
|||
return lower | (upper << 4);
|
||||
}
|
||||
|
||||
byte getSex(byte character)
|
||||
{
|
||||
return character == 1 ? 1 : 0; //character 1 is Paula
|
||||
}
|
||||
|
||||
void getPossessive(byte character, byte *str, int *index)
|
||||
{
|
||||
char his[] = "his";
|
||||
char her[] = "her";
|
||||
if(getSex(character) == 1)
|
||||
for (int i = 0; i < (sizeof(her) - 1); i++)
|
||||
str[(*index)++] = encode_ascii(her[i]);
|
||||
else
|
||||
for (int i = 0; i < (sizeof(his) - 1); i++)
|
||||
str[(*index)++] = encode_ascii(his[i]);
|
||||
}
|
||||
|
||||
void getPronoun(byte character, byte *str, int *index)
|
||||
{
|
||||
char he[] = "he";
|
||||
char she[] = "she";
|
||||
if(getSex(character) == 1)
|
||||
for (int i = 0; i < (sizeof(she) - 1); i++)
|
||||
str[(*index)++] = encode_ascii(she[i]);
|
||||
else
|
||||
for (int i = 0; i < (sizeof(he) - 1); i++)
|
||||
str[(*index)++] = encode_ascii(he[i]);
|
||||
}
|
||||
|
||||
void getCharName(byte character, byte *str, int *index)
|
||||
{
|
||||
copy_name(str, m2_ness_name, index, character * 7);
|
||||
}
|
||||
|
||||
void copy_name(byte *str, byte *source, int *index, int pos)
|
||||
{
|
||||
while(source[pos + 1] != 0xFF)
|
||||
str[(*index)++] = source[pos++];
|
||||
}
|
||||
|
||||
void print_file_string(int x, int y, int length, byte *str, int unknown)
|
||||
{
|
||||
int *tilesetBasePtr = (int *)(0x82B79B4 + (unknown * 20));
|
||||
|
|
|
@ -69,8 +69,14 @@ void format_cash_window(int value, int padding, byte* str);
|
|||
void handle_first_window(WINDOW* window);
|
||||
void print_file_string(int x, int y, int length, byte *str, int unknown);
|
||||
void format_file_string(FILE_SELECT *file);
|
||||
void getCharName(byte character, byte *str, int *index);
|
||||
void copy_name(byte *str, byte *source, int *index, int pos);
|
||||
byte getSex(byte character);
|
||||
void getPossessive(byte character, byte *str, int *index);
|
||||
void getPronoun(byte character, byte *str, int *index);
|
||||
|
||||
extern unsigned short m2_coord_table[];
|
||||
extern byte m2_ness_name[];
|
||||
extern int m2_bits_to_nybbles[];
|
||||
extern byte m2_nybbles_to_bits[];
|
||||
extern byte *m2_font_table[];
|
||||
|
|
|
@ -75,7 +75,7 @@ b @@store_x
|
|||
//--------------------------------
|
||||
// 5E FF XX: Load value into memory
|
||||
cmp r4,0x5E
|
||||
bne @@end
|
||||
bne @@next3
|
||||
mov r3,3
|
||||
|
||||
// Get the argument
|
||||
|
@ -94,6 +94,57 @@ mov r0,r1 // the jump table is 1-indexed
|
|||
mov r4,r3
|
||||
bl 0x80A334C // store to window memory
|
||||
mov r3,r4
|
||||
b @@end
|
||||
|
||||
@@next3:
|
||||
|
||||
//--------------------------------
|
||||
// 5D FF: Print give text
|
||||
cmp r4,0x5D
|
||||
bne @@end
|
||||
|
||||
// 5D FF should be treated as a renderable code
|
||||
push {r0-r3}
|
||||
mov r0,r2
|
||||
bl handle_first_window
|
||||
pop {r0-r3}
|
||||
|
||||
ldr r3,=#0x30009FB
|
||||
ldrb r3,[r3,#0] //Source
|
||||
ldr r2,=#m2_active_window_pc //Target
|
||||
ldrb r2,[r2,#0]
|
||||
ldr r1,=#0x3005230
|
||||
ldr r1,[r1,#0x10] //Inventory Window
|
||||
ldrh r4,[r1,#0x36] //Cursor Y
|
||||
ldrh r1,[r1,#0x34] //Cursor X
|
||||
lsl r4,r4,#1
|
||||
cmp r1,#0
|
||||
beq @@continue
|
||||
add r4,r4,#1 //Selected Item number in inventory
|
||||
@@continue:
|
||||
lsl r4,r4,#1
|
||||
ldr r0,=#0x3005200
|
||||
ldr r0,[r0,#0]
|
||||
push {r0} //String address
|
||||
ldr r0,=#0x3001D40
|
||||
mov r1,#0x6C
|
||||
mul r1,r3
|
||||
add r0,#0x14
|
||||
add r0,r0,r1 //Inventory of source
|
||||
add r0,r0,r4 //Item address
|
||||
ldrh r0,[r0,#0] //Item
|
||||
cmp r0,#0
|
||||
beq @@EndOf5D
|
||||
mov r1,r2
|
||||
mov r2,r3
|
||||
ldr r3,=#0x3005230
|
||||
ldr r3,[r3,#0x08] //Dialogue Window
|
||||
bl give_print
|
||||
|
||||
@@EndOf5D:
|
||||
pop {r0}
|
||||
mov r3,#0
|
||||
sub r3,r3,#1 //r3 is now -1
|
||||
|
||||
//--------------------------------
|
||||
@@end:
|
||||
|
|
|
@ -1256,15 +1256,7 @@ m2_enemy_attributes:
|
|||
// Existing subroutines/data
|
||||
//==============================================================================
|
||||
|
||||
.definelabel m2_ness_goods ,0x3001D54
|
||||
.definelabel m2_ness_exp ,0x3001D70
|
||||
.definelabel m2_ness_maxhp ,0x3001D84
|
||||
.definelabel m2_ness_curhp ,0x3001D86
|
||||
.definelabel m2_ness_maxpp ,0x3001D8C
|
||||
.definelabel m2_ness_curpp ,0x3001D8E
|
||||
.definelabel m2_paula_goods ,0x3001DC0
|
||||
.definelabel m2_jeff_goods ,0x3001E2C
|
||||
.definelabel m2_poo_goods ,0x3001E98
|
||||
.definelabel m2_ness_data ,0x3001D54
|
||||
.definelabel m2_ness_name ,0x3001F10
|
||||
.definelabel m2_old_paula_name ,0x3001F16
|
||||
.definelabel m2_paula_name ,0x3001F17
|
||||
|
@ -1300,11 +1292,13 @@ m2_enemy_attributes:
|
|||
.definelabel m2_psitargetwindow ,0x80B8AE0
|
||||
.definelabel m2_isequipped ,0x80BC670
|
||||
.definelabel m2_swapwindowbuf ,0x80BD7AC
|
||||
.definelabel m2_setup_window ,0x80BD844
|
||||
.definelabel m2_strlookup ,0x80BE260
|
||||
.definelabel m2_initwindow ,0x80BE458
|
||||
.definelabel m2_statuswindow_numbers,0x80C0A5C
|
||||
.definelabel m2_psiwindow ,0x80C1FBC
|
||||
.definelabel m2_drawwindow ,0x80C87D0
|
||||
.definelabel m2_print_window ,0x80C8BE4
|
||||
.definelabel m2_printstr ,0x80C9634
|
||||
.definelabel m2_printstr_hlight ,0x80C96F0
|
||||
.definelabel m2_printnextch ,0x80C980C
|
||||
|
|
|
@ -7,7 +7,12 @@ bl customcodes_parse
|
|||
ldr r1,[r6]
|
||||
|
||||
// If 0, return [r6]+2; otherwise, return [r6]+r0
|
||||
cmp r0,#0
|
||||
beq @@next
|
||||
cmp r0,#0
|
||||
bge @@continue //If -1, then set this to 0
|
||||
mov r0,#0
|
||||
@@continue:
|
||||
add r0,r0,r1
|
||||
pop {r1-r2,pc}
|
||||
@@next:
|
||||
|
@ -1408,9 +1413,8 @@ pop {pc}
|
|||
//Routine which gives the address to the party member's inventory
|
||||
get_inventory_selected:
|
||||
push {r3,lr}
|
||||
ldr r0,[r5,#0x1C] //Load source pc
|
||||
lsl r0,r0,#0x10
|
||||
asr r0,r0,#0x10
|
||||
ldr r0,=#0x30009FB //Load source pc
|
||||
ldrb r0,[r0,#0]
|
||||
ldr r3,=#0x3001D40 //Get inventory
|
||||
mov r2,#0x6C
|
||||
mul r0,r2
|
||||
|
@ -1431,9 +1435,8 @@ ldr r2,[r3,#0]
|
|||
lsl r2,r2,#0x10
|
||||
asr r2,r2,#0x10
|
||||
push {r2}
|
||||
ldr r2,[r5,#0x1C] //Load source pc
|
||||
lsl r2,r2,#0x10
|
||||
asr r2,r2,#0x10
|
||||
ldr r2,=#0x30009FB //Load source pc
|
||||
ldrb r2,[r2,#0]
|
||||
str r2,[r3,#0] //Store it
|
||||
|
||||
mov r2,#0 //No y offset
|
||||
|
@ -1462,13 +1465,10 @@ pop {pc}
|
|||
//Specific Routine which calls get_print_inventory_window
|
||||
b9ecc_get_print_inventory_window:
|
||||
push {lr}
|
||||
push {r4-r5}
|
||||
mov r5,r4
|
||||
mov r4,#0x1C
|
||||
sub r5,r5,r4 //Address with the windows' pc
|
||||
push {r4}
|
||||
ldr r4,=#0x3005230
|
||||
bl get_print_inventory_window //Prints old inventory
|
||||
pop {r4-r5}
|
||||
pop {r4}
|
||||
bl 0x80BD7F8 //Copies old arrangements, this includes the highlight
|
||||
pop {pc}
|
||||
|
||||
|
|
|
@ -2158,10 +2158,10 @@
|
|||
^L2139^[00 FF]
|
||||
^L2140^[86 FF _L4002_][09 FF B5 00][09 FF 85 02][86 FF _L4937_]@Hello![01 FF] This is Escargo Express.[01 FF] (hee, ha, he, ha)[02 FF]@I just (hee, ha, he, ha)[01 FF] couldn't find your location...[02 FF]@...You must be somewhere[01 FF] really strange.[01 FF] (hee, ha, he, ha)[02 FF]@I've decided, honestly, that...[01 FF] I should give up.[02 FF]@I'm outta here.[01 FF] (hee, ha, he, ha)[02 FF]@Sometimes this happens,[01 FF] you know?[02 FF][86 FF _L4938_][86 FF _L4024_][00 FF]
|
||||
^L2141^[09 FF B4 00][09 FF B3 00][86 FF _L4937_]@Hello![01 FF] This is Mach Pizza.[01 FF] (hee, ha, he, ha)[02 FF]@...You must be somewhere[01 FF] really strange,[01 FF] (hee, ha, he, ha)...[02 FF]@I couldn't deliver the pizza.[01 FF] The pizza got really cold and[01 FF] hard, and my legs are tired...[02 FF]@I am going to give up and[01 FF] go back.[02 FF]@...I hope I can find the way[01 FF] home...[01 FF] (hee, ha, he, ha)[02 FF][86 FF _L4938_][86 FF _L4024_][00 FF]
|
||||
^L2142^[AB FF 00 00][88 FF][86 FF _L3633_][89 FF][87 FF][00 FF]
|
||||
^L2143^himself.[1D FF][00 FF]
|
||||
^L2144^[88 FF][86 FF _L3633_][81 FF _L5455_][89 FF][87 FF][90 FF 00][1A FF 01 00].[02 FF][00 FF]
|
||||
^L2145^[87 FF][90 FF 00][1A FF 01 00] ###failed.[02 FF][1D FF][00 FF]
|
||||
^L2142^[5D FF][00 FF]
|
||||
^L2143^[00 FF]
|
||||
^L2144^[00 FF]
|
||||
^L2145^[00 FF]
|
||||
^L2146^[88 FF][AB FF 00 00][87 FF][9A FF C4 00][81 FF _L5456_][89 FF][AB FF 00 00][B7 FF 00][82 FF _L5457_][89 FF][B9 FF 00 00 00 00][88 FF][86 FF _L3633_][81 FF _L5458_][89 FF][87 FF]@[90 FF 00][1A FF 01 00] got rid of[01 FF] the [87 FF][90 FF 00][1A FF 02 00].[1D FF][00 FF]
|
||||
^L2147^[AB FF 00 00][87 FF]@[90 FF 00][1A FF 01 00] is the only one who[01 FF] should carry[01 FF] the [87 FF][90 FF 00][1A FF 02 00].[1D FF][00 FF]
|
||||
^L2148^[AB FF 00 00]@The [90 FF 00][1A FF 02 00] is one[01 FF] of the items that can be[01 FF] equipped.[1D FF][00 FF]
|
||||
|
|
Loading…
Reference in New Issue