-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCarSpawnerObj.h
110 lines (100 loc) · 3.1 KB
/
CarSpawnerObj.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* This file is part of TSRE5.
*
* TSRE5 - train sim game engine and MSTS/OR Editors.
* Copyright (C) 2016 Piotr Gadecki <[email protected]>
*
* Licensed under GNU General Public License 3.0 or later.
*
* See LICENSE.md or https://www.gnu.org/licenses/gpl.html
*/
#ifndef CARSPAWNEROBJ_H
#define CARSPAWNEROBJ_H
#include "WorldObj.h"
#include <QString>
#include "FileBuffer.h"
class TrackItemObj;
class OglObj;
class SFile;
class CarSpawnerObj : public WorldObj {
public:
struct CarSpawnerList {
QString name;
bool ignoreXRot = false;
QVector<QString> carName;
QVector<int> val;
};
struct SimpleCar {
bool loaded;
int x;
int y;
QString carName;
int shapeId = -1;
SFile* shapePointer;
unsigned int shapeState;
bool ignoreXRot = false;
int trNodeId;
float trPosMb;
float trPosMe;
float direction;
float speed;
float drawPosition[7];
SimpleCar();
SimpleCar(QString name);
~SimpleCar();
void updateSim(float deltaTime);
void render(GLUU *gluu, int selectionColor);
};
static void LoadCarSpawnerList();
static QVector<CarSpawnerList> carSpawnerList;
CarSpawnerObj();
CarSpawnerObj(const CarSpawnerObj& o);
WorldObj* clone();
virtual ~CarSpawnerObj();
void load(int x, int y);
bool allowNew();
void set(int sh, FileBuffer* val);
void set(QString sh, FileBuffer* data);
void save(QTextStream* out);
bool select(int value);
bool isTrackItem();
bool containsTrackItem(int tdbId, int id);
void addTrackItemIdOffset(unsigned int trackOffset, unsigned int roadOffset);
void getTrackItemIds(QVector<int> &ids, int tdbId);
void initTrItems(float* tpos);
void setPosition(int x, int z, float* p);
void translate(float px, float py, float pz);
float getCarNumber();
float getCarSpeed();
QString getCarListName();
void setCarListName(QString val);
float getLength();
void setCarNumber(float val);
void setCarSpeed(float val);
void deleteTrItems();
void expand();
int getDefaultDetailLevel();
void updateSim(float deltaTime);
void render(GLUU* gluu, float lod, float posx, float posz, float* playerW, float* target, float fov, int selectionColor, int renderMode);
private:
int trItemId[4];
int trItemIdCount = 0;
float carFrequency = 5;
float carAvSpeed = 20;
TrackItemObj* spointer3d = NULL;
TrackItemObj* spointer3dSelected = NULL;
OglObj* line = NULL;
float* drawPositionB = NULL;
float* drawPositionE = NULL;
int rotB = 0;
int rotE = 0;
int selectionValue = 0;
QString carspawnerListName;
int carListId = 0;
float carsNewTime = 0;
float carFreq = 1;
QVector<SimpleCar> cars;
void renderTritems(GLUU* gluu, int selectionColor);
void makelineShape();
static void parseCarList(FileBuffer* data);
};
#endif /* CARSPAWNEROBJ_H */