-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWoodRot.asc
512 lines (471 loc) · 17.5 KB
/
WoodRot.asc
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
DynamicSprite *SprFPV;
ObjectPosition *playerEye;
export playerEye;
LevelObjectClass *MobClass; // temporary placeholder class for Mobs
WoodRotAI *Mobs[];
static void WoodRotGame::DrawGrid(DrawingSurface *dest, int x, int y, int w, int h) {
DrawingSurface *ds = SprFPV.GetDrawingSurface();
FirstPersonView.DrawGridFrame(ds, 12, 14);
FirstPersonView.DrawViewport(ds, 15);
ds.Release();
dest.DrawImage(x, y, SprFPV.Graphic);
}
static void WoodRotGame::DrawPlayerView(DrawingSurface *dest, int x, int y, int w, int h) {
// TODO: think of ways to optimize this, to not to reconstruct whole scene each time;
// but this may be difficult because of the animating tiles, so .... idk.
DrawingSurface *ds = SprFPV.GetDrawingSurface();
ds.Clear(0);
//FirstPersonView.DrawGridFrame(ds, 12, 14);
ds.Release();
dest.DrawImage(x, y, SprFPV.Graphic);
FirstPersonView.SetCameraOffset(x, y);
FirstPersonView.ConstructLocation(playerEye);
// Level objects
for (int i = 0; i < CLevel.LevelObjects.Length; ++i) {
LevelObject *obj = CLevel.LevelObjects[i];
if (obj != null) {
FirstPersonView.ConstructObject(playerEye, obj.Pos,
obj.View, obj.Loop, obj.Frame, obj.Def.Directional, obj.Over);
}
}
}
static bool WoodRotGame::TryWalkLocal(ObjectPosition *who, int dx, int dy) {
Point *ptoff = Level.ObjectDeltaToMap(who, dx, dy);
return WoodRotGame.TryWalkAbs(who, ptoff.x, ptoff.y);
}
static bool WoodRotGame::TryWalkAbs(ObjectPosition *who, int dx, int dy) {
int final_x = who.X + dx;
int final_y = who.Y + dy;
readonly int ddx = Maths.Sign(dx);
readonly int ddy = Maths.Sign(dy);
//System.Log(eLogDebug, "who = %d,%d, final = %d,%d, ddx = %d,%d", who.X, who.Y, final_x, final_y, ddx, ddy);
while (who.X != final_x || who.Y != final_y) {
int old_x = who.X;
int old_y = who.Y;
int test_x = who.X + ddx;
int test_y = who.Y + ddy;
//System.Log(eLogDebug, "test = %d,%d", test_x, test_y);
if (test_x < 0 || test_x >= CLevel.MapWidth ||
test_y < 0 || test_y >= CLevel.MapHeight) {
//System.Log(eLogDebug, "out of bounds");
return false;
}
// TODO: test passability bits
if (CLevel.CellPassable[test_y * CLevel.MapWidth + test_x] > 0) {
//System.Log(eLogDebug, "impassable");
return false;
}
who.X = test_x;
who.Y = test_y;
// Trigger any actions on move
CLevel.Trigger(who, old_x, old_y, eCmdTrigger_Enter);
// Test if the trigger moved us elsewhere, if so - stop there
if (who.X != test_x || who.Y != test_y) {
return true;
}
}
//System.Log(eLogDebug, "success");
return true;
}
static ObjectDirection WoodRotGame::Turn(ObjectPosition *who, bool clockwise) {
int dir = clockwise ? who.Dir + 1 : who.Dir - 1;
if (dir < eDirNorth) {
dir = eDirWest;
} else if (dir > eDirWest) {
dir = eDirNorth;
}
who.Dir = dir;
return dir;
}
static ObjectDirection WoodRotGame::Face(ObjectPosition *who, ObjectDirection dir) {
who.Dir = dir;
return dir;
}
static ObjectDirection WoodRotGame::FaceDeltaPos(ObjectPosition *who, int dx, int dy) {
if (dx > 0) {
return WoodRotGame.Face(who, eDirEast);
} else if (dx < 0) {
return WoodRotGame.Face(who, eDirWest);
} else if (dy > 0) {
return WoodRotGame.Face(who, eDirSouth);
} else {
return WoodRotGame.Face(who, eDirNorth);
}
}
static void WoodRotGame::AddAI(WoodRotAI *ai) {
int index = Array_TryAdd(Mobs, ai);
if (index < 0) {
int old_len = Array_SafeLength(Mobs);
WoodRotAI *new_arr[] = new WoodRotAI[old_len + 10];
Array_Copy(new_arr, Mobs, old_len);
new_arr[old_len] = ai;
Mobs = new_arr;
}
// Register this AI's level object in level
CLevel.AddObject(ai.LObject);
}
static void WoodRotGame::TickAI() {
for (int i = 0; i < Mobs.Length; ++i) {
if (Mobs[i] != null) {
Mobs[i].Tick();
}
}
}
static WoodRotAI *WoodRotAI::Create(DSM_StateList *list, ObjectPosition *pos) {
// fixme position in the world
WoodRotAI *ai = new WoodRotAI;
ai.Runner = DSM_StateRunner.Create(list);
// TODO: pass a real customized level object class later
ai.LObject = LevelObject.Create2(MobClass, pos);
ai.LObject.View = ai.Runner.View;
ai.LObject.Loop = ai.Runner.Loop;
ai.LObject.Frame = ai.Runner.Frame;
ai.Tick(); // fixme, need to start somewhere
return ai;
}
void WoodRotAI::Tick() {
String action = Runner.Tick();
if (Runner.Frame >= 0) {
// We are doing a directional loop draw in FirstPersonView
}
if (!String.IsNullOrEmpty(action)) {
Action(action);
}
// Update level object
LObject.View = Runner.View;
LObject.Loop = Runner.Loop;
LObject.Frame = Runner.Frame;
}
void WoodRotAI::Action(String action) {
if (action.CompareTo("A_Decide") == 0) {
int rand = Random(2);
switch (rand) {
case 0: Runner.Goto("Idle"); break;
case 1: Runner.Goto("Walk"); break;
case 2: Runner.Goto("Speak"); break;
default: break;
}
} else if (action.CompareTo("A_Step") == 0) {
if (WalkTarget == null) {
WalkTarget = ObjectPosition.Create(
Random(CLevel.MapWidth - 1),
Random(CLevel.MapHeight - 1),
eDirNorth + Random(eDirWest - eDirNorth));
//System.Log(eLogDebug, "AI: new WalkTarget = %d,%d", WalkTarget.X, WalkTarget.Y);
}
//System.Log(eLogDebug, "AI: at %d,%d, WT = %d,%d", Pos.X, Pos.Y, WalkTarget.X, WalkTarget.Y);
int posx = LObject.Pos.X;
int posy = LObject.Pos.Y;
if (WalkTarget.X == posx && WalkTarget.Y == posy) {
//System.Log(eLogDebug, "AI: reached the WT");
WalkTarget = null;
return;
}
int dx = Maths.Sign(WalkTarget.X - posx);
int dy = Maths.Sign(WalkTarget.Y - posy);
//System.Log(eLogDebug, "AI: try walk dx,dy = %d,%d", dx, dy);
// FIXME: passability bit check
dx = dx * !CLevel.CellPassable[posy * CLevel.MapWidth + posx + dx];
dy = dy * !CLevel.CellPassable[(posy + dy) * CLevel.MapWidth + posx];
bool res;
if (dx != 0 && (dy == 0 || Random(1) == 0)) {
WoodRotGame.FaceDeltaPos(LObject.Pos, dx, 0);
res = WoodRotGame.TryWalkAbs(LObject.Pos, dx, 0);
//System.Log(eLogDebug, "AI: dx failed");
}
if (dy != 0 && !res) {
WoodRotGame.FaceDeltaPos(LObject.Pos, 0, dy);
res = WoodRotGame.TryWalkAbs(LObject.Pos, 0, dy);
//System.Log(eLogDebug, "AI: dy failed");
}
if (!res) {
//System.Log(eLogDebug, "AI: failed, reset WT");
WalkTarget = null;
return;
}
} else if (action.CompareTo("A_Speak") == 0) {
}
}
// Helper functions for setting up complex level objects.
// Would need to rewrite all this later.
//
void MakeTeleport(int at_x, int at_y, LevelObjectClass fx_def,
int to_x, int to_y, ObjectDirection to_dir) {
// Make fx object
LevelObject obj = LevelObject.Create(fx_def, at_x, at_y, eDirNorth);
CLevel.AddObject(obj);
// Add cell command
CellCommand ccmd = new CellCommand;
ccmd.Trigger = eCmdTrigger_Enter;
ccmd.Cmd.Type = eCmdGotoCell;
ccmd.Cmd.Args[0] = to_x;
ccmd.Cmd.Args[1] = to_y;
ccmd.Cmd.Args[2] = to_dir;
CLevel.CellTriggers[at_y * CLevel.MapWidth + at_x] = ccmd;
}
void SetupSchema()
{
CV_Schema.SetView(WoodRotConstants.VIEWPORT_WIDTH,
WoodRotConstants.VIEWPORT_HEIGHT,
WoodRotConstants.VIEW_ROWS,
WoodRotConstants.VIEW_COLS);
int x[WoodRotConstants.VIEW_ROWS, WoodRotConstants.VIEW_COLS + 1];
int y[WoodRotConstants.VIEW_ROWS, 2];
x[0, 0] = -1364; x[0, 1] = -1087; x[0, 2] = -809; x[0, 3] = -532; x[0, 4] = -255; x[0, 5] = 21; x[0, 6] = 298; x[0, 7] = 575; x[0, 8] = 852; x[0, 9] = 1129; x[0, 10] = 1407; x[0, 11] = 1684;
x[1, 0] = -602; x[1, 1] = -463; x[1, 2] = -324; x[1, 3] = -186; x[1, 4] = -47; x[1, 5] = 90; x[1, 6] = 229; x[1, 7] = 367; x[1, 8] = 506; x[1, 9] = 644; x[1, 10] = 783; x[1, 11] = 922;
x[2, 0] = -348; x[2, 1] = -255; x[2, 2] = -163; x[2, 3] = -70; x[2, 4] = 21; x[2, 5] = 113; x[2, 6] = 206; x[2, 7] = 298; x[2, 8] = 390; x[2, 9] = 483; x[2, 10] = 575; x[2, 11] = 668;
x[3, 0] = -221; x[3, 1] = -151; x[3, 2] = -82; x[3, 3] = -13; x[3, 4] = 56; x[3, 5] = 125; x[3, 6] = 194; x[3, 7] = 263; x[3, 8] = 333; x[3, 9] = 402; x[3, 10] = 471; x[3, 11] = 541;
x[4, 0] = -144; x[4, 1] = -89; x[4, 2] = -33; x[4, 3] = 21; x[4, 4] = 76; x[4, 5] = 132; x[4, 6] = 187; x[4, 7] = 243; x[4, 8] = 298; x[4, 9] = 353; x[4, 10] = 409; x[4, 11] = 464;
x[5, 0] = -94; x[5, 1] = -47; x[5, 2] = -1; x[5, 3] = 44; x[5, 4] = 90; x[5, 5] = 136; x[5, 6] = 183; x[5, 7] = 229; x[5, 8] = 275; x[5, 9] = 321; x[5, 10] = 367; x[5, 11] = 414;
y[0, 0] = 238; y[1, 0] = 169; y[2, 0] = 146; y[3, 0] = 134; y[4, 0] = 127; y[5, 0] = 123;
for (int row = 0; row < WoodRotConstants.VIEW_ROWS; row++) {
y[row, 1] = 100 - (y[row, 0] - 100); // assume perspective is y-centered
}
// Assign schema strips
for (int row = 0; row < WoodRotConstants.VIEW_ROWS; row++) {
int xx[] = new int[WoodRotConstants.VIEW_COLS + 1];
for (int col = 0; col < WoodRotConstants.VIEW_COLS + 1; col++) {
xx[col] = x[row, col];
}
CV_Schema.SetStrip(row, y[row, 1], y[row, 0], xx);
}
// NOTE: we do not alloc the last vertices strip for the farthest cell row,
// because we only want to draw front walls of that row
CV_Schema.SetScaling(3.0, 0.75, 1.0);
CV_Schema.Finalize();
}
function game_start()
{
SetupSchema();
SprFPV = DynamicSprite.Create(WoodRotConstants.VIEWPORT_WIDTH, WoodRotConstants.VIEWPORT_HEIGHT);
// FIXME: hide array allocations in the Level's function, make writeprotected?
CLevel.MapWidth = 20;
CLevel.MapHeight = 10;
CLevel.CellPassable = new char[CLevel.MapWidth * CLevel.MapHeight];
CLevel.CellTiles = new CellTile[CLevel.MapWidth * CLevel.MapHeight];
CLevel.CellTriggers = new CellCommand[CLevel.MapWidth * CLevel.MapHeight];
// Prepare tile (texture) definitions
const int num_textures = 6;
CLevel.TileDefs = new TileDefinition[num_textures];
// Base floor & ceiling for empty cells
TileDefinition td0_baseflats = new TileDefinition;
td0_baseflats.HasTextures = eTxTypeFlag_FlatMask;
td0_baseflats.Color1[eTxType_Floor] = Game.GetColorFromRGB(128, 128, 64);
td0_baseflats.Color2[eTxType_Floor] = Game.GetColorFromRGB(96, 96, 32);
td0_baseflats.Color1[eTxType_Ceil] = Game.GetColorFromRGB(128, 128, 196);
td0_baseflats.Color2[eTxType_Ceil] = Game.GetColorFromRGB(96, 96, 196);
CLevel.TileDefs[0] = td0_baseflats;
// Base wall tile
TileDefinition td1_basewalls = new TileDefinition;
td1_basewalls.HasTextures = eTxTypeFlag_WallMask;
td1_basewalls.Color1[eTxType_Front] = Game.GetColorFromRGB(168, 168, 168);
td1_basewalls.Color2[eTxType_Front] = Game.GetColorFromRGB(112, 112, 112);
td1_basewalls.Color1[eTxType_Side] = Game.GetColorFromRGB(128, 128, 128);
td1_basewalls.Color2[eTxType_Side] = Game.GetColorFromRGB(96, 96, 96);
CLevel.TileDefs[1] = td1_basewalls;
// Random different floor tile
TileDefinition td2_flooralt = new TileDefinition;
td2_flooralt.HasTextures = eTxTypeFlag_FlatMask;
td2_flooralt.Color1[eTxType_Floor] = Game.GetColorFromRGB(128, 64, 64);
td2_flooralt.Color2[eTxType_Floor] = Game.GetColorFromRGB(96, 48, 48);
CLevel.TileDefs[2] = td2_flooralt;
// Animated floor (blue, water)
TileDefinition td3_floorblueanim = new TileDefinition;
td3_floorblueanim.HasTextures = eTxTypeFlag_FlatMask;
TextureSequence txseq = new TextureSequence;
txseq.Type = eTxSeq_Normal;
txseq.Color1 = new int[4];
txseq.Color2 = new int[4];
for (int i = 0; i < 4; ++i) {
txseq.Color1[i] = Game.GetColorFromRGB(32 + i * 16, 32 + i * 16, 192);
txseq.Color2[i] = Game.GetColorFromRGB(32 + i * 8, 32 + i * 8, 168);
}
txseq.FrameTime = 16;
td3_floorblueanim.Seq[eTxType_Floor] = txseq;
CLevel.TileDefs[3] = td3_floorblueanim;
// Teleport pad tile
TileDefinition td4_floortelepad = new TileDefinition;
td4_floortelepad.HasTextures = eTxTypeFlag_FlatMask;
txseq = new TextureSequence;
txseq.Type = eTxSeq_Normal;
txseq.Color1 = new int[7];
txseq.Color2 = new int[7];
for (int i = 0; i < 7; ++i) {
txseq.Color1[i] = Game.GetColorFromRGB(192, 32 + i * 16, 32 + i * 16);
txseq.Color2[i] = Game.GetColorFromRGB(168, 32 + i * 8, 32 + i * 8);
}
txseq.FrameTime = 8;
td4_floortelepad.Seq[eTxType_Floor] = txseq;
CLevel.TileDefs[4] = td4_floortelepad;
// Dummy Pillar
TileDefinition td5_pillar = new TileDefinition;
td5_pillar.HasTextures = eTxTypeFlag_Base;
td5_pillar.Sprite[eTxType_Base] = 40;
td5_pillar.Scaled = true; // FIXME: works horribly
td5_pillar.OriginY = 7;
CLevel.TileDefs[5] = td5_pillar;
// Cell object definitions
CLevel.LevelObjectTypes = new LevelObjectClass[2];
// Ground teleport effect
CLevel.LevelObjectTypes[0] = new LevelObjectClass;
CLevel.LevelObjectTypes[0].Name = "CellTeleportFx";
CLevel.LevelObjectTypes[0].View = VCELLTELEPORT;
// Active teleporting effect
CLevel.LevelObjectTypes[1] = new LevelObjectClass;
CLevel.LevelObjectTypes[1].Name = "ObjTeleportFx";
CLevel.LevelObjectTypes[1].View = VDESTTELEFX;
CLevel.LevelObjectTypes[1].AnimateOnceAndRemove = true;
CLevel.TeleportFx = CLevel.LevelObjectTypes[1];
// This is alot of extra pointers, but we do this for simplicity
CLevel.LevelObjects = new LevelObject[CLevel.MapWidth * CLevel.MapHeight];
String mappass = ""
"11111111111111111111"
"10000000011000000001"
"10101010011000000001"
"10101011011000000001"
"10100000000000000001"
"10101011011000000001"
"10101010011000000001"
"10111011011000000001"
"10000000011000000001"
"11111111111111111111"
;
String mapbase = ""
"11111111111111111111"
"10000000011000000001"
"10101010011000000001"
"10101011011000000001"
"10100000000000000001"
"10101011011000000001"
"10101010011000000001"
"10111011011000000001"
"10000000011000000001"
"11111111111111111111"
;
String mapfloor = ""
"////////////////////"
"/20002002//40000004/"
"/00000000//00000000/"
"/00000000//00333300/"
"/000000000000333300/"
"/00000000//00333300/"
"/00000000//00333300/"
"/00000000//00000000/"
"/20002002//40000004/"
"////////////////////"
;
String mapfloorframe = ""
"////////////////////"
"///////////0//////0/"
"////////////////////"
"/////////////0123///"
"/////////////1123///"
"/////////////2223///"
"/////////////3333///"
"////////////////////"
"///////////0//////0/"
"////////////////////"
;
String mapceil = ""
"////////////////////"
"/00000000//00000000/"
"/00000000//00000000/"
"/00000000//00000000/"
"/000000000000000000/"
"/00000000//00000000/"
"/00000000//00000000/"
"/00000000//00000000/"
"/00000000//00000000/"
"////////////////////"
;
String mapcellobjects = ""
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
"////////////////////"
;
for (int i = 0; i < mappass.Length; ++i) {
CLevel.CellPassable[i] = mappass.Chars[i] - '0';
CLevel.CellTiles[i] = new CellTile;
CLevel.CellTiles[i].Floor.DefID = mapfloor.Chars[i] - '0';
CLevel.CellTiles[i].Floor.Frame = mapfloorframe.Chars[i] - '0';
CLevel.CellTiles[i].Ceil.DefID = mapceil.Chars[i] - '0';
CLevel.CellTiles[i].Base.DefID = mapbase.Chars[i] - '0';
// Simple cell objects
int obj_def = mapcellobjects.Chars[i] - '0';
if (obj_def >= 0) {
LevelObject obj = LevelObject.Create(CLevel.LevelObjectTypes[obj_def],
i % CLevel.MapWidth, i / CLevel.MapWidth, eDirNorth);
CLevel.LevelObjects[i] = obj;
System.Log(eLogDebug, "Created cell object: %s, at %d,%d, vlf: %d,%d,%d",
obj.Def.Name, obj.Pos.X, obj.Pos.Y, obj.View, obj.Loop, obj.Frame);
}
}
// It's too difficult to configure using our ASCII arrays,
// so just add these explicitly... like this for now
LevelObjectClass teleport_fx = CLevel.LevelObjectTypes[0];
MakeTeleport(11, 1, teleport_fx, 18, 1, eDirWest);
MakeTeleport(18, 1, teleport_fx, 11, 1, eDirEast);
MakeTeleport(11, 8, teleport_fx, 18, 8, eDirWest);
MakeTeleport(18, 8, teleport_fx, 11, 1, eDirEast);
String mob_ai = ""
/* ---- NOT WORKING AND NOT ENOUGH SPARE TIME TO FIX ----
"STATE Idle \n"
" LOOP 0 0,1 4 \n"
" LOOP 0 0 4 A_Decide 0.1 \n"
" GOTO 1 Idle \n"
"STATE Walk \n"
" LOOP 0 0,1,2, 4 \n"
" LOOP 0 3 4 A_Step 1 \n"
" LOOP 0 4,5,6 4 \n"
" GOTO 0.05 Idle \n"
" GOTO 1 Walk \n"
"STATE Speak \n"
" LOOP 0 0,1 4 \n"
" GOTO 1 Idle \n"
*/
"STATE Walk \n"
" LOOP 0 0,1,2, 4 \n"
" LOOP 0 3 4 A_Step 1 \n"
" LOOP 0 4,5,6 4 \n"
" GOTO 1 Walk \n"
;
DSM_StateList *mob_list = DSM_StateList.CreateFromText(VDUMMYNPC1, mob_ai);
MobClass = new LevelObjectClass;
MobClass.Directional = true;
MobClass.Name = "WoodRotAI";
WoodRotGame.AddAI(
WoodRotAI.Create(mob_list, ObjectPosition.Create(1, 1, eDirEast)));
WoodRotGame.AddAI(
WoodRotAI.Create(mob_list, ObjectPosition.Create(8, 1, eDirWest)));
WoodRotGame.AddAI(
WoodRotAI.Create(mob_list, ObjectPosition.Create(1, 8, eDirEast)));
WoodRotGame.AddAI(
WoodRotAI.Create(mob_list, ObjectPosition.Create(8, 8, eDirEast)));
playerEye = ObjectPosition.Create(5, 8, eDirNorth);
//FirstPersonView.SetHalfWallMode(true);
FirstPersonView.GenerateAssetsForLevel();
}
function repeatedly_execute()
{
Level.Tick();
WoodRotGame.TickAI();
}
function on_event(EventType event, int data)
{
if (event == eEventEnterRoomBeforeFadein) {
// This is a to clip unnecessary wall bits seen at the screen sides;
// TODO: correct the schema grid instead, and let FirstPersonView handle this?
// FIXME: also, this should be in game start, but there seem to be a bug
// in AGS, that resets camera after game start(?)
Screen.AutoSizeViewportOnRoomLoad = false;
Screen.Viewport.SetPosition((Screen.Width - 285) / 2, (Screen.Height - 204) / 2, 285, 204);
Game.Camera.SetSize(285, 204);
}
}