-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
p_setup.c
176 lines (151 loc) · 6.75 KB
/
p_setup.c
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
/**\file
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2002-2009 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2009 Daniel Swanson <danij@dengine.net>
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* p_setup.c: Handle jDoom64 specific map data properties.
*/
// HEADER FILES ------------------------------------------------------------
#include "jdoom64.h"
#include "am_map.h"
// MACROS ------------------------------------------------------------------
// TYPES -------------------------------------------------------------------
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
// PUBLIC DATA DEFINITIONS -------------------------------------------------
// PRIVATE DATA DEFINITIONS ------------------------------------------------
// CODE --------------------------------------------------------------------
/**
* Called during pre-init.
* Register the map object data types we want to Doomsday to make public via
* it's MPE interface.
*/
void P_RegisterMapObjs(void)
{
P_RegisterMapObj(MO_THING, "Thing");
P_RegisterMapObjProperty(MO_THING, MO_X, "X", DDVT_SHORT);
P_RegisterMapObjProperty(MO_THING, MO_Y, "Y", DDVT_SHORT);
P_RegisterMapObjProperty(MO_THING, MO_Z, "Z", DDVT_SHORT);
P_RegisterMapObjProperty(MO_THING, MO_ID, "ID", DDVT_SHORT);
P_RegisterMapObjProperty(MO_THING, MO_ANGLE, "Angle", DDVT_ANGLE);
P_RegisterMapObjProperty(MO_THING, MO_DOOMEDNUM, "DoomEdNum", DDVT_INT);
P_RegisterMapObjProperty(MO_THING, MO_SKILLMODES, "SkillModes", DDVT_INT);
P_RegisterMapObjProperty(MO_THING, MO_FLAGS, "Flags", DDVT_INT);
P_RegisterMapObj(MO_XLINEDEF, "XLinedef");
P_RegisterMapObjProperty(MO_XLINEDEF, MO_TAG, "Tag", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XLINEDEF, MO_TYPE, "Type", DDVT_BYTE);
P_RegisterMapObjProperty(MO_XLINEDEF, MO_USETYPE, "UseType", DDVT_BYTE);
P_RegisterMapObjProperty(MO_XLINEDEF, MO_FLAGS, "Flags", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XLINEDEF, MO_DRAWFLAGS, "DrawFlags", DDVT_BYTE);
P_RegisterMapObjProperty(MO_XLINEDEF, MO_TEXFLAGS, "TexFlags", DDVT_BYTE);
P_RegisterMapObj(MO_XSECTOR, "XSector");
P_RegisterMapObjProperty(MO_XSECTOR, MO_TAG, "Tag", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_TYPE, "Type", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_FLAGS, "Flags", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_FLOORCOLOR, "FloorColor", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_CEILINGCOLOR, "CeilingColor", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_UNKNOWNCOLOR, "UnknownColor", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_WALLTOPCOLOR, "WallTopColor", DDVT_SHORT);
P_RegisterMapObjProperty(MO_XSECTOR, MO_WALLBOTTOMCOLOR, "WallBottomColor", DDVT_SHORT);
P_RegisterMapObj(MO_LIGHT, "Light");
P_RegisterMapObjProperty(MO_LIGHT, MO_COLORR, "ColorR", DDVT_FLOAT);
P_RegisterMapObjProperty(MO_LIGHT, MO_COLORG, "ColorG", DDVT_FLOAT);
P_RegisterMapObjProperty(MO_LIGHT, MO_COLORB, "ColorB", DDVT_FLOAT);
P_RegisterMapObjProperty(MO_LIGHT, MO_XX0, "XX0", DDVT_BYTE);
P_RegisterMapObjProperty(MO_LIGHT, MO_XX1, "XX1", DDVT_BYTE);
P_RegisterMapObjProperty(MO_LIGHT, MO_XX2, "XX2", DDVT_BYTE);
}
/**
* \todo This is actually unnecessary. If we say that in the case of BOOM
* overloaded texture names, rather than setting the surface material as
* normal, the map converter should instead write to a property in XLinedef
* which the game can then look up later.
*
* Doomsday will call this when loading the map data if it encounters a
* value that it doesn't understand for a property IT handles.
*
* Doomsday thinks we might know what to do with it...
* If we don't know what to do we'll return -1.
*
* @param id Index of the current element being read.
* @param dtype DMU type identifier.
* @param prop DMU property identifier.
* @param type Data type id of the value pointed to by *data.
* @param *data Ptr to the data value (has already been expanded,
* size converted and endian converted where necessary).
*/
int P_HandleMapDataPropertyValue(uint id, int dtype, int prop,
valuetype_t type, void *data)
{
switch(dtype)
{
case DMU_SURFACE:
switch(prop)
{
case DMU_MATERIAL:
/**
* It could be a BOOM overloaded texture name?
* In this context Doomsday expects either -1 (a bad texture name)
* Or the id of a wall texture it should set to this section.
* \todo Add code to determine what to do.
*/
break;
default:
break;
}
break;
default:
break;
}
return -1; // We ain't got a clue what to do with it...
}
/**
* These status reports inform us of what Doomsday is doing to a particular
* map data object (at any time) that we might want to react to.
*
* If we arn't interested in the report - we should simply return true and
* take no further action.
*
* @param code ID code of the status report (enum in dd_share.h)
* @param id Map data object id.
* @param type Map data object type eg DMU_SECTOR.
* @param data Any relevant data for this report (currently unused).
*/
int P_HandleMapObjectStatusReport(int code, uint id, int dtype, void *data)
{
switch(code)
{
case DMUSC_LINE_FIRSTRENDERED:
/**
* Called the first time the given line is rendered.
* *data is a pointer to int, giving the player id which has seen it.
* We'll utilize this to mark it as being visible in the automap.
*/
P_SetLinedefAutomapVisibility(*(int*)data, id, true);
break;
default:
break;
}
return 1;
}