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 #include "kyra/kyra_v1.h"
24 #include "kyra/graphics/screen.h"
25
26 #include "common/system.h"
27
28 namespace Kyra {
29
o1_queryGameFlag(EMCState * script)30 int KyraEngine_v1::o1_queryGameFlag(EMCState *script) {
31 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
32 return queryGameFlag(stackPos(0));
33 }
34
o1_setGameFlag(EMCState * script)35 int KyraEngine_v1::o1_setGameFlag(EMCState *script) {
36 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
37 return setGameFlag(stackPos(0));
38 }
39
o1_resetGameFlag(EMCState * script)40 int KyraEngine_v1::o1_resetGameFlag(EMCState *script) {
41 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
42 return resetGameFlag(stackPos(0));
43 }
44
o1_getRand(EMCState * script)45 int KyraEngine_v1::o1_getRand(EMCState *script) {
46 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
47 int min = stackPos(0);
48 int max = stackPos(1);
49 if (max < min)
50 SWAP(min, max);
51 return _rnd.getRandomNumberRng(min, max);
52 }
53
o1_hideMouse(EMCState * script)54 int KyraEngine_v1::o1_hideMouse(EMCState *script) {
55 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_hideMouse(%p) ()", (const void *)script);
56 screen()->hideMouse();
57 return 0;
58 }
59
o1_showMouse(EMCState * script)60 int KyraEngine_v1::o1_showMouse(EMCState *script) {
61 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_showMouse(%p) ()", (const void *)script);
62 screen()->showMouse();
63 return 0;
64 }
65
o1_setMousePos(EMCState * script)66 int KyraEngine_v1::o1_setMousePos(EMCState *script) {
67 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
68 setMousePos(stackPos(0), stackPos(1));
69 return 0;
70 }
71
o1_setHandItem(EMCState * script)72 int KyraEngine_v1::o1_setHandItem(EMCState *script) {
73 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setHandItem(%p) (%d)", (const void *)script, stackPos(0));
74 setHandItem(stackPos(0));
75 return 0;
76 }
77
o1_removeHandItem(EMCState * script)78 int KyraEngine_v1::o1_removeHandItem(EMCState *script) {
79 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_removeHandItem(%p) ()", (const void *)script);
80 removeHandItem();
81 return 0;
82 }
83
o1_getMouseState(EMCState * script)84 int KyraEngine_v1::o1_getMouseState(EMCState *script) {
85 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getMouseState(%p) ()", (const void *)script);
86 return _mouseState;
87 }
88
o1_setDeathHandler(EMCState * script)89 int KyraEngine_v1::o1_setDeathHandler(EMCState *script) {
90 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0));
91 _deathHandler = stackPos(0);
92 return 0;
93 }
94
o1_playWanderScoreViaMap(EMCState * script)95 int KyraEngine_v1::o1_playWanderScoreViaMap(EMCState *script) {
96 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
97 snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
98 return 0;
99 }
100
o1_fillRect(EMCState * script)101 int KyraEngine_v1::o1_fillRect(EMCState *script) {
102 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_fillRect(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
103 screen()->fillRect(stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(0));
104 return 0;
105 }
106
o1_blockInWalkableRegion(EMCState * script)107 int KyraEngine_v1::o1_blockInWalkableRegion(EMCState *script) {
108 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_blockInWalkableRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
109 screen()->blockInRegion(stackPos(0), stackPos(1), stackPos(2) - stackPos(0) + 1, stackPos(3) - stackPos(1) + 1);
110 return 0;
111 }
112
o1_blockOutWalkableRegion(EMCState * script)113 int KyraEngine_v1::o1_blockOutWalkableRegion(EMCState *script) {
114 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_blockOutWalkableRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
115 screen()->blockOutRegion(stackPos(0), stackPos(1), stackPos(2) - stackPos(0) + 1, stackPos(3) - stackPos(1) + 1);
116 return 0;
117 }
118
o1_playSoundEffect(EMCState * script)119 int KyraEngine_v1::o1_playSoundEffect(EMCState *script) {
120 debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
121 if (!_preventScriptSfx)
122 snd_playSoundEffect(stackPos(0));
123 return 0;
124 }
125
126 } // End of namespace Kyra
127