Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
dp88_buildingScripts.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12
13#pragma once
14
15#include "LoopedAnimationController.h"
16
17
18// Define building child types
19#define BUILDING_CHILD_TYPE_GENERIC 0
20#define BUILDING_CHILD_TYPE_MINOR_WEAKPOINT 1
21#define BUILDING_CHILD_TYPE_MAJOR_WEAKPOINT 2
22#define BUILDING_CHILD_TYPE_CAPTUREPOINT 3
23
24
25/*------------------------
26Building Controller Script
27--------------------------*/
28
29class dp88_buildingScripts_controller : public ScriptImpClass
30{
31 // Struct to contain data for building children
32 struct ChildData
33 {
34 int objectId;
35 int type;
36 bool destroyed;
37
38 ChildData* operator= (ChildData* cd )
39 {
40 objectId = cd->objectId;
41 type = cd->type;
42 destroyed = false;
43 }
44 };
45
46 void Created( GameObject *obj );
47 void Destroyed( GameObject *obj );
48 void Killed( GameObject *obj, GameObject *killer );
49 void Custom( GameObject *obj, int type, int param, GameObject *sender );
50
51 // Array of data for child objects belonging to this building controller
52 int numChildren;
53 ChildData* children;
54
59 int findChild ( int objectId );
60
61 // Is the building online?
62 bool buildingOnline;
63
64 // String IDs
65 unsigned long team0_buildingOfflineStringId;
66 unsigned long team1_buildingOfflineStringId;
67 unsigned long team0_buildingOnlineStringId;
68 unsigned long team1_buildingOnlineStringId;
69};
70
71// -------------------------------------------------------------------------------------------------
72
81class dp88_buildingScripts_baseClass : public ScriptImpClass
82{
83public:
85
86protected:
90 GameObject* RegisterWithParent( GameObject* obj, const char* preset_name, int type );
91
92
96 void Custom( GameObject *obj, int type, int param, GameObject *sender );
97
99 virtual void OnCustom( GameObject* obj, int type, int param, GameObject *sender ) {};
100
101
103 virtual void OnBuildingOffline( GameObject* obj ) {};
104
106 virtual void OnBuildingOnline( GameObject* obj ) {};
107
109 virtual void OnBuildingCaptured( GameObject* obj, int team ) {};
110
112 virtual void OnBuildingDestroyed( GameObject* obj ) {};
113
114
117};
118
119// -------------------------------------------------------------------------------------------------
120
129{
130public:
132
133protected:
135 void Detach( GameObject* obj );
136
138 virtual void OnDetach( GameObject* obj ) {};
139
140
143 void PlayAnimation( GameObject* obj, const char* animation, int nStartFrame, int nEndFrame, bool bLooped );
144
145
148};
149
150// -------------------------------------------------------------------------------------------------
151
187{
188protected:
189 void Created( GameObject *obj );
190 void OnBuildingDestroyed( GameObject *obj );
191};
192
193// -------------------------------------------------------------------------------------------------
194
230{
231protected:
232 void Created( GameObject *obj );
233 void Killed( GameObject *obj, GameObject *killer );
234 void OnBuildingDestroyed( GameObject *obj );
235};
236
237// -------------------------------------------------------------------------------------------------
238
283{
284protected:
285 void Created( GameObject *obj );
286 void Damaged ( GameObject *obj, GameObject *damager, float amount );
287 void Killed( GameObject *obj, GameObject *killer );
288 void OnBuildingDestroyed( GameObject *obj );
289
290 void UpdateAnimation( GameObject* pSelf );
291
295};
296
297// -------------------------------------------------------------------------------------------------
298
299
300
309{
310protected:
311 void OnBuildingOffline( GameObject* obj );
312 void OnBuildingOnline( GameObject* obj );
313};
314
315
316
317
326{
327protected:
328 void OnBuildingOffline( GameObject* obj );
329 void OnBuildingOnline( GameObject* obj );
330};
331
332
341{
342protected:
343 void OnBuildingOffline( GameObject* obj );
344 void OnBuildingOnline( GameObject* obj );
345};
346
355{
356protected:
357 void OnBuildingOffline( GameObject* obj );
358 void OnBuildingOnline( GameObject* obj );
359};
360
369{
370protected:
371 void OnBuildingOffline( GameObject* obj );
372 void OnBuildingOnline( GameObject* obj );
373};
374
383{
384protected:
385 void OnBuildingOffline( GameObject* obj );
386 void OnBuildingOnline( GameObject* obj );
387};
388
397{
398protected:
399 void OnBuildingOffline( GameObject* obj );
400 void OnBuildingOnline( GameObject* obj );
401};
402
403
404// Money trickle function - gives the owning team X credits per second whilst alive
405class dp88_buildingScripts_functionMoneyTrickle : public dp88_buildingScripts_baseClass
406{
407public:
408 dp88_buildingScripts_functionMoneyTrickle() : isTimerRunning(false) {}
409
410 void Created ( GameObject* obj );
411 void Timer_Expired ( GameObject* obj, int number );
412 void OnBuildingCaptured ( GameObject* obj, int team );
413
414private:
415 bool isTimerRunning;
416};
417
418// -------------------------------------------------------------------------------------------------
419
436{
437 void Created ( GameObject* obj );
438 void OnBuildingCaptured ( GameObject* obj, int team );
439
442 float m_credits;
444};
445
446// -------------------------------------------------------------------------------------------------
447
448// Spawn team zone - spawns a script zone depending on which team currently owns
449// the building
450class dp88_buildingScripts_functionSpawnTeamZone : public dp88_buildingScripts_baseClass
451{
452public:
453 dp88_buildingScripts_functionSpawnTeamZone() : zoneId(NULL) {}
454
455 void Created ( GameObject* obj );
456 void OnBuildingOffline( GameObject* obj );
457 void OnBuildingOnline ( GameObject* obj );
458 void OnBuildingCaptured ( GameObject* obj, int team );
459 void Destroyed ( GameObject* obj );
460
461private:
462 // Functions to create and destroy the script zone
463 void createZone(GameObject* obj);
464 void destroyZone(GameObject* obj);
465
466 // ID of the zone we have created
467 int zoneId;
468};
469
470
471
472
499{
500public:
502
503 void Created( GameObject *obj );
504 void OnBuildingOffline( GameObject* obj );
505 void OnBuildingOnline ( GameObject* obj );
506 void OnBuildingDestroyed ( GameObject* obj );
507
508 // Functions to create and destroy the script zone
509 void createZone(GameObject* obj);
510 void destroyZone(GameObject* obj);
511
512 // ID of the zone we have created
513 int zoneId;
514};
515
516
517
518
527{
528protected:
529 void Created( GameObject *obj );
530 void Damaged ( GameObject *obj, GameObject *damager, float amount );
531 void OnBuildingCaptured ( GameObject* obj, int team );
532 void OnBuildingDestroyed( GameObject *obj );
533 void Timer_Expired( GameObject *obj, int number );
534
535 void UpdateAnimationFrame( GameObject* obj );
536
537 int currentTeam;
538
541 int m_nAnimTransitionFrames;
543};
544
545
546
547/*------------------------
548Spawn Building Part script
549--------------------------*/
550
551class dp88_buildingScripts_spawnPart : public dp88_buildingScripts_baseClass
552{
553 void Created ( GameObject* obj );
554 void Timer_Expired( GameObject *obj, int number );
555 void OnBuildingCaptured ( GameObject* obj, int team );
556 void Destroyed ( GameObject* obj );
557
558 int partObjectId;
559};
Controller for looped animations using a subset of frames.
Definition LoopedAnimationController.h:31
dp88 Building Scripts - Base Class
Definition dp88_buildingScripts.h:82
int m_parentId
Definition dp88_buildingScripts.h:116
virtual void OnCustom(GameObject *obj, int type, int param, GameObject *sender)
Definition dp88_buildingScripts.h:99
virtual void OnBuildingCaptured(GameObject *obj, int team)
Definition dp88_buildingScripts.h:109
GameObject * RegisterWithParent(GameObject *obj, const char *preset_name, int type)
Definition dp88_buildingScripts.cpp:446
void Custom(GameObject *obj, int type, int param, GameObject *sender)
Definition dp88_buildingScripts.cpp:464
virtual void OnBuildingDestroyed(GameObject *obj)
Definition dp88_buildingScripts.h:112
virtual void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.h:103
virtual void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.h:106
dp88 Building Scripts - Capture Point
Definition dp88_buildingScripts.h:527
void OnBuildingDestroyed(GameObject *obj)
Definition dp88_buildingScripts.cpp:1437
void OnBuildingCaptured(GameObject *obj, int team)
Definition dp88_buildingScripts.cpp:1452
dp88 Building Scripts - Component Base Class
Definition dp88_buildingScripts.h:129
void PlayAnimation(GameObject *obj, const char *animation, int nStartFrame, int nEndFrame, bool bLooped)
Definition dp88_buildingScripts.cpp:513
LoopedAnimationController * m_pAnimController
Definition dp88_buildingScripts.h:147
void Detach(GameObject *obj)
Definition dp88_buildingScripts.cpp:504
virtual void OnDetach(GameObject *obj)
Definition dp88_buildingScripts.h:138
dp88 Building Scripts - Building Component
Definition dp88_buildingScripts.h:187
void OnBuildingDestroyed(GameObject *obj)
Definition dp88_buildingScripts.cpp:557
Building function - Grant Money On Capture.
Definition dp88_buildingScripts.h:436
Building function - Produce Aircraft.
Definition dp88_buildingScripts.h:341
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:867
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:883
Building function - Produce Infantry.
Definition dp88_buildingScripts.h:309
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:779
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:786
Building function - Produce Naval Units.
Definition dp88_buildingScripts.h:355
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:915
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:931
Building function - Produce Vehicles.
Definition dp88_buildingScripts.h:326
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:830
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:809
Building function - Provide Harvester.
Definition dp88_buildingScripts.h:397
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:1023
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:1031
Building function - Provide Power.
Definition dp88_buildingScripts.h:369
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:970
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:963
Building function - Provide Radar.
Definition dp88_buildingScripts.h:383
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:993
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:1000
Building Function - Spawn Zone.
Definition dp88_buildingScripts.h:499
void OnBuildingOnline(GameObject *obj)
Definition dp88_buildingScripts.cpp:1247
void OnBuildingOffline(GameObject *obj)
Definition dp88_buildingScripts.cpp:1239
void OnBuildingDestroyed(GameObject *obj)
Definition dp88_buildingScripts.cpp:1255
dp88 Building Scripts - Major Weakpoint
Definition dp88_buildingScripts.h:230
void OnBuildingDestroyed(GameObject *obj)
Definition dp88_buildingScripts.cpp:628
dp88 Building Scripts - Minor Weakpoint
Definition dp88_buildingScripts.h:283
bool m_bIsDestroyed
Definition dp88_buildingScripts.h:294
void OnBuildingDestroyed(GameObject *obj)
Definition dp88_buildingScripts.cpp:721