2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2002, 2003 Gordon McNutt
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
20 // gmcnutt@users.sourceforge.net
29 static SDL_Rect windRect;
30 static int windDirection;
31 static int windDuration;
33 void windAdvanceTurns(void)
35 if (windDuration > 0) {
40 if (rand() % 100 < WIND_CHANGE_PROBABILITY) {
41 int dir = rand() % NUM_WIND_DIRECTIONS;
42 windSetDirection(dir, 10);
53 windDirection = NORTH;
59 void windSetDirection(int dir, int dur)
61 if (HERE == dir || dir >= NUM_WIND_DIRECTIONS) {
65 if (dir != windDirection) {
66 log_msg("É÷¸þ¤¤¬%s¤ËÊѤï¤Ã¤¿¡£", directionToString(dir));
74 int windGetDirection(void)
79 void windRepaint(void)
81 screenErase(&windRect);
82 screenPrint(&windRect, SP_CENTERED, "É÷¸þ¤:%s",
83 directionToString(windDirection));
84 screenUpdate(&windRect);
87 void windSave(struct save *save)
89 save->write(save, "(kern-set-wind %d %d)\n", windDirection,