-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewportRenderState.cpp
More file actions
144 lines (129 loc) · 4.73 KB
/
ViewportRenderState.cpp
File metadata and controls
144 lines (129 loc) · 4.73 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include "ViewportRenderState.h"
#include "ViewportRenderState.func.h"
#include "mmsystem.h"
ViewportRenderState::ViewportRenderState() { MACRO_CALL_MEMBER(ViewportRenderState_Func::_constructor_, this)(); }
// FUNCTION: STRONGHOLDCRUSADER 0x004e1fa0
ViewportRenderState* ViewportRenderState::_constructor_()
{
int iVar1;
int* piVar2;
DWORD t;
this->DAT_ViewportState.viewportX = 32;
this->DAT_ViewportState.viewportY = 8;
this->DAT_ViewportState.field4_0x10 = -1;
t = timeGetTime();
this->creationTime4 = t;
this->creationTime3 = t;
this->creationTime2 = t;
this->creationTime = t;
this->DAT_ViewportState.isZoomedOut = 0;
this->DAT_MapEditorDisplayLayer = 0;
this->field53_0x18b75c = 0;
this->field57_0x18b76c = 0;
this->field54_0x18b760 = 0;
this->field55_0x18b764 = 0;
this->field56_0x18b768 = 0;
this->DAT_ViewportState.field37_0x94 = 0;
this->value160 = 160;
this->value180 = 180;
this->value80 = 80;
this->value100 = 100;
this->unknownArray1Index = 1;
piVar2 = this->unknownTileArray3;
for (iVar1 = 45; iVar1 != 0; iVar1 = iVar1 + -1) {
*piVar2 = 0;
piVar2 = piVar2 + 1;
}
return this;
}
// FUNCTION: STRONGHOLDCRUSADER 0x00401000
BOOL ViewportRenderState::xyAreValid(uint x, uint y)
{
if (((x <= MAP_XY_LIMIT_INCLUSIVE) && (y <= MAP_XY_LIMIT_INCLUSIVE))
&& (this->DAT_BinaryTileMap400x400[y * MAP_XY_LIMIT + x] != '\0')) {
return 1;
}
return 0;
}
// FUNCTION: STRONGHOLDCRUSADER 0x00401040
int ViewportRenderState::translateXYToTile(int x, int y) { return this->translationMatrix[y].addXgetTile + x; }
// FUNCTION: STRONGHOLDCRUSADER 0x004092e0
int ViewportRenderState::meth_0x4092e0(int param_1, int param_2)
{
return param_1 - this->translationMatrix[param_2].addXgetTile;
}
// FUNCTION: STRONGHOLDCRUSADER 0x004e5dd0
void ViewportRenderState::setupMouseTileXY()
{
this->DAT_ViewportState.mouseTileX = 0;
this->DAT_ViewportState.mouseTileY = 0;
while (this->DAT_ViewportState.mouseTileY < 400) {
if (this->DAT_ViewportState.mouseAtomRefFloorTile
< this->translationMatrix[this->DAT_ViewportState.mouseTileY + 1].firstTileOfRow)
break;
this->DAT_ViewportState.mouseTileY = this->DAT_ViewportState.mouseTileY + 1;
};
this->DAT_ViewportState.mouseTileX = this->translationMatrix[this->DAT_ViewportState.mouseTileY].distanceToCenter
+ (this->DAT_ViewportState.mouseAtomRefFloorTile
- this->translationMatrix[this->DAT_ViewportState.mouseTileY].firstTileOfRow);
}
// FUNCTION: STRONGHOLDCRUSADER 0x004e5d80
void ViewportRenderState::setupMouseTileXY2()
{
this->DAT_ViewportState.mouseTileX = 0;
this->DAT_ViewportState.mouseTileY = 0;
while (this->DAT_ViewportState.mouseTileY < 400) {
if (this->DAT_ViewportState.mouseTile
< this->translationMatrix[this->DAT_ViewportState.mouseTileY + 1].firstTileOfRow)
break;
this->DAT_ViewportState.mouseTileY = this->DAT_ViewportState.mouseTileY + 1;
}
this->DAT_ViewportState.mouseTileX = this->translationMatrix[this->DAT_ViewportState.mouseTileY].distanceToCenter
+ (this->DAT_ViewportState.mouseTile
- this->translationMatrix[this->DAT_ViewportState.mouseTileY].firstTileOfRow);
}
// FUNCTION: STRONGHOLDCRUSADER 0x004e5a90
void ViewportRenderState::meth_0x4e5a90()
{
DWORD DVar1;
int* piVar2;
int iVar3;
DVar1 = timeGetTime();
this->field55_0x18b764 = 0;
if ((DVar1 - this->creationTime2) > this->value180) {
this->field55_0x18b764 = 1;
piVar2 = this->unknownArray2;
iVar3 = 0x2d;
this->creationTime2 = DVar1;
do {
*piVar2 = *piVar2 + 1;
piVar2 = piVar2 + 1;
iVar3 = iVar3 + -1;
} while (iVar3 != 0);
}
if ((DVar1 - this->creationTime3) > this->value80) {
this->field56_0x18b768 = this->field56_0x18b768 + 1;
this->creationTime3 = DVar1;
if (0x10 <= this->field56_0x18b768) {
this->field56_0x18b768 = 0;
}
}
if ((int)(DVar1 - this->creationTime4) > this->value100) {
this->field53_0x18b75c = this->field53_0x18b75c + 1;
this->creationTime4 = DVar1;
if (0x20 <= this->field53_0x18b75c) {
this->field53_0x18b75c = 0;
}
}
if ((int)(DVar1 - this->creationTime) > this->value160) {
this->field54_0x18b760 = this->field54_0x18b760 + 1;
if (0x24 <= this->field54_0x18b760) {
this->field54_0x18b760 = 0;
}
this->field57_0x18b76c = this->field57_0x18b76c + 1;
this->creationTime = DVar1;
if (0x200 <= this->field57_0x18b76c) {
this->field57_0x18b76c = 0;
}
}
}