Skip to content
Permalink
Browse files

* Nuclear missle now kills npcs. Can only be launched once. Disarming…

… the nuke works. And spawns smoke in the lower chamber. Also added lazycats fixes.

* Fixed text of the emergency shelter. It got to many spaces.
* Added Z level coord to npc spawns. (this is not checked for everywhere)
* Added monsters spawning on teleport and load
* Added messages to a few debug options.
* boomer explodes typo fix.
* It dies changed into <monstername> dies
* marked for death npcs do not show up on the overmap.
* fixed the overmap positioning of active/omap npcs
* overmap npc showing now looks at Z coords as well.
  • Loading branch information...
Soyweiser committed Apr 23, 2013
1 parent 183399d commit dd27ea987f397793680aa8a695d489b312ebaa3a
Showing with 92 additions and 47 deletions.
  1. +29 −15 computer.cpp
  2. +28 −20 game.cpp
  3. +2 −2 mondeath.cpp
  4. +3 −1 npc.cpp
  5. +1 −1 npc.h
  6. +29 −8 overmap.cpp
@@ -423,23 +423,26 @@ void computer::activate_function(game *g, computer_action action)
return;
}
if(query_yn("Confirm nuclear missile launch."))
g->add_msg("Nuclear missile launched!");
{
g->add_msg("Nuclear missile launched!");
options.clear();//Remove the option to fire another missle.
}
else
{
g->add_msg("Nuclear missile launched aborted.");
return;
}
g->refresh_all();

//Put some radiation and explosions at the nuke location.
//Put some smoke gas and explosions at the nuke location.
for(int i= g->u.posx +8; i < g->u.posx +15; i++)
{
for(int j= g->u.posy +3; j < g->u.posy +12; j++)
{
if(one_in(4))
g->explosion(i+rng(-1,1), j+rng(-1,1), rng(4,10), 0, true);
else
g->m.add_field(NULL, i+rng(-2,2), j+rng(-2,2), fd_nuke_gas, rng(1,9));
g->m.add_field(NULL, i+rng(-2,2), j+rng(-2,2), fd_smoke, rng(1,9));
}
}

@@ -468,7 +471,18 @@ void computer::activate_function(game *g, computer_action action)
} break;


case COMPACT_MISS_DISARM: // TODO: This!
case COMPACT_MISS_DISARM: // TODO: stop the nuke from creating radioactive clouds.
if(query_yn("Disarm missile."))
{
g->add_msg("Nuclear missile disarmed!");
options.clear();//disable missile.
activate_failure(g, COMPFAIL_SHUTDOWN);
}
else
{
g->add_msg("Nuclear missile remains active.");
return;
}
break;

case COMPACT_LIST_BIONICS: {
@@ -662,17 +676,17 @@ of pureed bone & LSD.");

case COMPACT_EMERG_MESS:
print_line("\
GREETINGS CITIZEN. A BIOLOGICAL ATTACK HAS TAKEN PLACE AND A STATE OF \n\
EMERGENCY HAS BEEN DECLARED. EMERGENCY PERSONNEL WILL BE AIDING YOU \n\
SHORTLY. TO ENSURE YOUR SAFETY PLEASE FOLLOW THE BELOW STEPS. \n\
\n\
1. DO NOT PANIC. \n\
2. REMAIN INSIDE THE BUILDING. \n\
3. SEEK SHELTER IN THE BASEMENT. \n\
4. USE PROVIDED GAS MASKS. \n\
5. AWAIT FURTHER INSTRUCTIONS \n\
\n\
Press any key to continue...");
GREETINGS CITIZEN. A BIOLOGICAL ATTACK HAS TAKEN PLACE AND A STATE OF \n\
EMERGENCY HAS BEEN DECLARED. EMERGENCY PERSONNEL WILL BE AIDING YOU \n\
SHORTLY. TO ENSURE YOUR SAFETY PLEASE FOLLOW THE BELOW STEPS. \n\
\n\
1. DO NOT PANIC. \n\
2. REMAIN INSIDE THE BUILDING. \n\
3. SEEK SHELTER IN THE BASEMENT. \n\
4. USE PROVIDED GAS MASKS. \n\
5. AWAIT FURTHER INSTRUCTIONS \n\
\n\
Press any key to continue...");
break;

} // switch (action)
@@ -251,6 +251,8 @@ void game::start_game()

//Load NPCs. Set nearby npcs to active.
load_npcs();
//spawn the monsters
m.spawn_monsters(this); // Static monsters
//Reset old NPCs.
// reset_npcs();
//Put some NPCs in there!
@@ -348,7 +350,7 @@ void game::create_starting_npcs()
npc * tmp = new npc();
tmp->normalize(this);
tmp->randomize(this, (one_in(2) ? NC_DOCTOR : NC_NONE));
tmp->spawn_at(&cur_om, levx, levy); //spawn the npc in the overmap.
tmp->spawn_at(&cur_om, levx, levy, levz); //spawn the npc in the overmap.
tmp->place_near(this, SEEX * int(MAPSIZE / 2) + SEEX, SEEY * int(MAPSIZE / 2) + 6);
tmp->form_opinion(&u);
tmp->attitude = NPCATT_NULL;
@@ -2215,6 +2217,7 @@ void game::debug()
set_adjacent_overmaps(true);
m.load(this, levx, levy, levz);
load_npcs();
m.spawn_monsters(this); // Static monsters
}
} break;
case 4:
@@ -2223,14 +2226,15 @@ void game::debug()
for (int j = 0; j < OMAPY; j++)
cur_om.seen(i, j, levz) = true;
}
add_msg("Current overmap revealed.");
break;

case 5: {
npc * temp = new npc();
temp->normalize(this);
temp->randomize(this);
//temp.attitude = NPCATT_TALK; //not needed
temp->spawn_at(&cur_om, levx, levy);
temp->spawn_at(&cur_om, levx, levy, levz);
temp->place_near(this, u.posx - 4, u.posy - 4);
temp->form_opinion(&u);
//temp.attitude = NPCATT_TALK;//The newly spawned npc always wants to talk. Disabled as form opinion sets the attitude.
@@ -2297,13 +2301,15 @@ z.size(), active_npc.size(), events.size());
case 11:
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin()++; aSkill != Skill::skills.end(); ++aSkill)
u.skillLevel(*aSkill).level(u.skillLevel(*aSkill) + 3);
add_msg("Skils increased.");
break;

case 12:
for(std::vector<std::string>::iterator it = martial_arts_itype_ids.begin();
it != martial_arts_itype_ids.end(); ++it){
u.styles.push_back(*it);
}
add_msg("Martial arts gained.");
break;

case 13: {
@@ -8583,7 +8589,7 @@ void game::spawn_mon(int shiftx, int shifty)
tmp->normalize(this);
tmp->randomize(this);
//tmp->stock_missions(this);
tmp->spawn_at(&cur_om, levx, levy);
tmp->spawn_at(&cur_om, levx, levy, levz);
tmp->place_near(this, SEEX * 2 * (tmp->mapx - levx) + rng(0 - SEEX, SEEX), SEEY * 2 * (tmp->mapy - levy) + rng(0 - SEEY, SEEY));
tmp->form_opinion(&u);
//tmp->attitude = NPCATT_TALK; //Form opinion seems to set the attitude.
@@ -8893,25 +8899,27 @@ void game::teleport(player *p)
void game::nuke(int x, int y)
{
// TODO: nukes hit above surface, not z = 0
if (x < 0 || y < 0 || x >= OMAPX || y >= OMAPY)
return;
int mapx = x * 2, mapy = y * 2;
map tmpmap(&itypes, &mapitems, &traps);
tmpmap.load(this, mapx, mapy, 0, false);
for (int i = 0; i < SEEX * 2; i++) {
for (int j = 0; j < SEEY * 2; j++) {
if (!one_in(10))
tmpmap.ter_set(i, j, t_rubble);
if (one_in(3))
tmpmap.add_field(NULL, i, j, fd_nuke_gas, 3);
tmpmap.radiation(i, j) += rng(20, 80);
}
}
tmpmap.save(&cur_om, turn, mapx, mapy, 0);
cur_om.ter(x, y, 0) = ot_crater;
if (x < 0 || y < 0 || x >= OMAPX || y >= OMAPY)
return;
int mapx = x * 2, mapy = y * 2;
map tmpmap(&itypes, &mapitems, &traps);
tmpmap.load(this, mapx, mapy, 0, false);
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEY * 2; j++)
{
if (!one_in(10))
tmpmap.ter_set(i, j, t_rubble);
if (one_in(3))
tmpmap.add_field(NULL, i, j, fd_nuke_gas, 3);
tmpmap.radiation(i, j) += rng(20, 80);
}
}
tmpmap.save(&cur_om, turn, mapx, mapy, 0);
cur_om.ter(x, y, 0) = ot_crater;
//Kill any npcs on that omap location.
for(int i = 0; i < cur_om.npcs.size();i++)
if(cur_om.npcs[i]->omx == x && cur_om.npcs[i]->omx)
if(cur_om.npcs[i]->mapx/2== x && cur_om.npcs[i]->mapy/2 == y && cur_om.npcs[i]->omz == 0)
cur_om.npcs[i]->marked_for_death = true;
}

@@ -8,7 +8,7 @@
void mdeath::normal(game *g, monster *z)
{
if (g->u_see(z))
g->add_msg("It dies!");
g->add_msg("%s dies!", z->name().c_str());
if (z->made_of(FLESH) && z->has_flag(MF_WARM)) {
if (g->m.field_at(z->posx, z->posy).type == fd_blood &&
g->m.field_at(z->posx, z->posy).density < 3)
@@ -36,7 +36,7 @@ void mdeath::acid(game *g, monster *z)
void mdeath::boomer(game *g, monster *z)
{
std::string tmp;
g->sound(z->posx, z->posy, 24, "a boomer explode!");
g->sound(z->posx, z->posy, 24, "a boomer explodes!");
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
g->m.bash(z->posx + i, z->posy + j, 10, tmp);
@@ -17,6 +17,7 @@ npc::npc()
{
omx = 0;
omy = 0;
omz = 0;
mapx = 0; //If these values are used for omap comparisons, add one and /2.
mapy = 0;
posx = -1;
@@ -959,11 +960,12 @@ std::list<item> starting_inv(npc *me, npc_class type, game *g)
return ret;
}

void npc::spawn_at(overmap *o, int x, int y)
void npc::spawn_at(overmap *o, int x, int y, int z)
{
// First, specify that we are in this overmap!
omx = o->pos().x;
omy = o->pos().y;
omz = z;
mapx = x;
mapy = y;
if (x == -1 || y == -1) { //<soy> not sure what this is supposed to do. If you do, please update this comment.
2 npc.h
@@ -411,7 +411,7 @@ class npc : public player {
// Generating our stats, etc.
void randomize(game *g, npc_class type = NC_NONE);
void randomize_from_faction(game *g, faction *fac);
void spawn_at(overmap *o, int posx, int posy);
void spawn_at(overmap *o, int posx, int posy, int omz);
void place_near(game *g, int potentialX, int potentialY);
skill best_skill();
void starting_weapon(game *g);
@@ -430,7 +430,7 @@ bool overmap::has_npc(game *g, int const x, int const y, int const z) const
{
//Check if the target overmap square has an npc in it.
for (int n = 0; n < npcs.size(); n++) {
if(npcs[n]->omz == z)
if(npcs[n]->omz == z && !npcs[n]->marked_for_death)
{
if (npcs[n]->is_active(g))
{ //Active npcs have different coords. Because Cata hates you!
@@ -454,9 +454,17 @@ void overmap::print_npcs(game *g, WINDOW *w, int const x, int const y, int const
//Check the max namelength of the npcs in the target
for (int n = 0; n < npcs.size(); n++)
{
if(npcs[n]->omz == z)
if(npcs[n]->omz == z && !npcs[n]->marked_for_death)
{
if ((npcs[n]->mapx)/2 == x && (npcs[n]->mapy)/2 == y) {
if (npcs[n]->is_active(g))
{ //Active npcs have different coords. Because Cata hates you!
if ((g->levx + (npcs[n]->posx / SEEX))/2 == x &&
(g->levy + (npcs[n]->posy / SEEY))/2 == y)
{
if (npcs[n]->name.length() > maxnamelength)
maxnamelength = npcs[n]->name.length();
}
} else if ((npcs[n]->mapx)/2 == x && (npcs[n]->mapy)/2 == y) {
if (npcs[n]->name.length() > maxnamelength)
maxnamelength = npcs[n]->name.length();
}
@@ -465,12 +473,25 @@ void overmap::print_npcs(game *g, WINDOW *w, int const x, int const y, int const
//Check if the target has an npc in it.
for (int n = 0; n < npcs.size(); n++)
{
if ((npcs[n]->mapx)/2 == x && (npcs[n]->mapy)/2 == y && npcs[n]->omz == z)
if (npcs[n]->omz == z && !npcs[n]->marked_for_death)
{
mvwprintz(w, i, 0, c_yellow, npcs[n]->name.c_str());
for (int j = npcs[n]->name.length(); j < maxnamelength; j++)
mvwputch(w, i, j, c_black, LINE_XXXX);
i++;
if (npcs[n]->is_active(g))
{
if ((g->levx + (npcs[n]->posx / SEEX))/2 == x &&
(g->levy + (npcs[n]->posy / SEEY))/2 == y)
{
mvwprintz(w, i, 0, c_yellow, npcs[n]->name.c_str());
for (int j = npcs[n]->name.length(); j < maxnamelength; j++)
mvwputch(w, i, j, c_black, LINE_XXXX);
i++;
}
} else if ((npcs[n]->mapx)/2 == x && (npcs[n]->mapy)/2 == y)
{
mvwprintz(w, i, 0, c_yellow, npcs[n]->name.c_str());
for (int j = npcs[n]->name.length(); j < maxnamelength; j++)
mvwputch(w, i, j, c_black, LINE_XXXX);
i++;
}
}
}
for (int j = 0; j < i; j++)

0 comments on commit dd27ea9

Please sign in to comment.
You can’t perform that action at this time.