Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/data_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ static void parsePATH(BinaryReader* reader, DataWin* dw) {
path->isSmooth = BinaryReader_readBool32(reader);
path->isClosed = BinaryReader_readBool32(reader);
path->precision = BinaryReader_readUint32(reader);
path->exists = true;

// Points SimpleList
path->pointCount = BinaryReader_readUint32(reader);
Expand Down
1 change: 1 addition & 0 deletions src/data_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ typedef struct {
uint32_t internalPointCount;
InternalPathPoint* internalPoints;
float length; // total arc length
bool exists;
} GamePath;

typedef struct {
Expand Down
6 changes: 5 additions & 1 deletion src/vm_builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -14428,7 +14428,9 @@ static RValue builtin_throw(VMContext* ctx, RValue* args, int32_t argCount) {
static GamePath* getPath(Runner* runner, int32_t pathIdx) {
if (0 > pathIdx) return nullptr;
if ((uint32_t) pathIdx >= runner->dataWin->path.count) return nullptr;
return &runner->dataWin->path.paths[pathIdx];

GamePath* p = &runner->dataWin->path.paths[pathIdx];
return p->exists ? p : nullptr;
}

// path_add() - create a new empty path, return its index
Expand All @@ -14450,6 +14452,7 @@ static RValue builtin_path_add(VMContext* ctx, MAYBE_UNUSED RValue* args, MAYBE_
p->internalPointCount = 0;
p->internalPoints = nullptr;
p->length = 0.0;
p->exists = true;
pc->count = newIdx + 1;
return RValue_makeInt32((int32_t) newIdx);
}
Expand Down Expand Up @@ -14499,6 +14502,7 @@ static RValue builtin_path_delete(VMContext* ctx, RValue* args, int32_t argCount
free(p->points); p->points = nullptr; p->pointCount = 0;
free(p->internalPoints); p->internalPoints = nullptr; p->internalPointCount = 0;
p->length = 0.0;
p->exists = false;
return RValue_makeUndefined();
}

Expand Down
Loading