Switch from clang-format to manual formatting
clang-format does too many weird things. FossilOrigin-Name: 75e920ae307d96d6ce0141652617959f609c21b542e930cb537789298856c480
This commit is contained in:
parent
3a081f18e5
commit
d3dc40de33
62 changed files with 945 additions and 991 deletions
|
@ -1,45 +0,0 @@
|
|||
IndentWidth: 8
|
||||
TabWidth: 8
|
||||
UseTab: ForIndentation
|
||||
ColumnLimit: 80
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
AlwaysBreakAfterReturnType: AllDefinitions
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: DontAlign
|
||||
Cpp11BracedListStyle: false
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
ObjCBlockIndentWidth: 8
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
ObjCPropertyAttributeOrder: [
|
||||
class, direct,
|
||||
readonly, readwrite,
|
||||
nullable, nonnull, null_resettable, null_unspecified,
|
||||
assign, retain, strong, copy, weak, unsafe_unretained,
|
||||
atomic, nonatomic,
|
||||
getter, setter
|
||||
]
|
||||
SpaceBeforeInheritanceColon: false
|
||||
QualifierAlignment: Left
|
||||
MaxEmptyLinesToKeep: 1
|
||||
#RemoveEmptyLinesInUnwrappedLines: true
|
||||
RemoveSemicolon: true
|
||||
CompactNamespaces: true
|
||||
SortIncludes: CaseSensitive
|
||||
IndentPPDirectives: AfterHash
|
||||
PPIndentWidth: 1
|
59
src/Cube.m
59
src/Cube.m
|
@ -145,42 +145,24 @@ VARP(minmillis, 0, 5, 1000);
|
|||
|
||||
log(@"basetex");
|
||||
int xs, ys;
|
||||
if (!installtex(2,
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/newchars.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(3,
|
||||
[_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/base.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(6,
|
||||
[_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/ball1.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(7,
|
||||
[_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/smoke.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(8,
|
||||
[_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/ball2.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(9,
|
||||
[_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/ball3.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(4,
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/explosion.jpg"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(5,
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/items.png"],
|
||||
&xs, &ys, false) ||
|
||||
!installtex(1,
|
||||
[_gameDataIRI
|
||||
IRIByAppendingPathComponent:@"data/crosshair.png"],
|
||||
&xs, &ys, false))
|
||||
if (!installtex(2, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/newchars.png"], &xs, &ys, false) ||
|
||||
!installtex(3, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/base.png"], &xs, &ys, false) ||
|
||||
!installtex(6, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/ball1.png"], &xs, &ys, false) ||
|
||||
!installtex(7, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/smoke.png"], &xs, &ys, false) ||
|
||||
!installtex(8, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/ball2.png"], &xs, &ys, false) ||
|
||||
!installtex(9, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/martin/ball3.png"], &xs, &ys, false) ||
|
||||
!installtex(4, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/explosion.jpg"], &xs, &ys, false) ||
|
||||
!installtex(5, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/items.png"], &xs, &ys, false) ||
|
||||
!installtex(1, [_gameDataIRI IRIByAppendingPathComponent:
|
||||
@"data/crosshair.png"], &xs, &ys, false))
|
||||
fatal(@"could not find core textures (hint: run cube "
|
||||
@"from the parent of the bin directory)");
|
||||
|
||||
|
@ -339,9 +321,8 @@ VARP(minmillis, 0, 5, 1000);
|
|||
endianswap(dest, 3, _width);
|
||||
}
|
||||
|
||||
OFString *path = [OFString
|
||||
stringWithFormat:@"screenshots/screenshot_%d.bmp",
|
||||
lastmillis];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"screenshots/screenshot_%d.bmp", lastmillis];
|
||||
SDL_SaveBMP(temp,
|
||||
[_userDataIRI IRIByAppendingPathComponent: path]
|
||||
.fileSystemRepresentation.UTF8String);
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
snap: (int)snap
|
||||
name: (OFString *)name
|
||||
{
|
||||
return [[self alloc] initWithRad:rad h:h zoff:zoff snap:snap name:name];
|
||||
return [[self alloc] initWithRad: rad
|
||||
h: h
|
||||
zoff: zoff
|
||||
snap: snap
|
||||
name: name];
|
||||
}
|
||||
|
||||
- (instancetype)initWithRad: (int)rad
|
||||
|
|
|
@ -305,7 +305,10 @@ enemylos(Monster *m, OFVector3D *v)
|
|||
case M_ATTACKING:
|
||||
case M_SEARCH:
|
||||
if (self.trigger < lastmillis)
|
||||
[self transitionWithState:M_HOME moving:1 n:100 r:200];
|
||||
[self transitionWithState: M_HOME
|
||||
moving: 1
|
||||
n: 100
|
||||
r: 200];
|
||||
break;
|
||||
|
||||
case M_SLEEP: // state classic sp monster start in, wait for visual
|
||||
|
@ -321,7 +324,10 @@ enemylos(Monster *m, OFVector3D *v)
|
|||
|| (disttoenemy < 16 && angle < 135) ||
|
||||
(disttoenemy < 32 && angle < 90) ||
|
||||
(disttoenemy < 64 && angle < 45) || angle < 10) {
|
||||
[self transitionWithState:M_HOME moving:1 n:500 r:200];
|
||||
[self transitionWithState: M_HOME
|
||||
moving: 1
|
||||
n: 500
|
||||
r: 200];
|
||||
OFVector3D loc = self.origin;
|
||||
playsound(S_GRUNT1 + rnd(2), &loc);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ OF_DIRECT_MEMBERS
|
|||
@property (readonly, nonatomic) OFString *query;
|
||||
@property (readonly, nonatomic) ENetAddress address;
|
||||
|
||||
+ (instancetype)resultWithQuery:(OFString *)query address:(ENetAddress)address;
|
||||
+ (instancetype)resultWithQuery: (OFString *)query
|
||||
address: (ENetAddress)address;
|
||||
- (instancetype)init OF_UNAVAILABLE;
|
||||
- (instancetype)initWithQuery:(OFString *)query address:(ENetAddress)address;
|
||||
- (instancetype)initWithQuery: (OFString *)query
|
||||
address: (ENetAddress)address OF_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
|
|
@ -25,8 +25,8 @@ extern OFMutableArray<ResolverResult *> *resolverresults;
|
|||
enet_address_set_host(&address, _query.UTF8String);
|
||||
|
||||
@synchronized(ResolverThread.class) {
|
||||
[resolverresults
|
||||
addObject:[ResolverResult resultWithQuery:_query
|
||||
[resolverresults addObject:
|
||||
[ResolverResult resultWithQuery: _query
|
||||
address: address]];
|
||||
|
||||
_query = NULL;
|
||||
|
|
|
@ -35,7 +35,7 @@ OF_ASSUME_NONNULL_BEGIN
|
|||
}); \
|
||||
}
|
||||
#define VARF(name, min_, cur, max_, body) \
|
||||
static void var_##name(); \
|
||||
static void var_##name(void); \
|
||||
static int name = cur; \
|
||||
\
|
||||
OF_CONSTRUCTOR() \
|
||||
|
@ -52,9 +52,13 @@ OF_ASSUME_NONNULL_BEGIN
|
|||
}); \
|
||||
} \
|
||||
\
|
||||
static void var_##name() { body; }
|
||||
static void \
|
||||
var_##name(void) \
|
||||
{ \
|
||||
body; \
|
||||
}
|
||||
#define VARFP(name, min_, cur, max_, body) \
|
||||
static void var_##name(); \
|
||||
static void var_##name(void); \
|
||||
static int name = cur; \
|
||||
\
|
||||
OF_CONSTRUCTOR() \
|
||||
|
@ -71,7 +75,11 @@ OF_ASSUME_NONNULL_BEGIN
|
|||
}); \
|
||||
} \
|
||||
\
|
||||
static void var_##name() { body; }
|
||||
static void \
|
||||
var_##name(void) \
|
||||
{ \
|
||||
body; \
|
||||
}
|
||||
|
||||
@interface Variable: Identifier
|
||||
@property (direct, readonly, nonatomic) int min, max;
|
||||
|
|
|
@ -51,21 +51,21 @@ renderclient(
|
|||
// mdl = (((int)d>>6)&1)+1;
|
||||
// mz = d.o.z-d.eyeHeight+0.2f;
|
||||
// scale = 1.2f;
|
||||
} else if (d.state == CS_EDITING) {
|
||||
} else if (d.state == CS_EDITING)
|
||||
n = 16;
|
||||
} else if (d.state == CS_LAGGED) {
|
||||
else if (d.state == CS_LAGGED)
|
||||
n = 17;
|
||||
} else if ([d isKindOfClass:Monster.class] &&
|
||||
((Monster *)d).monsterState == M_ATTACKING) {
|
||||
else if ([d isKindOfClass: Monster.class] &&
|
||||
((Monster *)d).monsterState == M_ATTACKING)
|
||||
n = 8;
|
||||
} else if ([d isKindOfClass:Monster.class] &&
|
||||
((Monster *)d).monsterState == M_PAIN) {
|
||||
else if ([d isKindOfClass: Monster.class] &&
|
||||
((Monster *)d).monsterState == M_PAIN)
|
||||
n = 10;
|
||||
} else if ((!d.move && !d.strafe) || !d.moving) {
|
||||
else if ((!d.move && !d.strafe) || !d.moving)
|
||||
n = 12;
|
||||
} else if (!d.onFloor && d.timeInAir > 100) {
|
||||
else if (!d.onFloor && d.timeInAir > 100)
|
||||
n = 18;
|
||||
} else {
|
||||
else {
|
||||
n = 14;
|
||||
speed = 1200 / d.maxSpeed * scale;
|
||||
if (hellpig)
|
||||
|
@ -86,13 +86,12 @@ extern int democlientnum;
|
|||
void
|
||||
renderclients()
|
||||
{
|
||||
[players
|
||||
enumerateObjectsUsingBlock:^(Player *player, size_t i, bool *stop) {
|
||||
[players enumerateObjectsUsingBlock: ^ (Player *player, size_t i,
|
||||
bool *stop) {
|
||||
if ([player isKindOfClass: Player.class] &&
|
||||
(!demoplayback || i != democlientnum))
|
||||
renderclient(player,
|
||||
isteam(Player.player1.team, [player team]),
|
||||
@"monster/ogro", false, 1.0f);
|
||||
renderclient(player, isteam(Player.player1.team,
|
||||
[player team]), @"monster/ogro", false, 1.0f);
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -169,8 +168,8 @@ renderscores()
|
|||
addteamscore(Player.player1);
|
||||
OFMutableString *teamScores = [OFMutableString string];
|
||||
for (size_t j = 0; j < teamsUsed; j++)
|
||||
[teamScores appendFormat:@"[ %@: %d ]", teamName[j],
|
||||
teamScore[j]];
|
||||
[teamScores appendFormat:
|
||||
@"[ %@: %d ]", teamName[j], teamScore[j]];
|
||||
menumanual(0, scoreLines.count, @"");
|
||||
menumanual(0, scoreLines.count + 1, teamScores);
|
||||
}
|
||||
|
@ -204,10 +203,8 @@ COMMAND(sendmap, ARG_1STR, (^(OFString *mapname) {
|
|||
enet_packet_resize(packet, p - start);
|
||||
sendpackettoserv(packet);
|
||||
conoutf(@"sending map %@ to server...", mapname);
|
||||
OFString *msg =
|
||||
[OFString stringWithFormat:@"[map %@ uploaded to server, "
|
||||
@"\"getmap\" to receive it]",
|
||||
mapname];
|
||||
OFString *msg = [OFString stringWithFormat:
|
||||
@"[map %@ uploaded to server, \"getmap\" to receive it]", mapname];
|
||||
toserver(msg);
|
||||
}))
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ extern int democlientnum;
|
|||
void
|
||||
otherplayers()
|
||||
{
|
||||
[players
|
||||
enumerateObjectsUsingBlock:^(Player *player, size_t i, bool *stop) {
|
||||
[players enumerateObjectsUsingBlock: ^ (Player *player, size_t i,
|
||||
bool *stop) {
|
||||
if ([player isKindOfClass: Player.class])
|
||||
return;
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ COMMAND(team, ARG_1STR, ^(OFString *name) {
|
|||
void
|
||||
writeclientinfo(OFStream *stream)
|
||||
{
|
||||
[stream writeFormat:@"name \"%@\"\nteam \"%@\"\n", Player.player1.name,
|
||||
Player.player1.team];
|
||||
[stream writeFormat: @"name \"%@\"\nteam \"%@\"\n",
|
||||
Player.player1.name, Player.player1.team];
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -317,8 +317,7 @@ c2sinfo(Player *d)
|
|||
putint(&p, (int)(d.velocity.y * DVF));
|
||||
putint(&p, (int)(d.velocity.z * DVF));
|
||||
// pack rest in 1 byte: strafe:2, move:2, onFloor:1, state:3
|
||||
putint(&p,
|
||||
(d.strafe & 3) | ((d.move & 3) << 2) |
|
||||
putint(&p, (d.strafe & 3) | ((d.move & 3) << 2) |
|
||||
(((int)d.onFloor) << 4) |
|
||||
((editmode ? CS_EDITING : d.state) << 5));
|
||||
|
||||
|
|
|
@ -174,10 +174,10 @@ localservertoclient(unsigned char *buf, int len)
|
|||
// server requests next map
|
||||
case SV_MAPRELOAD: {
|
||||
getint(&p);
|
||||
OFString *nextmapalias = [OFString
|
||||
stringWithFormat:@"nextmap_%@", getclientmap()];
|
||||
OFString *map =
|
||||
getalias(nextmapalias); // look up map in the cycle
|
||||
OFString *nextmapalias = [OFString stringWithFormat:
|
||||
@"nextmap_%@", getclientmap()];
|
||||
// look up map in the cycle
|
||||
OFString *map = getalias(nextmapalias);
|
||||
changemap(map != nil ? map : getclientmap());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ parseexp(char **p, int right)
|
|||
if (left == '(') {
|
||||
OFString *t;
|
||||
@try {
|
||||
t = [OFString
|
||||
stringWithFormat:@"%d", execute(@(s), true)];
|
||||
t = [OFString stringWithFormat:
|
||||
@"%d", execute(@(s), true)];
|
||||
} @finally {
|
||||
free(s);
|
||||
}
|
||||
|
@ -143,7 +143,8 @@ lookup(OFString *n)
|
|||
Identifier.identifiers[[n substringFromIndex: 1]];
|
||||
|
||||
if ([identifier isKindOfClass: Variable.class]) {
|
||||
return [OFString stringWithFormat:@"%d", *[identifier storage]];
|
||||
return [OFString stringWithFormat:
|
||||
@"%d", *[identifier storage]];
|
||||
} else if ([identifier isKindOfClass: Alias.class])
|
||||
return [identifier action];
|
||||
|
||||
|
@ -180,8 +181,8 @@ executeIdentifier(__kindof Identifier *identifier,
|
|||
if (arguments.count < 2 || arguments[1].length == 0)
|
||||
[identifier printValue];
|
||||
else
|
||||
[identifier
|
||||
setValue:[arguments[1] cube_intValueWithBase:0]];
|
||||
[identifier setValue:
|
||||
[arguments[1] cube_intValueWithBase: 0]];
|
||||
}
|
||||
|
||||
if ([identifier isKindOfClass: Alias.class]) {
|
||||
|
@ -279,12 +280,12 @@ complete(OFMutableString *s)
|
|||
}
|
||||
|
||||
__block int idx = 0;
|
||||
[Identifier.identifiers enumerateKeysAndObjectsUsingBlock:^(
|
||||
OFString *name, __kindof Identifier *identifier, bool *stop) {
|
||||
[Identifier.identifiers enumerateKeysAndObjectsUsingBlock:
|
||||
^ (OFString *name, __kindof Identifier *identifier, bool *stop) {
|
||||
if (strncmp(identifier.name.UTF8String, s.UTF8String + 1,
|
||||
completesize) == 0 &&
|
||||
idx++ == completeidx)
|
||||
[s replaceCharactersInRange:OFMakeRange(1, s.length - 1)
|
||||
completesize) == 0 && idx++ == completeidx)
|
||||
[s replaceCharactersInRange: OFMakeRange(
|
||||
1, s.length - 1)
|
||||
withString: identifier.name];
|
||||
}];
|
||||
|
||||
|
@ -331,43 +332,45 @@ writecfg()
|
|||
@try {
|
||||
OFIRI *IRI = [Cube.sharedInstance.userDataIRI
|
||||
IRIByAppendingPathComponent: @"config.cfg"];
|
||||
stream = [[OFIRIHandler handlerForIRI:IRI] openItemAtIRI:IRI
|
||||
stream = [[OFIRIHandler handlerForIRI: IRI]
|
||||
openItemAtIRI: IRI
|
||||
mode: @"w"];
|
||||
} @catch (id e) {
|
||||
return;
|
||||
}
|
||||
|
||||
[stream writeString:@"// automatically written on exit, do not modify\n"
|
||||
@"// delete this file to have defaults.cfg "
|
||||
@"overwrite these settings\n"
|
||||
@"// modify settings in game, or put settings in "
|
||||
@"autoexec.cfg to override anything\n"
|
||||
[stream writeString:
|
||||
@"// automatically written on exit, do not modify\n"
|
||||
@"// delete this file to have defaults.cfg overwrite these "
|
||||
@"settings\n"
|
||||
@"// modify settings in game, or put settings in autoexec.cfg to "
|
||||
@"override anything\n"
|
||||
@"\n"];
|
||||
writeclientinfo(stream);
|
||||
[stream writeString: @"\n"];
|
||||
|
||||
[Identifier.identifiers enumerateKeysAndObjectsUsingBlock:^(
|
||||
OFString *name, __kindof Identifier *identifier, bool *stop) {
|
||||
[Identifier.identifiers enumerateKeysAndObjectsUsingBlock:
|
||||
^ (OFString *name, __kindof Identifier *identifier, bool *stop) {
|
||||
if (![identifier isKindOfClass: Variable.class] ||
|
||||
![identifier persisted])
|
||||
return;
|
||||
|
||||
[stream writeFormat:@"%@ %d\n", identifier.name,
|
||||
*[identifier storage]];
|
||||
[stream writeFormat:
|
||||
@"%@ %d\n", identifier.name, *[identifier storage]];
|
||||
}];
|
||||
[stream writeString: @"\n"];
|
||||
|
||||
writebinds(stream);
|
||||
[stream writeString: @"\n"];
|
||||
|
||||
[Identifier.identifiers enumerateKeysAndObjectsUsingBlock:^(
|
||||
OFString *name, __kindof Identifier *identifier, bool *stop) {
|
||||
if (![identifier isKindOfClass:Alias.class] ||
|
||||
[identifier.name hasPrefix:@"nextmap_"])
|
||||
[Identifier.identifiers enumerateKeysAndObjectsUsingBlock:
|
||||
^ (OFString *name, Alias *alias, bool *stop) {
|
||||
if (![alias isKindOfClass: Alias.class] ||
|
||||
[alias.name hasPrefix: @"nextmap_"])
|
||||
return;
|
||||
|
||||
[stream writeFormat:@"alias \"%@\" [%@]\n", identifier.name,
|
||||
[identifier action]];
|
||||
[stream writeFormat: @"alias \"%@\" [%@]\n",
|
||||
alias.name, alias.action];
|
||||
}];
|
||||
|
||||
[stream close];
|
||||
|
|
|
@ -226,11 +226,11 @@ keypress(int code, bool isDown)
|
|||
init];
|
||||
|
||||
if (vhistory.count == 0 ||
|
||||
![vhistory.lastObject
|
||||
isEqual:commandbuf]) {
|
||||
![vhistory.lastObject isEqual:
|
||||
commandbuf]) {
|
||||
// cap this?
|
||||
[vhistory addObject:[commandbuf
|
||||
copy]];
|
||||
[vhistory addObject:
|
||||
[commandbuf copy]];
|
||||
}
|
||||
histpos = vhistory.count;
|
||||
if ([commandbuf hasPrefix: @"/"])
|
||||
|
@ -275,6 +275,6 @@ writebinds(OFStream *stream)
|
|||
{
|
||||
for (KeyMapping *mapping in keyMappings)
|
||||
if (mapping.action.length > 0)
|
||||
[stream writeFormat:@"bind \"%@\" [%@]\n", mapping.name,
|
||||
mapping.action];
|
||||
[stream writeFormat: @"bind \"%@\" [%@]\n",
|
||||
mapping.name, mapping.action];
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ OF_CONSTRUCTOR()
|
|||
{ @"selxs", &sel.xs }, { @"selys", &sel.ys } };
|
||||
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
Variable *variable =
|
||||
[Variable variableWithName:vars[i].name
|
||||
Variable *variable = [Variable
|
||||
variableWithName: vars[i].name
|
||||
min: 0
|
||||
max: 4096
|
||||
storage: vars[i].storage
|
||||
|
|
|
@ -113,8 +113,8 @@ menumanual(int m, int n, OFString *text)
|
|||
COMMAND(menuitem, ARG_2STR, ^ (OFString *text, OFString *action) {
|
||||
Menu *menu = menus.lastObject;
|
||||
|
||||
MenuItem *item =
|
||||
[MenuItem itemWithText:text
|
||||
MenuItem *item = [MenuItem
|
||||
itemWithText: text
|
||||
action: (action.length > 0 ? action : text)];
|
||||
[menu.items addObject: item];
|
||||
})
|
||||
|
|
|
@ -108,10 +108,8 @@ collide(DynamicEntity *d, bool spawn, float drop, float rise)
|
|||
const int y2 = fy2;
|
||||
float hi = 127, lo = -128;
|
||||
// big monsters are afraid of heights, unless angry :)
|
||||
float minfloor =
|
||||
([d isKindOfClass:Monster.class] && !spawn && d.health > 100
|
||||
? d.origin.z - d.eyeHeight - 4.5f
|
||||
: -1000.0f);
|
||||
float minfloor = ([d isKindOfClass: Monster.class] && !spawn &&
|
||||
d.health > 100 ? d.origin.z - d.eyeHeight - 4.5f : -1000.0f);
|
||||
|
||||
for (int x = x1; x <= x2; x++) {
|
||||
for (int y = y1; y <= y2; y++) {
|
||||
|
|
|
@ -207,8 +207,9 @@ renderents()
|
|||
if (e >= 0) {
|
||||
Entity *c = ents[e];
|
||||
closeent =
|
||||
[OFString stringWithFormat:@"closest entity = %@ (%d, %d, "
|
||||
@"%d, %d), selection = (%d, %d)",
|
||||
[OFString stringWithFormat:
|
||||
@"closest entity = %@ (%d, %d, %d, %d), "
|
||||
@"selection = (%d, %d)",
|
||||
entnames[c.type], c.attr1, c.attr2, c.attr3, c.attr4,
|
||||
getvar(@"selxs"), getvar(@"selys")];
|
||||
}
|
||||
|
@ -227,14 +228,12 @@ COMMAND(loadsky, ARG_1STR, (^(OFString *basename) {
|
|||
@"up" };
|
||||
int texnum = 14;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
OFString *path = [OFString
|
||||
stringWithFormat:@"packages/%@_%@.jpg", basename, side[i]];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"packages/%@_%@.jpg", basename, side[i]];
|
||||
|
||||
int xs, ys;
|
||||
if (!installtex(texnum + i,
|
||||
[Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent:path],
|
||||
&xs, &ys, true))
|
||||
if (!installtex(texnum + i, [Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent: path], &xs, &ys, true))
|
||||
conoutf(@"could not load sky textures");
|
||||
}
|
||||
|
||||
|
@ -407,7 +406,8 @@ gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater)
|
|||
[[OFColor colorWithRed: 1.0f
|
||||
green: 0.5f
|
||||
blue: 0.0f
|
||||
alpha:1.0f] cube_setAsGLColor];
|
||||
alpha: 1.0f]
|
||||
cube_setAsGLColor];
|
||||
}
|
||||
float chsize = (float)crosshairsize;
|
||||
glTexCoord2d(0.0, 0.0);
|
||||
|
|
|
@ -237,13 +237,11 @@ lookuptexture(int tex, int *xs, int *ys)
|
|||
int tnum = curtex + FIRSTTEX;
|
||||
texname[curtex] = mapname[tex][frame];
|
||||
|
||||
OFString *path =
|
||||
[OFString stringWithFormat:@"packages/%@", texname[curtex]];
|
||||
OFString *path = [OFString stringWithFormat: @"packages/%@",
|
||||
texname[curtex]];
|
||||
|
||||
if (installtex(tnum,
|
||||
[Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent:path],
|
||||
xs, ys, false)) {
|
||||
if (installtex(tnum, [Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent: path], xs, ys, false)) {
|
||||
mapping[tex][frame] = tnum;
|
||||
texx[curtex] = *xs;
|
||||
texy[curtex] = *ys;
|
||||
|
|
|
@ -17,16 +17,18 @@ void
|
|||
delayedload(MD2 *m)
|
||||
{
|
||||
if (!m.loaded) {
|
||||
OFString *path = [OFString
|
||||
stringWithFormat:@"packages/models/%@", m.loadname];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"packages/models/%@", m.loadname];
|
||||
OFIRI *baseIRI = [Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
|
||||
OFIRI *IRI1 = [baseIRI IRIByAppendingPathComponent:@"tris.md2"];
|
||||
OFIRI *IRI1 = [baseIRI
|
||||
IRIByAppendingPathComponent: @"tris.md2"];
|
||||
if (![m loadWithIRI: IRI1])
|
||||
fatal(@"loadmodel: %@", IRI1.string);
|
||||
|
||||
OFIRI *IRI2 = [baseIRI IRIByAppendingPathComponent:@"skin.jpg"];
|
||||
OFIRI *IRI2 = [baseIRI
|
||||
IRIByAppendingPathComponent: @"skin.jpg"];
|
||||
int xs, ys;
|
||||
installtex(FIRSTMDL + m.mdlnum, IRI2, &xs, &ys, false);
|
||||
m.loaded = true;
|
||||
|
@ -55,11 +57,9 @@ loadmodel(OFString *name)
|
|||
return m;
|
||||
}
|
||||
|
||||
COMMAND(mapmodel, ARG_5STR,
|
||||
^(OFString *rad, OFString *h, OFString *zoff, OFString *snap,
|
||||
OFString *name) {
|
||||
MD2 *m =
|
||||
loadmodel([name stringByReplacingOccurrencesOfString:@"\\"
|
||||
COMMAND(mapmodel, ARG_5STR, ^ (OFString *rad, OFString *h, OFString *zoff,
|
||||
OFString *snap, OFString *name) {
|
||||
MD2 *m = loadmodel([name stringByReplacingOccurrencesOfString: @"\\"
|
||||
withString: @"/"]);
|
||||
m.mmi = [MapModelInfo infoWithRad: rad.cube_intValue
|
||||
h: h.cube_intValue
|
||||
|
@ -102,7 +102,7 @@ rendermodel(OFString *mdl, int frame, int range, int tex, float rad,
|
|||
|
||||
int ix = (int)position.x;
|
||||
int iy = (int)position.z;
|
||||
OFColor *light = [OFColor colorWithRed:1 green:1 blue:1 alpha:1];
|
||||
OFColor *light = OFColor.white;
|
||||
|
||||
if (!OUTBORD(ix, iy)) {
|
||||
struct sqr *s = S(ix, iy);
|
||||
|
|
|
@ -97,8 +97,7 @@ savestate(OFIRI *IRI)
|
|||
{
|
||||
stop();
|
||||
f = gzopen([IRI.fileSystemRepresentation
|
||||
cStringWithEncoding:OFLocale.encoding],
|
||||
"wb9");
|
||||
cStringWithEncoding: OFLocale.encoding], "wb9");
|
||||
if (!f) {
|
||||
conoutf(@"could not write %@", IRI.string);
|
||||
return;
|
||||
|
@ -137,9 +136,10 @@ COMMAND(savegame, ARG_1STR, (^(OFString *name) {
|
|||
return;
|
||||
}
|
||||
|
||||
OFString *path = [OFString stringWithFormat:@"savegames/%@.csgz", name];
|
||||
OFIRI *IRI =
|
||||
[Cube.sharedInstance.userDataIRI IRIByAppendingPathComponent:path];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"savegames/%@.csgz", name];
|
||||
OFIRI *IRI = [Cube.sharedInstance.userDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
savestate(IRI);
|
||||
stop();
|
||||
conoutf(@"wrote %@", IRI.string);
|
||||
|
@ -152,8 +152,7 @@ loadstate(OFIRI *IRI)
|
|||
if (multiplayer())
|
||||
return;
|
||||
f = gzopen([IRI.fileSystemRepresentation
|
||||
cStringWithEncoding:OFLocale.encoding],
|
||||
"rb9");
|
||||
cStringWithEncoding: OFLocale.encoding], "rb9");
|
||||
if (!f) {
|
||||
conoutf(@"could not open %@", IRI.string);
|
||||
return;
|
||||
|
@ -184,9 +183,10 @@ out:
|
|||
}
|
||||
|
||||
COMMAND(loadgame, ARG_1STR, (^ (OFString *name) {
|
||||
OFString *path = [OFString stringWithFormat:@"savegames/%@.csgz", name];
|
||||
OFIRI *IRI =
|
||||
[Cube.sharedInstance.userDataIRI IRIByAppendingPathComponent:path];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"savegames/%@.csgz", name];
|
||||
OFIRI *IRI = [Cube.sharedInstance.userDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
loadstate(IRI);
|
||||
}))
|
||||
|
||||
|
@ -275,8 +275,8 @@ COMMAND(record, ARG_1STR, (^(OFString *name) {
|
|||
return;
|
||||
|
||||
OFString *path = [OFString stringWithFormat: @"demos/%@.cdgz", name];
|
||||
OFIRI *IRI =
|
||||
[Cube.sharedInstance.userDataIRI IRIByAppendingPathComponent:path];
|
||||
OFIRI *IRI = [Cube.sharedInstance.userDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
savestate(IRI);
|
||||
gzputi(cn);
|
||||
conoutf(@"started recording demo to %@", IRI.string);
|
||||
|
@ -335,8 +335,8 @@ incomingdemodata(unsigned char *buf, int len, bool extras)
|
|||
|
||||
COMMAND(demo, ARG_1STR, (^ (OFString *name) {
|
||||
OFString *path = [OFString stringWithFormat: @"demos/%@.cdgz", name];
|
||||
OFIRI *IRI =
|
||||
[Cube.sharedInstance.userDataIRI IRIByAppendingPathComponent:path];
|
||||
OFIRI *IRI = [Cube.sharedInstance.userDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
loadstate(IRI);
|
||||
demoloading = true;
|
||||
}))
|
||||
|
|
31
src/server.m
31
src/server.m
|
@ -24,8 +24,8 @@ int mode = 0;
|
|||
void
|
||||
restoreserverstate(OFArray<Entity *> *ents)
|
||||
{
|
||||
[sents enumerateObjectsUsingBlock:^(
|
||||
ServerEntity *e, size_t i, bool *stop) {
|
||||
[sents enumerateObjectsUsingBlock:
|
||||
^ (ServerEntity *e, size_t i, bool *stop) {
|
||||
e.spawned = ents[i].spawned;
|
||||
e.spawnsecs = 0;
|
||||
}];
|
||||
|
@ -159,8 +159,8 @@ vote(OFString *map, int reqmode, int sender)
|
|||
if (yes == 1 && no == 0)
|
||||
return true; // single player
|
||||
|
||||
OFString *msg = [OFString
|
||||
stringWithFormat:@"%@ suggests %@ on map %@ (set map to vote)",
|
||||
OFString *msg = [OFString stringWithFormat:
|
||||
@"%@ suggests %@ on map %@ (set map to vote)",
|
||||
clients[sender].name, modestr(reqmode), map];
|
||||
sendservmsg(msg);
|
||||
|
||||
|
@ -227,8 +227,8 @@ process(ENetPacket *packet, int sender) // sender may be -1
|
|||
while ((n = getint(&p)) != -1)
|
||||
if (notgotitems) {
|
||||
while (sents.count <= n)
|
||||
[sents addObject:[ServerEntity
|
||||
entity]];
|
||||
[sents addObject:
|
||||
[ServerEntity entity]];
|
||||
sents[n].spawned = true;
|
||||
}
|
||||
notgotitems = false;
|
||||
|
@ -314,8 +314,8 @@ send_welcome(int n)
|
|||
sendstring(smapname, &p);
|
||||
putint(&p, mode);
|
||||
putint(&p, SV_ITEMLIST);
|
||||
[sents enumerateObjectsUsingBlock:^(
|
||||
ServerEntity *e, size_t i, bool *stop) {
|
||||
[sents enumerateObjectsUsingBlock:
|
||||
^ (ServerEntity *e, size_t i, bool *stop) {
|
||||
if (e.spawned)
|
||||
putint(&p, i);
|
||||
}];
|
||||
|
@ -405,8 +405,8 @@ serverslice(int seconds,
|
|||
// sp, or dedicated server loop
|
||||
{
|
||||
// spawn entities when timer reached
|
||||
[sents enumerateObjectsUsingBlock:^(
|
||||
ServerEntity *e, size_t i, bool *stop) {
|
||||
[sents enumerateObjectsUsingBlock:
|
||||
^ (ServerEntity *e, size_t i, bool *stop) {
|
||||
if (e.spawnsecs && (e.spawnsecs -= seconds - lastsec) <= 0) {
|
||||
e.spawnsecs = 0;
|
||||
e.spawned = true;
|
||||
|
@ -421,8 +421,8 @@ serverslice(int seconds,
|
|||
checkintermission();
|
||||
if (interm && seconds > interm) {
|
||||
interm = 0;
|
||||
[clients enumerateObjectsUsingBlock:^(
|
||||
Client *client, size_t i, bool *stop) {
|
||||
[clients enumerateObjectsUsingBlock:
|
||||
^ (Client *client, size_t i, bool *stop) {
|
||||
if (client.type != ST_EMPTY) {
|
||||
// ask a client to trigger map reload
|
||||
send2(true, i, SV_MAPRELOAD, 0);
|
||||
|
@ -475,8 +475,8 @@ serverslice(int seconds,
|
|||
&c.peer->address, hn, sizeof(hn)) == 0
|
||||
? @(hn)
|
||||
: @"localhost");
|
||||
[OFStdOut
|
||||
writeFormat:@"client connected (%@)\n", c.hostname];
|
||||
[OFStdOut writeFormat: @"client connected (%@)\n",
|
||||
c.hostname];
|
||||
send_welcome(lastconnect = clients.count - 1);
|
||||
break;
|
||||
}
|
||||
|
@ -489,7 +489,8 @@ serverslice(int seconds,
|
|||
case ENET_EVENT_TYPE_DISCONNECT:
|
||||
if ((intptr_t)event.peer->data < 0)
|
||||
break;
|
||||
[OFStdOut writeFormat:@"disconnected client (%@)\n",
|
||||
[OFStdOut writeFormat:
|
||||
@"disconnected client (%@)\n",
|
||||
clients[(size_t)event.peer->data].hostname];
|
||||
clients[(size_t)event.peer->data].type = ST_EMPTY;
|
||||
send2(true, -1, SV_CDIS, (intptr_t)event.peer->data);
|
||||
|
|
|
@ -217,16 +217,15 @@ refreshservers()
|
|||
[servers sort];
|
||||
|
||||
__block int maxmenu = 16;
|
||||
[servers enumerateObjectsUsingBlock:^(
|
||||
ServerInfo *si, size_t i, bool *stop) {
|
||||
[servers enumerateObjectsUsingBlock:
|
||||
^ (ServerInfo *si, size_t i, bool *stop) {
|
||||
if (si.address.host != ENET_HOST_ANY && si.ping != 9999) {
|
||||
if (si.protocol != PROTOCOL_VERSION)
|
||||
si.full = [OFString stringWithFormat:
|
||||
@"%@ [different cube protocol]",
|
||||
si.name];
|
||||
@"%@ [different cube protocol]", si.name];
|
||||
else
|
||||
si.full = [OFString
|
||||
stringWithFormat:@"%d\t%d\t%@, %@: %@ %@",
|
||||
si.full = [OFString stringWithFormat:
|
||||
@"%d\t%d\t%@, %@: %@ %@",
|
||||
si.ping, si.numplayers,
|
||||
si.map.length > 0 ? si.map : @"[unknown]",
|
||||
modestr(si.mode), si.name, si.sdesc];
|
||||
|
|
|
@ -26,7 +26,8 @@ httpgetsend(ENetAddress *ad, OFString *hostname, OFString *req, OFString *ref,
|
|||
return;
|
||||
}
|
||||
ENetBuffer buf;
|
||||
OFString *httpget = [OFString stringWithFormat:@"GET %@ HTTP/1.0\n"
|
||||
OFString *httpget = [OFString stringWithFormat:
|
||||
@"GET %@ HTTP/1.0\n"
|
||||
@"Host: %@\n"
|
||||
@"Referer: %@\n"
|
||||
@"User-Agent: %@\n\n",
|
||||
|
@ -77,8 +78,8 @@ updatemasterserver(int seconds)
|
|||
{
|
||||
// send alive signal to masterserver every hour of uptime
|
||||
if (seconds > updmaster) {
|
||||
OFString *path = [OFString
|
||||
stringWithFormat:@"%@register.do?action=add", masterpath];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"%@register.do?action=add", masterpath];
|
||||
httpgetsend(&masterserver, masterbase, path, @"cubeserver",
|
||||
@"Cube Server");
|
||||
masterrep[0] = 0;
|
||||
|
@ -100,8 +101,8 @@ checkmasterreply()
|
|||
unsigned char *
|
||||
retrieveservers(unsigned char *buf, int buflen)
|
||||
{
|
||||
OFString *path =
|
||||
[OFString stringWithFormat:@"%@retrieve.do?item=list", masterpath];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"%@retrieve.do?item=list", masterpath];
|
||||
httpgetsend(
|
||||
&masterserver, masterbase, path, @"cubeserver", @"Cube Server");
|
||||
ENetBuffer eb;
|
||||
|
@ -140,8 +141,8 @@ serverms(int mode, int numplayers, int minremain, OFString *smapname,
|
|||
putint(&p, mode);
|
||||
putint(&p, numplayers);
|
||||
putint(&p, minremain);
|
||||
OFString *mname = [OFString stringWithFormat:@"%@%@",
|
||||
(isfull ? @"[FULL] " : @""), smapname];
|
||||
OFString *mname = [OFString stringWithFormat:
|
||||
@"%@%@", (isfull ? @"[FULL] " : @""), smapname];
|
||||
sendstring(mname, &p);
|
||||
sendstring(serverdesc, &p);
|
||||
buf.dataLength = p - pong;
|
||||
|
@ -157,7 +158,8 @@ servermsinit(OFString *master_, OFString *sdesc, bool listen)
|
|||
if (!mid)
|
||||
mid = master;
|
||||
masterpath = @(mid);
|
||||
masterbase = [OFString stringWithUTF8String:master length:mid - master];
|
||||
masterbase = [OFString stringWithUTF8String: master
|
||||
length: mid - master];
|
||||
serverdesc = sdesc;
|
||||
|
||||
if (listen) {
|
||||
|
|
|
@ -58,8 +58,8 @@ COMMAND(music, ARG_1STR, (^(OFString *name) {
|
|||
if (soundvol && musicvol) {
|
||||
name = [name stringByReplacingOccurrencesOfString: @"\\"
|
||||
withString: @"/"];
|
||||
OFString *path =
|
||||
[OFString stringWithFormat:@"packages/%@", name];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"packages/%@", name];
|
||||
OFIRI *IRI = [Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
|
||||
|
@ -195,8 +195,8 @@ playsound(int n, const OFVector3D *loc)
|
|||
|
||||
Mix_Chunk **sample = (Mix_Chunk **)[samples mutableItemAtIndex: n];
|
||||
if (*sample == NULL) {
|
||||
OFString *path = [OFString
|
||||
stringWithFormat:@"packages/sounds/%@.wav", snames[n]];
|
||||
OFString *path = [OFString stringWithFormat:
|
||||
@"packages/sounds/%@.wav", snames[n]];
|
||||
OFIRI *IRI = [Cube.sharedInstance.gameDataIRI
|
||||
IRIByAppendingPathComponent: path];
|
||||
|
||||
|
|
11
src/weapon.m
11
src/weapon.m
|
@ -225,8 +225,8 @@ splash(Projectile *p, OFVector3D v, OFVector3D vold, int notthisplayer,
|
|||
|
||||
radialeffect(Player.player1, v, -1, qdam, p.owner);
|
||||
|
||||
[players enumerateObjectsUsingBlock:^(
|
||||
id player, size_t i, bool *stop) {
|
||||
[players enumerateObjectsUsingBlock:
|
||||
^ (id player, size_t i, bool *stop) {
|
||||
if (i == notthisplayer)
|
||||
return;
|
||||
|
||||
|
@ -236,8 +236,8 @@ splash(Projectile *p, OFVector3D v, OFVector3D vold, int notthisplayer,
|
|||
radialeffect(player, v, i, qdam, p.owner);
|
||||
}];
|
||||
|
||||
[Monster.monsters enumerateObjectsUsingBlock:^(
|
||||
Monster *monster, size_t i, bool *stop) {
|
||||
[Monster.monsters enumerateObjectsUsingBlock:
|
||||
^ (Monster *monster, size_t i, bool *stop) {
|
||||
if (i != notthismonster)
|
||||
radialeffect(monster, v, i, qdam, p.owner);
|
||||
}];
|
||||
|
@ -432,7 +432,8 @@ shoot(DynamicEntity *d, OFVector3D targ)
|
|||
if (guns[d.gunSelect].projspeed)
|
||||
return;
|
||||
|
||||
[players enumerateObjectsUsingBlock:^(id player, size_t i, bool *stop) {
|
||||
[players enumerateObjectsUsingBlock:
|
||||
^ (id player, size_t i, bool *stop) {
|
||||
if (player != [OFNull null])
|
||||
raydamage(player, from, to, d, i);
|
||||
}];
|
||||
|
|
|
@ -83,8 +83,8 @@ trigger(int tag, int type, bool savegame)
|
|||
if (!savegame && type != 3)
|
||||
playsound(S_RUMBLE, NULL);
|
||||
|
||||
OFString *aliasname =
|
||||
[OFString stringWithFormat:@"level_trigger_%d", tag];
|
||||
OFString *aliasname = [OFString stringWithFormat:
|
||||
@"level_trigger_%d", tag];
|
||||
|
||||
if (identexists(aliasname))
|
||||
execute(aliasname, true);
|
||||
|
|
|
@ -37,14 +37,14 @@ setnames(OFString *name)
|
|||
mapname = name;
|
||||
}
|
||||
|
||||
cgzname = [[OFString alloc]
|
||||
initWithFormat:@"packages/%@/%@.cgz", pakname, mapname];
|
||||
bakname = [[OFString alloc] initWithFormat:@"packages/%@/%@_%d.BAK",
|
||||
pakname, mapname, lastmillis];
|
||||
pcfname = [[OFString alloc]
|
||||
initWithFormat:@"packages/%@/package.cfg", pakname];
|
||||
mcfname = [[OFString alloc]
|
||||
initWithFormat:@"packages/%@/%@.cfg", pakname, mapname];
|
||||
cgzname = [[OFString alloc] initWithFormat:
|
||||
@"packages/%@/%@.cgz", pakname, mapname];
|
||||
bakname = [[OFString alloc] initWithFormat:
|
||||
@"packages/%@/%@_%d.BAK", pakname, mapname, lastmillis];
|
||||
pcfname = [[OFString alloc] initWithFormat:
|
||||
@"packages/%@/package.cfg", pakname];
|
||||
mcfname = [[OFString alloc] initWithFormat:
|
||||
@"packages/%@/%@.cfg", pakname, mapname];
|
||||
}
|
||||
|
||||
// the optimize routines below are here to reduce the detrimental effects of
|
||||
|
@ -178,8 +178,8 @@ save_world(OFString *mname)
|
|||
mname = getclientmap();
|
||||
setnames(mname);
|
||||
backup(cgzname, bakname);
|
||||
gzFile f =
|
||||
gzopen([cgzname cStringWithEncoding:OFLocale.encoding], "wb9");
|
||||
gzFile f = gzopen([cgzname cStringWithEncoding: OFLocale.encoding],
|
||||
"wb9");
|
||||
if (!f) {
|
||||
conoutf(@"could not write map to %@", cgzname);
|
||||
return;
|
||||
|
@ -270,8 +270,8 @@ load_world(OFString *mname) // still supports all map formats that have existed
|
|||
cleardlights();
|
||||
pruneundos(0);
|
||||
setnames(mname);
|
||||
gzFile f =
|
||||
gzopen([cgzname cStringWithEncoding:OFLocale.encoding], "rb9");
|
||||
gzFile f = gzopen([cgzname cStringWithEncoding: OFLocale.encoding],
|
||||
"rb9");
|
||||
if (!f) {
|
||||
conoutf(@"could not read map %@", cgzname);
|
||||
return;
|
||||
|
@ -396,8 +396,8 @@ load_world(OFString *mname) // still supports all map formats that have existed
|
|||
startmap(mname);
|
||||
for (int l = 0; l < 256; l++) {
|
||||
// can this be done smarter?
|
||||
OFString *aliasname =
|
||||
[OFString stringWithFormat:@"level_trigger_%d", l];
|
||||
OFString *aliasname = [OFString stringWithFormat:
|
||||
@"level_trigger_%d", l];
|
||||
if (identexists(aliasname))
|
||||
alias(aliasname, @"");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue