diff options
author | Eugene Sandulenko | 2016-07-09 23:09:01 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 0b64438dbd3b2ff3579b47da9a46b274b2acde79 (patch) | |
tree | 4257a9004d89ec406e1bd220edbba528ac204c19 | |
parent | da408c0ad03429a4cbe9718491c1130fef47e1d1 (diff) | |
download | scummvm-rg350-0b64438dbd3b2ff3579b47da9a46b274b2acde79.tar.gz scummvm-rg350-0b64438dbd3b2ff3579b47da9a46b274b2acde79.tar.bz2 scummvm-rg350-0b64438dbd3b2ff3579b47da9a46b274b2acde79.zip |
DIRECTOR: Lingo: Added more 'the' entities. Implemented the floatPrecision entity
-rw-r--r-- | engines/director/director.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-the.cpp | 136 | ||||
-rw-r--r-- | engines/director/lingo/lingo-the.h | 12 | ||||
-rw-r--r-- | engines/director/lingo/lingo.cpp | 3 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 4 |
6 files changed, 97 insertions, 62 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 107a9a5f77..5a6c8ec32f 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -120,7 +120,7 @@ Common::Error DirectorEngine::run() { if x = 1 then\n\ put 1\n\ else if x = 2 then\n\ - put 2.1\n\ + put 1232.12345678901234\n\ put 2.2\n\ else if x = 3 then put 3\n\ end if\n\ diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 817f9c9a7f..f7dc403d3f 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -80,7 +80,7 @@ void Lingo::c_printtop(void) { warning("%d", d.u.i); break; case FLOAT: - warning("%f", d.u.f); + warning(g_lingo->_floatPrecisionFormat.c_str(), d.u.f); break; case VAR: if (!d.u.sym) { diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index b3c070286a..410be8ed4f 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -31,38 +31,47 @@ static struct TheEntityProto { const char *name; int hasID; } entities[] = { - { kTheFrame, "frame", VOID }, - { kThePathName, "pathname", VOID }, - { kTheMovie, "movie", VOID }, - { kTheMouseH, "mouseh", VOID }, - { kTheMouseV, "mousev", VOID }, - { kTheMouseDownScript, "mouseDownScript", VOID }, - { kTheMouseUpScript, "mouseUpScript", VOID }, + { kTheCast, "cast", INT }, // string? { kTheClickOn, "clickOn", VOID }, + { kTheColorDepth, "colorDepth", VOID }, + { kTheColorQD, "colorQD", VOID }, + { kTheCommandDown, "commandDown", VOID }, + { kTheControlDown, "controlDown", VOID }, { kTheDoubleClick, "doubleClick", VOID }, + { kTheExitLock, "exitlock", VOID }, + { kTheFloatPrecision, "floatPrecision", VOID }, + { kTheFrame, "frame", VOID }, + { kTheItemDelimiter, "itemDelimiter", VOID }, + { kTheKey, "key", VOID }, { kTheLastClick, "lastClick", VOID }, - { kTheLastFrame, "lastFrame", VOID }, { kTheLastEvent, "lastEvent", VOID }, - { kTheMouseUp, "mouseUp", VOID }, - { kTheMouseDown, "mouseDown", VOID }, - { kTheRightMouseUp, "rightMouseUp", VOID }, - { kTheRightMouseDown, "rightMouseDown", VOID }, - { kTheStillDown, "stillDown", VOID }, - { kTheKey, "key", VOID }, - { kTheControlDown, "controlDown", VOID }, - { kTheCommandDown, "commandDown", VOID }, - { kTheShiftDown, "shiftDown", VOID }, - { kTheOptionDown, "optionDown", VOID }, + { kTheLastFrame, "lastFrame", VOID }, { kTheMenu, "menu", INT }, { kTheMenus, "menus", VOID }, { kTheMenuItem, "menuitem", STRING }, // int? { kTheMenuItems, "menuitems", VOID }, - { kTheSprite, "sprite", INT }, - { kTheCast, "cast", INT }, // string? + { kTheMouseDown, "mouseDown", VOID }, + { kTheMouseDownScript, "mouseDownScript", VOID }, + { kTheMouseH, "mouseh", VOID }, + { kTheMouseUp, "mouseUp", VOID }, + { kTheMouseUpScript, "mouseUpScript", VOID }, + { kTheMouseV, "mousev", VOID }, + { kTheMovie, "movie", VOID }, + { kTheMultiSound, "multiSound", VOID }, + { kTheOptionDown, "optionDown", VOID }, + { kThePathName, "pathname", VOID }, { kThePerFrameHook, "perframehook", VOID }, + { kThePreloadEventAbort,"preloadEventAbort",VOID }, + { kTheRightMouseDown, "rightMouseDown", VOID }, + { kTheRightMouseUp, "rightMouseUp", VOID }, + { kTheRomanLingo, "romanLingo", VOID }, + { kTheShiftDown, "shiftDown", VOID }, + { kTheSprite, "sprite", INT }, + { kTheStage, "stage", VOID }, + { kTheStillDown, "stillDown", VOID }, { kTheTicks, "ticks", VOID }, - { kTheTimer, "timer", VOID }, { kTheTimeoutLength, "timeoutlength", VOID }, + { kTheTimer, "timer", VOID }, { kTheWindow, "window", VOID }, { kTheNOEntity, NULL, false } }; @@ -72,47 +81,47 @@ static struct TheEntityFieldProto { const char *name; TheField field; } fields[] = { - { kTheSprite, "castnum", kTheCastNum }, - { kTheSprite, "cursor", kTheCursor }, - { kTheSprite, "loch", kTheLocH }, - { kTheSprite, "locv", kTheLocV }, - { kTheSprite, "backColor", kTheBackColor }, - { kTheSprite, "blend", kTheBlend }, - { kTheSprite, "bottom", kTheBottom }, - { kTheSprite, "constraint", kTheConstraint }, - { kTheSprite, "editableText", kTheEditableText }, - { kTheSprite, "foreColor", kTheForeColor }, - { kTheSprite, "height", kTheHeight }, - { kTheSprite, "ink", kTheInk }, - { kTheSprite, "left", kTheLeft }, - { kTheSprite, "lineSize", kTheLineSize }, - { kTheSprite, "moveable", kTheMoveable }, - { kTheSprite, "movieRate", kTheMovieRate }, - { kTheSprite, "movieTime", kTheMovieTime }, - { kTheSprite, "right", kTheRight }, - { kTheSprite, "stopTime", kTheStopTime }, - { kTheSprite, "stretch", kTheStrech }, - { kTheSprite, "startTime", kTheStartTime }, - { kTheSprite, "scriptNum", kTheScriptNum }, - { kTheSprite, "top", kTheTop }, - { kTheSprite, "trails", kTheTrails }, - { kTheSprite, "type", kTheType }, - { kTheSprite, "visible", kTheVisible }, - { kTheSprite, "volume", kTheVolume }, - { kTheSprite, "width", kTheWidth }, + { kTheSprite, "backColor", kTheBackColor }, + { kTheSprite, "blend", kTheBlend }, + { kTheSprite, "bottom", kTheBottom }, + { kTheSprite, "castnum", kTheCastNum }, + { kTheSprite, "constraint", kTheConstraint }, + { kTheSprite, "cursor", kTheCursor }, + { kTheSprite, "editableText", kTheEditableText }, + { kTheSprite, "foreColor", kTheForeColor }, + { kTheSprite, "height", kTheHeight }, + { kTheSprite, "ink", kTheInk }, + { kTheSprite, "left", kTheLeft }, + { kTheSprite, "lineSize", kTheLineSize }, + { kTheSprite, "loch", kTheLocH }, + { kTheSprite, "locv", kTheLocV }, + { kTheSprite, "moveable", kTheMoveable }, + { kTheSprite, "movieRate", kTheMovieRate }, + { kTheSprite, "movieTime", kTheMovieTime }, + { kTheSprite, "right", kTheRight }, + { kTheSprite, "scriptNum", kTheScriptNum }, + { kTheSprite, "startTime", kTheStartTime }, + { kTheSprite, "stretch", kTheStrech }, + { kTheSprite, "stopTime", kTheStopTime }, + { kTheSprite, "top", kTheTop }, + { kTheSprite, "trails", kTheTrails }, + { kTheSprite, "type", kTheType }, + { kTheSprite, "visible", kTheVisible }, + { kTheSprite, "volume", kTheVolume }, + { kTheSprite, "width", kTheWidth }, //Common cast fields - { kTheCast, "width", kTheWidth }, - { kTheCast, "height", kTheHeight }, - { kTheCast, "filename", kTheFilename }, - { kTheCast, "scriptText", kTheScriptText }, { kTheCast, "castType", kTheCastType }, + { kTheCast, "filename", kTheFilename }, + { kTheCast, "height", kTheHeight }, + { kTheCast, "loaded", kTheLoaded }, + { kTheCast, "modified", kTheModified }, { kTheCast, "name", kTheName }, - { kTheCast, "rect", kTheRect }, { kTheCast, "number", kTheNumber }, - { kTheCast, "modified", kTheModified }, - { kTheCast, "loaded", kTheLoaded }, - { kTheCast, "purgePriority",kThePurgePriority }, //0 Never purge, 1 Purge Last, 2 Purge next, 2 Purge normal + { kTheCast, "rect", kTheRect }, + { kTheCast, "purgePriority",kThePurgePriority }, // 0 Never purge, 1 Purge Last, 2 Purge next, 2 Purge normal + { kTheCast, "scriptText", kTheScriptText }, + { kTheCast, "width", kTheWidth }, //Shape fields { kTheCast, "backColor", kTheBackColor }, @@ -134,8 +143,8 @@ static struct TheEntityFieldProto { { kTheCast, "picture", kThePicture }, //TextCast fields - { kTheCast, "size", kTheSize }, { kTheCast, "hilite", kTheHilite }, + { kTheCast, "size", kTheSize }, { kTheCast, "text", kTheText }, { kTheWindow, "drawRect", kTheDrawRect }, @@ -146,7 +155,7 @@ static struct TheEntityFieldProto { { kTheMenuItem, "checkmark", kTheCheckMark }, { kTheMenuItem, "enabled", kTheEnabled }, { kTheMenuItem, "name", kTheName }, - { kTheMenuItem, "name", kTheScript }, + { kTheMenuItem, "script", kTheScript }, { kTheMenu, "name", kTheName }, @@ -164,6 +173,11 @@ void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) { case kThePerFrameHook: warning("STUB: setting the perframehook"); break; + case kTheFloatPrecision: + _floatPrecision = d.toInt(); + _floatPrecision = MAX(0, MIN(_floatPrecision, 19)); // 0 to 19 + _floatPrecisionFormat.format("%%.%df", _floatPrecision); + break; default: error("Unprocessed setting field %d of entity %d", field, entity); } @@ -220,6 +234,10 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) { case kThePerFrameHook: warning("STUB: getting the perframehook"); break; + case kTheFloatPrecision: + d.type = INT; + d.u.i = _floatPrecision; + break; default: error("Unprocessed getting field %d of entity %d", field, entity); } diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h index 6fc62f8736..c3ee20fb04 100644 --- a/engines/director/lingo/lingo-the.h +++ b/engines/director/lingo/lingo-the.h @@ -61,7 +61,17 @@ enum TheEntity { kTheControlDown, kTheCommandDown, kTheShiftDown, - kTheOptionDown + kTheOptionDown, + + kTheColorDepth, + kTheColorQD, + kTheExitLock, + kTheFloatPrecision, + kTheItemDelimiter, + kTheMultiSound, + kThePreloadEventAbort, + kTheRomanLingo, + kTheStage }; enum TheField { diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 9fe17f3be5..a73820dff6 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -91,6 +91,9 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { _linenumber = _colnumber = 0; + _floatPrecision = 4; + _floatPrecisionFormat = "%.4f"; + warning("Lingo Inited"); } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index f3b36f94f6..ea41762f11 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -266,6 +266,8 @@ public: int _linenumber; int _colnumber; + Common::String _floatPrecisionFormat; + private: int parse(const char *code); void push(Datum d); @@ -285,6 +287,8 @@ private: StackData _stack; DirectorEngine *_vm; + + int _floatPrecision; }; extern Lingo *g_lingo; |