Skip to content

Commit

Permalink
Shelters. NPC dialog and missions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Whales committed Dec 8, 2011
1 parent 43e93a5 commit ef904d0
Show file tree
Hide file tree
Showing 33 changed files with 1,007 additions and 1,010 deletions.
2 changes: 1 addition & 1 deletion bodypart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ std::string encumb_text(body_part bp)
case bp_head: return "";
case bp_eyes: return "Ranged combat is hampered.";
case bp_mouth: return "Running is slowed.";
case bp_torso: return "Movement and melee is hampered.";
case bp_torso: return "Dodging and melee is hampered.";
case bp_arms: return "Melee and ranged combat is hampered.";
case bp_hands: return "Manual tasks are slowed.";
case bp_legs: return "Running and swimming are slowed.";
Expand Down
20 changes: 10 additions & 10 deletions computer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,10 @@ void computer::activate_function(game *g, computer_action action)
} break;

case COMPACT_MAPS: {
int minx = int(g->levx / 2) - 40;
int maxx = int(g->levx / 2) + 40;
int miny = int(g->levy / 2) - 40;
int maxy = int(g->levy / 2) + 40;
int minx = int((g->levx + int(MAPSIZE / 2)) / 2) - 40;
int maxx = int((g->levx + int(MAPSIZE / 2)) / 2) + 40;
int miny = int((g->levy + int(MAPSIZE / 2)) / 2) - 40;
int maxy = int((g->levy + int(MAPSIZE / 2)) / 2) + 40;
if (minx < 0) minx = 0;
if (maxx >= OMAPX) maxx = OMAPX - 1;
if (miny < 0) miny = 0;
Expand All @@ -391,13 +391,13 @@ void computer::activate_function(game *g, computer_action action)
} break;

case COMPACT_MAP_SEWER: {
int minx = int(g->levx / 2) - 60;
int maxx = int(g->levx / 2) + 60;
int miny = int(g->levy / 2) - 60;
int maxy = int(g->levy / 2) + 60;
if (minx < 0) minx = 0;
int minx = int((g->levx + int(MAPSIZE / 2)) / 2) - 60;
int maxx = int((g->levx + int(MAPSIZE / 2)) / 2) + 60;
int miny = int((g->levy + int(MAPSIZE / 2)) / 2) - 60;
int maxy = int((g->levy + int(MAPSIZE / 2)) / 2) + 60;
if (minx < 0) minx = 0;
if (maxx >= OMAPX) maxx = OMAPX - 1;
if (miny < 0) miny = 0;
if (miny < 0) miny = 0;
if (maxy >= OMAPY) maxy = OMAPY - 1;
for (int i = minx; i <= maxx; i++) {
for (int j = miny; j <= maxy; j++)
Expand Down
89 changes: 75 additions & 14 deletions dialogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,18 @@ struct dialogue {
WINDOW *win;
bool done;
std::vector<std::string> history;
std::vector<talk_topic> topic_stack;

int opt(std::string challenge, ...);
talk_topic opt(talk_topic topic, game *g);

dialogue()
{
alpha = NULL;
beta = NULL;
win = NULL;
done = false;
}
};

/* There is a array of tag_data, "tags", at the bottom of this file.
Expand All @@ -29,14 +39,6 @@ struct tag_data
std::string (*replacement)[10];
};

enum talk_topic {
TALK_NONE = 0, // Nothing; let the player take the lead
TALK_INQUIRE, // Inquire about what the player's doing
TALK_JOIN, // Ask to join forces
TALK_TRADE, // Look to trade goods
NUM_TALK_TOPICS
};

std::string talk_needs[num_needs][5] = {
{"", "", "", "", ""},
{"Hey<punc> You got any <ammo>?", "I'll need some <ammo> soon, got any?",
Expand Down Expand Up @@ -72,15 +74,19 @@ std::string talk_okay[10] = {

std::string talk_bad_names[10] = {
"punk", "bitch", "dickhead", "asshole", "fucker",
"sucker", "fuckwad", "fuckface", "motherfucker", "shithead"};
"sucker", "fuckwad", "cocksucker", "motherfucker", "shithead"};

std::string talk_good_names[10] = {
"stranger", "friend", "pilgrim", "traveler", "pal",
"fella", "you", "dude", "buddy", "man"};

std::string talk_swear[10] = { // e.g. "drop the <swear> weapon"
"fucking", "goddamn", "motherfucking", "freaking", "damn", "<swear> <swear>",
"shit-sucking", "fuckin'", "god damn", "mafuckin'"};
"fucking", "fuckin'", "god damn", "mafuckin'"};

std::string talk_swear_interjection[10] = {
"fuck", "damn", "damnit", "shit", "cocksucker", "crap",
"motherfucker", "<swear><punc> <swear!>", "<very> <swear!>", "son of a bitch"};

std::string talk_very[10] = { // Synonyms for "very" -- applied to adjectives
"really", "fucking", "super", "wicked", "very", "mega", "uber", "ultra",
Expand All @@ -91,8 +97,8 @@ std::string talk_really[10] = { // Synonyms for "really" -- applied to verbs
"<really> <really>", "most <really>", "urgently", "REALLY"};

std::string talk_happy[10] = {
"glad", "happy", "overjoyed", "ecstatic", "thrilled", "stoked", "<very> <happy>",
"tickled pink", "delighted", "pumped"};
"glad", "happy", "overjoyed", "ecstatic", "thrilled", "stoked",
"<very> <happy>", "tickled pink", "delighted", "pumped"};

std::string talk_sad[10] = {
"sad", "bummed", "depressed", "pissed", "unhappy", "<very> <sad>", "dejected",
Expand Down Expand Up @@ -146,7 +152,7 @@ std::string talk_no_faction[10] = {
"I'm a free agent, more money that way.",
"I prefer to work uninhibited by that kind of connection.",
"I haven't found one that's good enough for me.",
"I don't belong to a faction, <name_g>"
"I don't belong to a faction, <name_g>."
};

std::string talk_come_here[10] = {
Expand Down Expand Up @@ -215,14 +221,15 @@ std::string talk_done_mugging[10] = {
"Thanks, <name_g>!"
};

#define NUM_STATIC_TAGS 19
#define NUM_STATIC_TAGS 20


tag_data talk_tags[NUM_STATIC_TAGS] = {
{"<okay>", &talk_okay},
{"<name_b>", &talk_bad_names},
{"<name_g>", &talk_good_names},
{"<swear>", &talk_swear},
{"<swear!>", &talk_swear_interjection},
{"<very>", &talk_very},
{"<really>", &talk_really},
{"<happy>", &talk_happy},
Expand All @@ -240,4 +247,58 @@ tag_data talk_tags[NUM_STATIC_TAGS] = {
{"<done_mugging>", &talk_done_mugging}
};

struct talk_function
{
void nothing(game *g, npc *p) {};
void assign_mission(game *g, npc *p);
void mission_success(game *g, npc *p);
void clear_mission(game *g, npc *p);
void enslave(game *g, npc *p) {}; // p becomes slave of u
void hostile(game *g, npc *p) {}; // p turns hostile to u
};

enum talk_trial
{
TALK_TRIAL_NONE, // No challenge here!
TALK_TRIAL_LIE, // Straight up lying
TALK_TRIAL_PERSUADE, // Convince them
TALK_TRIAL_INTIMIDATE, // Physical intimidation
NUM_TALK_TRIALS
};

std::string talk_trial_text[NUM_TALK_TRIALS] = {
"", "LIE", "PERSUADE", "INTIMIDATE"
};

struct talk_response
{
std::string text;
talk_trial trial;
int difficulty;
int mission_index;
void (talk_function::*effect_success)(game *, npc *);
void (talk_function::*effect_failure)(game *, npc *);
talk_topic success;
talk_topic failure;

talk_response()
{
text = "";
trial = TALK_TRIAL_NONE;
difficulty = 0;
mission_index = -1;
effect_success = &talk_function::nothing;
effect_failure = &talk_function::nothing;
success = TALK_NONE;
failure = TALK_NONE;
}
};

struct talk_response_list
{
std::vector<talk_response> none(game *g, npc *p);
std::vector<talk_response> shelter(game *g, npc *p);
std::vector<talk_response> shopkeep(game *g, npc *p);
};

#endif
2 changes: 1 addition & 1 deletion faction.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define MAX_FAC_NAME_SIZE 40

#ifndef mfb
#define mfb(n) long(pow(2,(long)n))
#define mfb(n) long(1 << (n))
#endif

std::string fac_ranking_text(int val);
Expand Down
Loading

0 comments on commit ef904d0

Please sign in to comment.