1 //**************************************************************************
3 //** ## ## ## ## ## #### #### ### ###
4 //** ## ## ## ## ## ## ## ## ## ## #### ####
5 //** ## ## ## ## ## ## ## ## ## ## ## ## ## ##
6 //** ## ## ######## ## ## ## ## ## ## ## ### ##
7 //** ### ## ## ### ## ## ## ## ## ##
8 //** # ## ## # #### #### ## ##
10 //** Copyright (C) 1999-2006 Jānis Legzdiņš
11 //** Copyright (C) 2018-2023 Ketmar Dark
13 //** This program is free software: you can redistribute it and/or modify
14 //** it under the terms of the GNU General Public License as published by
15 //** the Free Software Foundation, version 3 of the License ONLY.
17 //** This program is distributed in the hope that it will be useful,
18 //** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 //** GNU General Public License for more details.
22 //** You should have received a copy of the GNU General Public License
23 //** along with this program. If not, see <http://www.gnu.org/licenses/>.
25 //**************************************************************************
27 //**************************************************************************
28 #ifndef VAVOOM_QSDATA_HEADER
29 #define VAVOOM_QSDATA_HEADER
38 extern QSPhase qsPhase
;
51 VEntity
*ent
; // owner (nullptr: player)
52 VStr name
; // value name
58 // used to map entities; 0 is player, 1.. -- entities
62 : type(QSType::QST_Void
)
72 QSValue (VEntity
*aent
, VStr aname
, QSType atype
)
83 static inline QSValue
CreateInt (VEntity
*ent
, VStr name
, vint32 value
) { QSValue
aval(ent
, name
, QSType::QST_Int
); aval
.ival
= value
; return aval
; }
84 static inline QSValue
CreateName (VEntity
*ent
, VStr name
, VName value
) { QSValue
aval(ent
, name
, QSType::QST_Name
); aval
.nval
= value
; return aval
; }
85 static inline QSValue
CreateStr (VEntity
*ent
, VStr name
, VStr value
) { QSValue
aval(ent
, name
, QSType::QST_Str
); aval
.sval
= value
; return aval
; }
86 static inline QSValue
CreateFloat (VEntity
*ent
, VStr name
, float value
) { QSValue
aval(ent
, name
, QSType::QST_Float
); aval
.fval
= value
; return aval
; }
88 inline bool isEmpty () const { return (type
== QSType::QST_Void
); }
90 void Serialise (VStream
&strm
);
92 VStr
toString () const;
96 extern TArray
<QSValue
> QS_GetCurrentArray ();
98 extern void QS_StartPhase (QSPhase aphase
);
99 extern void QS_PutValue (const QSValue
&val
);
100 extern QSValue
QS_GetValue (VEntity
*ent
, VStr name
);
102 // this is used in loader to build qs data
103 extern void QS_EnterValue (const QSValue
&val
);