From: chaoskagami Date: Sat, 23 Aug 2014 04:40:30 +0000 (-0400) Subject: Fixed if statements completely. Guess what? COMPLETELY 100% embedded ifs, and it... X-Git-Tag: stable-1 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=7450607b4bc21775896c49afa26dbfed29195af1;p=vn%2Fvndc.git Fixed if statements completely. Guess what? COMPLETELY 100% embedded ifs, and it's still 100% compatibile. Also, in the previous rev I added a script doc file. In this revision I made the program print the git rev instead of 0.0.1 b/c --- diff --git a/build b/build index e43af72..c3560a1 100755 --- a/build +++ b/build @@ -8,7 +8,7 @@ BIN=$ROOT/bin mkdir $LIB mkdir $BIN -CXXFLAGS=-g +CXXFLAGS="-g -DGIT_REV=\"$(git rev-parse HEAD)\"" source mk diff --git a/vndc/src/VNDC.cpp b/vndc/src/VNDC.cpp index f3301a2..c1c515c 100644 --- a/vndc/src/VNDC.cpp +++ b/vndc/src/VNDC.cpp @@ -13,9 +13,10 @@ void DebugTrap(int sig) { int main(int argc, char** argv) { printf(" ___________________________________________________________ \n"); - printf("| VNDC v0.0.1 - VNDC is Not a Direct Clone (of VNDS ;P) |\n"); + printf("| VNDC - VNDC is Not a Direct Clone (of VNDS ;P) |\n"); printf("| Interprets VNDS scripts with a few goodies and extensions |\n"); printf("| (C) Jonathan Feldman 2014 - Under the MIT license |\n"); + printf("| git: %s |\n", GIT_REV); printf("|___________________________________________________________|\n\n"); char* chdir_to_dir = NULL; diff --git a/vndc/src/op_bgload.cpp b/vndc/src/op_bgload.cpp index a6ad33a..119eacb 100644 --- a/vndc/src/op_bgload.cpp +++ b/vndc/src/op_bgload.cpp @@ -8,7 +8,7 @@ */ void op_bgload(char* file, int* fadetime) { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; // Fadeout not implemented yet. diff --git a/vndc/src/op_choice.cpp b/vndc/src/op_choice.cpp index 2c5e01e..fa3182c 100644 --- a/vndc/src/op_choice.cpp +++ b/vndc/src/op_choice.cpp @@ -11,7 +11,7 @@ */ void op_choice(char* line) { - if (GetData()->if_fail) + if (GetData()->if_fail != 0) return; // Strtok by the pipe '|' character diff --git a/vndc/src/op_cleartext.cpp b/vndc/src/op_cleartext.cpp index d05f9cd..4f917c5 100644 --- a/vndc/src/op_cleartext.cpp +++ b/vndc/src/op_cleartext.cpp @@ -40,7 +40,7 @@ void ct_transwindow() { */ void op_cleartext() { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; GetData()->text_x = GetData()->render_x1; diff --git a/vndc/src/op_delay.cpp b/vndc/src/op_delay.cpp index c032c10..c96b622 100644 --- a/vndc/src/op_delay.cpp +++ b/vndc/src/op_delay.cpp @@ -8,7 +8,7 @@ */ void op_delay(int* frames) { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; for(int i = 0; i < *frames; i++) { // This is one frame. diff --git a/vndc/src/op_fi.cpp b/vndc/src/op_fi.cpp index 20d8444..1816025 100644 --- a/vndc/src/op_fi.cpp +++ b/vndc/src/op_fi.cpp @@ -8,5 +8,6 @@ */ void op_fi() { - GetData()->if_fail -= 1; + if(GetData()->if_fail != 0) + GetData()->if_fail -= 1; } diff --git a/vndc/src/op_goto.cpp b/vndc/src/op_goto.cpp index d620e79..4f2615c 100644 --- a/vndc/src/op_goto.cpp +++ b/vndc/src/op_goto.cpp @@ -8,10 +8,10 @@ */ void op_goto(char* label) { + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) + return; FILE** infile = &(GetData()->accessScriptHandle); - if (GetData()->if_fail || GetData()->ctx->GetQuit()) - return; rewind(*infile); char *line = (char*)calloc(sizeof(char), 400); diff --git a/vndc/src/op_gsetvar.cpp b/vndc/src/op_gsetvar.cpp index 01f0bed..a3326ee 100644 --- a/vndc/src/op_gsetvar.cpp +++ b/vndc/src/op_gsetvar.cpp @@ -10,7 +10,7 @@ */ void op_gsetvar(char* var, int *modifier, int *value) { - if (GetData()->if_fail) + if (GetData()->if_fail != 0) return; if(*modifier == 0) { diff --git a/vndc/src/op_if.cpp b/vndc/src/op_if.cpp index cdc8a78..2114d2b 100644 --- a/vndc/src/op_if.cpp +++ b/vndc/src/op_if.cpp @@ -10,7 +10,7 @@ */ void op_if(char* var, int* op, int* val) { - if (GetData()->if_fail > 0) { + if (GetData()->if_fail != 0) { GetData()->if_fail += 1; return; } @@ -23,39 +23,27 @@ void op_if(char* var, int* op, int* val) { switch (op[0]) { case 0: if ( !(var_val <= val[0]) ) - GetData()->if_fail = true; - else - GetData()->if_fail = false; + GetData()->if_fail += 1; break; case 1: if ( !(var_val < val[0]) ) - GetData()->if_fail = true; - else - GetData()->if_fail = false; + GetData()->if_fail += 1; break; case 2: if ( !(var_val == val[0]) ) - GetData()->if_fail = true; - else - GetData()->if_fail = false; + GetData()->if_fail += 1; break; case 3: if ( !(var_val != val[0]) ) - GetData()->if_fail = true; - else - GetData()->if_fail = false; + GetData()->if_fail += 1; break; case 4: if ( !(var_val > val[0]) ) - GetData()->if_fail = true; - else - GetData()->if_fail = false; + GetData()->if_fail += 1; break; case 5: if ( !(var_val >= val[0]) ) - GetData()->if_fail = true; - else - GetData()->if_fail = false; + GetData()->if_fail += 1; break; } } diff --git a/vndc/src/op_jump.cpp b/vndc/src/op_jump.cpp index 98395ba..3770ff3 100644 --- a/vndc/src/op_jump.cpp +++ b/vndc/src/op_jump.cpp @@ -10,7 +10,7 @@ */ void op_jump(char* file, int* lineTo, bool isSave) { - if (GetData()->if_fail) + if (GetData()->if_fail != 0) return; memset(GetData()->current_scr, 0, 400); if(!isSave) diff --git a/vndc/src/op_music.cpp b/vndc/src/op_music.cpp index a817896..6be012e 100644 --- a/vndc/src/op_music.cpp +++ b/vndc/src/op_music.cpp @@ -8,7 +8,7 @@ */ void op_music(char* file) { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; memset(GetData()->current_music, 0, 400); diff --git a/vndc/src/op_random.cpp b/vndc/src/op_random.cpp index 1607378..5895ba9 100644 --- a/vndc/src/op_random.cpp +++ b/vndc/src/op_random.cpp @@ -10,7 +10,7 @@ bool seeded = false; void op_random(char* var, int* low, int* high) { - if (GetData()->if_fail) + if (GetData()->if_fail != 0) return; if (seeded == false) srand(time(NULL)); diff --git a/vndc/src/op_setimg.cpp b/vndc/src/op_setimg.cpp index e2c9a21..88f708d 100644 --- a/vndc/src/op_setimg.cpp +++ b/vndc/src/op_setimg.cpp @@ -8,7 +8,7 @@ */ void op_setimg(char* file, int* x, int* y) { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; // Fadeout not implemented yet. diff --git a/vndc/src/op_setvar.cpp b/vndc/src/op_setvar.cpp index b6477a9..045309d 100644 --- a/vndc/src/op_setvar.cpp +++ b/vndc/src/op_setvar.cpp @@ -10,7 +10,7 @@ */ void op_setvar(char* var, int* modifier, int* value) { - if (GetData()->if_fail) + if (GetData()->if_fail != 0) return; if(*modifier == 0) { diff --git a/vndc/src/op_sound.cpp b/vndc/src/op_sound.cpp index ec721cc..f6bd313 100644 --- a/vndc/src/op_sound.cpp +++ b/vndc/src/op_sound.cpp @@ -8,7 +8,7 @@ */ void op_sound(char* file, int* times) { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; // Fadeout not implemented yet. diff --git a/vndc/src/op_text.cpp b/vndc/src/op_text.cpp index 02a18d6..647dddb 100644 --- a/vndc/src/op_text.cpp +++ b/vndc/src/op_text.cpp @@ -8,7 +8,7 @@ */ void op_text(char* string) { - if (GetData()->if_fail || GetData()->ctx->GetQuit()) + if (GetData()->if_fail != 0 || GetData()->ctx->GetQuit()) return; // Search thru for vars and rebuild string.