Skip to content

Commit 4800a3b

Browse files
author
L'In20Cible
committed
Exposed datamap_t, typedescription_t, variant_t and inputdata_t...
1 parent d5c8aab commit 4800a3b

File tree

5 files changed

+484
-0
lines changed

5 files changed

+484
-0
lines changed

src/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,18 @@ Set(SOURCEPYTHON_STRINGTABLES_MODULE_SOURCES
314314
core/modules/stringtables/stringtables_wrap_python.cpp
315315
)
316316

317+
# ------------------------------------------------------------------
318+
# Datamap module.
319+
# ------------------------------------------------------------------
320+
Set(SOURCEPYTHON_DATAMAP_MODULE_HEADERS
321+
core/modules/datamap/datamap_wrap.h
322+
core/modules/datamap/${SOURCE_ENGINE}/datamap_wrap_python.h
323+
)
324+
325+
Set(SOURCEPYTHON_DATAMAP_MODULE_SOURCES
326+
core/modules/datamap/datamap_wrap_python.cpp
327+
)
328+
317329
# ------------------------------------------------------------------
318330
# All module source files
319331
# ------------------------------------------------------------------
@@ -372,6 +384,9 @@ Set(SOURCEPYTHON_MODULE_FILES
372384

373385
${SOURCEPYTHON_STRINGTABLES_MODULE_HEADERS}
374386
${SOURCEPYTHON_STRINGTABLES_MODULE_SOURCES}
387+
388+
${SOURCEPYTHON_DATAMAP_MODULE_HEADERS}
389+
${SOURCEPYTHON_DATAMAP_MODULE_SOURCES}
375390
)
376391

377392
# ------------------------------------------------------------------
@@ -400,6 +415,7 @@ Source_Group("Header Files\\Module\\Player" FILES ${SOURCEPYTHON
400415
Source_Group("Header Files\\Module\\RecipientFilter" FILES ${SOURCEPYTHON_RECIPIENTFILTER_MODULE_HEADERS})
401416
Source_Group("Header Files\\Module\\Usermessage" FILES ${SOURCEPYTHON_USERMESSAGE_MODULE_HEADERS})
402417
Source_Group("Header Files\\Module\\StringTables" FILES ${SOURCEPYTHON_STRINGTABLES_MODULE_HEADERS})
418+
Source_Group("Header Files\\Module\\DataMap" FILES ${SOURCEPYTHON_DATAMAP_MODULE_HEADERS})
403419

404420
Source_Group("Source Files\\Addons" FILES ${SOURCEPYTHON_ADDON_SOURCES})
405421
Source_Group("Source Files\\Core" FILES ${SOURCEPYTHON_CORE_SOURCES})
@@ -424,6 +440,7 @@ Source_Group("Source Files\\Module\\RecipientFilter" FILES ${SOURCEPYTHON
424440
Source_Group("Source Files\\Module\\Usermessage" FILES ${SOURCEPYTHON_USERMESSAGE_MODULE_SOURCES})
425441
Source_Group("Source Files\\Module\\Usermessage\\${SDK}" FILES ${SOURCEPYTHON_MODULE_USERMESSAGES_GAME_SOURCES})
426442
Source_Group("Source Files\\Module\\StringTables" FILES ${SOURCEPYTHON_MODULE_STRINGTABLES_SOURCES})
443+
Source_Group("Source Files\\Module\\DataMap" FILES ${SOURCEPYTHON_MODULE_DATAMAP_SOURCES})
427444

428445
# ------------------------------------------------------------------
429446
# All SourcePython source files. Ideally we break out each group of
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* =============================================================================
3+
* Source Python
4+
* Copyright (C) 2014 Source Python Development Team. All rights reserved.
5+
* =============================================================================
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License, version 3.0, as published by the
9+
* Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14+
* details.
15+
*
16+
* You should have received a copy of the GNU General Public License along with
17+
* this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* As a special exception, the Source Python Team gives you permission
20+
* to link the code of this program (as well as its derivative works) to
21+
* "Half-Life 2," the "Source Engine," and any Game MODs that run on software
22+
* by the Valve Corporation. You must obey the GNU General Public License in
23+
* all respects for all other code used. Additionally, the Source.Python
24+
* Development Team grants this exception to all derivative works.
25+
*/
26+
27+
#ifndef _DATAMAP_CSGO_H
28+
#define _DATAMAP_CSGO_H
29+
30+
//-----------------------------------------------------------------------------
31+
// Includes.
32+
//-----------------------------------------------------------------------------
33+
#include "datamap.h"
34+
35+
//-----------------------------------------------------------------------------
36+
// Expose datamap_t.
37+
//-----------------------------------------------------------------------------
38+
template<class T>
39+
T DataMap_Visitor(T cls)
40+
{
41+
cls
42+
.def_readonly("packed_size", &datamap_t::m_nPackedSize)
43+
44+
// TODO: Expose optimized_datamap_t...
45+
.def_readonly("optimized_datamap", &datamap_t::m_pOptimizedDataMap)
46+
;
47+
return cls;
48+
}
49+
50+
//-----------------------------------------------------------------------------
51+
// Expose typedescription_t.
52+
//-----------------------------------------------------------------------------
53+
class TypeDescExt
54+
{
55+
public:
56+
static int get_flat_offset(typedescription_t pTypeDesc)
57+
{
58+
// return pTypeDesc.flatOffset[TD_OFFSET_NORMAL];
59+
return NULL;
60+
}
61+
};
62+
63+
template<class T>
64+
T TypeDesc_Visitor(T cls)
65+
{
66+
cls
67+
.def_readonly("offset", &typedescription_t::fieldOffset)
68+
.def_readonly("flat_offset", &TypeDescExt::get_flat_offset)
69+
.def_readonly("flat_group", &typedescription_t::flatGroup)
70+
;
71+
return cls;
72+
}
73+
74+
//-----------------------------------------------------------------------------
75+
// Expose fieldtype_t.
76+
//-----------------------------------------------------------------------------
77+
template<class T>
78+
T FieldTypes_Visitor(T cls)
79+
{
80+
cls
81+
.value("INTEGER64", FIELD_INTEGER64)
82+
.value("VECTOR4D", FIELD_VECTOR4D)
83+
;
84+
return cls;
85+
}
86+
87+
#endif // _DATAMAP_CSGO_H
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* =============================================================================
3+
* Source Python
4+
* Copyright (C) 2012 Source Python Development Team. All rights reserved.
5+
* =============================================================================
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under
8+
* the terms of the GNU General Public License, version 3.0, as published by the
9+
* Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14+
* details.
15+
*
16+
* You should have received a copy of the GNU General Public License along with
17+
* this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* As a special exception, the Source Python Team gives you permission
20+
* to link the code of this program (as well as its derivative works) to
21+
* "Half-Life 2," the "Source Engine," and any Game MODs that run on software
22+
* by the Valve Corporation. You must obey the GNU General Public License in
23+
* all respects for all other code used. Additionally, the Source.Python
24+
* Development Team grants this exception to all derivative works.
25+
*/
26+
27+
#ifndef SP_DATAMAP_WRAP_H
28+
#define SP_DATAMAP_WRAP_H
29+
30+
//-----------------------------------------------------------------------------
31+
// Includes.
32+
//-----------------------------------------------------------------------------
33+
#include "edict.h"
34+
35+
//-----------------------------------------------------------------------------
36+
// Structure passed to input handlers.
37+
//-----------------------------------------------------------------------------
38+
struct inputdata_t
39+
{
40+
CBaseEntity *pActivator;
41+
CBaseEntity *pCaller;
42+
variant_t value;
43+
int nOutputID;
44+
};
45+
46+
#endif SP_DATAMAP_WRAP_H

0 commit comments

Comments
 (0)