Attached Files:
|
0001-Hacks-to-display-different-symbols-for-tentacle-segm.patch [^] (4,275 bytes) 2010-07-24 15:15 [Show Content] [Hide Content]From 7dc065fb289f4d8b251d8e046c80742a9db31caa Mon Sep 17 00:00:00 2001
From: Charles Otto <ottochar@gmail.com>
Date: Sun, 18 Jul 2010 22:34:47 -0400
Subject: [PATCH] Hacks to display different symbols for tentacle segments
A (bad) method of displaying different glyphs for tentacle connectors
depending on tentacle positioning.
---
crawl-ref/source/view.cc | 150 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 150 insertions(+), 0 deletions(-)
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index fe21552..8373b9a 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -578,6 +578,144 @@ static int _viewmap_flash_colour()
return (BLACK);
}
+int compass_lookup[3][3] = {{5, 4, 3},
+ {6, -1, 2},
+ {7, 0, 1}
+};
+
+enum compass_bytes
+{
+ SOUTH = 1 << 0,
+ SOUTH_EAST = 1 << 1,
+ EAST = 1 << 2,
+ NORTH_EAST = 1 << 3,
+ NORTH = 1 << 4,
+ NORTH_WEST = 1 << 5,
+ WEST = 1 << 6,
+ SOUTH_WEST = 1 << 7,
+};
+
+
+int compass_idx_lookup(const coord_def & first,
+ const coord_def & second)
+{
+ int delta_x = second.x - first.x;
+ //int delta_y = second.y - first.y;
+ int delta_y = second.y - first.y;
+ //int delta_y = second.y - first.y;
+
+
+ if (delta_x > 0)
+ delta_x = 1;
+ else if (delta_x < 0)
+ delta_x = -1;
+
+ if (delta_y > 0)
+ delta_y = 1;
+ else if (delta_y < 0)
+ delta_y = -1;
+
+ //delta_y = - delta_y;
+
+ //delta_y = delta_y;
+ int output = compass_lookup[delta_y + 1][delta_x + 1];
+// int output = compass_lookup[delta_ ]
+// mprf("dx %d dy %d res %d", delta_x, delta_y, output);
+
+ return (output);
+}
+
+unsigned glyph_from_pos_code(int code)
+{
+ if (code & SOUTH)
+ {
+ if (code & NORTH || code & NORTH_WEST || code & NORTH_EAST)
+ return '|';
+ }
+
+ if (code & NORTH && (code & SOUTH_WEST || code & SOUTH_EAST))
+ return '|';
+
+ if (code & EAST)
+ {
+ if (code & WEST || code & NORTH_WEST || code & SOUTH_WEST)
+ return '-';
+ }
+
+ if (code & WEST && (code & SOUTH_EAST || code & NORTH_EAST))
+ {
+ return '-';
+ }
+
+ if (code & SOUTH_EAST)
+ {
+ if (code & NORTH_WEST)
+ return '\\';
+
+ if (code & NORTH_EAST)
+ return '<';
+ if (code & SOUTH_WEST)
+ return '^';
+ }
+
+ if (code & NORTH_EAST)
+ {
+ if (code & SOUTH_WEST)
+ return '/';
+
+ if (code & NORTH_WEST)
+ return 'V';
+ }
+
+ if (code & NORTH_WEST)
+ {
+ if (code & SOUTH_WEST)
+ return '>';
+ }
+
+
+ return '*';
+}
+
+unsigned lookup_tentacle_char(monsters * connector)
+{
+ coord_def in (-1, -1);
+
+ if (connector->props.exists("inwards"))
+ {
+ int idx = connector->props["inwards"].get_int();
+ if (idx >= 0)
+ {
+ in = menv[idx].pos();
+ }
+ else
+ mprf("zero inbound %d", idx);
+ }
+ else return '*';
+
+ coord_def out(-1, -1);
+
+ if (connector->props.exists("outwards"))
+ {
+ int idx = connector->props["outwards"].get_int();
+ if (idx >= 0)
+ {
+ out = menv[idx].pos();
+ }
+ }
+ else
+ return '*';
+
+ int in_idx = compass_idx_lookup(connector->pos(), in);
+ int out_idx = compass_idx_lookup(connector->pos(), out);
+
+
+ int symbol = (1 << in_idx) | (1 << out_idx);
+
+ return glyph_from_pos_code(symbol);
+
+}
+
// Updates one square of the view area. Should only be called for square
// in LOS.
void view_update_at(const coord_def &pos)
@@ -830,6 +968,18 @@ static void _draw_los(screen_cell_t *cell,
bool anim_updates)
{
glyph g = get_show_glyph(env.show(ep));
+
+ // hook for changing tentacle connector glyph (lol). -cao
+ if (env.show(ep).cls == SH_MONSTER)
+ {
+ monsters * test = monster_at(gc);
+ if (test && test->type == MONS_KRAKEN_CONNECTOR)
+ {
+ g.ch = lookup_tentacle_char(test);
+ }
+ }
+
+
cell->glyph = g.ch;
cell->colour = g.col;
--
1.6.5.1.1367.gcd48
kraken_multiglyph.png [^] (17,252 bytes) 2010-07-24 15:38
kraken_singleglyph.png [^] (15,854 bytes) 2010-07-24 15:38
kraken_multicolor.png [^] (15,484 bytes) 2010-07-24 16:23
|