2
Copyright (C) 2006 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.
20
#include "../headers.h"
43
void Trigger::addLocationBox(const char *name, Vector position, Vector v)
45
TriggerBoxEntry *entry = new TriggerBoxEntry();
48
entry->position = position;
49
entry->boundingBox.mins -= v;
50
entry->boundingBox.maxs += v;
52
boundingBoxList.add(entry);
54
debug(("addLocationBox() - Added '%s'\n", name));
57
void Trigger::clearLocationBoxes()
59
boundingBoxList.clear();
62
void Trigger::assignTriggerLocation()
64
for (TriggerBoxEntry *entry = (TriggerBoxEntry*)boundingBoxList.getFirstElement() ; entry != NULL ; entry = (TriggerBoxEntry*)entry->next)
66
if (entry->name == name.getText())
68
debug(("Trigger::assignTriggerLocation - Assigning box to trigger '%s'\n", name.getText()));
70
boundingBox = entry->boundingBox;
71
position = entry->position;
76
void Trigger::load(Properties *props)
78
name = props->getString("name", name.getText());
79
targetName = props->getString("targetName", targetName.getText());
81
active = props->getInt("active", active);
83
targetValue = props->getInt("targetValue", targetValue);
85
timeLimit = props->getInt("timeLimit", timeLimit);
87
objectiveId = props->getInt("objectiveId", objectiveId);
89
position = props->getVector("position", position);
90
boundingBox.mins = props->getVector("bbMins", boundingBox.mins);
91
boundingBox.maxs = props->getVector("bbMaxs", boundingBox.maxs);
94
void Trigger::save(FILE *fp)
98
props.setName("Trigger");
100
props.setProperty("name", name.getText());
101
props.setProperty("targetName", targetName.getText());
103
props.setProperty("active", active);
104
props.setProperty("type", type);
106
props.setProperty("targetValue", targetValue);
108
props.setProperty("timeLimit", timeLimit);
110
props.setProperty("action", action);
112
props.setProperty("objectiveId", objectiveId);
114
props.setProperty("position", position);
115
props.setProperty("bbMins", boundingBox.mins);
116
props.setProperty("bbMaxs", boundingBox.maxs);
121
List Trigger::boundingBoxList;