ScummVM API documentation
ws_cruncher.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef M4_WSCRIPT_WS_CRUNCHER_H
24#define M4_WSCRIPT_WS_CRUNCHER_H
25
26#include "m4/m4_types.h"
27#include "m4/wscript/ws_machine.h"
28
29namespace M4 {
30
31#define OP_INSTR 0xfe000000
32#define OP_FORMAT1 0x01c00000
33#define OP_FORMAT2 0x00380000
34#define OP_FORMAT3 0x00070000
35#define OP_LOW_DATA 0x0000ffff
36#define OP_DATA_SIGN 0x8000
37#define OP_DATA_VALUE 0x7fff
38
39#define FMT_NOTHING 0
40#define FMT_LOCAL_SRC 1
41#define FMT_GLOBAL_SRC 2
42#define FMT_INT15 3
43#define FMT_4_11 4
44#define FMT_7_8 5
45#define FMT_11_4 6
46#define FMT_15_0 7
47#define REG_SET_IDX 0x0fff
48#define REG_SET_IDX_REG 0x8000
49#define LOCAL_FMT 0x7000
50#define LOCAL_FMT_PARENT 0x0000
51#define LOCAL_FMT_REG 0x1000
52#define LOCAL_FMT_DATA 0x2000
53
54#define BRANCH_BR 0
55#define BRANCH_BLT 1
56#define BRANCH_BLE 2
57#define BRANCH_BE 3
58#define BRANCH_BNE 4
59#define BRANCH_BGE 5
60#define BRANCH_BGT 6
61
62struct EOSreq {
63 EOSreq *next = nullptr;
64 EOSreq *prev = nullptr;
65 Anim8 *myAnim8 = nullptr;
66};
67
68struct cruncher {
69 Anim8 *backLayerAnim8;
70 Anim8 *frontLayerAnim8;
71 Anim8 *firstAnim8ToCrunch;
72 Anim8 *lastAnim8ToCrunch;
73};
74
76 cruncher *_myCruncher = nullptr;
77 bool _cruncherInitialized = false;
78 EOSreq *_EOSreqList = nullptr;
79 int32 _memtypeEOS = -1;
80
81 int32 _stackSize = 0;
82 uint32 *_stackBase = nullptr;
83 uint32 *_stackTop = nullptr;
84 uint32 *_stackLimit = nullptr;
85 Anim8 *_crunchNext = nullptr;
86
87 // OPCODE PROCESSING GLOBALS
88 int16 *_myDepthTable = nullptr;
89
90 frac16 _dataArg1 = 0;
91 frac16 _dataArg2 = 0;
92 frac16 _dataArg3 = 0;
93 frac16 *_myArg1 = nullptr;
94 frac16 *_myArg2 = nullptr;
95 frac16 *_myArg3 = nullptr;
96
97 bool _keepProcessing = false, _terminated = false, _mapTheCel = false;
98 bool _bailOut = false;
99 int32 _compareCCR = 0;
100 int32 _indexReg = 0;
101 int32 _pcOffsetOld = 0;
102};
103
104int32 *ws_GetDataFormats();
105bool ws_InitCruncher();
106void ws_KillCruncher();
107
108Anim8 *ws_AddAnim8ToCruncher(machine *m, int32 sequHash);
109
113bool ws_ChangeAnim8Program(machine *m, int32 newSequHash);
114
119
120bool ws_PauseAnim8(Anim8 *myAnim8);
121bool ws_ResumeAnim8(Anim8 *myAnim8);
122
131int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8);
132
133void ws_CrunchAnim8s(int16 *depth_table);
134void ws_CrunchEOSreqs();
135bool ws_OnEndSeqRequest(Anim8 *myAnim8, int32 pcOffset, int32 pcCount);
136void ws_CancelOnEndSeq(Anim8 *myAnim8);
137
138} // End of namespace M4
139
140#endif
Definition: database.h:28
int32 ws_PreProcessPcode(uint32 **PC, Anim8 *myAnim8)
void ws_RemoveAnim8FromCruncher(Anim8 *myAnim8)
bool ws_ChangeAnim8Program(machine *m, int32 newSequHash)
intptr frac16
Definition: m4_types.h:45
Definition: ws_machine.h:118
Definition: ws_cruncher.h:62
Definition: ws_cruncher.h:75
Definition: ws_cruncher.h:68
Definition: ws_machine.h:156