1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifdef ENABLE_HE
24 
25 #include "scumm/he/intern_he.h"
26 #include "scumm/he/logic_he.h"
27 
28 namespace Scumm {
29 
LogicHE(ScummEngine_v90he * vm)30 LogicHE::LogicHE(ScummEngine_v90he *vm) : _vm(vm) {
31 }
32 
~LogicHE()33 LogicHE::~LogicHE() {
34 }
35 
writeScummVar(int var,int32 value)36 void LogicHE::writeScummVar(int var, int32 value) {
37 	_vm->writeVar(var, value);
38 }
39 
versionID()40 int LogicHE::versionID() {
41 	return 1;
42 }
43 
getFromArray(int arg0,int idx2,int idx1)44 int LogicHE::getFromArray(int arg0, int idx2, int idx1) {
45 	_vm->VAR(_vm->VAR_U32_ARRAY_UNK) = arg0;
46 	return _vm->readArray(116, idx2, idx1);
47 }
48 
putInArray(int arg0,int idx2,int idx1,int val)49 void LogicHE::putInArray(int arg0, int idx2, int idx1, int val) {
50 	_vm->VAR(_vm->VAR_U32_ARRAY_UNK) = arg0;
51 	_vm->writeArray(116, idx2, idx1, val);
52 }
53 
dispatch(int op,int numArgs,int32 * args)54 int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
55 #if 1
56 	Common::String str;
57 
58 	str = Common::String::format("LogicHE::dispatch(%d, %d, [", op, numArgs);
59 	if (numArgs > 0)
60 		str += Common::String::format("%d", args[0]);
61 	for (int i = 1; i < numArgs; i++) {
62 		str += Common::String::format(", %d", args[i]);
63 	}
64 	str += "])";
65 
66 	debug(0, "%s", str.c_str());
67 #else
68 	// Used for parallel trace utility
69 	for (int i = 0; i < numArgs; i++)
70 		debug(0, "args[%d] = %d;", i, args[i]);
71 
72 	debug(0, "dispatch(%d, %d, args);", op, numArgs);
73 
74 #endif
75 
76 	return 1;
77 }
78 
makeLogicHE(ScummEngine_v90he * vm)79 LogicHE *LogicHE::makeLogicHE(ScummEngine_v90he *vm) {
80 	switch (vm->_game.id) {
81 	case GID_PUTTRACE:
82 		return makeLogicHErace(vm);
83 
84 	case GID_FUNSHOP:
85 		return makeLogicHEfunshop(vm);
86 
87 	case GID_FOOTBALL:
88 		return makeLogicHEfootball(vm);
89 
90 	case GID_FOOTBALL2002:
91 		return makeLogicHEfootball2002(vm);
92 
93 	case GID_SOCCER:
94 	case GID_SOCCERMLS:
95 	case GID_SOCCER2004:
96 		return makeLogicHEsoccer(vm);
97 
98 	case GID_BASEBALL2001:
99 		return makeLogicHEbaseball2001(vm);
100 
101 	case GID_BASKETBALL:
102 		return makeLogicHEbasketball(vm);
103 
104 	case GID_MOONBASE:
105 		return makeLogicHEmoonbase((ScummEngine_v100he *)vm);
106 
107 	default:
108 		return new LogicHE(vm);
109 	}
110 }
111 
112 } // End of namespace Scumm
113 
114 #endif // ENABLE_HE
115