/
Interactive.h
195 lines (157 loc) · 7.26 KB
/
Interactive.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
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
/*
* Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file)
*
* This file is part of Arx Libertatis.
*
* Arx Libertatis is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Arx Libertatis is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Arx Libertatis. If not, see <http://www.gnu.org/licenses/>.
*/
/* Based on:
===========================================================================
ARX FATALIS GPL Source Code
Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code. If not, see
<http://www.gnu.org/licenses/>.
In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
// Code: Cyril Meynier
//
// Copyright (c) 1999 ARKANE Studios SA. All rights reserved
#ifndef ARX_SCENE_INTERACTIVE_H
#define ARX_SCENE_INTERACTIVE_H
#include <stddef.h>
#include <string>
#include "game/Entity.h"
#include "game/EntityId.h"
#include "graphics/data/MeshManipulation.h"
#include "math/Vector.h"
#include "util/Flags.h"
struct EERIE_3DOBJ;
namespace res { class path; }
enum TargetInfo {
TARGET_PATH = -3,
TARGET_NONE = -2,
TARGET_PLAYER = 0, //-1
};
enum AddInteractiveFlag {
NO_MESH = (1<<0),
NO_ON_LOAD = (1<<1),
IO_IMMEDIATELOAD = (1<<2)
};
DECLARE_FLAGS(AddInteractiveFlag, AddInteractiveFlags)
DECLARE_FLAGS_OPERATORS(AddInteractiveFlags)
enum DeleteByIndexFlag {
FLAG_NOCONFIRM = 1,
FLAG_DONTKILLDIR = 2
};
DECLARE_FLAGS(DeleteByIndexFlag, DeleteByIndexFlags)
DECLARE_FLAGS_OPERATORS(DeleteByIndexFlags)
void ARX_INTERACTIVE_TWEAK_Icon(Entity * io, const res::path & s1);
void ARX_INTERACTIVE_DestroyDynamicInfo(Entity * io);
void ARX_INTERACTIVE_HideGore(Entity * io, long flag = 0);
bool ARX_INTERACTIVE_Attach(EntityHandle n_source, EntityHandle n_target, const std::string & ap_source, const std::string & ap_target);
void ARX_INTERACTIVE_Detach(EntityHandle n_source, EntityHandle n_target);
void ARX_INTERACTIVE_Show_Hide_1st(Entity * io, long state);
void ARX_INTERACTIVE_RemoveGoreOnIO(Entity * io);
bool ARX_INTERACTIVE_ConvertToValidPosForIO(Entity * io, Vec3f * target);
void ARX_INTERACTIVE_TeleportBehindTarget(Entity * io);
void ARX_INTERACTIVE_MEMO_TWEAK(Entity * io, TweakType type, const res::path & param1, const res::path & param2);
void ARX_INTERACTIVE_APPLY_TWEAK_INFO(Entity * io);
bool ARX_INTERACTIVE_USEMESH(Entity * io, const res::path & temp);
void ARX_INTERACTIVE_Teleport(Entity * io, const Vec3f & target, bool flag = false);
bool IsEquipedByPlayer(const Entity * io);
void CleanScriptLoadedIO();
void PrepareIOTreatZone(long flag = 0);
void LinkObjToMe(Entity * io, Entity * io2, const std::string & attach);
/*!
* Destroy an entity at the end of the current frame
*
* For items with a count over 1 the count is (immediately) descreased
* and the entity is not destroyed.
*
* \return true if the entity will be destroyed.
*/
bool ARX_INTERACTIVE_DestroyIOdelayed(Entity * entity);
void ARX_INTERACTIVE_DestroyIOdelayedRemove(Entity * entity);
void ARX_INTERACTIVE_DestroyIOdelayedExecute();
/* TODO remove
* ValidIONum and ValidIOAddress are fundamentally flawed and vulnerable to
* index / address aliasing as both indices and memory addresses can be reused.
*
* We should instead use a proper weak pointer!
*/
bool ValidIONum(EntityHandle num);
bool ValidIOAddress(const Entity * io);
void RestoreInitialIOStatusOfIO(Entity * io);
void SetWeapon_Back(Entity * io);
bool ForceNPC_Above_Ground(Entity * io);
void RestoreInitialIOStatus();
long GetNumberInterWithOutScriptLoad();
void UnlinkAllLinkedObjects();
EntityHandle IsCollidingAnyInter(const Vec3f & pos, const Vec3f & size);
Entity * GetFirstInterAtPos(const Vec2s & pos, long flag = 0, Vec3f * _pRef = NULL, Entity ** _pTable = NULL, size_t * _pnNbInTable = NULL);
/*!
* Adds an Interactive Object to the Scene
* Calls appropriate func depending on object Type (ITEM, NPC or FIX)
* Creates an IO Ident for added object if necessary
* \param flags can be IO_IMMEDIATELOAD (1) to FORCE loading
*/
Entity * AddInteractive(const res::path & classPath, EntityInstance instance = -1, AddInteractiveFlags flags = 0);
Entity * AddItem(const res::path & classPath, EntityInstance instance = -1, AddInteractiveFlags flags = 0);
Entity * AddNPC(const res::path & classPath, EntityInstance instance = -1, AddInteractiveFlags flags = 0);
Entity * AddFix(const res::path & classPath, EntityInstance instance = -1, AddInteractiveFlags flags = 0);
void UpdateCameras();
Entity * InterClick(const Vec2s & pos);
void UpdateInter();
void RenderInter();
void SetWeapon_On(Entity * io);
void Prepare_SetWeapon(Entity * io, const res::path & temp);
void ComputeVVPos(Entity * io);
void SetYlsideDeath(Entity * io);
std::string GetMaterialString(const res::path & origin );
Entity * CloneIOItem(Entity * src);
float ARX_INTERACTIVE_GetArmorClass(Entity * io);
long ARX_INTERACTIVE_GetPrice(Entity * io, Entity * shop);
void IO_UnlinkAllLinkedObjects(Entity * io);
struct TREATZONE_IO {
Entity * io;
EntityFlags ioflags;
long show;
};
extern TREATZONE_IO * treatio;
extern long TREATZONE_CUR;
void TREATZONE_Clear();
void TREATZONE_Release();
void TREATZONE_AddIO(Entity * io, bool justCollide = false);
void TREATZONE_RemoveIO(Entity * io);
bool IsSameObject(Entity * io, Entity * ioo);
void ARX_INTERACTIVE_ClearAllDynData();
bool HaveCommonGroup(Entity * io, Entity * ioo);
void UpdateIOInvisibility(Entity * io);
void CheckSetAnimOutOfTreatZone(Entity * io, AnimLayer & layer);
void ARX_HALO_SetToNative(Entity * io);
void ARX_INTERACTIVE_ActivatePhysics(EntityHandle t);
void ResetVVPos(Entity * io);
void UpdateGoldObject(Entity * io);
bool ARX_INTERACTIVE_CheckFULLCollision(PHYSICS_BOX_DATA * obj, Entity *io_source);
#endif // ARX_SCENE_INTERACTIVE_H