Migrate vectors
FossilOrigin-Name: 853e760619bc8b16ee0262c55740ba82bd7efdc508357d544a6f59f450a155a7
This commit is contained in:
parent
9dff5ec70c
commit
a67b134eb2
2 changed files with 24 additions and 17 deletions
24
src/cube.h
24
src/cube.h
|
@ -20,8 +20,8 @@
|
||||||
@property (nonatomic) int framesInMap;
|
@property (nonatomic) int framesInMap;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
enum // block types, order matters!
|
// block types, order matters!
|
||||||
{
|
enum {
|
||||||
SOLID = 0, // entirely solid cube [only specifies wtex]
|
SOLID = 0, // entirely solid cube [only specifies wtex]
|
||||||
CORNER, // half full corner of a wall
|
CORNER, // half full corner of a wall
|
||||||
FHF, // floor heightfield using neighbour vdelta values
|
FHF, // floor heightfield using neighbour vdelta values
|
||||||
|
@ -44,8 +44,8 @@ struct sqr {
|
||||||
uchar tag; // used by triggers
|
uchar tag; // used by triggers
|
||||||
};
|
};
|
||||||
|
|
||||||
enum // hardcoded texture numbers
|
// hardcoded texture numbers
|
||||||
{
|
enum {
|
||||||
DEFAULT_SKY = 0,
|
DEFAULT_SKY = 0,
|
||||||
DEFAULT_LIQUID,
|
DEFAULT_LIQUID,
|
||||||
DEFAULT_WALL,
|
DEFAULT_WALL,
|
||||||
|
@ -53,8 +53,8 @@ enum // hardcoded texture numbers
|
||||||
DEFAULT_CEIL
|
DEFAULT_CEIL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum // static entity types
|
// static entity types
|
||||||
{
|
enum {
|
||||||
NOTUSED = 0, // entity slot not in use in map
|
NOTUSED = 0, // entity slot not in use in map
|
||||||
LIGHT, // lightsource, attr1 = radius, attr2 = intensity
|
LIGHT, // lightsource, attr1 = radius, attr2 = intensity
|
||||||
PLAYERSTART, // attr1 = angle
|
PLAYERSTART, // attr1 = angle
|
||||||
|
@ -76,8 +76,8 @@ enum // static entity types
|
||||||
MAXENTTYPES
|
MAXENTTYPES
|
||||||
};
|
};
|
||||||
|
|
||||||
struct persistent_entity // map entity
|
// map entity
|
||||||
{
|
struct persistent_entity {
|
||||||
short x, y, z; // cube aligned position
|
short x, y, z; // cube aligned position
|
||||||
short attr1;
|
short attr1;
|
||||||
uchar type; // type is one of the above
|
uchar type; // type is one of the above
|
||||||
|
@ -90,8 +90,8 @@ struct entity: public persistent_entity {
|
||||||
|
|
||||||
#define MAPVERSION 5 // bump if map format changes, see worldio.cpp
|
#define MAPVERSION 5 // bump if map format changes, see worldio.cpp
|
||||||
|
|
||||||
struct header // map file format header
|
// map file format header
|
||||||
{
|
struct header {
|
||||||
char head[4]; // "CUBE"
|
char head[4]; // "CUBE"
|
||||||
int version; // any >8bit quantity is a little indian
|
int version; // any >8bit quantity is a little indian
|
||||||
int headersize; // sizeof(header)
|
int headersize; // sizeof(header)
|
||||||
|
@ -344,8 +344,8 @@ extern bool demoplayback;
|
||||||
#define m_classicsp (gamemode == -2)
|
#define m_classicsp (gamemode == -2)
|
||||||
#define isteam(a, b) (m_teammode && [a isEqual:b])
|
#define isteam(a, b) (m_teammode && [a isEqual:b])
|
||||||
|
|
||||||
enum // function signatures for script functions, see command.cpp
|
// function signatures for script functions, see command.mm
|
||||||
{
|
enum {
|
||||||
ARG_1INT,
|
ARG_1INT,
|
||||||
ARG_2INT,
|
ARG_2INT,
|
||||||
ARG_3INT,
|
ARG_3INT,
|
||||||
|
|
|
@ -189,15 +189,16 @@ calclight()
|
||||||
|
|
||||||
VARP(dynlight, 0, 16, 32);
|
VARP(dynlight, 0, 16, 32);
|
||||||
|
|
||||||
vector<block *> dlights;
|
static OFMutableData *dlights;
|
||||||
|
|
||||||
void
|
void
|
||||||
cleardlights()
|
cleardlights()
|
||||||
{
|
{
|
||||||
while (!dlights.empty()) {
|
while (dlights.count > 0) {
|
||||||
block *backup = dlights.pop();
|
block *backup = *(block **)[dlights lastItem];
|
||||||
|
[dlights removeLastItem];
|
||||||
blockpaste(*backup);
|
blockpaste(*backup);
|
||||||
free(backup);
|
OFFreeMemory(backup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +228,13 @@ dodynlight(const OFVector3D &vold, const OFVector3D &v, int reach, int strength,
|
||||||
if (b.ys + b.y > ssize - 2)
|
if (b.ys + b.y > ssize - 2)
|
||||||
b.ys = ssize - 2 - b.y;
|
b.ys = ssize - 2 - b.y;
|
||||||
|
|
||||||
dlights.add(blockcopy(b)); // backup area before rendering in dynlight
|
if (dlights == nil)
|
||||||
|
dlights =
|
||||||
|
[[OFMutableData alloc] initWithItemSize:sizeof(block *)];
|
||||||
|
|
||||||
|
// backup area before rendering in dynlight
|
||||||
|
block *copy = blockcopy(b);
|
||||||
|
[dlights addItem:©];
|
||||||
|
|
||||||
persistent_entity l = { (short)v.x, (short)v.y, (short)v.z,
|
persistent_entity l = { (short)v.x, (short)v.y, (short)v.z,
|
||||||
(short)reach, LIGHT, (uchar)strength, 0, 0 };
|
(short)reach, LIGHT, (uchar)strength, 0, 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue