Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
engine_ttdef.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#ifndef SCRIPTS_INCLUDE__ENGINE_TTDEF_H
13#define SCRIPTS_INCLUDE__ENGINE_TTDEF_H
14#include "scripts.h"
15
16class BaseControllerClass;
17class PhysicalGameObj;
18class AmmoDefinitionClass;
19
20enum TextMessageEnum
21{
22 TEXT_MESSAGE_PUBLIC,
23 TEXT_MESSAGE_TEAM,
24 TEXT_MESSAGE_PRIVATE,
25 TEXT_MESSAGE_TMSG, //special extra value for the TMSG console command
26};
27enum AnnouncementEnum
28{
29 ANNOUNCE_PUBLIC,
30 ANNOUNCE_TEAM,
31 ANNOUNCE_PRIVATE,
32};
33enum PurchaseStatus
34{
35 PurchaseStatus_AllowNoSpawn = -3, // Purchase is allowed as normal, without spawning the vehicle. (only for VehiclePurchaseHook)
36 PurchaseStatus_AllowFree = -2, // Purchase is allowed as normal, without charging the player.
37 PurchaseStatus_Allow = -1, // Purchase is allowed as normal.
38 PurchaseStatus_Granted, // "Purchase request granted."
39 PurchaseStatus_Pending, // "Transaction pending."
40 PurchaseStatus_InsufficientFunds, // "You have insufficient funds for this purchase."
41 PurchaseStatus_FactoryUnavailable, // "The factory is not presently available."
42 PurchaseStatus_OutOfStock, // "This item is not presently in stock."
43};
44enum DialogMessageType
45{
46 MESSAGE_TYPE_DIALOG_SHOW, // gets called when the dialog is shown
47 MESSAGE_TYPE_DIALOG_CLOSE, // gets called when the dialog is hidden/being deleted
48 MESSAGE_TYPE_DIALOG_ESCAPE, // gets called when the client hits Esc key
49 MESSAGE_TYPE_CONTROL_MOUSE_CLICK, // gets called when the client left-clicks on a supported control
50 MESSAGE_TYPE_CONTROL_VALUE_CHANGE, // gets called when the client changes the value of a supported control
51 MESSAGE_TYPE_CONTROL_VALUE_CONFIRM, // gets called when the client hits Enter key on a supported control
52 MESSAGE_TYPE_CONTROL_FOCUSED // gets called when the client changes the focused control
53};
54typedef bool (*ChatHook) (int PlayerID,TextMessageEnum Type,const wchar_t *Message,int recieverID);
55typedef bool (*HostHook) (int PlayerID,TextMessageEnum Type,const char *Message);
56typedef void (*ObjectCreateHook) (void *data,GameObject *obj);
57typedef void (*PlayerJoin) (int PlayerID,const char *PlayerName);
58typedef void (*PlayerLeave) (int PlayerID);
59typedef void (*LoadLevelHook) ();
60typedef void (*ConsoleOutputHook) (const char *output);
61typedef PurchaseStatus (*PurchaseHook) (BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,const char *data);
62typedef void (*PurchaseMonHook) (BaseControllerClass *base,GameObject *purchaser,unsigned int cost,unsigned int preset,unsigned int purchaseret,const char *data);
63typedef bool (*RefillHook) (GameObject *purchaser);
64typedef bool (*RadioHook) (int PlayerType, int PlayerID, int AnnouncementID, int IconID, AnnouncementEnum AnnouncementType);
65typedef bool (*StockDamageHook) (PhysicalGameObj* damager, PhysicalGameObj* target, float damage, uint warheadId);
66typedef bool (*TtDamageHook) (PhysicalGameObj* damager, PhysicalGameObj* target, const AmmoDefinitionClass* ammo, const char* bone);
67typedef void (*DialogHook) (int PlayerID, int DialogID, int ControlID, DialogMessageType MessageType);
68
69struct ObjectCreateHookStruct {
70 ObjectCreateHook hook;
71 void *data;
72};
73
74typedef void (*KeyHook) (void *data);
75struct KeyHookStruct {
76 KeyHook hook;
77 const char *key;
78 int PlayerID;
79 void *data;
80};
81
82typedef void (*ShaderNotify) (void *data, int notify);
83struct ShaderNotifyStruct {
84 ShaderNotify hook;
85 int ID;
86 int PlayerID;
87 void *data;
88};
89
90//values for Set_Fog_Mode and Set_Fog_Mode_Player
91#define FOG_EXP 1 //Set_Fog_Density applies to this mode
92#define FOG_EXP2 2 //Set_Fog_Density applies to this mode
93#define FOG_LINEAR 3 //This is the default if you are using fog
94
95enum PathfindDistanceResult
96{
97 PATHFIND_DISTANCE_INVALID_RESULT = -1,
98 PATHFIND_DISTANCE_RESULT_OK = 0,
99 PATHFIND_DISTANCE_RESULT_CANCELED,
100 PATHFIND_DISTANCE_RESULT_INVALID_START_POS,
101 PATHFIND_DISTANCE_RESULT_INVALID_DEST_POS,
102 PATHFIND_DISTANCE_RESULT_NO_PATH,
103 PATHFIND_DISTANCE_RESULT_COUNT
104};
105
106struct PathfindDistanceRequest;
107
108typedef void(*PathfindDistanceCallback)(const PathfindDistanceRequest &result);
109class PathSolveClass;
110struct PathfindDistanceRequest
111{
112 PathfindDistanceRequest() :
113 Id(0), Start(), Dest(), PathSolver(nullptr), Result(PATHFIND_DISTANCE_INVALID_RESULT), Distance(0.0f), Callback(nullptr), Data(nullptr)
114 {
115
116 }
117
118 PathfindDistanceRequest(uint32 id, const Vector3 &start, const Vector3 &dest, PathSolveClass* solver, PathfindDistanceCallback callback, void *data) :
119 Id(id), Start(start), Dest(dest), PathSolver(solver), Result(PATHFIND_DISTANCE_INVALID_RESULT), Distance(0.0f), Callback(callback), Data(data)
120 {
121
122 }
123
124 bool operator==(const PathfindDistanceRequest &other) const
125 {
126 return false;
127 }
128
129 bool operator!=(const PathfindDistanceRequest &other) const
130 {
131 return true;
132 }
133
134 void Do_Callback()
135 {
136 Callback((*this));
137 }
138
139 uint32 Id;
140 Vector3 Start;
141 Vector3 Dest;
142 PathSolveClass *PathSolver;
143 PathfindDistanceResult Result;
144 float Distance;
145 PathfindDistanceCallback Callback;
146 void *Data;
147};
148
149#endif