Updated Toy
This commit is contained in:
2
Toy
2
Toy
Submodule Toy updated: f84cdff883...f2f8aed23a
@@ -100,7 +100,7 @@ fn generateLevel(node: opaque, seed: int, width: int, height: int) {
|
|||||||
var y = 0;
|
var y = 0;
|
||||||
|
|
||||||
//while generated spot is a collision, or too close to the player
|
//while generated spot is a collision, or too close to the player
|
||||||
while ((x == 0 && y == 0) || node.getCollisionAt(x, y) == false || (x < (width / 6 * 2) && y < (height / 6 * 2))) { //TODO: toy bug - no short-circuiting?
|
while (x == 0 && y == 0 || node.getCollisionAt(x, y) == false || x < width / 6 * 2 && y < height / 6 * 2) {
|
||||||
x = rng.generateRandomNumber() % width;
|
x = rng.generateRandomNumber() % width;
|
||||||
y = rng.generateRandomNumber() % height;
|
y = rng.generateRandomNumber() % height;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ static inline void execEvents() {
|
|||||||
}
|
}
|
||||||
args.count = 0;
|
args.count = 0;
|
||||||
}
|
}
|
||||||
break; //TODO: remove copied code
|
break;
|
||||||
|
|
||||||
//mouse wheel
|
//mouse wheel
|
||||||
case SDL_MOUSEWHEEL: {
|
case SDL_MOUSEWHEEL: {
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ static int nativeLoadNodeTexture(Toy_Interpreter* interpreter, Toy_LiteralArray*
|
|||||||
|
|
||||||
Toy_freeLiteral(drivePathLiteral); //not needed anymore
|
Toy_freeLiteral(drivePathLiteral); //not needed anymore
|
||||||
|
|
||||||
//actually load TODO: number the opaques, and check the numbers
|
//actually load TODO: number the opaques, and check the tag
|
||||||
Box_EngineNode* node = (Box_EngineNode*)TOY_AS_OPAQUE(nodeLiteral);
|
Box_EngineNode* node = (Box_EngineNode*)TOY_AS_OPAQUE(nodeLiteral);
|
||||||
|
|
||||||
if (node->texture != NULL) {
|
if (node->texture != NULL) {
|
||||||
|
|||||||
@@ -78,10 +78,10 @@ const unsigned char* Toy_compileString(const char* source, size_t* size) {
|
|||||||
Toy_initParser(&parser, &lexer);
|
Toy_initParser(&parser, &lexer);
|
||||||
Toy_initCompiler(&compiler);
|
Toy_initCompiler(&compiler);
|
||||||
|
|
||||||
//run the parser until the end of the source
|
//step 1 - run the parser until the end of the source
|
||||||
Toy_ASTNode* node = Toy_scanParser(&parser);
|
Toy_ASTNode* node = Toy_scanParser(&parser);
|
||||||
while(node != NULL) {
|
while(node != NULL) {
|
||||||
//pack up and leave
|
//on error, pack up and leave
|
||||||
if (node->type == TOY_AST_NODE_ERROR) {
|
if (node->type == TOY_AST_NODE_ERROR) {
|
||||||
Toy_freeASTNode(node);
|
Toy_freeASTNode(node);
|
||||||
Toy_freeCompiler(&compiler);
|
Toy_freeCompiler(&compiler);
|
||||||
@@ -94,7 +94,7 @@ const unsigned char* Toy_compileString(const char* source, size_t* size) {
|
|||||||
node = Toy_scanParser(&parser);
|
node = Toy_scanParser(&parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the bytecode dump
|
//step 2 - get the bytecode dump
|
||||||
const unsigned char* tb = Toy_collateCompiler(&compiler, size);
|
const unsigned char* tb = Toy_collateCompiler(&compiler, size);
|
||||||
|
|
||||||
//cleanup
|
//cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user