]> Chaos Git - vn/vndc.git/commitdiff
Fixed if statements completely. Guess what? COMPLETELY 100% embedded ifs, and it... stable-1
authorchaoskagami <chaos.kagami@gmail.com>
Sat, 23 Aug 2014 04:40:30 +0000 (00:40 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Sat, 23 Aug 2014 04:40:30 +0000 (00:40 -0400)
17 files changed:
build
vndc/src/VNDC.cpp
vndc/src/op_bgload.cpp
vndc/src/op_choice.cpp
vndc/src/op_cleartext.cpp
vndc/src/op_delay.cpp
vndc/src/op_fi.cpp
vndc/src/op_goto.cpp
vndc/src/op_gsetvar.cpp
vndc/src/op_if.cpp
vndc/src/op_jump.cpp
vndc/src/op_music.cpp
vndc/src/op_random.cpp
vndc/src/op_setimg.cpp
vndc/src/op_setvar.cpp
vndc/src/op_sound.cpp
vndc/src/op_text.cpp

diff --git a/build b/build
index e43af728d86f740d7be1c8ebdce73ffa25d4dd26..c3560a1c212fa00b72fc80c6cffa1084712bcef7 100755 (executable)
--- 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
 
index f3301a2111d0aad57578519c7bdcfaaa4421322f..c1c515c08418a40209bc00645a1a6dacfcefe9e0 100644 (file)
@@ -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;
index a6ad33ab93f685e831128bd2e56218bc479d7efe..119eacb71cf2c123f1431b13d29773a8d2bdbee7 100644 (file)
@@ -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.
index 2c5e01eb63eb4e1f73c34a3d2abc6c3416154f1a..fa3182c628f94a10df39e6bc5887ca65e5630d19 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 void op_choice(char* line) {
-       if (GetData()->if_fail)
+       if (GetData()->if_fail != 0)
                return;
        // Strtok by the pipe '|' character
 
index d05f9cd8df60a1ca2796f836cbd21c341904565f..4f917c51497333b99b0dc49c949fe77b82d3bdb8 100644 (file)
@@ -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;
index c032c10b7cd6e8516e3ec57aa3c98cafdaa7dc50..c96b622459fc3db80b7835696742905b7f11a444 100644 (file)
@@ -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.
index 20d8444ed24441ad2a6e8aa9f43091790dc90612..181602581a4c087b9d73c903b6554e44b2838a4c 100644 (file)
@@ -8,5 +8,6 @@
  */
 
 void op_fi() {
-       GetData()->if_fail -= 1;
+       if(GetData()->if_fail != 0)
+               GetData()->if_fail -= 1;
 }
index d620e79c652a098b369a13e34341e16c772b91ac..4f2615c7310ee6e020fd7e0f7e9d8773ff21f040 100644 (file)
@@ -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);
index 01f0bed090d37a3760d8704e68180b40a651497d..a3326ee60d48d35cb6a54252c7c86055c272871a 100644 (file)
@@ -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) {
index cdc8a7877c60f359d96e719343f0a62be269b42c..2114d2b38b1c32fa7897b226a5ed6d72244cc429 100644 (file)
@@ -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;
        }
 }
index 98395ba33167fb6e13f8533ae3e558730541762b..3770ff32ad7928e5fd99d0607d6e67149e0350db 100644 (file)
@@ -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)
index a817896fd2d3205e3ba7b206359739f17d95c37c..6be012e39c4015e5368d0d04d11ce4e6065aa22a 100644 (file)
@@ -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);
index 1607378b0021ac5d7dafcfb155302202acf52cd7..5895ba98e8dad2828f09ed326db87c7b1e7f1922 100644 (file)
@@ -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));
index e2c9a21aa805b45c7b38e838abb7e75520b6a483..88f708df2b34ec82d11be2ffb79c00f58de7bd84 100644 (file)
@@ -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.
index b6477a978833e0a699dfe5d0c84320a46af73582..045309d43d4ee51f41c98285cefd9b74e56f360d 100644 (file)
@@ -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) {
index ec721cc2b7a100c9b5eccebf200e5742d9f23303..f6bd3139d43cef73ac0ace1027cd28622bb81ebc 100644 (file)
@@ -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.
index 02a18d69f85211485f32fa4a6976bdd83207a57f..647dddb271c945d2f09228b555856b742f4a90c3 100644 (file)
@@ -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.