• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision0925819cdb316fdfb85057cb1c59575c8c3d8a5e (tree)
Time2019-02-20 23:19:38
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

[Refactor] #37353 term.c/h 追加。 / Add term.c/h.

Change Summary

Incremental Difference

--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj
@@ -250,6 +250,7 @@
250250 <ClCompile Include="..\..\src\store.c" />
251251 <ClCompile Include="..\..\src\floor-streams.c" />
252252 <ClCompile Include="..\..\src\tables.c" />
253+ <ClCompile Include="..\..\src\term.c" />
253254 <ClCompile Include="..\..\src\trap.c" />
254255 <ClCompile Include="..\..\src\util.c" />
255256 <ClCompile Include="..\..\src\variable.c" />
@@ -337,6 +338,7 @@
337338 <ClInclude Include="..\..\src\spells-world.h" />
338339 <ClInclude Include="..\..\src\spells.h" />
339340 <ClInclude Include="..\..\src\store.h" />
341+ <ClInclude Include="..\..\src\term.h" />
340342 <ClInclude Include="..\..\src\trap.h" />
341343 <ClInclude Include="..\..\src\types.h" />
342344 <ClInclude Include="..\..\src\wild.h" />
--- a/src/mind.c
+++ b/src/mind.c
@@ -1658,11 +1658,11 @@ static bool cast_ninja_spell(int spell)
16581658 grid_array[target_row][target_col].m_idx = 0;
16591659
16601660 /* Update the new location */
1661- grid_array[ty][tx].m_idx = (s16b)m_idx;
1661+ grid_array[ty][tx].m_idx = m_idx;
16621662
16631663 /* Move the monster */
1664- m_ptr->fy = (byte_hack)ty;
1665- m_ptr->fx = (byte_hack)tx;
1664+ m_ptr->fy = ty;
1665+ m_ptr->fx = tx;
16661666
16671667 /* Wake the monster up */
16681668 (void)set_monster_csleep(m_idx, 0);
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -33,6 +33,7 @@
3333 #include "player-status.h"
3434 #include "realm-hex.h"
3535 #include "object-hook.h"
36+#include "term.h"
3637
3738
3839 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
@@ -80,192 +81,6 @@ static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSIT
8081 return;
8182 }
8283
83-/*!
84- * @brief 万色表現用にランダムな色を選択する関数 /
85- * Get a legal "multi-hued" color for drawing "spells"
86- * @param max 色IDの最大値
87- * @return 選択した色ID
88- */
89-static TERM_COLOR mh_attr(int max)
90-{
91- switch (randint1(max))
92- {
93- case 1: return (TERM_RED);
94- case 2: return (TERM_GREEN);
95- case 3: return (TERM_BLUE);
96- case 4: return (TERM_YELLOW);
97- case 5: return (TERM_ORANGE);
98- case 6: return (TERM_VIOLET);
99- case 7: return (TERM_L_RED);
100- case 8: return (TERM_L_GREEN);
101- case 9: return (TERM_L_BLUE);
102- case 10: return (TERM_UMBER);
103- case 11: return (TERM_L_UMBER);
104- case 12: return (TERM_SLATE);
105- case 13: return (TERM_WHITE);
106- case 14: return (TERM_L_WHITE);
107- case 15: return (TERM_L_DARK);
108- }
109-
110- return (TERM_WHITE);
111-}
112-
113-
114-/*!
115- * @brief 魔法属性に応じたエフェクトの色を返す /
116- * Return a color to use for the bolt/ball spells
117- * @param type 魔法属性
118- * @return 対応する色ID
119- */
120-static TERM_COLOR spell_color(EFFECT_ID type)
121-{
122- /* Check if A.B.'s new graphics should be used (rr9) */
123- if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
124- {
125- /* Analyze */
126- switch (type)
127- {
128- case GF_PSY_SPEAR: return (0x06);
129- case GF_MISSILE: return (0x0F);
130- case GF_ACID: return (0x04);
131- case GF_ELEC: return (0x02);
132- case GF_FIRE: return (0x00);
133- case GF_COLD: return (0x01);
134- case GF_POIS: return (0x03);
135- case GF_HOLY_FIRE: return (0x00);
136- case GF_HELL_FIRE: return (0x00);
137- case GF_MANA: return (0x0E);
138- /* by henkma */
139- case GF_SEEKER: return (0x0E);
140- case GF_SUPER_RAY: return (0x0E);
141-
142- case GF_ARROW: return (0x0F);
143- case GF_WATER: return (0x04);
144- case GF_NETHER: return (0x07);
145- case GF_CHAOS: return (mh_attr(15));
146- case GF_DISENCHANT: return (0x05);
147- case GF_NEXUS: return (0x0C);
148- case GF_CONFUSION: return (mh_attr(4));
149- case GF_SOUND: return (0x09);
150- case GF_SHARDS: return (0x08);
151- case GF_FORCE: return (0x09);
152- case GF_INERTIAL: return (0x09);
153- case GF_GRAVITY: return (0x09);
154- case GF_TIME: return (0x09);
155- case GF_LITE_WEAK: return (0x06);
156- case GF_LITE: return (0x06);
157- case GF_DARK_WEAK: return (0x07);
158- case GF_DARK: return (0x07);
159- case GF_PLASMA: return (0x0B);
160- case GF_METEOR: return (0x00);
161- case GF_ICE: return (0x01);
162- case GF_ROCKET: return (0x0F);
163- case GF_DEATH_RAY: return (0x07);
164- case GF_NUKE: return (mh_attr(2));
165- case GF_DISINTEGRATE: return (0x05);
166- case GF_PSI:
167- case GF_PSI_DRAIN:
168- case GF_TELEKINESIS:
169- case GF_DOMINATION:
170- case GF_DRAIN_MANA:
171- case GF_MIND_BLAST:
172- case GF_BRAIN_SMASH:
173- return (0x09);
174- case GF_CAUSE_1:
175- case GF_CAUSE_2:
176- case GF_CAUSE_3:
177- case GF_CAUSE_4: return (0x0E);
178- case GF_HAND_DOOM: return (0x07);
179- case GF_CAPTURE : return (0x0E);
180- case GF_IDENTIFY: return (0x01);
181- case GF_ATTACK: return (0x0F);
182- case GF_PHOTO : return (0x06);
183- }
184- }
185- /* Normal tiles or ASCII */
186- else
187- {
188- TERM_COLOR a;
189- SYMBOL_CODE c;
190-
191- /* Lookup the default colors for this type */
192- concptr s = quark_str(gf_color[type]);
193-
194- if (!s) return (TERM_WHITE);
195-
196- /* Pick a random color */
197- c = s[randint0(strlen(s))];
198-
199- /* Lookup this color */
200- a = my_strchr(color_char, c) - color_char;
201-
202- /* Invalid color (note check for < 0 removed, gave a silly
203- * warning because bytes are always >= 0 -- RG) */
204- if (a > 15) return (TERM_WHITE);
205-
206- /* Use this color */
207- return (a);
208- }
209-
210- /* Standard "color" */
211- return (TERM_WHITE);
212-}
213-
214-
215-/*!
216- * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
217- * Find the attr/char pair to use for a spell effect
218- * @param y 始点Y座標
219- * @param x 始点X座標
220- * @param ny 終点Y座標
221- * @param nx 終点X座標
222- * @param typ 魔法の効果属性
223- * @return 方向キャラID
224- * @details
225- * <pre>
226- * It is moving (or has moved) from (x,y) to (nx,ny).
227- * If the distance is not "one", we (may) return "*".
228- * </pre>
229- */
230-u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
231-{
232- int base;
233-
234- byte k;
235-
236- TERM_COLOR a;
237- SYMBOL_CODE c;
238-
239- /* No motion (*) */
240- if ((ny == y) && (nx == x)) base = 0x30;
241-
242- /* Vertical (|) */
243- else if (nx == x) base = 0x40;
244-
245- /* Horizontal (-) */
246- else if (ny == y) base = 0x50;
247-
248- /* Diagonal (/) */
249- else if ((ny - y) == (x - nx)) base = 0x60;
250-
251- /* Diagonal (\) */
252- else if ((ny - y) == (nx - x)) base = 0x70;
253-
254- /* Weird (*) */
255- else base = 0x30;
256-
257- /* Basic spell color */
258- k = spell_color(typ);
259-
260- /* Obtain attr/char */
261- a = misc_to_attr[base + k];
262- c = misc_to_char[base + k];
263-
264- /* Create pict */
265- return (PICT(a, c));
266-}
267-
268-
26984
27085 /*
27186 * Mega-Hack -- track "affected" monsters (see "project()" comments)
Show on old repository browser