[Scummvm-git-logs] scummvm master -> 93c1dfef3902d768258776a47f81479d90097ee3

sev- noreply at scummvm.org
Fri May 17 16:52:19 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
93c1dfef39 DIRECTOR: DECOMPILER: Get rid of global constructors


Commit: 93c1dfef3902d768258776a47f81479d90097ee3
    https://github.com/scummvm/scummvm/commit/93c1dfef3902d768258776a47f81479d90097ee3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-17T18:51:25+02:00

Commit Message:
DIRECTOR: DECOMPILER: Get rid of global constructors

Changed paths:
    engines/director/lingo/lingodec/ast.cpp
    engines/director/lingo/lingodec/handler.cpp
    engines/director/lingo/lingodec/names.cpp
    engines/director/lingo/lingodec/names.h


diff --git a/engines/director/lingo/lingodec/ast.cpp b/engines/director/lingo/lingodec/ast.cpp
index 044255ab28e..ea357808c2d 100644
--- a/engines/director/lingo/lingodec/ast.cpp
+++ b/engines/director/lingo/lingodec/ast.cpp
@@ -321,7 +321,7 @@ void BinaryOpNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 	}
 
 	code.write(" ");
-	code.write(StandardNames::getName(StandardNames::binaryOpNames, opcode));
+	code.write(StandardNames::binaryOpNames[opcode]);
 	code.write(" ");
 
 	if (parenRight) {
@@ -362,7 +362,7 @@ unsigned int BinaryOpNode::getPrecedence() const {
 /* ChunkExprNode */
 
 void ChunkExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
-	code.write(StandardNames::getName(StandardNames::chunkTypeNames, type));
+	code.write(StandardNames::chunkTypeNames[type]);
 	code.write(" ");
 	first->writeScriptText(code, dot, sum);
 	if (!(last->type == kLiteralNode && last->getValue()->type == kDatumInt && last->getValue()->i == 0)) {
@@ -903,7 +903,7 @@ void TheExprNode::writeScriptText(CodeWriter &code, bool, bool) const {
 
 void LastStringChunkExprNode::writeScriptText(CodeWriter &code, bool, bool sum) const {
 	code.write("the last ");
-	code.write(StandardNames::getName(StandardNames::chunkTypeNames, type));
+	code.write(StandardNames::chunkTypeNames[type]);
 	code.write(" in ");
 
 	bool parenObj = (obj->type == kBinaryOpNode);
@@ -920,7 +920,7 @@ void LastStringChunkExprNode::writeScriptText(CodeWriter &code, bool, bool sum)
 
 void StringChunkCountExprNode::writeScriptText(CodeWriter &code, bool, bool sum) const {
 	code.write("the number of ");
-	code.write(StandardNames::getName(StandardNames::chunkTypeNames, type)); // we want the object to always be verbose
+	code.write(StandardNames::chunkTypeNames[type]); // we want the object to always be verbose
 	code.write("s in ");
 
 	bool parenObj = (obj->type == kBinaryOpNode);
@@ -937,7 +937,7 @@ void StringChunkCountExprNode::writeScriptText(CodeWriter &code, bool, bool sum)
 
 void MenuPropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 	code.write("the ");
-	code.write(StandardNames::getName(StandardNames::menuPropertyNames, prop));
+	code.write(StandardNames::menuPropertyNames[prop]);
 	code.write(" of menu ");
 
 	bool parenMenuID = (menuID->type == kBinaryOpNode);
@@ -954,7 +954,7 @@ void MenuPropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) con
 
 void MenuItemPropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 	code.write("the ");
-	code.write(StandardNames::getName(StandardNames::menuItemPropertyNames, prop));
+	code.write(StandardNames::menuItemPropertyNames[prop]);
 	code.write(" of menuItem ");
 
 	bool parenItemID = (itemID->type == kBinaryOpNode);
@@ -982,7 +982,7 @@ void MenuItemPropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum)
 
 void SoundPropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 	code.write("the ");
-	code.write(StandardNames::getName(StandardNames::soundPropertyNames, prop));
+	code.write(StandardNames::soundPropertyNames[prop]);
 	code.write(" of sound ");
 
 	bool parenSoundID = (soundID->type == kBinaryOpNode);
@@ -999,7 +999,7 @@ void SoundPropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) co
 
 void SpritePropExprNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 	code.write("the ");
-	code.write(StandardNames::getName(StandardNames::spritePropertyNames, prop));
+	code.write(StandardNames::spritePropertyNames[prop]);
 	code.write(" of sprite ");
 
 	bool parenSpriteID = (spriteID->type == kBinaryOpNode);
@@ -1130,7 +1130,7 @@ void PutStmtNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 	code.write("put ");
 	value->writeScriptText(code, dot, sum);
 	code.write(" ");
-	code.write(StandardNames::getName(StandardNames::putTypeNames, type));
+	code.write(StandardNames::putTypeNames[type]);
 	code.write(" ");
 	variable->writeScriptText(code, false, sum); // we want the variable to always be verbose
 }
@@ -1139,7 +1139,7 @@ void PutStmtNode::writeScriptText(CodeWriter &code, bool dot, bool sum) const {
 
 void WhenStmtNode::writeScriptText(CodeWriter &code, bool, bool) const {
 	code.write("when ");
-	code.write(StandardNames::getName(StandardNames::whenEventNames, event));
+	code.write(StandardNames::whenEventNames[event]);
 	code.write(" then");
 
 	code.doIndentation = false;
diff --git a/engines/director/lingo/lingodec/handler.cpp b/engines/director/lingo/lingodec/handler.cpp
index c8eb821c88d..1707eb987c9 100644
--- a/engines/director/lingo/lingodec/handler.cpp
+++ b/engines/director/lingo/lingodec/handler.cpp
@@ -203,7 +203,7 @@ Common::SharedPtr<Node> Handler::readV4Property(uint32 offset, int propertyType,
 	case 0x00:
 		{
 			if (propertyID <= 0x0b) { // movie property
-				auto propName = StandardNames::getName(StandardNames::moviePropertyNames, propertyID);
+				Common::String propName(StandardNames::moviePropertyNames[propertyID]);
 				return Common::SharedPtr<Node>(new TheExprNode(offset, propName));
 			} else { // last chunk
 				auto string = pop();
@@ -246,16 +246,16 @@ Common::SharedPtr<Node> Handler::readV4Property(uint32 offset, int propertyType,
 		}
 		break;
 	case 0x07: // animation property
-		return Common::SharedPtr<Node>(new TheExprNode(offset, StandardNames::getName(StandardNames::animationPropertyNames, propertyID)));
+		return Common::SharedPtr<Node>(new TheExprNode(offset, StandardNames::animationPropertyNames[propertyID]));
 	case 0x08: // animation 2 property
 		if (propertyID == 0x02 && script->version >= 500) { // the number of castMembers supports castLib selection from Director 5.0
 			auto castLib = pop();
 			if (!(castLib->type == kLiteralNode && castLib->getValue()->type == kDatumInt && castLib->getValue()->toInt() == 0)) {
 				auto castLibNode = Common::SharedPtr<Node>(new MemberExprNode(offset, "castLib", castLib, nullptr));
-				return Common::SharedPtr<Node>(new ThePropExprNode(offset, castLibNode, StandardNames::getName(StandardNames::animation2PropertyNames, propertyID)));
+				return Common::SharedPtr<Node>(new ThePropExprNode(offset, castLibNode, StandardNames::animation2PropertyNames[propertyID]));
 			}
 		}
-		return Common::SharedPtr<Node>(new TheExprNode(offset, StandardNames::getName(StandardNames::animation2PropertyNames, propertyID)));
+		return Common::SharedPtr<Node>(new TheExprNode(offset, StandardNames::animation2PropertyNames[propertyID]));
 	case 0x09: // generic cast member
 	case 0x0a: // chunk of cast member
 	case 0x0b: // field
@@ -270,7 +270,7 @@ Common::SharedPtr<Node> Handler::readV4Property(uint32 offset, int propertyType,
 	case 0x14: // scriptText
 	case 0x15: // chunk of scriptText
 		{
-			auto propName = StandardNames::getName(StandardNames::memberPropertyNames, propertyID);
+			auto propName = StandardNames::memberPropertyNames[propertyID];
 			Common::SharedPtr<Node> castID;
 			if (script->version >= 500) {
 				castID = pop();
diff --git a/engines/director/lingo/lingodec/names.cpp b/engines/director/lingo/lingodec/names.cpp
index bac5d4e8527..6bdb3807fe2 100644
--- a/engines/director/lingo/lingodec/names.cpp
+++ b/engines/director/lingo/lingodec/names.cpp
@@ -12,306 +12,327 @@
 
 namespace LingoDec {
 
-template<class Key, class Val>
-static Common::StableMap<Key, Val> toMap(std::initializer_list<Common::Pair<Key, Val>> items) {
-	Common::StableMap<Key, Val> stableMap;
-	for(auto item : items) {
-		stableMap.insert(Common::Pair<Key, Val>(item.first, item.second));
-	}
-	return stableMap;
-}
-
+namespace StandardNames {
 /* StandardNames */
 
-Common::StableMap<unsigned int, Common::String> StandardNames::opcodeNames = toMap<unsigned int, Common::String>({
+const char *opcodeNamesS[] = {
 	// single-byte
-	{ kOpRet,				"ret" },
-	{ kOpRetFactory,		"retfactory" },
-	{ kOpPushZero,			"pushzero" },
-	{ kOpMul,				"mul" },
-	{ kOpAdd,				"add" },
-	{ kOpSub,				"sub" },
-	{ kOpDiv,				"div" },
-	{ kOpMod,				"mod" },
-	{ kOpInv,				"inv" },
-	{ kOpJoinStr,			"joinstr" },
-	{ kOpJoinPadStr,		"joinpadstr" },
-	{ kOpLt,				"lt" },
-	{ kOpLtEq,				"lteq" },
-	{ kOpNtEq,				"nteq" },
-	{ kOpEq,				"eq" },
-	{ kOpGt,				"gt" },
-	{ kOpGtEq,				"gteq" },
-	{ kOpAnd,				"and" },
-	{ kOpOr,				"or" },
-	{ kOpNot,				"not" },
-	{ kOpContainsStr,		"containsstr" },
-	{ kOpContains0Str,		"contains0str" },
-	{ kOpGetChunk,			"getchunk" },
-	{ kOpHiliteChunk,		"hilitechunk" },
-	{ kOpOntoSpr,			"ontospr" },
-	{ kOpIntoSpr,			"intospr" },
-	{ kOpGetField,			"getfield" },
-	{ kOpStartTell,			"starttell" },
-	{ kOpEndTell,			"endtell" },
-	{ kOpPushList,			"pushlist" },
-	{ kOpPushPropList,		"pushproplist" },
-	{ kOpSwap,				"swap" },
+	"unk00",
+	"ret",			// kOpRet			0x01
+	"retfactory",	// kOpRetFactory	0x02
+	"pushzero",		// kOpPushZero		0x03
+	"mul",			// kOpMul			0x04
+	"add",			// kOpAdd			0x05
+	"sub",			// kOpSub			0x06
+	"div",			// kOpDiv			0x07
+	"mod",			// kOpMod			0x08
+	"inv",			// kOpInv			0x09
+	"joinstr",		// kOpJoinStr		0x0a
+	"joinpadstr",	// kOpJoinPadStr	0x0b
+	"lt",			// kOpLt			0x0c
+	"lteq",			// kOpLtEq			0x0d
+	"nteq",			// kOpNtEq			0x0e
+	"eq",			// kOpEq			0x0f
+	"gt",			// kOpGt			0x10
+	"gteq",			// kOpGtEq			0x11
+	"and",			// kOpAnd			0x12
+	"or",			// kOpOr			0x13
+	"not",			// kOpNot			0x14
+	"containsstr",	// kOpContainsStr	0x15
+	"contains0str",	// kOpContains0Str	0x16
+	"getchunk",		// kOpGetChunk		0x17
+	"hilitechunk",	// kOpHiliteChunk	0x18
+	"ontospr",		// kOpOntoSpr		0x19
+	"intospr",		// kOpIntoSpr		0x1a
+	"getfield",		// kOpGetField		0x1b
+	"starttell",	// kOpStartTell		0x1c
+	"endtell",		// kOpEndTell		0x1d
+	"pushlist",		// kOpPushList		0x1e
+	"pushproplist",	// kOpPushPropList	0x1f
+	"unk20",
+	"swap",			// kOpSwap			0x21
+};
 
+const char *opcodeNamesM[] = {
 	// multi-byte
-	{ kOpPushInt8,			"pushint8" },
-	{ kOpPushArgListNoRet,	"pusharglistnoret" },
-	{ kOpPushArgList,		"pusharglist" },
-	{ kOpPushCons,			"pushcons" },
-	{ kOpPushSymb,			"pushsymb" },
-	{ kOpPushVarRef,		"pushvarref" },
-	{ kOpGetGlobal2,		"getglobal2" },
-	{ kOpGetGlobal,			"getglobal" },
-	{ kOpGetProp,			"getprop" },
-	{ kOpGetParam,			"getparam" },
-	{ kOpGetLocal,			"getlocal" },
-	{ kOpSetGlobal2,		"setglobal2" },
-	{ kOpSetGlobal,			"setglobal" },
-	{ kOpSetProp,			"setprop" },
-	{ kOpSetParam,			"setparam" },
-	{ kOpSetLocal,			"setlocal" },
-	{ kOpJmp,				"jmp" },
-	{ kOpEndRepeat,			"endrepeat" },
-	{ kOpJmpIfZ,			"jmpifz" },
-	{ kOpLocalCall,			"localcall" },
-	{ kOpExtCall,			"extcall" },
-	{ kOpObjCallV4,			"objcallv4" },
-	{ kOpPut,				"put" },
-	{ kOpPutChunk,			"putchunk" },
-	{ kOpDeleteChunk,		"deletechunk" },
-	{ kOpGet,				"get" },
-	{ kOpSet,				"set" },
-	{ kOpGetMovieProp,		"getmovieprop" },
-	{ kOpSetMovieProp,		"setmovieprop" },
-	{ kOpGetObjProp,		"getobjprop" },
-	{ kOpSetObjProp,		"setobjprop" },
-	{ kOpTellCall,			"tellcall" },
-	{ kOpPeek,				"peek" },
-	{ kOpPop,				"pop" },
-	{ kOpTheBuiltin,		"thebuiltin" },
-	{ kOpObjCall,			"objcall" },
-	{ kOpPushChunkVarRef,	"pushchunkvarref" },
-	{ kOpPushInt16,			"pushint16" },
-	{ kOpPushInt32,			"pushint32" },
-	{ kOpGetChainedProp,	"getchainedprop" },
-	{ kOpPushFloat32,		"pushfloat32" },
-	{ kOpGetTopLevelProp,	"gettoplevelprop" },
-	{ kOpNewObj,			"newobj" }
-});
+	"unk40",
+	"pushint8",			// kOpPushInt8			0x41
+	"pusharglistnoret",	// kOpPushArgListNoRet	0x42
+	"pusharglist",		// kOpPushArgList		0x43
+	"pushcons",			// kOpPushCons			0x44
+	"pushsymb",			// kOpPushSymb			0x45
+	"pushvarref",		// kOpPushVarRef		0x46
+	"unk47",
+	"getglobal2",		// kOpGetGlobal2		0x48
+	"getglobal",		// kOpGetGlobal			0x49
+	"getprop",			// kOpGetProp			0x4a
+	"getparam",			// kOpGetParam			0x4b
+	"getlocal",			// kOpGetLocal			0x4c
+	"unk4d",
+	"setglobal2",		// kOpSetGlobal2		0x4e
+	"setglobal",		// kOpSetGlobal			0x4f
+	"setprop",			// kOpSetProp			0x50
+	"setparam",			// kOpSetParam			0x51
+	"setlocal",			// kOpSetLocal			0x52
+	"jmp",				// kOpJmp				0x53
+	"endrepeat",		// kOpEndRepeat			0x54
+	"jmpifz",			// kOpJmpIfZ			0x55
+	"localcall",		// kOpLocalCall			0x56
+	"extcall",			// kOpExtCall			0x57
+	"objcallv4",		// kOpObjCallV4			0x58
+	"put",				// kOpPut				0x59
+	"putchunk",			// kOpPutChunk			0x5a
+	"deletechunk",		// kOpDeleteChunk		0x5b
+	"get",				// kOpGet				0x5c
+	"set",				// kOpSet				0x5d
+	"getmovieprop",		// kOpGetMovieProp		0x5f
+	"setmovieprop",		// kOpSetMovieProp		0x60
+	"getobjprop",		// kOpGetObjProp		0x61
+	"setobjprop",		// kOpSetObjProp		0x62
+	"tellcall",			// kOpTellCall			0x63
+	"peek",				// kOpPeek				0x64
+	"pop",				// kOpPop				0x65
+	"thebuiltin",		// kOpTheBuiltin		0x66
+	"objcall",			// kOpObjCall			0x67
+	"unk68",
+	"unk69",
+	"unk6a",
+	"unk6b",
+	"unk6c",
+	"pushchunkvarref",	// kOpPushChunkVarRef	0x6d
+	"pushint16",		// kOpPushInt16			0x6e
+	"pushint32",		// kOpPushInt32			0x6f
+	"getchainedprop",	// kOpGetChainedProp	0x70
+	"pushfloat32",		// kOpPushFloat32		0x71
+	"gettoplevelprop",	// kOpGetTopLevelProp	0x72
+	"newobj",			// kOpNewObj			0x73
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::binaryOpNames = toMap<unsigned int, Common::String>({
-	{ kOpMul,			"*" },
-	{ kOpAdd,			"+" },
-	{ kOpSub,			"-" },
-	{ kOpDiv,			"/" },
-	{ kOpMod,			"mod" },
-	{ kOpJoinStr,		"&" },
-	{ kOpJoinPadStr,	"&&" },
-	{ kOpLt,			"<" },
-	{ kOpLtEq,			"<=" },
-	{ kOpNtEq,			"<>" },
-	{ kOpEq,			"=" },
-	{ kOpGt,			">" },
-	{ kOpGtEq,			">=" },
-	{ kOpAnd,			"and" },
-	{ kOpOr,			"or" },
-	{ kOpContainsStr,	"contains" },
-	{ kOpContains0Str,	"starts" }
-});
+const char *binaryOpNames[] = {
+	"unk00",
+	"unk01",
+	"unk02",
+	"unk03",
+	"*",		// kOpMul			0x04
+	"+",		// kOpAdd			0x05
+	"-",		// kOpSub			0x06
+	"/",		// kOpDiv			0x07
+	"mod",		// kOpMod			0x08
+	"unk09",
+	"&",		// kOpJoinStr		0x0a
+	"&&",		// kOpJoinPadStr	0x0b
+	"<",		// kOpLt			0x0c
+	"<=",		// kOpLtEq			0x0d
+	"<",		// kOpNtEq			0x0e
+	"=",		// kOpEq			0x0f
+	"",		// kOpGt			0x10
+	">=",		// kOpGtEq			0x11
+	"and",		// kOpAnd			0x12
+	"or",		// kOpOr			0x13
+	"unk14",
+	"contains",	// kOpContainsStr	0x15
+	"starts",	// kOpContains0Str	0x16
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::chunkTypeNames = toMap<unsigned int, Common::String>({
-	{ kChunkChar, "char" },
-	{ kChunkWord, "word" },
-	{ kChunkItem, "item" },
-	{ kChunkLine, "line" }
-});
+const char *chunkTypeNames[] = {
+	"unk00",
+	"char", // kChunkChar   0x01
+	"word", // kChunkWord   0x02
+	"item", // kChunkItem   0x03
+	"line", // kChunkLine   0x04
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::putTypeNames = toMap<unsigned int, Common::String>({
-	{ kPutInto,		"into" },
-	{ kPutAfter,	"after" },
-	{ kPutBefore,	"before" }
-});
+const char *putTypeNames[] = {
+	"unk00",
+	"into",		// kPutInto		0x01
+	"after",	// kPutAfter	0x02
+	"before",	// kPutBefore	0x03
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::moviePropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x00, "floatPrecision" },
-	{ 0x01, "mouseDownScript" },
-	{ 0x02, "mouseUpScript" },
-	{ 0x03, "keyDownScript" },
-	{ 0x04, "keyUpScript" },
-	{ 0x05, "timeoutScript" },
-	{ 0x06, "short time" },
-	{ 0x07, "abbr time" },
-	{ 0x08, "long time" },
-	{ 0x09, "short date" },
-	{ 0x0a, "abbr date" },
-	{ 0x0b, "long date" }
-});
+const char *moviePropertyNames[] = {
+	"floatPrecision",	// 0x00
+	"mouseDownScript",	// 0x01
+	"mouseUpScript",	// 0x02
+	"keyDownScript",	// 0x03
+	"keyUpScript",		// 0x04
+	"timeoutScript",	// 0x05
+	"short time",		// 0x06
+	"abbr time",		// 0x07
+	"long time",		// 0x08
+	"short date",		// 0x09
+	"abbr date",		// 0x0a
+	"long date",		// 0x0b
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::whenEventNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "mouseDown" },
-	{ 0x02, "mouseUp" },
-	{ 0x03, "keyDown" },
-	{ 0x04, "keyUp" },
-	{ 0x05, "timeOut" },
-});
+const char *whenEventNames[] = {
+	"unk00",
+	"mouseDown",// 0x01
+	"mouseUp",	// 0x02
+	"keyDown",	// 0x03
+	"keyUp",	// 0x04
+	"timeOut",	// 0x05
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::menuPropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "name" },
-	{ 0x02, "number of menuItems" }
-});
+const char *menuPropertyNames[] = {
+	"unk00",
+	"name",					// 0x01
+	"number of menuItems",	// 0x02
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::menuItemPropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "name" },
-	{ 0x02, "checkMark" },
-	{ 0x03, "enabled" },
-	{ 0x04, "script" }
-});
+const char *menuItemPropertyNames[] = {
+	"unk00",
+	"name",		// 0x01
+	"checkMark",// 0x02
+	"enabled",	// 0x03
+	"script",	// 0x04
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::soundPropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "volume" }
-});
+const char *soundPropertyNames[] = {
+	"unk00",
+	"volume", // 0x01
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::spritePropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "type" },
-	{ 0x02, "backColor" },
-	{ 0x03, "bottom" },
-	{ 0x04, "castNum" },
-	{ 0x05, "constraint" },
-	{ 0x06, "cursor" },
-	{ 0x07, "foreColor" },
-	{ 0x08, "height" },
-	{ 0x09, "immediate" },
-	{ 0x0a, "ink" },
-	{ 0x0b, "left" },
-	{ 0x0c, "lineSize" },
-	{ 0x0d, "locH" },
-	{ 0x0e, "locV" },
-	{ 0x0f, "movieRate" },
-	{ 0x10, "movieTime" },
-	{ 0x11, "pattern" },
-	{ 0x12, "puppet" },
-	{ 0x13, "right" },
-	{ 0x14, "startTime" },
-	{ 0x15, "stopTime" },
-	{ 0x16, "stretch" },
-	{ 0x17, "top" },
-	{ 0x18, "trails" },
-	{ 0x19, "visible" },
-	{ 0x1a, "volume" },
-	{ 0x1b, "width" },
-	{ 0x1c, "blend" },
-	{ 0x1d, "scriptNum" },
-	{ 0x1e, "moveableSprite" },
-	{ 0x1f, "editableText" },
-	{ 0x20, "scoreColor" },
-	{ 0x21, "loc" },
-	{ 0x22, "rect" },
-	{ 0x23, "memberNum" },
-	{ 0x24, "castLibNum" },
-	{ 0x25, "member" },
-	{ 0x26, "scriptInstanceList" },
-	{ 0x27, "currentTime" },
-	{ 0x28, "mostRecentCuePoint" },
-	{ 0x29, "tweened" },
-	{ 0x2a, "name" }
-});
+const char *spritePropertyNames[] = {
+	"unk00",
+	"type",					// 0x01
+	"backColor",			// 0x02
+	"bottom",				// 0x03
+	"castNum",				// 0x04
+	"constraint",			// 0x05
+	"cursor",				// 0x06
+	"foreColor",			// 0x07
+	"height",				// 0x08
+	"immediate",			// 0x09
+	"ink",					// 0x0a
+	"left",					// 0x0b
+	"lineSize",				// 0x0c
+	"locH",					// 0x0d
+	"locV",					// 0x0e
+	"movieRate",			// 0x0f
+	"movieTime",			// 0x10
+	"pattern",				// 0x11
+	"puppet",				// 0x12
+	"right",				// 0x13
+	"startTime",			// 0x14
+	"stopTime",				// 0x15
+	"stretch",				// 0x16
+	"top",					// 0x17
+	"trails",				// 0x18
+	"visible",				// 0x19
+	"volume",				// 0x1a
+	"width",				// 0x1b
+	"blend",				// 0x1c
+	"scriptNum",			// 0x1d
+	"moveableSprite",		// 0x1e
+	"editableText",			// 0x1f
+	"scoreColor",			// 0x20
+	"loc",					// 0x21
+	"rect",					// 0x22
+	"memberNum",			// 0x23
+	"castLibNum",			// 0x24
+	"member",				// 0x25
+	"scriptInstanceList",	// 0x26
+	"currentTime",			// 0x27
+	"mostRecentCuePoint",	// 0x28
+	"tweened",				// 0x29
+	"name",					// 0x2a
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::animationPropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "beepOn" },
-	{ 0x02, "buttonStyle" },
-	{ 0x03, "centerStage" },
-	{ 0x04, "checkBoxAccess" },
-	{ 0x05, "checkboxType" },
-	{ 0x06, "colorDepth" },
-	{ 0x07, "colorQD" },
-	{ 0x08, "exitLock" },
-	{ 0x09, "fixStageSize" },
-	{ 0x0a, "fullColorPermit" },
-	{ 0x0b, "imageDirect" },
-	{ 0x0c, "doubleClick" },
-	{ 0x0d, "key" },
-	{ 0x0e, "lastClick" },
-	{ 0x0f, "lastEvent" },
-	{ 0x10, "keyCode" },
-	{ 0x11, "lastKey" },
-	{ 0x12, "lastRoll"},
-	{ 0x13, "timeoutLapsed" },
-	{ 0x14, "multiSound" },
-	{ 0x15, "pauseState" },
-	{ 0x16, "quickTimePresent" },
-	{ 0x17, "selEnd" },
-	{ 0x18, "selStart" },
-	{ 0x19, "soundEnabled" },
-	{ 0x1a, "soundLevel" },
-	{ 0x1b, "stageColor" },
+const char *animationPropertyNames[] = {
+	"unk00",
+	"beepOn", 					// 0x01
+	"buttonStyle", 				// 0x02
+	"centerStage", 				// 0x03
+	"checkBoxAccess", 			// 0x04
+	"checkboxType", 			// 0x05
+	"colorDepth", 				// 0x06
+	"colorQD", 					// 0x07
+	"exitLock", 				// 0x08
+	"fixStageSize", 			// 0x09
+	"fullColorPermit", 			// 0x0a
+	"imageDirect", 				// 0x0b
+	"doubleClick", 				// 0x0c
+	"key", 						// 0x0d
+	"lastClick", 				// 0x0e
+	"lastEvent", 				// 0x0f
+	"keyCode", 					// 0x10
+	"lastKey", 					// 0x11
+	"lastRoll", 				// 0x12
+	"timeoutLapsed",	 		// 0x13
+	"multiSound", 				// 0x14
+	"pauseState", 				// 0x15
+	"quickTimePresent", 		// 0x16
+	"selEnd", 					// 0x17
+	"selStart", 				// 0x18
+	"soundEnabled", 			// 0x19
+	"soundLevel", 				// 0x1a
+	"stageColor", 				// 0x1b
 	// 0x1c indicates dontPassEvent was called.
 	// It doesn't seem to have a Lingo-accessible name.
-	{ 0x1d, "switchColorDepth" },
-	{ 0x1e, "timeoutKeyDown" },
-	{ 0x1f, "timeoutLength" },
-	{ 0x20, "timeoutMouse" },
-	{ 0x21, "timeoutPlay" },
-	{ 0x22, "timer" },
-	{ 0x23, "preLoadRAM" },
-	{ 0x24, "videoForWindowsPresent" },
-	{ 0x25, "netPresent" },
-	{ 0x26, "safePlayer" },
-	{ 0x27, "soundKeepDevice" },
-	{ 0x28, "soundMixMedia" }
-});
+	"unk1c",
+	"switchColorDepth",			// 0x1d
+	"timeoutKeyDown",			// 0x1e
+	"timeoutLength",			// 0x1f
+	"timeoutMouse",				// 0x20
+	"timeoutPlay",				// 0x21
+	"timer",					// 0x22
+	"preLoadRAM",				// 0x23
+	"videoForWindowsPresent",	// 0x24
+	"netPresent",				// 0x25
+	"safePlayer",				// 0x26
+	"soundKeepDevice",			// 0x27
+	"soundMixMedia",			// 0x28
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::animation2PropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "perFrameHook" },
-	{ 0x02, "number of castMembers" },
-	{ 0x03, "number of menus" },
-	{ 0x04, "number of castLibs" },
-	{ 0x05, "number of xtras" }
-});
+const char *animation2PropertyNames[] = {
+	"unk00",
+	"perFrameHook", 		// 0x01
+	"number of castMembers",// 0x02
+	"number of menus", 		// 0x03
+	"number of castLibs", 	// 0x04
+	"number of xtras", 		// 0x05
+};
 
-Common::StableMap<unsigned int, Common::String> StandardNames::memberPropertyNames = toMap<unsigned int, Common::String>({
-	{ 0x01, "name" },
-	{ 0x02, "text" },
-	{ 0x03, "textStyle" },
-	{ 0x04, "textFont" },
-	{ 0x05, "textHeight" },
-	{ 0x06, "textAlign" },
-	{ 0x07, "textSize" },
-	{ 0x08, "picture" },
-	{ 0x09, "hilite" },
-	{ 0x0a, "number" },
-	{ 0x0b, "size" },
-	{ 0x0c, "loop" },
-	{ 0x0d, "duration" },
-	{ 0x0e, "controller" },
-	{ 0x0f, "directToStage" },
-	{ 0x10, "sound" },
-	{ 0x11, "foreColor" },
-	{ 0x12, "backColor" },
-	{ 0x13, "type" }
-});
+const char *memberPropertyNames[] = {
+	"unk00",
+	"name",			// 0x01
+	"text",			// 0x02
+	"textStyle",	// 0x03
+	"textFont",		// 0x04
+	"textHeight",	// 0x05
+	"textAlign",	// 0x06
+	"textSize",		// 0x07
+	"picture",		// 0x08
+	"hilite",		// 0x09
+	"number",		// 0x0a
+	"size",			// 0x0b
+	"loop",			// 0x0c
+	"duration",		// 0x0d
+	"controller",	// 0x0e
+	"directToStage",// 0x0f
+	"sound",		// 0x10
+	"foreColor",	// 0x11
+	"backColor",	// 0x12
+	"type",			// 0x13
+};
 
-Common::String StandardNames::getOpcodeName(byte id) {
-	if (id >= 0x40)
-		id = 0x40 + id % 0x40;
-	auto it = opcodeNames.find(id);
-	if (it == opcodeNames.end()){
-		return Common::String::format("unk%02X" , id);
-	}
-	return it->second;
-}
+Common::String getOpcodeName(byte id) {
+	if (id < 0x22)
+		return opcodeNamesS[id];
 
-Common::String StandardNames::getName(const Common::StableMap<unsigned int, Common::String> &nameMap, unsigned int id) {
-	auto it = nameMap.find(id);
-	if (it == nameMap.end())
-		return "ERROR";
-	return it->second;
+	if (id < 0x40)
+		return Common::String::format("unk%02x" , id);
+
+	id = id % 0x40;
+
+	if (id < 0x34)
+		return opcodeNamesM[id];
+
+	return Common::String::format("unk%02x" , id);
 }
 
+} // namespace StandardNames
+
 /* ScriptNames */
 
 void ScriptNames::read(Common::SeekableReadStream &stream) {
diff --git a/engines/director/lingo/lingodec/names.h b/engines/director/lingo/lingodec/names.h
index 10a764b5fda..0caf7834fb4 100644
--- a/engines/director/lingo/lingodec/names.h
+++ b/engines/director/lingo/lingodec/names.h
@@ -19,25 +19,25 @@ namespace LingoDec {
 
 /* StandardNames */
 
-struct StandardNames {
-	static Common::StableMap<unsigned int, Common::String> opcodeNames;
-	static Common::StableMap<unsigned int, Common::String> binaryOpNames;
-	static Common::StableMap<unsigned int, Common::String> chunkTypeNames;
-	static Common::StableMap<unsigned int, Common::String> putTypeNames;
-	static Common::StableMap<unsigned int, Common::String> moviePropertyNames;
-	static Common::StableMap<unsigned int, Common::String> whenEventNames;
-	static Common::StableMap<unsigned int, Common::String> timeNames;
-	static Common::StableMap<unsigned int, Common::String> menuPropertyNames;
-	static Common::StableMap<unsigned int, Common::String> menuItemPropertyNames;
-	static Common::StableMap<unsigned int, Common::String> soundPropertyNames;
-	static Common::StableMap<unsigned int, Common::String> spritePropertyNames;
-	static Common::StableMap<unsigned int, Common::String> animationPropertyNames;
-	static Common::StableMap<unsigned int, Common::String> animation2PropertyNames;
-	static Common::StableMap<unsigned int, Common::String> memberPropertyNames;
-
-	static Common::String getOpcodeName(byte id);
-	static Common::String getName(const Common::StableMap<unsigned int, Common::String> &nameMap, unsigned int id);
-};
+namespace StandardNames {
+extern const char *opcodeNamesS[];
+extern const char *opcodeNamesM[];
+extern const char *binaryOpNames[];
+extern const char *chunkTypeNames[];
+extern const char *putTypeNames[];
+
+extern const char *moviePropertyNames[];
+extern const char *whenEventNames[];
+extern const char *menuPropertyNames[];
+extern const char *menuItemPropertyNames[];
+extern const char *soundPropertyNames[];
+extern const char *spritePropertyNames[];
+extern const char *animationPropertyNames[];
+extern const char *animation2PropertyNames[];
+extern const char *memberPropertyNames[];
+
+Common::String getOpcodeName(byte id);
+}
 
 /* ScriptNames */
 




More information about the Scummvm-git-logs mailing list