diff options
author | Eugene Sandulenko | 2019-06-26 19:56:30 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:01 +0200 |
commit | 79e33b113a720ac8852c8960077288db265e8286 (patch) | |
tree | 6b1054f286aa75d6accd22c42537150cf21fde7f | |
parent | 03f84464cb91d0914e375e5fcdcebe4c1120c120 (diff) | |
download | scummvm-rg350-79e33b113a720ac8852c8960077288db265e8286.tar.gz scummvm-rg350-79e33b113a720ac8852c8960077288db265e8286.tar.bz2 scummvm-rg350-79e33b113a720ac8852c8960077288db265e8286.zip |
HDB: Fix CineCommand struct, use const char * insted of preallocated arrays
-rw-r--r-- | engines/hdb/ai-cinematic.cpp | 23 | ||||
-rw-r--r-- | engines/hdb/ai.h | 8 |
2 files changed, 15 insertions, 16 deletions
diff --git a/engines/hdb/ai-cinematic.cpp b/engines/hdb/ai-cinematic.cpp index 5620f4fa85..9be634c718 100644 --- a/engines/hdb/ai-cinematic.cpp +++ b/engines/hdb/ai-cinematic.cpp @@ -453,8 +453,7 @@ void AI::cineStart(bool abortable, const char *abortFunc) { void AI::cineStop(const char *funcNext) { CineCommand *cmd = new CineCommand; cmd->cmdType = C_STOPCINE; - if (funcNext) - strcpy(cmd->title, funcNext); + cmd->title = funcNext; _cine.push_back(cmd); } @@ -511,7 +510,7 @@ void AI::cineWaitUntilDone() { void AI::cineSetEntity(const char *entName, int x, int y, int level) { CineCommand *cmd = new CineCommand; - strcpy(cmd->string, entName); + cmd->string = entName; cmd->x = x * kTileWidth; cmd->y = y * kTileHeight; cmd->x2 = level; @@ -526,7 +525,7 @@ void AI::cineMoveEntity(const char *entName, int x, int y, int level, int speed) cmd->x2 = level; cmd->start = 0; cmd->speed = speed; - strcpy(cmd->title, entName); + cmd->title = entName; cmd->cmdType = C_MOVEENTITY; _cine.push_back(cmd); } @@ -534,7 +533,7 @@ void AI::cineMoveEntity(const char *entName, int x, int y, int level, int speed) void AI::cineAnimEntity(const char *entName, AIState state, int loop) { CineCommand *cmd = new CineCommand; cmd->start = 0; - strcpy(cmd->title, entName); + cmd->title = entName; cmd->speed = state; cmd->end = loop; cmd->cmdType = C_ANIMENTITY; @@ -544,7 +543,7 @@ void AI::cineAnimEntity(const char *entName, AIState state, int loop) { void AI::cineSetAnimFrame(const char *entName, AIState state, int frame) { CineCommand *cmd = new CineCommand; cmd->start = state; - strcpy(cmd->title, entName); + cmd->title = entName; cmd->end = frame; cmd->cmdType = C_SETANIMFRAME; _cine.push_back(cmd); @@ -552,7 +551,7 @@ void AI::cineSetAnimFrame(const char *entName, AIState state, int frame) { void AI::cineEntityFace(const char *luaName, double dir) { CineCommand *cmd = new CineCommand; - strcpy(cmd->title, luaName); + cmd->title = luaName; cmd->x = dir; cmd->cmdType = C_ENTITYFACE; _cine.push_back(cmd); @@ -560,8 +559,8 @@ void AI::cineEntityFace(const char *luaName, double dir) { void AI::cineDialog(const char *title, const char *string, int seconds) { CineCommand *cmd = new CineCommand; - strcpy(cmd->title, title); - strcpy(cmd->string, string); + cmd->title = title; + cmd->string = string; cmd->delay = seconds; cmd->start = 1; if (!title || !string) @@ -586,15 +585,15 @@ void AI::cineMoveMaskedPic(const char *id, const char *pic, int x1, int y1, int cmd->xv = ((double)(x2-x1)) / (double)speed; cmd->yv = ((double)(y2-y1)) / (double)speed; cmd->start = 0; - strcpy(cmd->string, pic); - strcpy(cmd->id, id); + cmd->string = pic; + cmd->id = id; cmd->cmdType = C_MOVEMASKEDPIC; _cine.push_back(cmd); } void AI::cineUse(const char *entName) { CineCommand *cmd = new CineCommand; - strcpy(cmd->string, entName); + cmd->string = entName; cmd->cmdType = C_USEENTITY; _cine.push_back(cmd); } diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 4f18a57190..51b8657d6f 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -626,14 +626,14 @@ struct CineCommand { int start, end; uint32 delay; int speed; - char title[32]; - char string[32]; - char *id; + const char *title; + const char *string; + const char *id; AIEntity *e; Picture *pic; CineCommand() : cmdType(C_NO_COMMAND), x(0.0), y(0.0), x2(0.0), y2(0.0), xv(0.0), yv(0.0), - start(0), end(0), delay(0), speed(0), title(""), string(""), id(NULL), e(NULL), pic(NULL) {} + start(0), end(0), delay(0), speed(0), title(NULL), string(NULL), id(NULL), e(NULL), pic(NULL) {} }; struct CineBlit { |