2 Copyright (C) 2004-2011 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.
23 void addLineDef(const char *name, const char *linkName, const char *message, int x, int y, int width, int height, bool active)
25 LineDef *lineDef = new LineDef();
27 lineDef->set(name, linkName, message, x, y, width, height);
28 lineDef->activated = active;
30 map.addLineDef(lineDef);
33 void showMessageLineDef(const char *linkName, bool show)
35 LineDef *lineDef = (LineDef*)map.lineList.getHead();
37 while (lineDef->next != NULL)
39 lineDef = (LineDef*)lineDef->next;
41 if (strcmp(lineDef->linkName, linkName) == 0)
42 lineDef->activated = show;
48 LineDef *lineDef = (LineDef*)map.lineList.getHead();
52 while (lineDef->next != NULL)
54 lineDef = (LineDef*)lineDef->next;
56 if (lineDef->activated)
59 x = (int)(lineDef->x - engine.playerPosX);
60 y = (int)(lineDef->y - engine.playerPosY);
65 if ((absX < 800) && (absY < 600))
68 graphics.drawRect(x, y, lineDef->width, lineDef->height, graphics.red, graphics.screen);
71 if (player.health < 1)
76 if (Collision::collision(player.x + player.dx, player.y + player.dy, player.width, player.height, lineDef->x, lineDef->y, lineDef->width, lineDef->height))
78 if ((strcmp(lineDef->name, "Exit") == 0) && (!requiredObjectivesCompleted()))
80 config.resetControl(CONTROL::LEFT);
81 config.resetControl(CONTROL::RIGHT);
83 if (player.dx > 0) player.x = (lineDef->x - player.width) - 2;
84 if (player.dx < 0) player.x = (lineDef->x + lineDef->width + 2);
88 if (!map.isBossMission)
90 engine.setInfoMessage("Can't Exit Yet - Objectives Not Met", 1, INFO_HINT);
96 if (strcmp(lineDef->name, "Message") == 0)
98 engine.setInfoMessage(lineDef->activateMessage, 1, INFO_HINT);
99 if (strcmp(lineDef->linkName, "@none@") == 0)
101 lineDef->activated = true;
104 else if (strcmp(lineDef->name, "PlayerOut") == 0)
106 if (game.missionOver == 0)
111 if (player.health > 0)
113 game.setMissionOver(MIS_PLAYEROUT);
117 game.setMissionOver(MIS_PLAYERDEAD);
120 else if (strcmp(lineDef->name, "CheckPoint") == 0)
122 game.setObjectiveCheckPoint();
123 engine.setInfoMessage("Checkpoint Reached", 9, INFO_OBJECTIVE);
124 lineDef->activated = true;
126 else if (strcmp(lineDef->name, "ActivateBoss") == 0)
128 map.mainBossPart->active = true;
129 lineDef->activated = true;
133 checkObjectives(lineDef->name, true);
134 activateTrigger(lineDef->linkName, lineDef->activateMessage, true);
135 lineDef->activated = true;
137 if (strcmp(lineDef->name, "StealCrystal") == 0)
140 lineDef->activated = true;