Permalink
Browse files

Bigger active maps. Lots of efficiency changes.

  • Loading branch information...
1 parent 0f9e9bf commit fadac131e3c29b88d8dc6d2df1ab8bc6b76f647b @Whales committed Dec 2, 2011
Showing with 1,162 additions and 594 deletions.
  1. +133 −10 artifact.cpp
  2. +6 −0 artifact.h
  3. +6 −0 artifactdata.h
  4. +26 −26 computer.cpp
  5. +9 −7 construction.cpp
  6. +7 −5 crafting.cpp
  7. +16 −16 event.cpp
  8. +3 −3 field.cpp
  9. +222 −170 game.cpp
  10. +5 −1 game.h
  11. +6 −0 inventory_ui.cpp
  12. +2 −1 itype.h
  13. +9 −4 itypedef.cpp
  14. +5 −1 iuse.cpp
  15. +0 −7 line.cpp
  16. +161 −61 map.cpp
  17. +4 −1 map.h
  18. +1 −1 mapdata.h
  19. +161 −1 mapgen.cpp
  20. +1 −0 mapitems.h
  21. +31 −15 mapitemsdef.cpp
  22. +17 −8 monattack.cpp
  23. +2 −0 mondeath.cpp
  24. +3 −0 monmove.cpp
  25. +4 −0 monster.cpp
  26. +1 −0 monster.h
  27. +4 −4 mtypedef.cpp
  28. +13 −11 npcmove.cpp
  29. +1 −1 npctalk.cpp
  30. +194 −181 omdata.h
  31. +19 −20 overmap.cpp
  32. +19 −3 player.cpp
  33. +36 −21 ranged.cpp
  34. +26 −5 trapfunc.cpp
  35. +1 −2 tutorial.h
  36. +8 −8 weather.cpp
View
@@ -66,7 +66,7 @@ It may have unknown powers; use 'a' to activate them.";
while (!good_effects.empty() && !bad_effects.empty() &&
(num_good < 1 || num_bad < 1 || one_in(num_good + 1) ||
one_in(num_bad + 1) || value > 1)) {
- if (one_in(2)) { // Good
+ if (value < 1 && one_in(2)) { // Good
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
@@ -89,7 +89,7 @@ It may have unknown powers; use 'a' to activate them.";
while (one_in(2) && !good_effects.empty() && !bad_effects.empty() &&
((num_good > 2 && one_in(num_good + 1)) || num_bad < 1 ||
one_in(num_bad + 1) || value > 1)) {
- if (one_in(3)) { // Good
+ if (value < 1 && one_in(3)) { // Good
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
@@ -218,9 +218,9 @@ It may have unknown powers; use 'a' to activate them.";
std::vector<art_effect_passive> bad_effects = fill_bad_passive();
while (!good_effects.empty() && !bad_effects.empty() &&
- (num_good < 1 || one_in(num_good) || !one_in(3 - num_bad) ||
- value > 1)) {
- if (one_in(2)) { // Good effect
+ (num_good < 1 || one_in(num_good * 2) || value > 1 ||
+ (num_bad < 3 && !one_in(3 - num_bad)))) {
+ if (value < 1 && one_in(2)) { // Good effect
int index = rng(0, good_effects.size() - 1);
passive_tmp = good_effects[index];
good_effects.erase(good_effects.begin() + index);
@@ -304,26 +304,27 @@ void game::process_artifact(item *it, player *p, bool wielded)
if (it->charges < tool->max_charges) {
switch (tool->charge_type) {
case ARTC_TIME:
- if (int(turn) % 300 == 0)
+ if (turn.second == 0 && turn.minute == 0) // Once per hour
it->charges++;
break;
case ARTC_SOLAR:
- if (int(turn) % 100 == 0 && is_in_sunlight(p->posx, p->posy))
+ if (turn.second == 0 && turn.minute % 10 == 0 &&
+ is_in_sunlight(p->posx, p->posy))
it->charges++;
break;
case ARTC_PAIN:
- if (int(turn) % 50 == 0) {
+ if (turn.second == 0) {
add_msg("You suddenly feel sharp pain for no reason.");
p->pain += 3 * rng(1, 3);
it->charges++;
}
break;
case ARTC_HP:
- if (int(turn) % 50 == 0) {
+ if (turn.second == 0) {
add_msg("You feel your body decaying.");
p->hurtall(1);
+ it->charges++;
}
- it->charges++;
break;
}
}
@@ -368,6 +369,29 @@ void game::process_artifact(item *it, player *p, bool wielded)
case AEP_SNAKES:
break; // Handled in player::hit()
+ case AEP_EXTINGUISH:
+ for (int x = p->posx - 1; x <= p->posx + 1; x++) {
+ for (int y = p->posy - 1; y <= p->posy + 1; y++) {
+ if (m.field_at(x, y).type == fd_fire) {
+ if (m.field_at(x, y).density == 0)
+ m.field_at(x, y) = field();
+ else
+ m.field_at(x, y).density--;
+ }
+ }
+ }
+ break;
+
+ case AEP_HUNGER:
+ if (one_in(100))
+ p->hunger++;
+ break;
+
+ case AEP_THIRST:
+ if (one_in(120))
+ p->thirst++;
+ break;
+
case AEP_EVIL:
if (one_in(150)) { // Once every 15 minutes, on average
p->add_disease(DI_EVIL, 300, this);
@@ -413,3 +437,102 @@ void game::process_artifact(item *it, player *p, bool wielded)
}
}
}
+
+void game::add_artifact_messages(std::vector<art_effect_passive> effects)
+{
+ int net_str = 0, net_dex = 0, net_per = 0, net_int = 0, net_speed = 0;
+ for (int i = 0; i < effects.size(); i++) {
+ switch (effects[i]) {
+ case AEP_STR_UP: net_str += 4; break;
+ case AEP_DEX_UP: net_dex += 4; break;
+ case AEP_PER_UP: net_per += 4; break;
+ case AEP_INT_UP: net_int += 4; break;
+ case AEP_ALL_UP: net_str += 2;
+ net_dex += 2;
+ net_per += 2;
+ net_int += 2; break;
+ case AEP_STR_DOWN: net_str -= 3; break;
+ case AEP_DEX_DOWN: net_dex -= 3; break;
+ case AEP_PER_DOWN: net_per -= 3; break;
+ case AEP_INT_DOWN: net_int -= 3; break;
+ case AEP_ALL_DOWN: net_str -= 2;
+ net_dex -= 2;
+ net_per -= 2;
+ net_int -= 2; break;
+
+ case AEP_SPEED_UP: net_speed += 20; break;
+ case AEP_SPEED_DOWN: net_speed -= 20; break;
+
+ case AEP_IODINE:
+ break; // No message
+
+ case AEP_SNAKES:
+ add_msg("Your skin feels slithery.");
+ break;
+
+ case AEP_INVISIBLE:
+ add_msg("You fade into invisibility!");
+ break;
+
+ case AEP_CLAIRVOYANCE:
+ add_msg("You can see through walls!");
+ break;
+
+ case AEP_STEALTH:
+ add_msg("Your steps stop making noise.");
+ break;
+
+ case AEP_GLOW:
+ add_msg("A glow of light forms around you.");
+ break;
+
+ case AEP_PSYSHIELD:
+ add_msg("Your mental state feels protected.");
+ break;
+
+ case AEP_HUNGER:
+ add_msg("You feel hungry.");
+ break;
+
+ case AEP_THIRST:
+ add_msg("You feel thirsty.");
+ break;
+
+ case AEP_EVIL:
+ add_msg("You feel an evil presence...");
+ break;
+
+ case AEP_SCHIZO:
+ add_msg("You feel a tickle of insanity.");
+ break;
+
+ case AEP_RADIOACTIVE:
+ add_msg("Your skin prickles with radiation.");
+ break;
+
+ case AEP_MUTAGENIC:
+ add_msg("You feel your genetic makeup degrading.");
+ break;
+
+ case AEP_ATTENTION:
+ add_msg("You feel an otherworldly attention upon you...");
+ break;
+ }
+ }
+
+ std::stringstream stat_info;
+ if (net_str != 0)
+ stat_info << "Str " << (net_str > 0 ? "+" : "") << net_str << "! ";
+ if (net_dex != 0)
+ stat_info << "Dex " << (net_dex > 0 ? "+" : "") << net_dex << "! ";
+ if (net_int != 0)
+ stat_info << "Int " << (net_int > 0 ? "+" : "") << net_int << "! ";
+ if (net_per != 0)
+ stat_info << "Per " << (net_per > 0 ? "+" : "") << net_per << "! ";
+
+ if (stat_info.str().length() > 0)
+ add_msg(stat_info.str().c_str());
+
+ if (net_speed != 0)
+ add_msg("Speed %s%d", (net_speed > 0 ? "+" : ""), net_speed);
+}
View
@@ -17,9 +17,15 @@ enum art_effect_passive {
AEP_SNAKES, // Summons friendly snakes when you're hit
AEP_INVISIBLE, // Makes you invisible
AEP_CLAIRVOYANCE, // See through walls
+ AEP_STEALTH, // Your steps are quieted
+ AEP_EXTINGUISH, // May extinguish nearby flames
+ AEP_GLOW, // Four-tile light source
+ AEP_PSYSHIELD, // Protection from stare attacks
// Splits good from bad
AEP_SPLIT,
// Bad
+ AEP_HUNGER, // Increases hunger
+ AEP_THIRST, // Increases thirst
AEP_SMOKE, // Emits smoke occasionally
AEP_EVIL, // Addiction to the power
AEP_SCHIZO, // Mimicks schizophrenia
View
@@ -18,9 +18,15 @@ int passive_effect_cost[NUM_AEPS] = {
4, // AEP_SNAKES
7, // AEP_INVISIBLE
5, // AEP_CLAIRVOYANCE
+2, // AEP_STEALTH
+2, // AEP_EXTINGUISH
+1, // AEP_GLOW
+1, // AEP_PSYSHIELD
0, // AEP_SPLIT
+-2, // AEP_HUNGER
+-2, // AEP_THIRST
-1, // AEP_SMOKE
-6, // AEP_EVIL
-4, // AEP_SCHIZO
View
@@ -246,8 +246,8 @@ void computer::activate_function(game *g, computer_action action)
break;
case COMPACT_SAMPLE:
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_sewage_pump) {
for (int x1 = x - 1; x1 <= x + 1; x1++) {
for (int y1 = y - 1; y1 <= y + 1; y1++ ) {
@@ -280,8 +280,8 @@ void computer::activate_function(game *g, computer_action action)
break;
case COMPACT_TERMINATE:
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
int mondex = g->mon_at(x, y);
if (mondex != -1 &&
((g->m.ter(x, y - 1) == t_reinforced_glass_h &&
@@ -295,8 +295,8 @@ void computer::activate_function(game *g, computer_action action)
break;
case COMPACT_PORTAL:
- for (int i = 0; i < SEEX * 3; i++) {
- for (int j = 0; j < SEEY * 3; j++) {
+ for (int i = 0; i < SEEX * MAPSIZE; i++) {
+ for (int j = 0; j < SEEY * MAPSIZE; j++) {
int numtowers = 0;
for (int xt = i - 2; xt <= i + 2; xt++) {
for (int yt = j - 2; yt <= j + 2; yt++) {
@@ -399,15 +399,14 @@ void computer::activate_function(game *g, computer_action action)
if (maxx >= OMAPX) maxx = OMAPX - 1;
if (miny < 0) miny = 0;
if (maxy >= OMAPY) maxy = OMAPY - 1;
- overmap tmp(g, g->cur_om.posx, g->cur_om.posy, g->cur_om.posz);
for (int i = minx; i <= maxx; i++) {
for (int j = miny; j <= maxy; j++)
- if ((tmp.ter(i, j) >= ot_sewer_ns && tmp.ter(i, j) <= ot_sewer_nesw) ||
- (tmp.ter(i, j) >= ot_sewage_treatment &&
- tmp.ter(i, j) <= ot_sewage_treatment_under))
- tmp.seen(i, j) = true;
+ if ((g->cur_om.ter(i, j) >= ot_sewer_ns &&
+ g->cur_om.ter(i, j) <= ot_sewer_nesw) ||
+ (g->cur_om.ter(i, j) >= ot_sewage_treatment &&
+ g->cur_om.ter(i, j) <= ot_sewage_treatment_under))
+ g->cur_om.seen(i, j) = true;
}
- tmp.save(g->u.name, g->cur_om.posx, g->cur_om.posy, 0);
print_line("Sewage map data downloaded.");
} break;
@@ -422,7 +421,7 @@ void computer::activate_function(game *g, computer_action action)
}
// Figure out where the glass wall is...
int wall_spot = 0;
- for (int i = 0; i < SEEX * 3 && wall_spot == 0; i++) {
+ for (int i = g->u.posx; i < g->u.posx + SEEX * 2 && wall_spot == 0; i++) {
if (g->m.ter(i, 10) == t_wall_glass_v)
wall_spot = i;
}
@@ -455,8 +454,8 @@ void computer::activate_function(game *g, computer_action action)
case COMPACT_LIST_BIONICS: {
std::vector<std::string> names;
int more = 0;
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
if (g->m.i_at(x, y)[i].is_bionic()) {
if (names.size() < 9)
@@ -474,8 +473,8 @@ void computer::activate_function(game *g, computer_action action)
} break;
case COMPACT_ELEVATOR_ON:
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_elevator_control_off)
g->m.ter(x, y) = t_elevator_control;
}
@@ -570,7 +569,8 @@ INITIATING STANDARD TREMOR TEST...");
case COMPACT_AMIGARA_START:
g->add_event(EVENT_AMIGARA, int(g->turn) + 10, 0, 0, 0);
- g->u.add_disease(DI_AMIGARA, -1, g);
+ if (!g->u.has_artifact_with(AEP_PSYSHIELD))
+ g->u.add_disease(DI_AMIGARA, -1, g);
break;
} // switch (action)
@@ -591,8 +591,8 @@ void computer::activate_failure(game *g, computer_failure fail)
break; // Do nothing. Why was this even called >:|
case COMPFAIL_SHUTDOWN:
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.has_flag(console, x, y))
g->m.ter(x, y) = t_console_broken;
}
@@ -648,8 +648,8 @@ void computer::activate_failure(game *g, computer_failure fail)
case COMPFAIL_PUMP_EXPLODE:
g->add_msg("The pump explodes!");
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_sewage_pump) {
g->m.ter(x, y) = t_rubble;
g->explosion(x, y, 10, 0, false);
@@ -660,8 +660,8 @@ void computer::activate_failure(game *g, computer_failure fail)
case COMPFAIL_PUMP_LEAK:
g->add_msg("Sewage leaks!");
- for (int x = 0; x < SEEX * 3; x++) {
- for (int y = 0; y < SEEY * 3; y++) {
+ for (int x = 0; x < SEEX * MAPSIZE; x++) {
+ for (int y = 0; y < SEEY * MAPSIZE; y++) {
if (g->m.ter(x, y) == t_sewage_pump) {
point p(x, y);
int leak_size = rng(4, 10);
@@ -691,8 +691,8 @@ void computer::activate_failure(game *g, computer_failure fail)
case COMPFAIL_AMIGARA:
g->add_event(EVENT_AMIGARA, int(g->turn) + 5, 0, 0, 0);
g->u.add_disease(DI_AMIGARA, -1, g);
- g->explosion(rng(0, SEEX * 3), rng(0, SEEY * 3), 10, 10, false);
- g->explosion(rng(0, SEEX * 3), rng(0, SEEY * 3), 10, 10, false);
+ g->explosion(rng(0, SEEX * MAPSIZE), rng(0, SEEY * MAPSIZE), 10, 10, false);
+ g->explosion(rng(0, SEEX * MAPSIZE), rng(0, SEEY * MAPSIZE), 10, 10, false);
break;
}// switch (fail)
}
Oops, something went wrong.

0 comments on commit fadac13

Please sign in to comment.