RingRacers/src/k_mapuser.h
Sally Coolatta d9382f2100 ACS: UDMF user properties
Lines, sides, sectors, and things now all support the "Custom" tab properly. Label a property as `user_[whatever you want]` in this tab, and it will be added to the structure. ACS will then be able to retrieve it using the `Get[x]UserProperty()` function.
2023-05-02 18:44:27 -04:00

94 lines
2.4 KiB
C

// DR. ROBOTNIK'S RING RACERS
//-----------------------------------------------------------------------------
// Copyright (C) by Sally "TehRealSalt" Cochenour
// Copyright (C) by Kart Krew
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file k_mapuser.h
/// \brief UDMF: Custom user properties
#ifndef __K_MAPUSER__
#define __K_MAPUSER__
#include "doomdef.h"
#include "doomstat.h"
#include "doomdata.h"
#ifdef __cplusplus
extern "C" {
#endif
struct mapUserProperty_t
{
UINT32 hash;
char *key;
mapUserPropertyType_e type;
boolean valueBool;
INT32 valueInt;
fixed_t valueFixed;
char *valueStr;
};
// mapUserProperties_t has to be defined in doomdata.h instead
// because of circular dependency issues
/*--------------------------------------------------
void K_UserPropertyPush(mapUserProperties_t *user, const char *key, mapUserPropertyType_e type, void *value);
Adds a new key value to the user properties struct.
Input Arguments:-
user - User properties memory structure.
key - The key to add.
type - Enum representing the type of the value to add.
value - The value to add, as a void pointer.
Return:-
N/A
--------------------------------------------------*/
void K_UserPropertyPush(mapUserProperties_t *user, const char *key, mapUserPropertyType_e type, void *value);
/*--------------------------------------------------
mapUserProperty_t *K_UserPropertyFind(mapUserProperties_t *user, const char *key);
Tries to find if the key value already exists in this
user properties struct.
Input Arguments:-
user - User properties memory structure.
key - The key to find.
Return:-
The struct of the property we just got, or NULL if the key didn't exist already.
--------------------------------------------------*/
mapUserProperty_t *K_UserPropertyFind(mapUserProperties_t *user, const char *key);
/*--------------------------------------------------
void K_UserPropertiesClear(mapUserProperties_t *user);
Frees an entire user properties struct.
Input Arguments:-
user - User properties memory structure to free.
Return:-
N/A
--------------------------------------------------*/
void K_UserPropertiesClear(mapUserProperties_t *user);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // __K_MAPUSER__