diff --git a/Kaos.c b/Kaos.c index b6861ab..de62882 100644 --- a/Kaos.c +++ b/Kaos.c @@ -387,10 +387,20 @@ void deleteFaceEachother(Kaos* target) } #ifdef SOUND_ON -Kaos* newPlaySound(int i) +Kaos* newPlaySound(char* args) { Kaos* core = rawKaos(); PlaySound* self = malloc(sizeof(PlaySound)); + int i; + + if (sscanf(args, "slot %d", &i) != 1) + { + free(core); + free(self); + core = NULL; + self = NULL; + return core; + } self->i = i; @@ -414,10 +424,21 @@ void deletePlaySound(Kaos* target) } #endif -Kaos* newErase(char t, int i) +Kaos* newErase(char* args) { Kaos* core = rawKaos(); Erase* self = malloc(sizeof(Erase)); + char t; + int i; + + if (sscanf(args, "objType %c, slot %d", &t, &i) != 2) + { + free(core); + free(self); + core = NULL; + self = NULL; + return core; + } self->type = t; self->index = i; @@ -459,11 +480,23 @@ void deleteErase(Kaos* target) free(target); } -Kaos* newWait(char t, int i) +Kaos* newWait(char* args) { Kaos* core = rawKaos(); Wait* self = malloc(sizeof(Wait)); + char t; + int i; + + if (sscanf(args, "wType %c, time %d", &t, &i) != 2) + { + free(core); + free(self); + core = NULL; + self = NULL; + return core; + } + self->type = t; self->frames = i; diff --git a/Kaos.h b/Kaos.h index 41cd9f8..1209c19 100644 --- a/Kaos.h +++ b/Kaos.h @@ -120,11 +120,11 @@ void runPlaySound(Kaos* self); void deletePlaySound(Kaos* target); #endif -Kaos* newErase(char t, int i); +Kaos* newErase(char* args); void runErase(Kaos* self); void deleteErase(Kaos* target); -Kaos* newWait(char t, int i); +Kaos* newWait(char* args); void runWait(Kaos* self); void deleteWait(Kaos* target); diff --git a/WorldData.c b/WorldData.c index 6ed2410..19538d5 100644 --- a/WorldData.c +++ b/WorldData.c @@ -258,7 +258,7 @@ int buildKaos(char* props) fp = &newConversation; break; case 'W': -// fp = &newWait; + fp = &newWait; break; case 'M': fp = &newManip; @@ -274,14 +274,14 @@ int buildKaos(char* props) break; case 'S': #ifdef SOUND_ON - //fp = &newPlaySound; + fp = &newPlaySound; break; #endif case 'T': fp = &newTeleport; break; case 'E': - //fp = &newErase; + fp = &newErase; break; } if (fp && !(kaosData[slot] = fp(kProps)))