2 Copyright (C) 2004 Parallel Realities
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "resources.h"
23 void loadSound(int index, const char *filename)
25 audio.loadSound(index, filename);
27 graphics.showLoading(1, 30);
30 void loadSprite(const char *token)
35 char filename[8][100];
41 sscanf(token, "%s %d %d %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d", name, &hue, &sat, &val, filename[0], &frameTime[0], filename[1], &frameTime[1], filename[2], &frameTime[2], filename[3], &frameTime[3], filename[4], &frameTime[4], filename[5], &frameTime[5], filename[6], &frameTime[6], filename[7], &frameTime[7]);
43 sprite = graphics.addSprite(name);
49 if (strcmp(filename[i], "@none@") == 0)
52 sprite->setFrame(i, graphics.loadImage(filename[i], hue, sat, val), frameTime[i]);
63 graphics.resetLoading();
68 graphics.quickSprite("cheatHeader", graphics.loadImage("gfx/main/cheats.png"));
69 graphics.quickSprite("optionsHeader", graphics.loadImage("gfx/main/options.png"));
70 graphics.quickSprite("joystickHeader", graphics.loadImage("gfx/main/joystickConfig.png"));
71 graphics.quickSprite("keyHeader", graphics.loadImage("gfx/main/keyConfig.png"));
72 graphics.quickSprite("optionsBackground", graphics.loadImage("gfx/main/optionsBackground.png"));
74 SDL_FillRect(graphics.screen, NULL, graphics.black);
75 graphics.drawString(_("Loading..."), 320, 440, TXT_CENTERED, graphics.screen);
76 graphics.showLoading(0, 0);
77 graphics.updateScreen();
79 if (!engine.loadDefines())
80 graphics.showErrorAndExit("Could not load map define list '%s'", "data/defines.h");
82 if (!engine.loadData("data/mainSprites"))
83 graphics.showErrorAndExit(ERR_FILE, "data/mainSprites");
85 char *token = strtok((char*)engine.dataBuffer, "\n");
89 if (strcmp(token, "@EOF@") == 0)
96 token = strtok(NULL, "\n");
98 graphics.showLoading(1, 20);
101 loadSound(SND_WATERIN, "sound/waterIn.wav");
102 loadSound(SND_WATEROUT, "sound/waterOut.wav");
103 loadSound(SND_ITEM, "sound/item.wav");
104 loadSound(SND_PISTOL, "sound/pistol.wav");
105 loadSound(SND_RICO1, "sound/rico1.wav");
106 loadSound(SND_RICO2, "sound/rico2.wav");
107 loadSound(SND_MACHINEGUN, "sound/machinegun.wav");
108 loadSound(SND_DEATH1, "sound/death1.wav");
109 loadSound(SND_DEATH2, "sound/death2.wav");
110 loadSound(SND_DEATH3, "sound/death3.wav");
111 loadSound(SND_GRENADE, "sound/grenade.wav");
112 loadSound(SND_ROCKET, "sound/rocket.wav");
113 loadSound(SND_FIREBALL, "sound/fireball.wav");
114 loadSound(SND_HIT, "sound/punch.wav");
115 loadSound(SND_SPLAT, "sound/splat.wav");
116 loadSound(SND_POP, "sound/pop1.wav");
117 loadSound(SND_TELEPORT1, "sound/teleport1.wav");
118 loadSound(SND_TELEPORT2, "sound/teleport2.wav");
119 loadSound(SND_TELEPORT3, "sound/teleport3.wav");
120 loadSound(SND_GETWEAPON, "sound/weaponPickup.wav");
121 loadSound(SND_LASER, "sound/laser.wav");
122 loadSound(SND_ELECDEATH1, "sound/elecDeath1.wav");
123 loadSound(SND_ELECDEATH2, "sound/elecDeath2.wav");
124 loadSound(SND_ELECDEATH3, "sound/elecDeath3.wav");
125 loadSound(SND_LOCKEDDOOR, "sound/doorLocked.wav");
126 loadSound(SND_OPENDOOR, "sound/doorOpen.wav");
127 loadSound(SND_DOOROPENED, "sound/doorOpened.wav");
128 loadSound(SND_SWITCH1, "sound/switch.wav");
129 loadSound(SND_SWITCH2, "sound/switch.wav");
130 loadSound(SND_DROWNING, "sound/drowning.wav");
131 loadSound(SND_GULP, "sound/gulp.wav");
132 loadSound(SND_EAT, "sound/eat.wav");
133 loadSound(SND_THROW, "sound/throw.wav");
134 loadSound(SND_GRBOUNCE, "sound/grenadeBounce.wav");
135 loadSound(SND_SPREADGUN, "sound/plasma.wav");
136 loadSound(SND_STONEBREAK, "sound/stoneBreak.wav");
137 loadSound(SND_ELECTRICITY1, "sound/electricity1.wav");
138 loadSound(SND_ELECTRICITY2, "sound/electricity2.wav");
139 loadSound(SND_ELECTRICITY3, "sound/electricity3.wav");
140 loadSound(SND_CLANG, "sound/clang.wav");
141 loadSound(SND_FIRECRACKLE, "sound/fireCrackle.wav");
142 loadSound(SND_CLOCK, "sound/clock.wav");
146 graphics.showLoading(35, 35);
150 graphics.showLoading(40, 40);
154 graphics.showLoading(45, 45);
156 graphics.loadMapTiles("gfx/common");
158 player.setSprites(graphics.getSprite("BobRight", true), graphics.getSprite("BobLeft", true), graphics.getSprite("BobSpin", true));
160 graphics.showLoading(50, 50);
162 loadMapData(game.mapName);
164 graphics.showLoading(100, 100);
167 graphics.showLoading(100, 100);
171 createBoss(game.stageName);
173 game.canContinue = 0;
175 // We don't need this anymore. Remove it to free up some memory...
176 engine.defineList.clear();