Replace Tmem_nasm.asm with C++ code. Patch by pyro.
[Glide64.git] / Combine.cpp
blobf31f860063522fd115b9617b112248a392bb2047
1 /*
2 * Glide64 - Glide video plugin for Nintendo 64 emulators.
3 * Copyright (c) 2002 Dave2001
4 * Copyright (c) 2008 Günther <guenther.emu@freenet.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //****************************************************************
23 // Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
24 // Project started on December 29th, 2001
26 // To modify Glide64:
27 // * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
28 // * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
30 // Official Glide64 development channel: #Glide64 on EFnet
32 // Original author: Dave2001 (Dave2999@hotmail.com)
33 // Other authors: Gonetz, Gugaman
35 //****************************************************************
36 // March 08, 2002:
37 // * New combiner method by Gonetz and Dave2001
38 //****************************************************************
40 #include "Gfx1.3.h"
41 #include "Util.h"
42 #include "Combine.h"
44 #ifndef _WIN32
45 #include <string.h>
46 #endif // _WIN32
48 #define FASTSEARCH // Enable fast combine mode searching algorithm
50 float percent_org, percent, r, g, b;
51 DWORD lod_frac;
53 DWORD cc_lookup[257];
54 DWORD ac_lookup[257];
55 COMBINE cmb;
57 //****************************************************************
58 // Macros
59 //****************************************************************
61 #define MOD_0(mode) cmb.mod_0 = mode
62 #define MOD_0_COL(color) cmb.modcolor_0 = color
63 #define MOD_0_COL1(color) cmb.modcolor1_0 = color
64 #define MOD_0_COL2(color) cmb.modcolor2_0 = color
65 #define MOD_0_FAC(factor) cmb.modfactor_0 = factor
66 #define MOD_1(mode) cmb.mod_1 = mode
67 #define MOD_1_COL(color) cmb.modcolor_1 = color
68 #define MOD_1_COL1(color) cmb.modcolor1_1 = color
69 #define MOD_1_COL2(color) cmb.modcolor2_1 = color
70 #define MOD_1_FAC(factor) cmb.modfactor_1 = factor
72 #define A_BLEND(f1,f2) cmb.abf1=f1,cmb.abf2=f2
74 // To make a color or alpha combine
75 #define CCMB(fnc,fac,loc,oth) \
76 cmb.c_fnc = fnc, \
77 cmb.c_fac = fac, \
78 cmb.c_loc = loc, \
79 cmb.c_oth = oth
80 #define ACMB(fnc,fac,loc,oth) \
81 cmb.a_fnc = fnc, \
82 cmb.a_fac = fac, \
83 cmb.a_loc = loc, \
84 cmb.a_oth = oth
85 #define CCMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
86 cmb.c_ext_a = a, \
87 cmb.c_ext_a_mode = a_mode, \
88 cmb.c_ext_b = b, \
89 cmb.c_ext_b_mode = b_mode, \
90 cmb.c_ext_c = c, \
91 cmb.c_ext_c_invert = c_invert, \
92 cmb.c_ext_d= d, \
93 cmb.c_ext_d_invert = d_invert, \
94 cmb.cmb_ext_use |= COMBINE_EXT_COLOR
95 #define ACMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
96 cmb.a_ext_a = a, \
97 cmb.a_ext_a_mode = a_mode, \
98 cmb.a_ext_b = b, \
99 cmb.a_ext_b_mode = b_mode, \
100 cmb.a_ext_c = c, \
101 cmb.a_ext_c_invert = c_invert, \
102 cmb.a_ext_d= d, \
103 cmb.a_ext_d_invert = d_invert, \
104 cmb.cmb_ext_use |= COMBINE_EXT_ALPHA
105 #define T0CCMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
106 cmb.t0c_ext_a = a, \
107 cmb.t0c_ext_a_mode = a_mode, \
108 cmb.t0c_ext_b = b, \
109 cmb.t0c_ext_b_mode = b_mode, \
110 cmb.t0c_ext_c = c, \
111 cmb.t0c_ext_c_invert = c_invert, \
112 cmb.t0c_ext_d= d, \
113 cmb.t0c_ext_d_invert = d_invert, \
114 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR
115 #define T0ACMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
116 cmb.t0a_ext_a = a, \
117 cmb.t0a_ext_a_mode = a_mode, \
118 cmb.t0a_ext_b = b, \
119 cmb.t0a_ext_b_mode = b_mode, \
120 cmb.t0a_ext_c = c, \
121 cmb.t0a_ext_c_invert = c_invert, \
122 cmb.t0a_ext_d= d, \
123 cmb.t0a_ext_d_invert = d_invert, \
124 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_ALPHA
125 #define T1CCMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
126 cmb.t1c_ext_a = a, \
127 cmb.t1c_ext_a_mode = a_mode, \
128 cmb.t1c_ext_b = b, \
129 cmb.t1c_ext_b_mode = b_mode, \
130 cmb.t1c_ext_c = c, \
131 cmb.t1c_ext_c_invert = c_invert, \
132 cmb.t1c_ext_d= d, \
133 cmb.t1c_ext_d_invert = d_invert, \
134 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR
135 #define T1ACMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
136 cmb.t1a_ext_a = a, \
137 cmb.t1a_ext_a_mode = a_mode, \
138 cmb.t1a_ext_b = b, \
139 cmb.t1a_ext_b_mode = b_mode, \
140 cmb.t1a_ext_c = c, \
141 cmb.t1a_ext_c_invert = c_invert, \
142 cmb.t1a_ext_d= d, \
143 cmb.t1a_ext_d_invert = d_invert, \
144 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_ALPHA
146 // To use textures
147 #define USE_T0() \
148 rdp.best_tex = 0; \
149 cmb.tex |= 1, \
150 cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL
151 #define USE_T1() \
152 if (num_tmu > 1) { \
153 rdp.best_tex = 1; \
154 cmb.tex |= 2, \
155 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
156 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
157 cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE; \
159 else { \
160 USE_T0(); \
162 #define T0_ADD_T1() \
163 rdp.best_tex = 0; \
164 cmb.tex |= 3, \
165 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
166 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
167 cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE
168 #define T0_MUL_T1() \
169 rdp.best_tex = 0; \
170 cmb.tex |= 3, \
171 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
172 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
173 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
174 #define T0_MUL_T1_ADD_T0() \
175 rdp.best_tex = 0; \
176 cmb.tex |= 3, \
177 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
178 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
179 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
180 #define T0A_MUL_T1() \
181 rdp.best_tex = 1; \
182 cmb.tex |= 3, \
183 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
184 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
185 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA
186 #define T0_MUL_T1A() \
187 rdp.best_tex = 1; \
188 cmb.tex |= 3, \
189 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA, \
190 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
191 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
192 #define T0_INTER_T1_USING_FACTOR(factor) \
193 if (factor == 0xFF) { \
194 USE_T1(); \
196 else if (factor == 0x00) { \
197 USE_T0(); \
199 else {\
200 if (factor <= 0x80) rdp.best_tex = 0; \
201 else rdp.best_tex = 1; \
202 cmb.tex |= 3, \
203 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
204 cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
205 cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
206 percent = (float)factor / 255.0f, \
207 cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
209 #define T1_INTER_T0_USING_FACTOR(factor) /* inverse of above */\
210 if (factor == 0xFF) { \
211 USE_T0(); \
213 else if (factor == 0x00) { \
214 USE_T1(); \
216 else {\
217 if (factor <= 0x80) rdp.best_tex = 0; \
218 else rdp.best_tex = 1; \
219 cmb.tex |= 3, \
220 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
221 cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
222 cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
223 percent = (255 - factor) / 255.0f, \
224 cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
226 #define T0_INTER_T1_USING_T0() \
227 rdp.best_tex = 0; \
228 cmb.tex |= 3, \
229 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
230 cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
231 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
232 #define T1_INTER_T0_USING_T0() \
233 rdp.best_tex = 0; \
234 cmb.tex |= 3, \
235 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
236 cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
237 cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL
238 #define T0_INTER_T1_USING_T1() \
239 if (!cmb.combine_ext) { \
240 T0_INTER_T1_USING_FACTOR(0x7F); \
242 else {\
243 rdp.best_tex = 0; \
244 cmb.tex |= 3, \
245 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
246 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
247 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
248 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
249 cmb.t1c_ext_c = GR_CMBX_ZERO, \
250 cmb.t1c_ext_c_invert = 0, \
251 cmb.t1c_ext_d= GR_CMBX_B, \
252 cmb.t1c_ext_d_invert = 0, \
253 cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
254 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
255 cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
256 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
257 cmb.t0c_ext_c = GR_CMBX_OTHER_TEXTURE_RGB, \
258 cmb.t0c_ext_c_invert = 0, \
259 cmb.t0c_ext_d= GR_CMBX_B, \
260 cmb.t0c_ext_d_invert = 0, \
261 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
263 #define T0_INTER_T1_USING_T1A() \
264 rdp.best_tex = 0; \
265 cmb.tex |= 3, \
266 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
267 cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
268 cmb.tmu0_fac = GR_COMBINE_FACTOR_OTHER_ALPHA
269 #define T0_INTER_T1_USING_PRIM() \
270 if (!cmb.combine_ext) { \
271 T0_INTER_T1_USING_FACTOR ((rdp.prim_color&0xFF)); \
273 else {\
274 rdp.best_tex = 0; \
275 cmb.tex |= 3, \
276 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
277 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
278 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
279 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
280 cmb.t1c_ext_c = GR_CMBX_ZERO, \
281 cmb.t1c_ext_c_invert = 0, \
282 cmb.t1c_ext_d= GR_CMBX_B, \
283 cmb.t1c_ext_d_invert = 0, \
284 cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
285 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
286 cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
287 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
288 cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
289 cmb.t0c_ext_c_invert = 0, \
290 cmb.t0c_ext_d= GR_CMBX_B, \
291 cmb.t0c_ext_d_invert = 0, \
292 cmb.tex_ccolor = rdp.prim_color, \
293 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
295 #define T1_INTER_T0_USING_PRIM() /* inverse of above */\
296 if (!cmb.combine_ext) { \
297 T1_INTER_T0_USING_FACTOR ((rdp.prim_color&0xFF)); \
299 else {\
300 rdp.best_tex = 0; \
301 cmb.tex |= 3, \
302 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
303 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
304 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
305 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
306 cmb.t1c_ext_c = GR_CMBX_ZERO, \
307 cmb.t1c_ext_c_invert = 0, \
308 cmb.t1c_ext_d= GR_CMBX_B, \
309 cmb.t1c_ext_d_invert = 0, \
310 cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
311 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
312 cmb.t0c_ext_b = GR_CMBX_OTHER_TEXTURE_RGB, \
313 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
314 cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
315 cmb.t0c_ext_c_invert = 0, \
316 cmb.t0c_ext_d= GR_CMBX_B, \
317 cmb.t0c_ext_d_invert = 0, \
318 cmb.tex_ccolor = rdp.prim_color, \
319 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
321 #define T0_INTER_T1_USING_ENV() \
322 if (!cmb.combine_ext) { \
323 T0_INTER_T1_USING_FACTOR ((rdp.env_color&0xFF)); \
325 else {\
326 rdp.best_tex = 0; \
327 cmb.tex |= 3, \
328 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
329 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
330 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
331 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
332 cmb.t1c_ext_c = GR_CMBX_ZERO, \
333 cmb.t1c_ext_c_invert = 0, \
334 cmb.t1c_ext_d= GR_CMBX_B, \
335 cmb.t1c_ext_d_invert = 0, \
336 cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
337 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
338 cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
339 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
340 cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
341 cmb.t0c_ext_c_invert = 0, \
342 cmb.t0c_ext_d= GR_CMBX_B, \
343 cmb.t0c_ext_d_invert = 0, \
344 cmb.tex_ccolor = rdp.env_color, \
345 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
347 #define T1_INTER_T0_USING_ENV() /* inverse of above */\
348 if (!cmb.combine_ext) { \
349 T1_INTER_T0_USING_FACTOR ((rdp.env_color&0xFF)); \
351 else {\
352 rdp.best_tex = 0; \
353 cmb.tex |= 3, \
354 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
355 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
356 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
357 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
358 cmb.t1c_ext_c = GR_CMBX_ZERO, \
359 cmb.t1c_ext_c_invert = 0, \
360 cmb.t1c_ext_d= GR_CMBX_B, \
361 cmb.t1c_ext_d_invert = 0, \
362 cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
363 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
364 cmb.t0c_ext_b = GR_CMBX_OTHER_TEXTURE_RGB, \
365 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
366 cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
367 cmb.t0c_ext_c_invert = 0, \
368 cmb.t0c_ext_d= GR_CMBX_B, \
369 cmb.t0c_ext_d_invert = 0, \
370 cmb.tex_ccolor = rdp.env_color, \
371 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
373 #define T0_INTER_T1_USING_SHADEA() \
374 if (!cmb.combine_ext) { \
375 T0_INTER_T1_USING_FACTOR (0x7F); \
377 else {\
378 rdp.best_tex = 0; \
379 cmb.tex |= 3, \
380 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
381 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
382 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
383 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
384 cmb.t1c_ext_c = GR_CMBX_ZERO, \
385 cmb.t1c_ext_c_invert = 0, \
386 cmb.t1c_ext_d= GR_CMBX_B, \
387 cmb.t1c_ext_d_invert = 0, \
388 cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
389 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
390 cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
391 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
392 cmb.t0c_ext_c = GR_CMBX_ITALPHA, \
393 cmb.t0c_ext_c_invert = 0, \
394 cmb.t0c_ext_d= GR_CMBX_B, \
395 cmb.t0c_ext_d_invert = 0, \
396 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
398 #define T1_INTER_T0_USING_SHADEA() \
399 if (!cmb.combine_ext) { \
400 T0_INTER_T1_USING_FACTOR (0x7F); \
402 else {\
403 rdp.best_tex = 0; \
404 cmb.tex |= 3, \
405 cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
406 cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
407 cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
408 cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
409 cmb.t1c_ext_c = GR_CMBX_ZERO, \
410 cmb.t1c_ext_c_invert = 0, \
411 cmb.t1c_ext_d= GR_CMBX_B, \
412 cmb.t1c_ext_d_invert = 0, \
413 cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
414 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
415 cmb.t0c_ext_b = GR_CMBX_OTHER_TEXTURE_RGB, \
416 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
417 cmb.t0c_ext_c = GR_CMBX_ITALPHA, \
418 cmb.t0c_ext_c_invert = 0, \
419 cmb.t0c_ext_d= GR_CMBX_B, \
420 cmb.t0c_ext_d_invert = 0, \
421 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
423 #define T1_SUB_T0() \
424 rdp.best_tex = 0; \
425 cmb.tex |= 3, \
426 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
427 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, \
428 cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE
429 #define T1_SUB_T0_MUL_T0() \
430 rdp.best_tex = 0; \
431 cmb.tex |= 3, \
432 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
433 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, \
434 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
435 #define T1_MUL_PRIMLOD_ADD_T0() \
436 rdp.best_tex = 0; \
437 cmb.tex |= 3, \
438 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
439 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
440 cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
441 percent = (float)(lod_frac) / 255.0f, \
442 cmb.dc0_detailmax = cmb.dc1_detailmax = percent
443 #define T1_MUL_PRIMA_ADD_T0() \
444 rdp.best_tex = 0; \
445 cmb.tex |= 3, \
446 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
447 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
448 cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
449 percent = (float)(rdp.prim_color&0xFF) / 255.0f, \
450 cmb.dc0_detailmax = cmb.dc1_detailmax = percent
451 #define T1_MUL_ENVA_ADD_T0() \
452 rdp.best_tex = 0; \
453 cmb.tex |= 3, \
454 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
455 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
456 cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
457 percent = (float)(rdp.env_color&0xFF) / 255.0f, \
458 cmb.dc0_detailmax = cmb.dc1_detailmax = percent
459 #define T0_SUB_PRIM_MUL_PRIMLOD_ADD_T1() \
460 T0_ADD_T1 (); \
461 MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC); \
462 MOD_0_COL (rdp.prim_color & 0xFFFFFF00); \
463 MOD_0_FAC (lod_frac & 0xFF);
464 #define T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0() \
465 if (cmb.combine_ext) \
467 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, \
468 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X, \
469 GR_CMBX_DETAIL_FACTOR, 0, \
470 GR_CMBX_ZERO, 0); \
471 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X, \
472 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, \
473 GR_CMBX_ZERO, 1, \
474 GR_CMBX_ZERO, 0); \
475 cmb.tex_ccolor = rdp.prim_color; \
476 cmb.tex |= 3; \
477 percent = (float)(lod_frac) / 255.0f; \
478 cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
480 else \
482 T0_ADD_T1 (); \
483 MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC); \
484 MOD_1_COL (rdp.prim_color & 0xFFFFFF00); \
485 MOD_1_FAC (lod_frac & 0xFF); \
487 #define PRIM_INTER_T0_USING_SHADEA() \
488 if (!cmb.combine_ext) { \
489 USE_T0 (); \
491 else {\
492 rdp.best_tex = 0; \
493 cmb.tex |= 1, \
494 cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
495 cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
496 cmb.t0c_ext_b = GR_CMBX_TMU_CCOLOR, \
497 cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
498 cmb.t0c_ext_c = GR_CMBX_ITALPHA, \
499 cmb.t0c_ext_c_invert = 0, \
500 cmb.t0c_ext_d= GR_CMBX_B, \
501 cmb.t0c_ext_d_invert = 0, \
502 cmb.tex_ccolor = rdp.prim_color, \
503 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
506 #define A_USE_T0() \
507 cmb.tex |= 1, \
508 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL
509 #define A_USE_T1() \
510 if (num_tmu > 1) { \
511 cmb.tex |= 2, \
512 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
513 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
514 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE; \
516 else { \
517 A_USE_T0(); \
519 #define A_T0_ADD_T1() \
520 cmb.tex |= 3, \
521 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
522 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
523 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE
524 #define A_T0_SUB_T1() \
525 cmb.tex |= 3, \
526 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
527 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL, \
528 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA
529 #define A_T0_MUL_T1() \
530 cmb.tex |= 3, \
531 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
532 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
533 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_LOCAL
534 #define A_T0_INTER_T1_USING_T0A() \
535 rdp.best_tex = 0; \
536 cmb.tex |= 3, \
537 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
538 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
539 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA
540 #define A_T1_INTER_T0_USING_T0A() \
541 rdp.best_tex = 0; \
542 cmb.tex |= 3, \
543 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
544 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
545 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA
546 #define A_T0_INTER_T1_USING_T1A() \
547 rdp.best_tex = 0; \
548 cmb.tex |= 3, \
549 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
550 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
551 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA
552 #define A_T0_INTER_T1_USING_FACTOR(factor) \
553 if (factor == 0xFF) { \
554 A_USE_T1(); \
556 else if (factor == 0x00) { \
557 A_USE_T0(); \
559 else { \
560 cmb.tex |= 3, \
561 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
562 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
563 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
564 percent = (float)factor / 255.0f, \
565 cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
567 #define A_T1_INTER_T0_USING_FACTOR(factor) /* inverse of above */\
568 if (factor == 0xFF) { \
569 A_USE_T0(); \
571 else if (factor == 0x00) { \
572 A_USE_T1(); \
574 else { \
575 cmb.tex |= 3, \
576 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
577 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
578 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
579 percent = (255 - factor) / 255.0f, \
580 cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
582 #define A_T0_INTER_T1_USING_SHADEA() \
583 if (!cmb.combine_ext) { \
584 A_T0_INTER_T1_USING_FACTOR (0x7F); \
586 else {\
587 rdp.best_tex = 0; \
588 cmb.tex |= 3, \
589 cmb.t1a_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA, \
590 cmb.t1a_ext_a_mode = GR_FUNC_MODE_ZERO, \
591 cmb.t1a_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA, \
592 cmb.t1a_ext_b_mode = GR_FUNC_MODE_ZERO, \
593 cmb.t1a_ext_c = GR_CMBX_ZERO, \
594 cmb.t1a_ext_c_invert = 0, \
595 cmb.t1a_ext_d= GR_CMBX_B, \
596 cmb.t1a_ext_d_invert = 0, \
597 cmb.t0a_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA, \
598 cmb.t0a_ext_a_mode = GR_FUNC_MODE_X, \
599 cmb.t0a_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA, \
600 cmb.t0a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
601 cmb.t0a_ext_c = GR_CMBX_ITALPHA, \
602 cmb.t0a_ext_c_invert = 0, \
603 cmb.t0a_ext_d= GR_CMBX_B, \
604 cmb.t0a_ext_d_invert = 0, \
605 cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_ALPHA; \
607 #define A_T1_MUL_PRIMLOD_ADD_T0() \
608 rdp.best_tex = 0; \
609 cmb.tex |= 3, \
610 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
611 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
612 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
613 percent = (float)(lod_frac) / 255.0f, \
614 cmb.dc0_detailmax = cmb.dc1_detailmax = percent
615 #define A_T1_MUL_PRIMA_ADD_T0() \
616 rdp.best_tex = 0; \
617 cmb.tex |= 3, \
618 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
619 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
620 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
621 percent = (float)(rdp.prim_color&0xFF) / 255.0f, \
622 cmb.dc0_detailmax = cmb.dc1_detailmax = percent
623 #define A_T1_MUL_ENVA_ADD_T0() \
624 rdp.best_tex = 0; \
625 cmb.tex |= 3, \
626 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
627 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
628 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
629 percent = (float)(rdp.env_color&0xFF) / 255.0f, \
630 cmb.dc0_detailmax = cmb.dc1_detailmax = percent
633 // UNIMP - writes to the unimplemented log, if it's enabled
634 #ifdef UNIMP_LOG
635 #define UNIMPMODE() { \
636 std::ofstream unimp; \
637 unimp.open("unimp.txt", std::ios::app); \
638 unimp << out_buf; \
639 unimp.close(); \
641 #else
642 #define UNIMPMODE()
643 #endif
645 // Bright red, sets up a bright red combine
646 #ifdef BRIGHT_RED
647 // Bright red, sets up a bright red combine during the alpha stage
648 #define BrightRed() { \
649 CCMB (GR_COMBINE_FUNCTION_LOCAL, \
650 GR_COMBINE_FACTOR_NONE, \
651 GR_COMBINE_LOCAL_CONSTANT, \
652 GR_COMBINE_OTHER_NONE); \
653 ACMB (GR_COMBINE_FUNCTION_LOCAL, \
654 GR_COMBINE_FACTOR_NONE, \
655 GR_COMBINE_LOCAL_CONSTANT, \
656 GR_COMBINE_OTHER_NONE); \
657 cmb.ccolor = 0xFF0000FF; \
659 #else
660 #define BrightRed()
661 #endif
663 #define CC(x) cmb.ccolor=(x)&0xFFFFFF00
664 #define CC_PRIM() cmb.ccolor=rdp.prim_color&0xFFFFFF00
665 #define CC_PRIMA() { cmb.ccolor=rdp.prim_color&0xFF; cmb.ccolor=(cmb.ccolor<<8)|(cmb.ccolor<<16)|(cmb.ccolor<<24); }
666 #define CC_1SUBPRIMA() { cmb.ccolor=(~rdp.prim_color)&0xFF; cmb.ccolor=(cmb.ccolor<<8)|(cmb.ccolor<<16)|(cmb.ccolor<<24); }
667 #define CC_1SUBPRIM() cmb.ccolor=(~rdp.prim_color)&0xFFFFFF00
668 #define CC_ENV() cmb.ccolor=rdp.env_color&0xFFFFFF00
669 #define CC_1SUBENV() cmb.ccolor=(~rdp.env_color)&0xFFFFFF00
670 #define CC_ENVA() { cmb.ccolor=rdp.env_color&0xFF; cmb.ccolor=(cmb.ccolor<<8)|(cmb.ccolor<<16)|(cmb.ccolor<<24); }
671 #define CC_PRIMLOD() { cmb.ccolor = (lod_frac<<24) | (lod_frac<<16) | (lod_frac<<8); }
672 #define CC_K5() { cmb.ccolor = (rdp.K5<<24) | (rdp.K5<<16) | (rdp.K5<<8); }
673 #define CC_PRIMMULENV() { \
674 cmb.ccolor=(BYTE)( ((rdp.prim_color & 0xFF000000) >> 24) * (((rdp.env_color & 0xFF000000) >> 24) /255.0f) ) << 24 | \
675 (BYTE)( ((rdp.prim_color & 0x00FF0000) >> 16) * (((rdp.env_color & 0x00FF0000) >> 16) /255.0f) ) << 16 | \
676 (BYTE)( ((rdp.prim_color & 0x0000FF00) >> 8) * (((rdp.env_color & 0x0000FF00) >> 8) /255.0f) ) << 8 ; \
678 #define CC_PRIMSUBENV() { \
679 cmb.ccolor=(BYTE)( ((rdp.prim_color & 0xFF000000) >> 24) - (((rdp.env_color & 0xFF000000) >> 24) ) ) << 24 | \
680 (BYTE)( ((rdp.prim_color & 0x00FF0000) >> 16) - (((rdp.env_color & 0x00FF0000) >> 16) ) ) << 16 | \
681 (BYTE)( ((rdp.prim_color & 0x0000FF00) >> 8) - (((rdp.env_color & 0x0000FF00) >> 8) ) ) << 8 ; \
684 #define MULSHADE(color) { \
685 rdp.col[0] *= (float)((color & 0xFF000000) >> 24) / 255.0f; \
686 rdp.col[1] *= (float)((color & 0x00FF0000) >> 16) / 255.0f; \
687 rdp.col[2] *= (float)((color & 0x0000FF00) >> 8) / 255.0f; \
688 rdp.cmb_flags |= CMB_MULT; \
690 #define MULSHADE_PRIM() { \
691 rdp.col[0] *= (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; \
692 rdp.col[1] *= (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; \
693 rdp.col[2] *= (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f; \
694 rdp.cmb_flags |= CMB_MULT; \
696 #define MULSHADE_PRIMA() { \
697 rdp.col[0] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
698 rdp.col[1] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
699 rdp.col[2] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
700 rdp.cmb_flags |= CMB_MULT; \
702 #define MULSHADE_ENV() { \
703 rdp.col[0] *= (float)((rdp.env_color & 0xFF000000) >> 24) / 255.0f; \
704 rdp.col[1] *= (float)((rdp.env_color & 0x00FF0000) >> 16) / 255.0f; \
705 rdp.col[2] *= (float)((rdp.env_color & 0x0000FF00) >> 8) / 255.0f; \
706 rdp.cmb_flags |= CMB_MULT; \
708 #define MULSHADE_ENVA() { \
709 rdp.col[0] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
710 rdp.col[1] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
711 rdp.col[2] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
712 rdp.cmb_flags |= CMB_MULT; \
714 #define MULSHADE_1MPRIM() { \
715 rdp.col[0] *= 1.0f-((float)((rdp.prim_color & 0xFF000000) >> 24)/255.0f); \
716 rdp.col[1] *= 1.0f-((float)((rdp.prim_color & 0x00FF0000) >> 16)/255.0f); \
717 rdp.col[2] *= 1.0f-((float)((rdp.prim_color & 0x0000FF00) >> 8)/255.0f); \
718 rdp.cmb_flags |= CMB_MULT; \
720 #define MULSHADE_1MENV() { \
721 rdp.col[0] *= 1.0f-((float)((rdp.env_color & 0xFF000000) >> 24)/255.0f); \
722 rdp.col[1] *= 1.0f-((float)((rdp.env_color & 0x00FF0000) >> 16)/255.0f); \
723 rdp.col[2] *= 1.0f-((float)((rdp.env_color & 0x0000FF00) >> 8)/255.0f); \
724 rdp.cmb_flags |= CMB_MULT; \
726 //Added by Gonetz
727 #define MULSHADE_PRIMSUBENV() { \
728 rdp.col[0] *= (float)( ((rdp.prim_color & 0xFF000000) >> 24) - ((rdp.env_color & 0xFF000000) >> 24) )/255.0f; \
729 rdp.col[1] *= (float)( ((rdp.prim_color & 0x00FF0000) >> 16) - ((rdp.env_color & 0x00FF0000) >> 16) )/255.0f; \
730 rdp.col[2] *= (float)( ((rdp.prim_color & 0x0000FF00) >> 8) - ((rdp.env_color & 0x0000FF00) >> 8) )/255.0f; \
731 rdp.cmb_flags |= CMB_MULT; \
733 //Added by Gonetz
734 #define MULSHADE_ENVSUBPRIM() { \
735 rdp.col[0] *= (float)( ((rdp.env_color & 0xFF000000) >> 24) - ((rdp.prim_color & 0xFF000000) >> 24) )/255.0f; \
736 rdp.col[1] *= (float)( ((rdp.env_color & 0x00FF0000) >> 16) - ((rdp.prim_color & 0x00FF0000) >> 16) )/255.0f; \
737 rdp.col[2] *= (float)( ((rdp.env_color & 0x0000FF00) >> 8) - ((rdp.prim_color & 0x0000FF00) >> 8) )/255.0f; \
738 rdp.cmb_flags |= CMB_MULT; \
740 //Added by Gonetz
741 #define MULSHADE_PRIMLOD() { \
742 rdp.col[0] *= (float)(lod_frac & 0xFF) / 255.0f; \
743 rdp.col[1] *= (float)(lod_frac & 0xFF) / 255.0f; \
744 rdp.col[2] *= (float)(lod_frac & 0xFF) / 255.0f; \
745 rdp.cmb_flags |= CMB_MULT; \
747 //Added by Gonetz
748 #define MULSHADE_K5() { \
749 rdp.col[0] *= (float)rdp.K5 / 255.0f; \
750 rdp.col[1] *= (float)rdp.K5 / 255.0f; \
751 rdp.col[2] *= (float)rdp.K5 / 255.0f; \
752 rdp.cmb_flags |= CMB_MULT; \
754 #define MULSHADE_SHADEA() rdp.cmb_flags |= CMB_MULT_OWN_ALPHA;
756 #define SUBSHADE_PRIM() { \
757 rdp.coladd[0] *= (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; \
758 rdp.coladd[1] *= (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; \
759 rdp.coladd[2] *= (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f; \
760 rdp.cmb_flags |= CMB_SUB; \
762 #define SUBSHADE_ENV() { \
763 rdp.coladd[0] *= (float)((rdp.env_color & 0xFF000000) >> 24) / 255.0f; \
764 rdp.coladd[1] *= (float)((rdp.env_color & 0x00FF0000) >> 16) / 255.0f; \
765 rdp.coladd[2] *= (float)((rdp.env_color & 0x0000FF00) >> 8) / 255.0f; \
766 rdp.cmb_flags |= CMB_SUB; \
768 #define SUBSHADE_PRIMSUBENV() { \
769 rdp.coladd[0] *= (float)( ((rdp.prim_color & 0xFF000000) >> 24) - ((rdp.env_color & 0xFF000000) >> 24) )/255.0f; \
770 rdp.coladd[1] *= (float)( ((rdp.prim_color & 0x00FF0000) >> 16) - ((rdp.env_color & 0x00FF0000) >> 16) )/255.0f; \
771 rdp.coladd[2] *= (float)( ((rdp.prim_color & 0x0000FF00) >> 8) - ((rdp.env_color & 0x0000FF00) >> 8) )/255.0f; \
772 rdp.cmb_flags |= CMB_SUB; \
774 #define SUBSHADE_PRIMMULENV() { \
775 rdp.coladd[0] *= (float)( ((rdp.prim_color & 0xFF000000) >> 24) * ((rdp.env_color & 0xFF000000) >> 24) )/255.0f; \
776 rdp.coladd[1] *= (float)( ((rdp.prim_color & 0x00FF0000) >> 16) * ((rdp.env_color & 0x00FF0000) >> 16) )/255.0f; \
777 rdp.coladd[2] *= (float)( ((rdp.prim_color & 0x0000FF00) >> 8) * ((rdp.env_color & 0x0000FF00) >> 8) )/255.0f; \
778 rdp.cmb_flags |= CMB_SUB; \
780 #define ADDSHADE_PRIM() { \
781 rdp.coladd[0] *= (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; \
782 rdp.coladd[1] *= (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; \
783 rdp.coladd[2] *= (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f; \
784 rdp.cmb_flags |= CMB_ADD; \
786 #define ADDSHADE_ENV() { \
787 rdp.coladd[0] *= (float)((rdp.env_color & 0xFF000000) >> 24) / 255.0f; \
788 rdp.coladd[1] *= (float)((rdp.env_color & 0x00FF0000) >> 16) / 255.0f; \
789 rdp.coladd[2] *= (float)((rdp.env_color & 0x0000FF00) >> 8) / 255.0f; \
790 rdp.cmb_flags |= CMB_ADD; \
792 #define ADDSHADE_PRIMSUBENV() { \
793 rdp.coladd[0] *= (float)( ((rdp.prim_color & 0xFF000000) >> 24) - ((rdp.env_color & 0xFF000000) >> 24) )/255.0f; \
794 rdp.coladd[1] *= (float)( ((rdp.prim_color & 0x00FF0000) >> 16) - ((rdp.env_color & 0x00FF0000) >> 16) )/255.0f; \
795 rdp.coladd[2] *= (float)( ((rdp.prim_color & 0x0000FF00) >> 8) - ((rdp.env_color & 0x0000FF00) >> 8) )/255.0f; \
796 rdp.cmb_flags |= CMB_ADD; \
798 #define COLSUBSHADE_PRIM() { \
799 rdp.coladd[0] *= (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; \
800 rdp.coladd[1] *= (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; \
801 rdp.coladd[2] *= (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f; \
802 rdp.cmb_flags |= CMB_COL_SUB_OWN; \
806 #define SETSHADE_PRIM() { \
807 rdp.col[0] *= (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; \
808 rdp.col[1] *= (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; \
809 rdp.col[2] *= (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f; \
810 rdp.cmb_flags = CMB_SET; \
812 #define SETSHADE_ENV() { \
813 rdp.col[0] *= (float)((rdp.env_color & 0xFF000000) >> 24) / 255.0f; \
814 rdp.col[1] *= (float)((rdp.env_color & 0x00FF0000) >> 16) / 255.0f; \
815 rdp.col[2] *= (float)((rdp.env_color & 0x0000FF00) >> 8) / 255.0f; \
816 rdp.cmb_flags = CMB_SET; \
818 #define SETSHADE_1MPRIM() { \
819 rdp.col[0] *= 1.0f-((float)((rdp.prim_color & 0xFF000000) >> 24)/255.0f); \
820 rdp.col[1] *= 1.0f-((float)((rdp.prim_color & 0x00FF0000) >> 16)/255.0f); \
821 rdp.col[2] *= 1.0f-((float)((rdp.prim_color & 0x0000FF00) >> 8)/255.0f); \
822 rdp.cmb_flags = CMB_SET; \
824 #define SETSHADE_1MENV() { \
825 rdp.col[0] *= 1.0f-((float)((rdp.env_color & 0xFF000000) >> 24)/255.0f); \
826 rdp.col[1] *= 1.0f-((float)((rdp.env_color & 0x00FF0000) >> 16)/255.0f); \
827 rdp.col[2] *= 1.0f-((float)((rdp.env_color & 0x0000FF00) >> 8)/255.0f); \
828 rdp.cmb_flags = CMB_SET; \
830 #define SETSHADE_PRIMA() { \
831 rdp.col[0] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
832 rdp.col[1] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
833 rdp.col[2] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
834 rdp.cmb_flags = CMB_SET; \
836 #define SETSHADE_1MPRIMA() { \
837 rdp.col[0] *= (float)((~rdp.prim_color) & 0xFF) / 255.0f; \
838 rdp.col[1] *= (float)((~rdp.prim_color) & 0xFF) / 255.0f; \
839 rdp.col[2] *= (float)((~rdp.prim_color) & 0xFF) / 255.0f; \
840 rdp.cmb_flags = CMB_SET; \
842 #define SETSHADE_PRIMSUBENV() { \
843 rdp.col[0] *= (float)( ((rdp.prim_color & 0xFF000000) >> 24) - ((rdp.env_color & 0xFF000000) >> 24) )/255.0f; \
844 rdp.col[1] *= (float)( ((rdp.prim_color & 0x00FF0000) >> 16) - ((rdp.env_color & 0x00FF0000) >> 16) )/255.0f; \
845 rdp.col[2] *= (float)( ((rdp.prim_color & 0x0000FF00) >> 8) - ((rdp.env_color & 0x0000FF00) >> 8) )/255.0f; \
846 rdp.cmb_flags = CMB_SET; \
848 #define SETSHADE_ENVSUBPRIM() { \
849 rdp.col[0] *= (float)( ((rdp.env_color & 0xFF000000) >> 24) - ((rdp.prim_color & 0xFF000000) >> 24) )/255.0f; \
850 rdp.col[1] *= (float)( ((rdp.env_color & 0x00FF0000) >> 16) - ((rdp.prim_color & 0x00FF0000) >> 16) )/255.0f; \
851 rdp.col[2] *= (float)( ((rdp.env_color & 0x0000FF00) >> 8) - ((rdp.prim_color & 0x0000FF00) >> 8) )/255.0f; \
852 rdp.cmb_flags = CMB_SET; \
854 #define SETSHADE_PRIMLOD() { \
855 rdp.col[0] *= (float)(lod_frac & 0xFF) / 255.0f; \
856 rdp.col[1] *= (float)(lod_frac & 0xFF) / 255.0f; \
857 rdp.col[2] *= (float)(lod_frac & 0xFF) / 255.0f; \
858 rdp.cmb_flags = CMB_SET; \
861 #define SETSHADE_1MPRIMLOD() { \
862 rdp.col[0] *= (float)(~lod_frac & 0xFF) / 255.0f; \
863 rdp.col[1] *= (float)(~lod_frac & 0xFF) / 255.0f; \
864 rdp.col[2] *= (float)(~lod_frac & 0xFF) / 255.0f; \
865 rdp.cmb_flags = CMB_SET; \
868 #define SETSHADE_SHADE_A() { \
869 rdp.cmb_flags = CMB_SETSHADE_SHADEALPHA; \
872 #define INTERSHADE_2(color,factor) { \
873 rdp.col_2[0] = (((color) >> 24) & 0xFF) / 255.0f; \
874 rdp.col_2[1] = (((color) >> 16) & 0xFF) / 255.0f; \
875 rdp.col_2[2] = (((color) >> 8) & 0xFF) / 255.0f; \
876 rdp.shade_factor = (factor) / 255.0f; \
877 rdp.cmb_flags_2 = CMB_INTER; \
880 #define CA(x) cmb.ccolor|=(x)&0xFF
881 #define CA_PRIM() cmb.ccolor|=rdp.prim_color&0xFF
882 #define CA_INVPRIM() cmb.ccolor|=0xFF-(rdp.prim_color&0xFF)
883 #define CA_INVENV() cmb.ccolor|=0xFF-(rdp.env_color&0xFF)
884 #define CA_ENV() cmb.ccolor|=rdp.env_color&0xFF
885 #define CA_ENV1MPRIM() cmb.ccolor|= (DWORD)(((rdp.env_color&0xFF)/255.0f) * (((~(rdp.prim_color&0xFF)) & 0xff)/255.0f) * 255.0f);
886 #define CA_PRIMENV() cmb.ccolor |= (DWORD)(((rdp.env_color&0xFF)/255.0f) * ((rdp.prim_color&0xFF)/255.0f) * 255.0f);
887 #define CA_PRIMLOD() cmb.ccolor |= lod_frac;
888 #define CA_PRIM_MUL_PRIMLOD() cmb.ccolor |= (int)(((rdp.prim_color&0xFF) * lod_frac) / 255.0f);
889 #define CA_ENV_MUL_PRIMLOD() cmb.ccolor |= (int)(((rdp.env_color&0xFF) * lod_frac) / 255.0f);
891 #define MULSHADE_A_PRIM() { \
892 rdp.col[3] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
893 rdp.cmb_flags |= CMB_A_MULT; \
895 #define MULSHADE_A_1MPRIM() { \
896 rdp.col[3] *= 1.0f-((float)(rdp.prim_color & 0xFF) / 255.0f); \
897 rdp.cmb_flags |= CMB_A_MULT; \
899 #define MULSHADE_A_ENV() { \
900 rdp.col[3] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
901 rdp.cmb_flags |= CMB_A_MULT; \
903 //Added by Gonetz
904 #define MULSHADE_A_PRIMSUBENV() { \
905 rdp.col[3] *= (float)( (rdp.prim_color & 0xFF) - (rdp.env_color & 0xFF) ) / 255.0f; \
906 rdp.cmb_flags |= CMB_A_MULT; \
908 //Added by Gonetz
909 #define MULSHADE_A_ENVSUBPRIM() { \
910 rdp.col[3] *= (float)( (rdp.env_color & 0xFF) - (rdp.prim_color & 0xFF) ) / 255.0f; \
911 rdp.cmb_flags |= CMB_A_MULT; \
914 #define SETSHADE_A(color) { \
915 rdp.col[3] *= (float)(color&0xFF)/255.0f; \
916 rdp.cmb_flags |= CMB_A_SET; \
918 #define SETSHADE_A_PRIM() { \
919 rdp.col[3] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
920 rdp.cmb_flags |= CMB_A_SET; \
922 #define SETSHADE_A_ENV() { \
923 rdp.col[3] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
924 rdp.cmb_flags |= CMB_A_SET; \
926 #define SETSHADE_A_INVENV() { \
927 rdp.col[3] *= (float)(0xFF - (rdp.env_color & 0xFF)) / 255.0f; \
928 rdp.cmb_flags |= CMB_A_SET; \
930 #define SUBSHADE_A_PRIM() { \
931 rdp.coladd[3] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
932 rdp.cmb_flags |= CMB_A_SUB; \
934 #define SUBSHADE_A_ENV() { \
935 rdp.coladd[3] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
936 rdp.cmb_flags |= CMB_A_SUB; \
938 #define ADDSHADE_A_PRIM() { \
939 rdp.coladd[3] *= (float)(rdp.prim_color & 0xFF) / 255.0f; \
940 rdp.cmb_flags |= CMB_A_ADD; \
942 #define ADDSHADE_A_ENV() { \
943 rdp.coladd[3] *= (float)(rdp.env_color & 0xFF) / 255.0f; \
944 rdp.cmb_flags |= CMB_A_ADD; \
947 //****************************************************************
948 // Combine Functions
949 //****************************************************************
951 // These are in a somewhat ordered way, using the A constants below. T0 comes before
952 // T1 comes before PRIM, ... except for CMB, which always comes at the end, where
953 // the CMB comes first in the name. T0 and T1 are always interleaved, because they use the
954 // same function.
955 // Keep going in alphabetical order, but do not break the order of variables!
956 // ex: A*C + B*C -> T0_MUL_PRIM_ADD_ENV_MUL_PRIM,
957 // Although prim comes before env, we have already used prim as C, so it must stay as C
958 // and would NOT become T0_MUL_PRIM_ADD_PRIM_MUL_ENV
960 // New version ordered by:
961 // t0
962 // prim
963 // env
964 // shade
966 static void cc_one ()
968 CCMB (GR_COMBINE_FUNCTION_LOCAL,
969 GR_COMBINE_FACTOR_NONE,
970 GR_COMBINE_LOCAL_CONSTANT,
971 GR_COMBINE_OTHER_NONE);
972 // CC (0xFFFFFF00);
973 CC (0xFFFFFF00);
976 static void cc_zero ()
978 CCMB (GR_COMBINE_FUNCTION_LOCAL,
979 GR_COMBINE_FACTOR_NONE,
980 GR_COMBINE_LOCAL_CONSTANT,
981 GR_COMBINE_OTHER_NONE);
982 CC (0x00000000);
985 static void cc_t0 ()
987 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
988 GR_COMBINE_FACTOR_ONE,
989 GR_COMBINE_LOCAL_NONE,
990 GR_COMBINE_OTHER_TEXTURE);
991 USE_T0 ();
994 static void cc_t1 () //Added by Gonetz
996 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
997 GR_COMBINE_FACTOR_ONE,
998 GR_COMBINE_LOCAL_NONE,
999 GR_COMBINE_OTHER_TEXTURE);
1000 USE_T1 ();
1003 static void cc_t0_mul_t1 ()
1005 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1006 GR_COMBINE_FACTOR_ONE,
1007 GR_COMBINE_LOCAL_NONE,
1008 GR_COMBINE_OTHER_TEXTURE);
1009 T0_MUL_T1 ();
1012 static void cc_t0_mul_t1_add_t0 () //Added by Gonetz
1014 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1015 GR_COMBINE_FACTOR_ONE,
1016 GR_COMBINE_LOCAL_NONE,
1017 GR_COMBINE_OTHER_TEXTURE);
1018 T0_MUL_T1_ADD_T0 ();
1021 static void cc_t1_inter_t0_using_env ()
1023 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1024 GR_COMBINE_FACTOR_ONE,
1025 GR_COMBINE_LOCAL_NONE,
1026 GR_COMBINE_OTHER_TEXTURE);
1027 T1_INTER_T0_USING_ENV ();
1030 static void cc_prim ()
1032 CCMB (GR_COMBINE_FUNCTION_LOCAL,
1033 GR_COMBINE_FACTOR_NONE,
1034 GR_COMBINE_LOCAL_CONSTANT,
1035 GR_COMBINE_OTHER_NONE);
1036 CC_PRIM ();
1039 static void cc_env ()
1041 CCMB (GR_COMBINE_FUNCTION_LOCAL,
1042 GR_COMBINE_FACTOR_NONE,
1043 GR_COMBINE_LOCAL_CONSTANT,
1044 GR_COMBINE_OTHER_NONE);
1045 CC_ENV ();
1048 static void cc_shade ()
1050 CCMB (GR_COMBINE_FUNCTION_LOCAL,
1051 GR_COMBINE_FACTOR_NONE,
1052 GR_COMBINE_LOCAL_ITERATED,
1053 GR_COMBINE_OTHER_NONE);
1056 static void cc_shadea ()
1058 CCMB (GR_COMBINE_FUNCTION_LOCAL_ALPHA,
1059 GR_COMBINE_FACTOR_NONE,
1060 GR_COMBINE_LOCAL_ITERATED,
1061 GR_COMBINE_OTHER_NONE);
1064 static void cc_t0_mul_prim ()
1066 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1067 GR_COMBINE_FACTOR_LOCAL,
1068 GR_COMBINE_LOCAL_CONSTANT,
1069 GR_COMBINE_OTHER_TEXTURE);
1070 CC_PRIM ();
1071 USE_T0 ();
1074 static void cc_t0_mul_prima ()
1076 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1077 GR_COMBINE_FACTOR_LOCAL,
1078 GR_COMBINE_LOCAL_CONSTANT,
1079 GR_COMBINE_OTHER_TEXTURE);
1080 CC_PRIMA ();
1081 USE_T0 ();
1084 static void cc_t1_mul_prim ()
1086 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1087 GR_COMBINE_FACTOR_LOCAL,
1088 GR_COMBINE_LOCAL_CONSTANT,
1089 GR_COMBINE_OTHER_TEXTURE);
1090 CC_PRIM ();
1091 USE_T1 ();
1094 //Added by Gonetz
1095 static void cc__t1_inter_t0_using_enva__mul_prim ()
1097 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1098 GR_COMBINE_FACTOR_LOCAL,
1099 GR_COMBINE_LOCAL_CONSTANT,
1100 GR_COMBINE_OTHER_TEXTURE);
1101 CC_PRIM ();
1102 BYTE factor = (BYTE)(rdp.env_color&0xFF);
1103 T1_INTER_T0_USING_FACTOR (factor);
1106 static void cc__t1_inter_one_using_env__mul_prim ()
1108 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1109 GR_COMBINE_FACTOR_LOCAL,
1110 GR_COMBINE_LOCAL_CONSTANT,
1111 GR_COMBINE_OTHER_TEXTURE);
1112 CC_PRIM ();
1113 if (cmb.combine_ext)
1115 T1CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
1116 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1117 GR_CMBX_LOCAL_TEXTURE_RGB, 1,
1118 GR_CMBX_B, 0);
1119 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
1120 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1121 GR_CMBX_ZERO, 1,
1122 GR_CMBX_ZERO, 0);
1123 cmb.tex |= 2;
1124 cmb.tex_ccolor = rdp.env_color;
1126 else
1128 USE_T1 ();
1132 //Added by Gonetz
1133 static void cc_prim_mul_prim ()
1135 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1136 GR_COMBINE_FACTOR_LOCAL,
1137 GR_COMBINE_LOCAL_ITERATED,
1138 GR_COMBINE_OTHER_CONSTANT);
1139 CC_PRIM ();
1140 SETSHADE_PRIM ();
1143 static void cc_prim_mul_prima ()
1145 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1146 GR_COMBINE_FACTOR_LOCAL,
1147 GR_COMBINE_LOCAL_CONSTANT,
1148 GR_COMBINE_OTHER_ITERATED);
1149 CC_PRIM ();
1150 SETSHADE_PRIMA ();
1153 static void cc_t1_mul_prima ()
1155 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1156 GR_COMBINE_FACTOR_LOCAL,
1157 GR_COMBINE_LOCAL_CONSTANT,
1158 GR_COMBINE_OTHER_TEXTURE);
1159 CC_PRIMA ();
1160 USE_T1 ();
1163 static void cc_t1_mul_enva ()
1165 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1166 GR_COMBINE_FACTOR_LOCAL,
1167 GR_COMBINE_LOCAL_CONSTANT,
1168 GR_COMBINE_OTHER_TEXTURE);
1169 CC_ENVA ();
1170 USE_T1 ();
1173 static void cc_t0_mul_env ()
1175 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1176 GR_COMBINE_FACTOR_LOCAL,
1177 GR_COMBINE_LOCAL_CONSTANT,
1178 GR_COMBINE_OTHER_TEXTURE);
1179 CC_ENV ();
1180 USE_T0 ();
1183 static void cc_t1_mul_env ()
1185 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1186 GR_COMBINE_FACTOR_LOCAL,
1187 GR_COMBINE_LOCAL_CONSTANT,
1188 GR_COMBINE_OTHER_TEXTURE);
1189 CC_ENV ();
1190 USE_T1 ();
1193 //Added by Gonetz
1194 static void cc_t0_mul_enva ()
1196 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1197 GR_COMBINE_FACTOR_LOCAL,
1198 GR_COMBINE_LOCAL_CONSTANT,
1199 GR_COMBINE_OTHER_TEXTURE);
1200 CC_ENVA ();
1201 USE_T0 ();
1204 static void cc_t0_mul_enva_add_prim ()
1206 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1207 GR_COMBINE_FACTOR_TEXTURE_RGB,
1208 GR_COMBINE_LOCAL_ITERATED,
1209 GR_COMBINE_OTHER_CONSTANT);
1210 SETSHADE_PRIM ();
1211 CC_ENVA ();
1212 USE_T0 ();
1215 static void cc_t0_mul_shade ()
1217 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1218 GR_COMBINE_FACTOR_LOCAL,
1219 GR_COMBINE_LOCAL_ITERATED,
1220 GR_COMBINE_OTHER_TEXTURE);
1221 USE_T0 ();
1224 static void cc_t0_mul_shadea ()
1226 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1227 GR_COMBINE_FACTOR_LOCAL,
1228 GR_COMBINE_LOCAL_ITERATED,
1229 GR_COMBINE_OTHER_TEXTURE);
1230 SETSHADE_SHADE_A ();
1231 USE_T0 ();
1234 static void cc_t0_mul_k5 ()
1236 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1237 GR_COMBINE_FACTOR_LOCAL,
1238 GR_COMBINE_LOCAL_CONSTANT,
1239 GR_COMBINE_OTHER_TEXTURE);
1240 CC_K5 ();
1241 USE_T0 ();
1244 static void cc_t1_mul_shade ()
1246 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1247 GR_COMBINE_FACTOR_LOCAL,
1248 GR_COMBINE_LOCAL_ITERATED,
1249 GR_COMBINE_OTHER_TEXTURE);
1250 USE_T1 ();
1253 //Added by Gonetz
1254 static void cc__t0_add_t1__mul_shade ()
1256 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1257 GR_COMBINE_FACTOR_LOCAL,
1258 GR_COMBINE_LOCAL_ITERATED,
1259 GR_COMBINE_OTHER_TEXTURE);
1260 T0_ADD_T1 ();
1263 //Added by Gonetz
1264 static void cc__t1_inter_t0_using_enva__mul_shade ()
1266 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1267 GR_COMBINE_FACTOR_LOCAL,
1268 GR_COMBINE_LOCAL_ITERATED,
1269 GR_COMBINE_OTHER_TEXTURE);
1270 BYTE factor = (BYTE)(rdp.env_color&0xFF);
1271 T1_INTER_T0_USING_FACTOR (factor);
1274 //Added by Gonetz
1275 static void cc__t1_inter_t0_using_shadea__mul_shade ()
1277 if (!cmb.combine_ext) {
1278 cc_t0_mul_shade ();
1279 return;
1281 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
1282 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
1283 GR_CMBX_ITRGB, 0,
1284 GR_CMBX_ZERO, 0);
1285 T1_INTER_T0_USING_SHADEA ();
1288 //Added by Gonetz
1289 static void cc__t0_inter_env_using_enva__mul_shade ()
1291 // (env-t0)*env_a+t0, (cmb-0)*shade+0
1292 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1293 GR_COMBINE_FACTOR_LOCAL,
1294 GR_COMBINE_LOCAL_ITERATED,
1295 GR_COMBINE_OTHER_TEXTURE);
1296 if (cmb.combine_ext)
1298 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
1299 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
1300 GR_CMBX_TMU_CALPHA, 0,
1301 GR_CMBX_B, 0);
1302 cmb.tex |= 1;
1303 cmb.tex_ccolor = rdp.env_color;
1305 else
1307 USE_T0 ();
1308 MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
1309 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
1310 MOD_0_FAC (rdp.env_color&0xFF);
1314 static void cc__t1_sub_t0_mul_primlod_add_prim__mul_shade ()
1316 if (cmb.combine_ext)
1318 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1319 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1320 GR_CMBX_ZERO, 0,
1321 GR_CMBX_B, 0);
1322 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
1323 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
1324 GR_CMBX_DETAIL_FACTOR, 0,
1325 GR_CMBX_ZERO, 0);
1326 cmb.tex |= 3;
1327 percent = (float)lod_frac / 255.0f;
1328 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
1329 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
1330 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
1331 GR_CMBX_ITRGB, 0,
1332 GR_CMBX_ZERO, 0);
1333 CC_PRIM ();
1335 else
1337 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1338 GR_COMBINE_FACTOR_LOCAL,
1339 GR_COMBINE_LOCAL_ITERATED,
1340 GR_COMBINE_OTHER_TEXTURE);
1341 T0_INTER_T1_USING_FACTOR (lod_frac);
1345 static void cc__t1_sub_prim_mul_t0__mul_shade ()
1347 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1348 GR_COMBINE_FACTOR_LOCAL,
1349 GR_COMBINE_LOCAL_ITERATED,
1350 GR_COMBINE_OTHER_TEXTURE);
1351 if (cmb.combine_ext)
1353 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1354 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1355 GR_CMBX_ZERO, 0,
1356 GR_CMBX_B, 0);
1357 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
1358 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
1359 GR_CMBX_LOCAL_TEXTURE_RGB, 0,
1360 GR_CMBX_ZERO, 0);
1361 cmb.tex_ccolor = rdp.prim_color;
1362 cmb.tex |= 3;
1364 else
1366 T0_MUL_T1 ();
1370 static void cc__t1_sub_t0_mul_t0_add_shade__mul_shade () //Aded by Gonetz
1372 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1373 GR_COMBINE_FACTOR_ONE,
1374 GR_COMBINE_LOCAL_ITERATED,
1375 GR_COMBINE_OTHER_TEXTURE);
1376 if (cmb.combine_ext)
1378 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1379 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1380 GR_CMBX_ZERO, 0,
1381 GR_CMBX_B, 0);
1382 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
1383 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
1384 GR_CMBX_LOCAL_TEXTURE_RGB, 0,
1385 GR_CMBX_ITRGB, 0);
1386 cmb.tex |= 3;
1388 else
1390 T1_SUB_T0_MUL_T0 ();
1394 static void cc__t0_mul_prima_add_prim_mul__shade ()
1396 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1397 GR_COMBINE_FACTOR_LOCAL,
1398 GR_COMBINE_LOCAL_ITERATED,
1399 GR_COMBINE_OTHER_TEXTURE);
1400 if (cmb.combine_ext)
1402 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1403 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
1404 GR_CMBX_TMU_CALPHA, 0,
1405 GR_CMBX_B, 0);
1406 cmb.tex_ccolor = rdp.prim_color;
1407 cmb.tex |= 1;
1409 else
1411 MOD_0 (TMOD_TEX_SCALE_FAC_ADD_COL);
1412 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
1413 MOD_0_FAC (rdp.prim_color & 0xFF);
1414 USE_T0 ();
1418 static void cc__prim_inter_t0_using_shadea__mul_shade ()
1420 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1421 GR_COMBINE_FACTOR_LOCAL,
1422 GR_COMBINE_LOCAL_ITERATED,
1423 GR_COMBINE_OTHER_TEXTURE);
1424 PRIM_INTER_T0_USING_SHADEA ();
1427 //Added by Gonetz
1428 static void cc_prim_mul_env ()
1430 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1431 GR_COMBINE_FACTOR_LOCAL,
1432 GR_COMBINE_LOCAL_ITERATED,
1433 GR_COMBINE_OTHER_CONSTANT);
1434 CC_PRIM ();
1435 SETSHADE_ENV ();
1438 static void cc_prim_mul_shade ()
1440 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1441 GR_COMBINE_FACTOR_LOCAL,
1442 GR_COMBINE_LOCAL_ITERATED,
1443 GR_COMBINE_OTHER_CONSTANT);
1444 CC_PRIM ();
1447 static void cc_prim_mul_shadea ()
1449 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1450 GR_COMBINE_FACTOR_LOCAL,
1451 GR_COMBINE_LOCAL_ITERATED,
1452 GR_COMBINE_OTHER_CONSTANT);
1453 SETSHADE_SHADE_A ();
1454 CC_PRIM ();
1457 static void cc_env_mul_shade ()
1459 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1460 GR_COMBINE_FACTOR_LOCAL,
1461 GR_COMBINE_LOCAL_ITERATED,
1462 GR_COMBINE_OTHER_CONSTANT);
1463 CC_ENV ();
1466 static void cc_env_mul_enva ()
1468 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1469 GR_COMBINE_FACTOR_OTHER_ALPHA,
1470 GR_COMBINE_LOCAL_NONE,
1471 GR_COMBINE_OTHER_CONSTANT);
1472 CC_ENV ();
1473 CA_ENV ();
1476 // ** A+B **
1478 static void cc_t0_add_t1 ()
1480 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1481 GR_COMBINE_FACTOR_ONE,
1482 GR_COMBINE_LOCAL_NONE,
1483 GR_COMBINE_OTHER_TEXTURE);
1484 T0_ADD_T1 ();
1487 static void cc_t0_add_prim () //Aded by Gonetz
1489 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1490 GR_COMBINE_FACTOR_ONE,
1491 GR_COMBINE_LOCAL_CONSTANT,
1492 GR_COMBINE_OTHER_TEXTURE);
1493 CC_PRIM ();
1494 USE_T0 ();
1497 static void cc__t0_mul_t1__add_prim () //Aded by Gonetz
1499 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1500 GR_COMBINE_FACTOR_ONE,
1501 GR_COMBINE_LOCAL_CONSTANT,
1502 GR_COMBINE_OTHER_TEXTURE);
1503 CC_PRIM ();
1504 T0_MUL_T1 ();
1507 static void cc_t0_add_env ()
1509 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1510 GR_COMBINE_FACTOR_ONE,
1511 GR_COMBINE_LOCAL_CONSTANT,
1512 GR_COMBINE_OTHER_TEXTURE);
1513 CC_ENV ();
1514 USE_T0 ();
1517 //Added by Gonetz
1518 static void cc__t0_mul_t1__add_env ()
1520 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1521 GR_COMBINE_FACTOR_ONE,
1522 GR_COMBINE_LOCAL_CONSTANT,
1523 GR_COMBINE_OTHER_TEXTURE);
1524 CC_ENV ();
1525 T0_MUL_T1 ();
1528 static void cc_t0_add_shade () //Aded by Gonetz
1530 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1531 GR_COMBINE_FACTOR_ONE,
1532 GR_COMBINE_LOCAL_ITERATED,
1533 GR_COMBINE_OTHER_TEXTURE);
1534 USE_T0 ();
1537 static void cc_prim_add_env ()
1539 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1540 GR_COMBINE_FACTOR_ONE,
1541 GR_COMBINE_LOCAL_CONSTANT,
1542 GR_COMBINE_OTHER_ITERATED);
1543 CC_ENV ();
1544 SETSHADE_PRIM ();
1547 static void cc_t0_add_prim_mul_one_sub_t0_add_t0 () //Aded by Gonetz
1549 if (cmb.combine_ext)
1551 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
1552 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1553 GR_CMBX_LOCAL_TEXTURE_RGB, 1,
1554 GR_CMBX_B, 0);
1555 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
1556 GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
1557 GR_CMBX_ZERO, 1,
1558 GR_CMBX_ZERO, 0);
1559 cmb.tex_ccolor = rdp.prim_color;
1560 cmb.tex |= 1;
1562 else
1564 cc_t0_add_prim ();
1568 static void cc_one_sub_prim_mul_t0_add_prim();
1569 static void cc__one_sub_prim_mul_t0_add_prim__mul_prima_add__one_sub_prim_mul_t0_add_prim () //Aded by Gonetz
1571 if (cmb.combine_ext)
1573 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1574 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
1575 GR_CMBX_TMU_CCOLOR, 1,
1576 GR_CMBX_B, 0);
1577 CCMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
1578 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
1579 GR_CMBX_CONSTANT_COLOR, 0,
1580 GR_CMBX_B, 0);
1581 cmb.tex_ccolor = rdp.prim_color;
1582 CC_PRIMA();
1583 cmb.tex |= 3; //hw frame buffer allocated as tile1, but not used in combiner
1585 else
1587 cc_one_sub_prim_mul_t0_add_prim();
1588 // cc_t0 ();
1592 static void cc_prim_add_shade () //Aded by Gonetz
1594 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1595 GR_COMBINE_FACTOR_ONE,
1596 GR_COMBINE_LOCAL_ITERATED,
1597 GR_COMBINE_OTHER_CONSTANT);
1598 CC_PRIM ();
1601 static void cc_env_add_shade () //Aded by Gonetz
1603 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1604 GR_COMBINE_FACTOR_ONE,
1605 GR_COMBINE_LOCAL_ITERATED,
1606 GR_COMBINE_OTHER_CONSTANT);
1607 CC_ENV ();
1610 // ** A-B **
1611 static void cc__t0_inter_t1_using_enva__sub_env () //Aded by Gonetz
1613 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
1614 GR_COMBINE_FACTOR_ONE,
1615 GR_COMBINE_LOCAL_CONSTANT,
1616 GR_COMBINE_OTHER_TEXTURE);
1617 CC_ENV ();
1618 BYTE factor = (BYTE)(rdp.env_color&0xFF);
1619 T0_INTER_T1_USING_FACTOR (factor);
1622 static void cc_t0_sub_shade ()
1624 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
1625 GR_COMBINE_FACTOR_ONE,
1626 GR_COMBINE_LOCAL_ITERATED,
1627 GR_COMBINE_OTHER_TEXTURE);
1628 USE_T0 ();
1631 // ** A-B*C **
1632 static void cc_env_sub__t0_sub_t1_mul_primlod__mul_prim () //Aded by Gonetz
1634 if (cmb.combine_ext)
1636 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1637 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1638 GR_CMBX_ZERO, 0,
1639 GR_CMBX_B, 0);
1640 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1641 GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
1642 GR_CMBX_ITRGB, 0,
1643 GR_CMBX_ZERO, 0);
1644 cmb.tex |= 3;
1645 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
1646 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
1647 GR_CMBX_ZERO, 1,
1648 GR_CMBX_ZERO, 0);
1649 SETSHADE_PRIM ();
1650 MULSHADE_PRIMLOD ();
1651 CC_ENV ();
1653 else
1655 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1656 GR_COMBINE_FACTOR_TEXTURE_RGB,
1657 GR_COMBINE_LOCAL_CONSTANT,
1658 GR_COMBINE_OTHER_ITERATED);
1659 SETSHADE_PRIM ();
1660 CC_ENV ();
1661 T1_INTER_T0_USING_FACTOR (lod_frac);
1665 static void cc_one_sub__one_sub_t0_mul_enva_add_prim__mul_prim () //Aded by Gonetz
1667 if (cmb.combine_ext)
1669 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
1670 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
1671 GR_CMBX_DETAIL_FACTOR, 0,
1672 GR_CMBX_B, 0);
1673 cmb.tex_ccolor = rdp.prim_color;
1674 cmb.tex |= 1;
1675 percent = (float)(rdp.env_color&0xFF) / 255.0f;
1676 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
1677 CCMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_X,
1678 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
1679 GR_CMBX_CONSTANT_COLOR, 0,
1680 GR_CMBX_ZERO, 1);
1681 CC_PRIM ();
1683 else
1685 cc_one ();
1689 // ** A+B*C **
1690 //Aded by Gonetz
1691 static void cc_t0_add_env_mul_k5 ()
1693 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1694 GR_COMBINE_FACTOR_ONE,
1695 GR_COMBINE_LOCAL_CONSTANT,
1696 GR_COMBINE_OTHER_TEXTURE);
1697 float scale = rdp.K5 / 255.0f;
1698 BYTE r = (BYTE)(rdp.env_color >> 24) & 0xFF;
1699 r = (BYTE)(r*scale);
1700 BYTE g = (BYTE)(rdp.env_color >> 16) & 0xFF;
1701 g = (BYTE)(g*scale);
1702 BYTE b = (BYTE)(rdp.env_color >> 8) & 0xFF;
1703 b = (BYTE)(b*scale);
1704 CC((r<<24)|(g<<16)|(b<<8));
1705 USE_T0 ();
1708 static void cc_t0_add_shade_mul_env ()
1710 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1711 GR_COMBINE_FACTOR_ONE,
1712 GR_COMBINE_LOCAL_ITERATED,
1713 GR_COMBINE_OTHER_TEXTURE);
1714 MULSHADE_ENV ();
1715 USE_T0 ();
1718 static void cc__t1_mul_t0_add_t0__add_prim_mul_shade () //Aded by Gonetz
1720 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1721 GR_COMBINE_FACTOR_ONE,
1722 GR_COMBINE_LOCAL_ITERATED,
1723 GR_COMBINE_OTHER_TEXTURE);
1724 MULSHADE_PRIM ();
1725 rdp.best_tex = 0;
1726 cmb.tex |= 3;
1727 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL;
1728 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
1729 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL;
1732 // ** A*B+C **
1733 //Added by Gonetz
1734 static void cc_t0_mul_prim_add_t1 ()
1736 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
1737 GR_COMBINE_FACTOR_ONE,
1738 GR_COMBINE_LOCAL_NONE,
1739 GR_COMBINE_OTHER_TEXTURE);
1740 if (cmb.combine_ext)
1742 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1743 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1744 GR_CMBX_ZERO, 0,
1745 GR_CMBX_B, 0);
1746 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1747 GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
1748 GR_CMBX_TMU_CCOLOR, 0,
1749 GR_CMBX_B, 0);
1750 cmb.tex |= 3;
1751 cmb.tex_ccolor = rdp.prim_color;
1753 else
1755 MOD_0 (TMOD_TEX_MUL_COL);
1756 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
1757 T0_ADD_T1 ();
1761 static void cc_t1_mul_prim_add_prim ()
1763 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1764 GR_COMBINE_FACTOR_TEXTURE_RGB,
1765 GR_COMBINE_LOCAL_CONSTANT,
1766 GR_COMBINE_OTHER_ITERATED);
1767 SETSHADE_PRIM ();
1768 CC_PRIM ();
1769 USE_T0 ();
1772 //Added by Gonetz
1773 static void cc_t0_mul_prim_add_env ()
1775 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1776 GR_COMBINE_FACTOR_TEXTURE_RGB,
1777 GR_COMBINE_LOCAL_CONSTANT,
1778 GR_COMBINE_OTHER_ITERATED);
1779 SETSHADE_PRIM ();
1780 CC_ENV ();
1781 USE_T0 ();
1784 //Added by Gonetz
1785 static void cc_t1_mul_prim_add_env ()
1787 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1788 GR_COMBINE_FACTOR_TEXTURE_RGB,
1789 GR_COMBINE_LOCAL_CONSTANT,
1790 GR_COMBINE_OTHER_ITERATED);
1791 SETSHADE_PRIM ();
1792 CC_ENV ();
1793 USE_T1 ();
1796 static void cc__t0_add_primlod__mul_prim_add_env ()
1798 if (cmb.combine_ext)
1800 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1801 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
1802 GR_CMBX_ZERO, 1,
1803 GR_CMBX_ZERO, 0);
1804 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1805 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
1806 GR_CMBX_ZERO, 1,
1807 GR_CMBX_ZERO, 0);
1808 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
1809 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
1810 GR_CMBX_ITRGB, 0,
1811 GR_CMBX_B, 0);
1812 CC_PRIMLOD ();
1813 cmb.tex_ccolor = cmb.ccolor;
1814 CC_ENV ();
1815 SETSHADE_PRIM ();
1816 cmb.tex |= 1;
1818 else
1820 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1821 GR_COMBINE_FACTOR_TEXTURE_RGB,
1822 GR_COMBINE_LOCAL_CONSTANT,
1823 GR_COMBINE_OTHER_ITERATED);
1824 CC_PRIMLOD ();
1825 MOD_0 (TMOD_TEX_ADD_COL);
1826 MOD_0_COL (cmb.ccolor & 0xFFFFFF00);
1827 SETSHADE_PRIM ();
1828 CC_ENV ();
1829 USE_T0 ();
1833 //Added by Gonetz
1834 static void cc_t0_mul_prim_mul_shade_add_prim_mul_shade ()
1836 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1837 GR_COMBINE_FACTOR_LOCAL,
1838 GR_COMBINE_LOCAL_ITERATED,
1839 GR_COMBINE_OTHER_TEXTURE);
1840 MULSHADE_PRIM ();
1841 USE_T0 ();
1844 //Added by Gonetz
1845 static void cc__t0_inter_t1_using_primlod__mul_prim_add_env ()
1847 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1848 GR_COMBINE_FACTOR_TEXTURE_RGB,
1849 GR_COMBINE_LOCAL_CONSTANT,
1850 GR_COMBINE_OTHER_ITERATED);
1851 SETSHADE_PRIM ();
1852 CC_ENV ();
1853 T0_INTER_T1_USING_FACTOR (lod_frac);
1856 static void cc__t1_sub_prim_mul_enva_add_t0__mul_prim_add_env ()
1858 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1859 GR_COMBINE_FACTOR_TEXTURE_RGB,
1860 GR_COMBINE_LOCAL_ITERATED,
1861 GR_COMBINE_OTHER_CONSTANT);
1862 CC_PRIM ();
1863 SETSHADE_ENV ();
1864 if (cmb.combine_ext)
1866 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1867 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
1868 GR_CMBX_DETAIL_FACTOR, 0,
1869 GR_CMBX_ZERO, 0);
1870 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
1871 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
1872 GR_CMBX_ZERO, 1,
1873 GR_CMBX_ZERO, 0);
1874 cmb.tex_ccolor = rdp.prim_color;
1875 cmb.tex |= 3;
1876 percent = (float)(rdp.env_color&0xFF) / 255.0f;
1877 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
1879 else
1881 MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC);
1882 MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
1883 MOD_1_FAC (rdp.env_color & 0xFF);
1884 T0_ADD_T1 ();
1888 //Added by Gonetz
1889 static void cc__t0_inter_t1_using_primlod__mul_shade_add_env ()
1891 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1892 GR_COMBINE_FACTOR_TEXTURE_RGB,
1893 GR_COMBINE_LOCAL_CONSTANT,
1894 GR_COMBINE_OTHER_ITERATED);
1895 CC_ENV ();
1896 T0_INTER_T1_USING_FACTOR (lod_frac);
1899 //Added by Gonetz
1900 static void cc__t1_sub_prim_mul_primlod_add_t0__mul_prim_add_env ()
1902 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1903 GR_COMBINE_FACTOR_TEXTURE_RGB,
1904 GR_COMBINE_LOCAL_CONSTANT,
1905 GR_COMBINE_OTHER_ITERATED);
1906 SETSHADE_PRIM ();
1907 CC_ENV ();
1908 T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
1911 //Aded by Gonetz
1912 static void cc__t0_mul_t1__mul_prim_add_env ()
1914 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1915 GR_COMBINE_FACTOR_TEXTURE_RGB,
1916 GR_COMBINE_LOCAL_CONSTANT,
1917 GR_COMBINE_OTHER_ITERATED);
1918 CC_ENV ();
1919 MULSHADE_PRIM ();
1920 T0_MUL_T1 ();
1923 //Aded by Gonetz
1924 static void cc__t0_mul_t1__mul_env_add_shade ()
1926 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1927 GR_COMBINE_FACTOR_TEXTURE_RGB,
1928 GR_COMBINE_LOCAL_ITERATED,
1929 GR_COMBINE_OTHER_CONSTANT);
1930 CC_ENV ();
1931 T0_MUL_T1 ();
1934 static void cc__t0_mul_t1__mul_shade_add_prim ()
1936 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1937 GR_COMBINE_FACTOR_TEXTURE_RGB,
1938 GR_COMBINE_LOCAL_CONSTANT,
1939 GR_COMBINE_OTHER_ITERATED);
1940 CC_PRIM ();
1941 T0_MUL_T1 ();
1944 //Added by Gonetz
1945 static void cc__t0_add_t1__mul_shade_add_env ()
1947 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1948 GR_COMBINE_FACTOR_TEXTURE_RGB,
1949 GR_COMBINE_LOCAL_CONSTANT,
1950 GR_COMBINE_OTHER_ITERATED);
1951 CC_ENV ();
1952 T0_ADD_T1 ();
1955 static void cc__t1_mul_prima_add_t0__mul_shade_add_env ()
1957 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1958 GR_COMBINE_FACTOR_TEXTURE_RGB,
1959 GR_COMBINE_LOCAL_CONSTANT,
1960 GR_COMBINE_OTHER_ITERATED);
1961 CC_ENV ();
1962 T1_MUL_PRIMA_ADD_T0 ();
1965 //Added by Gonetz
1966 static void cc__t0_inter_t1_using_enva__mul_shade_add_env ()
1968 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1969 GR_COMBINE_FACTOR_TEXTURE_RGB,
1970 GR_COMBINE_LOCAL_CONSTANT,
1971 GR_COMBINE_OTHER_ITERATED);
1972 CC_ENV ();
1973 BYTE factor = (BYTE)(rdp.env_color&0xFF);
1974 T0_INTER_T1_USING_FACTOR (factor);
1977 //Added by Gonetz
1978 static void cc_t0_mul_primlod_add_prim ()
1980 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1981 GR_COMBINE_FACTOR_TEXTURE_RGB,
1982 GR_COMBINE_LOCAL_ITERATED,
1983 GR_COMBINE_OTHER_CONSTANT);
1984 SETSHADE_PRIM ();
1985 CC_PRIMLOD ();
1986 USE_T0 ();
1989 //Added by Gonetz
1990 static void cc__t0_inter_t1_using_primlod__mul_shade_add_prim ()
1992 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
1993 GR_COMBINE_FACTOR_TEXTURE_RGB,
1994 GR_COMBINE_LOCAL_CONSTANT,
1995 GR_COMBINE_OTHER_ITERATED);
1996 CC_PRIM ();
1997 T0_INTER_T1_USING_FACTOR (lod_frac);
2000 //Added by Gonetz
2001 static void cc__t1_sub_t0_mul_primlod_add_prim__mul_shade_add_shade ()
2003 if (cmb.combine_ext)
2005 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
2006 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
2007 GR_CMBX_ZERO, 0,
2008 GR_CMBX_B, 0);
2009 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
2010 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
2011 GR_CMBX_DETAIL_FACTOR, 0,
2012 GR_CMBX_ZERO, 0);
2013 cmb.tex |= 3;
2014 percent = (float)lod_frac / 255.0f;
2015 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
2016 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
2017 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
2018 GR_CMBX_ITRGB, 0,
2019 GR_CMBX_ITRGB, 0);
2020 CC_PRIM ();
2022 else
2024 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2025 GR_COMBINE_FACTOR_LOCAL,
2026 GR_COMBINE_LOCAL_ITERATED,
2027 GR_COMBINE_OTHER_TEXTURE);
2028 T0_INTER_T1_USING_FACTOR (lod_frac);
2032 //Added by Gonetz
2033 static void cc__t0_inter_t1_using_half__mul_prim_add_env ()
2035 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2036 GR_COMBINE_FACTOR_TEXTURE_RGB,
2037 GR_COMBINE_LOCAL_CONSTANT,
2038 GR_COMBINE_OTHER_ITERATED);
2039 SETSHADE_PRIM ();
2040 CC_ENV ();
2041 T0_INTER_T1_USING_FACTOR (0x7F);
2044 //Added by Gonetz
2045 static void cc__t0_inter_t1_using_t1__mul_prim_add_shade ()
2047 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2048 GR_COMBINE_FACTOR_TEXTURE_RGB,
2049 GR_COMBINE_LOCAL_ITERATED,
2050 GR_COMBINE_OTHER_CONSTANT);
2051 CC_PRIM ();
2052 T0_INTER_T1_USING_T1 ();
2055 //Added by Gonetz
2056 static void cc_one_sub_t1_mul_t0a_add_t0_mul_env_add_prim ()
2058 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2059 GR_COMBINE_FACTOR_ONE,
2060 GR_COMBINE_LOCAL_CONSTANT,
2061 GR_COMBINE_OTHER_TEXTURE);
2062 CC_PRIM ();
2063 MOD_0 (TMOD_TEX_MUL_COL);
2064 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
2065 rdp.best_tex = 0;
2066 cmb.tex |= 3;
2067 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL;
2068 cmb.tmu1_invert = 1;
2069 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
2070 cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA;
2073 //Added by Gonetz
2074 static void cc__t0_inter_t1_using_t1__mul_shade_add_prim ()
2076 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2077 GR_COMBINE_FACTOR_TEXTURE_RGB,
2078 GR_COMBINE_LOCAL_CONSTANT,
2079 GR_COMBINE_OTHER_ITERATED);
2080 CC_PRIM ();
2081 T0_INTER_T1_USING_T1 ();
2084 //Added by Gonetz
2085 static void cc_t0_mul_prim_add_shade ()
2087 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2088 GR_COMBINE_FACTOR_TEXTURE_RGB,
2089 GR_COMBINE_LOCAL_ITERATED,
2090 GR_COMBINE_OTHER_CONSTANT);
2091 CC_PRIM ();
2092 USE_T0 ();
2095 static void cc_t1_mul_prim_add_shade ()
2097 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2098 GR_COMBINE_FACTOR_TEXTURE_RGB,
2099 GR_COMBINE_LOCAL_ITERATED,
2100 GR_COMBINE_OTHER_CONSTANT);
2101 CC_PRIM ();
2102 USE_T1 ();
2105 //Added by Gonetz
2106 static void cc_t0_mul_env_add_prim ()
2108 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2109 GR_COMBINE_FACTOR_TEXTURE_RGB,
2110 GR_COMBINE_LOCAL_CONSTANT,
2111 GR_COMBINE_OTHER_ITERATED);
2112 SETSHADE_ENV ();
2113 CC_PRIM ();
2114 USE_T0 ();
2117 //Added by Gonetz
2118 static void cc_t1_mul_env_add_prim ()
2120 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2121 GR_COMBINE_FACTOR_TEXTURE_RGB,
2122 GR_COMBINE_LOCAL_CONSTANT,
2123 GR_COMBINE_OTHER_ITERATED);
2124 SETSHADE_ENV ();
2125 CC_PRIM ();
2126 USE_T1 ();
2129 //Added by Gonetz
2130 static void cc__t0_mul_t1__mul_env_add_prim ()
2132 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2133 GR_COMBINE_FACTOR_TEXTURE_RGB,
2134 GR_COMBINE_LOCAL_CONSTANT,
2135 GR_COMBINE_OTHER_ITERATED);
2136 SETSHADE_ENV ();
2137 CC_PRIM ();
2138 T0_MUL_T1 ();
2141 //Added by Gonetz
2142 static void cc__t0_add_t1__mul_env_add_prim ()
2144 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2145 GR_COMBINE_FACTOR_TEXTURE_RGB,
2146 GR_COMBINE_LOCAL_CONSTANT,
2147 GR_COMBINE_OTHER_ITERATED);
2148 SETSHADE_ENV ();
2149 CC_PRIM ();
2150 T0_ADD_T1 ();
2153 //Added by Gonetz
2154 static void cc__t1_sub_t0__mul_env_add_prim ()
2156 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2157 GR_COMBINE_FACTOR_TEXTURE_RGB,
2158 GR_COMBINE_LOCAL_CONSTANT,
2159 GR_COMBINE_OTHER_ITERATED);
2160 SETSHADE_ENV ();
2161 CC_PRIM ();
2162 T1_SUB_T0 ();
2165 //Added by Gonetz
2166 static void cc_t0_mul_env_add_shade ()
2168 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2169 GR_COMBINE_FACTOR_TEXTURE_RGB,
2170 GR_COMBINE_LOCAL_ITERATED,
2171 GR_COMBINE_OTHER_CONSTANT);
2172 CC_ENV ();
2173 USE_T0 ();
2176 static void cc_t0_mul_shade_add_prim ()
2178 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2179 GR_COMBINE_FACTOR_TEXTURE_RGB,
2180 GR_COMBINE_LOCAL_CONSTANT,
2181 GR_COMBINE_OTHER_ITERATED);
2182 CC_PRIM ();
2183 USE_T0 ();
2186 static void cc_t1_mul_shade_add_prim ()
2188 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2189 GR_COMBINE_FACTOR_TEXTURE_RGB,
2190 GR_COMBINE_LOCAL_CONSTANT,
2191 GR_COMBINE_OTHER_ITERATED);
2192 CC_PRIM ();
2193 USE_T1 ();
2196 static void cc_t0_mul_shade_add_env ()
2198 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2199 GR_COMBINE_FACTOR_TEXTURE_RGB,
2200 GR_COMBINE_LOCAL_CONSTANT,
2201 GR_COMBINE_OTHER_ITERATED);
2202 CC_ENV ();
2203 USE_T0 ();
2206 static void cc__t0_add_primlod__mul_shade_add_env ()
2208 if (cmb.combine_ext)
2210 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
2211 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
2212 GR_CMBX_ZERO, 1,
2213 GR_CMBX_ZERO, 0);
2214 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
2215 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
2216 GR_CMBX_ZERO, 1,
2217 GR_CMBX_ZERO, 0);
2218 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
2219 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
2220 GR_CMBX_ITRGB, 0,
2221 GR_CMBX_B, 0);
2222 CC_PRIMLOD ();
2223 cmb.tex_ccolor = cmb.ccolor;
2224 CC_ENV ();
2225 cmb.tex |= 1;
2227 else
2229 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2230 GR_COMBINE_FACTOR_TEXTURE_RGB,
2231 GR_COMBINE_LOCAL_CONSTANT,
2232 GR_COMBINE_OTHER_ITERATED);
2233 DWORD color = (lod_frac<<24) | (lod_frac<<16) | (lod_frac<<8);
2234 MOD_0 (TMOD_TEX_ADD_COL);
2235 MOD_0_COL (color & 0xFFFFFF00);
2236 CC_ENV ();
2237 USE_T0 ();
2241 static void cc__t0_mul_prima_add_prim_mul__shade_add_env ()
2243 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2244 GR_COMBINE_FACTOR_TEXTURE_RGB,
2245 GR_COMBINE_LOCAL_CONSTANT,
2246 GR_COMBINE_OTHER_ITERATED);
2247 CC_ENV ();
2248 if (cmb.combine_ext)
2250 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
2251 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
2252 GR_CMBX_TMU_CALPHA, 0,
2253 GR_CMBX_B, 0);
2254 cmb.tex_ccolor = rdp.prim_color;
2255 cmb.tex |= 1;
2257 else
2259 MOD_0 (TMOD_TEX_SCALE_FAC_ADD_COL);
2260 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
2261 MOD_0_FAC (rdp.prim_color & 0xFF);
2262 USE_T0 ();
2266 //Added by Gonetz
2267 static void cc_t0_mul_shadea_add_shade ()
2269 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2270 GR_COMBINE_FACTOR_LOCAL_ALPHA,
2271 GR_COMBINE_LOCAL_ITERATED,
2272 GR_COMBINE_OTHER_TEXTURE);
2273 USE_T0 ();
2276 static void cc_prim_mul_prima_add_prim () //Added by Gonetz
2278 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2279 GR_COMBINE_FACTOR_LOCAL_ALPHA,
2280 GR_COMBINE_LOCAL_CONSTANT,
2281 GR_COMBINE_OTHER_ITERATED);
2282 CC_PRIM ();
2283 CA_PRIM ();
2284 SETSHADE_PRIM ();
2287 static void cc_prim_mul_prima_add_t0 () //Added by Gonetz
2289 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2290 GR_COMBINE_FACTOR_ONE,
2291 GR_COMBINE_LOCAL_ITERATED,
2292 GR_COMBINE_OTHER_TEXTURE);
2293 SETSHADE_PRIM ();
2294 SETSHADE_PRIMA ();
2295 USE_T0 ();
2298 static void cc_prim_mul_env_add_t0 () //Added by Gonetz
2300 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2301 GR_COMBINE_FACTOR_ONE,
2302 GR_COMBINE_LOCAL_ITERATED,
2303 GR_COMBINE_OTHER_TEXTURE);
2304 SETSHADE_PRIM ();
2305 SETSHADE_ENV ();
2306 USE_T0 ();
2309 static void cc_prim_mul_shade_add_env ()
2311 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2312 GR_COMBINE_FACTOR_ONE,
2313 GR_COMBINE_LOCAL_CONSTANT,
2314 GR_COMBINE_OTHER_ITERATED);
2315 CC_ENV ();
2316 MULSHADE_PRIM ();
2319 static void cc_env_mul_shade_add_env () //Added by Gonetz
2321 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2322 GR_COMBINE_FACTOR_ONE,
2323 GR_COMBINE_LOCAL_CONSTANT,
2324 GR_COMBINE_OTHER_ITERATED);
2325 CC_ENV ();
2326 MULSHADE_ENV ();
2329 // ** A*B+C*D **
2330 static void cc_t0_mul_prim_add_one_sub_prim_mul_shade () //Added by Gonetz
2332 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2333 GR_COMBINE_FACTOR_TEXTURE_RGB,
2334 GR_COMBINE_LOCAL_ITERATED,
2335 GR_COMBINE_OTHER_CONSTANT);
2336 CC_PRIM ();
2337 MULSHADE_1MPRIM ();
2338 USE_T0 ();
2341 static void cc_t0_mul_prim_add_shade_sub_env_mul_prim () //Added by Gonetz
2343 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2344 GR_COMBINE_FACTOR_TEXTURE_RGB,
2345 GR_COMBINE_LOCAL_ITERATED,
2346 GR_COMBINE_OTHER_CONSTANT);
2347 CC_PRIM ();
2348 SUBSHADE_ENV ()
2349 MULSHADE_PRIM ();
2350 USE_T0 ();
2353 static void cc_t0_mul_prim_add_shade_mul_shadea_mul_prim ()
2355 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2356 GR_COMBINE_FACTOR_TEXTURE_RGB,
2357 GR_COMBINE_LOCAL_ITERATED,
2358 GR_COMBINE_OTHER_CONSTANT);
2359 CC_PRIM ();
2360 MULSHADE_PRIM ();
2361 MULSHADE_SHADEA ();
2362 USE_T0 ();
2365 static void cc_t0_mul_env_add_prim_mul_shade () //Added by Gonetz
2367 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2368 GR_COMBINE_FACTOR_TEXTURE_RGB,
2369 GR_COMBINE_LOCAL_ITERATED,
2370 GR_COMBINE_OTHER_CONSTANT);
2371 MULSHADE_PRIM ();
2372 CC_ENV ();
2373 USE_T0 ();
2376 static void cc_t0_mul_enva_add_prim_mul_shade () //Added by Gonetz
2378 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2379 GR_COMBINE_FACTOR_TEXTURE_RGB,
2380 GR_COMBINE_LOCAL_ITERATED,
2381 GR_COMBINE_OTHER_CONSTANT);
2382 MULSHADE_PRIM ();
2383 CC_ENVA ();
2384 USE_T0 ();
2387 static void cc_t0_mul_shade_add_prim_mul_env () //Added by Gonetz
2389 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2390 GR_COMBINE_FACTOR_TEXTURE_RGB,
2391 GR_COMBINE_LOCAL_CONSTANT,
2392 GR_COMBINE_OTHER_ITERATED);
2393 CC_PRIMMULENV ();
2394 USE_T0 ();
2397 static void cc_prim_mul_env_add_one_sub_prim_mul_shade () //Added by Gonetz
2399 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2400 GR_COMBINE_FACTOR_ONE,
2401 GR_COMBINE_LOCAL_ITERATED,
2402 GR_COMBINE_OTHER_CONSTANT);
2403 MULSHADE_1MPRIM ();
2404 CC_PRIMMULENV ();
2407 // ** A*B*C **
2409 static void cc_t0_mul_prim_mul_prim () //Added by Gonetz
2411 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2412 GR_COMBINE_FACTOR_LOCAL,
2413 GR_COMBINE_LOCAL_ITERATED,
2414 GR_COMBINE_OTHER_TEXTURE);
2415 SETSHADE_PRIM ();
2416 SETSHADE_PRIM ();
2417 USE_T0 ();
2420 static void cc_t0_mul_prim_mul_prima () //Added by Gonetz
2422 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2423 GR_COMBINE_FACTOR_LOCAL,
2424 GR_COMBINE_LOCAL_ITERATED,
2425 GR_COMBINE_OTHER_TEXTURE);
2426 SETSHADE_PRIM ();
2427 SETSHADE_PRIMA ();
2428 USE_T0 ();
2431 static void cc_t0_mul_enva_mul_shade ()
2433 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2434 GR_COMBINE_FACTOR_LOCAL,
2435 GR_COMBINE_LOCAL_ITERATED,
2436 GR_COMBINE_OTHER_TEXTURE);
2437 MULSHADE_ENVA ();
2438 USE_T0 ();
2441 static void cc_t0_mul_primlod_mul_prim () //Added by Gonetz
2443 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2444 GR_COMBINE_FACTOR_LOCAL,
2445 GR_COMBINE_LOCAL_CONSTANT,
2446 GR_COMBINE_OTHER_TEXTURE);
2447 cmb.ccolor = (rdp.prim_color*lod_frac)&0xFFFFFF00;
2448 USE_T0 ();
2451 static void cc_t0_mul_primlod_mul_shade () //Added by Gonetz
2453 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2454 GR_COMBINE_FACTOR_LOCAL,
2455 GR_COMBINE_LOCAL_ITERATED,
2456 GR_COMBINE_OTHER_TEXTURE);
2457 MULSHADE_PRIMLOD ();
2458 USE_T0 ();
2461 static void cc__t0_mul_t1__mul_prim ()
2463 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2464 GR_COMBINE_FACTOR_LOCAL,
2465 GR_COMBINE_LOCAL_CONSTANT,
2466 GR_COMBINE_OTHER_TEXTURE);
2467 CC_PRIM ();
2468 T0_MUL_T1 ();
2471 static void cc__t1_mul_t1_add_t0__mul_prim ()
2473 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2474 GR_COMBINE_FACTOR_LOCAL,
2475 GR_COMBINE_LOCAL_CONSTANT,
2476 GR_COMBINE_OTHER_TEXTURE);
2477 CC_PRIM ();
2478 if (cmb.combine_ext)
2480 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
2481 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
2482 GR_CMBX_ZERO, 0,
2483 GR_CMBX_B, 0);
2484 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
2485 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
2486 GR_CMBX_OTHER_TEXTURE_RGB, 0,
2487 GR_CMBX_B, 0);
2488 cmb.tex |= 3;
2490 else
2492 T0_ADD_T1 ();
2496 static void cc__t0_mul_t1__mul_prima () //Added by Gonetz
2498 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2499 GR_COMBINE_FACTOR_LOCAL,
2500 GR_COMBINE_LOCAL_CONSTANT,
2501 GR_COMBINE_OTHER_TEXTURE);
2502 CC_PRIMA ();
2503 T0_MUL_T1 ();
2506 static void cc__t0_mul_t1__mul_env () //Added by Gonetz
2508 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2509 GR_COMBINE_FACTOR_LOCAL,
2510 GR_COMBINE_LOCAL_CONSTANT,
2511 GR_COMBINE_OTHER_TEXTURE);
2512 CC_ENV ();
2513 T0_MUL_T1 ();
2516 static void cc__t0_mul_t1__mul_enva () //Added by Gonetz
2518 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2519 GR_COMBINE_FACTOR_LOCAL,
2520 GR_COMBINE_LOCAL_CONSTANT,
2521 GR_COMBINE_OTHER_TEXTURE);
2522 CC_ENVA ();
2523 T0_MUL_T1 ();
2526 static void cc__t0_mul_t1__mul_shade ()
2528 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2529 GR_COMBINE_FACTOR_LOCAL,
2530 GR_COMBINE_LOCAL_ITERATED,
2531 GR_COMBINE_OTHER_TEXTURE);
2532 T0_MUL_T1 ();
2535 static void cc__t0a_mul_t1__mul_prim () //Added by Gonetz
2537 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2538 GR_COMBINE_FACTOR_LOCAL,
2539 GR_COMBINE_LOCAL_CONSTANT,
2540 GR_COMBINE_OTHER_TEXTURE);
2541 CC_PRIM ();
2542 T0A_MUL_T1 ();
2545 static void cc__t0_mul_t1a__mul_shade () //Added by Gonetz
2547 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2548 GR_COMBINE_FACTOR_LOCAL,
2549 GR_COMBINE_LOCAL_ITERATED,
2550 GR_COMBINE_OTHER_TEXTURE);
2551 T0_MUL_T1A ();
2554 static void cc__t0a_mul_t1__mul_shade () //Added by Gonetz
2556 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2557 GR_COMBINE_FACTOR_LOCAL,
2558 GR_COMBINE_LOCAL_ITERATED,
2559 GR_COMBINE_OTHER_TEXTURE);
2560 T0A_MUL_T1 ();
2563 static void cc_t0_mul_prim_mul_env ()
2565 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2566 GR_COMBINE_FACTOR_LOCAL,
2567 GR_COMBINE_LOCAL_ITERATED,
2568 GR_COMBINE_OTHER_TEXTURE);
2569 SETSHADE_PRIM ();
2570 SETSHADE_ENV (); // notice that setshade multiplies
2571 USE_T0 ();
2574 static void cc_t0_mul_prim_mul_shade ()
2576 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2577 GR_COMBINE_FACTOR_LOCAL,
2578 GR_COMBINE_LOCAL_ITERATED,
2579 GR_COMBINE_OTHER_TEXTURE);
2580 MULSHADE_PRIM ();
2581 USE_T0 ();
2584 static void cc_t0_mul_prim_mul_shadea ()
2586 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2587 GR_COMBINE_FACTOR_LOCAL,
2588 GR_COMBINE_LOCAL_ITERATED,
2589 GR_COMBINE_OTHER_TEXTURE);
2590 SETSHADE_PRIM ();
2591 MULSHADE_SHADEA();
2592 USE_T0 ();
2595 static void cc_t0_mul_prima_mul_shade ()
2597 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2598 GR_COMBINE_FACTOR_LOCAL,
2599 GR_COMBINE_LOCAL_ITERATED,
2600 GR_COMBINE_OTHER_TEXTURE);
2601 MULSHADE_PRIMA ();
2602 USE_T0 ();
2605 static void cc_t0_mul_one_sub_prim_mul_shade ()
2607 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2608 GR_COMBINE_FACTOR_LOCAL,
2609 GR_COMBINE_LOCAL_ITERATED,
2610 GR_COMBINE_OTHER_TEXTURE);
2611 MULSHADE_1MPRIM ();
2612 USE_T0 ();
2615 static void cc_t0_mul_one_sub_env_mul_shade ()
2617 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2618 GR_COMBINE_FACTOR_LOCAL,
2619 GR_COMBINE_LOCAL_ITERATED,
2620 GR_COMBINE_OTHER_TEXTURE);
2621 MULSHADE_1MENV ();
2622 USE_T0 ();
2625 static void cc_t1_mul_prim_mul_shade ()
2627 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2628 GR_COMBINE_FACTOR_LOCAL,
2629 GR_COMBINE_LOCAL_ITERATED,
2630 GR_COMBINE_OTHER_TEXTURE);
2631 MULSHADE_PRIM ();
2632 USE_T1 ();
2635 //Added by Gonetz
2636 static void cc_t0_mul_1mprim_mul_shade ()
2638 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2639 GR_COMBINE_FACTOR_LOCAL,
2640 GR_COMBINE_LOCAL_ITERATED,
2641 GR_COMBINE_OTHER_TEXTURE);
2642 MULSHADE_1MPRIM ();
2643 USE_T0 ();
2646 static void cc_t0_mul_env_mul_shade ()
2648 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2649 GR_COMBINE_FACTOR_LOCAL,
2650 GR_COMBINE_LOCAL_ITERATED,
2651 GR_COMBINE_OTHER_TEXTURE);
2652 MULSHADE_ENV ();
2653 USE_T0 ();
2656 static void cc_t0_mul_shade_mul_shadea ()
2658 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2659 GR_COMBINE_FACTOR_LOCAL,
2660 GR_COMBINE_LOCAL_ITERATED,
2661 GR_COMBINE_OTHER_TEXTURE);
2662 MULSHADE_SHADEA ();
2663 USE_T0 ();
2666 static void cc_prim_mul_env_mul_shade ()
2668 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2669 GR_COMBINE_FACTOR_LOCAL,
2670 GR_COMBINE_LOCAL_CONSTANT,
2671 GR_COMBINE_OTHER_ITERATED);
2672 CC_ENV ();
2673 MULSHADE_PRIM ();
2676 static void cc_prim_mul_one_sub_env_mul_shade ()
2678 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2679 GR_COMBINE_FACTOR_LOCAL,
2680 GR_COMBINE_LOCAL_CONSTANT,
2681 GR_COMBINE_OTHER_ITERATED);
2682 CC_1SUBENV ();
2683 MULSHADE_PRIM ();
2686 // ** A*B*C+D **
2687 static void cc_t0_mul_prim_mul_shade_add_env ()
2689 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2690 GR_COMBINE_FACTOR_TEXTURE_RGB,
2691 GR_COMBINE_LOCAL_CONSTANT,
2692 GR_COMBINE_OTHER_ITERATED);
2693 CC_ENV ();
2694 MULSHADE_PRIM ();
2695 USE_T0 ();
2698 //Added by Gonetz
2699 static void cc_t0_mul_prim_mul_shadea_add_env ()
2701 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2702 GR_COMBINE_FACTOR_LOCAL_ALPHA,
2703 GR_COMBINE_LOCAL_ITERATED,
2704 GR_COMBINE_OTHER_TEXTURE);
2705 CC_ENV ();
2706 SETSHADE_ENV ();
2707 MULSHADE_A_PRIM ();
2708 USE_T0 ();
2711 // (A*B+C)*D
2712 static void cc__t0a_mul_prim_add_t0__mul_shade ()
2714 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2715 GR_COMBINE_FACTOR_LOCAL,
2716 GR_COMBINE_LOCAL_ITERATED,
2717 GR_COMBINE_OTHER_TEXTURE);
2718 MOD_0 (TMOD_COL_MUL_TEXA_ADD_TEX);
2719 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
2720 USE_T0 ();
2723 static void cc__t0a_mul_env_add_t0__mul_shade ()
2725 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2726 GR_COMBINE_FACTOR_LOCAL,
2727 GR_COMBINE_LOCAL_ITERATED,
2728 GR_COMBINE_OTHER_TEXTURE);
2729 MOD_0 (TMOD_COL_MUL_TEXA_ADD_TEX);
2730 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
2731 USE_T0 ();
2734 // ** A*B*C+D*E **
2735 //Added by Gonetz
2736 static void cc_t0_mul_prim_mul_shade_add_prim_mul_env ()
2738 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2739 GR_COMBINE_FACTOR_TEXTURE_RGB,
2740 GR_COMBINE_LOCAL_CONSTANT,
2741 GR_COMBINE_OTHER_ITERATED);
2742 CC_PRIMMULENV ();
2743 MULSHADE_PRIM ();
2744 USE_T0 ();
2747 //Added by Gonetz
2748 static void cc_t0_mul_one_sub_prim_mul_shade_add_prim_mul_env ()
2750 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2751 GR_COMBINE_FACTOR_TEXTURE_RGB,
2752 GR_COMBINE_LOCAL_CONSTANT,
2753 GR_COMBINE_OTHER_ITERATED);
2754 CC_PRIMMULENV ();
2755 MULSHADE_1MPRIM ();
2756 USE_T0 ();
2759 //Added by Gonetz
2760 static void cc_t0_mul_one_sub_prim_mul_shadea_add_prim_mul_env ()
2762 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2763 GR_COMBINE_FACTOR_TEXTURE_RGB,
2764 GR_COMBINE_LOCAL_CONSTANT,
2765 GR_COMBINE_OTHER_ITERATED);
2766 CC_PRIMMULENV ();
2767 SETSHADE_1MPRIM ();
2768 MULSHADE_SHADEA ();
2769 USE_T0 ();
2772 //Added by Gonetz
2773 static void cc_t0_mul_one_sub_env_mul_shade_add_env ()
2775 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2776 GR_COMBINE_FACTOR_TEXTURE_RGB,
2777 GR_COMBINE_LOCAL_CONSTANT,
2778 GR_COMBINE_OTHER_ITERATED);
2779 CC_ENV ();
2780 MULSHADE_1MENV ();
2781 USE_T0 ();
2784 static void cc_t0_mul_prima_mul_shade_add_prim_mul_one_sub_prima () //Aded by Gonetz
2786 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2787 GR_COMBINE_FACTOR_TEXTURE_RGB,
2788 GR_COMBINE_LOCAL_CONSTANT,
2789 GR_COMBINE_OTHER_ITERATED);
2790 MULSHADE_PRIMA ();
2791 USE_T0 ();
2792 BYTE fac = 255 - (BYTE)(rdp.prim_color&0xFF);
2793 float col[3];
2794 col[0] = (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f;
2795 col[1] = (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f;
2796 col[2] = (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f;
2797 CC ( ((BYTE)(col[0]*fac))<<24 | ((BYTE)(col[1]*fac))<<16 | ((BYTE)(col[2]*fac))<<8 | fac );
2800 // ** A*(1-B)+C **
2801 static void cc_t0_mul_1menv_add_prim ()
2803 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
2804 GR_COMBINE_FACTOR_TEXTURE_RGB,
2805 GR_COMBINE_LOCAL_CONSTANT,
2806 GR_COMBINE_OTHER_ITERATED);
2807 CC_PRIM ();
2808 SETSHADE_1MENV ();
2809 USE_T0 ();
2812 // ** (A+B)*C **
2813 static void cc_t0_add_prim_mul_shade () //Aded by Gonetz
2815 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2816 GR_COMBINE_FACTOR_LOCAL,
2817 GR_COMBINE_LOCAL_ITERATED,
2818 GR_COMBINE_OTHER_TEXTURE);
2819 MOD_0 (TMOD_TEX_ADD_COL);
2820 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
2821 USE_T0 ();
2824 static void cc_t0_mul__prim_add_env () //Aded by Gonetz
2826 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2827 GR_COMBINE_FACTOR_LOCAL,
2828 GR_COMBINE_LOCAL_ITERATED,
2829 GR_COMBINE_OTHER_TEXTURE);
2830 SETSHADE_PRIM ();
2831 ADDSHADE_ENV ();
2832 USE_T0 ();
2835 static void cc_t1_mul__prim_add_env () //Aded by Gonetz
2837 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2838 GR_COMBINE_FACTOR_LOCAL,
2839 GR_COMBINE_LOCAL_ITERATED,
2840 GR_COMBINE_OTHER_TEXTURE);
2841 SETSHADE_PRIM ();
2842 ADDSHADE_ENV ();
2843 USE_T1 ();
2846 // ** (A-B)*C **
2847 static void cc__t0_mul_prim_add_shade__sub_env_mul_shade ()
2849 if (cmb.combine_ext)
2851 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
2852 GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
2853 GR_CMBX_TMU_CCOLOR, 0,
2854 GR_CMBX_B, 0);
2855 cmb.tex_ccolor = rdp.prim_color;
2856 cmb.tex |= 1;
2857 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
2858 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
2859 GR_CMBX_ITRGB, 0,
2860 GR_CMBX_ZERO, 0);
2861 CC_ENV ();
2863 else
2865 cc_t0_mul_prim_mul_shade ();
2869 static void cc__t0_sub_env_mul_shade__sub_prim_mul_shade ()
2871 if (cmb.combine_ext)
2873 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
2874 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
2875 GR_CMBX_ITRGB, 0,
2876 GR_CMBX_ZERO, 0);
2877 cmb.tex_ccolor = rdp.env_color;
2878 cmb.tex |= 1;
2879 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
2880 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
2881 GR_CMBX_ITRGB, 0,
2882 GR_CMBX_ITRGB, 0);
2883 CC_PRIM ();
2885 else
2887 cc_t0_mul_shade ();
2891 static void cc_t0_sub_env_mul_shade ()
2893 if (cmb.combine_ext)
2895 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
2896 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
2897 GR_CMBX_ITRGB, 0,
2898 GR_CMBX_ZERO, 0);
2899 CC_ENV ();
2901 else
2903 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2904 GR_COMBINE_FACTOR_LOCAL,
2905 GR_COMBINE_LOCAL_ITERATED,
2906 GR_COMBINE_OTHER_TEXTURE);
2907 if (rdp.env_color & 0xFFFFFF00)
2909 MOD_0 (TMOD_TEX_SUB_COL);
2910 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
2913 USE_T0 ();
2916 static void cc_one_sub_t0_mul_prim () //Added by Gonetz
2918 CCMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
2919 GR_COMBINE_FACTOR_TEXTURE_RGB,
2920 GR_COMBINE_LOCAL_CONSTANT,
2921 GR_COMBINE_OTHER_NONE);
2922 CC_PRIM ();
2923 USE_T0 ();
2926 static void cc_shade_sub_prim_mul_t0 () //Aded by Gonetz
2928 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
2929 GR_COMBINE_FACTOR_TEXTURE_RGB,
2930 GR_COMBINE_LOCAL_CONSTANT,
2931 GR_COMBINE_OTHER_ITERATED);
2932 CC_PRIM ();
2933 USE_T0 ();
2936 static void cc_shade_sub_prim_mul_env () //Aded by Gonetz
2938 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2939 GR_COMBINE_FACTOR_LOCAL,
2940 GR_COMBINE_LOCAL_CONSTANT,
2941 GR_COMBINE_OTHER_ITERATED);
2942 CC_ENV ();
2943 SUBSHADE_PRIM ();
2946 static void cc_shade_sub_env_mul_t0 () //Aded by Gonetz
2948 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
2949 GR_COMBINE_FACTOR_TEXTURE_RGB,
2950 GR_COMBINE_LOCAL_CONSTANT,
2951 GR_COMBINE_OTHER_ITERATED);
2952 CC_ENV ();
2953 USE_T0 ();
2956 static void cc_shade_sub_prim_mul__t0_inter_t1_using_primlod () //Aded by Gonetz
2958 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
2959 GR_COMBINE_FACTOR_TEXTURE_RGB,
2960 GR_COMBINE_LOCAL_CONSTANT,
2961 GR_COMBINE_OTHER_ITERATED);
2962 CC_PRIM ();
2963 T0_INTER_T1_USING_FACTOR (lod_frac);
2966 static void cc_shade_sub_env_mul__t0_inter_t1_using_primlod () //Aded by Gonetz
2968 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
2969 GR_COMBINE_FACTOR_TEXTURE_RGB,
2970 GR_COMBINE_LOCAL_CONSTANT,
2971 GR_COMBINE_OTHER_ITERATED);
2972 CC_ENV ();
2973 T0_INTER_T1_USING_FACTOR (lod_frac);
2976 static void cc_one_sub__t0_mul_t1__mul_shade () //Aded by Gonetz
2978 CCMB (GR_COMBINE_FUNCTION_BLEND,
2979 GR_COMBINE_FACTOR_TEXTURE_RGB,
2980 GR_COMBINE_LOCAL_ITERATED,
2981 GR_COMBINE_OTHER_CONSTANT);
2982 CC (0);
2983 T0_MUL_T1 ();
2986 static void cc_one_sub_env_mul_t0 () //Aded by Gonetz
2988 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2989 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
2990 GR_COMBINE_LOCAL_CONSTANT,
2991 GR_COMBINE_OTHER_TEXTURE);
2992 CC_ENV ();
2993 USE_T0 ();
2996 static void cc_one_sub_env_mul__t0_inter_t1_using_primlod () //Aded by Gonetz
2998 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
2999 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3000 GR_COMBINE_LOCAL_CONSTANT,
3001 GR_COMBINE_OTHER_TEXTURE);
3002 CC_ENV ();
3003 T0_INTER_T1_USING_FACTOR (lod_frac);
3006 static void cc_one_sub_env_mul_shade () //Aded by Gonetz
3008 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3009 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3010 GR_COMBINE_LOCAL_CONSTANT,
3011 GR_COMBINE_OTHER_ITERATED);
3012 CC_ENV ();
3015 // ** (1-A)*B + A*C **
3016 static void cc_t0_mul_env_add_1mt0_mul_shade ()
3018 CCMB (GR_COMBINE_FUNCTION_BLEND,
3019 GR_COMBINE_FACTOR_TEXTURE_RGB,
3020 GR_COMBINE_LOCAL_ITERATED,
3021 GR_COMBINE_OTHER_CONSTANT);
3022 CC_ENV ();
3023 USE_T0 ();
3026 // ** (1-A)*B+C **
3027 static void cc_one_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade () //Added by Gonetz
3029 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3030 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3031 GR_COMBINE_LOCAL_ITERATED,
3032 GR_COMBINE_OTHER_TEXTURE);
3033 T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
3036 // ** (1-A)*B*C **
3037 static void cc_one_sub_t0_mul_prim_mul_shade () //Added by Gonetz
3039 CCMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
3040 GR_COMBINE_FACTOR_TEXTURE_RGB,
3041 GR_COMBINE_LOCAL_ITERATED,
3042 GR_COMBINE_OTHER_NONE);
3043 MULSHADE_PRIM ();
3044 USE_T0 ();
3047 // ** (A-B)*C*D **
3048 static void cc_prim_sub_env_mul_t0_mul_shade ()
3050 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3051 GR_COMBINE_FACTOR_TEXTURE_RGB,
3052 GR_COMBINE_LOCAL_NONE,
3053 GR_COMBINE_OTHER_ITERATED);
3054 MULSHADE_PRIMSUBENV ();
3055 USE_T0 ();
3058 // ** (A-B)*C+D **
3059 static void cc_t0_sub_t1_mul_prim_mul_shade_add_t1 () //Aded by Gonetz
3061 if (cmb.combine_ext)
3063 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3064 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3065 GR_CMBX_ZERO, 0,
3066 GR_CMBX_B, 0);
3067 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3068 GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
3069 GR_CMBX_ITRGB, 0,
3070 GR_CMBX_B, 0);
3071 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3072 GR_COMBINE_FACTOR_ONE,
3073 GR_COMBINE_LOCAL_NONE,
3074 GR_COMBINE_OTHER_TEXTURE);
3075 MULSHADE_PRIM ();
3076 cmb.tex |= 3;
3078 else
3080 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3081 GR_COMBINE_FACTOR_LOCAL,
3082 GR_COMBINE_LOCAL_CONSTANT,
3083 GR_COMBINE_OTHER_TEXTURE);
3084 CC_PRIM ();
3085 T0_ADD_T1 ();
3089 static void cc_t0_sub_prim_mul_t0a_add_prim () //Aded by Gonetz
3091 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3092 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
3093 GR_COMBINE_LOCAL_CONSTANT,
3094 GR_COMBINE_OTHER_TEXTURE);
3095 CC_PRIM ();
3096 USE_T0 ();
3099 static void cc_t0_sub_prim_mul_prima_add_prim () //Aded by Gonetz
3101 // * not guaranteed to work if another iterated alpha is set
3102 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3103 GR_COMBINE_FACTOR_TEXTURE_RGB,
3104 GR_COMBINE_LOCAL_ITERATED,
3105 GR_COMBINE_OTHER_CONSTANT);
3106 SETSHADE_PRIM ();
3107 SETSHADE_1MPRIMA ();
3108 CC_PRIMA ();
3109 USE_T0 ();
3112 static void cc_t0_sub_prim_mul_shadea_add_prim () //Aded by Gonetz
3114 // * not guaranteed to work if another iterated alpha is set
3115 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3116 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3117 GR_COMBINE_LOCAL_ITERATED,
3118 GR_COMBINE_OTHER_TEXTURE);
3119 SETSHADE_PRIM ();
3120 USE_T0 ();
3123 static void cc_t0_sub_prim_mul_env_add_shade () //Aded by Gonetz
3125 if (cmb.combine_ext)
3127 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3128 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
3129 GR_CMBX_ZERO, 1,
3130 GR_CMBX_ZERO, 0);
3131 cmb.tex |= 1;
3132 cmb.tex_ccolor = rdp.prim_color;
3133 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
3134 GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
3135 GR_CMBX_CONSTANT_COLOR, 0,
3136 GR_CMBX_B, 0);
3137 CC_ENV ();
3139 else
3141 cc_t0_mul_env_add_shade ();
3145 static void cc__t0_inter_t1_using_shadea__sub_prim_mul_env_add_shade () //Aded by Gonetz
3147 if (cmb.combine_ext)
3149 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
3150 GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
3151 GR_CMBX_CONSTANT_COLOR, 0,
3152 GR_CMBX_B, 0);
3153 //have to pass shade alpha to combiner
3154 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
3155 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
3156 GR_CMBX_ZERO, 0,
3157 GR_CMBX_ZERO, 0);
3159 else
3161 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3162 GR_COMBINE_FACTOR_TEXTURE_RGB,
3163 GR_COMBINE_LOCAL_ITERATED,
3164 GR_COMBINE_OTHER_CONSTANT);
3166 CC_ENV ();
3167 SUBSHADE_PRIMMULENV ();
3168 T0_INTER_T1_USING_SHADEA ();
3172 static void cc_t0_sub_prim_mul_env_add_prim () //Aded by Gonetz
3174 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3175 GR_COMBINE_FACTOR_TEXTURE_RGB,
3176 GR_COMBINE_LOCAL_ITERATED,
3177 GR_COMBINE_OTHER_CONSTANT);
3178 CC_ENV ();
3179 SETSHADE_PRIM ();
3180 SETSHADE_1MENV ();
3181 USE_T0 ();
3184 static void cc_t0_sub_prim_mul_enva_add_prim () //Aded by Gonetz
3186 // * not guaranteed to work if another iterated alpha is set
3187 CCMB (GR_COMBINE_FUNCTION_BLEND,
3188 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3189 GR_COMBINE_LOCAL_CONSTANT,
3190 GR_COMBINE_OTHER_TEXTURE);
3191 CC_PRIM ();
3192 CA_ENV ();
3193 USE_T0 ();
3196 static void cc_t0_sub_prim_mul_primlod_add_env () //Aded by Gonetz
3198 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3199 GR_COMBINE_FACTOR_ONE,
3200 GR_COMBINE_LOCAL_CONSTANT,
3201 GR_COMBINE_OTHER_TEXTURE);
3202 CC_ENV ();
3203 MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
3204 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
3205 MOD_0_FAC (lod_frac & 0xFF);
3206 USE_T0 ();
3209 static void cc_t0_sub__prim_mul_env () //Aded by Gonetz
3211 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
3212 GR_COMBINE_FACTOR_ONE,
3213 GR_COMBINE_LOCAL_ITERATED,
3214 GR_COMBINE_OTHER_TEXTURE);
3215 SETSHADE_PRIM ();
3216 SETSHADE_ENV ();
3217 USE_T0 ();
3220 static void cc__t0_mul_t1__sub_prim_mul__t0t1a__add_prim () //Aded by Gonetz
3222 // * not guaranteed to work if another iterated alpha is set
3223 CCMB (GR_COMBINE_FUNCTION_BLEND,
3224 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
3225 GR_COMBINE_LOCAL_CONSTANT,
3226 GR_COMBINE_OTHER_TEXTURE);
3227 CC_PRIM ();
3228 T0_MUL_T1 ();
3229 A_T0_MUL_T1 ();
3232 static void cc__t1_inter_t0_using_enva__sub_prim_mul_prima_add_prim () //Aded by Gonetz
3234 // * not guaranteed to work if another iterated alpha is set
3235 CCMB (GR_COMBINE_FUNCTION_BLEND,
3236 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3237 GR_COMBINE_LOCAL_CONSTANT,
3238 GR_COMBINE_OTHER_TEXTURE);
3239 CC_PRIM ();
3240 CA_PRIM ();
3241 BYTE factor = (BYTE)(rdp.env_color&0xFF);
3242 T1_INTER_T0_USING_FACTOR (factor);
3245 static void cc__t0_mul_shade__sub_env_mul_shadea_add_env () //Aded by Gonetz
3247 if (rdp.tiles[rdp.cur_tile].format == 4)
3249 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3250 GR_COMBINE_FACTOR_OTHER_ALPHA,
3251 GR_COMBINE_LOCAL_CONSTANT,
3252 GR_COMBINE_OTHER_ITERATED);
3253 CC_ENV ();
3255 else if (rdp.tiles[rdp.cur_tile].format == 2)
3257 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3258 GR_COMBINE_FACTOR_LOCAL,
3259 GR_COMBINE_LOCAL_ITERATED,
3260 GR_COMBINE_OTHER_TEXTURE);
3261 USE_T0 ();
3263 else
3265 cc_t0 ();
3269 static void cc_t0_sub_env_mul_k5_add_prim () //Aded by Gonetz
3271 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3272 GR_COMBINE_FACTOR_ONE,
3273 GR_COMBINE_LOCAL_CONSTANT,
3274 GR_COMBINE_OTHER_TEXTURE);
3275 CC_PRIM ();
3276 MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
3277 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
3278 MOD_0_FAC (rdp.K5);
3279 USE_T0 ();
3282 static void cc__t0_inter_t1_using_t0__sub_shade_mul_prima_add_shade () //Aded by Gonetz
3284 if (cmb.combine_ext)
3286 cmb.tex |= 3;
3287 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
3288 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
3289 GR_CMBX_CONSTANT_COLOR, 0,
3290 GR_CMBX_B, 0);
3291 CC_PRIMA();
3293 else
3295 // * not guaranteed to work if another iterated alpha is set
3296 CCMB (GR_COMBINE_FUNCTION_BLEND,
3297 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3298 GR_COMBINE_LOCAL_ITERATED,
3299 GR_COMBINE_OTHER_TEXTURE);
3300 SETSHADE_A_PRIM ();
3302 // T0_INTER_T1_USING_T0 ();
3303 T1_INTER_T0_USING_T0 (); //strange, but this one looks better
3306 static void cc_t0_sub__prim_mul_shade__mul_enva_add__prim_mul_shade () //Aded by Gonetz
3308 // * not guaranteed to work if another iterated alpha is set
3309 CCMB (GR_COMBINE_FUNCTION_BLEND,
3310 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3311 GR_COMBINE_LOCAL_ITERATED,
3312 GR_COMBINE_OTHER_TEXTURE);
3313 MULSHADE_PRIM ();
3314 SETSHADE_A_ENV ();
3315 USE_T0 ();
3318 static void cc_t0_sub_env_mul_t0_add_env () //Aded by Gonetz
3320 CCMB (GR_COMBINE_FUNCTION_BLEND,
3321 GR_COMBINE_FACTOR_TEXTURE_RGB,
3322 GR_COMBINE_LOCAL_CONSTANT,
3323 GR_COMBINE_OTHER_TEXTURE);
3324 CC_ENV ();
3325 USE_T0 ();
3326 //(t0-env)*t0+env = t0*t0 + (1-t0)*env
3329 static void cc_t0_sub_env_mul_prim_add_shade () //Aded by Gonetz
3331 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3332 GR_COMBINE_FACTOR_TEXTURE_RGB,
3333 GR_COMBINE_LOCAL_ITERATED,
3334 GR_COMBINE_OTHER_CONSTANT);
3335 CC_PRIM ();
3336 MOD_0 (TMOD_TEX_SUB_COL);
3337 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
3338 USE_T0 ();
3341 static void cc_t0_sub_env_mul_shade_add_prim () //Aded by Gonetz
3343 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3344 GR_COMBINE_FACTOR_TEXTURE_RGB,
3345 GR_COMBINE_LOCAL_CONSTANT,
3346 GR_COMBINE_OTHER_ITERATED);
3347 CC_PRIM ();
3348 MOD_0 (TMOD_TEX_SUB_COL);
3349 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
3350 USE_T0 ();
3353 static void cc__t0_sub_env_mul_shade_add_prim__mul_shade () //Aded by Gonetz
3355 if (!cmb.combine_ext)
3357 cc_t0_sub_env_mul_shade_add_prim ();
3358 return;
3360 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3361 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
3362 GR_CMBX_ITRGB, 0,
3363 GR_CMBX_ZERO, 0);
3364 cmb.tex_ccolor = rdp.env_color;
3365 cmb.tex |= 1;
3366 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
3367 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
3368 GR_CMBX_ITRGB, 0,
3369 GR_CMBX_ZERO, 0);
3370 CC_PRIM ();
3373 static void cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_env ()
3375 // (t1-t0)*primlod+t0, (cmb-env)*shade+env
3376 if (cmb.combine_ext)
3378 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
3379 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
3380 GR_CMBX_ITRGB, 0,
3381 GR_CMBX_B, 0);
3383 else
3385 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3386 GR_COMBINE_FACTOR_TEXTURE_RGB,
3387 GR_COMBINE_LOCAL_CONSTANT,
3388 GR_COMBINE_OTHER_ITERATED);
3390 CC_ENV ();
3391 T0_INTER_T1_USING_FACTOR (lod_frac);
3395 static void cc_t0_sub_env_mul_enva_add_prim () //Aded by Gonetz
3397 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3398 GR_COMBINE_FACTOR_ONE,
3399 GR_COMBINE_LOCAL_CONSTANT,
3400 GR_COMBINE_OTHER_TEXTURE);
3401 CC_PRIM ();
3402 MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
3403 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
3404 MOD_0_FAC (rdp.env_color & 0xFF);
3405 USE_T0 ();
3408 static void cc_one_sub_t0_mul_prim_add_t0 () //Aded by Gonetz
3410 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3411 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3412 GR_COMBINE_LOCAL_CONSTANT,
3413 GR_COMBINE_OTHER_TEXTURE);
3414 CC_PRIM ();
3415 USE_T0 ();
3416 //(1-t)*prim+t == (1-prim)*t+prim
3419 static void cc_one_sub_t1_mul_prim_add_t1 () //Aded by Gonetz
3421 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3422 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3423 GR_COMBINE_LOCAL_CONSTANT,
3424 GR_COMBINE_OTHER_TEXTURE);
3425 CC_PRIM ();
3426 USE_T1 ();
3427 //(1-t)*prim+t == (1-prim)*t+prim
3430 static void cc_one_sub_t1_mul_env_add_t1 () //Aded by Gonetz
3432 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3433 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3434 GR_COMBINE_LOCAL_CONSTANT,
3435 GR_COMBINE_OTHER_TEXTURE);
3436 CC_ENV ();
3437 USE_T1 ();
3438 //(1-t)*env+t == (1-env)*t+env
3441 static void cc_one_sub_t0_mul_primlod_add_t0 () //Aded by Gonetz
3443 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3444 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3445 GR_COMBINE_LOCAL_CONSTANT,
3446 GR_COMBINE_OTHER_TEXTURE);
3447 CC_PRIMLOD ();
3448 USE_T0 ();
3449 //(1-t)*primlod+t == (1-primlod)*t+primlod
3452 static void cc_one_sub_t0_mul_prima_add_t0 () //Aded by Gonetz
3454 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3455 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
3456 GR_COMBINE_LOCAL_CONSTANT,
3457 GR_COMBINE_OTHER_TEXTURE);
3458 CA_PRIM ();
3459 USE_T0 ();
3460 //(1-t)*prima+t == (1-prima)*t+prima
3463 static void cc_one_sub__t0_inter_t1_using_enva__mul_prim_add__t0_inter_t1_using_enva () //Aded by Gonetz
3465 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3466 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3467 GR_COMBINE_LOCAL_CONSTANT,
3468 GR_COMBINE_OTHER_TEXTURE);
3469 CC_PRIM ();
3470 BYTE factor = (BYTE)(rdp.env_color&0xFF);
3471 T0_INTER_T1_USING_FACTOR (factor);
3472 //(1-t)*prim+t == (1-prim)*t+prim
3475 static void cc_one_sub_t0_mul_shade_add_t0 ()
3477 CCMB (GR_COMBINE_FUNCTION_BLEND,
3478 GR_COMBINE_FACTOR_TEXTURE_RGB,
3479 GR_COMBINE_LOCAL_ITERATED,
3480 GR_COMBINE_OTHER_CONSTANT);
3481 CC (0xFFFFFFFF);
3482 USE_T0 ();
3485 static void cc_one_sub_prim_mul_t0_add_prim () //Aded by Gonetz
3487 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3488 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3489 GR_COMBINE_LOCAL_CONSTANT,
3490 GR_COMBINE_OTHER_TEXTURE);
3491 CC_PRIM ();
3492 USE_T0 ();
3495 static void cc__one_sub_prim_mul_shade__mul_t0_add__prim_mul_shade () //Aded by Gonetz
3497 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3498 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3499 GR_COMBINE_LOCAL_ITERATED,
3500 GR_COMBINE_OTHER_TEXTURE);
3501 MULSHADE_PRIM ();
3502 USE_T0 ();
3505 static void cc_one_sub_prim_mul_t1_add_prim () //Aded by Gonetz
3507 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3508 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3509 GR_COMBINE_LOCAL_CONSTANT,
3510 GR_COMBINE_OTHER_TEXTURE);
3511 CC_PRIM ();
3512 USE_T1 ();
3515 static void cc_one_sub_prim_mul_env_add_prim () //Aded by Gonetz
3517 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3518 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3519 GR_COMBINE_LOCAL_CONSTANT,
3520 GR_COMBINE_OTHER_ITERATED);
3521 CC_PRIM ();
3522 SETSHADE_ENV ();
3525 static void cc_one_sub_prim_mul_shade_add_shade () //Aded by Gonetz
3527 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3528 GR_COMBINE_FACTOR_LOCAL,
3529 GR_COMBINE_LOCAL_ITERATED,
3530 GR_COMBINE_OTHER_CONSTANT);
3531 CC_1SUBPRIM ();
3534 static void cc_t0_inter_env_using_prima ()
3536 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3537 GR_COMBINE_FACTOR_ONE,
3538 GR_COMBINE_LOCAL_NONE,
3539 GR_COMBINE_OTHER_TEXTURE);
3540 USE_T0 ();
3542 MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
3543 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
3544 MOD_0_FAC (rdp.prim_color & 0xFF);
3547 static void cc_t0_inter_env_using_enva ()
3549 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3550 GR_COMBINE_FACTOR_ONE,
3551 GR_COMBINE_LOCAL_NONE,
3552 GR_COMBINE_OTHER_TEXTURE);
3553 USE_T0 ();
3555 MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
3556 MOD_0_COL (rdp.env_color & 0xFFFFFFFF);
3557 MOD_0_FAC (rdp.env_color & 0xFF);
3560 static void cc_t0_inter_noise_using_prim ()
3562 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3563 GR_COMBINE_FACTOR_ONE,
3564 GR_COMBINE_LOCAL_NONE,
3565 GR_COMBINE_OTHER_TEXTURE);
3566 USE_T0 ();
3568 MOD_0 (TMOD_TEX_INTER_NOISE_USING_COL);
3569 MOD_0_COL (rdp.prim_color);
3570 rdp.noise = noise_texture;
3573 static void cc_t0_inter_noise_using_env ()
3575 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
3576 GR_COMBINE_FACTOR_ONE,
3577 GR_COMBINE_LOCAL_NONE,
3578 GR_COMBINE_OTHER_TEXTURE);
3579 USE_T0 ();
3581 MOD_0 (TMOD_TEX_INTER_NOISE_USING_COL);
3582 MOD_0_COL (rdp.env_color);
3583 rdp.noise = noise_texture;
3586 static void cc_t0_sub_env_mul_enva_add_env ()
3588 CCMB (GR_COMBINE_FUNCTION_BLEND,
3589 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3590 GR_COMBINE_LOCAL_CONSTANT,
3591 GR_COMBINE_OTHER_TEXTURE);
3592 CC_ENV ();
3593 CA_ENV ();
3594 USE_T0 ();
3597 //Added by Gonetz
3598 static void cc_one_sub_prim_mul__t0_mul_t1__add__prim_mul_env ()
3600 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3601 GR_COMBINE_FACTOR_TEXTURE_RGB,
3602 GR_COMBINE_LOCAL_ITERATED,
3603 GR_COMBINE_OTHER_CONSTANT);
3604 CC_1SUBPRIM ();
3605 SETSHADE_PRIM ();
3606 SETSHADE_ENV ();
3607 T0_MUL_T1 ();
3610 //Added by Gonetz
3611 static void cc_one_sub_prim_mul__t0_inter_t1_using_enva__add_prim ()
3613 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3614 GR_COMBINE_FACTOR_TEXTURE_RGB,
3615 GR_COMBINE_LOCAL_ITERATED,
3616 GR_COMBINE_OTHER_CONSTANT);
3617 CC_1SUBPRIM ();
3618 SETSHADE_PRIM ();
3619 BYTE factor = (BYTE)(rdp.env_color&0xFF);
3620 T0_INTER_T1_USING_FACTOR (factor);
3623 static void cc_one_sub_env_mul__t0_inter_t1_using_primlod__add_env () //Aded by Gonetz
3625 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3626 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3627 GR_COMBINE_LOCAL_CONSTANT,
3628 GR_COMBINE_OTHER_TEXTURE);
3629 CC_ENV ();
3630 T0_INTER_T1_USING_FACTOR (lod_frac);
3633 static void cc_one_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env () //Aded by Gonetz
3635 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3636 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3637 GR_COMBINE_LOCAL_CONSTANT,
3638 GR_COMBINE_OTHER_TEXTURE);
3639 CC_ENV ();
3640 T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
3643 static void cc_one_sub_env_mul_t0_add_prim_mul_env () //Aded by Gonetz
3645 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3646 GR_COMBINE_FACTOR_TEXTURE_RGB,
3647 GR_COMBINE_LOCAL_ITERATED,
3648 GR_COMBINE_OTHER_CONSTANT);
3649 CC_1SUBENV ();
3650 SETSHADE_PRIM ();
3651 SETSHADE_ENV ();
3652 USE_T0 ();
3655 static void cc_one_sub_env_mul_t0_add_env () //Aded by Gonetz
3657 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3658 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3659 GR_COMBINE_LOCAL_CONSTANT,
3660 GR_COMBINE_OTHER_TEXTURE);
3661 CC_ENV ();
3662 USE_T0 ();
3665 static void cc_one_sub_env_mul_t0_add_shade () //Aded by Gonetz
3667 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3668 GR_COMBINE_FACTOR_TEXTURE_RGB,
3669 GR_COMBINE_LOCAL_ITERATED,
3670 GR_COMBINE_OTHER_CONSTANT);
3671 CC_1SUBENV ();
3672 USE_T0 ();
3675 static void cc_one_sub_env_mul_prim_add_env () //Aded by Gonetz
3677 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3678 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3679 GR_COMBINE_LOCAL_CONSTANT,
3680 GR_COMBINE_OTHER_ITERATED);
3681 CC_ENV ();
3682 SETSHADE_PRIM ();
3685 static void cc_one_sub_env_mul_prim_add_shade () //Aded by Gonetz
3687 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3688 GR_COMBINE_FACTOR_ONE,
3689 GR_COMBINE_LOCAL_ITERATED,
3690 GR_COMBINE_OTHER_CONSTANT);
3691 CC_1SUBENV ();
3692 cmb.ccolor=(BYTE)( ((rdp.prim_color & 0xFF000000) >> 24) * (((cmb.ccolor & 0xFF000000) >> 24) /255.0f) ) << 24 |
3693 (BYTE)( ((rdp.prim_color & 0x00FF0000) >> 16) * (((cmb.ccolor & 0x00FF0000) >> 16) /255.0f) ) << 16 |
3694 (BYTE)( ((rdp.prim_color & 0x0000FF00) >> 8) * (((cmb.ccolor & 0x0000FF00) >> 8) /255.0f) ) << 8;
3697 static void cc_one_sub_env_mul_shade_add_env () //Aded by Gonetz
3699 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3700 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3701 GR_COMBINE_LOCAL_CONSTANT,
3702 GR_COMBINE_OTHER_ITERATED);
3703 CC_ENV ();
3706 static void cc_one_sub_env_mul_prim_add__t0_inter_t1_using_env () //Aded by Gonetz
3708 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3709 GR_COMBINE_FACTOR_ONE,
3710 GR_COMBINE_LOCAL_ITERATED,
3711 GR_COMBINE_OTHER_TEXTURE);
3712 SETSHADE_PRIM ();
3713 SETSHADE_1MENV ();
3714 //BYTE factor = (BYTE)(rdp.env_color&0xFF);
3715 T0_INTER_T1_USING_ENV ();
3718 static void cc_one_sub_shade_mul_t0_add_shade ()
3720 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3721 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3722 GR_COMBINE_LOCAL_ITERATED,
3723 GR_COMBINE_OTHER_TEXTURE);
3724 USE_T0 ();
3727 static void cc_one_sub_shade_mul__t0_mul_shadea__add_shade ()
3729 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3730 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3731 GR_COMBINE_LOCAL_ITERATED,
3732 GR_COMBINE_OTHER_TEXTURE);
3733 if (cmb.combine_ext)
3735 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3736 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3737 GR_CMBX_ITALPHA, 0,
3738 GR_CMBX_ZERO, 0);
3739 cmb.tex |= 1;
3741 else
3743 USE_T0 ();
3747 static void cc_one_sub_shade_mul_env_add_shade ()
3749 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3750 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
3751 GR_COMBINE_LOCAL_ITERATED,
3752 GR_COMBINE_OTHER_CONSTANT);
3753 CC_ENV ();
3756 static void cc_one_sub_shade_mul_shadea_add_shade ()
3758 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3759 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3760 GR_COMBINE_LOCAL_ITERATED,
3761 GR_COMBINE_OTHER_CONSTANT);
3762 CC (0xFFFFFFFF);
3765 ///*
3766 static void cc_t0_sub_env_mul_prim_add_env () //Aded by Gonetz
3768 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3769 GR_COMBINE_FACTOR_TEXTURE_RGB,
3770 GR_COMBINE_LOCAL_ITERATED,
3771 GR_COMBINE_OTHER_CONSTANT);
3772 SETSHADE_1MPRIM();
3773 SETSHADE_ENV();
3774 CC_PRIM ();
3775 USE_T0 ();
3776 //(t0-env)*prim+env == t0*prim + env*(1-prim)
3778 //*/
3779 static void cc__t0_inter_t1_using_t1a__sub_env_mul_enva_add_env () //Aded by Gonetz
3781 CCMB (GR_COMBINE_FUNCTION_BLEND,
3782 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3783 GR_COMBINE_LOCAL_CONSTANT,
3784 GR_COMBINE_OTHER_TEXTURE);
3785 cmb.ccolor = rdp.env_color;
3786 T0_INTER_T1_USING_T1A ();
3789 static void cc_t0_sub_shade_mul_t0a_add_shade ()
3791 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3792 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
3793 GR_COMBINE_LOCAL_ITERATED,
3794 GR_COMBINE_OTHER_TEXTURE);
3795 USE_T0 ();
3796 A_USE_T0 ();
3799 static void cc_t0_sub_shade_mul_prima_add_shade () //Aded by Gonetz
3801 // * not guaranteed to work if another iterated alpha is set
3802 CCMB (GR_COMBINE_FUNCTION_BLEND,
3803 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3804 GR_COMBINE_LOCAL_ITERATED,
3805 GR_COMBINE_OTHER_TEXTURE);
3806 SETSHADE_A_PRIM ();
3807 USE_T0 ();
3810 static void cc_t0_sub_shade_mul_shadea_add_shade () //Aded by Gonetz
3812 // * not guaranteed to work if another iterated alpha is set
3813 CCMB (GR_COMBINE_FUNCTION_BLEND,
3814 GR_COMBINE_FACTOR_LOCAL_ALPHA,
3815 GR_COMBINE_LOCAL_ITERATED,
3816 GR_COMBINE_OTHER_TEXTURE);
3817 USE_T0 ();
3820 static void cc_prim_sub_t0_mul_env_add_t0 () //Aded by Gonetz
3822 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3823 GR_COMBINE_FACTOR_TEXTURE_RGB,
3824 GR_COMBINE_LOCAL_ITERATED,
3825 GR_COMBINE_OTHER_CONSTANT);
3826 CC_1SUBENV ();
3827 SETSHADE_PRIM ();
3828 SETSHADE_ENV ();
3829 USE_T0 ();
3830 //(prim-t0)*env+t0 == prim*env + t0*(1-env)
3833 static void cc_prim_sub_env_mul_t0_add_prim ()
3835 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3836 GR_COMBINE_FACTOR_TEXTURE_RGB,
3837 GR_COMBINE_LOCAL_CONSTANT,
3838 GR_COMBINE_OTHER_ITERATED);
3839 CC_PRIM ();
3840 SETSHADE_PRIMSUBENV ();
3841 USE_T0 ();
3844 static void cc_prim_sub_env_mul_t0_add_env ()
3846 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3847 GR_COMBINE_FACTOR_TEXTURE_RGB,
3848 GR_COMBINE_LOCAL_ITERATED,
3849 GR_COMBINE_OTHER_CONSTANT);
3850 CC_PRIM ();
3851 SETSHADE_ENV ();
3852 USE_T0 ();
3855 static void cc_prim_sub_env_mul__t0_mul_prim__add_env ()
3857 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3858 GR_COMBINE_FACTOR_TEXTURE_RGB,
3859 GR_COMBINE_LOCAL_ITERATED,
3860 GR_COMBINE_OTHER_CONSTANT);
3861 CC_PRIM ();
3862 SETSHADE_ENV ();
3863 if (cmb.combine_ext)
3865 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3866 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3867 GR_CMBX_TMU_CCOLOR, 0,
3868 GR_CMBX_ZERO, 0);
3869 cmb.tex_ccolor = rdp.prim_color;
3870 cmb.tex |= 1;
3872 else
3874 USE_T0 ();
3878 static void cc_prim_sub_env_mul_t0_mul_shade_add_env ()
3880 if (cmb.combine_ext)
3882 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3883 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3884 GR_CMBX_TMU_CCOLOR, 0,
3885 GR_CMBX_ZERO, 0);
3886 CC_PRIMSUBENV ();
3887 cmb.tex_ccolor = cmb.ccolor;
3888 cmb.tex |= 1;
3889 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
3890 GR_COMBINE_FACTOR_TEXTURE_RGB,
3891 GR_COMBINE_LOCAL_CONSTANT,
3892 GR_COMBINE_OTHER_ITERATED);
3893 CC_ENV ();
3895 else
3897 cc_t0_mul_prim_mul_shade ();
3901 static void cc_prim_sub_env_mul__t0_sub_t0_mul_prima__add_env ()
3903 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3904 GR_COMBINE_FACTOR_TEXTURE_RGB,
3905 GR_COMBINE_LOCAL_ITERATED,
3906 GR_COMBINE_OTHER_CONSTANT);
3907 CC_PRIM ();
3908 SETSHADE_ENV ();
3909 rdp.best_tex = 0;
3910 cmb.tex |= 1;
3911 cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
3912 cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
3913 percent = (float)(rdp.prim_color&0xFF) / 255.0f;
3914 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
3917 static void cc_prim_sub_env_mul__t0_add_t1a__add_env ()
3919 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3920 GR_COMBINE_FACTOR_TEXTURE_RGB,
3921 GR_COMBINE_LOCAL_ITERATED,
3922 GR_COMBINE_OTHER_CONSTANT);
3923 CC_PRIM ();
3924 SETSHADE_ENV ();
3925 rdp.best_tex = 0;
3926 cmb.tex |= 3;
3927 cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
3928 cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
3929 cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE;
3932 static void cc_prim_sub_env_mul__t0_sub_prim_mul_enva_add_t0__add_env ()
3934 // (t0-prim)*env_a+t0, (prim-env)*cmb+env
3935 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3936 GR_COMBINE_FACTOR_TEXTURE_RGB,
3937 GR_COMBINE_LOCAL_CONSTANT,
3938 GR_COMBINE_OTHER_ITERATED);
3939 CC_ENV ();
3940 SETSHADE_PRIM ();
3941 USE_T0 ();
3943 MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX);
3944 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
3945 MOD_0_FAC (rdp.env_color & 0xFF);
3948 static void cc_prim_sub_env_mul__t1_sub_prim_mul_enva_add_t0__add_env ()
3950 // (t0-prim)*env_a+t0, (prim-env)*cmb+env
3951 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
3952 GR_COMBINE_FACTOR_TEXTURE_RGB,
3953 GR_COMBINE_LOCAL_CONSTANT,
3954 GR_COMBINE_OTHER_ITERATED);
3955 CC_ENV ();
3956 SETSHADE_PRIM ();
3957 if (cmb.combine_ext)
3959 if (rdp.tiles[rdp.cur_tile].format > 2)
3961 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3962 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
3963 GR_CMBX_ZERO, 0,
3964 GR_CMBX_B, 0);
3965 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
3966 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
3967 GR_CMBX_DETAIL_FACTOR, 0,
3968 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
3970 else
3972 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3973 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
3974 GR_CMBX_DETAIL_FACTOR, 0,
3975 GR_CMBX_ZERO, 0);
3976 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
3977 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
3978 GR_CMBX_ZERO, 1,
3979 GR_CMBX_ZERO, 0);
3981 cmb.tex_ccolor = rdp.prim_color;
3982 cmb.tex |= 3;
3983 cmb.dc0_detailmax = cmb.dc1_detailmax = (float)(rdp.env_color&0xFF) / 255.0f;
3985 else
3987 MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC);
3988 MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
3989 MOD_1_FAC (rdp.env_color & 0xFF);
3990 T0_ADD_T1 ();
3994 static void cc__prim_sub_env_mul_t0_add_env__mul_k5 ()
3996 CCMB (GR_COMBINE_FUNCTION_BLEND,
3997 GR_COMBINE_FACTOR_TEXTURE_RGB,
3998 GR_COMBINE_LOCAL_ITERATED,
3999 GR_COMBINE_OTHER_CONSTANT);
4000 float factor = (float)rdp.K5 / 255.0f;
4001 BYTE r = (BYTE)((rdp.prim_color >> 24) & 0xFF);
4002 r = (BYTE)((float)r * factor);
4003 BYTE g = (BYTE)((rdp.prim_color >> 16) & 0xFF);
4004 g = (BYTE)((float)g * factor);
4005 BYTE b = (BYTE)((rdp.prim_color >> 8) & 0xFF);
4006 b = (BYTE)((float)b * factor);
4007 CC ((r<<24) | (g<<16) | (b<<8));
4008 SETSHADE_ENV ();
4009 MULSHADE_K5 ();
4010 USE_T0 ();
4014 static void cc_prim_sub_env_mul_t1_add_env ()
4016 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4017 GR_COMBINE_FACTOR_TEXTURE_RGB,
4018 GR_COMBINE_LOCAL_ITERATED,
4019 GR_COMBINE_OTHER_CONSTANT);
4020 CC_PRIM ();
4021 SETSHADE_ENV ();
4022 USE_T1 ();
4025 static void cc_prim_sub_env_mul_t1_add_env_mul_t0 ()
4027 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
4028 GR_COMBINE_FACTOR_ONE,
4029 GR_COMBINE_LOCAL_NONE,
4030 GR_COMBINE_OTHER_TEXTURE);
4031 MOD_1 (TMOD_COL_INTER_COL1_USING_TEX);
4032 MOD_1_COL (rdp.env_color & 0xFFFFFF00);
4033 MOD_1_COL1 (rdp.prim_color & 0xFFFFFF00);
4034 T0_MUL_T1 ();
4037 //Added by Gonetz
4038 static void cc_prim_sub_env_mul_t0a_add_env ()
4040 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4041 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4042 GR_COMBINE_LOCAL_CONSTANT,
4043 GR_COMBINE_OTHER_ITERATED);
4044 CC_ENV ();
4045 SETSHADE_PRIM ();
4046 USE_T0 ();
4049 //Added by Gonetz
4050 static void cc_prim_sub_env_mul_t1a_add_env ()
4052 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4053 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4054 GR_COMBINE_LOCAL_CONSTANT,
4055 GR_COMBINE_OTHER_ITERATED);
4056 CC_ENV ();
4057 SETSHADE_PRIM ();
4058 USE_T1 ();
4061 //Added by Gonetz
4062 static void cc_prim_sub_env_mul__t0_mul_t1__add_env ()
4064 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4065 GR_COMBINE_FACTOR_TEXTURE_RGB,
4066 GR_COMBINE_LOCAL_ITERATED,
4067 GR_COMBINE_OTHER_CONSTANT);
4068 CC_PRIM ();
4069 SETSHADE_ENV ();
4070 T0_MUL_T1 ();
4073 //Added by Gonetz
4074 static void cc_prim_sub_env_mul__t0_add_t1__add_env ()
4076 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4077 GR_COMBINE_FACTOR_TEXTURE_RGB,
4078 GR_COMBINE_LOCAL_ITERATED,
4079 GR_COMBINE_OTHER_CONSTANT);
4080 CC_PRIM ();
4081 SETSHADE_ENV ();
4082 T0_ADD_T1 ();
4085 //Added by Gonetz
4086 static void cc_prim_sub_env_mul__t0_mul_enva__add_env ()
4088 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4089 GR_COMBINE_FACTOR_TEXTURE_RGB,
4090 GR_COMBINE_LOCAL_CONSTANT,
4091 GR_COMBINE_OTHER_ITERATED);
4092 CC_ENV ();
4093 SETSHADE_PRIMSUBENV ();
4094 MULSHADE_ENVA ();
4095 USE_T0 ();
4098 //Added by Gonetz
4099 static void cc_prim_sub_env_mul__t0_mul_shade__add_env ()
4101 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4102 GR_COMBINE_FACTOR_TEXTURE_RGB,
4103 GR_COMBINE_LOCAL_CONSTANT,
4104 GR_COMBINE_OTHER_ITERATED);
4105 CC_ENV ();
4106 MULSHADE_PRIMSUBENV ();
4107 USE_T0 ();
4110 //Added by Gonetz
4111 static void cc_prim_sub_env_mul__prim_inter_t0_using_shadea__add_env ()
4113 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4114 GR_COMBINE_FACTOR_TEXTURE_RGB,
4115 GR_COMBINE_LOCAL_CONSTANT,
4116 GR_COMBINE_OTHER_ITERATED);
4117 CC_ENV ();
4118 if (cmb.combine_ext)
4120 SETSHADE_PRIM ();
4121 PRIM_INTER_T0_USING_SHADEA ();
4123 else
4125 MULSHADE_SHADEA ();
4126 SETSHADE_PRIMSUBENV ();
4127 USE_T0 ();
4131 //Added by Gonetz
4132 static void cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t0__add_env ()
4134 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4135 GR_COMBINE_FACTOR_TEXTURE_RGB,
4136 GR_COMBINE_LOCAL_ITERATED,
4137 GR_COMBINE_OTHER_CONSTANT);
4138 CC_PRIM ();
4139 SETSHADE_ENV ();
4140 if (cmb.combine_ext)
4142 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
4143 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4144 GR_CMBX_DETAIL_FACTOR, 0,
4145 GR_CMBX_B, 0);
4146 cmb.tex_ccolor = rdp.prim_color;
4147 cmb.tex |= 1;
4148 percent = (float)(lod_frac) / 255.0f;
4149 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
4151 else
4153 USE_T0 ();
4154 MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX);
4155 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
4156 MOD_0_FAC (lod_frac & 0xFF);
4160 static void cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_shade__add_env ()
4162 if (!cmb.combine_ext)
4164 cc_prim_sub_env_mul_t0_add_env ();
4165 return;
4167 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4168 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
4169 GR_CMBX_DETAIL_FACTOR, 0,
4170 GR_CMBX_ITRGB, 0);
4171 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
4172 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
4173 GR_CMBX_TEXTURE_RGB, 0,
4174 GR_CMBX_B, 0);
4175 cmb.tex_ccolor = rdp.prim_color;
4176 CC_PRIM ();
4177 SETSHADE_ENV ();
4178 cmb.tex |= 1;
4179 percent = (float)(lod_frac) / 255.0f;
4180 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
4183 static void cc_prim_sub_env_mul__t0_sub_shade_mul_primlod_add_shade__add_env ()
4185 if (!cmb.combine_ext)
4187 cc_prim_sub_env_mul_t0_add_env ();
4188 return;
4190 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4191 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
4192 GR_CMBX_DETAIL_FACTOR, 0,
4193 GR_CMBX_B, 0);
4194 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4195 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
4196 GR_CMBX_DETAIL_FACTOR, 0,
4197 GR_CMBX_B, 0);
4198 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
4199 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
4200 GR_CMBX_TEXTURE_RGB, 0,
4201 GR_CMBX_B, 0);
4202 cmb.tex_ccolor = rdp.prim_color;
4203 CC_PRIM ();
4204 SETSHADE_ENV ();
4205 cmb.tex |= 1;
4206 percent = (float)(lod_frac) / 255.0f;
4207 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
4210 //Added by Gonetz
4211 static void cc_lavatex_sub_prim_mul_shade_add_lavatex ()
4213 if (!cmb.combine_ext)
4215 cc_t0_add_t1 ();
4216 return;
4218 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
4219 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
4220 GR_CMBX_ITRGB, 0,
4221 GR_CMBX_B, 0);
4222 CC_PRIM ();
4223 T0_SUB_PRIM_MUL_PRIMLOD_ADD_T1 ();
4226 //Added by Gonetz
4227 static void cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t1__add_env ()
4229 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4230 GR_COMBINE_FACTOR_TEXTURE_RGB,
4231 GR_COMBINE_LOCAL_ITERATED,
4232 GR_COMBINE_OTHER_CONSTANT);
4233 CC_PRIM ();
4234 SETSHADE_ENV ();
4235 T0_SUB_PRIM_MUL_PRIMLOD_ADD_T1 ();
4238 //Added by Gonetz
4239 static void cc_prim_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env ()
4241 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4242 GR_COMBINE_FACTOR_TEXTURE_RGB,
4243 GR_COMBINE_LOCAL_ITERATED,
4244 GR_COMBINE_OTHER_CONSTANT);
4245 CC_PRIM ();
4246 SETSHADE_ENV ();
4247 T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
4250 //Added by Gonetz
4251 static void cc_prim_sub_env_mul__t0_inter_t1_using_t1__add_env ()
4253 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4254 GR_COMBINE_FACTOR_TEXTURE_RGB,
4255 GR_COMBINE_LOCAL_ITERATED,
4256 GR_COMBINE_OTHER_CONSTANT);
4257 CC_PRIM ();
4258 SETSHADE_ENV ();
4259 T0_INTER_T1_USING_T1 ();
4262 //Added by Gonetz
4263 static void cc_prim_sub_env_mul__t0_inter_t1_using_enva_alpha__add_env ()
4265 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4266 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4267 GR_COMBINE_LOCAL_ITERATED,
4268 GR_COMBINE_OTHER_CONSTANT);
4269 CC_PRIM ();
4270 SETSHADE_ENV ();
4271 BYTE factor = (BYTE)(rdp.env_color&0xFF);
4272 T0_INTER_T1_USING_FACTOR (factor);
4273 A_T0_INTER_T1_USING_FACTOR (factor);
4276 //Added by Gonetz
4277 static void cc_prim_sub_env_mul__t0_mul_t1__add_shade ()
4279 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4280 GR_COMBINE_FACTOR_TEXTURE_RGB,
4281 GR_COMBINE_LOCAL_ITERATED,
4282 GR_COMBINE_OTHER_CONSTANT);
4283 CC_PRIMSUBENV ();
4284 USE_T0 ();
4285 // T0_MUL_T1 ();
4288 //Added by Gonetz
4289 static void cc_prim_sub_env_mul_shade_add_t0 ()
4291 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4292 GR_COMBINE_FACTOR_ONE,
4293 GR_COMBINE_LOCAL_ITERATED,
4294 GR_COMBINE_OTHER_TEXTURE);
4295 MULSHADE_PRIMSUBENV ();
4296 USE_T0 ();
4299 //Added by Gonetz
4300 static void cc_prim_sub_env_mul_prima_add_t0 ()
4302 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4303 GR_COMBINE_FACTOR_ONE,
4304 GR_COMBINE_LOCAL_ITERATED,
4305 GR_COMBINE_OTHER_TEXTURE);
4306 SETSHADE_PRIMSUBENV ();
4307 SETSHADE_PRIMA ();
4308 USE_T0 ();
4311 //Added by Gonetz
4312 static void cc_prim_sub_env_mul_shade_add_env ()
4314 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4315 GR_COMBINE_FACTOR_ONE,
4316 GR_COMBINE_LOCAL_CONSTANT,
4317 GR_COMBINE_OTHER_ITERATED);
4318 CC_ENV ();
4319 MULSHADE_PRIMSUBENV ();
4322 static void cc_prim_sub_env_mul_shadea_add_env ()
4324 // * not guaranteed to work if another iterated alpha is set
4325 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4326 GR_COMBINE_FACTOR_OTHER_ALPHA,
4327 GR_COMBINE_LOCAL_CONSTANT,
4328 GR_COMBINE_OTHER_ITERATED);
4329 CC_ENV ();
4330 SETSHADE_PRIM ();
4333 //Added by Gonetz
4334 static void cc_prim_sub_env_mul__t0_inter_t1_using_prima__add_env ()
4336 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4337 GR_COMBINE_FACTOR_TEXTURE_RGB,
4338 GR_COMBINE_LOCAL_CONSTANT,
4339 GR_COMBINE_OTHER_ITERATED);
4340 CC_ENV ();
4341 SETSHADE_PRIM ();
4342 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
4343 T0_INTER_T1_USING_FACTOR (factor);
4346 //Added by Gonetz
4347 static void cc_prim_sub_env_mul__t1_inter_t0_using_prima__add_env ()
4349 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4350 GR_COMBINE_FACTOR_TEXTURE_RGB,
4351 GR_COMBINE_LOCAL_CONSTANT,
4352 GR_COMBINE_OTHER_ITERATED);
4353 CC_ENV ();
4354 SETSHADE_PRIM ();
4355 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
4356 T1_INTER_T0_USING_FACTOR (factor);
4359 static void cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env ()
4361 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4362 GR_COMBINE_FACTOR_TEXTURE_RGB,
4363 GR_COMBINE_LOCAL_CONSTANT,
4364 GR_COMBINE_OTHER_ITERATED);
4365 CC_ENV ();
4366 SETSHADE_PRIM ();
4367 BYTE factor = (BYTE)(rdp.env_color&0xFF);
4368 T0_INTER_T1_USING_FACTOR (factor);
4371 static void cc_prim_sub_env_mul__t1_inter_t0_using_enva__add_env ()
4373 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4374 GR_COMBINE_FACTOR_TEXTURE_RGB,
4375 GR_COMBINE_LOCAL_CONSTANT,
4376 GR_COMBINE_OTHER_ITERATED);
4377 CC_ENV ();
4378 SETSHADE_PRIM ();
4379 BYTE factor = (BYTE)(rdp.env_color&0xFF);
4380 T1_INTER_T0_USING_FACTOR (factor);
4383 static void cc_prim_sub_env_mul__t1_inter_t0_using_primlod__add_env ()
4385 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4386 GR_COMBINE_FACTOR_TEXTURE_RGB,
4387 GR_COMBINE_LOCAL_CONSTANT,
4388 GR_COMBINE_OTHER_ITERATED);
4389 CC_ENV ();
4390 SETSHADE_PRIM ();
4391 T1_INTER_T0_USING_FACTOR (lod_frac);
4394 static void cc_prim_sub_env_mul__t0_mul_enva_add_t1__add_env ()
4396 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4397 GR_COMBINE_FACTOR_TEXTURE_RGB,
4398 GR_COMBINE_LOCAL_CONSTANT,
4399 GR_COMBINE_OTHER_ITERATED);
4400 CC_ENV ();
4401 SETSHADE_PRIM ();
4402 if (cmb.combine_ext)
4404 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
4405 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4406 GR_CMBX_ZERO, 1,
4407 GR_CMBX_ZERO, 0);
4408 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4409 GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
4410 GR_CMBX_DETAIL_FACTOR, 0,
4411 GR_CMBX_B, 0);
4412 cmb.tex |= 3;
4413 percent = (float)(rdp.env_color&0xFF) / 255.0f;
4414 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
4416 else
4418 T0_ADD_T1 ();
4422 static void cc_prim_sub_env_mul__t1_mul_enva_add_t0__add_env ()
4424 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4425 GR_COMBINE_FACTOR_TEXTURE_RGB,
4426 GR_COMBINE_LOCAL_CONSTANT,
4427 GR_COMBINE_OTHER_ITERATED);
4428 CC_ENV ();
4429 SETSHADE_PRIM ();
4430 T1_MUL_ENVA_ADD_T0 ();
4433 //Added by Gonetz
4434 static void cc_prim_sub_env_mul_primlod_add__t0_inter_t1_using_primlod ()
4436 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4437 GR_COMBINE_FACTOR_ONE,
4438 GR_COMBINE_LOCAL_CONSTANT,
4439 GR_COMBINE_OTHER_TEXTURE);
4440 CC_PRIMSUBENV();
4441 float factor = lod_frac / 255.0f;
4442 cmb.ccolor=(BYTE)( ((cmb.ccolor & 0xFF000000) >> 24) * factor ) << 24 |
4443 (BYTE)( ((cmb.ccolor & 0x00FF0000) >> 16) * factor ) << 16 |
4444 (BYTE)( ((cmb.ccolor & 0x0000FF00) >> 8) * factor ) << 8;
4445 T0_INTER_T1_USING_FACTOR (lod_frac);
4448 static void cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env ()
4450 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4451 GR_COMBINE_FACTOR_TEXTURE_RGB,
4452 GR_COMBINE_LOCAL_CONSTANT,
4453 GR_COMBINE_OTHER_ITERATED);
4454 CC_ENV ();
4455 SETSHADE_PRIM ();
4456 T0_INTER_T1_USING_FACTOR (lod_frac);
4459 static void cc_prim_sub_env_mul__t1_mul_primlod_add_t0__add_env ()
4461 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4462 GR_COMBINE_FACTOR_TEXTURE_RGB,
4463 GR_COMBINE_LOCAL_CONSTANT,
4464 GR_COMBINE_OTHER_ITERATED);
4465 CC_ENV ();
4466 SETSHADE_PRIM ();
4467 T1_MUL_PRIMLOD_ADD_T0 ();
4470 static void cc_prim_sub_env_mul__t1_sub_prim_mul_t0_add_t0__add_env ()
4472 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4473 GR_COMBINE_FACTOR_TEXTURE_RGB,
4474 GR_COMBINE_LOCAL_CONSTANT,
4475 GR_COMBINE_OTHER_ITERATED);
4476 CC_ENV ();
4477 SETSHADE_PRIM ();
4478 if (cmb.combine_ext)
4480 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4481 GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
4482 GR_CMBX_ZERO, 1,
4483 GR_CMBX_ZERO, 0);
4484 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
4485 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
4486 GR_CMBX_LOCAL_TEXTURE_RGB, 0,
4487 GR_CMBX_B, 0);
4488 cmb.tex_ccolor = rdp.prim_color;
4489 cmb.tex |= 3;
4491 else
4493 MOD_1 (TMOD_TEX_SUB_COL);
4494 MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
4495 T0_MUL_T1_ADD_T0 ();
4499 //Added by Gonetz
4500 static void cc__prim_sub_env_mul_prim_add_t0__mul_prim ()
4502 if (cmb.combine_ext)
4504 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
4505 GR_CMBX_ITRGB, GR_FUNC_MODE_X,
4506 GR_CMBX_ZERO, 1,
4507 GR_CMBX_ZERO, 0);
4508 cmb.tex |= 1;
4509 SETSHADE_PRIMSUBENV ();
4510 SETSHADE_PRIM ();
4511 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
4512 GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
4513 GR_CMBX_CONSTANT_COLOR, 0,
4514 GR_CMBX_ZERO, 0);
4515 CC_PRIM() ;
4517 else
4519 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4520 GR_COMBINE_FACTOR_ONE,
4521 GR_COMBINE_LOCAL_ITERATED,
4522 GR_COMBINE_OTHER_TEXTURE);
4523 SETSHADE_PRIMSUBENV ();
4524 SETSHADE_PRIM ();
4525 USE_T0 ();
4529 //Added by Gonetz
4530 static void cc_prim_sub_env_mul_prim_add_env ()
4532 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4533 GR_COMBINE_FACTOR_ONE,
4534 GR_COMBINE_LOCAL_CONSTANT,
4535 GR_COMBINE_OTHER_ITERATED);
4536 SETSHADE_PRIMSUBENV ();
4537 SETSHADE_PRIM ();
4538 CC_ENV ();
4541 //Added by Gonetz
4542 static void cc_prim_sub_env_mul_enva_add_t0 ()
4544 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4545 GR_COMBINE_FACTOR_ONE,
4546 GR_COMBINE_LOCAL_ITERATED,
4547 GR_COMBINE_OTHER_TEXTURE);
4548 MULSHADE_ENVA ();
4549 SETSHADE_PRIMSUBENV ();
4550 USE_T0 ();
4553 //Added by Gonetz
4554 static void cc_prim_sub_shade_mul_t0_add_env ()
4556 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4557 GR_COMBINE_FACTOR_TEXTURE_RGB,
4558 GR_COMBINE_LOCAL_CONSTANT,
4559 GR_COMBINE_OTHER_ITERATED);
4560 CC_ENV ();
4561 COLSUBSHADE_PRIM ();
4562 USE_T0 ();
4565 //Added by Gonetz
4566 static void cc_prim_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade ()
4568 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4569 GR_COMBINE_FACTOR_TEXTURE_RGB,
4570 GR_COMBINE_LOCAL_ITERATED,
4571 GR_COMBINE_OTHER_CONSTANT);
4572 CC_PRIM ();
4573 T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
4576 static void cc_prim_sub_shade_mul_t1a_add_shade ()
4578 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4579 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4580 GR_COMBINE_LOCAL_ITERATED,
4581 GR_COMBINE_OTHER_CONSTANT);
4582 CC_PRIM ();
4583 USE_T1 ();
4586 //Added by Gonetz
4587 static void cc_prim_sub_shade_mul_t0_add_shade ()
4589 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4590 GR_COMBINE_FACTOR_TEXTURE_RGB,
4591 GR_COMBINE_LOCAL_ITERATED,
4592 GR_COMBINE_OTHER_CONSTANT);
4593 CC_PRIM ();
4594 USE_T0 ();
4597 //Added by Gonetz
4598 static void cc_prim_sub_shade_mul_t1_add_shade ()
4600 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4601 GR_COMBINE_FACTOR_TEXTURE_RGB,
4602 GR_COMBINE_LOCAL_ITERATED,
4603 GR_COMBINE_OTHER_CONSTANT);
4604 CC_PRIM ();
4605 USE_T1 ();
4608 //Added by Gonetz
4609 static void cc_prim_sub_shade_mul__t0_inter_t1_using_enva__add_shade ()
4611 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4612 GR_COMBINE_FACTOR_TEXTURE_RGB,
4613 GR_COMBINE_LOCAL_ITERATED,
4614 GR_COMBINE_OTHER_CONSTANT);
4615 CC_PRIM ();
4616 BYTE factor = (BYTE)(rdp.env_color&0xFF);
4617 T0_INTER_T1_USING_FACTOR (factor);
4620 //Added by Gonetz
4621 static void cc_prim_sub_shade_mul__t0_inter_t1_using_shadea__add_shade ()
4623 if (cmb.combine_ext)
4625 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
4626 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
4627 GR_CMBX_TEXTURE_RGB, 0,
4628 GR_CMBX_B, 0);
4630 else
4632 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4633 GR_COMBINE_FACTOR_TEXTURE_RGB,
4634 GR_COMBINE_LOCAL_ITERATED,
4635 GR_COMBINE_OTHER_CONSTANT);
4637 CC_PRIM ();
4638 T0_INTER_T1_USING_SHADEA ();
4641 //Added by Gonetz
4642 static void cc_prim_sub_shade_mul_prima_add_shade ()
4644 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4645 GR_COMBINE_FACTOR_OTHER_ALPHA,
4646 GR_COMBINE_LOCAL_ITERATED,
4647 GR_COMBINE_OTHER_CONSTANT);
4648 CC_PRIM ();
4649 CA_PRIM ();
4652 //Added by Gonetz
4653 static void cc_prim_sub_shade_mul_env_add_shade ()
4655 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4656 GR_COMBINE_FACTOR_ONE,
4657 GR_COMBINE_LOCAL_ITERATED,
4658 GR_COMBINE_OTHER_CONSTANT);
4659 CC_PRIMMULENV ();
4660 MULSHADE_1MENV ();
4663 //Added by Gonetz
4664 static void cc_prim_sub_shade_mul_shadea_add_shade ()
4666 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4667 GR_COMBINE_FACTOR_LOCAL_ALPHA,
4668 GR_COMBINE_LOCAL_ITERATED,
4669 GR_COMBINE_OTHER_CONSTANT);
4670 CC_PRIM ();
4673 static void cc_env_sub_prim_mul_t0_add_prim ()
4675 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4676 GR_COMBINE_FACTOR_TEXTURE_RGB,
4677 GR_COMBINE_LOCAL_ITERATED,
4678 GR_COMBINE_OTHER_CONSTANT);
4679 CC_ENV ();
4680 SETSHADE_PRIM ();
4681 USE_T0 ();
4684 static void cc_env_sub_prim_mul_t1_add_prim ()
4686 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4687 GR_COMBINE_FACTOR_TEXTURE_RGB,
4688 GR_COMBINE_LOCAL_ITERATED,
4689 GR_COMBINE_OTHER_CONSTANT);
4690 CC_ENV ();
4691 SETSHADE_PRIM ();
4692 USE_T1 ();
4695 static void cc_env_sub_prim_mul_t0a_add_prim ()
4697 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4698 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4699 GR_COMBINE_LOCAL_ITERATED,
4700 GR_COMBINE_OTHER_CONSTANT);
4701 CC_ENV ();
4702 SETSHADE_PRIM ();
4703 A_USE_T0 ();
4706 static void cc_env_sub_prim_mul_t1a_add_prim ()
4708 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4709 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4710 GR_COMBINE_LOCAL_ITERATED,
4711 GR_COMBINE_OTHER_CONSTANT);
4712 CC_ENV ();
4713 SETSHADE_PRIM ();
4714 A_USE_T1 ();
4717 static void cc_env_sub_prim_mul__t0_add_t1__add_prim ()
4719 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4720 GR_COMBINE_FACTOR_TEXTURE_RGB,
4721 GR_COMBINE_LOCAL_ITERATED,
4722 GR_COMBINE_OTHER_CONSTANT);
4723 CC_ENV ();
4724 SETSHADE_PRIM ();
4725 T0_ADD_T1 ();
4728 static void cc_env_sub_prim_mul__t0_mul_t1__add_prim () //Added by Gonetz
4730 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4731 GR_COMBINE_FACTOR_TEXTURE_RGB,
4732 GR_COMBINE_LOCAL_ITERATED,
4733 GR_COMBINE_OTHER_CONSTANT);
4734 CC_ENV ();
4735 SETSHADE_PRIM ();
4736 T0_MUL_T1 ();
4739 static void cc_env_sub_prim_mul__t0t1a__add_prim () //Added by Gonetz
4741 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4742 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
4743 GR_COMBINE_LOCAL_ITERATED,
4744 GR_COMBINE_OTHER_CONSTANT);
4745 CC_ENV ();
4746 SETSHADE_PRIM ();
4747 A_T0_MUL_T1 ();
4750 static void cc_env_sub_prim_mul__t0_inter_t1_using_t1__add_prim () //Added by Gonetz
4752 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4753 GR_COMBINE_FACTOR_TEXTURE_RGB,
4754 GR_COMBINE_LOCAL_ITERATED,
4755 GR_COMBINE_OTHER_CONSTANT);
4756 CC_ENV ();
4757 SETSHADE_PRIM ();
4758 T0_INTER_T1_USING_T1 ();
4761 static void cc_env_sub_prim_mul__t0_inter_t1_using_half__add_prim () //Added by Gonetz
4763 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4764 GR_COMBINE_FACTOR_TEXTURE_RGB,
4765 GR_COMBINE_LOCAL_ITERATED,
4766 GR_COMBINE_OTHER_CONSTANT);
4767 CC_ENV ();
4768 SETSHADE_PRIM ();
4769 T0_INTER_T1_USING_FACTOR (0x7F);
4772 static void cc_env_sub_prim_mul__t1_inter_t0_using_t0__add_prim () //Added by Gonetz
4774 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4775 GR_COMBINE_FACTOR_TEXTURE_RGB,
4776 GR_COMBINE_LOCAL_ITERATED,
4777 GR_COMBINE_OTHER_CONSTANT);
4778 CC_ENV ();
4779 SETSHADE_PRIM ();
4780 T1_INTER_T0_USING_T0 ();
4783 static void cc_env_sub_shade_mul__t0_mul_t1__add_shade () //Added by Gonetz
4785 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4786 GR_COMBINE_FACTOR_TEXTURE_RGB,
4787 GR_COMBINE_LOCAL_ITERATED,
4788 GR_COMBINE_OTHER_CONSTANT);
4789 CC_ENV ();
4790 T0_MUL_T1 ();
4793 static void cc_env_sub_prim_mul_prima_add_prim () //Aded by Gonetz
4795 // * not guaranteed to work if another iterated alpha is set
4796 CCMB (GR_COMBINE_FUNCTION_BLEND,
4797 GR_COMBINE_FACTOR_LOCAL_ALPHA,
4798 GR_COMBINE_LOCAL_CONSTANT,
4799 GR_COMBINE_OTHER_ITERATED);
4800 CC_PRIM ();
4801 CA_PRIM ();
4802 SETSHADE_ENV ();
4805 static void cc_env_sub_prim_mul_enva_add_prim () //Aded by Gonetz
4807 // * not guaranteed to work if another iterated alpha is set
4808 CCMB (GR_COMBINE_FUNCTION_BLEND,
4809 GR_COMBINE_FACTOR_OTHER_ALPHA,
4810 GR_COMBINE_LOCAL_ITERATED,
4811 GR_COMBINE_OTHER_CONSTANT);
4812 CC_ENV ();
4813 CA_ENV ();
4814 SETSHADE_PRIM ();
4817 static void cc_env_sub_prim_mul_shade_add_prim () //Added by Gonetz
4819 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4820 GR_COMBINE_FACTOR_ONE,
4821 GR_COMBINE_LOCAL_CONSTANT,
4822 GR_COMBINE_OTHER_ITERATED);
4823 CC_PRIM ();
4824 MULSHADE_ENVSUBPRIM ();
4827 static void cc_env_sub_prim_mul_shadea_add_prim () //Added by Gonetz
4829 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4830 GR_COMBINE_FACTOR_ONE,
4831 GR_COMBINE_LOCAL_CONSTANT,
4832 GR_COMBINE_OTHER_ITERATED);
4833 CC_PRIM ();
4834 MULSHADE_SHADEA ();
4835 SETSHADE_ENVSUBPRIM ();
4838 static void cc_env_sub_prim_mul__t0_inter_t1_using_prima__add_prim ()
4840 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4841 GR_COMBINE_FACTOR_TEXTURE_RGB,
4842 GR_COMBINE_LOCAL_ITERATED,
4843 GR_COMBINE_OTHER_CONSTANT);
4844 CC_ENV ();
4845 SETSHADE_PRIM ();
4846 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
4847 T0_INTER_T1_USING_FACTOR (factor);
4850 static void cc_env_sub_prim_mul__t0_inter_t1_using_primlod__add_prim ()
4852 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4853 GR_COMBINE_FACTOR_TEXTURE_RGB,
4854 GR_COMBINE_LOCAL_ITERATED,
4855 GR_COMBINE_OTHER_CONSTANT);
4856 CC_ENV ();
4857 SETSHADE_PRIM ();
4858 T0_INTER_T1_USING_FACTOR (lod_frac);
4861 static void cc_env_sub_primshade_mul_t0_add_primshade ()
4863 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4864 GR_COMBINE_FACTOR_TEXTURE_RGB,
4865 GR_COMBINE_LOCAL_ITERATED,
4866 GR_COMBINE_OTHER_CONSTANT);
4867 CC_ENV ();
4868 MULSHADE_PRIM ();
4869 USE_T0 ();
4872 static void cc_env_sub_primshade_mul_t1_add_primshade ()
4874 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4875 GR_COMBINE_FACTOR_TEXTURE_RGB,
4876 GR_COMBINE_LOCAL_ITERATED,
4877 GR_COMBINE_OTHER_CONSTANT);
4878 CC_ENV ();
4879 MULSHADE_PRIM ();
4880 USE_T1 ();
4883 static void cc_env_sub_shade_mul_t0_add_shade ()
4885 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4886 GR_COMBINE_FACTOR_TEXTURE_RGB,
4887 GR_COMBINE_LOCAL_ITERATED,
4888 GR_COMBINE_OTHER_CONSTANT);
4889 CC_ENV ();
4890 USE_T0 ();
4893 static void cc_env_sub_shade_mul_t1_add_shade ()
4895 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4896 GR_COMBINE_FACTOR_TEXTURE_RGB,
4897 GR_COMBINE_LOCAL_ITERATED,
4898 GR_COMBINE_OTHER_CONSTANT);
4899 CC_ENV ();
4900 USE_T1 ();
4903 //Added by Gonetz
4904 static void cc_env_sub_shade_mul__t0_inter_t1_using_shadea__add_shade ()
4906 if (cmb.combine_ext)
4908 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
4909 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
4910 GR_CMBX_TEXTURE_RGB, 0,
4911 GR_CMBX_B, 0);
4913 else
4915 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4916 GR_COMBINE_FACTOR_TEXTURE_RGB,
4917 GR_COMBINE_LOCAL_ITERATED,
4918 GR_COMBINE_OTHER_CONSTANT);
4920 CC_ENV ();
4921 T0_INTER_T1_USING_SHADEA ();
4924 //Added by Gonetz
4925 static void cc_env_sub_shade_mul_enva_add_shade ()
4927 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4928 GR_COMBINE_FACTOR_OTHER_ALPHA,
4929 GR_COMBINE_LOCAL_ITERATED,
4930 GR_COMBINE_OTHER_CONSTANT);
4931 cmb.ccolor = rdp.env_color;
4934 static void cc_env_sub__prim_inter_t0_using_shadea__mul_shade_add_env ()
4936 // (t0-prim)*shade_alpha+prim, (env-cmb)*shade+cmb
4937 if (cmb.combine_ext)
4939 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
4940 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
4941 GR_CMBX_ITRGB, 0,
4942 GR_CMBX_B, 0);
4943 CC_ENV ();
4944 PRIM_INTER_T0_USING_SHADEA ();
4946 else
4948 cc_t0_mul_shadea ();
4953 //Added by Gonetz
4954 static void cc_shade_sub_t0_mul_shadea_add_t0 ()
4956 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
4957 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
4958 GR_COMBINE_LOCAL_ITERATED,
4959 GR_COMBINE_OTHER_TEXTURE);
4960 MULSHADE_SHADEA ();
4961 USE_T0 ();
4964 static void cc_shade_sub_prim_mul__t0_inter_t1_using_primlod__add_prim ()
4966 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4967 GR_COMBINE_FACTOR_TEXTURE_RGB,
4968 GR_COMBINE_LOCAL_CONSTANT,
4969 GR_COMBINE_OTHER_ITERATED);
4970 CC_PRIM ();
4971 T0_INTER_T1_USING_FACTOR (lod_frac);
4974 static void cc_shade_sub_prim_mul_t0_add_prim ()
4976 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4977 GR_COMBINE_FACTOR_TEXTURE_RGB,
4978 GR_COMBINE_LOCAL_CONSTANT,
4979 GR_COMBINE_OTHER_ITERATED);
4980 CC_PRIM ();
4981 USE_T0 ();
4984 static void cc_shade_sub_prim_mul__t0_mul_t1__add_prim ()
4986 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4987 GR_COMBINE_FACTOR_TEXTURE_RGB,
4988 GR_COMBINE_LOCAL_CONSTANT,
4989 GR_COMBINE_OTHER_ITERATED);
4990 CC_PRIM ();
4991 T0_MUL_T1 ();
4994 //Added by Gonetz
4995 static void cc_shade_sub_prim_mul_t1_add_prim ()
4997 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
4998 GR_COMBINE_FACTOR_TEXTURE_RGB,
4999 GR_COMBINE_LOCAL_CONSTANT,
5000 GR_COMBINE_OTHER_ITERATED);
5001 CC_PRIM ();
5002 USE_T1 ();
5005 //Added by Gonetz
5006 static void cc_shade_sub_env_mul__t0_mul_t1__add__t0_mul_t1 ()
5008 if (cmb.combine_ext)
5010 CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
5011 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
5012 GR_CMBX_TEXTURE_RGB, 0,
5013 GR_CMBX_TEXTURE_RGB, 0);
5014 CC_ENV ();
5015 T0_MUL_T1 ();
5017 else
5019 cc_t0_mul_t1 ();
5023 //Added by Gonetz
5024 static void cc_shade_sub_env_mul_t0_add_prim ()
5026 if (rdp.cur_image && (rdp.cur_image->format != 0))
5028 cc_prim ();
5029 return;
5032 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5033 GR_COMBINE_FACTOR_TEXTURE_RGB,
5034 GR_COMBINE_LOCAL_CONSTANT,
5035 GR_COMBINE_OTHER_ITERATED);
5036 CC_PRIM ();
5037 SUBSHADE_ENV ();
5038 USE_T0 ();
5041 //Added by Gonetz
5042 static void cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_prim ()
5044 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5045 GR_COMBINE_FACTOR_TEXTURE_RGB,
5046 GR_COMBINE_LOCAL_CONSTANT,
5047 GR_COMBINE_OTHER_ITERATED);
5048 CC_PRIM ();
5049 SUBSHADE_ENV ();
5050 T0_INTER_T1_USING_FACTOR (lod_frac);
5053 //Added by Gonetz
5054 static void cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_env ()
5056 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
5057 GR_COMBINE_FACTOR_TEXTURE_RGB,
5058 GR_COMBINE_LOCAL_CONSTANT,
5059 GR_COMBINE_OTHER_ITERATED);
5060 CC_ENV ();
5061 T0_INTER_T1_USING_FACTOR (lod_frac);
5064 //Added by Gonetz
5065 static void cc_shade_sub_env_mul__t0_mul_t1__add_env ()
5067 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
5068 GR_COMBINE_FACTOR_TEXTURE_RGB,
5069 GR_COMBINE_LOCAL_CONSTANT,
5070 GR_COMBINE_OTHER_ITERATED);
5071 CC_ENV ();
5072 T0_MUL_T1 ();
5075 //Added by Gonetz
5076 static void cc_shade_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env ()
5078 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
5079 GR_COMBINE_FACTOR_TEXTURE_RGB,
5080 GR_COMBINE_LOCAL_CONSTANT,
5081 GR_COMBINE_OTHER_ITERATED);
5082 CC_ENV ();
5083 SETSHADE_ENV ();
5084 T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
5087 //Added by Gonetz
5088 static void cc_shade_sub_env_mul_t0_add_env ()
5090 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
5091 GR_COMBINE_FACTOR_TEXTURE_RGB,
5092 GR_COMBINE_LOCAL_CONSTANT,
5093 GR_COMBINE_OTHER_ITERATED);
5094 CC_ENV ();
5095 USE_T0 ();
5098 //Added by Gonetz
5099 static void cc_shade_sub_env_mul_t0_mul_prim_add_prim_mul_env ()
5101 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5102 GR_COMBINE_FACTOR_TEXTURE_RGB,
5103 GR_COMBINE_LOCAL_CONSTANT,
5104 GR_COMBINE_OTHER_ITERATED);
5105 CC_PRIMMULENV ();
5106 SUBSHADE_ENV ();
5107 MULSHADE_PRIM()
5108 USE_T0 ();
5111 //Added by Gonetz
5112 static void cc_shade_sub_env_mul_t1_add_env ()
5114 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
5115 GR_COMBINE_FACTOR_TEXTURE_RGB,
5116 GR_COMBINE_LOCAL_CONSTANT,
5117 GR_COMBINE_OTHER_ITERATED);
5118 CC_ENV ();
5119 USE_T1 ();
5122 //Added by Gonetz
5123 static void cc_shade_sub_env_mul_prim_add_t0 ()
5125 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5126 GR_COMBINE_FACTOR_ONE,
5127 GR_COMBINE_LOCAL_ITERATED,
5128 GR_COMBINE_OTHER_TEXTURE);
5129 SUBSHADE_ENV ();
5130 MULSHADE_PRIM ();
5131 USE_T0 ();
5134 static void cc__t0_add_prim_mul_shade__mul_shade_add_env ()
5136 if (!cmb.combine_ext)
5138 cc_shade_sub_env_mul_prim_add_t0 ();
5139 return;
5141 T1CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
5142 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5143 GR_CMBX_ITRGB, 0,
5144 GR_CMBX_B, 0);
5145 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
5146 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5147 GR_CMBX_ITRGB, 0,
5148 GR_CMBX_B, 0);
5149 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
5150 GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
5151 GR_CMBX_ITRGB, 0,
5152 GR_CMBX_B, 0);
5153 cmb.tex_ccolor = rdp.prim_color;
5154 CC_ENV ();
5155 cmb.tex |= 1;
5158 static void cc__t0_add_prim_mul_shade__mul_shade ()
5160 if (!cmb.combine_ext)
5162 cc_shade_sub_env_mul_prim_add_t0 ();
5163 return;
5165 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
5166 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5167 GR_CMBX_ITRGB, 0,
5168 GR_CMBX_B, 0);
5169 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
5170 GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
5171 GR_CMBX_ITRGB, 0,
5172 GR_CMBX_ZERO, 0);
5173 cmb.tex_ccolor = rdp.prim_color;
5174 cmb.tex |= 1;
5177 //Added by Gonetz
5178 static void cc_shade_sub_env_mul_prim_add_env ()
5180 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5181 GR_COMBINE_FACTOR_ONE,
5182 GR_COMBINE_LOCAL_CONSTANT,
5183 GR_COMBINE_OTHER_ITERATED);
5184 SUBSHADE_ENV ();
5185 MULSHADE_PRIM ();
5186 CC_ENV ();
5189 //Added by Gonetz
5190 static void cc_shade_sub_env_mul_prima_add_prim ()
5192 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5193 GR_COMBINE_FACTOR_ONE,
5194 GR_COMBINE_LOCAL_CONSTANT,
5195 GR_COMBINE_OTHER_ITERATED);
5196 SUBSHADE_ENV ();
5197 MULSHADE_PRIMA ();
5198 CC_PRIM ();
5201 static void cc_shade_sub_env_mul_k5_add_prim ()
5203 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5204 GR_COMBINE_FACTOR_ONE,
5205 GR_COMBINE_LOCAL_CONSTANT,
5206 GR_COMBINE_OTHER_ITERATED);
5207 SUBSHADE_ENV ();
5208 DWORD temp = rdp.prim_color;
5209 rdp.prim_color = rdp.K5;
5210 MULSHADE_PRIMA ();
5211 rdp.prim_color = temp;
5212 CC_PRIM ();
5215 // ** A inter B using C **
5216 static void cc_t0_inter_t1_using_t1a ()
5218 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5219 GR_COMBINE_FACTOR_ONE,
5220 GR_COMBINE_LOCAL_NONE,
5221 GR_COMBINE_OTHER_TEXTURE);
5222 T0_INTER_T1_USING_T1A ();
5225 static void cc_t0_inter_t1_using_prima ()
5227 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5228 GR_COMBINE_FACTOR_ONE,
5229 GR_COMBINE_LOCAL_NONE,
5230 GR_COMBINE_OTHER_TEXTURE);
5231 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5232 T0_INTER_T1_USING_FACTOR (factor);
5235 static void cc_t1_inter_t0_using_prima ()
5237 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5238 GR_COMBINE_FACTOR_ONE,
5239 GR_COMBINE_LOCAL_NONE,
5240 GR_COMBINE_OTHER_TEXTURE);
5241 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5242 T1_INTER_T0_USING_FACTOR (factor);
5245 static void cc_t1_inter_t0_using_prim ()
5247 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5248 GR_COMBINE_FACTOR_ONE,
5249 GR_COMBINE_LOCAL_NONE,
5250 GR_COMBINE_OTHER_TEXTURE);
5251 T1_INTER_T0_USING_PRIM ();
5254 static void cc_t0_inter_t1_using_env ()
5256 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5257 GR_COMBINE_FACTOR_ONE,
5258 GR_COMBINE_LOCAL_NONE,
5259 GR_COMBINE_OTHER_TEXTURE);
5260 T0_INTER_T1_USING_ENV ();
5263 static void cc_t0_inter_t1_using_enva ()
5265 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5266 GR_COMBINE_FACTOR_ONE,
5267 GR_COMBINE_LOCAL_NONE,
5268 GR_COMBINE_OTHER_TEXTURE);
5269 BYTE factor = (BYTE)(rdp.env_color&0xFF);
5270 T0_INTER_T1_USING_FACTOR (factor);
5273 static void cc__t0_inter_t1_using_prim__inter_env_using_enva ()
5275 // (t1-t0)*prim+t0, (env-cmb)*env_a+cmb
5276 if (!cmb.combine_ext)
5278 cc_t0_inter_t1_using_prima ();
5279 return;
5281 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5282 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5283 GR_CMBX_ZERO, 0,
5284 GR_CMBX_B, 0);
5285 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
5286 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5287 GR_CMBX_TMU_CCOLOR, 0,
5288 GR_CMBX_B, 0);
5289 cmb.tex_ccolor = rdp.prim_color;
5290 cmb.tex |= 3;
5291 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
5292 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5293 GR_CMBX_CONSTANT_ALPHA, 0,
5294 GR_CMBX_B, 0);
5295 cmb.ccolor = rdp.env_color;
5298 static void cc__t0_inter_t1_using_shade__inter_env_using_enva ()
5300 // (t1-t0)*shade+t0, (env-cmb)*env_a+cmb
5301 if (!cmb.combine_ext)
5303 cc_t0_inter_t1_using_enva ();
5304 return;
5306 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5307 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5308 GR_CMBX_ZERO, 0,
5309 GR_CMBX_B, 0);
5310 T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
5311 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5312 GR_CMBX_ITRGB, 0,
5313 GR_CMBX_B, 0);
5314 cmb.tex |= 3;
5315 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
5316 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5317 GR_CMBX_CONSTANT_ALPHA, 0,
5318 GR_CMBX_B, 0);
5319 cmb.ccolor = rdp.env_color;
5322 static void cc__t1_inter_env_using_t0__inter_prim_using_shadea ()
5324 //(env-t1)*t0+t1, (prim-cmb)*shadea+cmb
5325 if (!cmb.combine_ext)
5327 cc_t0_add_t1 ();
5328 return;
5330 T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5331 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5332 GR_CMBX_ZERO, 0,
5333 GR_CMBX_B, 0);
5334 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
5335 GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5336 GR_CMBX_LOCAL_TEXTURE_RGB, 0,
5337 GR_CMBX_B, 0);
5338 cmb.tex |= 3;
5339 cmb.tex_ccolor = rdp.env_color;
5340 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
5341 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5342 GR_CMBX_ITALPHA, 0,
5343 GR_CMBX_B, 0);
5344 CC_PRIM();
5349 //Added by Gonetz
5350 static void cc_t1_inter_t0_using_shadea ()
5352 if (cmb.combine_ext)
5354 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
5355 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
5356 GR_CMBX_ZERO, 1,
5357 GR_CMBX_ZERO, 0);
5359 else
5361 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5362 GR_COMBINE_FACTOR_ONE,
5363 GR_COMBINE_LOCAL_NONE,
5364 GR_COMBINE_OTHER_TEXTURE);
5366 T1_INTER_T0_USING_SHADEA ();
5369 //Added by Gonetz
5370 static void cc_t0_inter_t1_using_primlod ()
5372 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5373 GR_COMBINE_FACTOR_ONE,
5374 GR_COMBINE_LOCAL_NONE,
5375 GR_COMBINE_OTHER_TEXTURE);
5376 T0_INTER_T1_USING_FACTOR (lod_frac);
5379 //Added by Gonetz
5380 static void cc_t1_inter_t0_using_primlod ()
5382 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5383 GR_COMBINE_FACTOR_ONE,
5384 GR_COMBINE_LOCAL_NONE,
5385 GR_COMBINE_OTHER_TEXTURE);
5386 T1_INTER_T0_USING_FACTOR (lod_frac);
5389 //Added by Gonetz
5390 static void cc_t1_inter_t0_using_t0 ()
5392 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5393 GR_COMBINE_FACTOR_ONE,
5394 GR_COMBINE_LOCAL_NONE,
5395 GR_COMBINE_OTHER_TEXTURE);
5396 T1_INTER_T0_USING_T0 ();
5399 //Added by Gonetz
5400 static void cc_t0_inter_t1_using_k5 ()
5402 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5403 GR_COMBINE_FACTOR_ONE,
5404 GR_COMBINE_LOCAL_NONE,
5405 GR_COMBINE_OTHER_TEXTURE);
5406 T0_INTER_T1_USING_FACTOR (rdp.K5);
5409 static void cc_t0_inter_env_using_prim ()
5411 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5412 GR_COMBINE_FACTOR_ONE,
5413 GR_COMBINE_LOCAL_NONE,
5414 GR_COMBINE_OTHER_TEXTURE);
5415 USE_T0 ();
5417 MOD_0 (TMOD_TEX_INTER_COL_USING_COL1);
5418 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5419 MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
5422 //Added by Gonetz
5423 static void cc_t0_inter_prim_using_primlod ()
5425 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5426 GR_COMBINE_FACTOR_ONE,
5427 GR_COMBINE_LOCAL_NONE,
5428 GR_COMBINE_OTHER_TEXTURE);
5429 USE_T0 ();
5431 MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
5432 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
5433 MOD_0_FAC (lod_frac & 0xFF);
5436 static void cc_t0_inter_shade_using_primlod ()
5438 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5439 GR_COMBINE_FACTOR_TEXTURE_RGB,
5440 GR_COMBINE_LOCAL_ITERATED,
5441 GR_COMBINE_OTHER_CONSTANT);
5442 CC_PRIMLOD();
5443 cmb.ccolor=(~cmb.ccolor)&0xFFFFFF00;
5444 MULSHADE_PRIMLOD ();
5445 USE_T0 ();
5446 //(shade-t0)*primlod+t0 = t0*(1-primlod)+shade*primlod
5449 //Added by Gonetz
5450 static void cc__env_inter_t0_using_primlod__mul_prim ()
5452 //((t0-env)*primlod+env)*prim = t0*prim*primlod+env*prim*(1-primlod);
5453 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5454 GR_COMBINE_FACTOR_TEXTURE_RGB,
5455 GR_COMBINE_LOCAL_ITERATED,
5456 GR_COMBINE_OTHER_CONSTANT);
5457 CC_PRIM ();
5458 cmb.ccolor = ((((cmb.ccolor & 0xFF000000) >> 24) * (lod_frac & 0xFF))<<24) | ((((cmb.ccolor & 0x00FF0000) >> 16) * (lod_frac & 0xFF))<<16) | ((((cmb.ccolor & 0x0000FF00) >> 8) * (lod_frac & 0xFF))<<8);
5459 SETSHADE_PRIM ();
5460 SETSHADE_ENV ();
5461 SETSHADE_1MPRIMLOD ();
5462 USE_T0 ();
5465 //Added by Gonetz
5466 static void cc_env_inter_prim_using_primlod ()
5468 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5469 GR_COMBINE_FACTOR_ONE,
5470 GR_COMBINE_LOCAL_CONSTANT,
5471 GR_COMBINE_OTHER_ITERATED);
5472 SETSHADE_PRIMSUBENV ();
5473 SETSHADE_PRIMLOD ();
5474 CC_ENV ();
5477 // ** (A-B)*C+D*E **
5478 static void cc_one_sub_env_mul_prim_add__t0_mul_env () //Aded by Gonetz
5480 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5481 GR_COMBINE_FACTOR_TEXTURE_RGB,
5482 GR_COMBINE_LOCAL_ITERATED,
5483 GR_COMBINE_OTHER_CONSTANT);
5484 CC_ENV ();
5485 SETSHADE_1MENV ();
5486 SETSHADE_PRIM ();
5487 USE_T0 ();
5490 // ** (A inter B using C) * D **
5491 //Added by Gonetz
5492 static void cc__t0_inter_t1_using_prima__mul_prim ()
5494 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5495 GR_COMBINE_FACTOR_LOCAL,
5496 GR_COMBINE_LOCAL_CONSTANT,
5497 GR_COMBINE_OTHER_TEXTURE);
5498 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5499 T0_INTER_T1_USING_FACTOR (factor);
5500 CC_PRIM ();
5503 //Added by Gonetz
5504 static void cc__t1_inter_t0_using_prima__mul_prim ()
5506 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5507 GR_COMBINE_FACTOR_LOCAL,
5508 GR_COMBINE_LOCAL_CONSTANT,
5509 GR_COMBINE_OTHER_TEXTURE);
5510 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5511 T1_INTER_T0_USING_FACTOR (factor);
5512 CC_PRIM ();
5515 //Added by Gonetz
5516 static void cc__t0_inter_t1_using_prim__mul_shade ()
5518 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5519 GR_COMBINE_FACTOR_LOCAL,
5520 GR_COMBINE_LOCAL_ITERATED,
5521 GR_COMBINE_OTHER_TEXTURE);
5522 //BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5523 T0_INTER_T1_USING_PRIM ();
5526 //Added by Gonetz
5527 static void cc__t0_inter_t1_using_prima__mul_shade ()
5529 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5530 GR_COMBINE_FACTOR_LOCAL,
5531 GR_COMBINE_LOCAL_ITERATED,
5532 GR_COMBINE_OTHER_TEXTURE);
5533 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5534 T0_INTER_T1_USING_FACTOR (factor);
5537 //Added by Gonetz
5538 static void cc__t1_inter_t0_using_prima__mul_shade ()
5540 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5541 GR_COMBINE_FACTOR_LOCAL,
5542 GR_COMBINE_LOCAL_ITERATED,
5543 GR_COMBINE_OTHER_TEXTURE);
5544 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
5545 T1_INTER_T0_USING_FACTOR (factor);
5548 static void cc__t0_inter_t1_using_env__mul_shade ()
5550 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5551 GR_COMBINE_FACTOR_LOCAL,
5552 GR_COMBINE_LOCAL_ITERATED,
5553 GR_COMBINE_OTHER_TEXTURE);
5554 T0_INTER_T1_USING_ENV ();
5557 static void cc__t0_inter_t1_using_enva__mul_shade ()
5559 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5560 GR_COMBINE_FACTOR_LOCAL,
5561 GR_COMBINE_LOCAL_ITERATED,
5562 GR_COMBINE_OTHER_TEXTURE);
5563 BYTE factor = (BYTE)(rdp.env_color&0xFF);
5564 T0_INTER_T1_USING_FACTOR (factor);
5567 static void cc__t0_inter_t1_using_enva__mul_prim ()
5569 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5570 GR_COMBINE_FACTOR_LOCAL,
5571 GR_COMBINE_LOCAL_CONSTANT,
5572 GR_COMBINE_OTHER_TEXTURE);
5573 CC_PRIM ();
5574 BYTE factor = (BYTE)(rdp.env_color&0xFF);
5575 T0_INTER_T1_USING_FACTOR (factor);
5578 //Added by Gonetz
5579 static void cc__t0_inter_t1_using_enva__mul_env ()
5581 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5582 GR_COMBINE_FACTOR_LOCAL,
5583 GR_COMBINE_LOCAL_CONSTANT,
5584 GR_COMBINE_OTHER_TEXTURE);
5585 CC_ENV ();
5586 BYTE factor = (BYTE)(rdp.env_color&0xFF);
5587 T0_INTER_T1_USING_FACTOR (factor);
5590 //Added by Gonetz
5591 static void cc__t0_inter_t1_using_primlod__mul_prim ()
5593 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5594 GR_COMBINE_FACTOR_LOCAL,
5595 GR_COMBINE_LOCAL_CONSTANT,
5596 GR_COMBINE_OTHER_TEXTURE);
5597 CC_PRIM ();
5598 T0_INTER_T1_USING_FACTOR (lod_frac);
5601 //Added by Gonetz
5602 static void cc__t0_inter_t1_using_primlod__mul_prima ()
5604 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5605 GR_COMBINE_FACTOR_LOCAL,
5606 GR_COMBINE_LOCAL_CONSTANT,
5607 GR_COMBINE_OTHER_TEXTURE);
5608 CC_PRIMA ();
5609 T0_INTER_T1_USING_FACTOR (lod_frac);
5612 //Added by Gonetz
5613 static void cc__t1_mul_primlod_add_t0__mul_prim ()
5615 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5616 GR_COMBINE_FACTOR_LOCAL,
5617 GR_COMBINE_LOCAL_CONSTANT,
5618 GR_COMBINE_OTHER_TEXTURE);
5619 CC_PRIM ();
5620 T1_MUL_PRIMLOD_ADD_T0 ();
5623 //Added by Gonetz
5624 static void cc__t0_inter_t1_using_primlod__mul_env ()
5626 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5627 GR_COMBINE_FACTOR_LOCAL,
5628 GR_COMBINE_LOCAL_CONSTANT,
5629 GR_COMBINE_OTHER_TEXTURE);
5630 CC_ENV ();
5631 T0_INTER_T1_USING_FACTOR (lod_frac);
5634 //Added by Gonetz
5635 static void cc__t1_mul_primlod_add_t0__mul_env ()
5637 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5638 GR_COMBINE_FACTOR_LOCAL,
5639 GR_COMBINE_LOCAL_CONSTANT,
5640 GR_COMBINE_OTHER_TEXTURE);
5641 CC_ENV ();
5642 T1_MUL_PRIMLOD_ADD_T0 ();
5645 //Added by Gonetz
5646 static void cc__t1_inter_t0_using_prim__mul_env ()
5648 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5649 GR_COMBINE_FACTOR_LOCAL,
5650 GR_COMBINE_LOCAL_CONSTANT,
5651 GR_COMBINE_OTHER_TEXTURE);
5652 CC_ENV ();
5653 T1_INTER_T0_USING_PRIM ();
5656 static void cc__t0_inter_t1_using_primlod__mul_shade ()
5658 if (rdp.LOD_en && (rdp.mipmap_level == 0))
5660 cc_t0_mul_shade ();
5661 return;
5663 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5664 GR_COMBINE_FACTOR_LOCAL,
5665 GR_COMBINE_LOCAL_ITERATED,
5666 GR_COMBINE_OTHER_TEXTURE);
5667 T0_INTER_T1_USING_FACTOR (lod_frac);
5670 static void cc__t1_inter_t0_using_primlod__mul_shade ()
5672 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5673 GR_COMBINE_FACTOR_LOCAL,
5674 GR_COMBINE_LOCAL_ITERATED,
5675 GR_COMBINE_OTHER_TEXTURE);
5676 T1_INTER_T0_USING_FACTOR (lod_frac);
5679 static void cc__t0_inter_t1_using_half__mul_shade ()
5681 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5682 GR_COMBINE_FACTOR_LOCAL,
5683 GR_COMBINE_LOCAL_ITERATED,
5684 GR_COMBINE_OTHER_TEXTURE);
5685 T0_INTER_T1_USING_FACTOR (0x7F);
5688 static void cc__t0_inter_t1_using_t0__mul_shade ()
5690 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5691 GR_COMBINE_FACTOR_LOCAL,
5692 GR_COMBINE_LOCAL_ITERATED,
5693 GR_COMBINE_OTHER_TEXTURE);
5694 T0_INTER_T1_USING_T0();
5697 static void cc__t0_inter_t1_using_t1a__mul_shade ()
5699 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5700 GR_COMBINE_FACTOR_LOCAL,
5701 GR_COMBINE_LOCAL_ITERATED,
5702 GR_COMBINE_OTHER_TEXTURE);
5703 T0_INTER_T1_USING_T1A();
5706 static void cc__t0_inter_t1_using_shadea__mul_shade ()
5708 if (cmb.combine_ext)
5710 CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
5711 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
5712 GR_CMBX_ITRGB, 0,
5713 GR_CMBX_ZERO, 0);
5715 else
5717 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5718 GR_COMBINE_FACTOR_LOCAL,
5719 GR_COMBINE_LOCAL_ITERATED,
5720 GR_COMBINE_OTHER_TEXTURE);
5722 T0_INTER_T1_USING_SHADEA ();
5725 static void cc__t0_inter_t1_using_k5__mul_shade ()
5727 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5728 GR_COMBINE_FACTOR_LOCAL,
5729 GR_COMBINE_LOCAL_ITERATED,
5730 GR_COMBINE_OTHER_TEXTURE);
5731 T0_INTER_T1_USING_FACTOR (rdp.K5);
5734 static void cc__t1_inter_t0_using_k5__mul_shade ()
5736 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5737 GR_COMBINE_FACTOR_LOCAL,
5738 GR_COMBINE_LOCAL_ITERATED,
5739 GR_COMBINE_OTHER_TEXTURE);
5740 T1_INTER_T0_USING_FACTOR (rdp.K5);
5743 static void cc_t0_inter_prim_using_prima ()
5745 if (cmb.combine_ext)
5747 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
5748 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5749 GR_CMBX_TMU_CALPHA, 0,
5750 GR_CMBX_B, 0);
5751 cmb.tex_ccolor = rdp.prim_color;
5752 cmb.tex |= 1;
5753 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5754 GR_COMBINE_FACTOR_ONE,
5755 GR_COMBINE_LOCAL_NONE,
5756 GR_COMBINE_OTHER_TEXTURE);
5758 else
5760 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
5761 GR_COMBINE_FACTOR_TEXTURE_RGB,
5762 GR_COMBINE_LOCAL_ITERATED,
5763 GR_COMBINE_OTHER_CONSTANT);
5764 CC_1SUBPRIMA ();
5765 SETSHADE_PRIM ();
5766 SETSHADE_PRIMA ();
5767 USE_T0 ();
5771 static void cc__t0_inter_prim_using_t0a__mul_shade ()
5773 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5774 GR_COMBINE_FACTOR_LOCAL,
5775 GR_COMBINE_LOCAL_ITERATED,
5776 GR_COMBINE_OTHER_TEXTURE);
5777 MOD_0 (TMOD_TEX_INTER_COL_USING_TEXA);
5778 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
5779 USE_T0 ();
5782 static void cc__env_inter_prim_using_t0__mul_prim ()
5784 // (prim-env)*t0+env, (cmb-0)*prim+0
5785 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5786 GR_COMBINE_FACTOR_LOCAL,
5787 GR_COMBINE_LOCAL_CONSTANT,
5788 GR_COMBINE_OTHER_TEXTURE);
5789 CC_PRIM ();
5790 MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
5791 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5792 MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
5793 USE_T0 ();
5796 static void cc__env_inter_prim_using_t0__mul_shade ()
5798 // amazing... mace actually uses the blender as part of the combine
5799 if ((rdp.othermode_l & 0xFFFF0000) == 0x03820000 ||
5800 (rdp.othermode_l & 0xFFFF0000) == 0x00910000)
5802 // blender:
5803 // 1ST = CLR_IN * A_IN + CLR_BL * 1MA
5804 // OUT = 1ST * 0 + 1ST * 1
5806 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5807 GR_COMBINE_FACTOR_LOCAL,
5808 GR_COMBINE_LOCAL_ITERATED,
5809 GR_COMBINE_OTHER_TEXTURE);
5810 MOD_0 (TMOD_COL2_INTER__COL_INTER_COL1_USING_TEX__USING_TEXA);
5811 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5812 MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
5813 MOD_0_COL2 (rdp.blend_color & 0xFFFFFF00);
5814 USE_T0 ();
5816 else
5818 //(prim-env)*t0+env, (shade-0)*cmb+0
5819 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5820 GR_COMBINE_FACTOR_LOCAL,
5821 GR_COMBINE_LOCAL_ITERATED,
5822 GR_COMBINE_OTHER_TEXTURE);
5823 MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
5824 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5825 MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
5826 USE_T0 ();
5830 static void cc__prim_inter_t0_using_env__mul_shade ()
5832 // (t0-prim)*env+prim, (cmb-0)*shade+0
5833 if ((rdp.prim_color & 0xFFFFFF00) == 0)
5835 cc_t0_mul_env_mul_shade ();
5836 return;
5838 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5839 GR_COMBINE_FACTOR_LOCAL,
5840 GR_COMBINE_LOCAL_ITERATED,
5841 GR_COMBINE_OTHER_TEXTURE);
5842 MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
5843 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
5844 MOD_0_COL1 (rdp.env_color & 0xFFFFFF00);
5845 USE_T0 ();
5848 static void cc_prim_sub__prim_sub_t0_mul_prima__mul_shade ()
5850 // (prim-t0)*prim_a+0, (prim-cmb)*shade+0
5851 if (cmb.combine_ext)
5853 T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
5854 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5855 GR_CMBX_TMU_CALPHA, 0,
5856 GR_CMBX_ZERO, 0);
5857 cmb.tex_ccolor = rdp.prim_color;
5858 cmb.tex |= 1;
5859 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
5860 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5861 GR_CMBX_ITRGB, 0,
5862 GR_CMBX_ZERO, 0);
5863 CC_PRIM();
5865 else
5867 if ((rdp.prim_color & 0xFFFFFF00) == 0)
5869 cc_t0_mul_prima_mul_shade ();
5870 return;
5872 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5873 GR_COMBINE_FACTOR_LOCAL,
5874 GR_COMBINE_LOCAL_ITERATED,
5875 GR_COMBINE_OTHER_TEXTURE);
5876 MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
5877 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
5878 BYTE prima = (BYTE)(rdp.prim_color&0xFF);
5879 MOD_0_COL1 ((prima<<24)|(prima<<16)|(prima<<8));
5880 USE_T0 ();
5884 static void cc__prim_inter_env_using_t0__mul_shade ()
5886 // (env-prim)*t0+prim, (cmb-0)*shade+0
5887 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5888 GR_COMBINE_FACTOR_LOCAL,
5889 GR_COMBINE_LOCAL_ITERATED,
5890 GR_COMBINE_OTHER_TEXTURE);
5891 MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
5892 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
5893 MOD_0_COL1 (rdp.env_color & 0xFFFFFF00);
5894 USE_T0 ();
5897 static void cc__env_inter_prim_using_t0a__mul_t0 ()
5899 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5900 GR_COMBINE_FACTOR_ONE,
5901 GR_COMBINE_LOCAL_NONE,
5902 GR_COMBINE_OTHER_TEXTURE);
5903 MOD_0 (TMOD_COL_INTER_COL1_USING_TEXA__MUL_TEX);
5904 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5905 MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
5906 USE_T0 ();
5909 static void cc__env_inter_prim_using__t0_sub_shade_mul_primlod_add_env ()
5911 // (t0-shade)*lodf+env, (prim-env)*cmb+env
5912 if (cmb.combine_ext)
5914 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
5915 GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
5916 GR_CMBX_DETAIL_FACTOR, 0,
5917 GR_CMBX_TMU_CCOLOR, 0);
5918 cmb.tex_ccolor = rdp.env_color;
5919 percent = (float)lod_frac / 255.0f;
5920 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
5921 cmb.tex |= 1;
5922 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5923 GR_COMBINE_FACTOR_LOCAL,
5924 GR_COMBINE_LOCAL_CONSTANT,
5925 GR_COMBINE_OTHER_TEXTURE);
5926 CC_PRIMSUBENV ();
5928 else
5930 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
5931 GR_COMBINE_FACTOR_ONE,//TEXTURE_RGB,
5932 GR_COMBINE_LOCAL_ITERATED,
5933 GR_COMBINE_OTHER_TEXTURE);//CONSTANT);
5934 MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
5935 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5936 MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
5937 USE_T0 ();
5938 MULSHADE_PRIMSUBENV ();
5939 MULSHADE_PRIMLOD();
5940 SUBSHADE_PRIMSUBENV ();
5944 static void cc__prim_inter_t0_using_t0__mul_shade ()
5946 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5947 GR_COMBINE_FACTOR_LOCAL,
5948 GR_COMBINE_LOCAL_ITERATED,
5949 GR_COMBINE_OTHER_TEXTURE);
5950 MOD_0 (TMOD_COL_INTER_TEX_USING_TEX);
5951 MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
5952 USE_T0 ();
5955 static void cc__env_inter_t0_using_t0a__mul_shade ()
5957 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5958 GR_COMBINE_FACTOR_LOCAL,
5959 GR_COMBINE_LOCAL_ITERATED,
5960 GR_COMBINE_OTHER_TEXTURE);
5961 MOD_0 (TMOD_COL_INTER_TEX_USING_TEXA);
5962 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
5963 USE_T0 ();
5966 static void cc_shade_mul_prima ()
5968 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5969 GR_COMBINE_FACTOR_ONE,
5970 GR_COMBINE_LOCAL_NONE,
5971 GR_COMBINE_OTHER_ITERATED);
5972 MULSHADE_PRIMA ();
5975 static void cc_shade_mul_shadea ()
5977 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
5978 GR_COMBINE_FACTOR_ONE,
5979 GR_COMBINE_LOCAL_NONE,
5980 GR_COMBINE_OTHER_ITERATED);
5981 MULSHADE_SHADEA ();
5984 static void cc__t0_mul_shade__inter_env_using_enva ()
5986 // (t0-0)*shade+0, (env-cmb)*env_a+cmb ** INC **
5987 if (cmb.combine_ext)
5989 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
5990 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
5991 GR_CMBX_ITRGB, 0,
5992 GR_CMBX_ZERO, 0);
5993 cmb.tex |= 1;
5994 CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
5995 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
5996 GR_CMBX_ITALPHA, 0,
5997 GR_CMBX_B, 0);
5998 CC_ENV ();
5999 SETSHADE_A_ENV ();
6001 else
6003 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6004 GR_COMBINE_FACTOR_LOCAL,
6005 GR_COMBINE_LOCAL_ITERATED,
6006 GR_COMBINE_OTHER_TEXTURE);
6007 INTERSHADE_2 (rdp.env_color & 0xFFFFFF00, rdp.env_color & 0xFF);
6008 USE_T0 ();
6009 MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
6010 MOD_0_COL (rdp.env_color & 0xFFFFFF00);
6011 MOD_0_FAC (rdp.env_color & 0xFF);
6015 static void cc__t0_mul_shade__inter_one_using_shadea ()
6017 if (cmb.combine_ext)
6019 T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
6020 GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
6021 GR_CMBX_ITRGB, 0,
6022 GR_CMBX_ZERO, 0);
6023 cmb.tex |= 1;
6024 CCMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_X,
6025 GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
6026 GR_CMBX_ITALPHA, 0,
6027 GR_CMBX_B, 0);
6029 else
6031 cc_t0_mul_shade ();
6036 //****************************************************************
6038 static void ac_one ()
6040 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6041 GR_COMBINE_FACTOR_NONE,
6042 GR_COMBINE_LOCAL_CONSTANT,
6043 GR_COMBINE_OTHER_NONE);
6044 cmb.ccolor |= 0xFF;
6047 static void ac_t0 ()
6049 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6050 GR_COMBINE_FACTOR_ONE,
6051 GR_COMBINE_LOCAL_NONE,
6052 GR_COMBINE_OTHER_TEXTURE);
6053 A_USE_T0 ();
6056 static void ac_zero ()
6058 if (cmb.tex > 0)
6060 ac_t0 ();
6061 return;
6063 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6064 GR_COMBINE_FACTOR_NONE,
6065 GR_COMBINE_LOCAL_CONSTANT,
6066 GR_COMBINE_OTHER_NONE);
6067 cmb.ccolor &= 0xFFFFFF00;
6070 static void ac_t1 ()
6072 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6073 GR_COMBINE_FACTOR_ONE,
6074 GR_COMBINE_LOCAL_NONE,
6075 GR_COMBINE_OTHER_TEXTURE);
6076 if (settings.BAR && rdp.tiles[rdp.cur_tile].format == 3)
6077 A_USE_T0 ();
6078 else
6079 A_USE_T1 ();
6082 static void ac_prim ()
6084 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6085 GR_COMBINE_FACTOR_NONE,
6086 GR_COMBINE_LOCAL_CONSTANT,
6087 GR_COMBINE_OTHER_NONE);
6088 CA_PRIM ();
6091 static void ac_primlod ()
6093 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6094 GR_COMBINE_FACTOR_NONE,
6095 GR_COMBINE_LOCAL_CONSTANT,
6096 GR_COMBINE_OTHER_NONE);
6097 CA_PRIMLOD ();
6100 static void ac_one_sub_prim ()
6102 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6103 GR_COMBINE_FACTOR_NONE,
6104 GR_COMBINE_LOCAL_CONSTANT,
6105 GR_COMBINE_OTHER_NONE);
6106 CA_INVPRIM ();
6109 static void ac_env ()
6111 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6112 GR_COMBINE_FACTOR_NONE,
6113 GR_COMBINE_LOCAL_CONSTANT,
6114 GR_COMBINE_OTHER_NONE);
6115 CA_ENV ();
6118 static void ac_shade ()
6120 ACMB (GR_COMBINE_FUNCTION_LOCAL,
6121 GR_COMBINE_FACTOR_NONE,
6122 GR_COMBINE_LOCAL_ITERATED,
6123 GR_COMBINE_OTHER_NONE);
6126 // ** A+B **
6127 static void ac_t0_add_t1 () //Aded by Gonetz
6129 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6130 GR_COMBINE_FACTOR_ONE,
6131 GR_COMBINE_LOCAL_NONE,
6132 GR_COMBINE_OTHER_TEXTURE);
6133 A_T0_ADD_T1 ();
6136 static void ac__t0_mul_prim__add__t1_mul_primlod () //Aded by Gonetz
6138 if (lod_frac == 0)
6140 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6141 GR_COMBINE_FACTOR_LOCAL,
6142 GR_COMBINE_LOCAL_CONSTANT,
6143 GR_COMBINE_OTHER_TEXTURE);
6144 CA_PRIM ();
6145 A_USE_T0 ();
6147 else if ((rdp.prim_color&0xFF) == 0)
6149 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6150 GR_COMBINE_FACTOR_LOCAL,
6151 GR_COMBINE_LOCAL_CONSTANT,
6152 GR_COMBINE_OTHER_TEXTURE);
6153 CA_PRIMLOD ();
6154 A_USE_T1 ();
6156 else
6158 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6159 GR_COMBINE_FACTOR_LOCAL,
6160 GR_COMBINE_LOCAL_CONSTANT,
6161 GR_COMBINE_OTHER_TEXTURE);
6162 CA_PRIM ();
6163 A_T0_ADD_T1 ();
6167 static void ac_t0_add_prim () //Aded by Gonetz
6169 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6170 GR_COMBINE_FACTOR_ONE,
6171 GR_COMBINE_LOCAL_CONSTANT,
6172 GR_COMBINE_OTHER_TEXTURE);
6173 CA_PRIM ();
6174 A_USE_T0 ();
6177 static void ac_t0_add_env () //Aded by Gonetz
6179 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6180 GR_COMBINE_FACTOR_ONE,
6181 GR_COMBINE_LOCAL_CONSTANT,
6182 GR_COMBINE_OTHER_TEXTURE);
6183 CA_ENV ();
6184 A_USE_T0 ();
6187 static void ac_t1_add_env () //Added by Gonetz
6189 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6190 GR_COMBINE_FACTOR_ONE,
6191 GR_COMBINE_LOCAL_CONSTANT,
6192 GR_COMBINE_OTHER_TEXTURE);
6193 CA_ENV ();
6194 A_USE_T1 ();
6197 static void ac__t0_add_t1__add_prim () //Aded by Gonetz
6199 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6200 GR_COMBINE_FACTOR_ONE,
6201 GR_COMBINE_LOCAL_CONSTANT,
6202 GR_COMBINE_OTHER_TEXTURE);
6203 CA_PRIM ();
6204 A_T0_ADD_T1 ();
6207 static void ac_prim_add_shade () //Aded by Gonetz
6209 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6210 GR_COMBINE_FACTOR_ONE,
6211 GR_COMBINE_LOCAL_ITERATED,
6212 GR_COMBINE_OTHER_CONSTANT);
6213 CA_PRIM ();
6216 static void ac_env_add_shade () //Aded by Gonetz
6218 CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6219 GR_COMBINE_FACTOR_ONE,
6220 GR_COMBINE_LOCAL_ITERATED,
6221 GR_COMBINE_OTHER_CONSTANT);
6222 CA_ENV ();
6225 // ** A*B **
6226 static void ac_t0_mul_t0 () //Added by Gonetz
6228 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6229 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6230 GR_COMBINE_LOCAL_NONE,
6231 GR_COMBINE_OTHER_TEXTURE);
6232 A_USE_T0 ();
6235 static void ac_t0_mul_t1 ()
6237 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6238 GR_COMBINE_FACTOR_ONE,
6239 GR_COMBINE_LOCAL_NONE,
6240 GR_COMBINE_OTHER_TEXTURE);
6241 A_T0_MUL_T1 ();
6244 static void ac_t0_mul_t1_add_prim ()
6246 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6247 GR_COMBINE_FACTOR_ONE,
6248 GR_COMBINE_LOCAL_CONSTANT,
6249 GR_COMBINE_OTHER_TEXTURE);
6250 CA_PRIM ();
6251 A_T0_MUL_T1 ();
6254 static void ac_t0_mul_prim ()
6256 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6257 GR_COMBINE_FACTOR_LOCAL,
6258 GR_COMBINE_LOCAL_CONSTANT,
6259 GR_COMBINE_OTHER_TEXTURE);
6260 CA_PRIM ();
6261 A_USE_T0 ();
6264 static void ac_t0_mul_prim_mul_primlod ()
6266 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6267 GR_COMBINE_FACTOR_LOCAL,
6268 GR_COMBINE_LOCAL_CONSTANT,
6269 GR_COMBINE_OTHER_TEXTURE);
6270 CA_PRIM_MUL_PRIMLOD ();
6271 A_USE_T0 ();
6274 static void ac_t1_mul_prim ()
6276 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6277 GR_COMBINE_FACTOR_LOCAL,
6278 GR_COMBINE_LOCAL_CONSTANT,
6279 GR_COMBINE_OTHER_TEXTURE);
6280 CA_PRIM ();
6281 A_USE_T1 ();
6284 //Added by Gonetz
6285 static void ac__t1_sub_one_mul_primlod_add_t0__mul_prim ()
6287 if (cmb.combine_ext)
6289 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6290 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6291 GR_CMBX_ZERO, 0,
6292 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6293 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6294 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
6295 GR_CMBX_DETAIL_FACTOR, 0,
6296 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6297 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
6298 percent = (float)lod_frac / 255.0f;
6300 else
6302 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
6303 cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
6304 percent = (255 - lod_frac) / 255.0f;
6305 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
6306 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
6308 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6309 GR_COMBINE_FACTOR_LOCAL,
6310 GR_COMBINE_LOCAL_CONSTANT,
6311 GR_COMBINE_OTHER_TEXTURE);
6312 CA_PRIM ();
6313 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6314 cmb.tex |= 3;
6317 static void ac__t0_sub_t1_mul_enva_add_t0__mul_prim ()
6319 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6320 GR_COMBINE_FACTOR_LOCAL,
6321 GR_COMBINE_LOCAL_CONSTANT,
6322 GR_COMBINE_OTHER_TEXTURE);
6323 CA_PRIM ();
6324 if (cmb.combine_ext)
6326 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6327 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6328 GR_CMBX_ZERO, 0,
6329 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6330 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
6331 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6332 GR_CMBX_TMU_CALPHA, 0,
6333 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6334 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
6335 cmb.tex |= 3;
6337 else
6339 A_T0_MUL_T1 ();
6343 static void ac__t0_sub_one_mul_enva_add_t0__mul_prim ()
6345 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6346 GR_COMBINE_FACTOR_LOCAL,
6347 GR_COMBINE_LOCAL_CONSTANT,
6348 GR_COMBINE_OTHER_TEXTURE);
6349 CA_PRIM ();
6350 if (cmb.combine_ext)
6352 T0ACMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
6353 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6354 GR_CMBX_TMU_CALPHA, 0,
6355 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6356 SETSHADE_A(0xFF);
6357 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
6358 cmb.tex |= 1;
6360 else
6362 A_USE_T0 ();
6366 static void ac__t0_sub_t1_mul_primlod_add_t0__mul_prim ()
6368 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6369 GR_COMBINE_FACTOR_LOCAL,
6370 GR_COMBINE_LOCAL_CONSTANT,
6371 GR_COMBINE_OTHER_TEXTURE);
6372 CA_PRIM ();
6373 if (cmb.combine_ext)
6375 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6376 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6377 GR_CMBX_ZERO, 0,
6378 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6379 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
6380 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6381 GR_CMBX_DETAIL_FACTOR, 0,
6382 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6383 cmb.tex |= 3;
6384 percent = (float)lod_frac / 255.0f;
6385 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6387 else
6389 A_T0_INTER_T1_USING_FACTOR (lod_frac);
6393 static void ac__t1_sub_prim_mul_primlod_add_t0__mul_prim ()
6395 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6396 GR_COMBINE_FACTOR_LOCAL,
6397 GR_COMBINE_LOCAL_CONSTANT,
6398 GR_COMBINE_OTHER_TEXTURE);
6399 CA_PRIM ();
6400 if (cmb.combine_ext)
6402 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6403 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6404 GR_CMBX_ZERO, 0,
6405 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6406 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6407 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
6408 GR_CMBX_DETAIL_FACTOR, 0,
6409 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6410 cmb.tex |= 3;
6411 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
6412 percent = (float)lod_frac / 255.0f;
6413 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6415 else
6417 A_T0_INTER_T1_USING_FACTOR (lod_frac);
6421 static void ac__t1_sub_t0_mul_enva_add_t1__mul_prim ()
6423 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6424 GR_COMBINE_FACTOR_LOCAL,
6425 GR_COMBINE_LOCAL_CONSTANT,
6426 GR_COMBINE_OTHER_TEXTURE);
6427 CA_PRIM ();
6428 if (cmb.combine_ext)
6430 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6431 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6432 GR_CMBX_ZERO, 0,
6433 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6434 T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
6435 GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6436 GR_CMBX_TMU_CALPHA, 0,
6437 GR_CMBX_B, 0);
6438 cmb.tex |= 3;
6439 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF);
6441 else
6443 BYTE factor = (BYTE)(rdp.env_color&0xFF);
6444 A_T0_INTER_T1_USING_FACTOR (factor);
6448 static void ac__t0_sub_one_mul_enva_add_t1__mul_prim ()
6450 if (cmb.combine_ext)
6452 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6453 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6454 GR_CMBX_ZERO, 0,
6455 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6456 T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6457 GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6458 GR_CMBX_TMU_CALPHA, 0,
6459 GR_CMBX_B, 0);
6460 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
6461 cmb.tex |= 3;
6462 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6463 GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
6464 GR_CMBX_ITALPHA, 0,
6465 GR_CMBX_ZERO, 0);
6466 CA_ENV ();
6467 SETSHADE_A_PRIM ();
6469 else
6471 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6472 GR_COMBINE_FACTOR_LOCAL,
6473 GR_COMBINE_LOCAL_ITERATED,
6474 GR_COMBINE_OTHER_TEXTURE);
6475 SETSHADE_A_PRIM ();
6476 SETSHADE_A_ENV ();
6477 A_T0_MUL_T1 ();
6481 static void ac__t1_mul_prima_add_t0__mul_env ()
6483 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6484 GR_COMBINE_FACTOR_LOCAL,
6485 GR_COMBINE_LOCAL_CONSTANT,
6486 GR_COMBINE_OTHER_TEXTURE);
6487 CA_ENV ();
6488 A_T1_MUL_PRIMA_ADD_T0 ();
6491 static void ac__t1_mul_enva_add_t0__mul_prim ()
6493 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6494 GR_COMBINE_FACTOR_LOCAL,
6495 GR_COMBINE_LOCAL_CONSTANT,
6496 GR_COMBINE_OTHER_TEXTURE);
6497 CA_PRIM ();
6498 A_T1_MUL_ENVA_ADD_T0 ();
6501 static void ac_t0_mul_primlod ()
6503 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6504 GR_COMBINE_FACTOR_LOCAL,
6505 GR_COMBINE_LOCAL_CONSTANT,
6506 GR_COMBINE_OTHER_TEXTURE);
6507 CA_PRIMLOD ();
6508 A_USE_T0 ();
6511 static void ac_t1_mul_primlod ()
6513 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6514 GR_COMBINE_FACTOR_LOCAL,
6515 GR_COMBINE_LOCAL_CONSTANT,
6516 GR_COMBINE_OTHER_TEXTURE);
6517 CA_PRIMLOD ();
6518 A_USE_T1 ();
6521 //Added by Gonetz
6522 static void ac__t0_add_t1__mul_prim ()
6524 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6525 GR_COMBINE_FACTOR_LOCAL,
6526 GR_COMBINE_LOCAL_CONSTANT,
6527 GR_COMBINE_OTHER_TEXTURE);
6528 CA_PRIM ();
6529 A_T0_ADD_T1 ();
6532 //Added by Gonetz
6533 static void ac__t0_add_t1__mul_primlod ()
6535 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6536 GR_COMBINE_FACTOR_LOCAL,
6537 GR_COMBINE_LOCAL_CONSTANT,
6538 GR_COMBINE_OTHER_TEXTURE);
6539 CA_PRIMLOD ();
6540 A_T0_ADD_T1 ();
6543 //Added by Gonetz
6544 static void ac__t0_mul_t1__mul_primlod ()
6546 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6547 GR_COMBINE_FACTOR_LOCAL,
6548 GR_COMBINE_LOCAL_CONSTANT,
6549 GR_COMBINE_OTHER_TEXTURE);
6550 CA_PRIMLOD ();
6551 A_T0_MUL_T1 ();
6554 static void ac_t0_mul_env ()
6556 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6557 GR_COMBINE_FACTOR_LOCAL,
6558 GR_COMBINE_LOCAL_CONSTANT,
6559 GR_COMBINE_OTHER_TEXTURE);
6560 CA_ENV ();
6561 A_USE_T0 ();
6564 static void ac_t0_mul_env_mul_primlod ()
6566 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6567 GR_COMBINE_FACTOR_LOCAL,
6568 GR_COMBINE_LOCAL_CONSTANT,
6569 GR_COMBINE_OTHER_TEXTURE);
6570 CA_ENV_MUL_PRIMLOD ();
6571 A_USE_T0 ();
6574 static void ac_t1_mul_env () //Added by Gonetz
6576 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6577 GR_COMBINE_FACTOR_LOCAL,
6578 GR_COMBINE_LOCAL_CONSTANT,
6579 GR_COMBINE_OTHER_TEXTURE);
6580 CA_ENV ();
6581 A_USE_T1 ();
6584 static void ac__t1_sub_one_mul_primlod_add_t0__mul_env ()
6586 if (cmb.combine_ext)
6588 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6589 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6590 GR_CMBX_ZERO, 0,
6591 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6592 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6593 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
6594 GR_CMBX_DETAIL_FACTOR, 0,
6595 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6596 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
6597 percent = (float)lod_frac / 255.0f;
6599 else
6601 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
6602 cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
6603 percent = (255 - lod_frac) / 255.0f;
6604 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
6605 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
6607 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6608 GR_COMBINE_FACTOR_LOCAL,
6609 GR_COMBINE_LOCAL_CONSTANT,
6610 GR_COMBINE_OTHER_TEXTURE);
6611 CA_ENV ();
6612 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6613 cmb.tex |= 3;
6616 static void ac_t0_mul_shade ()
6618 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6619 GR_COMBINE_FACTOR_LOCAL,
6620 GR_COMBINE_LOCAL_ITERATED,
6621 GR_COMBINE_OTHER_TEXTURE);
6622 A_USE_T0 ();
6625 static void ac_t1_mul_shade ()
6627 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6628 GR_COMBINE_FACTOR_LOCAL,
6629 GR_COMBINE_LOCAL_ITERATED,
6630 GR_COMBINE_OTHER_TEXTURE);
6631 A_USE_T1 ();
6634 //Added by Gonetz
6635 static void ac__t0_add_t1__mul_shade ()
6637 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6638 GR_COMBINE_FACTOR_LOCAL,
6639 GR_COMBINE_LOCAL_ITERATED,
6640 GR_COMBINE_OTHER_TEXTURE);
6641 A_T0_ADD_T1 ();
6644 static void ac__t1_mul_prima_add_t0__mul_shade ()
6646 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6647 GR_COMBINE_FACTOR_LOCAL,
6648 GR_COMBINE_LOCAL_ITERATED,
6649 GR_COMBINE_OTHER_TEXTURE);
6650 A_T1_MUL_PRIMA_ADD_T0 ();
6653 //Added by Gonetz
6654 static void ac__t0_sub_t1__mul_shade ()
6656 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6657 GR_COMBINE_FACTOR_LOCAL,
6658 GR_COMBINE_LOCAL_ITERATED,
6659 GR_COMBINE_OTHER_TEXTURE);
6660 if (cmb.combine_ext)
6662 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6663 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6664 GR_CMBX_ZERO, 0,
6665 GR_CMBX_B, 0);
6666 T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6667 GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
6668 GR_CMBX_ZERO, 1,
6669 GR_CMBX_ZERO, 0);
6670 cmb.tex |= 3;
6672 else
6674 A_T0_SUB_T1 ();
6678 static void ac__t1_mul_t1_add_t1__mul_shade ()
6680 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6681 GR_COMBINE_FACTOR_LOCAL,
6682 GR_COMBINE_LOCAL_ITERATED,
6683 GR_COMBINE_OTHER_TEXTURE);
6684 if (cmb.combine_ext)
6686 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6687 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6688 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
6689 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6690 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6691 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6692 GR_CMBX_ZERO, 1,
6693 GR_CMBX_ZERO, 0);
6694 cmb.tex |= 2;
6696 else
6698 A_USE_T1 ();
6702 static void ac__t1_mul_enva_add_t0__mul_shade ()
6704 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6705 GR_COMBINE_FACTOR_LOCAL,
6706 GR_COMBINE_LOCAL_ITERATED,
6707 GR_COMBINE_OTHER_TEXTURE);
6708 A_T1_MUL_ENVA_ADD_T0 ();
6711 static void ac__t1_sub_one_mul_primlod_add_t0__mul_shade ()
6713 if (cmb.combine_ext)
6715 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6716 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6717 GR_CMBX_ZERO, 0,
6718 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6719 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6720 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
6721 GR_CMBX_DETAIL_FACTOR, 0,
6722 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6723 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
6724 percent = (float)lod_frac / 255.0f;
6726 else
6728 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
6729 cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
6730 percent = (255 - lod_frac) / 255.0f;
6731 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
6732 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
6734 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6735 GR_COMBINE_FACTOR_LOCAL,
6736 GR_COMBINE_LOCAL_ITERATED,
6737 GR_COMBINE_OTHER_TEXTURE);
6738 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6739 cmb.tex |= 3;
6742 static void ac__t1_sub_shade_mul_primlod_add_t0__mul_shade ()
6744 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6745 GR_COMBINE_FACTOR_LOCAL,
6746 GR_COMBINE_LOCAL_CONSTANT,
6747 GR_COMBINE_OTHER_TEXTURE);
6748 CA_PRIM ();
6749 if (cmb.combine_ext)
6751 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6752 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6753 GR_CMBX_ZERO, 0,
6754 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6755 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6756 GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
6757 GR_CMBX_DETAIL_FACTOR, 0,
6758 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6759 cmb.tex |= 3;
6760 percent = (float)lod_frac / 255.0f;
6761 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6763 else
6765 A_T0_INTER_T1_USING_FACTOR (lod_frac);
6769 //Added by Gonetz
6770 static void ac_prim_mul_prim ()
6772 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6773 GR_COMBINE_FACTOR_LOCAL,
6774 GR_COMBINE_LOCAL_CONSTANT,
6775 GR_COMBINE_OTHER_ITERATED);
6776 CA_PRIM ();
6777 SETSHADE_A_PRIM ();
6780 //Added by Gonetz
6781 static void ac_prim_mul_primlod ()
6783 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6784 GR_COMBINE_FACTOR_LOCAL,
6785 GR_COMBINE_LOCAL_CONSTANT,
6786 GR_COMBINE_OTHER_ITERATED);
6787 CA_PRIMLOD ();
6788 SETSHADE_A_PRIM ();
6791 static void ac_prim_mul_env ()
6793 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6794 GR_COMBINE_FACTOR_LOCAL,
6795 GR_COMBINE_LOCAL_CONSTANT,
6796 GR_COMBINE_OTHER_ITERATED);
6797 CA_ENV ();
6798 SETSHADE_A_PRIM ();
6801 static void ac__prim_sub_one_mul_primlod_add_t0__mul_env ()
6803 if (cmb.combine_ext)
6805 T0ACMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
6806 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
6807 GR_CMBX_DETAIL_FACTOR, 0,
6808 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6809 SETSHADE_A_PRIM ();
6810 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
6811 percent = (float)lod_frac / 255.0f;
6812 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6813 cmb.tex |= 1;
6815 else
6817 A_USE_T0 ();
6819 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6820 GR_COMBINE_FACTOR_LOCAL,
6821 GR_COMBINE_LOCAL_CONSTANT,
6822 GR_COMBINE_OTHER_TEXTURE);
6823 CA_ENV ();
6826 static void ac_prim_mul_shade ()
6828 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6829 GR_COMBINE_FACTOR_LOCAL,
6830 GR_COMBINE_LOCAL_CONSTANT,
6831 GR_COMBINE_OTHER_ITERATED);
6832 CA_PRIM ();
6835 static void ac_env_mul_shade ()
6837 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6838 GR_COMBINE_FACTOR_LOCAL,
6839 GR_COMBINE_LOCAL_CONSTANT,
6840 GR_COMBINE_OTHER_ITERATED);
6841 CA_ENV ();
6844 static void ac_primlod_mul_shade ()
6846 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6847 GR_COMBINE_FACTOR_LOCAL,
6848 GR_COMBINE_LOCAL_CONSTANT,
6849 GR_COMBINE_OTHER_ITERATED);
6850 CA_PRIMLOD ();
6853 // ** A-B **
6854 static void ac_prim_sub_t0 ()
6856 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6857 GR_COMBINE_FACTOR_ONE,
6858 GR_COMBINE_LOCAL_NONE,
6859 GR_COMBINE_OTHER_TEXTURE);
6860 A_USE_T0 ();
6862 MOD_0 (TMOD_FULL_COLOR_SUB_TEX);
6863 MOD_0_COL (rdp.prim_color);
6866 // ** A*B+C **
6867 static void ac_t1_mul_prima_add_t0 ()
6869 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6870 GR_COMBINE_FACTOR_ONE,
6871 GR_COMBINE_LOCAL_NONE,
6872 GR_COMBINE_OTHER_TEXTURE);
6873 A_T1_MUL_PRIMA_ADD_T0 ();
6876 //Added by Gonetz
6877 static void ac_t0_mul_prim_add_env ()
6879 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6880 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6881 GR_COMBINE_LOCAL_CONSTANT,
6882 GR_COMBINE_OTHER_ITERATED);
6883 SETSHADE_A_PRIM ();
6884 CA_ENV ();
6885 A_USE_T0 ();
6888 //Added by Gonetz
6889 static void ac__t0_add_t1__mul_prim_add_env ()
6891 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6892 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6893 GR_COMBINE_LOCAL_CONSTANT,
6894 GR_COMBINE_OTHER_ITERATED);
6895 SETSHADE_A_PRIM ();
6896 CA_ENV ();
6897 A_T0_ADD_T1 ();
6900 //Aded by Gonetz
6901 static void ac__t0_inter_t1_using_enva__mul_prim_add_env ()
6903 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6904 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6905 GR_COMBINE_LOCAL_CONSTANT,
6906 GR_COMBINE_OTHER_ITERATED);
6907 SETSHADE_A_PRIM ();
6908 CA_ENV ();
6909 BYTE factor = (BYTE)(rdp.env_color&0xFF);
6910 A_T0_INTER_T1_USING_FACTOR (factor);
6913 //Aded by Gonetz
6914 static void ac_t0_mul_primlod_add_t0 ()
6916 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6917 GR_COMBINE_FACTOR_ONE,
6918 GR_COMBINE_LOCAL_NONE,
6919 GR_COMBINE_OTHER_TEXTURE);
6920 if (cmb.combine_ext)
6922 T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
6923 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
6924 GR_CMBX_DETAIL_FACTOR, 0,
6925 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
6926 cmb.tex |= 1;
6927 percent = (float)lod_frac / 255.0f;
6928 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
6930 else
6932 A_USE_T0 ();
6936 //Aded by Gonetz
6937 static void ac_t1_mul_primlod_add_t0 ()
6939 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
6940 GR_COMBINE_FACTOR_ONE,
6941 GR_COMBINE_LOCAL_NONE,
6942 GR_COMBINE_OTHER_TEXTURE);
6943 A_T1_MUL_PRIMLOD_ADD_T0 ();
6946 //Aded by Gonetz
6947 static void ac_t0_mul_primlod_add_prim ()
6949 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6950 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6951 GR_COMBINE_LOCAL_ITERATED,
6952 GR_COMBINE_OTHER_CONSTANT);
6953 CA_PRIMLOD ();
6954 SETSHADE_A_PRIM ();
6955 A_USE_T0 ();
6958 //Aded by Gonetz
6959 static void ac__t0_add_t1__mul_primlod_add_prim ()
6961 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6962 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6963 GR_COMBINE_LOCAL_ITERATED,
6964 GR_COMBINE_OTHER_CONSTANT);
6965 CA_PRIMLOD ();
6966 SETSHADE_A_PRIM ();
6967 A_T0_ADD_T1 ();
6970 //Added by Gonetz
6971 static void ac_t0_mul_env_add_prim ()
6973 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6974 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6975 GR_COMBINE_LOCAL_CONSTANT,
6976 GR_COMBINE_OTHER_ITERATED);
6977 SETSHADE_A_ENV ();
6978 CA_PRIM ();
6979 A_USE_T0 ();
6982 //Added by Gonetz
6983 static void ac_t1_mul_prim_add_prim ()
6985 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6986 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
6987 GR_COMBINE_LOCAL_CONSTANT,
6988 GR_COMBINE_OTHER_ITERATED);
6989 SETSHADE_A_PRIM ();
6990 CA_PRIM ();
6991 A_USE_T1 ();
6994 //Added by Gonetz
6995 static void ac_prim_mul_shade_add_shade ()
6997 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
6998 GR_COMBINE_FACTOR_LOCAL,
6999 GR_COMBINE_LOCAL_ITERATED,
7000 GR_COMBINE_OTHER_CONSTANT);
7001 CA_PRIM ();
7004 //Added by Gonetz
7005 static void ac_t0_mul_shade_add_prim ()
7007 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7008 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7009 GR_COMBINE_LOCAL_CONSTANT,
7010 GR_COMBINE_OTHER_ITERATED);
7011 CA_PRIM ();
7012 A_USE_T0 ();
7015 static void ac_t0_mul_shade_add_env ()
7017 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7018 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7019 GR_COMBINE_LOCAL_CONSTANT,
7020 GR_COMBINE_OTHER_ITERATED);
7021 CA_ENV ();
7022 A_USE_T0 ();
7026 // ** A*B+C*D **
7027 static void ac_t0_mul_prim_add_shade_mul_one_minus_prim ()
7029 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7030 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7031 GR_COMBINE_LOCAL_ITERATED,
7032 GR_COMBINE_OTHER_CONSTANT);
7033 MULSHADE_A_1MPRIM ();
7034 CA_PRIM ();
7035 A_USE_T0 ();
7038 // ** A*B*C **
7039 static void ac__t0_mul_t1__mul_prim ()
7041 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7042 GR_COMBINE_FACTOR_LOCAL,
7043 GR_COMBINE_LOCAL_CONSTANT,
7044 GR_COMBINE_OTHER_TEXTURE);
7045 CA_PRIM ();
7046 A_T0_MUL_T1 ();
7049 static void ac__t0_mul_t1__mul_env ()
7051 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7052 GR_COMBINE_FACTOR_LOCAL,
7053 GR_COMBINE_LOCAL_CONSTANT,
7054 GR_COMBINE_OTHER_TEXTURE);
7055 CA_ENV ();
7056 A_T0_MUL_T1 ();
7059 static void ac__t0_mul_t1__mul_env_mul_shade ()
7061 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7062 GR_COMBINE_FACTOR_LOCAL,
7063 GR_COMBINE_LOCAL_ITERATED,
7064 GR_COMBINE_OTHER_TEXTURE);
7065 MULSHADE_A_ENV ();
7066 A_T0_MUL_T1 ();
7069 static void ac__t0_mul_t1__mul_prim_mul_shade ()
7071 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7072 GR_COMBINE_FACTOR_LOCAL,
7073 GR_COMBINE_LOCAL_ITERATED,
7074 GR_COMBINE_OTHER_TEXTURE);
7075 MULSHADE_A_PRIM ();
7076 A_T0_MUL_T1 ();
7079 static void ac__t0_mul_t1__mul_shade ()
7081 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7082 GR_COMBINE_FACTOR_LOCAL,
7083 GR_COMBINE_LOCAL_ITERATED,
7084 GR_COMBINE_OTHER_TEXTURE);
7085 A_T0_MUL_T1 ();
7088 //Added by Gonetz
7089 static void ac_t0_mul_prim_mul_prim ()
7091 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7092 GR_COMBINE_FACTOR_LOCAL,
7093 GR_COMBINE_LOCAL_ITERATED,
7094 GR_COMBINE_OTHER_TEXTURE);
7095 SETSHADE_A_PRIM ();
7096 MULSHADE_A_PRIM ();
7097 A_USE_T0 ();
7100 static void ac_t0_mul_prim_mul_env ()
7102 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7103 GR_COMBINE_FACTOR_LOCAL,
7104 GR_COMBINE_LOCAL_CONSTANT,
7105 GR_COMBINE_OTHER_TEXTURE);
7106 CA_PRIMENV();
7107 A_USE_T0 ();
7110 static void ac_t0_mul_prim_mul_shade ()
7112 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7113 GR_COMBINE_FACTOR_LOCAL,
7114 GR_COMBINE_LOCAL_ITERATED,
7115 GR_COMBINE_OTHER_TEXTURE);
7116 MULSHADE_A_PRIM ();
7117 A_USE_T0 ();
7120 static void ac_t1_mul_prim_mul_shade ()
7122 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7123 GR_COMBINE_FACTOR_LOCAL,
7124 GR_COMBINE_LOCAL_ITERATED,
7125 GR_COMBINE_OTHER_TEXTURE);
7126 MULSHADE_A_PRIM ();
7127 A_USE_T1 ();
7130 static void ac_t0_mul_env_mul_shade ()
7132 if (rdp.cur_image && (rdp.cur_image->format != 0))
7134 ac_shade ();
7135 return;
7138 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7139 GR_COMBINE_FACTOR_LOCAL,
7140 GR_COMBINE_LOCAL_ITERATED,
7141 GR_COMBINE_OTHER_TEXTURE);
7142 MULSHADE_A_ENV ();
7143 A_USE_T0 ();
7146 static void ac_t1_mul_env_mul_shade ()
7148 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7149 GR_COMBINE_FACTOR_LOCAL,
7150 GR_COMBINE_LOCAL_ITERATED,
7151 GR_COMBINE_OTHER_TEXTURE);
7152 MULSHADE_A_ENV ();
7153 A_USE_T1 ();
7156 static void ac_t0_mul_primlod_mul_prim () //Aded by Gonetz
7158 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7159 GR_COMBINE_FACTOR_LOCAL,
7160 GR_COMBINE_LOCAL_CONSTANT,
7161 GR_COMBINE_OTHER_TEXTURE);
7162 cmb.ccolor |= (DWORD)(lod_frac * (rdp.prim_color&0xFF) / 255);
7163 A_USE_T0 ();
7166 // ** (A+B)*C **
7167 static void ac_prim_add_env_mul_t0 () //Aded by Gonetz
7169 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7170 GR_COMBINE_FACTOR_LOCAL,
7171 GR_COMBINE_LOCAL_ITERATED,
7172 GR_COMBINE_OTHER_TEXTURE);
7173 SETSHADE_A_PRIM ();
7174 ADDSHADE_A_ENV ();
7175 A_USE_T0 ();
7178 static void ac_t1_add_prim_mul_env () //Aded by Gonetz
7180 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7181 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7182 GR_COMBINE_LOCAL_ITERATED,
7183 GR_COMBINE_OTHER_CONSTANT);
7184 CA_ENV ();
7185 SETSHADE_A_PRIM ();
7186 SETSHADE_A_ENV ();
7187 A_USE_T1 ();
7188 //(t1+prim)*env = t1*env + prim*env
7191 // ** A-B*C **
7192 static void ac_t0_sub_prim_mul_shade ()
7194 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
7195 GR_COMBINE_FACTOR_ONE,
7196 GR_COMBINE_LOCAL_ITERATED,
7197 GR_COMBINE_OTHER_TEXTURE);
7198 MULSHADE_A_PRIM ();
7199 A_USE_T0 ();
7202 // ** (A-B)*C **
7203 static void ac__t1_mul_primlod_add_t0__sub_env_mul_prim () //Aded by Gonetz
7205 if (cmb.combine_ext)
7207 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7208 GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
7209 GR_CMBX_ITALPHA, 0,
7210 GR_CMBX_ZERO, 0);
7211 CA_ENV ();
7212 SETSHADE_A_PRIM ();
7214 else
7216 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7217 GR_COMBINE_FACTOR_LOCAL,
7218 GR_COMBINE_LOCAL_CONSTANT,
7219 GR_COMBINE_OTHER_TEXTURE);
7220 CA_PRIM ();
7222 A_T1_MUL_PRIMLOD_ADD_T0 ();
7225 static void ac_one_sub_t0_mul_prim () //Aded by Gonetz
7227 ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
7228 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7229 GR_COMBINE_LOCAL_CONSTANT,
7230 GR_COMBINE_OTHER_NONE);
7231 CA_PRIM ();
7232 A_USE_T0 ();
7235 static void ac_one_sub_t0_mul_shade () //Aded by Gonetz
7237 if (!rdp.hires_tex)
7239 ac_zero();
7240 return;
7242 ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
7243 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7244 GR_COMBINE_LOCAL_ITERATED,
7245 GR_COMBINE_OTHER_NONE);
7246 A_USE_T0 ();
7249 static void ac_one_sub_prim_mul_t0 () //Aded by Gonetz
7251 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7252 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
7253 GR_COMBINE_LOCAL_CONSTANT,
7254 GR_COMBINE_OTHER_TEXTURE);
7255 CA_PRIM ();
7256 A_USE_T0 ();
7259 static void ac_one_sub_env_mul_t0 () //Aded by Gonetz
7261 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7262 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
7263 GR_COMBINE_LOCAL_CONSTANT,
7264 GR_COMBINE_OTHER_TEXTURE);
7265 CA_ENV ();
7266 A_USE_T0 ();
7269 static void ac_one_sub_shade_mul_t0 () //Aded by Gonetz
7271 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7272 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
7273 GR_COMBINE_LOCAL_ITERATED,
7274 GR_COMBINE_OTHER_TEXTURE);
7275 A_USE_T0 ();
7278 static void ac_prim_sub_shade_mul_t0 () //Aded by Gonetz
7280 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
7281 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7282 GR_COMBINE_LOCAL_ITERATED,
7283 GR_COMBINE_OTHER_CONSTANT);
7284 CA_PRIM ();
7285 A_USE_T0 ();
7288 static void ac_shade_sub_env_mul_t0 () //Aded by Gonetz
7290 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
7291 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7292 GR_COMBINE_LOCAL_CONSTANT,
7293 GR_COMBINE_OTHER_ITERATED);
7294 CA_ENV ();
7295 A_USE_T0 ();
7298 // ** (A-B)*C*D **
7299 static void ac_one_sub_t0_mul_prim_mul_shade () //Aded by Gonetz
7301 ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
7302 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7303 GR_COMBINE_LOCAL_ITERATED,
7304 GR_COMBINE_OTHER_NONE);
7305 MULSHADE_A_PRIM ();
7306 A_USE_T0 ();
7309 // ** (A-B)*C+D **
7310 static void ac__t0_sub_prim_mul_shade_add_shade__mul_env () //Aded by Gonetz
7312 if (cmb.combine_ext)
7314 T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7315 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
7316 GR_CMBX_ITALPHA, 0,
7317 GR_CMBX_ITALPHA, 0);
7318 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF) ;
7319 cmb.tex |= 1;
7320 ACMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
7321 GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7322 GR_CMBX_CONSTANT_ALPHA, 0,
7323 GR_CMBX_ZERO, 0);
7324 CA_ENV();
7326 else
7328 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7329 GR_COMBINE_FACTOR_LOCAL,
7330 GR_COMBINE_LOCAL_ITERATED,
7331 GR_COMBINE_OTHER_TEXTURE);
7332 MULSHADE_A_ENV ();
7333 MOD_0 (TMOD_TEX_SUB_COL);
7334 MOD_0_COL (rdp.prim_color & 0xFF);
7335 A_USE_T0 ();
7339 static void ac_t0_sub_one_mul_enva_add_t1 () //Aded by Gonetz
7341 if (cmb.combine_ext)
7343 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7344 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7345 GR_CMBX_ZERO, 0,
7346 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
7347 T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7348 GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7349 GR_CMBX_TMU_CALPHA, 0,
7350 GR_CMBX_B, 0);
7351 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
7352 cmb.tex |= 3;
7353 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
7354 GR_COMBINE_FACTOR_ONE,
7355 GR_COMBINE_LOCAL_CONSTANT,
7356 GR_COMBINE_OTHER_TEXTURE);
7357 CA_ENV();
7359 else
7361 ac__t0_mul_t1__mul_env ();
7365 static void ac_t1_sub_one_mul_enva_add_t0 () //Aded by Gonetz
7367 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7368 GR_COMBINE_FACTOR_ONE,
7369 GR_COMBINE_LOCAL_NONE,
7370 GR_COMBINE_OTHER_TEXTURE);
7371 if (cmb.combine_ext)
7373 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7374 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7375 GR_CMBX_ZERO, 0,
7376 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
7377 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7378 GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
7379 GR_CMBX_TMU_CALPHA, 0,
7380 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
7381 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
7382 SETSHADE_A (0xFF);
7383 cmb.tex |= 3;
7385 else
7387 A_USE_T0 ();
7391 static void ac_t1_sub_one_mul_primlod_add_t0 () //Aded by Gonetz
7393 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7394 GR_COMBINE_FACTOR_ONE,
7395 GR_COMBINE_LOCAL_NONE,
7396 GR_COMBINE_OTHER_TEXTURE);
7397 if (cmb.combine_ext)
7399 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7400 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7401 GR_CMBX_ZERO, 0,
7402 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
7403 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7404 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
7405 GR_CMBX_DETAIL_FACTOR, 0,
7406 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
7407 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
7408 percent = (float)lod_frac / 255.0f;
7409 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
7410 cmb.tex |= 3;
7412 else
7414 // A_T0_MUL_T1 ();
7415 // A_T1_MUL_PRIMLOD_ADD_T0 ();
7416 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
7417 cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
7418 percent = (255 - lod_frac) / 255.0f;
7419 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
7420 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
7421 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
7422 cmb.tex |= 3;
7426 static void ac_t1_sub_prim_mul_shade_add_prim () //Aded by Gonetz
7428 if (cmb.combine_ext)
7430 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7431 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
7432 GR_CMBX_ITALPHA, 0,
7433 GR_CMBX_B, 0);
7434 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7435 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
7436 GR_CMBX_ZERO, 1,
7437 GR_CMBX_ZERO, 0);
7438 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF) ;
7439 cmb.tex |= 2;
7440 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7441 GR_CMBX_ZERO, GR_FUNC_MODE_X,
7442 GR_CMBX_ZERO, 1,
7443 GR_CMBX_ZERO, 0);
7445 else
7447 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7448 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7449 GR_COMBINE_LOCAL_CONSTANT,
7450 GR_COMBINE_OTHER_ITERATED);
7451 CA_PRIM ();
7452 MOD_1 (TMOD_TEX_SUB_COL);
7453 MOD_1_COL (rdp.prim_color & 0xFF);
7454 A_USE_T1 ();
7458 static void ac_t0_sub_env_mul_prim_add_env () //Aded by Gonetz
7460 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7461 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7462 GR_COMBINE_LOCAL_CONSTANT,
7463 GR_COMBINE_OTHER_ITERATED);
7464 SETSHADE_A_PRIM ();
7465 CA_ENV1MPRIM ();
7466 A_USE_T0 ();
7467 //(t0-env)*prim+env == t0*prim + env*(1-prim)
7470 static void ac__one_sub_t0_mul_t1_add_t0__mul_prim () //Aded by Gonetz
7472 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7473 GR_COMBINE_FACTOR_LOCAL,
7474 GR_COMBINE_LOCAL_CONSTANT,
7475 GR_COMBINE_OTHER_TEXTURE);
7476 CA_PRIM ();
7477 rdp.best_tex = 0;
7478 cmb.tex |= 3;
7479 cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL;
7480 cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
7481 cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA;
7484 static void ac_one_sub_t0_mul_prim_add_t0 () //Aded by Gonetz
7486 ACMB (GR_COMBINE_FUNCTION_BLEND,
7487 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7488 GR_COMBINE_LOCAL_ITERATED,
7489 GR_COMBINE_OTHER_CONSTANT);
7490 SETSHADE_A_PRIM ();
7491 CA (0xFF);
7492 A_USE_T0 ();
7495 static void ac_one_sub_t0_mul_env_add_t0 () //Aded by Gonetz
7497 ACMB (GR_COMBINE_FUNCTION_BLEND,
7498 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7499 GR_COMBINE_LOCAL_ITERATED,
7500 GR_COMBINE_OTHER_CONSTANT);
7501 SETSHADE_A_ENV ();
7502 CA (0xFF);
7503 A_USE_T0 ();
7506 static void ac_one_sub_t0_mul_primlod_add_prim () //Aded by Gonetz
7508 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7509 GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA,
7510 GR_COMBINE_LOCAL_ITERATED,
7511 GR_COMBINE_OTHER_CONSTANT);
7512 SETSHADE_A_PRIM ();
7513 CA_PRIMLOD();
7514 A_USE_T0 ();
7517 static void ac_prim_sub_t0_mul_env_add_t0 () //Aded by Gonetz
7519 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7520 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7521 GR_COMBINE_LOCAL_ITERATED,
7522 GR_COMBINE_OTHER_CONSTANT);
7523 CA_INVENV ();
7524 SETSHADE_A_PRIM ();
7525 SETSHADE_A_ENV ();
7526 A_USE_T0 ();
7527 //(prim-t0)*env+t0 = prim*env + t0*(1-env)
7530 static void ac_prim_sub_env_mul_t0_add_env ()
7532 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
7533 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7534 GR_COMBINE_LOCAL_ITERATED,
7535 GR_COMBINE_OTHER_CONSTANT);
7536 CA_PRIM ();
7537 SETSHADE_A_ENV ();
7538 A_USE_T0 ();
7541 static void ac_prim_sub_env_mul_t1_add_env ()
7543 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
7544 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7545 GR_COMBINE_LOCAL_ITERATED,
7546 GR_COMBINE_OTHER_CONSTANT);
7547 CA_PRIM ();
7548 SETSHADE_A_ENV ();
7549 A_USE_T1 ();
7552 //Added by Gonetz
7553 static void ac_prim_sub_env_mul_shade_add_env ()
7555 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7556 GR_COMBINE_FACTOR_ONE,
7557 GR_COMBINE_LOCAL_CONSTANT,
7558 GR_COMBINE_OTHER_ITERATED);
7559 CA_ENV ();
7560 MULSHADE_A_PRIMSUBENV ();
7563 //Added by Gonetz
7564 static void ac_prim_sub_env_mul_shade_add_env_mul_t1 ()
7566 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7567 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7568 GR_COMBINE_LOCAL_CONSTANT,
7569 GR_COMBINE_OTHER_ITERATED);
7570 CA_ENV ();
7571 MULSHADE_A_PRIMSUBENV ();
7572 A_USE_T1 ();
7575 //Added by Gonetz
7576 static void ac_prim_sub_shade_mul_t0_add_shade ()
7578 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
7579 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7580 GR_COMBINE_LOCAL_ITERATED,
7581 GR_COMBINE_OTHER_CONSTANT);
7582 CA_PRIM ();
7583 A_USE_T0 ();
7586 //Added by Gonetz
7587 static void ac_one_sub_shade_mul_t1_add_shade ()
7589 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7590 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
7591 GR_COMBINE_LOCAL_ITERATED,
7592 GR_COMBINE_OTHER_TEXTURE);
7593 A_USE_T1 ();
7596 //Added by Gonetz
7597 static void ac_one_sub_env_mul_shade_add_env ()
7599 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7600 GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
7601 GR_COMBINE_LOCAL_CONSTANT,
7602 GR_COMBINE_OTHER_ITERATED);
7603 CA_ENV ();
7606 //Added by Gonetz
7607 static void ac_env_sub_prim_mul_t0_add_prim ()
7609 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
7610 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7611 GR_COMBINE_LOCAL_ITERATED,
7612 GR_COMBINE_OTHER_CONSTANT);
7613 CA_ENV ();
7614 SETSHADE_A_PRIM ();
7615 A_USE_T0 ();
7618 static void ac_env_sub_prim_mul_shade_add_prim () //Added by Gonetz
7620 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7621 GR_COMBINE_FACTOR_ONE,
7622 GR_COMBINE_LOCAL_CONSTANT,
7623 GR_COMBINE_OTHER_ITERATED);
7624 CA_PRIM ();
7625 MULSHADE_A_ENVSUBPRIM ();
7628 static void ac_env_sub_primshade_mul_t1_add_primshade ()
7630 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
7631 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7632 GR_COMBINE_LOCAL_ITERATED,
7633 GR_COMBINE_OTHER_CONSTANT);
7634 CA_ENV ();
7635 MULSHADE_A_PRIM ();
7636 A_USE_T1 ();
7639 static void ac_one_sub_prim_mul_t0_add_prim ()
7641 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
7642 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7643 GR_COMBINE_LOCAL_ITERATED,
7644 GR_COMBINE_OTHER_CONSTANT);
7645 CA (0xFF);
7646 SETSHADE_A_PRIM ();
7647 A_USE_T0 ();
7650 static void ac_one_sub_prim_mul_t0_add__prim_mul_env ()
7652 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
7653 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
7654 GR_COMBINE_LOCAL_ITERATED,
7655 GR_COMBINE_OTHER_CONSTANT);
7656 CA_INVPRIM ();
7657 SETSHADE_A_PRIM ();
7658 SETSHADE_A_ENV ();
7659 A_USE_T0 ();
7662 // ** A inter B using C **
7663 static void ac_t0_inter_t1_using_prima ()
7665 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7666 GR_COMBINE_FACTOR_ONE,
7667 GR_COMBINE_LOCAL_NONE,
7668 GR_COMBINE_OTHER_TEXTURE);
7669 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
7670 A_T0_INTER_T1_USING_FACTOR (factor);
7673 static void ac_t1_inter_t0_using_prima ()
7675 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7676 GR_COMBINE_FACTOR_ONE,
7677 GR_COMBINE_LOCAL_NONE,
7678 GR_COMBINE_OTHER_TEXTURE);
7679 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
7680 A_T1_INTER_T0_USING_FACTOR (factor);
7683 static void ac_t0_inter_t1_using_primlod ()
7685 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7686 GR_COMBINE_FACTOR_ONE,
7687 GR_COMBINE_LOCAL_NONE,
7688 GR_COMBINE_OTHER_TEXTURE);
7689 A_T0_INTER_T1_USING_FACTOR (lod_frac);
7692 static void ac_t0_inter_t1_using_enva ()
7694 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7695 GR_COMBINE_FACTOR_ONE,
7696 GR_COMBINE_LOCAL_NONE,
7697 GR_COMBINE_OTHER_TEXTURE);
7698 BYTE factor = (BYTE)(rdp.env_color&0xFF);
7699 A_T0_INTER_T1_USING_FACTOR (factor);
7702 static void ac_t1_inter_t0_using_enva ()
7704 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7705 GR_COMBINE_FACTOR_ONE,
7706 GR_COMBINE_LOCAL_NONE,
7707 GR_COMBINE_OTHER_TEXTURE);
7708 BYTE factor = (BYTE)(rdp.env_color&0xFF);
7709 A_T1_INTER_T0_USING_FACTOR (factor);
7712 //Added by Gonetz
7713 static void ac_t0_inter_t1_using_t0a ()
7715 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7716 GR_COMBINE_FACTOR_ONE,
7717 GR_COMBINE_LOCAL_NONE,
7718 GR_COMBINE_OTHER_TEXTURE);
7719 A_T0_INTER_T1_USING_T0A ();
7722 //Added by Gonetz
7723 static void ac_t0_inter_t1_using_t1a ()
7725 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7726 GR_COMBINE_FACTOR_ONE,
7727 GR_COMBINE_LOCAL_NONE,
7728 GR_COMBINE_OTHER_TEXTURE);
7729 A_T0_INTER_T1_USING_T1A ();
7732 //Added by Gonetz
7733 static void ac_t0_inter_t1_using_shadea ()
7735 if (cmb.combine_ext)
7737 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7738 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
7739 GR_CMBX_ZERO, 1,
7740 GR_CMBX_ZERO, 0);
7742 else
7744 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7745 GR_COMBINE_FACTOR_ONE,
7746 GR_COMBINE_LOCAL_NONE,
7747 GR_COMBINE_OTHER_TEXTURE);
7749 A_T0_INTER_T1_USING_SHADEA ();
7752 // ** (A inter B using C) * D **
7754 static void ac__t0_inter_t1_using_primlod__mul_prim ()
7756 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7757 GR_COMBINE_FACTOR_LOCAL,
7758 GR_COMBINE_LOCAL_CONSTANT,
7759 GR_COMBINE_OTHER_TEXTURE);
7760 CA_PRIM ();
7761 A_T0_INTER_T1_USING_FACTOR (lod_frac);
7764 static void ac__t1_mul_primlod_add_t0__mul_prim ()
7766 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7767 GR_COMBINE_FACTOR_LOCAL,
7768 GR_COMBINE_LOCAL_CONSTANT,
7769 GR_COMBINE_OTHER_TEXTURE);
7770 CA_PRIM ();
7771 A_T1_MUL_PRIMLOD_ADD_T0 ();
7774 static void ac__t0_inter_t1_using_primlod__mul_env ()
7776 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7777 GR_COMBINE_FACTOR_LOCAL,
7778 GR_COMBINE_LOCAL_CONSTANT,
7779 GR_COMBINE_OTHER_TEXTURE);
7780 CA_ENV ();
7781 A_T0_INTER_T1_USING_FACTOR (lod_frac);
7784 static void ac__t1_mul_primlod_add_t0__mul_env ()
7786 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7787 GR_COMBINE_FACTOR_LOCAL,
7788 GR_COMBINE_LOCAL_CONSTANT,
7789 GR_COMBINE_OTHER_TEXTURE);
7790 CA_ENV ();
7791 A_T1_MUL_PRIMLOD_ADD_T0 ();
7794 static void ac__t0_inter_t1_using_primlod__mul_shade ()
7796 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7797 GR_COMBINE_FACTOR_LOCAL,
7798 GR_COMBINE_LOCAL_ITERATED,
7799 GR_COMBINE_OTHER_TEXTURE);
7800 A_T0_INTER_T1_USING_FACTOR (lod_frac);
7803 static void ac__t1_mul_primlod_add_t0__mul_shade ()
7805 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7806 GR_COMBINE_FACTOR_LOCAL,
7807 GR_COMBINE_LOCAL_ITERATED,
7808 GR_COMBINE_OTHER_TEXTURE);
7809 A_T1_MUL_PRIMLOD_ADD_T0 ();
7812 //Added by Gonetz
7813 static void ac__t0_inter_t1_using_prima__mul_env ()
7815 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7816 GR_COMBINE_FACTOR_LOCAL,
7817 GR_COMBINE_LOCAL_CONSTANT,
7818 GR_COMBINE_OTHER_TEXTURE);
7819 CA_ENV ();
7820 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
7821 A_T0_INTER_T1_USING_FACTOR (factor);
7824 //Added by Gonetz
7825 static void ac__t1_inter_t0_using_t0a__mul_prim ()
7827 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7828 GR_COMBINE_FACTOR_LOCAL,
7829 GR_COMBINE_LOCAL_CONSTANT,
7830 GR_COMBINE_OTHER_TEXTURE);
7831 CA_PRIM ();
7832 A_T1_INTER_T0_USING_T0A ();
7835 static void ac__t1_inter_t0_using_prima__mul_env ()
7837 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7838 GR_COMBINE_FACTOR_LOCAL,
7839 GR_COMBINE_LOCAL_CONSTANT,
7840 GR_COMBINE_OTHER_TEXTURE);
7841 CA_ENV ();
7842 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
7843 A_T1_INTER_T0_USING_FACTOR (factor);
7846 //Added by Gonetz
7847 static void ac__t0_inter_t1_using_prima__mul_shade ()
7849 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7850 GR_COMBINE_FACTOR_LOCAL,
7851 GR_COMBINE_LOCAL_ITERATED,
7852 GR_COMBINE_OTHER_TEXTURE);
7853 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
7854 A_T0_INTER_T1_USING_FACTOR (factor);
7857 static void ac__t1_inter_t0_using_prima__mul_shade ()
7859 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7860 GR_COMBINE_FACTOR_LOCAL,
7861 GR_COMBINE_LOCAL_ITERATED,
7862 GR_COMBINE_OTHER_TEXTURE);
7863 BYTE factor = (BYTE)(rdp.prim_color&0xFF);
7864 A_T1_INTER_T0_USING_FACTOR (factor);
7867 static void ac__t0_inter_t1_using_enva__mul_prim ()
7869 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7870 GR_COMBINE_FACTOR_LOCAL,
7871 GR_COMBINE_LOCAL_CONSTANT,
7872 GR_COMBINE_OTHER_TEXTURE);
7873 CA_PRIM ();
7874 BYTE factor = (BYTE)(rdp.env_color&0xFF);
7875 A_T0_INTER_T1_USING_FACTOR (factor);
7878 static void ac__env_sub_one_mul_t1_add_t0__mul_prim ()
7880 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7881 GR_COMBINE_FACTOR_LOCAL,
7882 GR_COMBINE_LOCAL_CONSTANT,
7883 GR_COMBINE_OTHER_TEXTURE);
7884 CA_PRIM ();
7885 if (cmb.combine_ext)
7887 T1ACMBEXT(GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_X,
7888 GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
7889 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
7890 GR_CMBX_ZERO, 0);
7891 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7892 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7893 GR_CMBX_ZERO, 1,
7894 GR_CMBX_ZERO, 0);
7895 SETSHADE_A(0xFF);
7896 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
7897 cmb.tex |= 3;
7899 else
7901 BYTE factor = (BYTE)(rdp.env_color&0xFF);
7902 A_T0_INTER_T1_USING_FACTOR (factor);
7906 static void ac__t0_inter_t1_using_enva__mul_primlod ()
7908 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7909 GR_COMBINE_FACTOR_LOCAL,
7910 GR_COMBINE_LOCAL_CONSTANT,
7911 GR_COMBINE_OTHER_TEXTURE);
7912 CA_PRIMLOD ();
7913 BYTE factor = (BYTE)(rdp.env_color&0xFF);
7914 A_T0_INTER_T1_USING_FACTOR (factor);
7917 static void ac__t0_inter_t1_using_enva__mul_prim_mul_shade ()
7919 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
7920 GR_COMBINE_FACTOR_LOCAL,
7921 GR_COMBINE_LOCAL_ITERATED,
7922 GR_COMBINE_OTHER_TEXTURE);
7923 MULSHADE_PRIM ();
7924 BYTE factor = (BYTE)(rdp.env_color&0xFF);
7925 A_T0_INTER_T1_USING_FACTOR (factor);
7928 //Added by Gonetz
7929 static void ac__t0_inter_t1_using_t0a__mul_prim ()
7931 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7932 GR_COMBINE_FACTOR_LOCAL,
7933 GR_COMBINE_LOCAL_CONSTANT,
7934 GR_COMBINE_OTHER_TEXTURE);
7935 CA_PRIM ();
7936 A_T0_INTER_T1_USING_T0A ();
7939 //Added by Gonetz
7940 static void ac__t0_inter_t1_using_t1a__mul_prim ()
7942 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7943 GR_COMBINE_FACTOR_LOCAL,
7944 GR_COMBINE_LOCAL_CONSTANT,
7945 GR_COMBINE_OTHER_TEXTURE);
7946 CA_PRIM ();
7947 A_T0_INTER_T1_USING_T1A ();
7950 //Added by Gonetz
7951 static void ac__t0_inter_t1_using_shadea__mul_prim ()
7953 if (cmb.combine_ext)
7955 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7956 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
7957 GR_CMBX_CONSTANT_ALPHA, 0,
7958 GR_CMBX_ZERO, 0);
7959 A_T0_INTER_T1_USING_SHADEA ();
7961 else
7963 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7964 GR_COMBINE_FACTOR_LOCAL,
7965 GR_COMBINE_LOCAL_CONSTANT,
7966 GR_COMBINE_OTHER_TEXTURE);
7967 A_T0_INTER_T1_USING_FACTOR (0x7F);
7969 CA_PRIM ();
7972 //Added by Gonetz
7973 static void ac__t0_inter_t1_using_shadea__mul_env ()
7975 if (cmb.combine_ext)
7977 ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
7978 GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
7979 GR_CMBX_CONSTANT_ALPHA, 0,
7980 GR_CMBX_ZERO, 0);
7981 A_T0_INTER_T1_USING_SHADEA ();
7983 else
7985 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7986 GR_COMBINE_FACTOR_LOCAL,
7987 GR_COMBINE_LOCAL_CONSTANT,
7988 GR_COMBINE_OTHER_TEXTURE);
7989 A_T0_INTER_T1_USING_FACTOR (0x7F);
7991 CA_ENV ();
7994 //Added by Gonetz
7995 static void ac__t0_inter_t1_using_enva__mul_shade ()
7997 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
7998 GR_COMBINE_FACTOR_LOCAL,
7999 GR_COMBINE_LOCAL_ITERATED,
8000 GR_COMBINE_OTHER_TEXTURE);
8001 BYTE factor = (BYTE)(rdp.env_color&0xFF);
8002 A_T0_INTER_T1_USING_FACTOR (factor);
8005 //Added by Gonetz
8006 static void ac__t0_inter_t1_using_primlod__mul_shade_add_prim ()
8008 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
8009 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
8010 GR_COMBINE_LOCAL_CONSTANT,
8011 GR_COMBINE_OTHER_ITERATED);
8012 CA_PRIM ();
8013 A_T0_INTER_T1_USING_FACTOR (lod_frac);
8016 //Added by Gonetz
8017 static void ac__t0_inter_t1_using_primlod__mul_env_add__t0_inter_t1_using_primlod ()
8019 if (cmb.combine_ext)
8021 ACMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
8022 GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
8023 GR_CMBX_CONSTANT_ALPHA, 0,
8024 GR_CMBX_B, 0);
8025 CA_ENV ();
8027 else
8029 ACMB (GR_COMBINE_FUNCTION_BLEND,
8030 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
8031 GR_COMBINE_LOCAL_CONSTANT,
8032 GR_COMBINE_OTHER_ITERATED);
8033 SETSHADE_A_ENV ();
8034 CA (0xFF);
8036 A_T0_INTER_T1_USING_FACTOR (lod_frac);
8039 static void ac__t1_sub_one_mul_enva_add_t0__mul_prim ()
8041 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
8042 GR_COMBINE_FACTOR_LOCAL,
8043 GR_COMBINE_LOCAL_CONSTANT,
8044 GR_COMBINE_OTHER_TEXTURE);
8045 CA_PRIM ();
8046 if (cmb.combine_ext)
8048 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
8049 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
8050 GR_CMBX_ZERO, 0,
8051 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
8052 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
8053 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
8054 GR_CMBX_DETAIL_FACTOR, 0,
8055 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
8056 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
8057 cmb.tex |= 3;
8058 cmb.dc0_detailmax = cmb.dc1_detailmax = (float)(rdp.env_color&0xFF) / 255.0f;
8060 else
8062 // (t1-1)*env+t0, (cmb-0)*prim+0
8063 A_T0_MUL_T1 ();
8065 MOD_1 (TMOD_TEX_SCALE_FAC_ADD_FAC);
8066 MOD_1_FAC (rdp.env_color & 0xFF);
8070 static void ac__t1_sub_one_mul_enva_add_t0__mul_shade ()
8072 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
8073 GR_COMBINE_FACTOR_LOCAL,
8074 GR_COMBINE_LOCAL_ITERATED,
8075 GR_COMBINE_OTHER_TEXTURE);
8076 CA_PRIM ();
8077 if (cmb.combine_ext)
8079 T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
8080 GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
8081 GR_CMBX_ZERO, 0,
8082 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
8083 T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
8084 GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
8085 GR_CMBX_DETAIL_FACTOR, 0,
8086 GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
8087 cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | 0xFF ;
8088 percent = (rdp.env_color&0xFF) / 255.0f;
8089 cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
8090 cmb.tex |= 3;
8092 else
8094 BYTE factor = (BYTE)(rdp.env_color&0xFF);
8095 A_T0_INTER_T1_USING_FACTOR (factor);
8099 static void ac_zero_sub_prim_mul_t0_add_prim ()
8101 ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
8102 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
8103 GR_COMBINE_LOCAL_CONSTANT,
8104 GR_COMBINE_OTHER_ITERATED);
8105 SETSHADE_A (0);
8106 CA_PRIM ();
8107 A_USE_T0 ();
8110 static void ac_one_sub_t0_mul_primshade ()
8112 ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
8113 GR_COMBINE_FACTOR_TEXTURE_ALPHA,
8114 GR_COMBINE_LOCAL_ITERATED,
8115 GR_COMBINE_OTHER_NONE);
8116 MULSHADE_A_PRIM ();
8117 A_USE_T0 ();
8120 //****************************************************************
8121 // Combine List
8123 // 3/13/02: I have converted the combine descriptions, now using
8124 // the correct values for each slot, instead of a one-for-all-
8125 // slot version. All of the descriptions marked with 'z' have
8126 // not yet been converted or checked. I have not totally redone
8127 // the modes, because they should be for the most part correct
8128 // as they are, even with the wrong descriptions. [Dave2001]
8129 //****************************************************************
8131 //#define cmb(x) (DWORD)(x)
8132 #define cmb(x) (x)
8133 typedef void (*cmb_func)();
8135 struct cmb_list_entry {
8136 DWORD key; cmb_func func;
8139 static cmb_list_entry color_cmb_list[] = {
8140 // { #CCSTART }
8141 // intro, Aidyn Chronicles. Added by Gonetz
8142 // (0-cmb)*env+cmb, (t1-t0)*0+t0
8143 { 0x05083812, cmb(cc_t0) },
8144 //terminal, Spacestation Silicon Valley. Added by Gonetz
8145 // (0-0)*0+cmb, (0-0)*0+prim
8146 { 0x1fff7fff, cmb(cc_prim) },
8147 //chip in Spacestation Silicon Valley intro. Added by Gonetz
8148 // (0-0)*0+cmb, (prim-0)*shade+0
8149 { 0x1fffe4f3, cmb(cc_prim_mul_shade) },
8150 // car, beetle adventure racing. Added by Gonetz
8151 // (t1-t0)*t0+t0, (cmb-shade)*prima+shade **can work incorrect**
8152 { 0x21128a40, cmb(cc__t0_inter_t1_using_t0__sub_shade_mul_prima_add_shade) },
8153 // Treasure opening, zelda
8154 // (t1-prim)*t0+t0, (prim-env)*cmb+env
8155 { 0x2132a053, cmb(cc_prim_sub_env_mul__t1_sub_prim_mul_t0_add_t0__add_env) },
8156 // Water, doubut no mori
8157 // (t1-0)*t0+t0, (prim-0)*shade+cmb
8158 { 0x21f204f3, cmb(cc__t1_mul_t0_add_t0__add_prim_mul_shade) },
8159 // enemy transparent, paper mario. Addd by Gonetz
8160 // (t1-t0)*t1+t0, (env-prim)*cmb+prim
8161 { 0x22126035, cmb(cc_env_sub_prim_mul__t0_inter_t1_using_t1__add_prim) },
8162 // snowhead temple, zelda 2. Addd by Gonetz
8163 // (t1-t0)*t1+t0, (cmb-0)*shade+prim
8164 { 0x221264f0, cmb(cc__t0_inter_t1_using_t1__mul_shade_add_prim) },
8165 // snowhead temple entrance, zelda 2. Addd by Gonetz
8166 // (t1-t0)*t1+t0, (cmb-0)*prim+shade
8167 { 0x221283f0, cmb(cc__t0_inter_t1_using_t1__mul_prim_add_shade) },
8168 // teleportation, Spacestation Silicon Valley. Added by Gonetz
8169 // (t1-t0)*t1+t0, (prim-env)*cmb+env
8170 { 0x2212a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_t1__add_env) },
8171 // Some gannon spell, zelda
8172 // (t1-0)*t1+t0, (prim-0)*cmb+0
8173 { 0x22f2e0f3, cmb(cc__t1_mul_t1_add_t0__mul_prim) },
8174 // battle tanks 2 [Ogy]
8175 // (1-0)*t1+t0, (env-prim)*cmb+prim
8176 { 0x22f66035, cmb(cc_env_sub_prim_mul__t0_add_t1__add_prim) },
8177 // GASP Fighters
8178 // (1-0)*t1+t0, (shade-0)*cmb+0
8179 { 0x22f6e0f4, cmb(cc__t0_add_t1__mul_shade) },
8180 // parts of a car, F1 World Grand Prix. Added by Gonetz
8181 // (1-0)*t1+t0, (cmb-0)*shade+0
8182 { 0x22f6e4f0, cmb(cc__t0_add_t1__mul_shade) },
8183 // ???, zelda
8184 // (noise-0)*t1+t0, (prim-env)*cmb+env
8185 { 0x22f7a053, cmb(cc_prim_sub_env_mul__t0_add_t1__add_env) },
8186 // flashing arrow over buoy, wave race. Added by Gonetz
8187 // (t1-t0)*prim+t0, (env-cmb)*enva+cmb ** INC **
8188 { 0x23120c05, cmb(cc__t0_inter_t1_using_prim__inter_env_using_enva) },
8189 // ground, zelda2. Added by Gonetz
8190 // (t1-t0)*prim+t0, (cmb-0)*shade+0
8191 { 0x2312e4f0, cmb(cc__t0_inter_t1_using_prim__mul_shade) },
8192 // wwf rules
8193 // (env-t0)*prim+t0
8194 { 0x23152315, cmb(cc_t0_inter_env_using_prim) },
8195 // Paper Mario
8196 // (1-t0)*prim+t0, (1-t0)*t0+cmb ** INC **
8197 { 0x23160116, cmb(cc_t0_add_prim_mul_one_sub_t0_add_t0) },
8198 // intro, castlevania. Added by Gonetz
8199 // (1-t0)*prim+t0
8200 { 0x23162316, cmb(cc_one_sub_t0_mul_prim_add_t0) },
8201 // Explosions, aerofighter's assault
8202 // (1-t0)*prim+t0, (shade-0)*cmb+0
8203 { 0x2316e0f4, cmb(cc_t0_mul_shade) },
8204 //beetle adventure racing. Added by Gonetz
8205 // (1-t0)*prim+t0, (cmb-0)*shade+0 **INC**
8206 { 0x2316e4f0, cmb(cc_one_sub_t0_mul_prim_mul_shade) },
8207 // Unknown player background, smash bros
8208 // (noise-t0)*prim+t0 ** INC **
8209 // 0x23172317, cmb(cc_t0),
8210 { 0x23172317, cmb(cc_t0_inter_noise_using_prim) },
8211 // paper mario. Added by Gonetz
8212 // (noise-prim)*prim+t0 ** INC **
8213 { 0x23372337, cmb(cc_t0_add_prim) },
8214 // strange mirror in stone temple, zelda 2. Added by Gonetz
8215 // (prim-env)*prim+t0, (cmb-0)*prim+0 ** INC **
8216 { 0x2353e3f0, cmb(cc__prim_sub_env_mul_prim_add_t0__mul_prim) },
8217 // Gilded sword, zelda 2. Added by Gonetz
8218 // (shade-env)*prim+t0, (cmb-0)*shade+env ** INC **
8219 { 0x2354a4f0, cmb(cc__t0_add_prim_mul_shade__mul_shade_add_env) },
8220 // Razor sword, zelda 2. Added by Gonetz
8221 // (shade-env)*prim+t0, (cmb-0)*shade+0 ** INC **
8222 { 0x2354e4f0, cmb(cc__t0_add_prim_mul_shade__mul_shade) },
8223 // menu, Mischief Makers. Added by Gonetz
8224 // (0-env)*prim+t0, (cmb-0)*shade+0
8225 { 0x235f235f, cmb(cc_t0_sub__prim_mul_env) },
8226 // Deadly Arts logo. Added by Gonetz
8227 // (t0-0)*prim+t0
8228 { 0x23f123f1, cmb(cc_t0_mul_prim) },
8229 // pokemon attack, Pokemon Stadium 2. Added by Gonetz
8230 // (shade-0)*prim+t0, (cmb-0)*shade+0 ** INC **
8231 { 0x23f4e4f0, cmb(cc_t0_mul_shade) },
8232 // Mischief Makers logo. Added by Gonetz
8233 // (env-0)*prim+t0
8234 { 0x23f523f5, cmb(cc_prim_mul_env_add_t0) },
8235 // Taken out bomb, zelda
8236 // (1-0)*prim+t0
8237 { 0x23f623f6, cmb(cc_t0_add_prim) },
8238 // Jabu-Jabu's Belly, zelda
8239 // (noise-0)*prim+t0
8240 { 0x23f723f7, cmb(cc_t0_add_prim) },
8241 // carmagedon
8242 // (0-0)*prim+t0
8243 { 0x23ff23ff, cmb(cc_t0) },
8244 // water, diddy kong racing. Added by Gonetz
8245 // (t1-t0)*shade+t0, (env-cmb)*env_a+cmb **INC**
8246 { 0x24120c05, cmb(cc__t0_inter_t1_using_shade__inter_env_using_enva) },
8247 // ground, f-zero x
8248 // (prim-t0)*shade+t0 ** INC **
8249 { 0x24132413, cmb(cc__one_sub_prim_mul_shade__mul_t0_add__prim_mul_shade) },
8250 // intro, F1 Racing Championship. Added by Gonetz
8251 // (env-t0)*shade+t0 ** INC *
8252 { 0x24152415, cmb(cc_one_sub_t0_mul_shade_add_t0) },
8253 // Sky, pilotwings
8254 // (1-t0)*shade+t0
8255 { 0x24162416, cmb(cc_one_sub_t0_mul_shade_add_t0) },
8256 // zelda 2 [Ogy]. Added by Gonetz
8257 // (prim-env)*shade+t0, (prim-prim)*shade+cmb ** INC ** ?
8258 { 0x24530433, cmb(cc_prim_sub_env_mul_shade_add_t0) },
8259 // waves, Dr. Mario
8260 // (0-center)*shade+t0
8261 { 0x246f246f, cmb(cc_t0_sub_shade) },
8262 // lums, Rayman2. Added by Gonetz
8263 // (t0-0)*shade+t0 ** INC **
8264 { 0x24f124f1, cmb(cc_t0) }, //this one works better
8265 // 0x24f124f1, cmb(cc_t0_mul_shade),
8266 // Goemon, mystical ninja. Added by Gonetz
8267 // (prim-0)*shade+t0
8268 { 0x24f324f3, cmb(cc_t0_add_prim_mul_shade) },
8269 // Sky, waverace
8270 //z (t1-t0)*env+t0 ** INC **
8271 { 0x25122512, cmb(cc_t0_inter_t1_using_env) },
8272 // Rare logo, Jet Force. Added by Gonetz
8273 // (t1-t0)*env+t0, (cmb-0)*prim+0 ** INC **
8274 { 0x2512e3f0, cmb(cc__t0_inter_t1_using_enva__mul_prim) },
8275 // ridge recer, unimp log. Added by Gonetz
8276 // (t1-t0)*env+t0, (cmb-0)*shade+0 ** INC **
8277 { 0x2512e4f0, cmb(cc__t0_inter_t1_using_env__mul_shade) },
8278 // menu, Mischief Makers. Added by Gonetz
8279 //(prim-t0)*env+t0 ** INC **
8280 { 0x25132513, cmb(cc_one_sub_env_mul_t0_add_prim_mul_env) },
8281 // Battle border, quest64
8282 // (1-t0)*env+t0
8283 { 0x25162516, cmb(cc_one_sub_env_mul_t0_add_env) },
8284 // Paper Mario
8285 // (noise-t0)*env+t0
8286 { 0x25172517, cmb(cc_t0_inter_noise_using_env) },
8287 // the lamp in the bomb shop in town, zelda 2 [Ogy]. Added by Gonetz
8288 // (t0-t1)*env+t0, (1-env)*prim+cmb ** INC **
8289 { 0x25210356, cmb(cc_one_sub_env_mul_prim_add__t0_inter_t1_using_env) },
8290 // Darmani's necklace, zelda 2 [Ogy]. Added by Gonetz
8291 // (prim-shade)*env+t0, (cmb-0)*shade+0 ** INC **
8292 { 0x2543e4f0, cmb(cc_t0_mul_shade_add_prim_mul_env) },
8293 // 0x2543e4f0, cmb(cc_t0_mul_shade),
8294 // mystical ninja. Added by Gonetz
8295 // (1-0)*env+t0
8296 { 0x25f625f6, cmb(cc_t0_add_env) },
8297 // smoke, Starshot. Added by Gonetz
8298 // (1-0)*env+t0, (1-0)*cmb+0
8299 { 0x25f6e0f6, cmb(cc_t0_add_env) },
8300 // mega shock, Paper Mario. Added by Gonetz
8301 // (t1-0)*scale+t0, (env-center)*cmb+prim
8302 { 0x26f26065, cmb(cc__t0_add_t1__mul_env_add_prim) },
8303 // character select, Duck Dodgers. Added by Gonetz
8304 // (prim-t0)*t0_alpha+t0, (cmb-0)*shade+0 **INC**
8305 { 0x2813e4f0, cmb(cc__t0_inter_prim_using_t0a__mul_shade) },
8306 // intro, Duck Dodgers. Added by Gonetz
8307 // (shade-t0)*t0_alpha+t0 **INC**
8308 { 0x28142814, cmb(cc_t0) },
8309 // F1 World Grand Prix. Added by Gonetz
8310 // (prim-0)*t0_a+t0, (cmb-0)*shade+0 ** INC **
8311 { 0x28f3e4f0, cmb(cc__t0a_mul_prim_add_t0__mul_shade) },
8312 // battle tanks 2 [Ogy]
8313 // (env-0)*t0_a+t0, (cmb-0)*shade+0
8314 { 0x28f5e4f0, cmb(cc__t0a_mul_env_add_t0__mul_shade) },
8315 // blastcorps, unimp log. Added by Gonetz
8316 // (t1-t0)*t1_alpha+t0
8317 { 0x29122912, cmb(cc_t0_inter_t1_using_t1a) },
8318 // paper mario. Added by Gonetz
8319 // (t1-t0)*t1_alpha+t0, (cmb-env)*env_a+env
8320 { 0x2912ac50, cmb(cc__t0_inter_t1_using_t1a__sub_env_mul_enva_add_env) },
8321 // Rally 2000. Added by Gonetz
8322 // (t1-t0)*t1_alpha+t0, (cmb-0)*shade+0
8323 { 0x2912e4f0, cmb(cc__t0_inter_t1_using_t1a__mul_shade) },
8324 // ??? in zelda ending, zelda
8325 // (1-0)*t1_alpha+t0, (prim-env)*cmb+env
8326 { 0x29f6a053, cmb(cc_prim_sub_env_mul__t0_add_t1a__add_env) },
8327 // Sky, zelda
8328 //z (t1-t0)*prim_a+t0
8329 { 0x2a122a12, cmb(cc_t0_inter_t1_using_prima) },
8330 // battle tanks [Ogy]
8331 // (t1-t0)*prim_a+t0, (env-prim)*cmb+prim
8332 { 0x2a126035, cmb(cc_env_sub_prim_mul__t0_inter_t1_using_prima__add_prim) },
8333 // clothes, zelda 2. Added by Gonetz
8334 // (t1-t0)*prim_a+t0, (prim-env)*cmb+env
8335 { 0x2a12a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_prima__add_env) },
8336 // flame, Doraemon 2. Added by Gonetz
8337 // (t1-t0)*prim_a+t0, (cmb-0)*prim+0
8338 { 0x2a12e3f0, cmb(cc__t0_inter_t1_using_prima__mul_prim) },
8339 // logo, PD. Added by Gonetz
8340 // (t1-t0)*prim_a+t0, (cmb-0)*shade+0
8341 { 0x2a12e4f0, cmb(cc__t0_inter_t1_using_prima__mul_shade) },
8342 // 1080 snowboarding [Ogy] - 7/03/02 fixed by Dave2001. 15 Mar 2005 fixed by Gonetz.
8343 // (prim-t0)*prim_a+t0
8344 { 0x2a132a13, cmb(cc_t0_inter_prim_using_prima) },
8345 // menu background, Paper Mario
8346 // (prim-t0)*prim_a+t0, (prim-t1)*prim_a+t1
8347 { 0x2a134a23, cmb(cc_t0_inter_prim_using_prima) },
8348 // 0x2a134a23, cmb(cc_t0),
8349 // Mickey USA
8350 // (prim-t0)*prim_a+t0, (cmb-0)*shade+0 ** INC **
8351 { 0x2a13e4f0, cmb(cc_t0_mul_shade) },
8352 // gunfire, Sin and Punishmen. Added by Gonetz
8353 // (env-t0)*prima+t0 **INC**
8354 { 0x2a152a15, cmb(cc_t0_inter_env_using_prima) },
8355 // Mystical Ninja
8356 // (0-t0)*prima+t0, (prim-env)*cmb+env ** INC **
8357 { 0x2a1fa053, cmb(cc_prim_sub_env_mul__t0_sub_t0_mul_prima__add_env) },
8358 // arena, Pokemon Stadium 2. Added by Gonetz
8359 // (shade-prim)*prim_a+t0 ** INC **
8360 { 0x2a342a34, cmb(cc_t0_mul_shade) },
8361 // Paper Mario
8362 // (t1-k4)*prim_a+t0, (t1-k4)*cmb_a+cmb ** INC **
8363 { 0x2a720772, cmb(cc_t0_add_t1) },
8364 // GASP Fighters. Added by Gonetz
8365 // (t0-0)*prim_a+t0, (cmb-center)*scale+0 ** INC **
8366 { 0x2af1e660, cmb(cc_t0_mul_prima) },
8367 // F1 World Grand Prix. Added by Gonetz
8368 // (t1-0)*prim_a+t0, (cmb-0)*shade+env
8369 { 0x2af2a4f0, cmb(cc__t1_mul_prima_add_t0__mul_shade_add_env) },
8370 // tidal wave, Paper Mario. Added by Gonetz
8371 // (prim-0)*prim_a+t0
8372 { 0x2af32af3, cmb(cc_prim_mul_prima_add_t0) },
8373 //Spacestation Silicon Valley intro. Added by Gonetz
8374 // (t1-t0)*shade_alpha+t0, (prim-shade)*cmb+shade ** INC **
8375 { 0x2b128043, cmb(cc_prim_sub_shade_mul__t0_inter_t1_using_shadea__add_shade) },
8376 // water, Rocket Robot in Wheels
8377 // (t1-t0)*shade_alpha+t0, (env-shade)*cmb+shade ** INC **
8378 { 0x2b128045, cmb(cc_env_sub_shade_mul__t0_inter_t1_using_shadea__add_shade) },
8379 // arena, Pokemon Stadium 2
8380 // (t1-t0)*shade_alpha+t0, (cmb-prim)*env+shade ** INC **
8381 { 0x2b128530, cmb(cc__t0_inter_t1_using_shadea__sub_prim_mul_env_add_shade) },
8382 // Rocket Robot in Wheels intro
8383 // (t1-t0)*shade_a+t0, (shade-0)*cmb+0 ** INC **
8384 { 0x2b12e0f4, cmb(cc__t0_inter_t1_using_shadea__mul_shade) },
8385 // water, Mickey USA
8386 // (t1-t0)*shade_a+t0, (cmb-0)*shade+0 ** INC **
8387 { 0x2b12e4f0, cmb(cc__t0_inter_t1_using_shadea__mul_shade) },
8388 // Extreme G. Added by Gonetz
8389 // (shade-t0)*shade_alpha+t0
8390 { 0x2b142b14, cmb(cc_shade_sub_t0_mul_shadea_add_t0) },
8391 // Jet Force Gemini. Added by Gonetz
8392 // (shade-t0)*shade_alpha+t0, (cmb-0)*prim+0 ** INC **
8393 { 0x2b14e3f0, cmb(cc_t0_mul_prim_add_shade_mul_shadea_mul_prim) },
8394 // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
8395 // (t1-0)*shade_alpha+t0, (prim-env)*cmb+env ** INC **
8396 { 0x2bf2a053, cmb(cc_prim_sub_env_mul__t0_add_t1__add_env) },
8397 // pads, Pokemon Stadium 2. Added by Gonetz
8398 // (0-0)*shade_alpha+t0, (prim-env)*cmba+env
8399 { 0x2bffa753, cmb(cc_prim_sub_env_mul_t0a_add_env) },
8400 // paper mario. Added by Gonetz
8401 // (t1-t0)*env_a+t0, (1-cmb)*prim+cmb
8402 { 0x2c120306, cmb(cc_one_sub__t0_inter_t1_using_enva__mul_prim_add__t0_inter_t1_using_enva) },
8403 // Amoeba boss, water temple, zelda
8404 // (t1-t0)*env_a+t0, (cmb-env)*prim+t0 ** INC **
8405 { 0x2c122350, cmb(cc__t0_inter_t1_using_enva__sub_env) },
8406 // paper mario. Added by Gonetz
8407 // (t1-t0)*env_a+t0
8408 { 0x2c122c12, cmb(cc_t0_inter_t1_using_enva) },
8409 // paper mario. Added by Gonetz
8410 // (t1-t0)*env_a+t0, (1-prim)*cmb+prim
8411 { 0x2c126036, cmb(cc_one_sub_prim_mul__t0_inter_t1_using_enva__add_prim) },
8412 // water, jet force. Added by Gonetz
8413 // (t1-t0)*env_a+t0, (prim-shade)*cmb+shade
8414 { 0x2c128043, cmb(cc_prim_sub_shade_mul__t0_inter_t1_using_enva__add_shade) },
8415 // Faries, zelda
8416 //z (t1-t0)*env_a+t0, (prim-env)*cmb+env
8417 { 0x2c12a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env) },
8418 // paper mario. Added by Gonetz
8419 // (t1-t0)*env_a+t0, (prim-center)*cmb+env
8420 { 0x2c12a063, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env) },
8421 // pads, Pokemon Stadium 2. Added by Gonetz
8422 // (t1-t0)*env_a+t0, (cmb-prim)*shade+env ** INC **
8423 { 0x2c12a430, cmb(cc__t0_inter_t1_using_enva__mul_shade_add_env) },
8424 // Scary dead thing boss, zelda
8425 // (t1-t0)*env_a+t0, (cmb-t1)*cmb_a+env
8426 { 0x2c12a720, cmb(cc__t0_inter_t1_using_enva__mul_env) },
8427 // something in a menu, PokemonStadium2, [Raziel64]
8428 // (t1-t0)*env_a+t0, (prim-env)*cmb_a+env
8429 { 0x2c12a753, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_enva_alpha__add_env) },
8430 // Water in zora's place, zelda
8431 // (t1-t0)*env_a+t0, (cmb-0)*prim+0
8432 { 0x2c12e3f0, cmb(cc__t0_inter_t1_using_enva__mul_prim) },
8433 // Ground, zelda
8434 //z (t1-t0)*env_a+t0, (cmb-k5)*shade+cmb_a
8435 { 0x2c12e4f0, cmb(cc__t0_inter_t1_using_enva__mul_shade) },
8436 // zelda, uninmp log. Added by Gonetz
8437 //(t1-t0)*env_a+t0, (cmb-0)*env+0
8438 { 0x2c12e5f0, cmb(cc__t0_inter_t1_using_enva__mul_env) },
8439 // Spheres, waverace
8440 //z (env-t0)*env_a+t0
8441 { 0x2c152c15, cmb(cc_t0_inter_env_using_enva) },//cmb(cc_t0) },
8442 // backgrounds, Mario Golf. Added by Gonetz
8443 // (env-t0)*env_a+t0, (shade-0)*cmb+0
8444 { 0x2c15e0f4, cmb(cc__t0_inter_env_using_enva__mul_shade) },
8445 // ground on Volcano level, DKR, [Raziel64]
8446 // (env-t0)*env_a+t0, (cmb-0)*shade+0
8447 { 0x2c15e4f0, cmb(cc__t0_inter_env_using_enva__mul_shade) },
8448 // Nintendo 'N', zelda
8449 //z (t0-prim)*env_a+t0, (prim-env)*cmb+env
8450 { 0x2c31a053, cmb(cc_prim_sub_env_mul__t0_sub_prim_mul_enva_add_t0__add_env) },
8451 // Nintendo title & saria's song, zelda
8452 //z (t1-prim)*env_a+t0, (prim-env)*cmb+env
8453 { 0x2c32a053, cmb(cc_prim_sub_env_mul__t1_sub_prim_mul_enva_add_t0__add_env) },
8454 // Hover boots flying, zelda
8455 // (t1-prim)*env_a+t0, (prim-0)*cmb+env
8456 { 0x2c32a0f3, cmb(cc__t1_sub_prim_mul_enva_add_t0__mul_prim_add_env) },
8457 // star beam, paper mario
8458 // (prim-env)*env_a+t0
8459 { 0x2c532c53, cmb(cc_prim_sub_env_mul_enva_add_t0) },
8460 // Kotake & koume's hair, zelda
8461 // (t1-0)*env_a+t0, (prim-env)*cmb+env
8462 { 0x2cf2a053, cmb(cc_prim_sub_env_mul__t1_mul_enva_add_t0__add_env) },
8463 //Goldeneye, [Jeremy]. Added by Gonetz
8464 // (t0-t0)*lodf+t0, (cmb-0)*prim+0
8465 { 0x2d11e3f0, cmb(cc_t0_mul_prim) },
8466 // Indy Racing 2000. Added by Gonetz
8467 // (t1-t0)*lodf+t0, (env-cmb)*prima+cmb ** INC **
8468 { 0x2d120a05, cmb(cc_t0_inter_t1_using_primlod) },
8469 // (t1-t0)*lodf+t0
8470 { 0x2d122d12, cmb(cc_t0_inter_t1_using_primlod) },
8471 //broken wall, beetle adventure racing. Added by Gonetz
8472 // (t1-t0)*lodf+t0, (shade-prim)*cmb+prim
8473 { 0x2d126034, cmb(cc_shade_sub_prim_mul__t0_inter_t1_using_primlod__add_prim) },
8474 //Intro, CBFD. Added by Gonetz
8475 // (t1-t0)*lodf+t0, (shade-env)*cmb+prim
8476 // 0x2d126054, cmb(cc_shade_sub_env_mul_t0_add_prim) },
8477 { 0x2d126054, cmb(cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_prim) },
8478 // bassmasters 2000 [Ogy]
8479 // (t1-t0)*lodf+t0, (env-0)*cmb+prim ** INC **
8480 { 0x2d1260f5, cmb(cc_t0_mul_env_add_prim) },
8481 // sign, CBFD. Added by Gonetz
8482 // (t1-t0)*lodf+t0, (cmb-env)*shade+prim ** INC **
8483 { 0x2d126450, cmb(cc_t0_sub_env_mul_shade_add_prim) },
8484 // landscape, Cruis'n Exotica. Added by Gonetz
8485 // (t1-t0)*lodf+t0, (cmb-0)*shade+prim
8486 { 0x2d1264f0, cmb(cc__t0_inter_t1_using_primlod__mul_shade_add_prim) },
8487 // blast corps [Ogy]
8488 // (t1-t0)*lodf+t0, (0-0)*0+shade
8489 { 0x2d129fff, cmb(cc__t0_inter_t1_using_primlod__mul_shade) },
8490 // End of level, zelda
8491 // (t1-t0)*lodf+t0, (prim-env)*cmb+env
8492 { 0x2d12a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env) },
8493 // Rocket Robot in Wheels intro
8494 // (t1-t0)*lodf+t0, (shade-env)*cmb+env
8495 { 0x2d12a054, cmb(cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_env) },
8496 // basket, Fox Sport
8497 // (t1-t0)*lodf+t0, (prim-env)*t0+env
8498 { 0x2d12a153, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env) },
8499 // paper mario. Added by Gonetz
8500 // (t1-t0)*lodf+t0, (cmb-0)*prim+env ** INC **
8501 { 0x2d12a3f0, cmb(cc__t0_inter_t1_using_primlod__mul_prim_add_env) },
8502 // Tony Hawk Pro Skater
8503 // (t1-t0)*lodf+t0, (cmb-0)*shade+env
8504 { 0x2d12a4f0, cmb(cc__t0_inter_t1_using_primlod__mul_shade_add_env) },
8505 // part of a building, Spiderman. Added by Gonetz
8506 // (t1-t0)*lodf+t0, (cmb-env)*cmba+env ** INC **
8507 { 0x2d12a750, cmb(cc_t0_inter_t1_using_primlod) },
8508 // Mike Piazza's Strike Zone
8509 // (t1-t0)*lodf+t0, (shade-prim)*cmb+0
8510 { 0x2d12e034, cmb(cc_shade_sub_prim_mul__t0_inter_t1_using_primlod) },
8511 // intro, F1 Racing Championship. Added by Gonetz
8512 // (t1-t0)*lodf+t0, (shade-env)*cmb+0
8513 { 0x2d12e054, cmb(cc_shade_sub_env_mul__t0_inter_t1_using_primlod) },
8514 // stands, F1 Racing Championship. Added by Gonetz
8515 // (t1-t0)*lodf+t0, (1-env)*cmb+0
8516 { 0x2d12e056, cmb(cc_one_sub_env_mul__t0_inter_t1_using_primlod) },
8517 // court, Mario Tennis. Added by Gonetz
8518 // (t1-t0)*lodf+t0, (prim-0)*cmb+0
8519 { 0x2d12e0f3, cmb(cc__t0_inter_t1_using_primlod__mul_prim) },
8520 // Rocket Robot in Wheels intro
8521 // (t1-t0)*lodf+t0, (shade-0)*cmb+0
8522 { 0x2d12e0f4, cmb(cc__t0_inter_t1_using_primlod__mul_shade) },
8523 // cars wheels, SF Rush 2049. Added by Gonetz
8524 // (t1-t0)*lodf+t0, (cmb-0)*prim+0
8525 { 0x2d12e3f0, cmb(cc__t0_inter_t1_using_primlod__mul_prim) },
8526 // Bridge, sf rush
8527 // (t1-t0)*lodf+t0, (cmb-0)*shade+0
8528 { 0x2d12e4f0, cmb(cc__t0_inter_t1_using_primlod__mul_shade) },
8529 // blast corps [Ogy]
8530 // (t1-t0)*lodf+t0, (t0-0)*shade+0
8531 { 0x2d12e4f1, cmb(cc_t0_mul_shade) },
8532 // field, Mike Piazza's Strike Zone
8533 // (t1-t0)*lodf+t0, (cmb-prim)*env+0 ** INC **
8534 { 0x2d12e530, cmb(cc__t0_inter_t1_using_primlod__mul_env) },
8535 // radar, Perfect Dark
8536 // (t1-t0)*lodf+t0, (cmb-0)*env+0
8537 { 0x2d12e5f0, cmb(cc__t0_inter_t1_using_primlod__mul_env) },
8538 // planet, Blast Corps
8539 // (t1-t0)*lodf+t0, (cmb-0)*prima+0
8540 { 0x2d12eaf0, cmb(cc__t0_inter_t1_using_primlod__mul_prima) },
8541 // zelda 2. Added by Gonetz
8542 // (t0-t0)*primlod+t0, (prim-env)*cmb+env
8543 { 0x2e11a053, cmb(cc_prim_sub_env_mul_t0_add_env) },
8544 // zelda 2. Added by Gonetz
8545 // (t1-t0)*primlod+t0, (0-0)*shade+cmb
8546 { 0x2e1204ff, cmb(cc_t0_inter_t1_using_primlod) },
8547 // zelda 2. Added by Gonetz
8548 // (t1-t0)*primlod+t0, (env-prim)*primlod+cmb
8549 { 0x2e120d35, cmb(cc_prim_sub_env_mul_primlod_add__t0_inter_t1_using_primlod) },
8550 // lamppost, Ridge Racer. Added by Gonetz
8551 // (t1-t0)*primlod+t0
8552 { 0x2e122e12, cmb(cc_t0_inter_t1_using_primlod) },
8553 // Hearts, zelda
8554 //z (t1-t0)*primlod+t0, (shade-prim)*cmb+prim
8555 { 0x2e126034, cmb(cc_shade_sub_prim_mul__t0_inter_t1_using_primlod__add_prim) },
8556 // Sunny Day, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
8557 // (t1-t0)*primlod+t0, (env-prim)*cmb+prim
8558 { 0x2e126035, cmb(cc_env_sub_prim_mul__t0_inter_t1_using_primlod__add_prim) },
8559 // snowhead temple, zelda 2. Added by Gonetz
8560 // (t1-t0)*primlod+t0, (cmb-env)*shade+prim ** INC **
8561 { 0x2e126450, cmb(cc__t0_inter_t1_using_primlod__mul_shade_add_prim) },
8562 // snow on a wall, snowhead temple, zelda 2. Added by Gonetz
8563 // (t1-t0)*primlod+t0, (cmb-0)*shade+prim
8564 { 0x2e1264f0, cmb(cc__t0_inter_t1_using_primlod__mul_shade_add_prim) },
8565 // Morning Sun, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
8566 // (t1-t0)*primlod+t0, (cmb-0)*0+prim ** INC **?
8567 { 0x2e127ff0, cmb(cc_prim) },
8568 // arena, Pokemon Stadium 2. Added by Gonetz
8569 // (t1-t0)*primlod+t0, (cmb-prim)*shade+shade ** INC **
8570 { 0x2e128430, cmb(cc__t0_inter_t1_using_primlod__mul_shade) },
8571 // Pokemon Stadium 2. Added by Gonetz
8572 // (t1-t0)*primlod+t0, (cmb-env)*cmb+env ** INC **
8573 { 0x2e12a050, cmb(cc_t0_inter_t1_using_primlod) },
8574 // End of level heart, zelda
8575 // (t1-t0)*primlod+t0, (prim-env)*cmb+env
8576 { 0x2e12a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env) },
8577 // Huge turtle appearance, zelda 2. Added by Gonetz
8578 // (t1-t0)*primlod+t0, (1-env)*cmb+env
8579 { 0x2e12a056, cmb(cc_one_sub_env_mul__t0_inter_t1_using_primlod__add_env) },
8580 // frozen octorok, zelda 2. Added by Gonetz
8581 // (t1-t0)*primlod+t0, (prim-env)*t1+env
8582 { 0x2e12a253, cmb(cc_prim_sub_env_mul_t1_add_env) },
8583 // fall headwaters, zelda 2. Added by Gonetz
8584 // (t1-t0)*primlod+t0, (cmb-env)*shade+env ** INC **
8585 { 0x2e12a450, cmb(cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_env) },
8586 // zelda 2. Added by Gonetz
8587 // (t1-t0)*primlod+t0, (cmb-0)*t1+0 ** INC ** ?
8588 { 0x2e12e2f0, cmb(cc_t0_inter_t1_using_primlod) },
8589 // zelda 2. Added by Gonetz
8590 // (t1-t0)*primlod+t0, (cmb-0)*prim+0
8591 { 0x2e12e3f0, cmb(cc__t0_inter_t1_using_primlod__mul_prim) },
8592 // sky, PGA European Tour
8593 // (t1-t0)*primlod+t0, (cmb-env)*shade+0 ** INC **
8594 { 0x2e12e450, cmb(cc__t0_inter_t1_using_primlod__mul_shade) },
8595 // Kirby's pool, smash bros
8596 // (t1-t0)*primlod+t0, (cmb-0)*shade+0
8597 { 0x2e12e4f0, cmb(cc__t0_inter_t1_using_primlod__mul_shade) },
8598 //Spacestation Silicon Valley intro. Added by Gonetz
8599 // (prim-t0)*primlod+t0, (cmb-0)*shade+0 **INC**
8600 { 0x2e132e13, cmb(cc_t0_inter_prim_using_primlod) },
8601 // explosions, daikatana. Added by Gonetz
8602 // (prim-t0)*primlod+t0, (cmb-0)*shade+0 **INC**
8603 { 0x2e13e4f0, cmb(cc_t0_mul_shade) },
8604 //Mike Piazza's Strike Zone logo. Added by Gonetz
8605 // (shade-t0)*primlod+t0
8606 { 0x2e142e14, cmb(cc_t0_inter_shade_using_primlod) },
8607 // Cartridge color (transfer pak) }, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
8608 // (1-t0)*primlod+t0
8609 { 0x2e162e16, cmb(cc_one_sub_t0_mul_primlod_add_t0) },
8610 // pokemon attack, Pokemon Stadium 2. Added by Gonetz
8611 // (1-t0)*primlod+t0, (prim-0)*cmb+0 **INC**
8612 { 0x2e16e0f3, cmb(cc_t0_mul_prim) },
8613 // zelda 2. Added by Gonetz
8614 // (t1-t1)*primlod+t0, (prim-env)*cmb+env
8615 { 0x2e22a053, cmb(cc_prim_sub_env_mul_t0_add_env) },
8616 // Shadow Ball, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
8617 // (0-t1)*primlod+t0, (prim-env)*cmb+env ** INC **
8618 { 0x2e2fa053, cmb(cc_prim_sub_env_mul_t0_add_env) },
8619 // Skulltula coin solid, zelda
8620 // (t0-prim)*primlod+t0, (prim-env)*cmb+env
8621 { 0x2e31a053, cmb(cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t0__add_env) },
8622 // Triforce lines, zelda
8623 // (t1-prim)*primlod+t0, (prim-shade)*cmb+shade
8624 { 0x2e328043, cmb(cc_prim_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade) },
8625 // moon when majora defeated, zelda 2. Added by Gonetz
8626 // (t1-prim)*primlod+t0, (1-shade)*cmb+shade
8627 { 0x2e328046, cmb(cc_one_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade) },
8628 // Fire, zelda
8629 //z (t1-prim)*primlod+t0, (prim-env)*cmb+env ** INC **
8630 { 0x2e32a053, cmb(cc_prim_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env) },
8631 // zelda 2 [Ogy]. Added by Gonetz
8632 // (t1-prim)*primlod+t0, (shade-env)*cmb+env
8633 { 0x2e32a054, cmb(cc_shade_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env) },
8634 // Scary face, pokemon stadium 2
8635 // (t1-prim)*primlod+t0, (1-env)*cmb+env
8636 { 0x2e32a056, cmb(cc_one_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env) },
8637 // zelda 2. Added by Gonetz
8638 // (t1-prim)*primlod+t0, (prim-0)*cmb+env
8639 { 0x2e32a0f3, cmb(cc__t1_sub_prim_mul_primlod_add_t0__mul_prim_add_env) },
8640 // zelda 2. Added by Gonetz
8641 // (t1-0)*primlod+t0, (prim-env)*cmb+env
8642 { 0x2ef2a053, cmb(cc_prim_sub_env_mul__t1_mul_primlod_add_t0__add_env) },
8643 // zelda 2. Added by Gonetz
8644 // (t1-0)*primlod+t0, (cmb-0)*prim+0
8645 { 0x2ef2e3f0, cmb(cc__t1_mul_primlod_add_t0__mul_prim) },
8646 // zelda 2. Added by Gonetz
8647 // (t1-0)*primlod+t0, (cmb-0)*env+0
8648 { 0x2ef2e5f0, cmb(cc__t1_mul_primlod_add_t0__mul_env) },
8649 // gun, Doom64. Added by Gonetz
8650 // (1-0)*primlod+t0, (cmb-0)*prim+env
8651 { 0x2ef6a3f0, cmb(cc__t0_add_primlod__mul_prim_add_env) },
8652 // walls, Doom64. Added by Gonetz
8653 // (1-0)*primlod+t0, (cmb-0)*shade+env
8654 { 0x2ef6a4f0, cmb(cc__t0_add_primlod__mul_shade_add_env) },
8655 // Pokemon Stadium 2. Added by Gonetz
8656 // (noise-0)*primlod+t0, (prim-env)*cmb+env ** INC **
8657 { 0x2ef7a053, cmb(cc_prim_sub_env_mul_t0_add_env) },
8658 // Tony Hawk's Pro Skater. Added by Gonetz
8659 // (t1-t0)*k5+t0
8660 { 0x2f122f12, cmb(cc_t0_inter_t1_using_k5) },
8661 // F1 World Grand Prix. Added by Gonetz
8662 // (t1-t0)*k5+t0, (cmb-0)*shade+0 **INC**
8663 { 0x2f12e4f0, cmb(cc__t0_inter_t1_using_k5__mul_shade) },
8664 // Turok 3 [scorpiove]. Added by Gonetz
8665 // (t0-k4)*k5+t0
8666 { 0x2f712f71, cmb(cc_t0) },
8667 // THPS 3
8668 // (env-0)*k5+t0,
8669 { 0x2ff52ff5, cmb(cc_t0_add_env_mul_k5) },
8670 // super bowling
8671 // (0-0)*k5+t0,
8672 { 0x2fff0000, cmb(cc_t0) },
8673 // super bowling
8674 // (0-0)*k5+t0
8675 { 0x2fff2fff, cmb(cc_t0) },
8676 // RARE logo, blast corps. Added by Gonetz
8677 // (t0-0)*0+t0
8678 { 0x3ff13ff1, cmb(cc_t0) },
8679 // the ground below the scarecrow in the trading post in town, zelda 2 [Ogy]. Added by Gonetz
8680 // (t1-0)*0+t0, (cmb-0)*shade+0
8681 { 0x3ff2e4f0, cmb(cc_t0_mul_shade) },
8682 // intro, background, Dezaemon 3D
8683 // (1-0)*0+t0
8684 { 0x3ff63ff6, cmb(cc_t0) },
8685 // Tony Hawk's Pro Skater. Added by Gonetz
8686 // ((0-0)*0+t0, (t1-0)*shade+cmb ** INC **
8687 { 0x3fff04f2, cmb(cc_t0) },
8688 // Dr. Mario [Ogy]. Added by Gonetz
8689 // ((0-0)*0+t0, (prim-cmb)*env+cmb
8690 { 0x3fff0503, cmb(cc_prim_sub_t0_mul_env_add_t0) },
8691 // Stained glass, quest64
8692 // (0-0)*0+t0, (1-0)*env+cmb
8693 { 0x3fff05f6, cmb(cc_t0_add_env) },
8694 // Health bar, killer instinct gold
8695 // (0-0)*0+t0, (prim-env)*prim_a+cmb
8696 { 0x3fff0a53, cmb(cc_prim_sub_env_mul_prima_add_t0) },
8697 // Runes, Turok - Dinosaur Hunter. Added by Gonetz
8698 // (0-0)*0+t0, (env-cmb)*env_a+cmb
8699 { 0x3fff0c05, cmb(cc_t0_inter_env_using_enva) },
8700 // intro, Mission Impossible. Added by Gonetz
8701 // (k5-k5)*0+t0, (0-0)*scale+t0
8702 { 0x3fff26ff, cmb(cc_t0) },
8703 // TM, mario
8704 //z (k5-k5)*0+t0
8705 { 0x3fff3fff, cmb(cc_t0) },
8706 // Intro, CBFD. Added by Gonetz
8707 // ((0-0)*0+t0, (shade-env)*cmb+prim
8708 { 0x3fff6054, cmb(cc_shade_sub_env_mul_t0_add_prim) },
8709 // paper mario. Added by Gonetz
8710 // ((0-0)*0+t0, (prim-env)*cmb+env
8711 { 0x3fffa053, cmb(cc_prim_sub_env_mul_t0_add_env) },
8712 // Objects in arena, pokemon stadium 2
8713 // (0-0)*0+t0, (cmb-prim)*shade+env
8714 { 0x3fffa430, cmb(cc_t0_mul_prim) },
8715 // intro, F1 Racing Championship. Added by Gonetz
8716 // (0-0)*0+t0, (shade-env)*cmb+0
8717 { 0x3fffe054, cmb(cc_shade_sub_env_mul_t0) },
8718 // stands, F1 Racing Championship. Added by Gonetz
8719 // (0-0)*0+t0, (1-env)*cmb+0
8720 { 0x3fffe056, cmb(cc_one_sub_env_mul_t0) },
8721 // ? (from log)
8722 // (0-0)*0+t0, (prim-0)*cmb+0
8723 { 0x3fffe0f3, cmb(cc_t0_mul_prim) },
8724 // background, GASP Fighters
8725 // (0-0)*0+t0, (shade-0)*cmb+0
8726 { 0x3fffe0f4, cmb(cc_t0_mul_shade) },
8727 // zelda 2 [Ogy]. Added by Gonetz
8728 // (0-0)*0+t0, (env-0)*cmb+0
8729 { 0x3fffe0f5, cmb(cc_t0_mul_env) },
8730 // logo, v-rally 99
8731 // (0-0)*0+t0, (prim-0)*t0+0
8732 { 0x3fffe1f3, cmb(cc_t0_mul_prim) },
8733 // target hit, zelda 2. Added by Gonetz
8734 // (0-0)*0+t0, (cmb-0)*prim+0
8735 { 0x3fffe3f0, cmb(cc_t0_mul_prim) },
8736 // Ms. Pac-Man intro background. Added by Gonetz
8737 // (0-0)*0+t0, (cmb-0)*shade+0
8738 { 0x3fffe4f0, cmb(cc_t0_mul_shade) },
8739 // Wonder Project J2 logo. Added by Gonetz
8740 // (0-0)*0+t0, (t0-0)*shade+0
8741 { 0x3fffe4f1, cmb(cc_t0_mul_shade) },
8742 // tire trace, Monster truck madness. Added by Gonetz
8743 // (0-0)*0+t0, (cmb-0)*env+0
8744 { 0x3fffe5f0, cmb(cc_t0_mul_env) },
8745 // Gauntlet Legends intro. Added by Gonetz
8746 // (0-0)*0+t0, (cmb-0)*ecale+0
8747 { 0x3fffe6f0, cmb(cc_t0) },
8748 // tire trace, beetle adventure racing. Added by Gonetz
8749 // (t1-t0)*t0+t1, (cmb-t0)*shade+t1 **INC**
8750 { 0x41124410, cmb(cc__t0_inter_t1_using_t0__mul_shade) },
8751 // Paper Mario. Added by Gonetz
8752 // (t0-t1)*t0+t1 **INC**
8753 { 0x41214121, cmb(cc_t1_inter_t0_using_t0) },
8754 // Powered Star Beam, Paper Mario. Added by Gonetz
8755 // (t0-t1)*t0+t1, (env-prim)*cmb+prim **INC**
8756 { 0x41216035, cmb(cc_env_sub_prim_mul__t1_inter_t0_using_t0__add_prim) },
8757 // wetrix raiseland [Raziel64]. Added by Gonetz
8758 // (prim-t1)*t0+t1, (env-t0)*cmb+cmb **INC**
8759 { 0x41230015, cmb(cc_env_sub_prim_mul__t0_mul_t1__add_prim) },
8760 // SCARS. Added by Gonetz
8761 // (t1-t0)*t0+t1, (cmb-t0)*shade+t1 **INC**
8762 { 0x41250b03, cmb(cc__t0_inter_t1_using_half__mul_shade) },
8763 //beetle adventure racing. Added by Gonetz
8764 //(env-t1)*t0+t1, (prim-cmb)*shadea+cmb **INC**
8765 { 0x4221e4f0, cmb(cc__t1_inter_env_using_t0__inter_prim_using_shadea) },
8766 // paper mario. Added by Gonetz
8767 // (t0-t0)*prim+t1, (t1-cmb)*cmb+env **INC** weird
8768 { 0x4311a002, cmb(cc_env) },
8769 // background, Wetrix level 1, [Raziel64]. Added by Gonetz
8770 // (t0-t1)*prim+t1
8771 { 0x43214321, cmb(cc_t1_inter_t0_using_prim) },
8772 // grass, ISS 2k. Added by Gonetz
8773 // (t0-t1)*prim+t1, (cmb-0)*env+0 **INC**
8774 { 0x4321e5f0, cmb(cc__t1_inter_t0_using_prim__mul_env) },
8775 // intro, Paper Mario
8776 // (t0-0)*prim+t1
8777 { 0x43f143f1, cmb(cc_t0_mul_prim_add_t1) },
8778 // F1 World Grand Prix. Added by Gonetz
8779 // (t0-0)*prim+t1, (cmb-0)*shade+env **INC**
8780 { 0x43f1a4f0, cmb(cc__t0_add_t1__mul_shade_add_env) },
8781 // field, ISS64. Added by Gonetz
8782 // (t0-t1)*shade+t1, (cmb-t1)*prim+t1 ** INC **
8783 { 0x44214320, cmb(cc_t0_sub_t1_mul_prim_mul_shade_add_t1) },
8784 // 0x44214320, cmb(cc__t0_add_t1__mul_prim) },
8785 // water, goemon great adventure
8786 // (t0-t1)*env+t1 ** INC **
8787 { 0x45214521, cmb(cc_t1_inter_t0_using_env) },
8788 // characters, Ogre Battle. Added by Gonetz
8789 // (1-t1)*env+t1, (1-cmb)*prim+cmb ** INC **
8790 { 0x45260306, cmb(cc_one_sub_t1_mul_prim_add_t1) },
8791 // characters, Ogre Battle. Added by Gonetz
8792 // (1-t1)*env+t1
8793 { 0x45264526, cmb(cc_one_sub_t1_mul_env_add_t1) },
8794 // characters, Ogre Battle. Added by Gonetz
8795 // (1-t1)*env+t1, (cmb-0)*prim+0 ** INC **
8796 { 0x4526e3f0, cmb(cc__t1_inter_one_using_env__mul_prim) },
8797 // explosion, body harvest. Added by Gonetz
8798 // (t0-t1)*scale+t1, (env-prim)*cmb+prim ** INC **
8799 { 0x46216035, cmb(cc_env_sub_prim_mul__t0_inter_t1_using_half__add_prim) },
8800 // Water, AeroGauge. Added by Gonetz
8801 // (t0-t1)*prima+t1, (0-0)*0+cmb
8802 { 0x4a214a21, cmb(cc_t1_inter_t0_using_prima) },
8803 // flame, castlevania 2. Added by Gonetz
8804 // (t0-t1)*prima+t1, (prim-env)*cmb+env
8805 { 0x4a21a053, cmb(cc_prim_sub_env_mul__t1_inter_t0_using_prima__add_env) },
8806 // shadows, Mario Tennis. Added by Gonetz
8807 // (t0-t1)*prima+t1, (prim-0)*cmb+0
8808 { 0x4a21e0f3, cmb(cc__t1_inter_t0_using_prima__mul_prim) },
8809 // menu, Mario Golf. Added by Gonetz
8810 // (t0-t1)*prima+t1, (shade-0)*cmb+0
8811 { 0x4a21e0f4, cmb(cc__t1_inter_t0_using_prima__mul_shade) },
8812 // intro, castlevania 2. Added by Gonetz
8813 // (t0-t1)*prima+t1, (cmb-0)*prim+0
8814 { 0x4a21e3f0, cmb(cc__t1_inter_t0_using_prima__mul_prim) },
8815 // water on map, Ogre Battle64. Added by Gonetz
8816 // (t0-t1)*prima+t1, (cmb-0)*shade+0
8817 { 0x4a21e4f0, cmb(cc__t1_inter_t0_using_prima__mul_shade) },
8818 // Ice, Paper Mario
8819 // (t0-t1)*shade_a+t1
8820 { 0x4b214b21, cmb(cc_t1_inter_t0_using_shadea) },
8821 // Grass, Beetle Adventure Racing
8822 // (t0-t1)*shade_a+t1, (cmb-0)*shade+0
8823 { 0x4b21e4f0, cmb(cc__t1_inter_t0_using_shadea__mul_shade) },
8824 // Ground at kotake & koume, zelda
8825 // (t1-t0)*env_a+t0, (prim-env)*cmb+env
8826 { 0x4c12a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env) },
8827 // Tony Hawk's Pro Skater. Added by Gonetz
8828 // (t0-t1)*env_a+t1, (cmb-0)*shade+cmb ** INC **
8829 { 0x4c2104f0, cmb(cc__t1_inter_t0_using_enva__mul_shade) },
8830 // bikes, xg2. Added by Gonetz
8831 // (t0-t1)*env_a+t1, (cmb-prim)*prima+prim
8832 { 0x4c216a30, cmb(cc__t1_inter_t0_using_enva__sub_prim_mul_prima_add_prim) },
8833 // Yoshi Story
8834 // (t0-t1)*env_a+t1, (prim-env)*cmb+env
8835 { 0x4c21a053, cmb(cc_prim_sub_env_mul__t1_inter_t0_using_enva__add_env) },
8836 // arena, Pokemon Stadium 1. Added by Gonetz
8837 // (t0-t1)*env_a+t1, (cmb-0)*prim+0
8838 { 0x4c21e3f0, cmb(cc__t1_inter_t0_using_enva__mul_prim) },
8839 // "end of chapter" text, paper mario. Added by Gonetz
8840 // (1-t1)*env_a+t1, (cmb-0)*t1+0 ** INC **
8841 { 0x4c26e2f0, cmb(cc_t0_mul_t1) },
8842 // 0x4c26e2f0, cmb(cc_t1_mul_enva) },
8843 // Zelda opening door, zelda
8844 // (t0-prim)*env_a+t1, (prim-env)*t0+env
8845 { 0x4c31a053, cmb(cc_prim_sub_env_mul_t0_add_env) },
8846 // Kotake & koume magic poof, zelda
8847 // (t0-0)*env_a+t1, (prim-env)*cmb+env
8848 { 0x4cf1a053, cmb(cc_prim_sub_env_mul__t0_mul_enva_add_t1__add_env) },
8849 // ground in stone temple, zelda 2. Added by Gonetz
8850 // (t1-t0)*primlod+t1, (cmb-0)*prim+0
8851 { 0x4e12e3f0, cmb(cc__t0_inter_t1_using_primlod__mul_prim) },
8852 // pokemon attack, Pokemon Stadium 2. Added by Gonetz
8853 // (noise-t0)*primlod+t1, (prim-env)*cmb+env ** INC **
8854 { 0x4e17a053, cmb(cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env) },
8855 // menu, pokemon stadium 1, [Raziel64]
8856 // (t0-t1)*lodf+t1, (prim-env)*cmb+env
8857 { 0x4e214e21, cmb(cc_t1_inter_t0_using_primlod) },
8858 // Pokemon backgrounds, pokemon stadium 2
8859 // (t0-t1)*lodf+t1, (prim-env)*cmb+env
8860 { 0x4e21a053, cmb(cc_prim_sub_env_mul__t1_inter_t0_using_primlod__add_env) },
8861 // zelda 2 [Ogy]. Added by Gonetz
8862 // (t0-t1)*primlod+t1, (t1-cmb)*prim+env ** INC **
8863 { 0x4e21a302, cmb(cc_env_sub__t0_sub_t1_mul_primlod__mul_prim) },
8864 // Magnitude, pokemon stadium 2
8865 // (t0-t1)*primlod+t1, (prim-env)*cmb_a+env
8866 { 0x4e21a753, cmb(cc_prim_sub_env_mul__t1_inter_t0_using_primlod__add_env) },
8867 // zelda 2 [Ogy]. Added by Gonetz
8868 // (t0-t1)*primlod+t1, (cmb-0)*shade+0
8869 { 0x4e21e4f0, cmb(cc__t1_inter_t0_using_primlod__mul_shade) },
8870 // lava in snowhead temple, zelda 2. Added by Gonetz
8871 // (t0-prim)*primlod+t1, (cmb-prim)*shade+cmb ** INC **
8872 { 0x4e310430, cmb(cc_lavatex_sub_prim_mul_shade_add_lavatex) },
8873 // Skulltula coin, zelda
8874 // (t0-prim)*primlod+t1, (prim-env)*cmb+env
8875 { 0x4e31a053, cmb(cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t1__add_env) },
8876 // Pokemon background, pokemon stadium 2
8877 // (noise-shade)*primlod+t1, (prim-env)*cmb+env
8878 { 0x4e47a053, cmb(cc_prim_sub_env_mul_t1_add_env) },
8879 // Reflect, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
8880 // (t0-0)*primlod+t1, (prim-env)*cmb+env
8881 { 0x4ef1a053, cmb(cc_prim_sub_env_mul__t0_add_t1__add_env) },
8882 //beetle adventure racing. Added by Gonetz
8883 //(t0-t1)*k5+t1, (cmb-0)*shade+0
8884 { 0x4f21e4f0, cmb(cc__t1_inter_t0_using_k5__mul_shade) },
8885 // Spiderman. Added by Gonetz
8886 //(t0-t1)*k5+t1, (cmb-0)*env+0
8887 { 0x4f21e5f0, cmb(cc_t1_mul_env) },
8888 // N64 logo, Ogre Battle. Added by Gonetz
8889 //(0-0)*0+t1
8890 { 0x5fff5fff, cmb(cc_t1) },
8891 // reversing light, Monster truck madness. Added by Gonetz
8892 //(0-0)*0+t0, (0-0)*0+prim
8893 { 0x5fff7fff, cmb(cc_prim) },
8894 // battle tanks [Ogy]
8895 // (0-0)*0+t1, (env-shade)*cmb+shade
8896 { 0x5fff8045, cmb(cc_env_sub_shade_mul_t1_add_shade) },
8897 // minigame, pokemon stadium 1. Added by Gonetz
8898 // (0-0)*0+t1, (prim-env)*cmb+env
8899 { 0x5fffa053, cmb(cc_prim_sub_env_mul_t1_add_env) },
8900 // F1 World Grand Prix. Added by Gonetz
8901 // (t0-prim)*t0+prim, (cmb-0)*shade
8902 { 0x6131e4f0, cmb(cc__prim_inter_t0_using_t0__mul_shade) },
8903 // aerofighter's assault [Ogy]
8904 // (shade-prim)*t0+prim
8905 { 0x61346134, cmb(cc_shade_sub_prim_mul_t0_add_prim) },
8906 // club blow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
8907 // (shade-prim)*t0+prim, (cmb-env)*cmb_a+env ** INC **
8908 { 0x6134a750, cmb(cc_shade_sub_prim_mul_t0_add_prim) },
8909 // lava, beetle adventure racing
8910 // (shade-prim)*t0+prim, (cmb-0)*t1+0 ** INC **
8911 { 0x6134e2f0, cmb(cc_shade_sub_prim_mul__t0_mul_t1__add_prim) },
8912 // Monster truck madness intro. Added by Gonetz
8913 // (env-prim)*t0+prim, (cmb-0)*scale+cmb ** INC **
8914 { 0x613506f0, cmb(cc_env_sub_prim_mul_t0_add_prim) },
8915 // pokemon attack, Pokemon stadium 1
8916 // (env-prim)*t0+prim, (cmb-0)*0+cmb
8917 { 0x61351ff0, cmb(cc_env_sub_prim_mul_t0_add_prim) },
8918 // Paper Mario, fortune teller spheres
8919 // (env-prim)*t0+prim, (cmb-0)*t1+t0 ** INC **
8920 { 0x613522f0, cmb(cc_t0_mul_t1_add_t0) },
8921 // Later hearts, zelda
8922 // (env-prim)*t0+prim
8923 { 0x61356135, cmb(cc_env_sub_prim_mul_t0_add_prim) },
8924 // Mission Impossible. Added by Gonetz
8925 // (env-prim)*t0+prim, (shade-0)*cmb+0 ** INC **
8926 { 0x6135e0f4, cmb(cc_t0_mul_shade) },
8927 // crashing other vehicle, Monster truck madness [Raziel64]. Added by Gonetz
8928 // (env-prim)*t0+prim, (cmb-0)*t0+0 ** INC **
8929 { 0x6135e1f0, cmb(cc_env_sub_prim_mul_t0_add_prim) },
8930 // Tony Hawk's Pro Skater. Added by Gonetz
8931 // (env-prim)*t0+prim, (cmb-0)*t1+0 ** INC **
8932 { 0x6135e2f0, cmb(cc_env_sub_prim_mul_t0_add_prim) },
8933 // aerofighter's assault [Ogy]
8934 // (env-prim)*t0+prim, (cmb-0)*shade+0 ** INC **
8935 { 0x6135e4f0, cmb(cc__prim_inter_env_using_t0__mul_shade) },
8936 // "time out", paper mario. Added by Gonetz
8937 // (1-prim)*t0+prim, (1-cmb)*enva+cmb ** INC **
8938 { 0x61360c06, cmb(cc_one_sub_prim_mul_t0_add_prim) },
8939 // intro, paper mario. Added by Gonetz
8940 // (1-prim)*t0+prim, (cmb-0)*prima+t0 ** INC **
8941 { 0x61362af0, cmb(cc__one_sub_prim_mul_t0_add_prim__mul_prima_add__one_sub_prim_mul_t0_add_prim) },
8942 // paper mario. Added by Gonetz
8943 // (1-prim)*t0+prim
8944 { 0x61366136, cmb(cc_one_sub_prim_mul_t0_add_prim) },
8945 // arena, Pokemon Stadium 2. Added by Gonetz
8946 // (1-prim)*t0+prim, (cmb-env)*shade+shade ** INC **
8947 { 0x61368450, cmb(cc_t0_mul_shade) },
8948 // F1 World Grand Prix. Added by Gonetz
8949 // (1-prim)*t0+prim, (cmb-0)*shade+0 ** INC **
8950 { 0x6136e4f0, cmb(cc_t0_mul_shade) },
8951 // Xena. Added by Gonetz
8952 // (0-prim)*t0+prim
8953 { 0x613f613f, cmb(cc_one_sub_t0_mul_prim) },
8954 // Kirby64 end [Raziel64]. Added by Gonetz
8955 // (prim-env)*t0+prim
8956 { 0x61536153, cmb(cc_prim_sub_env_mul_t0_add_prim) },
8957 // Xena. Added by Gonetz
8958 // (shade-env)*t0+prim
8959 { 0x61546154, cmb(cc_shade_sub_env_mul_t0_add_prim) },
8960 // Karts, mario kart
8961 //z (center-env)*t0+prim
8962 { 0x61566156, cmb(cc_t0_mul_1menv_add_prim) },
8963 // Famista64. Added by Gonetz
8964 //(t0-0)*t0+prim
8965 { 0x61f161f1, cmb(cc_t0_mul_prim) },
8966 // Pokemon Stadium 2. Added by Gonetz
8967 //(shade-0)*t0+prim
8968 { 0x61f461f4, cmb(cc_t0_mul_shade_add_prim) },
8969 // Doom. Added by Gonetz
8970 //(1-0)*t0+prim
8971 { 0x61f661f6, cmb(cc_t0_add_prim) },
8972 // tire trace, beetle adventure racing. Added by Gonetz
8973 // (shade-prim)*t1+prim, (cmb-0)*t1+0 **INC**
8974 { 0x6234e2f0, cmb(cc_shade_sub_prim_mul_t1_add_prim) },
8975 // Text, turok
8976 // (env-prim)*t1+prim
8977 { 0x62356235, cmb(cc_env_sub_prim_mul_t1_add_prim) },
8978 // Pokemon Stadium 2, [gokuss4]. Added by Gonetz
8979 // (env-prim)*t1+prim, (cmb-0)*t1+0 ** INC **
8980 { 0x6235e2f0, cmb(cc_env_sub_prim_mul_t1_add_prim) },
8981 // bike trace, xg2 intro. Added by Gonetz
8982 // (1-prim)*t1+prim
8983 { 0x62366236, cmb(cc_one_sub_prim_mul_t1_add_prim) },
8984 // aerofighter's assault [Ogy]
8985 // (1-prim)*t1+prim, (cmb-0)*0+env
8986 { 0x6236bff0, cmb(cc_one_sub_prim_mul_t1_add_prim) },
8987 // Tennis court, mario tennis
8988 // (t0-0)*t1+prim
8989 { 0x62f162f1, cmb(cc__t0_mul_t1__add_prim) },
8990 // Rush2. Added by Gonetz
8991 // (prim-prim)*prim+prim
8992 { 0x63336333, cmb(cc_prim) },
8993 //Bowser in final battle, Paper Mario. Added by Gonetz
8994 // (t1-0)*prim+prim
8995 { 0x63f263f2, cmb(cc_t1_mul_prim_add_prim) },
8996 // wetrix, icelayer, [Raziel64]. Added by Gonetz
8997 // (t0-prim)*shade+prim ** INC **
8998 { 0x64316431, cmb(cc_t0_mul_shade) },
8999 // KI. Added by Gonetz
9000 // (env-prim)*shade+prim
9001 { 0x64356435, cmb(cc_env_sub_prim_mul_shade_add_prim) },
9002 // xg2. Added by Gonetz
9003 // (1-prim)*shade+prim, (t0-0)*cmb+0 ** INC **
9004 { 0x6436e0f1, cmb(cc_t0_mul_one_sub_prim_mul_shade) },
9005 // Intro, CBFD. Added by Gonetz
9006 // (t0-env)*shade+prim
9007 { 0x64516451, cmb(cc_t0_sub_env_mul_shade_add_prim) },
9008 // sword in final battle, zelda 2. Added by Gonetz
9009 // (t0-env)*shade+prim, (cmb-0)*shade+0 ** INC **
9010 { 0x6451e4f0, cmb(cc__t0_sub_env_mul_shade_add_prim__mul_shade) },
9011 // Road Rush. Added by Gonetz
9012 // (t0-0)*shade+prim
9013 { 0x64f164f1, cmb(cc_t0_mul_shade_add_prim) },
9014 // paper mario. Added by Gonetz
9015 // (1-0)*shade+prim
9016 { 0x64f664f6, cmb(cc_prim_add_shade) },
9017 // Character select, smash bros
9018 // (t0-prim)*env+prim
9019 { 0x65316531, cmb(cc_t0_sub_prim_mul_env_add_prim) },
9020 // Clear screen intro, banjo kazooie
9021 // (t0-prim)*env+prim, (cmb-0)*shade+0
9022 // 0x6531e4f0, cmb(cc_t0_mul_env_mul_shade) },
9023 { 0x6531e4f0, cmb(cc__prim_inter_t0_using_env__mul_shade) },
9024 // Dragonfly feet, banjo kazooie
9025 // (1-prim)*env+prim, (cmb-0)*shade+0 ** INC **
9026 { 0x6536e4f0, cmb(cc_env_mul_shade) },
9027 // Lava piranha atack, Paper Mario
9028 // (t1-k4)*env+prim ** INC **
9029 { 0x65726572, cmb(cc_t1_mul_env_add_prim) },
9030 // zelda 2 [Ogy]. Added by Gonetz
9031 // (t0-0)*env+prim, (1-t1)*t0a+cmb ** INC **
9032 { 0x65f10826, cmb(cc_one_sub_t1_mul_t0a_add_t0_mul_env_add_prim) },
9033 // clocks while warping through time, zelda 2
9034 // (t0-0)*env+prim, (cmb-0)*0+cmb
9035 { 0x65f11ff0, cmb(cc_t0_mul_env_add_prim) },
9036 // Helicopter, Nuclear Strike. Added by Gonetz
9037 // (t0-0)*env+prim
9038 { 0x65f165f1, cmb(cc_t0_mul_env_add_prim) },
9039 // Mystical Ninja
9040 // (1-0)*env+prim
9041 { 0x65f665f6, cmb(cc_prim_add_env) },
9042 // duke nukem: zero hour [Ogy]
9043 // (noise-0)*env+prim ** INC **
9044 { 0x65f765f7, cmb(cc_prim_add_env) },
9045 // "terminator", CBFD
9046 // (0-0)*env+prim
9047 { 0x65ff65ff, cmb(cc_prim) },
9048 // Cliffs, Taz express. Added by Gonetz
9049 // (t0-0)*scale+prim
9050 { 0x66f166f1, cmb(cc_t0_add_prim) },
9051 // Taz express. Added by Gonetz
9052 // (t0-0)*scale+prim, (cmb-0)*shade+0
9053 { 0x66f1e4f0, cmb(cc_t0_add_prim_mul_shade) },
9054 // NFL Quarterback Club 98 Menu [CpUMasteR]
9055 // (prim-0)*scale+prim
9056 { 0x66f366f3, cmb(cc_prim) },
9057 // Character, dual heroes
9058 // (t0-prim)*t0_a+prim
9059 { 0x68316831, cmb(cc_t0_sub_prim_mul_t0a_add_prim) },
9060 // Indy Racing 2000. Added by Gonetz
9061 // (t0-prim)*t0_a+prim, (cmb-0)*shade+0 ** INC **
9062 { 0x6831e4f0, cmb(cc_t0_mul_shade) },
9063 // text, Sin and Punishmen. Added by Gonetz
9064 // (env-prim)*t0_a+prim ** INC **
9065 { 0x68356835, cmb(cc_env_sub_prim_mul_t0a_add_prim) },
9066 // menu, PD. Added by Gonetz
9067 // (env-prim)*t1_a+prim
9068 { 0x69356935, cmb(cc_env_sub_prim_mul_t1a_add_prim) },
9069 // 0x69356935, cmb(cc_t1) },
9070 //xg2. Added by Gonetz
9071 // (t0-prim)*prima+prim
9072 { 0x6a316a31, cmb(cc_t0_sub_prim_mul_prima_add_prim) },
9073 // menu, battle phoenix 64. Added by Gonetz
9074 // (env-prim)*prima+prim
9075 { 0x6a356a35, cmb(cc_env_sub_prim_mul_prima_add_prim) },
9076 // ground, KI. Added by Gonetz
9077 // (shade-env)*prima+prim
9078 { 0x6a546a54, cmb(cc_shade_sub_env_mul_prima_add_prim) },
9079 // F1 World Grand Prix. Added by Gonetz
9080 // (t0-0)*prima+prim, (shade-0)*cmb+env **INC**
9081 { 0x6af1a0f4, cmb(cc__t0_mul_prima_add_prim_mul__shade_add_env) },
9082 //broken wall, beetle adventure racing. Added by Gonetz
9083 // (t0-0)*prima+prim, (cmb-0)*shade+0 **INC**
9084 { 0x6af1e4f0, cmb(cc__t0_mul_prima_add_prim_mul__shade) },
9085 // Genie, diddy kong racing
9086 // (t0-prim)*shade_alpha+prim, (env-cmb)*shade+cmb
9087 // 0x6b310405, cmb(cc_env_sub__prim_inter_t0_using_shadea__mul_shade_add_env) },
9088 { 0x6b310405, cmb(cc_t0_mul_shadea) },
9089 // Extreme G. Added by Gonetz
9090 // (t0-prim)*shade_alpha+prim ** INC **
9091 { 0x6b316b31, cmb(cc_t0_sub_prim_mul_shadea_add_prim) },
9092 // water block, Paper Mario. Added by Gonetz
9093 // (t0-prim)*shade_alpha+prim, (prim-env)*cmb+env ** INC **
9094 { 0x6b31a053, cmb(cc_prim_sub_env_mul__prim_inter_t0_using_shadea__add_env) },
9095 // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
9096 // (t0-prim)*shade_alpha+prim, (cmb-0)*shade+0 ** INC **
9097 { 0x6b31e4f0, cmb(cc__prim_inter_t0_using_shadea__mul_shade) },
9098 // F1 World Grand Prix. Added by Gonetz
9099 // (env-prim)*shade_alpha+prim, (shade-cmb)*cmb_a+cmb ** INC **
9100 { 0x6b350704, cmb(cc_env_sub_prim_mul_shade_add_prim) },
9101 // lullaby, Paper Mario. Added by Gonetz
9102 // (env-prim)*shade_alpha+prim
9103 { 0x6b356b35, cmb(cc_env_sub_prim_mul_shadea_add_prim) },
9104 // Some gannon spell, zelda
9105 // (noise-t0)*env_a+prim, (0-prim)*cmb+1 ** INC **
9106 { 0x6c17c03f, cmb(cc_one_sub__one_sub_t0_mul_enva_add_prim__mul_prim) },
9107 //Goldeneye, [Jeremy]. Added by Gonetz
9108 // (t0-prim)*env_a+prim
9109 { 0x6c316c31, cmb(cc_t0_sub_prim_mul_enva_add_prim) },
9110 // button, Sin and Punishmen. Added by Gonetz
9111 // (env-prim)*env_a+prim
9112 { 0x6c356c35, cmb(cc_env_sub_prim_mul_enva_add_prim) },
9113 // fallen stars at star summit, Paper Mario. Added by Gonetz
9114 // (t0-env)*env_a+prim, (1-0)*primlod+cmb
9115 { 0x6c510ef6, cmb(cc_t0_sub_env_mul_enva_add_prim) },
9116 // focus, Paper Mario. Added by Gonetz
9117 // (t0-env)*env_a+prim, (cmb-shade)*shadea+shade ** INC **
9118 { 0x6c518b40, cmb(cc_t0_sub_shade_mul_shadea_add_shade) },
9119 // Ring, pokemon stadium 2
9120 // (t0-0)*env_a+prim, (1-0)*cmb+0
9121 { 0x6cf1e0f6, cmb(cc_t0_mul_enva_add_prim) },
9122 // Jet Force
9123 // (noise-0)*env_a+prim
9124 { 0x6cf76cf7, cmb(cc_prim) },
9125 // snowhead temple, zelda 2. Added by Gonetz
9126 // (t1-t0)*primlod+prim, (cmb-0)*shade+shade
9127 { 0x6e1284f0, cmb(cc__t1_sub_t0_mul_primlod_add_prim__mul_shade_add_shade) },
9128 // zelda 2. Added by Gonetz
9129 // (t1-t0)*primlod+prim, (cmb-0)*shade+0 ** INC **
9130 { 0x6e12e4f0, cmb(cc__t1_sub_t0_mul_primlod_add_prim__mul_shade) },
9131 // sky, daikatana. Added by Gonetz
9132 // (t0-prim)*primlod+prim, (cmb-0)*shade+0
9133 { 0x6e31e4f0, cmb(cc_t0_mul_shade) },
9134 // ball's track, NFL Blitz. Added by Gonetz
9135 // (t0-0)*primlod+prim
9136 { 0x6ef16ef1, cmb(cc_t0_mul_primlod_add_prim) },
9137 // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
9138 // (t0-0)*primlod+prim, (cmb-env)*cmb_a+env ** INC **
9139 { 0x6ef1a750, cmb(cc_t0_mul_primlod_add_prim) },
9140 // rope, CBFD
9141 // (t0-env)*k5+prim
9142 { 0x6f516f51, cmb(cc_t0_sub_env_mul_k5_add_prim) },
9143 // super bowling
9144 // (0-0)*k5+prim
9145 { 0x6fff6fff, cmb(cc_prim) },
9146 // intro, Aidyn Chronicles. Added by Gonetz
9147 // (0-0)*0+prim, (0-0)*0+prim
9148 { 0x79fb7788, cmb(cc_prim) },
9149 // Menu, megaman
9150 // (1-0)*0+prim
9151 { 0x7ff67ff6, cmb(cc_prim) },
9152 // sky, PGA European Tour
9153 // (0-0)*0+prim, (env-0)*t0+cmb
9154 { 0x7fff01f5, cmb(cc_t0_mul_env_add_prim) },
9155 // sky, Spiderman. Added by Gonetz
9156 // (0-0)*0+prim, (t1-0)*shade+cmb
9157 { 0x7fff04f2, cmb(cc_t1_mul_shade_add_prim) },
9158 // ball's shadow, ISS 2k. Added by Gonetz
9159 // (0-0)*0+prim, (1-cmb)*env+cmb
9160 { 0x7fff0506, cmb(cc_one_sub_prim_mul_env_add_prim) },
9161 // Necklace, quest64
9162 // (0-0)*0+prim, (1-0)*env+cmb
9163 { 0x7fff05f6, cmb(cc_prim_add_env) },
9164 // Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
9165 // (0-0)*0+prim, (1-cmb)*cmba+cmb ** INC **
9166 { 0x7fff0706, cmb(cc_prim) },
9167 // Dobutsu no Mori. Added by Gonetz
9168 //(k5-k5)*0+prim, (cmb-0)*0+cmb
9169 { 0x7fff1ff0, cmb(cc_prim) },
9170 // Intro background, starfox
9171 //z (k5-k5)*0+prim
9172 { 0x7fff7fff, cmb(cc_prim) },
9173 // train smoke, Dobutsu No Mori. Added by Gonetz
9174 //(0-0)*0+prim, (shade-0)*cmb+0
9175 { 0x7fffe0f4, cmb(cc_prim_mul_shade) },
9176 // Donald Duck intro. Added by Gonetz
9177 //(0-0)*0+prim, (cmb-0)*prim+0
9178 { 0x7fffe3f0, cmb(cc_prim_mul_prim) },
9179 // Ms. Pac-Man intro. Added by Gonetz
9180 //(0-0)*0+prim, (cmb-0)*shade+0
9181 { 0x7fffe4f0, cmb(cc_prim_mul_shade) },
9182 // zelda 2. Added by Gonetz
9183 //(t1-t0)*t0+shade, (cmb-0)*shade+0
9184 { 0x8112e4f0, cmb(cc__t1_sub_t0_mul_t0_add_shade__mul_shade) },
9185 // branches, Beetle Adventure Racing
9186 //(t0-shade)*t0+shade, (t0-cmb)*prim+cmb **INC**
9187 { 0x81410301, cmb(cc_t0_mul_prim) },
9188 // Namco logo, Famista 64
9189 //(prim-shade)*t0+shade, (env-cmb)*t0+cmb **INC**
9190 { 0x81430105, cmb(cc_prim_sub_shade_mul_t0_add_shade) },
9191 // pikachu, hey you pikachu
9192 //(prim-shade)*t0+shade, (env-cmb)*enva+cmb **INC**
9193 { 0x81430c05, cmb(cc_prim_sub_shade_mul_t0_add_shade) },
9194 // Mario's head, mario //Added by Gonetz
9195 //(prim-shade)*t0+shade
9196 { 0x81438143, cmb(cc_prim_sub_shade_mul_t0_add_shade) },
9197 // Iguana background, turok
9198 // (env-shade)*t0+shade
9199 { 0x81458145, cmb(cc_env_sub_shade_mul_t0_add_shade) },
9200 // Bubbles in Jabu-Jabu's belly, zelda
9201 // (1-shade)*t0+shade
9202 { 0x81468146, cmb(cc_one_sub_shade_mul_t0_add_shade) },
9203 // duck dodgers intro. Added by Gonetz
9204 // (1-shade)*t0+shade, (cmb-0)*shade+0 **INC**
9205 { 0x8146e4f0, cmb(cc_one_sub_shade_mul_t0_add_shade) },
9206 // intro, Madden Footbal
9207 // (1-env)*t0+shade
9208 { 0x81568156, cmb(cc_one_sub_env_mul_t0_add_shade) },
9209 // sky in doom. Added by Gonetz
9210 // (prim-0)*t0+shade, (cmb-0)*primlod+env **INC**
9211 { 0x81f3aef0, cmb(cc_t0_mul_prim_add_shade) },
9212 // commercial? in IIS98. Added by Gonetz
9213 // (1-0)*t0+shade
9214 { 0x81f681f6, cmb(cc_t0_add_shade) },
9215 //beetle adventure racing. Added by Gonetz
9216 //(prim-shade)*t1+shade, (cmb-0)*t1+0 **INC**
9217 { 0x8243e2f0, cmb(cc_prim_sub_shade_mul_t1_add_shade) },
9218 // Scorpion fire breath, MK4 [Jeremy]. Added by Gonetz
9219 // (t0-shade)*prim+shade
9220 { 0x83418341, cmb(cc_t0_mul_prim_add_one_sub_prim_mul_shade) },
9221 // Menu background, wwf no mercy
9222 // (env-shade)*prim+shade
9223 { 0x83458345, cmb(cc_prim_mul_env_add_one_sub_prim_mul_shade) },
9224 // Pokemon selection window background, pokemon stadium 2
9225 // (noise-shade)*prim+shade
9226 { 0x83478347, cmb(cc_shade) },
9227 // crown of king of ikana, zelda 2. Added by Gonetz
9228 // (t0-env)*prim+shade
9229 { 0x83518351, cmb(cc_t0_sub_env_mul_prim_add_shade) },
9230 // crown of king of ikana, zelda 2. Added by Gonetz
9231 // (t0-env)*prim+shade, (cmb-0)*cmb+0 ** INC **
9232 { 0x8351e0f0, cmb(cc_t0_sub_env_mul_prim_add_shade) },
9233 // salesman's shirt in the bomb shop in town, zelda 2 [Ogy]. Added by Gonetz
9234 // (t0-env)*prim+shade, (cmb-0)*shade+0 ** INC **
9235 { 0x8351e4f0, cmb(cc_t0_mul_prim_mul_shade) },
9236 // intro, Madden Footbal
9237 // (1-env)*prim+shade
9238 { 0x83568356, cmb(cc_one_sub_env_mul_prim_add_shade) },
9239 // Buss hunter 64. Added by Gonetz
9240 // (t0-0)*prim+shade
9241 { 0x83f183f1, cmb(cc_t0_mul_prim_add_shade) },
9242 // huge water lilies, zelda 2 [Ogy]. Added by Gonetz
9243 // (t0-0)*prim+shade, (cmb-env)*shade+0 ** INC **
9244 { 0x83f1e450, cmb(cc__t0_mul_prim_add_shade__sub_env_mul_shade) },
9245 // Objects in arena, pokemon stadium 2
9246 // (t1-0)*prim+shade, (cmb-0)*prim_a+0 - not going to bother with prim_a since it is FF
9247 { 0x83f2eaf0, cmb(cc_t1_mul_prim_add_shade) },
9248 // Pokemon Stadium 2. Added by Gonetz
9249 // (t0-prim)*shade+shade ** INC **
9250 { 0x84318431, cmb(cc_t0_mul_shade) },
9251 // big N, Pokemon Stadium 2. Added by Gonetz
9252 // (1-prim)*shade+shade ** INC **
9253 { 0x84368436, cmb(cc_one_sub_prim_mul_shade_add_shade) },
9254 // arena, PokemonStadium2, [Raziel64]
9255 // (t0-0)*shade+shade, (cmb-0)*prim+0
9256 { 0x84f1e3f0, cmb(cc_t0_mul_prim_mul_shade_add_prim_mul_shade) },
9257 // Spiderman. Added by Gonetz
9258 // (1-0)*shade+shade
9259 { 0x84f684f6, cmb(cc_shade) },
9260 // the "gekko" ( a monster in a room above the 3rd room of woodfall temple ) }, zelda 2 [Ogy]. Added by Gonetz
9261 // (t0-prim)*env+shade ** INC **
9262 { 0x85318531, cmb(cc_t0_sub_prim_mul_env_add_shade) },
9263 // clothes, zelda 2. Added by Gonetz
9264 // (t0-prim)*env+shade, (cmb-0)*shade+0 ** INC **
9265 { 0x8531e4f0, cmb(cc_t0_mul_env_mul_shade) },
9266 // Robotron 64, [scorpiove]
9267 // (env-shade)*env+shade ** INC **
9268 { 0x85458545, cmb(cc_one_sub_env_mul_shade_add_env) },
9269 // Enemy dying, quest64
9270 // (1-shade)*env+shade **changed by Gonetz
9271 { 0x85468546, cmb(cc_one_sub_shade_mul_env_add_shade) },
9272 // Sky, Beetle Adventure Racing ** INC **
9273 //(t0-shade)*t0_a+shade, (env-cmb)*enva+cmb
9274 { 0x88410c05, cmb(cc_t0_sub_shade_mul_t0a_add_shade) },
9275 // Mario's eyes, mario
9276 //z (t0-shade)*t0_a+shade
9277 { 0x88418841, cmb(cc_t0_sub_shade_mul_t0a_add_shade) },
9278 //beetle adventure racing. Added by Gonetz
9279 // (prim-shade)*t1_a+shade, (t1-0)*cmb+0 **INC**
9280 { 0x8843e0f2, cmb(cc_t1_mul_shade) },
9281 // blast corps [Ogy]
9282 // (prim-shade)*t1_a+shade
9283 { 0x89438943, cmb(cc_prim_sub_shade_mul_t1a_add_shade) },
9284 //broken wall, beetle adventure racing. Added by Gonetz
9285 // (t0-shade)*prima+shade, (1-0)*0+cmb
9286 { 0x8a411ff6, cmb(cc_t0_sub_shade_mul_prima_add_shade) },
9287 // menu, battle phoenix 64. Added by Gonetz
9288 // (t0-shade)*prima+shade
9289 { 0x8a418a41, cmb(cc_t0_add_shade) },
9290 // intro, castlevania 2. Added by Gonetz
9291 // (prim-shade)*prim_a+shade
9292 { 0x8a438a43, cmb(cc_prim_sub_shade_mul_prima_add_shade) },
9293 // ?
9294 // (1-shade)*shade_a+shade
9295 { 0x8b468b46, cmb(cc_one_sub_shade_mul_shadea_add_shade) },
9296 // arena, Pokemon Stadium. Added by Gonetz
9297 // (t0-t1)*env_a+shade, (cmb-env)*prim+0 ** INC **
9298 { 0x8c21e350, cmb(cc_t0_add_prim_mul_shade) },
9299 //diddy kong racing background fill. Added by Gonetz ** Modified by Dave2001
9300 // (env-shade)*env_a+shade, (cmb-0)*prim+0
9301 { 0x8c458c45, cmb(cc_shade) }, // note: previous combiner used other_alpha; doesn't work
9302 //diddy kong racing. Added by Gonetz
9303 // (env-shade)*env_a+shade, (cmb-0)*prim+0 ** INC **
9304 { 0x8c45e3f0, cmb(cc_prim_mul_shade) },
9305 // sky, Pokemon Stadium, [Raziel64]
9306 // (t0-0)*env_a+shade, (cmb-env)*prim+0 ** INC **
9307 { 0x8cf1e350, cmb(cc_t0_mul_prim_add_shade_sub_env_mul_prim) },
9308 // zelda 2 [Ogy]. Added by Gonetz
9309 // (t0-prim)*primlod+shade, (prim-env)*cmb+env ** INC **
9310 { 0x8e31a053, cmb(cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_shade__add_env) },
9311 // fallen leaves, Dobutsu no Mori. Added by Gonetz
9312 // (t0-shade)*primlod+shade, (prim-env)*cmb+env ** INC **
9313 { 0x8e41a053, cmb(cc_prim_sub_env_mul__t0_sub_shade_mul_primlod_add_shade__add_env) },
9314 // the icicle above the part just before the entrance to the mountain village, zelda 2 [Ogy]. Added by Gonetz
9315 // (t0-prim)*0+shade, (prim-env)*cmb+env ** INC ** ?
9316 { 0x9f31a053, cmb(cc_prim_sub_env_mul_shade_add_env) },
9317 // background on level 3-1, kirby 64 [Raziel64]. Added by Gonetz
9318 // (0-env)*0+shade
9319 { 0x9f5f9f5f, cmb(cc_shade) },
9320 // Spotlight, smash bros
9321 // (1-0)*0+shade
9322 { 0x9ff69ff6, cmb(cc_shade) },
9323 // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
9324 // (0-0)*0+shade, (cmb-cmb)*cmb+cmb
9325 { 0x9fff0000, cmb(cc_shade) },
9326 // menu, Dr.Mario. Added by Gonetz
9327 // (0-0)*0+shade, (prim-cmb)*env+cmb
9328 { 0x9fff0503, cmb(cc_prim_sub_shade_mul_env_add_shade) },
9329 // pikachu, hey you pikachu. Added by Gonetz
9330 // (0-0)*0+shade, (env-cmb)*enva+cmb
9331 { 0x9fff0c05, cmb(cc_env_sub_shade_mul_enva_add_shade) },
9332 // mega shock, paper mario
9333 //(0-0)*0+shade, (env-prim)*cmb+prim
9334 { 0x9fff6035, cmb(cc_env_sub_prim_mul_shade_add_prim) },
9335 // Super Mario 64 logo background
9336 //z (k5-k5)*0+shade
9337 { 0x9fff9fff, cmb(cc_shade) },
9338 // Zelda 2 final movie. Added by Gonetz
9339 // (0-0)*0+shade, (prim-0)*cmb+0
9340 { 0x9fffe0f3, cmb(cc_prim_mul_shade) },
9341 // tree shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
9342 // (0-0)*0+shade, (env-0)*cmb+0
9343 { 0x9fffe0f5, cmb(cc_env_mul_shade) },
9344 // N64 logo, Aidyn Chronicles. Added by Gonetz
9345 // (0-0)*0+shade, (cmb-0)*prim+0
9346 { 0x9fffe3f0, cmb(cc_prim_mul_shade) },
9347 // Hand, smash bros
9348 // (0-0)*0+shade, (cmb-0)*env+0
9349 { 0x9fffe5f0, cmb(cc_env_mul_shade) },
9350 // Lave piranha atack, Paper Mario
9351 // (t1-t0)*t0+env, (cmb-t1)*t0+prim ** INC **
9352 { 0xa1126120, cmb(cc__t0_mul_t1__mul_env_add_prim) },
9353 // Kirby64 end [Raziel64]. Added by Gonetz
9354 // (prim-shade)*t0+env
9355 { 0xa143a143, cmb(cc_prim_sub_shade_mul_t0_add_env) },
9356 // Superman [scorpiove]. Added by Gonetz
9357 // (t0-env)*t0+env
9358 { 0xa151a151, cmb(cc_t0_sub_env_mul_t0_add_env) },
9359 // powder keg, zelda 2. Added by Gonetz
9360 // (prim-env)*t0+env, (0-0)*shade_a+cmb
9361 { 0xa1530bff, cmb(cc_prim_sub_env_mul_t0_add_env) },
9362 // Kotake & koume defeated, going into sky, zelda
9363 // (prim-env)*t0+env, (prim-env)*0+cmb
9364 { 0xa1531f53, cmb(cc_prim_sub_env_mul_t0_add_env) },
9365 // water, Dobutsu no Mori. Added by Gonetz
9366 // (prim-env)*t0+env, (cmb-0)*shade+t0
9367 { 0xa15324f0, cmb(cc_t0_add_shade_mul_env) },
9368 //broken wall, beetle adventure racing. Added by Gonetz
9369 // (prim-env)*t0+env, (cmb-shade)*t1+shade **INC** can't be done in one step
9370 { 0xa1538240, cmb(cc_prim_sub_env_mul__t0_mul_t1__add_shade) },
9371 //couple's mask, zelda2. Added by Gonetz
9372 // (prim-env)*t0+env, (prim-cmb)*shade+shade **INC** can't be done in one step
9373 { 0xa1538403, cmb(cc_t0_mul_shade) },
9374 // stadium, Pokemon Stadium 2. Added by Gonetz
9375 // (prim-env)*t0+env, (cmb-0)*shade+shade **INC** can't be done in one step
9376 { 0xa15384f0, cmb(cc_t0_mul_shade) },
9377 //clothes on girl in inn, zelda2. Added by Gonetz
9378 // (prim-env)*t0+env, (cmb-prim)*env+shade **INC** can't be done in one step
9379 { 0xa1538530, cmb(cc_t0_mul_env_add_shade) },
9380 // Getting light arrows for the first time, zelda
9381 // (prim-env)*t0+env, (prim-env)*cmb+env ** INC **
9382 { 0xa153a053, cmb(cc_prim_sub_env_mul_t0_add_env) },
9383 // Fire, starfox
9384 // (prim-env)*t0+env
9385 { 0xa153a153, cmb(cc_prim_sub_env_mul_t0_add_env) },
9386 // a spell, Fushigi no Dungeon: Fuurai no Shiren 2
9387 // (prim-env)*t0+env, (cmb-env)*enva+env
9388 { 0xa153ac50, cmb(cc_prim_sub_env_mul__t0_mul_enva__add_env) },
9389 // wizrobe's attack, zelda 2. Added by Gonetz.
9390 // (prim-env)*t0+env, (cmb-0)*cmb+0
9391 { 0xa153e0f0, cmb(cc_prim_sub_env_mul_t0_add_env) },
9392 // dress, zelda 2. Added by Gonetz.
9393 // also for Great Farie's hair - changed to use texture mod by Dave2001.
9394 // (prim-env)*t0+env, (shade-0)*cmb+0
9395 { 0xa153e0f4, cmb(cc__env_inter_prim_using_t0__mul_shade) },
9396 // Start menu, paper mario
9397 // (prim-env)*t0+env, (cmb-0)*t0+0
9398 { 0xa153e1f0, cmb(cc_prim_sub_env_mul_t0_add_env) },
9399 // { 0xa153e0f4, cmb(cc_prim_sub_env_mul_t0_add_env) },
9400 // Jellyfish tentacles in Jabu-Jabu's belly, zelda
9401 // (prim-env)*t0+env, (cmb-0)*prim+0
9402 { 0xa153e3f0, cmb(cc__env_inter_prim_using_t0__mul_prim) },
9403 // Dust, zelda
9404 //z (prim-env)*t0+env, (cmb-k5)*shade+cmb_a ** INC **
9405 { 0xa153e4f0, cmb(cc__env_inter_prim_using_t0__mul_shade) },
9406 //0xa153e4f0, cmb(cc_prim_sub_env_mul_t0_add_env) },
9407 // roof, Kirby 64. Added by Gonetz
9408 // (prim-env)*t0+env, (cmb-0)*env+0 ** INC **
9409 { 0xa153e5f0, cmb(cc_prim_sub_env_mul_t0_add_env) },
9410 // Something weird in intro, monster truck madness
9411 // (prim-env)*t0+env, (cmb-0)*k5+0
9412 { 0xa153eff0, cmb(cc__prim_sub_env_mul_t0_add_env__mul_k5) },
9413 // clothes, kirby 64. Added by Gonetz
9414 // (shade-env)*t0+env
9415 { 0xa154a154, cmb(cc_shade_sub_env_mul_t0_add_env) },
9416 // field, Derby Stallion
9417 // (shade-env)*t0+env, (cmb-0)*prim+0 ** INC **
9418 { 0xa154e3f0, cmb(cc_shade_sub_env_mul_t0_mul_prim_add_prim_mul_env) },
9419 // background, level 3-5, kirby 64, [Raziel64]
9420 // (shade-env)*t0+env, (cmb-0)*shade+0 ** INC **
9421 { 0xa154e4f0, cmb(cc_shade_sub_env_mul_t0_add_env) },
9422 // quake 2 intro
9423 // (prim-0)*t0+env, (prim-0)*primlod+cmb ** INC **
9424 { 0xa1f30ef3, cmb(cc_t0_mul_prim_add_env) },
9425 // Kotake or koume's hair, zelda
9426 // (prim-0)*t0+env
9427 { 0xa1f3a1f3, cmb(cc_t0_mul_prim_add_env) },
9428 // track, ridge racer. Added by Gonetz
9429 // (t0-env)*t1+env, (cmb-0)*shade+0 ** INC **
9430 { 0xa251e4f0, cmb(cc__t0_mul_t1__mul_shade) },
9431 // lava, beetle adventure racing
9432 // (t0-env)*t1+env, (cmb-0)*enva+0 ** INC **
9433 { 0xa251ecf0, cmb(cc__t0_mul_t1__mul_enva) },
9434 // Ded Moroz, Paper Mario
9435 // (prim-env)*t1+env, (1-cmb)*t1+cmb ** INC **
9436 { 0xa2530206, cmb(cc_prim_sub_env_mul_t1_add_env) },
9437 // text, monster truck madness
9438 // (prim-env)*t1+env
9439 { 0xa253a253, cmb(cc_prim_sub_env_mul_t1_add_env) },
9440 // car position, Top Gear Rally. Added by Gonetz
9441 // (prim-env)*t1+env, (cmb-t0)*t1+0 ** INC **
9442 { 0xa253e210, cmb(cc_prim_sub_env_mul_t1_add_env_mul_t0) },
9443 // text, Top Gear Rally. Added by Gonetz
9444 // (prim-env)*t1+env, (cmb-0)*t1+0 ** INC **
9445 { 0xa253e2f0, cmb(cc_prim_sub_env_mul_t1_add_env_mul_t0) },
9446 // 0xa253e2f0, cmb(cc_prim_sub_env_mul_t1_add_env) },
9447 // a pole in the cut-scene that appears after you receive odolwa's mask, zelda 2 [Ogy]. Added by Gonetz
9448 // (prim-env)*t1+env, (cmb-0)*shade+0 ** INC **
9449 { 0xa253e4f0, cmb(cc_t1_mul_prim_mul_shade) },
9450 // Quake 2 intro. Added by Gonetz
9451 // (t0-0)*t1+env, (t0-0)*primlod+cmb ** INC **
9452 { 0xa2f10ef1, cmb(cc__t0_mul_t1__add_env) },
9453 // Quake64. Added by Gonetz
9454 // (t0-0)*t1+env
9455 { 0xa2f1a2f1, cmb(cc__t0_mul_t1__add_env) },
9456 // Quake II. Added by Gonetz ** INC **
9457 // (t0-0)*t1+env, (cmb-0)*prim+env
9458 { 0xa2f1a3f0, cmb(cc__t0_mul_t1__mul_prim_add_env) },
9459 // Dr Mario [Ogy]. Added by Gonetz
9460 // (t0-env)*prim+env
9461 // 0xa351a351, cmb(cc_t0_mul_prim_add_env) },
9462 { 0xa351a351, cmb(cc_t0_sub_env_mul_prim_add_env) },
9463 // menu, Dr.Mario. Added by Gonetz
9464 // (prim-env)*prim+env
9465 { 0xa353a353, cmb(cc_prim_sub_env_mul_prim_add_env) },
9466 // Razor sword, zelda 2. Added by Gonetz
9467 // (shade-env)*prim+env, (cmb-0)*shade+0 ** INC **
9468 { 0xa354e4f0, cmb(cc_shade_sub_env_mul_prim_add_env) },
9469 // bomberman 64-2 intro. Added by Gonetz
9470 // (1-env)*prim+env
9471 { 0xa356a356, cmb(cc_one_sub_env_mul_prim_add_env) },
9472 // thing that escapes from the well, zelda
9473 // (noise-env)*prim+env
9474 { 0xa357a357, cmb(cc_prim_add_env) },
9475 // Bongo Bongo, zelda
9476 // (noise-env)*prim+env, (cmb-0)*shade+0
9477 { 0xa357e4f0, cmb(cc_env_mul_shade) },
9478 // paper mario. Added by Gonetz
9479 // (t0-0)*prim+env
9480 { 0xa3f1a3f1, cmb(cc_t0_mul_prim_add_env) },
9481 // paper mario. Added by Gonetz
9482 // (t0-0)*prim+env, (t0-env)*prim+0
9483 { 0xa3f1e351, cmb(cc_t0_mul_prim_add_env) },
9484 // paper mario. Added by Gonetz
9485 // (t0-0)*prim+env, (t0-0)*prim+0
9486 { 0xa3f1e3f1, cmb(cc_t0_mul_prim) },
9487 // squirt, paper mario. Added by Gonetz
9488 // (t1-0)*prim+env, (1-cmb)*t1+cmb
9489 { 0xa3f20206, cmb(cc_t1_mul_prim_add_env) },
9490 // paper mario. Added by Gonetz
9491 // (shade-0)*prim+env
9492 { 0xa3f4a3f4, cmb(cc_prim_mul_shade_add_env) },
9493 // Doraemon 2. Added by Gonetz
9494 // (1-0)*prim+env
9495 { 0xa3f6a3f6, cmb(cc_prim_add_env) },
9496 // Pokemon Stadium 2, [Jeremy]. Added by Gonetz
9497 // (noise-0)*prim+env ** INC ** ?
9498 { 0xa3f7a3f7, cmb(cc_prim_add_env) },
9499 // monsters, Pokemon Stadium. Added by Gonetz
9500 // (t0-t1)*shade+env, (cmb-0)*prim+0 ** INC **
9501 { 0xa421e3f0, cmb(cc_t0_mul_prim_mul_shade_add_prim_mul_env) },
9502 // background, pokemon stadium 2
9503 // (t0-prim)*shade+env
9504 { 0xa431a431, cmb(cc_t0_mul_shade) },
9505 // Buildings, pokemon stadium 2
9506 // (t1-prim)*shade+env
9507 { 0xa432a432, cmb(cc_t1_mul_shade) },
9508 // bomberman 64 [Ogy]
9509 // (t0-env)*shade+env
9510 { 0xa451a451, cmb(cc_t0_mul_shade_add_env) },
9511 // kirby drill, kirby 64. Added by Gonetz
9512 // (prim-env)*shade+env
9513 { 0xa453a453, cmb(cc_prim_sub_env_mul_shade_add_env) },
9514 // ball, ISS98 intro. Added by Gonetz
9515 // (t0-0)*shade+env
9516 { 0xa4f1a4f1, cmb(cc_t0_mul_shade_add_env) },
9517 // score, ISS98 intro. Added by Gonetz
9518 // (prim-0)*shade+env
9519 { 0xa4f3a4f3, cmb(cc_prim_mul_shade_add_env) },
9520 // magic fist, Rayman2. Added by Gonetz
9521 // (env-0)*shade+env
9522 { 0xa4f5a4f5, cmb(cc_env_mul_shade_add_env) },
9523 // gunfire, Quake64. Added by Gonetz
9524 // (1-0)*shade+env
9525 { 0xa4f6a4f6, cmb(cc_env_add_shade) },
9526 // Paper Mario. Added by Gonetz
9527 // (t0-center)*scale+env, (0-prim)*cmb+env
9528 { 0xa661a03f, cmb(cc_t0_add_env) },
9529 // pink car, f-zero x
9530 // (t0-env)*t0_a+env, cmb*shade
9531 { 0xa851e4f0, cmb(cc__env_inter_t0_using_t0a__mul_shade) },
9532 // PokemonStadium1, [Raziel64]
9533 // (prim-env)*t0_a+env, (cmb-cmb)*cmb+cmb
9534 { 0xa8530000, cmb(cc_prim_sub_env_mul_t0a_add_env) },
9535 // N64 logo, Ogre Battle
9536 // (prim-env)*t0_a+env
9537 { 0xa853a853, cmb(cc_prim_sub_env_mul_t0a_add_env) },
9538 // Mud Slap, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
9539 // (prim-env)*t0_a+env, (cmb-0)*cmb+0
9540 { 0xa853e0f0, cmb(cc_prim_sub_env_mul_t0a_add_env) },
9541 // Tree background, mace
9542 // (prim-env)*t0_a+env, (cmb-0)*t0+0
9543 { 0xa853e1f0, cmb(cc__env_inter_prim_using_t0a__mul_t0) },
9544 // logo, Deadly Arts. Added by Gonetz
9545 // (prim-env)*t1_a+env
9546 { 0xa953a953, cmb(cc_prim_sub_env_mul_t1a_add_env) },
9547 // Girl, PD intro. Added by Gonetz
9548 // (t0-env)*shade_alpha+env, (cmb-0)*shade+0 ** INC **
9549 { 0xab51e4f0, cmb(cc_t0_mul_shade) },
9550 // 0xab51e4f0, cmb(cc_t0_sub_env_mul_shade_mul_shadea_add_env) },
9551 // Some gannon spell, zelda
9552 // (prim-env)*shade_alpha+env
9553 { 0xab53ab53, cmb(cc_prim_sub_env_mul_shadea_add_env) },
9554 // Boxes, Taz express. Added by Gonetz
9555 // (t0-env)*env_a+env
9556 { 0xac51ac51, cmb(cc_t0_sub_env_mul_enva_add_env) },
9557 // paper mario. Added by Gonetz
9558 // (t0-env)*env_a+env, (cmb-0)*shade+0 **INC**
9559 { 0xac51e4f0, cmb(cc_t0_mul_env_mul_shade) },
9560 // goal, Monster Truck Madness 64
9561 // (noise-0)*env_a+env, (cmb-0)*t1+0 **INC**
9562 { 0xacf7e2f0, cmb(cc_t1_mul_env) },
9563 // sword on forge, zelda 2. Added by Gonetz
9564 // (t1-t1)*lodf+env, (t1-t0)*cmb+prim
9565 { 0xae226012, cmb(cc__t1_sub_t0__mul_env_add_prim) },
9566 // menu background, Pokemon Stadium 2, [Raziel64]
9567 // (t0-prim)*lodf+env
9568 { 0xae31ae31, cmb(cc_t0_sub_prim_mul_primlod_add_env) },
9569 // odd mushroom, zelda oot. Added by Gonetz
9570 // (t0-shade)*lodf+env, (prim-env)*cmb+env ** INC **
9571 { 0xae41a053, cmb(cc__env_inter_prim_using__t0_sub_shade_mul_primlod_add_env) },
9572 // 0xae41a053, cmb(cc_prim_sub_env_mul__t0_mul_shade__add_env) },
9573 // Morning Sun, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
9574 // (t0-env)*lodf+env, (cmb-0)*prim+0
9575 { 0xae51e3f0, cmb(cc__env_inter_t0_using_primlod__mul_prim) },
9576 //Spacestation Silicon Valley intro. Added by Gonetz
9577 // (prim-env)*lodf+env
9578 { 0xae53ae53, cmb(cc_env_inter_prim_using_primlod) },
9579 // Doom, intro. Added by Gonetz
9580 // (t0-0)*lodf+env, (t0-0)*lodf+env
9581 { 0xaef1aef1, cmb(cc_t0_add_env) },
9582 // Dobutsu no Mori. Added by Gonetz
9583 // (prim-0)*lodf+env
9584 { 0xaef3aef3, cmb(cc_prim_add_env) },
9585 // light from window, Dobutsu no Mori. Added by Gonetz
9586 // (prim-0)*lodf+env, (t1-0)*cmb+0
9587 { 0xaef3e0f2, cmb(cc_t1_mul__prim_add_env) },
9588 // intro, Mission Impossible. Added by Gonetz
9589 // (k5-k5)*0+env, (0-0)*scale+env
9590 { 0xbfffa6ff, cmb(cc_env) },
9591 // Something blocking the screen, waverace
9592 //z (k5-k5)*0+env
9593 { 0xbfffbfff, cmb(cc_env) },
9594 // Derby Stallion . Added by Gonetz
9595 // (0-0)*0+env, (cmb-0)*prim+0
9596 { 0xbfffe3f0, cmb(cc_prim_mul_env) },
9597 // zelda 2 [Ogy]. Added by Gonetz
9598 // (k5-k5)*0+env, ((cmb-0)*shade+0
9599 { 0xbfffe4f0, cmb(cc_env_mul_shade) },
9600 // flame, paper mario. Added by Gonetz
9601 // (t0-t1)*t0+1, (0-prim)*cmb+env **INC** weird
9602 { 0xc121a03f, cmb(cc__t0_inter_t1_using_half__mul_prim_add_env) },
9603 // tube near big monster on level 5, Kirby64 [Raziel64]
9604 // (prim-env)*t0+1, (cmb-0)*shade+0 ** INC **
9605 { 0xc153e4f0, cmb(cc_prim_sub_env_mul_t0_mul_shade) },
9606 // paper mario. Added by Gonetz
9607 // (0-env)*t0+1, (prim-cmb)*t0+prim **INC**
9608 { 0xc15f6103, cmb(cc_env_sub_prim_mul_t0_add_prim) },
9609 // HAL, smash bros
9610 // (0-0)*0+1
9611 { 0xdfffdfff, cmb(cc_one) },
9612 // arena, Pokemon Stadium 1, [Raziel64]
9613 // (0-0)*0+1, (cmb-0)*prim+0
9614 { 0xdfffe3f0, cmb(cc_prim) },
9615 // skis, Spacestation Silicon Valley. Added by Gonetz
9616 // (shade-0)*cmb+0, (t1-t0)*primlod+t0
9617 { 0xe0f42d12, cmb(cc_t0_inter_t1_using_primlod) },
9618 // paper mario. Added by Gonetz
9619 // (1-t1)*t0+0, (env-prim)*cmb+prim ** INC **
9620 { 0xe1266035, cmb(cc_env_sub_prim_mul__t0_mul_t1__add_prim) },
9621 // ground, zelda 2. Added by Gonetz.
9622 // (t1-prim)*t0+0, (cmb-0)*shade+0
9623 { 0xe132e4f0, cmb(cc__t1_sub_prim_mul_t0__mul_shade) },
9624 // carmagedon
9625 // (shade-prim)*t0+0
9626 { 0xe134e134, cmb(cc_shade_sub_prim_mul_t0) },
9627 // skeleton, castlevania 2. Added by Gonetz
9628 // (1-prim)*t0+0, (cmb-0)*shade+0
9629 { 0xe136e4f0, cmb(cc_t0_mul_1mprim_mul_shade) },
9630 // Starshot logo. Added by Gonetz
9631 // (shade-env)*t0+0, (1-0)*cmb+cmb
9632 { 0xe15400f6, cmb(cc_shade_sub_env_mul_t0) },
9633 // Kirby morfing, smash bros. Added by Gonetz
9634 // (shade-env)*t0+0
9635 { 0xe154e154, cmb(cc_shade_sub_env_mul_t0) },
9636 // menu, PGA euro tour. Added by Gonetz
9637 // (1-env)*t0+0
9638 { 0xe156e156, cmb(cc_one_sub_env_mul_t0) },
9639 // paper mario. Added by Gonetz
9640 // (t0-0)*t0+0, (1-cmb)*prim+cmb
9641 { 0xe1f10306, cmb(cc_one_sub_t0_mul_prim_add_t0) },
9642 // F1 World Grand Prix. Added by Gonetz
9643 // (t0-0)*t0+0, (shade-prim)*cmb+prim
9644 { 0xe1f16034, cmb(cc_shade_sub_prim_mul_t0_add_prim) },
9645 // paper mario. Added by Gonetz
9646 // (t0-0)*t0+0, (env-prim)*cmb+prim
9647 { 0xe1f16035, cmb(cc_env_sub_prim_mul_t0_add_prim) },
9648 // sparkles, F1 World Grand Prix. Added by Gonetz
9649 // (t0-0)*t0+0, (1-prim)*cmb+prim
9650 { 0xe1f16036, cmb(cc_one_sub_prim_mul_t0_add_prim) },
9651 // Tony Hawk's Pro Skater. Added by Gonetz
9652 // (t0-0)*t0+0, (cmb-0)*t0+0
9653 { 0xe1f1e1f0, cmb(cc_t0) },
9654 // something in upper left corner, mario tennis
9655 // (t0-0)*t0+0
9656 { 0xe1f1e1f1, cmb(cc_t0) },
9657 // zelda 2. Added by Gonetz
9658 // (t0-0)*t0+0, (cmb-0)*prim+0
9659 { 0xe1f1e3f0, cmb(cc_t0_mul_prim) },
9660 // zelda 2 final movie. Added by Gonetz
9661 // (t0-0)*t0+0, (cmb-0)*shade+0
9662 { 0xe1f1e4f0, cmb(cc_t0_mul_shade) },
9663 // paper mario. Added by Gonetz
9664 // (t0-t1)*t0+1, (env-cmb)*prima+cmb ** INC **
9665 { 0xe1f20a05, cmb(cc_t1_mul_prima) },
9666 // terrain, SCARS. Added by Gonetz
9667 // (t1-0)*t0+0, (env-prim)*cmb+prim
9668 { 0xe1f26035, cmb(cc_env_sub_prim_mul__t0_mul_t1__add_prim) },
9669 // Trees, Zelda 2
9670 // (t1-0)*t0+0, (cmb-0)*shade+prim
9671 { 0xe1f264f0, cmb(cc__t0_mul_t1__mul_shade_add_prim) },
9672 // terrain, SCARS. Added by Gonetz
9673 // (t1-0)*t0+0, (env-shade)*cmb+shade
9674 { 0xe1f28045, cmb(cc_env_sub_shade_mul__t0_mul_t1__add_shade) },
9675 // arena, Pokemon Stadium 2. Added by Gonetz
9676 // (t1-0)*t0+0, (cmb-prim)*shade+shade ** INC **
9677 { 0xe1f28430, cmb(cc__t0_mul_t1__mul_shade) },
9678 // Zelda 2, [Ogy]. Added by Gonetz
9679 // (t1-0)*t0+0, (cmb-prim)*env+shade ** INC **
9680 { 0xe1f28530, cmb(cc__t0_mul_t1__mul_env_add_shade) },
9681 // pokemon attack, Pokemon Stadium 2. Added by Gonetz
9682 // (t1-0)*t0+0, (prim-env)*cmb+env
9683 { 0xe1f2a053, cmb(cc_prim_sub_env_mul__t0_mul_t1__add_env) },
9684 // paper mario. Added by Gonetz
9685 // (t1-0)*t0+0, (cmb-0)*prim+env
9686 { 0xe1f2a3f0, cmb(cc__t0_mul_t1__mul_prim_add_env) },
9687 // Sand, pokemon stadium 2
9688 // (t1-0)*t0+0, (cmb-prim)*shade+env ** INC **
9689 { 0xe1f2a430, cmb(cc__t0_mul_t1__mul_shade) },
9690 // grass, Mission Impossible. Added by Gonetz
9691 // (t1-0)*t0+0, (shade-0)*cmb+0
9692 { 0xe1f2e0f4, cmb(cc__t0_mul_t1__mul_shade) },
9693 // lighthouse's beam, zelda 2. Added by Gonetz
9694 // (t1-0)*t0+0, (cmb-0)*prim+0
9695 { 0xe1f2e3f0, cmb(cc__t0_mul_t1__mul_prim) },
9696 // Bottom of wings, pilotwings
9697 // (t1-0)*t0+0, (cmb-0)*shade+0
9698 { 0xe1f2e4f0, cmb(cc__t0_mul_t1__mul_shade) },
9699 // zelda 2. Added by Gonetz
9700 // (t1-0)*t0+0, (cmb-0)*prima+0
9701 { 0xe1f2eaf0, cmb(cc__t0_mul_t1__mul_prima) },
9702 // lava, Roadsters. Added by Gonetz
9703 // (prim-0)*t0+0, (1-prim)*t0+cmb
9704 { 0xe1f30136, cmb(cc_t0) },
9705 // sky, Pokemon Stadium 2. Added by Gonetz
9706 // (prim-0)*t0+0, (cmb-0)*shadea+env
9707 { 0xe1f3abf0, cmb(cc_t0_mul_prim_mul_shadea_add_env) },
9708 // cars, Indy Racing 2000. Added by Gonetz
9709 // (prim-0)*t0+0, (shade-0)*cmb+0
9710 { 0xe1f3e0f4, cmb(cc_t0_mul_prim_mul_shade) },
9711 // Sign shadows, zelda
9712 //z (prim-k5)*t0+cmb_a
9713 { 0xe1f3e1f3, cmb(cc_t0_mul_prim) },
9714 // Table, mace
9715 // (prim-0)*t0+0, (cmb-0)*shade+0
9716 { 0xe1f3e4f0, cmb(cc_t0_mul_prim_mul_shade) },
9717 // Gauntlet Legends intro
9718 // (prim-0)*t0+0, (cmb-0)*prima+0
9719 { 0xe1f3eaf0, cmb(cc_t0_mul_prim_mul_prima) },
9720 // walls, beetle adventure racing. Added by Gonetz
9721 // (shade-0)*t0+0, (prim-0)*t0+cmb
9722 { 0xe1f401f3, cmb(cc_t0_mul_shade) },
9723 // cars, ridge racer. Added by Gonetz
9724 // (shade-0)*t0+0, (prim-cmb)*cmb_a+cmb **INC**
9725 { 0xe1f40703, cmb(cc_t0_mul_shade) },
9726 // water block, Paper Mario. Added by Gonetz
9727 // (shade-0)*t0+0, (prim-env)*cmb+env
9728 { 0xe1f4a053, cmb(cc_prim_sub_env_mul__t0_mul_shade__add_env) },
9729 // a lot in TWINE. Added by Gonetz
9730 // (shade-0)*t0+0, (cmb-0)*prim+env
9731 { 0xe1f4a3f0, cmb(cc_t0_mul_prim_mul_shade_add_env) },
9732 // Xena. Added by Gonetz
9733 // (shade-0)*t0+0, (env-0)*cmb+0
9734 { 0xe1f4e0f5, cmb(cc_t0_mul_env_mul_shade) },
9735 // Starshot logo. Added by Gonetz
9736 // (shade-0)*t0+0, (1-0)*cmb+0
9737 { 0xe1f4e0f6, cmb(cc_t0_mul_shade) },
9738 // Duck Dodgers intro. Added by Gonetz
9739 // (shade-0)*t0+0
9740 { 0xe1f4e1f4, cmb(cc_t0_mul_shade) },
9741 // shadow, Mission Impossible. Added by Gonetz
9742 // (shade-0)*t0+0, (cmb-0)*prim+0
9743 { 0xe1f4e3f0, cmb(cc_t0_mul_prim_mul_shade) },
9744 // Tony Hawk's Pro Skater 3. Added by Gonetz
9745 // (env-0)*t0+0, (t1-0)*shade+cmb ** INC **
9746 { 0xe1f504f2, cmb(cc__t0_add_t1__mul_shade) },
9747 // text, tonic trouble. Added by Gonetz
9748 // (env-0)*t0+0
9749 { 0xe1f5e1f5, cmb(cc_t0_mul_env) },
9750 // powder keg, zelda 2. Added by Gonetz
9751 // (env-0)*t0+0, (cmb-0)*shade+0
9752 { 0xe1f5e4f0, cmb(cc_t0_mul_env_mul_shade) },
9753 // water, Starshot. Added by Gonetz
9754 // (1-0)*t0+0, (1-0)*cmb+0
9755 { 0xe1f6e0f6, cmb(cc_t0) },
9756 // bomberman 64 [Ogy]
9757 // (1-0)*t0+0
9758 { 0xe1f6e1f6, cmb(cc_t0) },
9759 // Mermaid attack, Mystical Ninja
9760 // (noise-0)*t0+0
9761 { 0xe1f7e1f7, cmb(cc_t0) },
9762 // paper mario. Added by Gonetz * changed because of odd palette copy
9763 // (t0-0)*t1+0, (shade-env)*cmb+cmb **INC** ?
9764 { 0xe2f10054, cmb(cc_shade_sub_env_mul__t0_mul_t1__add__t0_mul_t1) },
9765 // water, PGA European Tour
9766 // (t0-0)*t1+0, (env-cmb)*prim+cmb
9767 { 0xe2f10305, cmb(cc_one_sub_prim_mul__t0_mul_t1__add__prim_mul_env) },
9768 // Grass, mario golf
9769 // (t0-0)*t1+0, (cmb-t0)*cmb_a+t0
9770 { 0xe2f12710, cmb(cc_t0_mul_t1) },
9771 // xg2, Added by Gonetz
9772 // (t0-0)*t1+0, (env-prim)*cmb+prim
9773 { 0xe2f16035, cmb(cc_env_sub_prim_mul__t0_mul_t1__add_prim) },
9774 // poo, CBFD, Added by Gonetz
9775 // (t0-0)*t1+0, (cmb-env)*shade+prim ** INC **
9776 { 0xe2f16450, cmb(cc__t0_mul_t1__mul_shade_add_prim) },
9777 // sky, xg2, Added by Gonetz
9778 // (t0-0)*t1+0, (cmb-prim)*cmb_a+prim
9779 { 0xe2f16730, cmb(cc__t0_mul_t1__sub_prim_mul__t0t1a__add_prim ) },
9780 // Sin and Punishment, [scorpiove], Added by Gonetz
9781 // (t0-0)*t1+0, (env-prim)*cmb_a+prim
9782 { 0xe2f16735, cmb(cc_env_sub_prim_mul__t0t1a__add_prim) },
9783 // light, Ridge Racer. Added by Gonetz
9784 // (t0-0)*t1+0, (prim-env)*cmb+env
9785 { 0xe2f1a053, cmb(cc_prim_sub_env_mul__t0_mul_t1__add_env) },
9786 // Waterfall, duck dodgers. Added by Gonetz
9787 // (t0-0)*t1+0, (shade-env)*cmb+env
9788 { 0xe2f1a054, cmb(cc_shade_sub_env_mul__t0_mul_t1__add_env) },
9789 // bikes, xg2
9790 // (t0-0)*t1+0, (shade-0)*cmb+0
9791 { 0xe2f1e0f4, cmb(cc__t0_mul_t1__mul_shade) },
9792 // Sky background, xg2
9793 // (t0-0)*t1+0
9794 { 0xe2f1e2f1, cmb(cc_t0_mul_t1) },
9795 // statistics, Banjo 2. Added by Gonetz
9796 // (t0-0)*t1+0, (cmb-0)*prim+0
9797 { 0xe2f1e3f0, cmb(cc__t0_mul_t1__mul_prim) },
9798 // Water, pilotwings
9799 // (t0-0)*t1+0, (cmb-0)*shade+0
9800 { 0xe2f1e4f0, cmb(cc__t0_mul_t1__mul_shade) },
9801 //beetle adventure racing. A dded by Gonetz
9802 // (t0-0)*t1+0, (cmb-0)*env+0
9803 { 0xe2f1e5f0, cmb(cc__t0_mul_t1__mul_env) },
9804 //fall headwaters, zelda 2. Added by Gonetz
9805 // (t1-0)*t1+0, (cmb-0)*shade+0
9806 { 0xe2f2e4f0, cmb(cc_t1_mul_shade) },
9807 //text, Paper Mario
9808 // (prim-0)*t1+0
9809 { 0xe2f3e2f3, cmb(cc_t1_mul_prim) },
9810 //terrain, Beetle Adventure Racing. Added by Gonetz
9811 // (shade-0)*t1+0
9812 { 0xe2f4e2f4, cmb(cc_t1_mul_shade) },
9813 // lens of truth, zelda 2 [Ogy]. Added by Gonetz
9814 // (1-t0)*prim+0
9815 { 0xe316e316, cmb(cc_one_sub_t0_mul_prim) },
9816 // Magnitude, pokemon stadium 2
9817 // (t0-0)*prim+0, (t0-0)*env+cmb
9818 { 0xe3f105f1, cmb(cc_t0_mul__prim_add_env) },
9819 // night vision, jet force gemini
9820 // (t0-0)*prim+0, (noise-0)*env+cmb
9821 { 0xe3f105f7, cmb(cc_t0_mul_prim_add_env) },
9822 // Smoke, diddy kong racing
9823 // (t0-0)*prim+0, (env-cmb)*env_alpha+cmb
9824 { 0xe3f10c05, cmb(cc_t0_mul_prim) },
9825 // battle menu, Paper Mario. Added by Gonetz
9826 // (t0-0)*prim+0, (t0-env)*env_alpha+cmb ** INC **
9827 { 0xe3f10c51, cmb(cc_t0_mul_prim) },
9828 // stalactites, Beetle adventure Racing. Added by Gonetz
9829 // (t0-0)*prim+0, (cmb-shade)*t1_alpha+shade ** INC **
9830 { 0xe3f18940, cmb(cc_t0_mul_prim_add_shade ) },
9831 // ? in Jabu-Jabu's belly, submitted by gokuss4
9832 // 0xe4f1a053, (t0-0)*prim+0, (prim-env)*cmb+env
9833 { 0xe3f1a053, cmb(cc_prim_sub_env_mul__t0_mul_prim__add_env) },
9834 // kirby drill, kirby 64. Added by Gonetz
9835 // (t0-0)*prim+0, (cmb-env)*shade+env **INC**
9836 { 0xe3f1a450, cmb(cc_t0_mul_prim_mul_shade_add_env) },
9837 // ? sign, zelda 2. Added by Gonetz
9838 // (t0-0)*prim+0, (cmb-0)*cmb+0 ** INC **
9839 { 0xe3f1e0f0, cmb(cc_t0_mul_prim) },
9840 // vehicle, Star Wars Ep.1 Racer, [Raziel64]. Added by Gonetz
9841 // (t0-0)*prim+0, (shade-0)*cmb+0
9842 { 0xe3f1e0f4, cmb(cc_t0_mul_prim_mul_shade) },
9843 // magic stuff, buck bumble. Added by Gonetz
9844 // (t0-0)*prim+0, (cmb-0)*prim+0
9845 { 0xe3f1e3f0, cmb(cc_t0_mul_prim_mul_prim) },
9846 // The mario face, mario
9847 //z (t0-k5)*prim+cmb_a
9848 { 0xe3f1e3f1, cmb(cc_t0_mul_prim) },
9849 // Butterflies at Jabu-Jabu's lake, zelda
9850 // (t0-0)*prim+0, (cmb-0)*shade+0
9851 { 0xe3f1e4f0, cmb(cc_t0_mul_prim_mul_shade) },
9852 // Sprites, Ogre Battle. Added by Gonetz
9853 // (t1-0)*prim+0
9854 { 0xe3f2e3f2, cmb(cc_t1_mul_prim) },
9855 // F1 World Grand Prix. Added by Gonetz
9856 // (t1-0)*prim+0, (cmb-0)*shade+0
9857 { 0xe3f2e4f0, cmb(cc_t1_mul_prim_mul_shade) },
9858 // intro background, bio freaks. Added by Gonetz
9859 // (prim-0)*prim+0
9860 { 0xe3f3e3f3, cmb(cc_prim_mul_prim) },
9861 // player, Ohzumou2
9862 // (shade-0)*prim+0, (env-cmb)*t0+cmb
9863 { 0xe3f40105, cmb(cc_env_sub_primshade_mul_t0_add_primshade) },
9864 // floor in pyramides, beetle adventure racing.
9865 // (shade-0)*prim+0, (t1-0)*cmb+0
9866 { 0xe3f4e0f2, cmb(cc_t1_mul_prim_mul_shade) },
9867 // Slingshot string, zelda
9868 // (shade-0)*prim+0
9869 { 0xe3f4e3f4, cmb(cc_prim_mul_shade) },
9870 // ???, zelda
9871 // (env-0)*prim+0, (0-0)*0+cmb
9872 { 0xe3f5e3f5, cmb(cc_prim_mul_env) },
9873 // Option selection, zelda
9874 //z (center-k5)*prim+cmb_a
9875 { 0xe3f6e3f6, cmb(cc_t0_mul_prim) },
9876 // ranco monster, zelda 2. Added by Gonetz
9877 // (noise-0)*prim+0, (cmb-0)*prim_a+prim
9878 { 0xe3f76af0, cmb(cc_prim_mul_prima_add_prim) },
9879 // zelda 2 [Ogy]. Added by Gonetz
9880 // (noise-0)*prim+0
9881 { 0xe3f7e3f7, cmb(cc_prim) },
9882 // Road rush. Added by Gonetz
9883 // (0-0)*prim+0 ** INC ** ?
9884 { 0xe3ffe3ff, cmb(cc_prim) },
9885 // Letter to Kafei's mom, zelda 2. Added by Gonetz
9886 // (0-0)*prim+0, (cmb-0)*shade+0
9887 { 0xe3ffe4f0, cmb(cc_prim_mul_shade) },
9888 // Jabu-Jabu's Belly, zelda. Added by Gonetz
9889 // (1-t0)*shade+0, (cmb-0)*prim+0
9890 { 0xe416e3f0, cmb(cc_one_sub_t0_mul_prim_mul_shade) },
9891 // bomb mask, zelda 2. Added by Gonetz
9892 // (t0-env)*shade+0, (cmb-prim)*shade+shade ** INC **
9893 { 0xe4518430, cmb(cc__t0_sub_env_mul_shade__sub_prim_mul_shade) },
9894 // terrain, Top Gear Rally 2. Added by Gonetz
9895 // (t0-env)*shade+0
9896 { 0xe451e451, cmb(cc_t0_sub_env_mul_shade) },
9897 // closes, Nightmire Creatures
9898 // (1-env)*shade+0
9899 { 0xe456e456, cmb(cc_one_sub_env_mul_shade) },
9900 // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
9901 // (t0-0)*shade+0, (cmb-cmb)*cmb+cmb
9902 { 0xe4f10000, cmb(cc_t0_mul_shade) },
9903 // Monster truck madness intro. Added by Gonetz
9904 // (t0-0)*shade+0, (1-0)*cmb+cmb ** INC **
9905 { 0xe4f100f6, cmb(cc_t0_mul_shade) },
9906 // terrain, SCARS. Added by Gonetz
9907 // (t0-0)*shade+0, (prim-cmb)*t0+cmb ** INC **
9908 { 0xe4f10103, cmb(cc_t0_mul_shade) },
9909 // Boomerang circle, zelda
9910 // (t0-0)*shade+0, (1-cmb)*t0+cmb
9911 { 0xe4f10106, cmb(cc_t0_mul_shade) },
9912 // THPS3.
9913 // (t0-0)*shade+0, (1-0)*t0+cmb
9914 { 0xe4f101f6, cmb(cc_t0_mul_shade) },
9915 // ???, WWF No Mercy [CpuMaster]
9916 // (t0-0)*shade+0, (env-cmb)*prim+cmb
9917 { 0xe4f10305, cmb(cc_t0_mul_one_sub_prim_mul_shade_add_prim_mul_env) },
9918 // magic bubble, zelda2. Added by Gonetz
9919 // (t0-0)*shade+0, (t1-0)*shade+0
9920 { 0xe4f104f2, cmb(cc_t0_mul_shade) },
9921 // bike select, xg2. Added by Gonetz
9922 // (t0-0)*shade+0, (1-cmb)*env+cmb ** INC **
9923 { 0xe4f10506, cmb(cc_t0_mul_shade) },
9924 // a bugs life [Ogy]
9925 // (t0-0)*shade+0, (cmb-0)*env+cmb
9926 // 0xe4f105f0, cmb(cc_t0_mul_env_mul_shade) },
9927 { 0xe4f105f0, cmb(cc_t0_mul_shade) },
9928 // Wall, quest64
9929 // (t0-0)*shade+0, (1-0)*env+cmb
9930 { 0xe4f105f6, cmb(cc_t0_mul_shade_add_env) },
9931 //lava, beetle adventure racing. Added by Gonetz
9932 // (t0-0)*shade+0, (prim-cmb)*cmb_a+cmb **INC**
9933 { 0xe4f10703, cmb(cc_t0_mul_shade) },
9934 // course map, Ridge Racer. Added by Gonetz
9935 // (t0-0)*shade+0, (prim-cmb)*prima+cmb **INC**
9936 { 0xe4f10a03, cmb(cc_t0_mul_shade) },
9937 // arena, custom robo. Added by Gonetz
9938 // (t0-0)*shade+0, (noise-cmb)*prima+cmb **INC**
9939 { 0xe4f10a07, cmb(cc_t0_mul_shade) },
9940 // arena, custom robo 2. Added by Gonetz
9941 // (t0-0)*shade+0, (0-cmb)*prima+cmb **INC**
9942 { 0xe4f10a0f, cmb(cc_t0_mul_shade) },
9943 //floor in a cave, Paper mario. Added by Gonetz
9944 // (t0-0)*shade+0, (cmb-prim)*prima+cmb **INC**
9945 { 0xe4f10a30, cmb(cc_t0_mul_shade) },
9946 //beetle adventure racing. Added by Gonetz
9947 // (t0-0)*shade+0, (t1-prim)*prima+cmb **INC**
9948 { 0xe4f10a32, cmb(cc_t0_mul_shade) },
9949 // Monster truck madness intro. Added by Gonetz
9950 // (t0-0)*shade+0, (shade-cmb)*shade_a+cmb ** INC **
9951 { 0xe4f10b04, cmb(cc_t0_mul_shade) },
9952 // xg2 intro. Added by Gonetz
9953 // (t0-0)*shade+0, (1-cmb)*shade_a+cmb ** INC **
9954 { 0xe4f10b06, cmb(cc__t0_mul_shade__inter_one_using_shadea) },
9955 // Link's bomb, smash bros
9956 // (t0-0)*shade+0, (env-cmb)*env_a+cmb ** INC **
9957 { 0xe4f10c05, cmb(cc__t0_mul_shade__inter_env_using_enva) },
9958 // A Bugs Life, [Raziel64]
9959 // (t0-0)*shade+0, (cmb-0)*k5+cmb
9960 { 0xe4f10ff0, cmb(cc_t0_mul_shade) },
9961 // car, Top Gear Rally. Added by Gonetz
9962 // (t0-0)*shade+0, (cmb-t0)*t0a+t0 **INC**
9963 { 0xe4f12810, cmb(cc_t0_mul_shade) },
9964 // logo, SCARS. Added by Gonetz
9965 // (t0-0)*shade+0, (cmb-t0)*shadea+t0 **INC**
9966 { 0xe4f12b10, cmb(cc_t0_mul_shade) },
9967 // ? sign, Spiderman. Added by Gonetz
9968 // (t0-0)*shade+0, (0-0)*0+t1
9969 { 0xe4f15fff, cmb(cc_t0_mul_shade) },
9970 // plants, CBFD. Added by Gonetz
9971 // (t0-0)*shade+0, (cmb-env)*shade+prim ** INC **
9972 { 0xe4f16450, cmb(cc_t0_sub_env_mul_shade_add_prim) },
9973 // Kirby64. Added by Gonetz
9974 // (t0-0)*shade+0, (cmb-prim)*prima+prim
9975 { 0xe4f16a30, cmb(cc_t0_mul_prima_mul_shade_add_prim_mul_one_sub_prima) },
9976 // building shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
9977 // (t0-0)*shade+0, (0-0)*0+prim
9978 { 0xe4f17fff, cmb(cc_prim) },
9979 // tire trace, beetle adventure racing. Added by Gonetz
9980 // (t0-0)*shade+0, (env-cmb)*t1+shade **INC**
9981 { 0xe4f18205, cmb(cc_env_sub_shade_mul_t0_add_shade) },
9982 // Gold Skulltula, zelda
9983 // (t0-0)*shade+0, (prim-env)*cmb+env
9984 { 0xe4f1a053, cmb(cc_prim_sub_env_mul_t0_mul_shade_add_env) },
9985 // 0xe4f1a053, cmb(cc_t0_mul_prim_mul_shade) },
9986 // fighters, GASP Fighters
9987 // (t0-0)*shade+0, (1-env)*cmb+env
9988 { 0xe4f1a056, cmb(cc_t0_mul_one_sub_env_mul_shade_add_env) },
9989 // Brian, quest64
9990 // (t0-0)*shade+0, (cmb-0)*prim+env
9991 { 0xe4f1a3f0, cmb(cc_t0_mul_prim_mul_shade_add_env) },
9992 // Objects in arena, pokemon stadium 2
9993 // (t0-0)*shade+0
9994 // (cmb-prim)*shade+env
9995 { 0xe4f1a430, cmb(cc_t0_mul_shade) },
9996 // Monster truck madness intro. Added by Gonetz
9997 // (t0-0)*shade+0, (cmb-env)*shadea+env **INC**
9998 // 0xe4f1ab50, cmb(cc_t0_mul_shade_add_env) },
9999 { 0xe4f1ab50, cmb(cc__t0_mul_shade__sub_env_mul_shadea_add_env) },
10000 // Taz express. Added by Gonetz
10001 // (t0-0)*shade+0, (cmb-env)*enva+env **INC**
10002 { 0xe4f1ac50, cmb(cc_t0_mul_shade_add_env) },
10003 // sky in doom. Added by Gonetz
10004 // (t0-0)*shade+0, (cmb-0)*primlod+env **INC**
10005 { 0xe4f1aef0, cmb(cc_t0_mul_shade_add_env) },
10006 // fighters, GASP Fighters
10007 // (t0-0)*shade+0, (1-env)*cmb+0
10008 { 0xe4f1e056, cmb(cc_t0_mul_one_sub_env_mul_shade) },
10009 // walls, beetle adventure racing. Added by Gonetz
10010 // (t0-0)*shade+0, (t0-0)*cmb+0 **INC**
10011 { 0xe4f1e0f1, cmb(cc_t0_mul_shade) },
10012 // Link's face, zelda
10013 //z (t0-k5)*shade+cmb_a, (prim-k5)*cmb+cmb_a
10014 { 0xe4f1e0f3, cmb(cc_t0_mul_prim_mul_shade) },
10015 // Link's suit, zelda
10016 //z (t0-k5)*shade+cmb_a, (env-k5)*cmb+cmb_a
10017 { 0xe4f1e0f5, cmb(cc_t0_mul_env_mul_shade) },
10018 // Window, starfox
10019 //z (t0-k5)*shade+cmb_a, (cmb-k5)*prim+cmb_a
10020 { 0xe4f1e3f0, cmb(cc_t0_mul_prim_mul_shade) },
10021 // crystal, Doraemon 2
10022 //(t0-0)*shade+0, (t0-0)*prim+0
10023 { 0xe4f1e3f1, cmb(cc_t0_mul_prim) },
10024 // Characters, mace
10025 // (t0-0)*shade+0, (cmb-0)*shade+0
10026 { 0xe4f1e4f0, cmb(cc_t0_mul_shade) },
10027 // Super Mario 64 logo
10028 //z (t0-k5)*shade+cmb_a
10029 { 0xe4f1e4f1, cmb(cc_t0_mul_shade) },
10030 // Kokiri's hat, zelda
10031 // (t0-0)*shade+0, (cmb-0)*env+0
10032 { 0xe4f1e5f0, cmb(cc_t0_mul_env_mul_shade) },
10033 // Gauntlet Legends intro
10034 // (t0-0)*shade+0, (cmb-0)*scale+0
10035 { 0xe4f1e6f0, cmb(cc_t0_mul_shade) },
10036 // Something on a tree, Paper Mario. Added by Gonetz
10037 // (t0-0)*shade+0, (cmb-0)*prima+0
10038 { 0xe4f1eaf0, cmb(cc_t0_mul_prima_mul_shade) },
10039 // Course map, Ridge Racer. Added by Gonetz
10040 // (t0-0)*shade+0, (cmb-0)*shadea+0
10041 { 0xe4f1ebf0, cmb(cc_t0_mul_shade_mul_shadea) },
10042 // Dodongo skull's eyes, zelda
10043 // (t0-0)*shade+0, (cmb-0)*env_alpha+0
10044 { 0xe4f1ecf0, cmb(cc_t0_mul_enva_mul_shade) },
10045 // lava, beetle adventure racing. Added by Gonetz
10046 // (t1-0)*shade+0, (cmb-prim)*cmb_a+prim **INC**
10047 { 0xe4f26730, cmb(cc_t1_mul_shade) },
10048 // headlight, beetle adventure racing. Added by Gonetz
10049 // (t1-0)*shade+0, (env-cmb)*t0+shade **INC**
10050 { 0xe4f28105, cmb(cc_one_sub__t0_mul_t1__mul_shade) },
10051 // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
10052 // (prim-0)*shade+0, (cmb-cmb)*cmb+cmb
10053 { 0xe4f30000, cmb(cc_prim_mul_shade) },
10054 // lamp shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
10055 // (prim-0)*shade+0, (cmb-cmb)*t0+cmb
10056 { 0xe4f30100, cmb(cc_prim_mul_shade) },
10057 // Yoshi, mario golf
10058 // (prim-0)*shade+0, (env-cmb)*t0+cmb
10059 { 0xe4f30105, cmb(cc_env_sub_primshade_mul_t0_add_primshade) },
10060 //Spacestation Silicon Valley intro. Added by Gonetz
10061 // (prim-0)*shade+0, (env-cmb)*t1+cmb
10062 { 0xe4f30205, cmb(cc_env_sub_primshade_mul_t1_add_primshade) },
10063 // Tip of brian's hair, quest64
10064 // (prim-0)*shade+0, (1-0)*env+cmb
10065 { 0xe4f305f6, cmb(cc_prim_mul_shade_add_env) },
10066 // Background circle, xg2
10067 // (prim-0)*shade+0, (1-cmb)*shade_a+cmb
10068 { 0xe4f30b06, cmb(cc_prim_mul_shade) },
10069 // circle, waverace. Added by Gonetz
10070 // (prim-0)*shade+0, (t0-cmb)*enva+cmb
10071 { 0xe4f30c01, cmb(cc_t0_sub__prim_mul_shade__mul_enva_add__prim_mul_shade) },
10072 // player, super bowling
10073 // (prim-0)*shade+0, (0-0)*k5+cmb
10074 { 0xe4f30fff, cmb(cc_prim_mul_shade) },
10075 // walls, beetle adventure racing. Added by Gonetz
10076 // (prim-0)*shade+0, (cmb-shade)*t1+shade **INC**
10077 { 0xe4f38240, cmb(cc_prim_sub_shade_mul_t1_add_shade) },
10078 // GASP fighters
10079 //(prim-0)*shade+0, (1-env)*cmb+0
10080 { 0xe4f3e056, cmb(cc_prim_mul_one_sub_env_mul_shade) },
10081 // Flag, mario kart
10082 //z (prim-k5)*shade+cmb_a
10083 { 0xe4f3e4f3, cmb(cc_prim_mul_shade) },
10084 // Characters, smash bros
10085 // (prim-0)*shade+0, (cmb-0)*env+0
10086 { 0xe4f3e5f0, cmb(cc_prim_mul_env_mul_shade) },
10087 // N64 logo, ridge race. Added by Gonetz
10088 // (shade-0)*shade+0, (prim-cmb)*prima+cmb **INC**
10089 { 0xe4f40a03, cmb(cc_shade) },
10090 // fighter, shield mode, bio freaks. Added by Gonetz
10091 // (shade-0)*shade+0
10092 { 0xe4f4e4f4, cmb(cc_shade) },
10093 // truck crush, Monster truck madness. Added by Gonetz
10094 // (env-0)*shade+0, (env-0)*shade+cmb
10095 { 0xe4f504f5, cmb(cc_env_mul_shade) },
10096 // Course map, Ridge Racer. Added by Gonetz
10097 // (env-0)*shade+0
10098 { 0xe4f5e4f5, cmb(cc_env_mul_shade) },
10099 // lava, beetle adventure racing
10100 // (1-0)*shade+0, (prim-cmb)*cmb_a+cmb
10101 { 0xe4f60703, cmb(cc_prim_sub_shade_mul_shadea_add_shade) },
10102 // the wings in the song of soaring cut-scene, zelda2 [Ogy]. Added by Gonetz
10103 // (1-0)*shade+0, (prim-0)*cmb+0
10104 { 0xe4f6e0f3, cmb(cc_prim_mul_shade) },
10105 // parts of vehicle, Star Wars Ep.I Racer. Added by Gonetz
10106 // (1-0)*shade+0, (cmb-0)*prim+0
10107 { 0xe4f6e3f0, cmb(cc_prim_mul_shade) },
10108 // Snowflakes??? (gokuss4) }, mario kart
10109 // (1-0)*shade+0, (1-0)*shade+0
10110 { 0xe4f6e4f6, cmb(cc_shade) },
10111 // ???
10112 // (noise-0)*shade+0
10113 { 0xe4f7e4f7, cmb(cc_shade) },
10114 // quest64 [Ogy]
10115 // (prim-t0)*env+0, (0-0)*0+prim
10116 { 0xe5137fff, cmb(cc_prim) },
10117 // field, Mike Piazza's Strike Zone
10118 // (t0-prim)*env+0 ** INC **
10119 { 0xe531e531, cmb(cc_t0_mul_env) },
10120 // Mike Piazza's Strike Zone
10121 // (shade-prim)*env+0
10122 { 0xe534e534, cmb(cc_shade_sub_prim_mul_env) },
10123 // rope, CBFD. Added by Gonetz
10124 // (t0-0)*env+0, (1-env)*prim+cmb
10125 { 0xe5f10356, cmb(cc_one_sub_env_mul_prim_add__t0_mul_env) },
10126 // Bell, Pokemon Stadium 2. Added by Gonetz
10127 // (t0-0)*env+0, (shade-0)*prim+cmb
10128 { 0xe5f103f4, cmb(cc_t0_mul_env_add_prim_mul_shade) },
10129 // aerofighter's assault [Ogy]
10130 // (t0-0)*env+0, (1-t0)*shade+cmb
10131 { 0xe5f10416, cmb(cc_t0_mul_env_add_1mt0_mul_shade) },
10132 // foto, Armorines - Project S.W.A.R.M. Added by Gonetz
10133 // (t0-0)*env+0, (noise-0)*scale+cmb
10134 { 0xe5f106f7, cmb(cc_t0_mul_env) },
10135 // Extreme G2, score. Added by Gonetz
10136 // (t0-0)*env+0, (1-cmb)*enva+cmb ** INC **
10137 { 0xe5f10c06, cmb(cc_t0_mul_env) },
10138 // many objects in Tonic Trouble
10139 // (t0-0)*env+0, (shade-0)*cmb+0
10140 { 0xe5f1e0f4, cmb(cc_t0_mul_env_mul_shade) },
10141 // Flying skull's eyes, zelda
10142 // (t0-0)*env+0, (cmb-0)*prim+0
10143 { 0xe5f1e3f0, cmb(cc_t0_mul_prim_mul_env) },
10144 // Rock spell, quest64
10145 // (t0-0)*env+0, (cmb-0)*shade+0
10146 { 0xe5f1e4f0, cmb(cc_t0_mul_env_mul_shade) },
10147 // Text, mario
10148 //z (t0-k5)*env+cmb_a
10149 { 0xe5f1e5f1, cmb(cc_t0_mul_env) },
10150 // kirby 64. Added by Gonetz
10151 // (prim-0)*env+0, (cmb-0)*shade+0
10152 { 0xe5f3e4f0, cmb(cc_prim_mul_env_mul_shade) },
10153 // wings, kirby 64. Added by Gonetz
10154 // (prim-0)*env+0
10155 { 0xe5f3e5f3, cmb(cc_prim_mul_env) },
10156 // Text, xg2
10157 // (shade-0)*env+0, (1-cmb)*env_a+cmb
10158 { 0xe5f40c06, cmb(cc_env_mul_shade) },
10159 // Text box, mario
10160 //z (shade-k5)*env+cmb_a
10161 { 0xe5f4e5f4, cmb(cc_env_mul_shade) },
10162 // bomberman 64 [Ogy]
10163 // (1-0)*env+0
10164 { 0xe5f6e5f6, cmb(cc_env) },
10165 // Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
10166 // (1-t0)*scale+0
10167 { 0xe616e616, cmb(cc_zero) },
10168 // Gauntlet Legends intro. Added by Gonetz
10169 // (t0-0)*scale+0, (cmb-0)*shade+0
10170 { 0xe6f1e4f0, cmb(cc_t0_mul_shade) },
10171 // shadows, Taz express. Added by Gonetz
10172 // (t0-0)*scale+0
10173 { 0xe6f1e6f1, cmb(cc_t0) },
10174 // shadows, Knockout Kings 2000. Added by Gonetz
10175 // (shade-0)*scale+0
10176 { 0xe6f4e6f4, cmb(cc_shade) },
10177 // bomberman 64 2 [Ogy]. Added by Gonetz
10178 // (1-0)*scale+0 **INC** what "scale" is ?
10179 { 0xe6f6e6f6, cmb(cc_one) },
10180 // walls, beetle adventure racing. Added by Gonetz
10181 // (t1-0)*t0_a+0, (1-t1)*cmb+t1 **INC**
10182 { 0xe8f24026, cmb(cc_t1) },
10183 // house on rancho, zelda2. Added by Gonetz
10184 // (t1-0)*t0_a+0, (cmb-0)*prim+0
10185 { 0xe8f2e3f0, cmb(cc__t0a_mul_t1__mul_prim) },
10186 // zelda2 [Ogy]. Added by Gonetz
10187 // (t1-0)*t0_a+0, (cmb-0)*shade+0
10188 { 0xe8f2e4f0, cmb(cc__t0a_mul_t1__mul_shade) },
10189 // logo, Deadly Arts. Added by Gonetz
10190 // (t0-0)*t1_a+0, (cmb-0)*shade+0
10191 { 0xe9f1e4f0, cmb(cc__t0_mul_t1a__mul_shade) },
10192 // car, Roadsters. Added by Gonetz
10193 // (prim-t0)*prim_a+0, (prim-cmb)*shade+0 ** INC **
10194 { 0xea13e403, cmb(cc_prim_sub__prim_sub_t0_mul_prima__mul_shade) },
10195 // arena, Pokemon Stadium 2. Added by Gonetz
10196 // (1-t0)*prim_a+0, (0-prim)*cmb+prim ** INC **
10197 { 0xea16603f, cmb(cc_t0_mul_prim) },
10198 // match start, Mario Tennis. Added by Gonetz
10199 // (t0-0)*prim_a+0, (1-t0)*cmb+t0 ** INC **
10200 { 0xeaf12016, cmb(cc_one_sub_t0_mul_prima_add_t0) },
10201 // blast corps [Ogy]
10202 // (t0-0)*prim_a+0
10203 { 0xeaf1eaf1, cmb(cc_t0_mul_prima) },
10204 // final battle, CBFD. Added by Gonetz
10205 // (prim-0)*prim_a+0
10206 { 0xeaf3eaf3, cmb(cc_prim_mul_prima) },
10207 // flower's stalk, Paper Mario. Added by Gonetz
10208 // (shade-0)*prim_a+0
10209 { 0xeaf4eaf4, cmb(cc_shade_mul_prima) },
10210 // blast corps [Ogy]
10211 // (noise-0)*prim_a+0, (t1-0)*shade+cmb ** INC **
10212 { 0xeaf704f2, cmb(cc_t1_mul_shade) },
10213 // F1 World Grand Prix. Added by Gonetz
10214 // (noise-0)*prim_a+0, (t1-0)*env_a+cmb ** INC **
10215 { 0xeaf70cf2, cmb(cc_t1_mul_enva) },
10216 // shadows, killer instinct gold
10217 // (0-0)*prim_a+0
10218 { 0xeaffeaff, cmb(cc_zero) },
10219 // Wreslters, WWF No Mercy, [CpUMasteR]
10220 // (t0-0)*shade_alpha+0, (env-cmb)*prim+cmb
10221 { 0xebf10305, cmb(cc_t0_mul_one_sub_prim_mul_shadea_add_prim_mul_env) },
10222 // map, Pilot wings. Added by Gonetz
10223 // (t0-0)*shade_alpha+0, (1-cmb)*shade+cmb
10224 { 0xebf10406, cmb(cc_one_sub_shade_mul__t0_mul_shadea__add_shade) },
10225 // Indy Racing 2000. Added by Gonetz
10226 // (t0-0)*shade_alpha+0, (1-0)*shade+cmb
10227 { 0xebf104f6, cmb(cc_t0_mul_shadea_add_shade) },
10228 // logo, WCW-nWo Revenge
10229 // (t0-0)*shade_alpha+0, (cmb-0)*prim+0
10230 { 0xebf1e3f0, cmb(cc_t0_mul_prim_mul_shadea) },
10231 // Wrestlers in Game, WWF No mercy [CpUMasteR]
10232 // (t0-0)*shade_alpha+0
10233 { 0xebf1ebf1, cmb(cc_t0_mul_shadea) },
10234 // flag, top gear overdrive
10235 // (prim-0)*shade_alpha+0
10236 { 0xebf3ebf3, cmb(cc_prim_mul_shadea) },
10237 // Ropes, WWF games
10238 // (shade-0)*shade_alpha+0, (env-cmb)*prim+cmb
10239 { 0xebf40305, cmb(cc_shade_mul_shadea) },
10240 // Ropes, WWF games
10241 // (shade-0)*shade_alpha+0
10242 { 0xebf4ebf4, cmb(cc_shade_mul_shadea) },
10243 // arena, custom robo 2
10244 // (noise-0)*shade_alpha+0
10245 { 0xebf7ebf7, cmb(cc_shadea) },
10246 // Bell, Pokemon Stadium 2. Added by Gonetz
10247 // (t0-0)*enva+0, (shade-0)*prim+cmb
10248 { 0xecf103f4, cmb(cc_t0_mul_enva_add_prim_mul_shade) },
10249 // blastcorps, unimp log. Added by Gonetz
10250 // (t0-0)*enva+0
10251 { 0xecf1ecf1, cmb(cc_t0_mul_enva) },
10252 // car, Top Gear Rally. Added by Gonetz
10253 // (env-0)*enva+0
10254 { 0xecf5ecf5, cmb(cc_env_mul_enva) },
10255 // Walls of well through lens of truth, zelda
10256 // (prim-t0)*primlod+0 ** INC **
10257 { 0xee13ee13, cmb(cc_t0) }, // JUST t0 b/c the other combiner handles the subtraction
10258 // something on a flor in stone temple, zelda 2. Added by Gonetz
10259 // (t0-0)*primlod+0, (cmb-0)*prim+0
10260 { 0xeef1e3f0, cmb(cc_t0_mul_primlod_mul_prim) },
10261 // entrance to oceanside spider house, zelda 2. Added by Gonetz
10262 // (t0-0)*primlod+0, (cmb-0)*shade+0
10263 { 0xeef1e4f0, cmb(cc_t0_mul_primlod_mul_shade) },
10264 // Haze/(all powder status changers) }, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10265 // (noise-0)*primlod+0, (prim-env)*cmb+env ** INC **
10266 { 0xeef7a053, cmb(cc_env) },
10267 // pokemon attack, Pokemon Stadium 2. Added by Gonetz
10268 // (noise-0)*primlod+0, (prim-cmb)*cmb+0 ** INC **
10269 { 0xeef7e003, cmb(cc_zero) },
10270 // Night trees, Monster truck madness. Added by Gonetz
10271 // (t0-0)*k5+0
10272 { 0xeff1eff1, cmb(cc_t0_mul_k5) },
10273 // submitted by gokuss4
10274 // (0-0)*0+0, (0-0)*0+prim
10275 { 0xfffd5fe6, cmb(cc_prim) },
10276 // intro, Bettle Adventure Racing, [Raziel64]
10277 // (0-0)*0+0, (0-0)*0+t0
10278 { 0xffff3fff, cmb(cc_t0) },
10279 // Conker's face, CBFD
10280 // (0-0)*0+0, (shade-env)*k5+prim
10281 { 0xffff6f54, cmb(cc_shade_sub_env_mul_k5_add_prim) },
10282 // Boost, Beetle Adventure Racing. Added by Gonetz
10283 // (0-0)*0+0, (0-0)*0+prim
10284 { 0xffff7fff, cmb(cc_prim) },
10285 // headlight, beetle adventure racing. Added by Gonetz
10286 // (0-0)*0+0, (0-0)*0+shade
10287 { 0xffff9fff, cmb(cc_shade) },
10288 // intro, Bettle Adventure Racing, [Raziel64]
10289 // (0-0)*0+0, (shade-env)*t1+env
10290 { 0xffffa254, cmb(cc_shade_sub_env_mul_t1_add_env) },
10291 // Fly Swooping in, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10292 // (0-0)*0+0, (1-env)*cmb_a+env
10293 { 0xffffa756, cmb(cc_env) },
10294 // Waterfall, Donkey Kong 64
10295 // (0-0)*0+0, (t0-0)*t1+0
10296 { 0xffffe1f2, cmb(cc_t0_mul_t1) },
10297 // Screen clear, banjo kazooie
10298 // (0-0)*0+0
10299 { 0xffffffff, cmb(cc_zero) },
10300 // { #CCEND }
10303 static cmb_list_entry alpha_cmb_list[] = {
10304 // { #ACSTART }
10305 //Tony Hawk's Pro Skater. Added by Gonetz
10306 // (0-0)*0+0
10307 { 0x01ff01ff, cmb(ac_zero) },
10308 //terminal, Spacestation Silicon Valley. Added by Gonetz
10309 // (0-0)*0+0, (0-0)*0+prim
10310 { 0x01ff07ff, cmb(ac_prim) },
10311 // kirby drill, kirby 64. Added by Gonetz
10312 // (0-0)*0+cmb, (0-0)*0+1
10313 { 0x01ff0dff, cmb(ac_one) },
10314 //chip in Spacestation Silicon Valley intro. Added by Gonetz
10315 // (0-0)*0+cmb, (prim-0)*shade+0
10316 { 0x01ff0f3b, cmb(ac_prim_mul_shade) },
10317 //Goldeneye, [Jeremy]. Added by Gonetz
10318 // (t0-t0)*lodf+t0, (cmb-0)*prim+0
10319 { 0x02090ef8, cmb(ac_t0_mul_prim) },
10320 // Indy Racing 2000. Added by Gonetz
10321 // (t1-t0)*lodf+t0, (env-cmb)*prim+cmb ** INC **
10322 { 0x020a00c5, cmb(ac_t0_inter_t1_using_primlod) },
10323 // water, Spacestation Silicon Valley. Added by Gonetz
10324 // (t1-t0)*lodf+t0, (0-shade)*0+cmb
10325 { 0x020a01e7, cmb(ac_t0_inter_t1_using_primlod) },
10326 // Bridge, sf rush
10327 //z (t1-t0)*lodf+t0
10328 { 0x020a020a, cmb(ac_t0_inter_t1_using_primlod) },
10329 // explosion, body harvest. Added by Gonetz
10330 //(t1-t0)*lodf+t0, (0-0)*0+t0
10331 { 0x020a03ff, cmb(ac_t0) },
10332 // cars, PD intro. Added by Gonetz
10333 // (t1-t0)*lodf+t0, (cmb-0)*shade+prim
10334 { 0x020a0738, cmb(ac__t0_inter_t1_using_primlod__mul_shade_add_prim) },
10335 // Rocket Robot in Wheels intro
10336 //(t1-t0)*lodf+t0, (0-0)*0+prim
10337 { 0x020a07ff, cmb(ac_prim) },
10338 // Iguana background ground, turok
10339 // (t1-t0)*lodf+t0, (0-0)*0+shade
10340 { 0x020a09ff, cmb(ac_shade) },
10341 // Ground, monster truck madness
10342 // (t1-t0)*lodf+t0, (0-0)*0+env
10343 { 0x020a0bff, cmb(ac_env) },
10344 // Taz express. Added by Gonetz
10345 // (t1-t0)*lodf+t0, (0-0)*0+1
10346 { 0x020a0dff, cmb(ac_one) },
10347 // Mike Piazza's Strike Zone
10348 // (t1-t0)*lodf+t0, (cmb-0)*t0+0
10349 { 0x020a0e78, cmb(ac_t0_inter_t1_using_primlod) },
10350 // N64 logo, tetrisphere. Added by Gonetz
10351 // (t1-t0)*lodf+t0, (cmb-0)*prim+0
10352 { 0x020a0ef8, cmb(ac__t0_inter_t1_using_primlod__mul_prim) },
10353 // Ground, mace
10354 // (t1-t0)*lodf+t0, (cmb-0)*shade+0
10355 // { 0x020a0f38, cmb(ac_t0_mul_shade) },
10356 { 0x020a0f38, cmb(ac__t0_inter_t1_using_primlod__mul_shade) },
10357 // blast corps [Ogy]
10358 // (t1-t0)*lodf+t0, (cmb-0)*env+0
10359 { 0x020a0f78, cmb(ac__t0_inter_t1_using_primlod__mul_env) },
10360 // blast corps [Ogy]
10361 // (t1-t0)*lodf+t0, (t0-0)*env+0
10362 { 0x020a0f79, cmb(ac_t0_mul_env) },
10363 // blast corps. Added by Gonetz
10364 // (t1-t0)*lodf+t0, (shade-0)*env+0
10365 { 0x020a0f7c, cmb(ac_env_mul_shade) },
10366 // field, Mike Piazza's Strike Zone
10367 // (t1-t0)*lodf+t0, (0-0)*0+0
10368 { 0x020a0fff, cmb(ac_t0_inter_t1_using_primlod) },
10369 // blast corps, unimp log. Added by Gonetz
10370 // (t1-t0)*t0+t0
10371 { 0x024a024a, cmb(ac_t0_inter_t1_using_t0a) },
10372 // zelda 2 [Ogy]. Added by Gonetz
10373 // (t1-t0)*t0+t0, (cmb-0)*prim+0 **INC**
10374 { 0x024a0ef8, cmb(ac__t0_inter_t1_using_t0a__mul_prim) },
10375 // text in a menu, Twisted_Edge_Extreme_Snowboarding [Razeil64]. Added by Gonetz
10376 // (prim-t0)*t0+t0 **INC**
10377 { 0x024b024b, cmb(ac_t0) },
10378 // enemy's shot, battle tanks 2
10379 // (env-prim)*t0+t0 **INC**
10380 { 0x025d025d, cmb(ac_t0) },
10381 //Bowser in final battle, Paper Mario. Added by Gonetz
10382 // (t1-env)*t0+t0, (cmb-env)*prim+0 ** INC **
10383 { 0x026a0ee8, cmb(ac__t0_mul_t1__mul_prim) },
10384 // paper mario. Added by Gonetz
10385 // (t1-env)*t0+t0, (cmb-0)*prim+0 ** INC **
10386 { 0x026a0ef8, cmb(ac__t0_mul_t1__mul_prim) },
10387 // THPS3. Added by Gonetz
10388 // (0-0)*t0+t0
10389 { 0x027f027f, cmb(ac_t0) },
10390 // zelda 2. Added by Gonetz
10391 // (0-0)*t0+t0, (cmb-0)*prim+0
10392 { 0x027f0ef8, cmb(ac_t0_mul_prim) },
10393 // teleportation, Spacestation Silicon Valley. Added by Gonetz
10394 // (t1-t0)*t1+t0
10395 { 0x028a028a, cmb(ac_t0_inter_t1_using_t1a) },
10396 // mega shock, paper mario. Added by Gonetz
10397 // (t1-t0)*t1+t0, (cmb-0)*prim+0
10398 { 0x028a0ef8, cmb(ac__t0_inter_t1_using_t1a__mul_prim) },
10399 // Magnitude, pokemon stadium 2
10400 // (shade-t0)*t1+t0, (cmb-0)*shade+env
10401 { 0x028c0b38, cmb(ac__t0_mul_t1__mul_shade) },
10402 // paper mario. Added by Gonetz
10403 // (1-t0)*t1+t0, (t1-0)*prim+0 ** INC **
10404 { 0x028e0efa, cmb(ac__one_sub_t0_mul_t1_add_t0__mul_prim) },
10405 // { 0x028e0efa, cmb(ac_t1_mul_prim) },
10406 // paper mario. Added by Gonetz
10407 // (t1-env)*t1+t0, (cmb-0)*shade+0
10408 { 0x02aa0f38, cmb(ac__t0_inter_t1_using_enva__mul_shade) },
10409 // Scary dead boss thing, zelda
10410 // (env-1)*t1+t0, (cmb-0)*prim+0 * MAY need t1_inter_t0 instead...
10411 { 0x02b50ef8, cmb(ac__env_sub_one_mul_t1_add_t0__mul_prim) },
10412 // first screen, castlevania. Added by Gonetz
10413 // (env-0)*t1+t0 **INC**
10414 { 0x02bd02bd, cmb(ac_t0) },
10415 // enemy's shot, battle tanks 2 [Flash]
10416 // (1-0)*t1+t0, (0-0)*0+env
10417 { 0x02be0bff, cmb(ac_env) },
10418 // battle tanks 2 [Ogy]
10419 // (1-0)*t1+t0, (0-0)*0+1
10420 { 0x02be0dff, cmb(ac_one) },
10421 // menu screen, Rayman2. Added by Gonetz
10422 // (1-0)*t1+t0, (cmb-0)*shade+0
10423 { 0x02be0f38, cmb(ac__t0_add_t1__mul_shade) },
10424 // Sky, zelda
10425 //z (t1-t0)*prim+t0
10426 { 0x02ca02ca, cmb(ac_t0_inter_t1_using_prima) },
10427 // F1 World Grand Prix. Added by Gonetz
10428 // (t1-t0)*prim+t0, (0-0)*0+1
10429 { 0x02ca0dff, cmb(ac_t0_inter_t1_using_prima) },
10430 // logo, PD. Added by Gonetz
10431 // (t1-t0)*prim+t0, (cmb-0)*shade+0
10432 { 0x02ca0f38, cmb(ac__t0_inter_t1_using_prima__mul_shade) },
10433 // battle tanks [Ogy]
10434 // (t1-t0)*prim+t0, (cmb-0)*env+0
10435 { 0x02ca0f78, cmb(ac__t0_inter_t1_using_prima__mul_env) },
10436 // logo, Deadly Arts. Added by Gonetz
10437 // (env-t0)*prim+t0
10438 { 0x02cd02cd, cmb(ac_one_sub_prim_mul_t0_add__prim_mul_env) },
10439 // intro, castlevania 2. Added by Gonetz
10440 // (1-t0)*prim+t0
10441 { 0x02ce02ce, cmb(ac_one_sub_t0_mul_prim_add_t0) },
10442 // intro, diddy kong racing. Added by Gonetz
10443 // (1-t0)*prim+t0, (cmb-0)*shade+0 **INC**
10444 { 0x02ce0f38, cmb(ac_t0_mul_shade) },
10445 // submitted by Scorpiove, mario party 1
10446 // (0-t0)*prim+t0
10447 { 0x02cf02cf, cmb(ac_one_sub_prim_mul_t0) },
10448 // Ground, pokemon stadium 2
10449 // (t0-0)*prim+t0
10450 { 0x02f902f9, cmb(ac_t0_mul_prim) },
10451 // GASP Fighters
10452 // (t1-0)*prim+t0, ** INC **
10453 { 0x02fa02fa, cmb(ac_t1_mul_prima_add_t0) },
10454 // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10455 // (t1-0)*prim+t0, (cmb-0)*shade+0
10456 { 0x02fa0f38, cmb(ac__t1_mul_prima_add_t0__mul_shade) },
10457 // Paper Mario, fortune teller
10458 // (t1-0)*prim+t0, (cmb-0)*env+0
10459 { 0x02fa0f78, cmb(ac__t1_mul_prima_add_t0__mul_env) },
10460 // map, Ogre Battle 64. Added by Gonetz
10461 // (1-0)*prim+t0
10462 { 0x02fe02fe, cmb(ac_t0_add_prim) },
10463 // borders, Tony Hawk's Pro Skater 2. Added by Gonetz
10464 // (t1-t0)*shade+t0 ** INC **
10465 { 0x030a030a, cmb(ac_t0_inter_t1_using_shadea) },
10466 // Mickey USA
10467 // (t1-t0)*shade+t0, (cmb-0)*prim+0 ** INC **
10468 { 0x030a0ef8, cmb(ac__t0_inter_t1_using_shadea__mul_prim) },
10469 // Rocket Robot in Wheels intro
10470 // (t1-t0)*shade+t0, (cmb-0)*env+0 ** INC **
10471 { 0x030a0f78, cmb(ac__t0_inter_t1_using_shadea__mul_env) },
10472 // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
10473 // (1-t0)*shade+t0, (cmb-0)*shade+0 ** INC **
10474 { 0x030e0f38, cmb(ac_t0_mul_shade) },
10475 // sky, f-zero x
10476 // (0-t0)*shade+t0
10477 { 0x030f030f, cmb(ac_one_sub_shade_mul_t0) },
10478 // Deku tree from kokiri villiage, zelda
10479 //z (t1-t0)*env+t0, (t1-0)*primlod+cmb
10480 { 0x034a01ba, cmb(ac_t0_inter_t1_using_enva) },
10481 // Hearts, zelda
10482 //z (t1-t0)*env+t0
10483 { 0x034a034a, cmb(ac_t0_inter_t1_using_enva) },
10484 // Faries, zelda
10485 //z (t1-t0)*env+t0, (cmb-0)*prim+0
10486 { 0x034a0ef8, cmb(ac__t0_inter_t1_using_enva__mul_prim) },
10487 // zelda, waterfall. Added by Gonetz
10488 //z (t1-t0)*env+t0, (cmb-0)*shade+0
10489 { 0x034a0f38, cmb(ac__t0_inter_t1_using_enva__mul_shade) },
10490 // pokemon stadium 1. Added by Gonetz
10491 //(t1-t0)*env+t0, (cmb-0)*primlod+0
10492 { 0x034a0fb8, cmb(ac__t0_inter_t1_using_enva__mul_primlod) },
10493 // fruits, Yoshi Story. Added by Gonetz
10494 //(prim-t0)*env+t0
10495 { 0x034b034b, cmb(ac_prim_sub_t0_mul_env_add_t0) },
10496 // window, Rayman2. Added by Gonetz
10497 //(1-t0)*env+t0
10498 { 0x034e034e, cmb(ac_one_sub_t0_mul_env_add_t0) },
10499 // menu, PokemonStadium1, [Raziel64]
10500 //(1-t0)*env+t0, (cmb-0)*shade+0 ** INC **
10501 { 0x034e0f38, cmb(ac_t0_mul_shade) },
10502 // Ganon's sword swinging, zelda
10503 // (t0-t1)*env+t0, (cmb-0)*prim+0 ** INC **
10504 { 0x03510ef8, cmb(ac__t0_sub_t1_mul_enva_add_t0__mul_prim) },
10505 // Lave piranha atack, Paper Mario
10506 // (t1-prim)*env+t0, (0-cmb)*t1+0 ** INC **
10507 { 0x035a0e87, cmb(ac_t0_mul_t1) },
10508 // Reflected fire at kotake & koume's, zelda
10509 // (t0-1)*env+t0, (cmb-0)*prim+0 ** INC **
10510 { 0x03710ef8, cmb(ac__t0_sub_one_mul_enva_add_t0__mul_prim) },
10511 // thing that escapes from the well, zelda
10512 // (t1-1)*env+t0 ** INC **
10513 { 0x03720372, cmb(ac_t1_sub_one_mul_enva_add_t0) },
10514 // Sword charge, zelda
10515 // (t1-1)*env+t0, (cmb-0)*prim+0
10516 { 0x03720ef8, cmb(ac__t1_sub_one_mul_enva_add_t0__mul_prim) },
10517 // Gannon hitting the ground, zelda
10518 // (t1-1)*env+t0, (cmb-0)*shade+0 ** INC **
10519 { 0x03720f38, cmb(ac__t1_sub_one_mul_enva_add_t0__mul_shade) },
10520 // Tony Hawk's Pro Skater 3. Added by Gonetz
10521 // (t0-0)*env+t0
10522 { 0x03790379, cmb(ac_t0_mul_env) },
10523 // paper mario. Added by Gonetz
10524 // (t0-0)*env+t0, (cmb-0)*prim+0
10525 { 0x03790ef8, cmb(ac_t0_mul_prim) },
10526 // pads, Pokemon Stadium 2. Added by Gonetz
10527 // (t1-0)*env+t0, (cmb-0)*prim+env ** INC **
10528 { 0x037a0af8, cmb(ac__t0_inter_t1_using_enva__mul_prim_add_env) },
10529 // Ice arrow gfx, zelda
10530 // (t1-0)*env+t0, (cmb-0)*prim+0
10531 { 0x037a0ef8, cmb(ac__t1_mul_enva_add_t0__mul_prim) },
10532 // Scary face move, pokemon stadium 2
10533 // (t1-0)*env+t0, (cmb-prim)*shade+0
10534 { 0x037a0f18, cmb(ac__t0_inter_t1_using_enva__mul_prim_mul_shade) },
10535 // Saria's song, zelda
10536 // (t1-0)*env+t0, (cmb-0)*shade+0
10537 { 0x037a0f38, cmb(ac__t1_mul_enva_add_t0__mul_shade) },
10538 // eye drops bottle, zelda
10539 // (t0-t0)*prim_lodfrac+t0
10540 { 0x03890389, cmb(ac_t0) },
10541 // lighthouse's beam, zelda 2. Added by Gonetz
10542 // (t0-t0)*prim_lodfrac+t0, (cmb-0)*prim+0
10543 { 0x03890ef8, cmb(ac_t0_mul_prim) },
10544 // zelda 2. Added by Gonetz
10545 // (t1-t0)*primlod+t0, (cmb-0)*env+cmb ** INC **
10546 { 0x038a0178, cmb(ac__t0_inter_t1_using_primlod__mul_env_add__t0_inter_t1_using_primlod) },
10547 // Enter name letter background, zelda
10548 //z (t1-t0)*primlod+t0
10549 { 0x038a038a, cmb(ac_t0_inter_t1_using_primlod) },
10550 // Sunny Day, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10551 // (t1-t0)*primlod+t0, (cmb-0)*0+prim ** INC **?
10552 { 0x038a07f8, cmb(ac_t0_inter_t1_using_primlod) },
10553 // blastcorps, unimp log. Added by Gonetz
10554 // (t1-t0)*primlod+t0, (0-0)*0+shade **INC**?
10555 { 0x038a09ff, cmb(ac_t0_inter_t1_using_primlod) },
10556 // sky, PGA European Tour
10557 // (t1-t0)*primlod+t0, (0-0)*0+1
10558 { 0x038a0dff, cmb(ac_one) },
10559 // Ice surrounding enemy, zelda
10560 // (t1-t0)*primlod+t0, (env-0)*lodf+0
10561 { 0x038a0e3d, cmb(ac__t0_inter_t1_using_primlod__mul_env) },
10562 // the bridge out side the mountain smithy shop, zelda 2 [Ogy]. Added by Gonetz
10563 // (t1-t0)*primlod+t0, (cmb-0)*t0+0
10564 { 0x038a0e78, cmb(ac_t0_inter_t1_using_primlod) },
10565 // zelda 2, [Ogy]. Added by Gonetz
10566 // (t1-t0)*primlod+t0, (cmb-0)*t1+0
10567 { 0x038a0eb8, cmb(ac_t0_inter_t1_using_primlod) },
10568 // Kirby's pool, smash bros
10569 // (t1-t0)*primlod+t0, (cmb-0)*prim+0
10570 { 0x038a0ef8, cmb(ac__t0_inter_t1_using_primlod__mul_prim) },
10571 // Samus stage fire, smash bros
10572 // (t1-t0)*primlod+t0, (cmb-0)*shade+0
10573 { 0x038a0f38, cmb(ac__t0_inter_t1_using_primlod__mul_shade) },
10574 // something about ice, zelda
10575 // (t1-t0)*primlod+t0, (cmb-0)*env+0
10576 { 0x038a0f78, cmb(ac__t0_inter_t1_using_primlod__mul_env) },
10577 // Blast Corps. Added by Gonetz
10578 // (t1-t0)*primlod+t0, (shade-0)*env+0
10579 { 0x038a0f7c, cmb(ac_env_mul_shade) },
10580 // goals, J. League Tactics Soccer. Added by Gonetz
10581 // (prim-t0)*primlod+t0 ** INC **
10582 { 0x038b038b, cmb(ac_t0) },
10583 // zelda 2, [Ogy]. Added by Gonetz
10584 // (t0-t1)*primlod+t0, (cmb-0)*prim+0
10585 { 0x03910ef8, cmb(ac__t0_sub_t1_mul_primlod_add_t0__mul_prim) },
10586 // a plane in the entrance to the mountain village zelda 2, [Ogy]. Added by Gonetz
10587 // (t1-t1)*primlod+t0, (cmb-0)*prim+0 ** INC **?
10588 { 0x03920ef8, cmb(ac_t0_mul_prim) },
10589 // zelda 2. Added by Gonetz
10590 // (t1-prim)*primlod+t0, (cmb-0)*prim+0 ** INC **
10591 { 0x039a0ef8, cmb(ac__t1_sub_prim_mul_primlod_add_t0__mul_prim) },
10592 // zelda 2. Added by Gonetz
10593 // (t1-shade)*primlod+t0, (cmb-0)*shade+0 ** INC **
10594 { 0x03a20f38, cmb(ac__t1_sub_shade_mul_primlod_add_t0__mul_shade) },
10595 // Candle flame in ganon's castle, zelda
10596 // (t1-1)*primlod+t0 ** INC **
10597 { 0x03b203b2, cmb(ac_t1_sub_one_mul_primlod_add_t0) },
10598 // Fire, zelda
10599 //z (t1-1)*primlod+t0, (cmb-0)*prim+0 ** INC **
10600 { 0x03b20ef8, cmb(ac__t1_sub_one_mul_primlod_add_t0__mul_prim) },
10601 // explosion, zelda 2. Added by Gonetz
10602 // (t1-1)*primlod+t0, (t0-0)*prim+0 ** INC **
10603 { 0x03b20ef9, cmb(ac_t0_mul_prim) },
10604 // Din's fire, zelda
10605 // (t1-1)*prim_lodfrac+t0, (cmb-0)*shade+0 ** INC **
10606 { 0x03b20f38, cmb(ac__t1_sub_one_mul_primlod_add_t0__mul_shade) },
10607 // Fire cloud, zelda
10608 // (t1-1)*prim_lodfrac+t0, (cmb-0)*env+0 ** INC **
10609 { 0x03b20f78, cmb(ac__t1_sub_one_mul_primlod_add_t0__mul_env) },
10610 // zelda 2 [Ogy]. Added by Gonetz
10611 // (prim-1)*prim_lodfrac+t0, (cmb-0)*env+0 ** INC **
10612 { 0x03b30f78, cmb(ac__prim_sub_one_mul_primlod_add_t0__mul_env) },
10613 // fairy's spirit, zelda oot
10614 // (t0-0)*primlod+t0
10615 { 0x03b903b9, cmb(ac_t0_mul_primlod_add_t0) },
10616 // Scary face, pokemon stadium 2
10617 // (t0-0)*primlod+t0, (cmb-0)*prim+0
10618 { 0x03b90ef8, cmb(ac_t0_mul_prim) },
10619 // Leftovers Recovery, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10620 // (t1-0)*prim_lodfrac+t0, (cmb-env)*prim+0 ** INC **
10621 { 0x03ba0ee8, cmb(ac__t1_mul_primlod_add_t0__sub_env_mul_prim) },
10622 // zelda 2 [Ogy]. Added by Gonetz
10623 // (t1-0)*prim_lodfrac+t0, (cmb-0)*prim+0
10624 { 0x03ba0ef8, cmb(ac__t1_mul_primlod_add_t0__mul_prim) },
10625 // zelda 2 [Ogy]. Added by Gonetz
10626 // (t1-0)*prim_lodfrac+t0, (cmb-0)*shade+0
10627 { 0x03ba0f38, cmb(ac__t1_mul_primlod_add_t0__mul_shade) },
10628 // chuchu monsters, zelda 2 [Ogy]. Added by Gonetz
10629 // (t1-0)*prim_lodfrac+t0, (cmb-0)*env+0
10630 { 0x03ba0f78, cmb(ac__t1_mul_primlod_add_t0__mul_env) },
10631 // Scary face, pokemon stadium 2
10632 // (env-0)*primlod+t0, (cmb-0)*prim+0
10633 { 0x03bd0ef8, cmb(ac_t0_mul_prim) },
10634 // ground, zelda 2. Added by Gonetz
10635 // (t1-t0)*0+t0, (cmb-0)*0+cmb
10636 { 0x03ca01f8, cmb(ac_t0) },
10637 // zelda 2. Added by Gonetz
10638 // (t1-t0)*0+t0, (cmb-0)*prim+0
10639 { 0x03ca0ef8, cmb(ac_t0_mul_prim) },
10640 // smoke in a night, zelda 2. Added by Gonetz
10641 // (t1-t0)*0+t0, (cmb-0)*shade+0
10642 { 0x03ca0f38, cmb(ac_t0_mul_shade) },
10643 //the ice plane out side the mountain smithy shop, zelda 2 [Ogy]. Added by Gonetz
10644 //(t1-1)*0+t0, (cmb-0)*env+0
10645 { 0x03f20f78, cmb(ac_t0_mul_env) },
10646 //something on level 5, Kirby64 [Raziel64]
10647 //(t0-0)*0+t0
10648 { 0x03f903f9, cmb(ac_t0) },
10649 //spider house, zelda 2 [Ogy]. Added by Gonetz
10650 //(t0-0)*0+t0, (cmb-0)*prim+0
10651 { 0x03f90ef8, cmb(ac_t0_mul_prim) },
10652 //Darmani's fire spin, zelda 2 [Ogy]. Added by Gonetz
10653 //(t1-0)*0+t0, (cmb-0)*prim+0
10654 { 0x03fa0ef8, cmb(ac_t0_mul_prim) },
10655 // headlight, beetle adventure racing. Added by Gonetz
10656 //(1-0)*0+t0
10657 { 0x03fe03fe, cmb(ac_t0) },
10658 // player, super bowling
10659 // (0-0)*0+t0,
10660 { 0x03ff0000, cmb(ac_t0) },
10661 // Ghost's lantern, zelda
10662 // (0-0)*0+t0, (t1-0)*prim_lod+cmb
10663 { 0x03ff01ba, cmb(ac_t1_mul_primlod_add_t0) },
10664 // Hand cursor, mario
10665 //z (0-0)*0+t0
10666 { 0x03ff03ff, cmb(ac_t0) },
10667 // Taz express. Added by Gonetz
10668 // (0-0)*0+t0, (0-0)*0+t1
10669 { 0x03ff05ff, cmb(ac_t0) },
10670 // powder keg, zelda2. Added by Gonetz
10671 // (0-0)*0+t0, (0-0)*0+prim
10672 { 0x03ff07ff, cmb(ac_t0) },
10673 // water, Spacestation Silicon Valley. Added by Gonetz
10674 // (0-0)*0+t0, (0-0)*0+shade
10675 { 0x03ff09ff, cmb(ac_t0) },
10676 // Characters, Ogre Battle. Added by Gonetz.
10677 // (0-0)*0+t0, (cmb-0)*prim+env
10678 { 0x03ff0af8, cmb(ac_t0_mul_prim_add_env) },
10679 // Monster truck madness intro. Added by Gonetz
10680 // (0-0)*0+t0, (0-0)*0+env
10681 { 0x03ff0bff, cmb(ac_t0) },
10682 // Zoras, zelda
10683 // (0-0)*0+t0, (env-0)*lodf+0
10684 { 0x03ff0e3d, cmb(ac_env) },
10685 // logo, v-rally 99
10686 // (0-0)*0+t0, (prim-0)*t0+0
10687 { 0x03ff0e7b, cmb(ac_t0_mul_prim) },
10688 // intro, WWF-War Zone
10689 // (0-0)*0+t0, (env-0)*t0+0
10690 { 0x03ff0e7d, cmb(ac_t0_mul_env) },
10691 // Window, starfox
10692 //z (0-0)*0+t0, (cmb-0)*prim+0
10693 { 0x03ff0ef8, cmb(ac_t0_mul_prim) },
10694 //beetle adventure racing. Added by Gonetz
10695 // (0-0)*0+t0, (cmb-0)*shade+0
10696 { 0x03ff0f38, cmb(ac_t0_mul_shade) },
10697 // Wonder Project J2 logo. Added by Gonetz
10698 // (0-0)*0+t0, (t0-0)*shade+0
10699 { 0x03ff0f39, cmb(ac_t0_mul_shade) },
10700 // Saria's suit, zelda
10701 // (0-0)*0+t0, (cmb-0)*env+0
10702 { 0x03ff0f78, cmb(ac_t0_mul_env) },
10703 // Pokemon Stadium 2, [Jeremy]. Added by Gonetz
10704 // (0-0)*0+t0, (cmb-0)*primlod+0
10705 { 0x03ff0fb8, cmb(ac_t0_mul_primlod) },
10706 // Tony Hawk's Pro Skater. Added by Gonetz
10707 // (0-0)*0+t0, (0-0)*0+0
10708 { 0x03ff0fff, cmb(ac_zero) },
10709 // Powered Star Beam, Paper Mario. Added by Gonetz
10710 // (t0-t1)*t0+t1, (cmb-0)*prim+0 **INC**
10711 { 0x04510ef8, cmb(ac__t1_inter_t0_using_t0a__mul_prim) },
10712 // Deadly Arts logo. Added by Gonetz
10713 // (1-0)*t0+t1, (1-0)*prim+cmb
10714 { 0x047e00fe, cmb(ac__t0_add_t1__add_prim) },
10715 // Spiderman. Added by Gonetz
10716 // (1-0)*t0+t1
10717 { 0x047e047e, cmb(ac_t0_add_t1) },
10718 // water, Dobutsu no Mori. Added by Gonetz
10719 // (1-0)*t0+t1, (cmb-0)*primlod+prim
10720 { 0x047e07b8, cmb(ac__t0_add_t1__mul_primlod_add_prim) },
10721 // paper mario. Added by Gonetz
10722 // (1-t0)*t1+t1, (cmb-0)*t1+0 **INC**
10723 { 0x048e0eb8, cmb(ac_t0_mul_t1) },
10724 // Pokemon Stadium 2. Added by Gonetz
10725 // (t0-prim)*t1+t1, (cmb-0)*shade+0 **INC**
10726 { 0x04990f38, cmb(ac_t1_mul_shade) },
10727 // light, Dobutsu no Mori. Added by Gonetz
10728 // (t0-0)*t1+t1, (cmb-0)*primlod+0 ** INC **
10729 { 0x04b90fb8, cmb(ac__t0_add_t1__mul_primlod) },
10730 // lava, beetle adventure racing
10731 // (t1-0)*t1+t1, (cmb-0)*shade+0 ** INC **
10732 { 0x04ba0f38, cmb(ac__t1_mul_t1_add_t1__mul_shade) },
10733 // wheels, F1 World Grand Prix. Added by Gonetz
10734 // (t0-t1)*prim+t1
10735 { 0x04d104d1, cmb(ac_t1_inter_t0_using_prima) },
10736 // intro, castlevania 2. Added by Gonetz
10737 // (t0-t1)*prim+t1, (cmb-0)*shade+0
10738 { 0x04d10f38, cmb(ac__t1_inter_t0_using_prima__mul_shade) },
10739 // flame, castlevania 2. Added by Gonetz
10740 // (t0-t1)*prim+t1, (cmb-0)*env+0
10741 { 0x04d10f78, cmb(ac__t1_inter_t0_using_prima__mul_env) },
10742 // walls, beetle adventure racing. Added by Gonetz
10743 // (t0-0)*prim+t1 **INC**
10744 { 0x04f904f9, cmb(ac_t0_mul_prim) },
10745 // Reflect pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10746 // (t0-0)*prim+t1, (cmb-0)*prim+env **INC**
10747 { 0x04f90af8, cmb(ac__t0_add_t1__mul_prim_add_env) },
10748 // Psychic pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10749 // (t0-0)*prim+t1, (cmb-0)*shade+0 **INC**
10750 { 0x04f90f38, cmb(ac__t0_add_t1__mul_shade) },
10751 // Rayman2. Added by Gonetz
10752 // (0-0)*shade+t1, (cmb-0)*env+0
10753 { 0x053f0f78, cmb(ac_t1_mul_env) },
10754 // Ground at kotake & koume, zelda
10755 // (t1-t0)*env+t1, (cmb-0)*prim+0 ** INC **
10756 { 0x054a0ef8, cmb(ac__t1_sub_t0_mul_enva_add_t1__mul_prim) },
10757 // Tony Hawk's Pro Skater. Added by Gonetz
10758 // (t0-t1)*env+t1
10759 { 0x05510551, cmb(ac_t1_inter_t0_using_enva) },
10760 // Shiek's disappearance, zelda
10761 // (t0-1)*env+t1
10762 { 0x05710571, cmb(ac_t0_sub_one_mul_enva_add_t1) },
10763 // Kotake or koume's magic poof, zelda
10764 // (t0-1)*env+t1, (cmb-0)*prim+0 ** INC **
10765 { 0x05710ef8, cmb(ac__t0_sub_one_mul_enva_add_t1__mul_prim) },
10766 // Gauntlet Legends intro
10767 // (t0-0)*env+t1, (cmb-0)*prim+0 ** INC **
10768 { 0x05790ef8, cmb(ac__t0_add_t1__mul_prim) },
10769 // Zelda opening door, zelda
10770 // (t0-0)*env+t1, (cmb-0)*shade+0
10771 { 0x05790f38, cmb(ac_t1_mul_shade) },
10772 // paper mario. Added by Gonetz
10773 // (t1-0)*env+t1, (cmb-0)*prim+0 ** INC **
10774 { 0x057a0ef8, cmb(ac_t1_mul_prim) },
10775 // Skulltula coin, zelda
10776 // (t0-1)*primlod+t1 ** INC **
10777 { 0x05b105b1, cmb(ac_t0_mul_t1) },
10778 // Bell, Pokemon Stadium 2. Added by Gonetz
10779 // (t0-0)*primlod+t1, (cmb-env)*prim ** INC **
10780 { 0x05b90ee8, cmb(ac__t0_add_t1__mul_prim) },
10781 // intro, Aidyn Chronicles. Added by Gonetz
10782 // (0-cmb)*0+t1, (t1-1)*0+cmb
10783 { 0x05c701f2, cmb(ac_t1) },
10784 // zelda 2 [Ogy]. Added by Gonetz
10785 // (t1-t0)*0+t1, (cmb-0)*prim+0
10786 { 0x05ca0ef8, cmb(ac_t1_mul_prim) },
10787 // beaver's river, zelda 2. Added by Gonetz
10788 // (t1-0)*0+t1, (cmb-0)*prim+0
10789 { 0x05fa0ef8, cmb(ac_t1_mul_prim) },
10790 // Ogre Battle, unimp log. Added by Gonetz
10791 // (0-0)*0+t1, (0-0)*0+cmb
10792 { 0x05ff05ff, cmb(ac_t1) },
10793 // lullaby, Paper Mario. Added by Gonetz
10794 // (0-0)*0+t1, (cmb-0)*prim+0
10795 { 0x05ff0ef8, cmb(ac_t1_mul_prim) },
10796 // aerofighter's assault [Ogy]
10797 // (0-0)*0+t1, (cmb-0)*shade+0
10798 { 0x05ff0f38, cmb(ac_t1_mul_shade) },
10799 // magic fist, Rayman2. Added by Gonetz
10800 // (0-0)*0+t1, (cmb-0)*env+0
10801 { 0x05ff0f78, cmb(ac_t1_mul_env) },
10802 // Pokemon selection background, Pokemon stadium 2
10803 // (env-prim)*t0+prim
10804 { 0x065d065d, cmb(ac_env_sub_prim_mul_t0_add_prim) },
10805 // text background, Ganbare Goemon - Mononoke Sugoroku
10806 // (1-prim)*t0+prim
10807 { 0x065e065e, cmb(ac_one_sub_prim_mul_t0_add_prim) },
10808 // shadows, star wars: ep1 racer
10809 // (0-prim)*t0+prim
10810 { 0x065f065f, cmb(ac_zero_sub_prim_mul_t0_add_prim) },
10811 // lava, beetle adventure racing
10812 // (0-1)*t0+prim, (cmb-0)*prim+0 ** INC **
10813 { 0x06770ef8, cmb(ac_t0_mul_prim) },
10814 // menu, Ganbare Goemon - Mononoke Sugoroku
10815 // (t0-0)*t0+prim
10816 { 0x06790679, cmb(ac_t0_add_prim) },
10817 // Water, pokemon stadium 2
10818 // (t1-0)*t0+prim
10819 { 0x067a067a, cmb(ac_t0_mul_t1_add_prim) },
10820 // Smackdown Mall Menu, WWF No Mercy
10821 // (shade-0)*t0+prim
10822 { 0x067c067c, cmb(ac_t0_mul_shade_add_prim) },
10823 // flag, Top Gear Rally 2. Added by Gonetz
10824 // (env-0)*t0+prim
10825 { 0x067d067d, cmb(ac_t0_mul_env_add_prim) },
10826 // Mario Tennis. Added by Gonetz
10827 // (1-0)*t0+prim
10828 { 0x067e067e, cmb(ac_t0_add_prim) },
10829 // sky, PGA European Tour
10830 // (t0-0)*t1+prim
10831 { 0x06b906b9, cmb(ac_t0_mul_t1_add_prim) },
10832 // lava, beetle adventure racing
10833 // (t0-0)*t1+prim, (0-0)*0+1 **INC**?
10834 { 0x06b90dff, cmb(ac_one) },
10835 // Pokemon Stadium 2, [Jeremy]. Added by Gonetz
10836 // (prim-0)*t1+prim
10837 { 0x06bb06bb, cmb(ac_t1_mul_prim_add_prim) },
10838 // pokemon psyattack, Pokemon Stadium 2. Added by Gonetz
10839 // (1-0)*t1+prim, (cmb-0)*env+0
10840 { 0x06be0f78, cmb(ac_t1_add_prim_mul_env) },
10841 // Rush2 2. Added by Gonetz
10842 // (prim-prim)*prim+prim
10843 { 0x06db06db, cmb(ac_prim) },
10844 //Spacestation Silicon Valley intro. Added by Gonetz
10845 // (t1-prim)*shade+prim
10846 // { 0x071a071a, cmb(ac_t1_mul_shade) },
10847 { 0x071a071a, cmb(ac_t1_sub_prim_mul_shade_add_prim) },
10848 //KI logos. Added by Gonetz
10849 // (env-prim)*shade+prim
10850 { 0x071d071d, cmb(ac_env_sub_prim_mul_shade_add_prim) },
10851 // Deadly Arts, arena. Added by Gonetz
10852 // (1-0)*shade+prim
10853 { 0x073e073e, cmb(ac_prim_add_shade) },
10854 // Phantom Gannon's portal, zelda
10855 // (t1-t0)*env+prim, (cmb-0)*shade+0 ** INC **
10856 { 0x074a0f38, cmb(ac__t0_mul_t1__mul_prim_mul_shade) },
10857 // Road rush. Added by Gonetz
10858 // (t0-0)*env+prim
10859 { 0x07790779, cmb(ac_t0_mul_env_add_prim) },
10860 // telescope, zelda 2. Added by Gonetz
10861 // (1-t0)*primlod+prim
10862 { 0x078e078e, cmb(ac_one_sub_t0_mul_primlod_add_prim) },
10863 // zelda 2 [Ogy]. Added by Gonetz
10864 // (t0-t1)*primlod+prim, (cmb-0)*t0+0
10865 { 0x07910e78, cmb(ac_t0_inter_t1_using_primlod) },
10866 // Dobutsu no Mori. Added by Gonetz
10867 // (t0-0)*primlod+prim
10868 { 0x07b907b9, cmb(ac_t0_mul_primlod_add_prim) },
10869 // water, DK64
10870 // (0-0)*0+0, (0-t1)*0+prim
10871 { 0x07d707d7, cmb(ac_prim) },
10872 // Menu, megaman
10873 // (1-0)*0+prim
10874 { 0x07fe07fe, cmb(ac_prim) },
10875 // super bowling
10876 //(0-0)*0+prim,
10877 { 0x07ff0000, cmb(ac_prim) },
10878 // menu, Ganbare Goemon - Mononoke Sugoroku
10879 // (0-0)*0+prim, (0-0)*0+t0
10880 { 0x07ff03ff, cmb(ac_t0) },
10881 // Intro background, starfox
10882 //z (0-0)*0+prim
10883 { 0x07ff07ff, cmb(ac_prim) },
10884 // gem, castlevania 2. Added by Gonetz
10885 // (0-0)*0+prim, (cmb-0)*t0+0
10886 { 0x07ff0e78, cmb(ac_t0_mul_prim) },
10887 // text, Tony Hawk's Pro Skater. Added by Gonetz
10888 // (0-0)*0+prim, (cmb-0)*t1+0
10889 { 0x07ff0eb8, cmb(ac_t1_mul_prim) }, //weird, but implementing this makes text unreadable
10890 // zelda 2. Added by Gonetz
10891 // (0-0)*0+prim, (cmb-0)*prim+0
10892 { 0x07ff0ef8, cmb(ac_prim_mul_prim) },
10893 // explosion, Blast Corps. Added by Gonetz
10894 // (0-0)*0+prim, (t0-0)*prim+0
10895 { 0x07ff0ef9, cmb(ac_t0_mul_prim) },
10896 // zelda 2, [Ogy]. Added by Gonetz
10897 // (0-0)*0+prim, (cmb-0)*shade+0
10898 { 0x07ff0f38, cmb(ac_prim_mul_shade) },
10899 // Fox's ears and arms, smash bros
10900 // (0-0)*0+prim, (cmb-0)*env+0
10901 { 0x07ff0f78, cmb(ac_prim_mul_env) },
10902 // monsters, Pokemon Stadium. Added by Gonetz
10903 // (0-0)*0+prim, (cmb-0)*primlod+0
10904 { 0x07ff0fb8, cmb(ac_prim_mul_primlod) },
10905 // focus, Paper Mario. Added by Gonetz
10906 //(t0-shade)*t0+shade, (cmb-0)*prim+0 * INC **
10907 { 0x08610ef8, cmb(ac_t0_mul_prim) },
10908 // Mario's head, mario //Added by Gonetz
10909 //(prim-shade)*t0+shade
10910 { 0x08630863, cmb(ac_prim_sub_shade_mul_t0_add_shade) },
10911 // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
10912 //(t0-t1)*prim+shade, (cmb-0)*shade+0 ** INC **
10913 { 0x08d10f38, cmb(ac_t0_mul_prim_mul_shade) },
10914 // ?
10915 //(t0-shade)*prim+shade
10916 { 0x08e108e1, cmb(ac_t0_mul_prim_add_shade_mul_one_minus_prim) },
10917 // Paper Mario
10918 // (t0-prim)*shade+shade, (cmb-0)*env+0
10919 { 0x09190f78, cmb(ac__t0_sub_prim_mul_shade_add_shade__mul_env) },
10920 // pads, Pokemon Stadium 2. Added by Gonetz
10921 // (0-t0)*env+shade, (cmb-0)*prim+0 ** INC **
10922 { 0x094f0ef8, cmb(ac_one_sub_t0_mul_prim_mul_shade) },
10923 // Huge turtle appearance, zelda 2. Added by Gonetz
10924 // (t1-0)*primlod+shade, (cmb-0)*shade+0 ** INC **
10925 { 0x09ba0f38, cmb(ac_t1_mul_shade) },
10926 // roof, Kirby 64. Added by Gonetz
10927 // (t0-0)*0+shade
10928 { 0x09f909f9, cmb(ac_shade) },
10929 // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
10930 // (0-0)*0+shade, (cmb-cmb)*lodf+cmb
10931 { 0x09ff0000, cmb(ac_shade) },
10932 // water temple, zelda 2. Added by Gonetz
10933 // (0-0)*0+shade, (cmb-0)*prim+cmb
10934 { 0x09ff00f8, cmb(ac_prim_mul_shade_add_shade) },
10935 // damaged car, SCARS. Added by Gonetz
10936 // (0-0)*0+shade, (t0-t1)*primlod+prim ** INC **
10937 { 0x09ff0791, cmb(ac_t0_mul_primlod_add_prim) },
10938 // Hyrule castle gate, zelda
10939 //z (0-0)*0+shade, (0-0)*0+prim
10940 { 0x09ff07ff, cmb(ac_prim) },
10941 // Super Mario 64 logo
10942 //z (0-0)*0+shade
10943 { 0x09ff09ff, cmb(ac_shade) },
10944 // terrain, SCARS. Added by Gonetz
10945 // (0-0)*0+shade, (0-0)*0+1
10946 { 0x09ff0dff, cmb(ac_one) },
10947 // terrain, SCARS. Added by Gonetz
10948 // (0-0)*0+shade, (t0-0)*t1+0
10949 { 0x09ff0eb9, cmb(ac_t0_mul_t1) },
10950 // N64 logo, Aidyn Chronicles. Added by Gonetz
10951 // (0-0)*0+shade, (cmb-0)*prim+0
10952 { 0x09ff0ef8, cmb(ac_prim_mul_shade) },
10953 // birds?, custom robo. Added by Gonetz
10954 // (0-0)*0+shade, (cmb-0)*shade+0
10955 { 0x09ff0f38, cmb(ac_shade) },
10956 // sky, Glover, [Raziel64]. Added by Gonetz
10957 // (0-0)*0+shade, (t0-0)*shade+0
10958 { 0x09ff0f39, cmb(ac_t0_mul_shade) },
10959 // Hand, smash bros
10960 // (0-0)*0+shade, (cmb-0)*env+0
10961 { 0x09ff0f78, cmb(ac_env_mul_shade) },
10962 // Conker's helicopter tail, CBFD
10963 // (0-0)*0+shade, (shade-0)*env+0
10964 { 0x09ff0f7c, cmb(ac_env_mul_shade) },
10965 // menu, PokemonStadium1, [Raziel64]
10966 // (0-0)*0+shade, (cmb-0)*primlod+0
10967 { 0x09ff0fb8, cmb(ac_primlod_mul_shade) },
10968 // Link's sword slashing, smash bros
10969 // (prim-env)*t0+env
10970 { 0x0a6b0a6b, cmb(ac_prim_sub_env_mul_t0_add_env) },
10971 // Reflected beam at kotake & koume's, zelda
10972 // (prim-env)*t0+env, (cmb-0)*prim+0 ** INC **
10973 { 0x0a6b0ef8, cmb(ac_t0_mul_prim) },
10974 // teleporter, Spacestation Silicon Valley. Added by Gonetz
10975 // (prim-env)*t0+env, (cmb-0)*shade+0 ** INC **
10976 { 0x0a6b0f38, cmb(ac_t0_mul_shade) },
10977 // Ridge Racer, unimp log. Added by Gonetz
10978 // (prim-env)*t0+env, (cmb-0)*primlod+0
10979 { 0x0a6b0fb8, cmb(ac_prim_sub_env_mul_t0_add_env) },
10980 // Kotake or koume's hair, zelda
10981 // (prim-0)*t0+env
10982 { 0x0a7b0a7b, cmb(ac_t0_mul_prim_add_env) },
10983 // menu, doubut no mori
10984 // (1-0)*t0+env
10985 { 0x0a7e0a7e, cmb(ac_t0_add_env) },
10986 // Grass, mario golf
10987 // (env-shade)*t1+env, (0-0)*0+1
10988 { 0x0aa50dff, cmb(ac_one) },
10989 // Ridge Racer, cars select. Added by Gonetz
10990 // (prim-env)*t1+env
10991 { 0x0aab0aab, cmb(ac_prim_sub_env_mul_t1_add_env) },
10992 // text, monster truck madness
10993 // (prim-env)*t1+env, (cmb-0)*t1+0
10994 { 0x0aab0eb8, cmb(ac_t1_mul_env) },
10995 // zelda 2 [Ogy]. Added by Gonetz
10996 // (1-0)*t1+env, (0-0)*0+cmb
10997 { 0x0abe0abe, cmb(ac_one) },
10998 // { 0x0abe0abe, cmb(ac_t1_add_env) },
10999 // arena, Pokemon Stadium 2. Added by Gonetz
11000 // (1-t0)*prim+env, (cmb-0)*shade+0
11001 { 0x0ace0f38, cmb(ac_one_sub_t0_mul_prim_mul_shade) },
11002 // intro, Bomberman 64 - 2. Added by Gonetz
11003 // (t0-env)*prim+env
11004 { 0x0ae90ae9, cmb(ac_t0_sub_env_mul_prim_add_env) },
11005 // N64 logo, Ogre Battle. Added by Gonetz
11006 // (t0-0)*prim+env
11007 { 0x0af90af9, cmb(ac_t0_mul_prim_add_env) },
11008 // girls, PD intro. Added by Gonetz
11009 // (t0-env)*shade+env ** INC **
11010 { 0x0b290b29, cmb(ac_t0_mul_shade_add_env) },
11011 // shadows, Mario Tennis. Added by Gonetz
11012 // (prim-env)*shade+env, (0-cmb)*t1+cmb ** INC **
11013 { 0x0b2b0087, cmb(ac_prim_sub_env_mul_shade_add_env_mul_t1) },
11014 // lamppost?, Ridge Racer. Added by Gonetz
11015 // (prim-env)*shade+env, (0-0)*0+cmb
11016 { 0x0b2b0b2b, cmb(ac_prim_sub_env_mul_shade_add_env) },
11017 // ground, zelda2. Added by Gonetz
11018 // (1-env)*shade+env, (t1-0)*prim+0
11019 { 0x0b2e0efa, cmb(ac_t1_mul_prim) },
11020 // GASP Fighters
11021 // (t0-0)*shade+env
11022 { 0x0b390b39, cmb(ac_t0_mul_shade_add_env) },
11023 // destroying stuff, golden eye
11024 // (1-0)*shade+env
11025 { 0x0b3e0b3e, cmb(ac_env_add_shade) },
11026 // Papeer Mario. Added by Gonetz
11027 // (t0-t1)*env+env, (0-0)*0+1
11028 { 0x0b510dff, cmb(ac_one) },
11029 // International Track and Field 2000. Added by Gonetz
11030 // (t0-0)*0+env
11031 { 0x0bf90bf9, cmb(ac_env) },
11032 // TM, mario
11033 //z (0-0)*0+env
11034 { 0x0bff0bff, cmb(ac_env) },
11035 // rancho monster, zelda2. Added by Gonetz
11036 // (0-0)*0+env, (cmb-0)*t1+0
11037 { 0x0bff0eb8, cmb(ac_t1_mul_env) },
11038 // Rocket Robot in Wheels intro
11039 // (0-0)*0+env, (cmb-0)*prim+0
11040 { 0x0bff0ef8, cmb(ac_prim_mul_env) },
11041 // Tony Hawk's Pro Skater. Added by Gonetz
11042 // (1-t0)*t1+1, (cmb-t1)*t1+t1 ** INC **
11043 { 0x0c770c77, cmb(ac_t0_mul_t1) },
11044 // flame, paper mario. Added by Gonetz
11045 // (1-t0)*t1+1, (cmb-t1)*t1+t1
11046 { 0x0c8e0490, cmb(ac_t0_mul_t1) },
11047 // Ring boundary, dual heroes
11048 // (0-1)*prim+1
11049 { 0x0cf70cf7, cmb(ac_one_sub_prim) },
11050 // Kirby64, level 6, [Raziel64]
11051 // (0-0)*prim+1
11052 { 0x0cff0cff, cmb(ac_one) },
11053 // Mystical Ninja
11054 // (0-1)*env+1
11055 { 0x0d770d77, cmb(ac_one) },
11056 // Deku shield in shop, zelda
11057 // (1-1)*primlod+1
11058 { 0x0db60db6, cmb(ac_one) },
11059 // water near gorons willage. Added by Gonetz
11060 // (t1-t0)*0+1, (cmb-0)*prim+0
11061 { 0x0dca0ef8, cmb(ac_prim) },
11062 // background, kirby 64. Added by Gonetz
11063 // (t0-0)*0+1
11064 { 0x0df90df9, cmb(ac_one) },
11065 // kirby 64. Added by Gonetz
11066 // (1-0)*0+1
11067 { 0x0dfe0dfe, cmb(ac_one) },
11068 // background on level 2-1, kirby 64 [Raziel64]. Added by Gonetz
11069 // (1-0)*0+1, (0-0)*0+1
11070 { 0x0dfe0dff, cmb(ac_one) },
11071 // duck dodgers intro. Added by Gonetz
11072 // (0-0)*0+1, (cmb-cmb)*primlod+cmb
11073 { 0x0dff0000, cmb(ac_one) },
11074 // duck dodgers intro. Added by Gonetz
11075 // (0-0)*0+1, (0-0)*0+t1 **INC**?
11076 { 0x0dff05ff, cmb(ac_t1) },
11077 // ?
11078 // (0-0)*0+1, (0-0)*0+prim
11079 { 0x0dff07ff, cmb(ac_prim) },
11080 // arena, custom robo. Added by Gonetz
11081 // (0-0)*0+1, (0-0)*0+shade
11082 { 0x0dff09ff, cmb(ac_shade) },
11083 // field, Mario Golf
11084 // (0-0)*0+1, (1-env)*shade+env
11085 { 0x0dff0b2e, cmb(ac_one_sub_env_mul_shade_add_env) },
11086 // battle tanks 2 [Ogy]
11087 // (0-0)*0+1, (0-0)*0+env
11088 { 0x0dff0bff, cmb(ac_env) },
11089 // helmet, F1 World Grand Prix. Added by Gonetz
11090 // (0-0)*0+1, (0-1)*0+1
11091 { 0x0dff0df7, cmb(ac_one) },
11092 // secret in level 3-4, Kirby64, [Raziel64]
11093 // (0-0)*0+1, (cmb-0)*0+1
11094 { 0x0dff0df8, cmb(ac_one) },
11095 // Menu options, starfox
11096 // (0-0)*0+1
11097 { 0x0dff0dff, cmb(ac_one) },
11098 // Water, zelda
11099 //z (0-0)*0+primlod, (cmb-0)*prim+0
11100 { 0x0dff0ef8, cmb(ac_prim) },
11101 // Desert ground, zelda
11102 // (0-0)*0+1, (cmb-0)*shade+0
11103 { 0x0dff0f38, cmb(ac_shade) },
11104 // Characters, smash bros
11105 // (0-0)*0+1, (cmb-0)*env+0
11106 { 0x0dff0f78, cmb(ac_env) },
11107 // end of level 3-4, Kirby64, [Raziel64]
11108 // (0-0)*0+1, (cmb-0)*0+0
11109 { 0x0dff0ff8, cmb(ac_zero) },
11110 // Kirby64
11111 // (0-0)*0+1, (0-0)*0+0
11112 { 0x0dff0fff, cmb(ac_zero) },
11113 // floor, Spiderman [Raziel64]. Added by Gonetz
11114 // (env-t1)*t0+0 ** INC **
11115 { 0x0e550e55, cmb(ac_t0_mul_env) },
11116 // skeleton, castlevania 2. Added by Gonetz
11117 // (1-prim)*t0+0
11118 { 0x0e5e0e5e, cmb(ac_one_sub_prim_mul_t0) },
11119 // player select, Forsaken [Raziel64]. Added by Gonetz
11120 // (prim-shade)*t0+0
11121 { 0x0e630e63, cmb(ac_prim_sub_shade_mul_t0) },
11122 // castlevania 2 [Ogy]. Added by Gonetz
11123 // (1-shade)*t0+0
11124 { 0x0e660e66, cmb(ac_one_sub_shade_mul_t0) },
11125 // background, level3-4, Kirby64, [Raziel64]
11126 // (shade-env)*t0+0
11127 { 0x0e6c0e6c, cmb(ac_shade_sub_env_mul_t0) },
11128 // Goemon, mystical ninja. Added by Gonetz
11129 // (1-env)*t0+0
11130 { 0x0e6e0e6e, cmb(ac_one_sub_env_mul_t0) },
11131 // fist attack, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
11132 // (t0-0)*t0+0, (t1-cmb)*prim+cmb
11133 { 0x0e7900c2, cmb(ac_t0_inter_t1_using_prima) },
11134 // Clay Fighter [Ogy]. Added by Gonetz
11135 // (t0-0)*t0+0
11136 { 0x0e790e79, cmb(ac_t0_mul_t0) },
11137 // Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
11138 // (t0-0)*t0+0, (prim-0)*t1+0
11139 { 0x0e790ebb, cmb(ac_t1_mul_prim) },
11140 // zelda 2 [Ogy]. Added by Gonetz
11141 // (t0-0)*t0+0, (cmb-0)*prim+0
11142 { 0x0e790ef8, cmb(ac_t0_mul_prim) },
11143 // zelda 2. Added by Gonetz
11144 // (t0-0)*t0+0, (cmb-0)*shade+0
11145 { 0x0e790f38, cmb(ac_t0_mul_shade) },
11146 // zelda 2. Added by Gonetz
11147 // (t0-0)*t0+0, (cmb-0)*env+0
11148 { 0x0e790f78, cmb(ac_t0_mul_env) },
11149 // the ice plane just before the entrance to gorons village (where tingle is) }, zelda 2 [Ogy]. Added by Gonetz
11150 // (t1-0)*t0+0, (cmb-0)*0+cmb
11151 { 0x0e7a01f8, cmb(ac_t0_mul_t1) },
11152 // paper mario. Added by Gonetz
11153 // (t1-0)*t0+0, (cmb-env)*prim+env ** INC **
11154 { 0x0e7a0ae8, cmb(ac_t1_mul_prim) },
11155 // Tony Hawk's Pro Skater. Added by Gonetz
11156 // (t1-0)*t0+0, (cmb-0)*t0+0
11157 { 0x0e7a0e78, cmb(ac_t0_mul_t1) },
11158 // bike trace, xg2. Added by Gonetz
11159 // (t1-0)*t0+0
11160 { 0x0e7a0e7a, cmb(ac_t0_mul_t1) },
11161 // Kotake & koume defeated, zelda
11162 // (t1-0)*t0+0, (cmb-0)*prim+0
11163 { 0x0e7a0ef8, cmb(ac__t0_mul_t1__mul_prim) },
11164 // Magnitude, pokemon stadium 2
11165 // (t1-0)*t0+0, (cmb-env)*shade+0
11166 { 0x0e7a0f28, cmb(ac__t0_mul_t1__mul_env_mul_shade) },
11167 // Bongo Bongo, zelda
11168 // (t1-0)*t0+0, (cmb-0)*shade+0
11169 { 0x0e7a0f38, cmb(ac__t0_mul_t1__mul_shade) },
11170 // Back of doors, megaman
11171 // (prim-0)*t0+0, (cmb-0)*lodfrac+0
11172 { 0x0e7b0e38, cmb(ac_t0_mul_prim) },
11173 // Karts, mario kart
11174 //z (prim-0)*t0+0
11175 { 0x0e7b0e7b, cmb(ac_t0_mul_prim) },
11176 // paper mario. Added by Gonetz
11177 // (prim-0)*t0+0, (t0-0)*prim+0
11178 { 0x0e7b0ef9, cmb(ac_t0_mul_prim) },
11179 // Table, mace
11180 // (prim-0)*t0+0, (cmb-0)*shade+0
11181 { 0x0e7b0f38, cmb(ac_t0_mul_prim_mul_shade) },
11182 // lamp shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
11183 // (shade-0)*t0+0, (cmb-cmb)*lodf+cmb
11184 { 0x0e7c0000, cmb(ac_t0_mul_shade) },
11185 // Game logo, Aerofighters Assault [Raziel64]
11186 //(shade-0)*t0+0, (0-0)*0+1
11187 { 0x0e7c0dff, cmb(ac_one) },
11188 // Higher sky, waverace
11189 //z (shade-0)*t0+0
11190 { 0x0e7c0e7c, cmb(ac_t0_mul_shade) },
11191 // duck dodgers, intro. Added by Gonetz
11192 // (shade-0)*t0+0, (cmb-0)*prim+0
11193 { 0x0e7c0ef8, cmb(ac_t0_mul_prim_mul_shade) },
11194 // waterwheel in water temple, zelda 2. Added by Gonetz
11195 // (shade-0)*t0+0, (cmb-0)*env+0
11196 { 0x0e7c0f78, cmb(ac_t0_mul_env_mul_shade) },
11197 // Blowing up mine at bowser's, mario
11198 // (env-0)*t0+0
11199 { 0x0e7d0e7d, cmb(ac_t0_mul_env) },
11200 // castlevania 2, intro. Added by Gonetz
11201 // (1-0)*t0+0
11202 { 0x0e7e0e7e, cmb(ac_t0) },
11203 // moon, castlevania 2. Added by Gonetz
11204 // (1-0)*t0+0, (cmb-0)*prim+0
11205 { 0x0e7e0ef8, cmb(ac_t0_mul_prim) },
11206 //beetle adventure racing. Added by Gonetz
11207 // (1-0)*t0+0, (cmb-0)*shade+0
11208 { 0x0e7e0f38, cmb(ac_t0_mul_shade) },
11209 // lava, beetle adventure racing
11210 // (t0-prim)*t1+0, (0-0)*0+shade ** INC **
11211 { 0x0e9909ff, cmb(ac_shade) },
11212 // Rain Dance, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
11213 // (t0-env)*t1+0, (cmb-0)*0+prim ** INC **
11214 { 0x0ea90ef8, cmb(ac__t0_mul_t1__mul_prim) },
11215 // airboarder 64 [Ogy]
11216 // (t0-0)*t1+0, (0-0)*0+prim
11217 { 0x0eb907ff, cmb(ac_prim) },
11218 // explosion, body harvest. Added by Gonetz
11219 // (t0-0)*t1+0, (0-0)*0+shade
11220 { 0x0eb909ff, cmb(ac_shade) },
11221 // Text off top, banjo kazooie
11222 // (t0-0)*t1+0
11223 { 0x0eb90eb9, cmb(ac_t0_mul_t1) },
11224 // smoke, daikatana. Added by Gonetz
11225 // (t0-0)*t1+0, (cmb-0)*prim+0
11226 { 0x0eb90ef8, cmb(ac__t0_mul_t1__mul_prim) },
11227 // Water, pilotwings
11228 // (t0-0)*t1+0, (cmb-0)*shade+0
11229 { 0x0eb90f38, cmb(ac__t0_mul_t1__mul_shade) },
11230 // Tony Hawk's Pro Skater. Added by Gonetz
11231 // (t0-0)*t1+0, (cmb-0)*env+0
11232 { 0x0eb90f78, cmb(ac__t0_mul_t1__mul_env) },
11233 // light from window, Dobutsu no Mori. Added by Gonetz
11234 // (t0-0)*t1+0, (cmb-0)*primlod+0
11235 { 0x0eb90fb8, cmb(ac__t0_mul_t1__mul_primlod) },
11236 // chandelier in spider house, zelda 2. Added by Gonetz
11237 // (t1-0)*t1+0, (cmb-0)*prim+0
11238 { 0x0eba0ef8, cmb(ac_t1_mul_prim) },
11239 // cars, ridge racer. Added by Gonetz
11240 // (prim-0)*t1+0, (0-0)*0+1
11241 { 0x0ebb0dff, cmb(ac_t1_mul_prim) },
11242 // aerofighter's assault [Ogy]
11243 // (prim-0)*t1+0
11244 { 0x0ebb0ebb, cmb(ac_t1_mul_prim) },
11245 // tire trace, beetle adventure racing. Added by Gonetz
11246 // (shade-0)*t1+0
11247 { 0x0ebc0ebc, cmb(ac_t1_mul_shade) },
11248 // smoke, Starshot. Added by Gonetz
11249 // (env-0)*t1+0
11250 { 0x0ebd0ebd, cmb(ac_t1_mul_env) },
11251 // lots of things, goldeneye
11252 // (1-0)*t1+0, (0-0)*0+shade
11253 { 0x0ebe09ff, cmb(ac_shade) },
11254 // zelda 2 [Ogy]. Added by Gonetz
11255 // (1-0)*t1+0, (cmb-0)*prim+0
11256 { 0x0ebe0ef8, cmb(ac_t1_mul_prim) },
11257 // walls, perfect dark. Added by Gonetz
11258 // (1-0)*t1+0, (cmb-0)*shade+0
11259 { 0x0ebe0f38, cmb(ac_t1_mul_shade) },
11260 // sand, perfect dark. Added by Gonetz
11261 // (1-0)*t1+0, (cmb-0)*env+0
11262 { 0x0ebe0f78, cmb(ac_t1_mul_env) },
11263 // light, Ridge Racer. Added by Gonetz
11264 // (1-t0)*prim+0
11265 { 0x0ece0ece, cmb(ac_one_sub_t0_mul_prim) },
11266 // exaust, star wars ep1 racer
11267 // (1-t0)*prim+0, (cmb-0)*shade+0
11268 { 0x0ece0f38, cmb(ac_one_sub_t0_mul_primshade) },
11269 // iguana, Forsaken, [Raziel64]. Added by Gonetz
11270 // (t0-shade)*prim+0 ** INC **
11271 { 0x0ee10ee1, cmb(ac_t0_sub_prim_mul_shade) },
11272 // stands, NASCAR 2000
11273 // (prim-shade)*prim+0 ** INC **
11274 { 0x0ee30ee3, cmb(ac_prim) },
11275 // arena, Pokemon Stadium 2. Added by Gonetz
11276 // (t0-env)*prim+0 ** INC **
11277 { 0x0ee90ee9, cmb(ac_t0_mul_prim) },
11278 // explosion, body harvest. Added by Gonetz
11279 // (t0-0)*prim+0, (t0-0)*env+cmb
11280 { 0x0ef90179, cmb(ac_prim_add_env_mul_t0) },
11281 // frog's eyes, zelda
11282 // (t0-0)*prim+0, (1-1)*prim_lod+cmb
11283 { 0x0ef901b6, cmb(ac_t0_mul_prim) },
11284 // Monster truck madness intro. Added by Gonetz
11285 // (t0-0)*prim+0, (cmb-0)*prim_lod+cmb ** INC **
11286 { 0x0ef901b8, cmb(ac_t0_mul_prim) },
11287 // Road, zelda
11288 //z (t0-0)*prim+0, (t1-0)*primlod+cmb
11289 { 0x0ef901ba, cmb(ac__t0_mul_prim__add__t1_mul_primlod) },
11290 // Track, wipeout. Addded by Gonetz
11291 // (t0-0)*prim+0, (0-0)*0+prim
11292 { 0x0ef907ff, cmb(ac_t0_mul_prim) },
11293 // magic stuff, buck bumble. Added by Gonetz
11294 // (t0-0)*prim+0, (cmb-0)*prim+0
11295 { 0x0ef90ef8, cmb(ac_t0_mul_prim_mul_prim) },
11296 // The mario face, mario
11297 //z (t0-0)*prim+0
11298 { 0x0ef90ef9, cmb(ac_t0_mul_prim) },
11299 // paper mario. Added by Gonetz
11300 // (t0-0)*prim+0, (cmb-0)*shade+0
11301 { 0x0ef90f38, cmb(ac_t0_mul_prim_mul_shade) },
11302 // Pik achu's mouth, smash bros
11303 // (t0-0)*prim+0, (cmb-0)*env+0
11304 { 0x0ef90f78, cmb(ac_t0_mul_prim_mul_env) },
11305 // bomb mask, zelda 2. Added by Gonetz
11306 // (t0-0)*prim+0, (1-0)*env+0
11307 { 0x0ef90f7e, cmb(ac_t0_mul_prim) },
11308 // Charmander's tail, pokemon stadium 2
11309 // (t0-0)*prim+0, (cmb-0)*primlod+0
11310 { 0x0ef90fb8, cmb(ac_t0_mul_prim_mul_primlod) },
11311 // stalactites, Beetle adventure Racing. Added by Gonetz
11312 // (t1-0)*prim+0, (1-cmb)*shade+cmb
11313 { 0x0efa0106, cmb(ac_one_sub_shade_mul_t1_add_shade) },
11314 // Sprites, Ogre Battle. Added by Gonetz
11315 // (t1-0)*prim+0, (0-0)*0+cmb
11316 { 0x0efa0efa, cmb(ac_t1_mul_prim) },
11317 // Something about kotake & koume's combined attack, zelda
11318 // (t1-0)*prim+0, (cmb-0)*shade+0
11319 { 0x0efa0f38, cmb(ac_t1_mul_prim_mul_shade) },
11320 // intro background, bio freaks. Added by Gonetz
11321 // (prim-0)*prim+0
11322 { 0x0efb0efb, cmb(ac_prim_mul_prim) },
11323 // sky, xg2. Added by Gonetz
11324 // (shade-0)*prim+0, (0-0)*0+1
11325 { 0x0efc0dff, cmb(ac_one) },
11326 // Zelda, unimp log. Added by Gonetz
11327 // (shade-0)*prim+0
11328 { 0x0efc0efc, cmb(ac_prim_mul_shade) },
11329 // Baby mario's hat shadow, mario golf
11330 // (env-0)*prim+0
11331 { 0x0efd0efd, cmb(ac_prim_mul_env) },
11332 // Menu, doom
11333 // (1-0)*prim+0
11334 { 0x0efe0efe, cmb(ac_prim) },
11335 // Conker's shadow, CBFD. Added by Gonetz
11336 // (1-t0)*shade+0
11337 { 0x0f0e0f0e, cmb(ac_one_sub_t0_mul_shade) },
11338 // Rock smash, pokemon stadium 2
11339 // (1-t0)*shade+0
11340 { 0x0f0f0ee8, cmb(ac_one_sub_t0_mul_shade) },
11341 //waterfall, Paper Mario
11342 // (t0-t1)*shade+0
11343 { 0x0f110f11, cmb(ac__t0_sub_t1__mul_shade) },
11344 // Boomerang circle, zelda
11345 // (t0-0)*shade+0, (1-cmb)*t0+cmb
11346 { 0x0f390046, cmb(ac_t0_mul_shade) },
11347 // THPS3
11348 // (t0-0)*shade+0, (1-0)*t0+cmb
11349 { 0x0f39007e, cmb(ac_t0_mul_shade) },
11350 // ???
11351 // (t0-0)*shade+0, (env-0)*t1+cmb
11352 { 0x0f3900bd, cmb(ac_t0_mul_shade) },
11353 // Forest temple doorway, zelda
11354 // (t0-0)*shade+0, (t1-0)*primlod+cmb
11355 { 0x0f3901ba, cmb(ac_t0_mul_shade) },
11356 // skis, Spacestation Silicon Valley. Added by Gonetz
11357 // (t0-0)*shade+0, (0-0)*0+t0
11358 { 0x0f3903ff, cmb(ac_t0) },
11359 // paper mario. Added by Gonetz
11360 // (t0-0)*shade+0, (cmb-t0)*prim+0
11361 { 0x0f390ec8, cmb(ac_t0_mul_prim_mul_shade) },
11362 // House windows, zelda intro
11363 //z (t0-0)*shade+0, (cmb-0)*prim+0
11364 { 0x0f390ef8, cmb(ac_t0_mul_prim_mul_shade) },
11365 // Characters, mace
11366 // (t0-0)*shade+0, (cmb-0)*shade+0
11367 { 0x0f390f38, cmb(ac_t0_mul_shade) },
11368 // Shadows, mario
11369 //z (t0-0)*shade+0
11370 { 0x0f390f39, cmb(ac_t0_mul_shade) },
11371 // Clear screen intro, banjo kazooie
11372 // (t0-0)*shade+0, (cmb-0)*env+0
11373 { 0x0f390f78, cmb(ac_t0_mul_env_mul_shade) },
11374 // ridge racer, unimp log. Added by Gonetz
11375 // (t0-0)*shade+0, (cmb-0)*primlod+0 **INC**?
11376 { 0x0f390fb8, cmb(ac_t0_mul_shade) },
11377 // Reflecting combined attack at kotake & koume's, zelda
11378 // (t1-0)*shade+0, (cmb-0)*prim+0
11379 { 0x0f3a0ef8, cmb(ac_t1_mul_prim_mul_shade) },
11380 // aerofighter's assault [Ogy]
11381 // (t1-0)*shade+0
11382 { 0x0f3a0f3a, cmb(ac_t1_mul_shade) },
11383 //beetle adventure racing. Added by Gonetz
11384 //(t1-0)*shade+0, (cmb-0)*env+0
11385 { 0x0f3a0f78, cmb(ac_t1_mul_env_mul_shade) },
11386 // building shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
11387 // (prim-0)*shade+0, (cmb-cmb)*lodf+cmb
11388 { 0x0f3b0000, cmb(ac_prim_mul_shade) },
11389 //chip in Spacestation Silicon Valley intro. Added by Gonetz
11390 // (prim-0)*shade+0, (env-cmb)*t1+cmb
11391 { 0x0f3b0085, cmb(ac_env_sub_primshade_mul_t1_add_primshade) },
11392 // N64 logo, tetrisphere. Added by Gonetz
11393 // (prim-0)*shade+0, (prim-0)*shade+0
11394 { 0x0f3b0f3b, cmb(ac_prim_mul_shade) },
11395 // rays, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
11396 // (shade-0)*shade+0, (cmb-0)*prim+0
11397 { 0x0f3c0ef8, cmb(ac_prim_mul_shade) },
11398 // light, dracula resurrection, castlevania 2. Added by Gonetz
11399 // (env-0)*shade+0
11400 { 0x0f3d0f3d, cmb(ac_env_mul_shade) },
11401 // zelda 2 [Ogy]. Added by Gonetz
11402 // (1-0)*shade+0
11403 { 0x0f3e0f3e, cmb(ac_shade) },
11404 // surf pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
11405 // (1-t0)*env+0, (1-cmb)*shade+0 ** INC **
11406 { 0x0f4e0f06, cmb(ac_t0_mul_shade) },
11407 //beetle adventure racing. Added by Gonetz
11408 //(t0-0)*env+0, (1-t0)*prim+cmb
11409 { 0x0f7900ce, cmb(ac_t0_mul_env) }, //this one looks better
11410 // { 0x0f7900ce, cmb(ac_env_sub_prim_mul_t0_add_prim) },
11411 //Zelda, logo ? Added by Gonetz
11412 //(t0-0)*env+0, (t1-0)*primlod+0 **INC** changed to mul_env for gannon's organ disappearing [Dave2001]
11413 { 0x0f7901ba, cmb(ac__t0_inter_t1_using_primlod__mul_env) },
11414 // Skeleton guy's eyes, zelda
11415 // (t0-0)*env+0, (cmb-0)*prim+0
11416 { 0x0f790ef8, cmb(ac_t0_mul_prim_mul_env) },
11417 // Dust from rock spell, quest64
11418 // (t0-0)*env+0, (cmb-0)*shade+0
11419 { 0x0f790f38, cmb(ac_t0_mul_env_mul_shade) },
11420 // eyes of poe, zelda
11421 // (t0-0)*env+0, (cmb-0)*env+0
11422 { 0x0f790f78, cmb(ac_t0_mul_env) },
11423 // Text, mario
11424 //z (t0-0)*env+0
11425 { 0x0f790f79, cmb(ac_t0_mul_env) },
11426 // Shadows, pokemon stadeom 2
11427 // (t0-0)*env+0, (cmb-0)*primlod+0
11428 { 0x0f790fb8, cmb(ac_t0_mul_env_mul_primlod) },
11429 //gauge, PGA
11430 // (t1-0)*env+0, (cmb-0)*t1+0 ** INC **
11431 { 0x0f7a0eb8, cmb(ac_t1_mul_env) },
11432 //text and shadows, Rayman2. Added by Gonetz
11433 // (t1-0)*env+0, (cmb-0)*shade+0
11434 { 0x0f7a0f38, cmb(ac_t1_mul_env_mul_shade) },
11435 // shadows, tom and jerry. Added by Gonetz
11436 // (t1-0)*env+0
11437 { 0x0f7a0f7a, cmb(ac_t1_mul_env) },
11438 // Bomberman64-2 intro. Added by Gonetz
11439 // (prim-0)*env+0
11440 { 0x0f7b0f7b, cmb(ac_prim_mul_env) },
11441 // Text box, mario
11442 //z (shade-0)*env+0
11443 { 0x0f7c0f7c, cmb(ac_env_mul_shade) },
11444 // Ogre battle 64
11445 // (env-0)*env+0
11446 { 0x0f7d0f7d, cmb(ac_env) },
11447 //Goldeneye, [Jeremy]. Added by Gonetz
11448 // (1-0)*env+0, (cmb-0)*shade+0
11449 { 0x0f7e0f38, cmb(ac_env_mul_shade) },
11450 // Status items, megaman
11451 // (1-0)*env+0
11452 { 0x0f7e0f7e, cmb(ac_env) },
11453 // gun fire, Beast_Wars_Transmetal [Raziel64]
11454 // (0-0)*env+0
11455 { 0x0f7f0f7f, cmb(ac_zero) },
11456 // Shadow Ball, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
11457 // (t1-t0)*primlod+0, (t1-cmb)*prim+0 ** INC **
11458 { 0x0f8a0ec2, cmb(ac_t0_mul_prim) },
11459 // Walls of well through lens of truth, zelda
11460 // (prim-t0)*primlod+0
11461 { 0x0f8b0f8b, cmb(ac_prim_sub_t0) },
11462 // N64 logo, ridge racer. Added by Gonetz
11463 // (1-prim)*primlod+0 **INC**
11464 { 0x0f9e0f9e, cmb(ac_zero) },
11465 // Vines that covers a door in the third room of woodfall temple, zelda 2 [Ogy]. Added by Gonetz
11466 // (t0-0)*primlod+0, (cmb-0)*prim+0
11467 { 0x0fb90ef8, cmb(ac_t0_mul_primlod_mul_prim) },
11468 // zelda 2. Added by Gonetz
11469 // (t0-0)*primlod+0
11470 { 0x0fb90fb9, cmb(ac_t0_mul_primlod) },
11471 // NFL Blitz logo. Added by Gonetz
11472 // (t1-0)*primlod+0
11473 { 0x0fba0fba, cmb(ac_t1_mul_primlod) }, //causes issues
11474 // fallen stars at star summit, Paper Mario. Added by Gonetz
11475 // (shade-0)*primlod+0
11476 { 0x0fbc0fbc, cmb(ac_primlod_mul_shade) },
11477 // expansion pack, Jeremy McGrath Supercross 2000. Added by Gonetz
11478 // (1-0)*primlod+0
11479 { 0x0fbe0fbe, cmb(ac_primlod) },
11480 // intro, Aidyn Chronicles. Added by Gonetz
11481 // (0-0)*primlod+0, (prim-env)*t0+prim **INC**
11482 { 0x0fbf066b, cmb(ac_t0_mul_prim) },
11483 // sky, Rayman2. Added by Gonetz
11484 // (0-shade)*0+0
11485 { 0x0fe70fe7, cmb(ac_zero) },
11486 // flame, PokemonStadium1 [Raziel64]
11487 // (t0-0)*0+0
11488 { 0x0ff90ff9, cmb(ac_zero) },
11489 // Screen clear, banjo kazooie
11490 // (0-0)*0+0
11491 { 0x0fff0fff, cmb(ac_zero) },
11492 // { #ACEND }
11495 // CountCombine - count the # of entries in the combine lists
11496 void CountCombine ()
11498 int size = sizeof(color_cmb_list) >> 3;
11499 int i=0, index=0, a, b;
11500 do {
11501 a = color_cmb_list[index].key >> 24;
11502 for (; i<=a; i++)
11503 cc_lookup[i] = index;
11505 while (index < size)
11507 b = color_cmb_list[index].key >> 24;
11508 if (b != a) break;
11509 index ++;
11511 } while (index < size);
11512 for (; i<257; i++) cc_lookup[i] = index;
11514 size = sizeof(alpha_cmb_list) >> 3;
11515 i=0, index=0;
11516 do {
11517 a = (alpha_cmb_list[index].key >> 20) & 0xFF;
11518 for (; i<=a; i++)
11519 ac_lookup[i] = index;
11521 while (index < size)
11523 b = (alpha_cmb_list[index].key >> 20) & 0xFF;
11524 if (b != a) break;
11525 index ++;
11527 } while (index < size);
11528 for (; i<257; i++) ac_lookup[i] = index;
11530 //color_cmb_list_count = sizeof(color_cmb_list) >> 3; // #bytes/4/2
11531 //alpha_cmb_list_count = sizeof(alpha_cmb_list) >> 3;
11534 //****************************************************************
11535 // Main Combine
11536 //****************************************************************
11538 void Combine ()
11540 FRDP (" | |- color combine: %08lx, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
11541 ((rdp.cycle1 & 0xFFFF) << 16) | (rdp.cycle2 & 0xFFFF),
11542 Mode0[rdp.cycle1&0xF], Mode1[(rdp.cycle1>>4)&0xF], Mode2[(rdp.cycle1>>8)&0x1F], Mode3[(rdp.cycle1>>13)&7],
11543 Mode0[rdp.cycle2&0xF], Mode1[(rdp.cycle2>>4)&0xF], Mode2[(rdp.cycle2>>8)&0x1F], Mode3[(rdp.cycle2>>13)&7]);
11544 FRDP (" | |- alpha combine: %08lx, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
11545 (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 & 0x0FFF0000) >> 16),
11546 Alpha0[(rdp.cycle1>>16)&7], Alpha1[(rdp.cycle1>>19)&7], Alpha2[(rdp.cycle1>>22)&7], Alpha3[(rdp.cycle1>>25)&7],
11547 Alpha0[(rdp.cycle2>>16)&7], Alpha1[(rdp.cycle2>>19)&7], Alpha2[(rdp.cycle2>>22)&7], Alpha3[(rdp.cycle2>>25)&7]);
11549 if (settings.lodmode == 0 || rdp.cur_tile == rdp.mipmap_level)
11550 lod_frac = rdp.prim_lodfrac;
11551 else
11552 lod_frac = 10;
11554 rdp.noise = noise_none;
11556 DWORD found = TRUE;
11558 rdp.col[0] = rdp.col[1] = rdp.col[2] = rdp.col[3] =
11559 rdp.coladd[0] = rdp.coladd[1] = rdp.coladd[2] = rdp.coladd[3] = 1.0f;
11560 rdp.cmb_flags = rdp.cmb_flags_2 = 0;
11562 rdp.uncombined = 0;
11564 cmb.tex = 0;
11565 cmb.tmu0_func = cmb.tmu1_func = cmb.tmu0_a_func = cmb.tmu1_a_func = GR_COMBINE_FUNCTION_ZERO;
11566 cmb.tmu0_fac = cmb.tmu1_fac = cmb.tmu0_a_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_NONE;
11567 cmb.tmu0_invert = cmb.tmu0_a_invert = cmb.tmu1_invert = cmb.tmu1_a_invert = FXFALSE;
11569 cmb.dc0_detailmax = cmb.dc1_detailmax = 0;
11571 cmb.mod_0 = cmb.mod_1 = 0; // remove all modifications
11572 cmb.modcolor_0 = cmb.modcolor1_0 = cmb.modcolor2_0 = cmb.modcolor_1 = cmb.modcolor1_1 = cmb.modcolor2_1
11573 = cmb.modfactor_0 = cmb.modfactor_1 = 0;
11575 cmb.ccolor = cmb.tex_ccolor = 0;
11576 if (cmb.cmb_ext_use || cmb.tex_cmb_ext_use)
11578 //have to draw something to allow use of standard combine functions
11579 if (fullscreen)
11581 VERTEX v;
11582 memset(&v,0,sizeof(v));
11583 grDrawPoint(&v);
11585 cmb.cmb_ext_use = 0;
11586 cmb.tex_cmb_ext_use = 0;
11589 DWORD cmb_mode_c = (rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF);
11590 DWORD cmb_mode_a = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
11592 cmb.abf1 = GR_BLEND_SRC_ALPHA;
11593 cmb.abf2 = GR_BLEND_ONE_MINUS_SRC_ALPHA;
11595 #ifdef FASTSEARCH
11596 // Fast, ordered search
11597 int current=0x7FFFFFFF, last;
11598 DWORD actual_combine, current_combine = 0x7fffffff, color_combine, alpha_combine;
11599 int left, right;
11601 actual_combine = cmb_mode_c;
11602 color_combine = actual_combine;
11603 if ((rdp.cycle2 & 0xFFFF) == 0x1FFF)
11604 actual_combine = (rdp.cycle1 << 16) | (rdp.cycle1 & 0xFFFF);
11606 left = cc_lookup[actual_combine>>24];
11607 right = cc_lookup[(actual_combine>>24)+1];
11609 while (1)
11611 last = current;
11612 current = left + ((right-left) >> 1);
11613 if (current == last)
11614 break; // can't be found!
11616 current_combine = color_cmb_list[current].key;
11617 if (current_combine < actual_combine)
11618 left = current;
11619 else if (current_combine > actual_combine)
11620 right = current;
11621 else
11622 break; // found it!
11625 // Check if we didn't find it
11626 if (actual_combine != current_combine)
11628 rdp.uncombined |= 1;
11629 #ifdef UNIMP_LOG
11630 if (settings.log_unk)
11632 sprintf (out_buf, "COLOR combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
11633 actual_combine,
11634 Mode0[rdp.cycle1&0xF], Mode1[(rdp.cycle1>>4)&0xF], Mode2[(rdp.cycle1>>8)&0x1F], Mode3[(rdp.cycle1>>13)&7],
11635 Mode0[rdp.cycle2&0xF], Mode1[(rdp.cycle2>>4)&0xF], Mode2[(rdp.cycle2>>8)&0x1F], Mode3[(rdp.cycle2>>13)&7]);
11636 UNIMPMODE();
11638 #endif
11639 found = FALSE;
11640 //tex |= 3;
11642 // use t0 as default
11643 cc_t0 ();
11645 else
11646 (color_cmb_list[current].func)();
11648 RDP (" | |- Color done\n");
11650 // Now again for alpha
11651 current = 0x7FFFFFFF;
11652 actual_combine = cmb_mode_a;
11653 alpha_combine = actual_combine;
11654 if ((rdp.cycle2 & 0x0FFF0000) == 0x01FF0000)
11655 actual_combine = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle1 >> 16) & 0x00000FFF);
11656 if ((rdp.cycle1 & 0x0FFF0000) == 0x0FFF0000)
11657 actual_combine = (rdp.cycle2 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
11659 left = ac_lookup[(actual_combine>>20)&0xFF];
11660 right = ac_lookup[((actual_combine>>20)&0xFF)+1];
11662 while (1)
11664 last = current;
11665 current = left + ((right-left) >> 1);
11666 if (current == last)
11667 break; // can't be found!
11669 current_combine = alpha_cmb_list[current].key;
11670 if (current_combine < actual_combine)
11671 left = current;
11672 else if (current_combine > actual_combine)
11673 right = current;
11674 else
11675 break; // found it!
11678 // Check if we didn't find it
11679 if (actual_combine != current_combine || !found)
11681 if (actual_combine != current_combine)
11683 rdp.uncombined |= 2;
11684 #ifdef UNIMP_LOG
11685 if (settings.log_unk)
11687 sprintf (out_buf, "ALPHA combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
11688 actual_combine,
11689 Alpha0[(rdp.cycle1>>16)&7], Alpha1[(rdp.cycle1>>19)&7], Alpha2[(rdp.cycle1>>22)&7], Alpha3[(rdp.cycle1>>25)&7],
11690 Alpha0[(rdp.cycle2>>16)&7], Alpha1[(rdp.cycle2>>19)&7], Alpha2[(rdp.cycle2>>22)&7], Alpha3[(rdp.cycle2>>25)&7]);
11691 UNIMPMODE();
11693 #endif
11695 if (settings.unk_as_red)
11697 BrightRed ();
11699 else
11701 // use full alpha as default
11702 ac_t0 ();
11704 //tex |= 3;
11706 else
11707 (alpha_cmb_list[current].func)();
11710 if (color_combine == 0x69351fff) //text, PD, need to change texture alpha
11712 A_USE_T1();
11714 else if ((color_combine == 0x3fff1fff) && (alpha_combine == 0x03ff03ff) && (rdp.last_tile > rdp.cur_tile))//Dr. Mario
11716 cc_t0();
11717 ac_t1();
11719 else if (color_combine == 0x613522f0 && settings.PM) //Paper Mario fortune teller spheres
11721 ac_t0();
11724 RDP (" | |- Alpha done\n");
11725 #endif // FASTSEARCH
11727 CombineBlender ();
11728 //*
11729 // Update textures?
11730 // if (tex == 2 && rdp.texrecting && (cmb.tmu1_func != GR_COMBINE_FUNCTION_ZERO) && (rdp.last_tile_size == 0))
11731 if (cmb.tex == 2 && rdp.texrecting && (rdp.cur_tile == rdp.last_tile_size))
11733 cmb.tex = 0;
11734 USE_T0();
11735 A_USE_T0();
11737 //*/
11738 rdp.tex = cmb.tex;
11740 if (cmb.tex && rdp.hires_tex && settings.fb_read_alpha)
11742 if (settings.PM && rdp.hires_tex->width == rdp.ci_width)
11744 else
11746 grChromakeyValue(0);
11747 grChromakeyMode(GR_CHROMAKEY_ENABLE);
11750 else if (settings.invaders && (rdp.geom_mode == 0x0205))
11752 grChromakeyValue(0);
11753 grChromakeyMode(GR_CHROMAKEY_ENABLE);
11755 else
11756 grChromakeyMode(GR_CHROMAKEY_DISABLE);
11758 RDP (" | + Combine end\n");
11761 void CombineBlender ()
11763 // Check force-blending
11764 if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
11766 switch (rdp.othermode_l >> 16)
11768 // Mace objects
11769 case 0x0382:
11770 case 0x0091:
11771 // 1080 sky
11772 case 0x0c08:
11773 // Mario kart player select
11774 // clr_in * 0 + clr_in * 1
11775 // - or just clr_in, no matter what alpha
11776 case 0x0f0a:
11777 //DK64 blue prints
11778 case 0x0302:
11779 A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
11780 break;
11782 // LOT in Zelda: MM
11783 case 0xaf50:
11784 case 0x0f5a: //clr_in * 0 + clr_mem * 1
11785 A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
11786 break;
11788 case 0x5f50: //clr_mem * 0 + clr_mem * (1-a)
11789 A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE_MINUS_SRC_ALPHA);
11790 break;
11792 case 0xf550: //clr_fog * a_fog + clr_mem * (1-a)
11793 A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
11794 rdp.col[0] *= (float)((rdp.fog_color & 0xFF000000) >> 24) / 255.0f;
11795 rdp.col[1] *= (float)((rdp.fog_color & 0x00FF0000) >> 16) / 255.0f;
11796 rdp.col[2] *= (float)((rdp.fog_color & 0x0000FF00) >> 8) / 255.0f;
11797 rdp.col[3] *= (float)(rdp.fog_color & 0xFF) / 255.0f;
11798 rdp.cmb_flags = CMB_SET | CMB_A_SET;
11799 break;
11801 // Super Smash Bros, faked fog for flashing characters
11802 case 0xc411:
11804 MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
11805 MOD_0_COL (rdp.fog_color & 0x00FFFFFF);
11806 MOD_0_FAC (rdp.fog_color >> 24);
11807 INTERSHADE_2 (rdp.fog_color & 0x00FFFFFF, rdp.fog_color >> 24);
11809 float percent = (rdp.fog_color >> 24) / 255.0f;
11810 cmb.ccolor = (cmb.ccolor & 0xFF000000) |
11811 ((DWORD)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
11812 ((DWORD)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
11813 (DWORD)((cmb.ccolor & 0xFF) * (1.0f-percent) + (rdp.fog_color & 0xFF) * percent);
11815 rdp.col[0] = rdp.col[0] * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) / 255.0f * percent;
11816 rdp.col[1] = rdp.col[1] * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) / 255.0f * percent;
11817 rdp.col[2] = rdp.col[2] * (1.0f-percent) + (rdp.fog_color & 0xFF) / 255.0f * percent;
11819 break;
11821 default:
11822 A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
11825 else
11826 A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
11828 // ALPHA_CVG_SEL means full alpha
11829 // The reason it wasn't working before was because I wasn't handling rdp:setothermode
11830 // if (rdp.othermode_l & 0x2000)
11831 if ((rdp.othermode_l & 0x2000) && ((rdp.othermode_l & 0x7000) != 0x7000))
11833 if (settings.PM && ((rdp.othermode_l >> 16) == 0x5055))
11835 A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
11837 else
11839 A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
11843 //hack
11845 if (settings.ISS64)
11847 if ((rdp.othermode_l >> 16) == 0xc302)
11849 A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
11851 else if (rdp.othermode_l == 0xff5a6379)
11853 A_BLEND (GR_BLEND_ZERO, GR_BLEND_SRC_ALPHA);
11855 else if (rdp.othermode_l == 0x00504dd9)
11857 A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
11860 else if (settings.TGR)
11862 if (rdp.othermode_l == 0x0f0a0235)
11864 A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
11867 //*/
11870 void InitCombine ()
11872 LOG ("InitCombine() ");
11873 memset(&cmb, 0, sizeof(cmb));
11874 const char *extensions = grGetString (GR_EXTENSION);
11875 if (char * extstr = strstr(extensions, "COMBINE")) {
11876 if (!strncmp(extstr, "COMBINE", 7)) {
11877 LOG ("extensions ");
11878 cmb.grColorCombineExt = (GRCOLORCOMBINEEXT) grGetProcAddress("grColorCombineExt");
11879 cmb.grAlphaCombineExt = (GRCOLORCOMBINEEXT) grGetProcAddress("grAlphaCombineExt");
11880 cmb.grTexColorCombineExt = (GRTEXCOLORCOMBINEEXT) grGetProcAddress("grTexColorCombineExt");
11881 cmb.grTexAlphaCombineExt = (GRTEXCOLORCOMBINEEXT) grGetProcAddress("grTexAlphaCombineExt");
11882 cmb.grConstantColorValueExt = (GRCONSTANTCOLORVALUEEXT) grGetProcAddress("grConstantColorValueExt");
11883 if (cmb.grColorCombineExt && cmb.grAlphaCombineExt &&
11884 cmb.grTexColorCombineExt && cmb.grTexAlphaCombineExt)
11886 cmb.combine_ext = TRUE;
11887 LOG ("initialized.");
11889 else
11891 cmb.combine_ext = FALSE;
11895 cmb.dc0_lodbias = cmb.dc1_lodbias = 31;
11896 cmb.dc0_detailscale = cmb.dc1_detailscale = 7;
11897 cmb.lodbias0 = cmb.lodbias1 = 1.0f;
11898 LOG ("\n");
11901 void ColorCombinerToExtension ()
11903 DWORD ext_local, ext_local_a, ext_other, ext_other_a;
11904 switch (cmb.c_loc)
11906 case GR_COMBINE_LOCAL_ITERATED:
11907 ext_local = GR_CMBX_ITRGB;
11908 ext_local_a = GR_CMBX_ITALPHA;
11909 break;
11910 case GR_COMBINE_LOCAL_CONSTANT:
11911 ext_local = GR_CMBX_CONSTANT_COLOR;
11912 ext_local_a = GR_CMBX_CONSTANT_ALPHA;
11913 break;
11914 default:
11915 ext_local = 0;
11916 ext_local_a = 0;
11917 break;
11919 switch (cmb.c_oth)
11921 case GR_COMBINE_OTHER_ITERATED:
11922 ext_other = GR_CMBX_ITRGB;
11923 ext_other_a = GR_CMBX_ITALPHA;
11924 break;
11925 case GR_COMBINE_OTHER_TEXTURE:
11926 ext_other = GR_CMBX_TEXTURE_RGB;
11927 ext_other_a = GR_CMBX_TEXTURE_ALPHA;
11928 break;
11929 case GR_COMBINE_OTHER_CONSTANT:
11930 ext_other = GR_CMBX_CONSTANT_COLOR;
11931 ext_other_a = GR_CMBX_CONSTANT_ALPHA;
11932 break;
11933 default:
11934 ext_other = 0;
11935 ext_other_a = 0;
11936 break;
11938 switch (cmb.c_fac)
11940 case GR_COMBINE_FACTOR_ZERO:
11941 cmb.c_ext_c = GR_CMBX_ZERO;
11942 cmb.c_ext_c_invert = 0;
11943 break;
11944 case GR_COMBINE_FACTOR_ONE:
11945 cmb.c_ext_c = GR_CMBX_ZERO;
11946 cmb.c_ext_c_invert = 1;
11947 break;
11948 case GR_COMBINE_FACTOR_LOCAL:
11949 cmb.c_ext_c = ext_local;
11950 cmb.c_ext_c_invert = 0;
11951 break;
11952 case GR_COMBINE_FACTOR_LOCAL_ALPHA:
11953 cmb.c_ext_c = ext_local_a;
11954 cmb.c_ext_c_invert = 0;
11955 break;
11956 case GR_COMBINE_FACTOR_OTHER_ALPHA:
11957 cmb.c_ext_c = ext_other_a;
11958 cmb.c_ext_c_invert = 0;
11959 break;
11960 case GR_COMBINE_FACTOR_TEXTURE_RGB:
11961 cmb.c_ext_c = GR_CMBX_TEXTURE_RGB;
11962 cmb.c_ext_c_invert = 0;
11963 break;
11964 case GR_COMBINE_FACTOR_TEXTURE_ALPHA:
11965 cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
11966 cmb.c_ext_c_invert = 0;
11967 break;
11968 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
11969 cmb.c_ext_c = ext_local;
11970 cmb.c_ext_c_invert = 1;
11971 break;
11972 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
11973 cmb.c_ext_c = ext_local_a;
11974 cmb.c_ext_c_invert = 1;
11975 break;
11976 case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
11977 cmb.c_ext_c = ext_other_a;
11978 cmb.c_ext_c_invert = 1;
11979 break;
11980 case GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA:
11981 cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
11982 cmb.c_ext_c_invert = 1;
11983 break;
11986 switch (cmb.c_fnc)
11988 case GR_COMBINE_FUNCTION_ZERO:
11989 cmb.c_ext_a = GR_CMBX_ZERO;
11990 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
11991 cmb.c_ext_b = GR_CMBX_ZERO;
11992 cmb.c_ext_b_mode = GR_FUNC_MODE_X;
11993 cmb.c_ext_c = GR_CMBX_ZERO;
11994 cmb.c_ext_c_invert = 0;
11995 cmb.c_ext_d = GR_CMBX_ZERO;
11996 cmb.c_ext_d_invert = 0;
11997 break;
11998 case GR_COMBINE_FUNCTION_LOCAL:
11999 cmb.c_ext_a = ext_local;
12000 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12001 cmb.c_ext_b = GR_CMBX_ZERO;
12002 cmb.c_ext_b_mode = GR_FUNC_MODE_X;
12003 cmb.c_ext_c = GR_CMBX_ZERO;
12004 cmb.c_ext_c_invert = 1;
12005 cmb.c_ext_d = GR_CMBX_ZERO;
12006 cmb.c_ext_d_invert = 0;
12007 break;
12008 case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
12009 cmb.c_ext_a = ext_local_a;
12010 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12011 cmb.c_ext_b = GR_CMBX_ZERO;
12012 cmb.c_ext_b_mode = GR_FUNC_MODE_X;
12013 cmb.c_ext_c = GR_CMBX_ZERO;
12014 cmb.c_ext_c_invert = 1;
12015 cmb.c_ext_d = GR_CMBX_ZERO;
12016 cmb.c_ext_d_invert = 0;
12017 break;
12018 case GR_COMBINE_FUNCTION_SCALE_OTHER:
12019 cmb.c_ext_a = ext_other;
12020 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12021 cmb.c_ext_b = GR_CMBX_ZERO;
12022 cmb.c_ext_b_mode = GR_FUNC_MODE_ZERO;
12023 cmb.c_ext_d = GR_CMBX_ZERO;
12024 cmb.c_ext_d_invert = 0;
12025 break;
12026 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
12027 cmb.c_ext_a = ext_other;
12028 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12029 cmb.c_ext_b = ext_local;
12030 cmb.c_ext_b_mode = GR_FUNC_MODE_ZERO;
12031 cmb.c_ext_d = GR_CMBX_B;
12032 cmb.c_ext_d_invert = 0;
12033 break;
12034 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
12035 cmb.c_ext_a = ext_other;
12036 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12037 cmb.c_ext_b = ext_local_a;
12038 cmb.c_ext_b_mode = GR_FUNC_MODE_ZERO;
12039 cmb.c_ext_d = GR_CMBX_B;
12040 cmb.c_ext_d_invert = 0;
12041 break;
12042 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
12043 cmb.c_ext_a = ext_other;
12044 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12045 cmb.c_ext_b = ext_local;
12046 cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12047 cmb.c_ext_d = GR_CMBX_ZERO;
12048 cmb.c_ext_d_invert = 0;
12049 break;
12050 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
12051 cmb.c_ext_a = ext_other;
12052 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12053 cmb.c_ext_b = ext_local;
12054 cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12055 cmb.c_ext_d = GR_CMBX_B;
12056 cmb.c_ext_d_invert = 0;
12057 break;
12058 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12059 cmb.c_ext_a = ext_other;
12060 cmb.c_ext_a_mode = GR_FUNC_MODE_X;
12061 cmb.c_ext_b = ext_local;
12062 cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12063 cmb.c_ext_d = GR_CMBX_ALOCAL;
12064 cmb.c_ext_d_invert = 0;
12065 break;
12066 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
12067 cmb.c_ext_a = GR_CMBX_ZERO;
12068 cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
12069 cmb.c_ext_b = ext_local;
12070 cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12071 cmb.c_ext_d = GR_CMBX_B;
12072 cmb.c_ext_d_invert = 0;
12073 break;
12074 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12075 cmb.c_ext_a = GR_CMBX_ZERO;
12076 cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
12077 cmb.c_ext_b = ext_local;
12078 cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12079 cmb.c_ext_d = GR_CMBX_ALOCAL;
12080 cmb.c_ext_d_invert = 0;
12081 break;
12085 void AlphaCombinerToExtension ()
12087 DWORD ext_local, ext_other;
12088 switch (cmb.a_loc)
12090 case GR_COMBINE_LOCAL_ITERATED:
12091 ext_local = GR_CMBX_ITALPHA;
12092 break;
12093 case GR_COMBINE_LOCAL_CONSTANT:
12094 ext_local = GR_CMBX_CONSTANT_ALPHA;
12095 break;
12096 default:
12097 ext_local = GR_CMBX_ZERO;
12099 switch (cmb.a_oth)
12101 case GR_COMBINE_OTHER_ITERATED:
12102 ext_other = GR_CMBX_ITALPHA;
12103 break;
12104 case GR_COMBINE_OTHER_TEXTURE:
12105 ext_other = GR_CMBX_TEXTURE_ALPHA;
12106 break;
12107 case GR_COMBINE_OTHER_CONSTANT:
12108 ext_other = GR_CMBX_CONSTANT_ALPHA;
12109 break;
12110 default:
12111 ext_other = GR_CMBX_ZERO;
12113 switch (cmb.a_fac)
12115 case GR_COMBINE_FACTOR_ZERO:
12116 cmb.a_ext_c = GR_CMBX_ZERO;
12117 cmb.a_ext_c_invert = 0;
12118 break;
12119 case GR_COMBINE_FACTOR_ONE:
12120 cmb.a_ext_c = GR_CMBX_ZERO;
12121 cmb.a_ext_c_invert = 1;
12122 break;
12123 case GR_COMBINE_FACTOR_LOCAL:
12124 case GR_COMBINE_FACTOR_LOCAL_ALPHA:
12125 cmb.a_ext_c = ext_local;
12126 cmb.a_ext_c_invert = 0;
12127 break;
12128 case GR_COMBINE_FACTOR_OTHER_ALPHA:
12129 cmb.a_ext_c = ext_other;
12130 cmb.a_ext_c_invert = 0;
12131 break;
12132 case GR_COMBINE_FACTOR_TEXTURE_ALPHA:
12133 cmb.a_ext_c = GR_CMBX_TEXTURE_ALPHA;
12134 cmb.a_ext_c_invert = 0;
12135 break;
12136 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
12137 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
12138 cmb.a_ext_c = ext_local;
12139 cmb.a_ext_c_invert = 1;
12140 break;
12141 case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
12142 cmb.a_ext_c = ext_other;
12143 cmb.a_ext_c_invert = 1;
12144 break;
12145 case GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA:
12146 cmb.a_ext_c = GR_CMBX_TEXTURE_ALPHA;
12147 cmb.a_ext_c_invert = 1;
12148 break;
12149 default:
12150 cmb.a_ext_c = GR_CMBX_ZERO;
12151 cmb.a_ext_c_invert = 0;
12154 switch (cmb.a_fnc)
12156 case GR_COMBINE_FUNCTION_ZERO:
12157 cmb.a_ext_a = GR_CMBX_ZERO;
12158 cmb.a_ext_a_mode = GR_FUNC_MODE_X;
12159 cmb.a_ext_b = GR_CMBX_ZERO;
12160 cmb.a_ext_b_mode = GR_FUNC_MODE_X;
12161 cmb.a_ext_c = GR_CMBX_ZERO;
12162 cmb.a_ext_c_invert = 0;
12163 cmb.a_ext_d = GR_CMBX_ZERO;
12164 cmb.a_ext_d_invert = 0;
12165 break;
12166 case GR_COMBINE_FUNCTION_LOCAL:
12167 case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
12168 cmb.a_ext_a = GR_CMBX_ZERO;
12169 cmb.a_ext_a_mode = GR_FUNC_MODE_ZERO;
12170 cmb.a_ext_b = ext_local;
12171 cmb.a_ext_b_mode = GR_FUNC_MODE_X;
12172 cmb.a_ext_c = GR_CMBX_ZERO;
12173 cmb.a_ext_c_invert = 1;
12174 cmb.a_ext_d = GR_CMBX_ZERO;
12175 cmb.a_ext_d_invert = 0;
12176 break;
12177 case GR_COMBINE_FUNCTION_SCALE_OTHER:
12178 cmb.a_ext_a = ext_other;
12179 cmb.a_ext_a_mode = GR_FUNC_MODE_X;
12180 cmb.a_ext_b = GR_CMBX_ZERO;
12181 cmb.a_ext_b_mode = GR_FUNC_MODE_ZERO;
12182 cmb.a_ext_d = GR_CMBX_ZERO;
12183 cmb.a_ext_d_invert = 0;
12184 break;
12185 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
12186 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
12187 cmb.a_ext_a = ext_other;
12188 cmb.a_ext_a_mode = GR_FUNC_MODE_X;
12189 cmb.a_ext_b = ext_local;
12190 cmb.a_ext_b_mode = GR_FUNC_MODE_ZERO;
12191 cmb.a_ext_d = GR_CMBX_B;
12192 cmb.a_ext_d_invert = 0;
12193 break;
12194 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
12195 cmb.a_ext_a = ext_other;
12196 cmb.a_ext_a_mode = GR_FUNC_MODE_X;
12197 cmb.a_ext_b = ext_local;
12198 cmb.a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12199 cmb.a_ext_d = GR_CMBX_ZERO;
12200 cmb.a_ext_d_invert = 0;
12201 break;
12202 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
12203 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12204 cmb.a_ext_a = ext_other;
12205 cmb.a_ext_a_mode = GR_FUNC_MODE_X;
12206 cmb.a_ext_b = ext_local;
12207 cmb.a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12208 cmb.a_ext_d = GR_CMBX_B;
12209 cmb.a_ext_d_invert = 0;
12210 break;
12211 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
12212 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12213 cmb.a_ext_a = GR_CMBX_ZERO;
12214 cmb.a_ext_a_mode = GR_FUNC_MODE_ZERO;
12215 cmb.a_ext_b = ext_local;
12216 cmb.a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12217 cmb.a_ext_d = GR_CMBX_B;
12218 cmb.a_ext_d_invert = 0;
12219 break;
12223 void TexColorCombinerToExtension (GrChipID_t tmu)
12225 DWORD tc_ext_a, tc_ext_a_mode, tc_ext_b, tc_ext_b_mode, tc_ext_c, tc_ext_d;
12226 BOOL tc_ext_c_invert, tc_ext_d_invert;
12227 DWORD tmu_func, tmu_fac;
12229 if (tmu == GR_TMU0)
12231 tmu_func = cmb.tmu0_func;
12232 tmu_fac = cmb.tmu0_fac;
12234 else
12236 tmu_func = cmb.tmu1_func;
12237 tmu_fac = cmb.tmu1_fac;
12240 switch (tmu_fac)
12242 case GR_COMBINE_FACTOR_ZERO:
12243 tc_ext_c = GR_CMBX_ZERO;
12244 tc_ext_c_invert = 0;
12245 break;
12246 case GR_COMBINE_FACTOR_LOCAL:
12247 tc_ext_c = GR_CMBX_LOCAL_TEXTURE_RGB;
12248 tc_ext_c_invert = 0;
12249 break;
12250 case GR_COMBINE_FACTOR_LOCAL_ALPHA:
12251 tc_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12252 tc_ext_c_invert = 0;
12253 break;
12254 case GR_COMBINE_FACTOR_OTHER_ALPHA:
12255 tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
12256 tc_ext_c_invert = 0;
12257 break;
12258 case GR_COMBINE_FACTOR_DETAIL_FACTOR:
12259 tc_ext_c = GR_CMBX_DETAIL_FACTOR;
12260 tc_ext_c_invert = 0;
12261 break;
12262 case GR_COMBINE_FACTOR_ONE:
12263 tc_ext_c = GR_CMBX_ZERO;
12264 tc_ext_c_invert = 1;
12265 break;
12266 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
12267 tc_ext_c = GR_CMBX_LOCAL_TEXTURE_RGB;
12268 tc_ext_c_invert = 1;
12269 break;
12270 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
12271 tc_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12272 tc_ext_c_invert = 1;
12273 break;
12274 case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
12275 tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
12276 tc_ext_c_invert = 1;
12277 break;
12278 case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
12279 tc_ext_c = GR_CMBX_DETAIL_FACTOR;
12280 tc_ext_c_invert = 1;
12281 break;
12282 default:
12283 tc_ext_c = 0;
12284 tc_ext_c_invert = 0;
12285 break;
12288 switch (tmu_func)
12290 case GR_COMBINE_FUNCTION_ZERO:
12291 tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
12292 tc_ext_a_mode = GR_FUNC_MODE_ZERO;
12293 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12294 tc_ext_b_mode = GR_FUNC_MODE_ZERO;
12295 tc_ext_c = GR_CMBX_ZERO;
12296 tc_ext_c_invert = 0;
12297 tc_ext_d = GR_CMBX_ZERO;
12298 tc_ext_d_invert = 0;
12299 break;
12300 case GR_COMBINE_FUNCTION_LOCAL:
12301 tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
12302 tc_ext_a_mode = GR_FUNC_MODE_X;
12303 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12304 tc_ext_b_mode = GR_FUNC_MODE_ZERO;
12305 tc_ext_c = GR_CMBX_ZERO;
12306 tc_ext_c_invert = 1;
12307 tc_ext_d = GR_CMBX_ZERO;
12308 tc_ext_d_invert = 0;
12309 break;
12310 case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
12311 tc_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12312 tc_ext_a_mode = GR_FUNC_MODE_X;
12313 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12314 tc_ext_b_mode = GR_FUNC_MODE_ZERO;
12315 tc_ext_c = GR_CMBX_ZERO;
12316 tc_ext_c_invert = 1;
12317 tc_ext_d = GR_CMBX_ZERO;
12318 tc_ext_d_invert = 0;
12319 break;
12320 case GR_COMBINE_FUNCTION_SCALE_OTHER:
12321 tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
12322 tc_ext_a_mode = GR_FUNC_MODE_X;
12323 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12324 tc_ext_b_mode = GR_FUNC_MODE_ZERO;
12325 tc_ext_d = GR_CMBX_ZERO;
12326 tc_ext_d_invert = 0;
12327 break;
12328 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
12329 tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
12330 tc_ext_a_mode = GR_FUNC_MODE_X;
12331 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12332 tc_ext_b_mode = GR_FUNC_MODE_ZERO;
12333 tc_ext_d = GR_CMBX_B;
12334 tc_ext_d_invert = 0;
12335 break;
12336 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
12337 tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
12338 tc_ext_a_mode = GR_FUNC_MODE_X;
12339 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12340 tc_ext_b_mode = GR_FUNC_MODE_ZERO;
12341 tc_ext_d = GR_CMBX_B;
12342 tc_ext_d_invert = 0;
12343 break;
12344 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
12345 tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
12346 tc_ext_a_mode = GR_FUNC_MODE_X;
12347 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12348 tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12349 tc_ext_d = GR_CMBX_ZERO;
12350 tc_ext_d_invert = 0;
12351 break;
12352 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
12353 tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
12354 tc_ext_a_mode = GR_FUNC_MODE_X;
12355 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12356 tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12357 tc_ext_d = GR_CMBX_B;
12358 tc_ext_d_invert = 0;
12359 break;
12360 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12361 tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
12362 tc_ext_a_mode = GR_FUNC_MODE_X;
12363 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12364 tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12365 tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12366 tc_ext_d_invert = 0;
12367 break;
12368 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
12369 tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
12370 tc_ext_a_mode = GR_FUNC_MODE_ZERO;
12371 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12372 tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12373 tc_ext_d = GR_CMBX_B;
12374 tc_ext_d_invert = 0;
12375 break;
12376 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12377 tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
12378 tc_ext_a_mode = GR_FUNC_MODE_ZERO;
12379 tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
12380 tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12381 tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12382 tc_ext_d_invert = 0;
12383 break;
12384 default:
12385 tc_ext_a = 0;
12386 tc_ext_a_mode = 0;
12387 tc_ext_b = 0;
12388 tc_ext_b_mode = 0;
12389 tc_ext_d = 0;
12390 tc_ext_d_invert = 0;
12391 break;
12394 if (tmu == GR_TMU0)
12396 cmb.t0c_ext_a = tc_ext_a;
12397 cmb.t0c_ext_a_mode = tc_ext_a_mode;
12398 cmb.t0c_ext_b = tc_ext_b;
12399 cmb.t0c_ext_b_mode = tc_ext_b_mode;
12400 cmb.t0c_ext_c = tc_ext_c;
12401 cmb.t0c_ext_c_invert = tc_ext_c_invert;
12402 cmb.t0c_ext_d = tc_ext_d;
12403 cmb.t0c_ext_d_invert = tc_ext_d_invert;
12405 else
12407 cmb.t1c_ext_a = tc_ext_a;
12408 cmb.t1c_ext_a_mode = tc_ext_a_mode;
12409 cmb.t1c_ext_b = tc_ext_b;
12410 cmb.t1c_ext_b_mode = tc_ext_b_mode;
12411 cmb.t1c_ext_c = tc_ext_c;
12412 cmb.t1c_ext_c_invert = tc_ext_c_invert;
12413 cmb.t1c_ext_d = tc_ext_d;
12414 cmb.t1c_ext_d_invert = tc_ext_d_invert;
12418 void TexAlphaCombinerToExtension (GrChipID_t tmu)
12420 DWORD ta_ext_a, ta_ext_a_mode, ta_ext_b, ta_ext_b_mode, ta_ext_c, ta_ext_d;
12421 BOOL ta_ext_c_invert, ta_ext_d_invert;
12422 DWORD tmu_a_func, tmu_a_fac;
12424 if (tmu == GR_TMU0)
12426 tmu_a_func = cmb.tmu0_a_func;
12427 tmu_a_fac = cmb.tmu0_a_fac;
12429 else
12431 tmu_a_func = cmb.tmu1_a_func;
12432 tmu_a_fac = cmb.tmu1_a_fac;
12435 switch (tmu_a_fac)
12437 case GR_COMBINE_FACTOR_ZERO:
12438 ta_ext_c = GR_CMBX_ZERO;
12439 ta_ext_c_invert = 0;
12440 break;
12441 case GR_COMBINE_FACTOR_LOCAL:
12442 case GR_COMBINE_FACTOR_LOCAL_ALPHA:
12443 ta_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12444 ta_ext_c_invert = 0;
12445 break;
12446 case GR_COMBINE_FACTOR_OTHER_ALPHA:
12447 ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
12448 ta_ext_c_invert = 0;
12449 break;
12450 case GR_COMBINE_FACTOR_DETAIL_FACTOR:
12451 ta_ext_c = GR_CMBX_DETAIL_FACTOR;
12452 ta_ext_c_invert = 0;
12453 break;
12454 case GR_COMBINE_FACTOR_ONE:
12455 ta_ext_c = GR_CMBX_ZERO;
12456 ta_ext_c_invert = 1;
12457 break;
12458 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
12459 case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
12460 ta_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12461 ta_ext_c_invert = 1;
12462 break;
12463 case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
12464 ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
12465 ta_ext_c_invert = 1;
12466 break;
12467 case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
12468 ta_ext_c = GR_CMBX_DETAIL_FACTOR;
12469 ta_ext_c_invert = 1;
12470 break;
12471 default:
12472 ta_ext_c = 0;
12473 ta_ext_c_invert = 0;
12474 break;
12477 switch (tmu_a_func)
12479 case GR_COMBINE_FUNCTION_ZERO:
12480 ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12481 ta_ext_a_mode = GR_FUNC_MODE_ZERO;
12482 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12483 ta_ext_b_mode = GR_FUNC_MODE_ZERO;
12484 ta_ext_c = GR_CMBX_ZERO;
12485 ta_ext_c_invert = 0;
12486 ta_ext_d = GR_CMBX_ZERO;
12487 ta_ext_d_invert = 0;
12488 break;
12489 case GR_COMBINE_FUNCTION_LOCAL:
12490 case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
12491 ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12492 ta_ext_a_mode = GR_FUNC_MODE_X;
12493 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12494 ta_ext_b_mode = GR_FUNC_MODE_ZERO;
12495 ta_ext_c = GR_CMBX_ZERO;
12496 ta_ext_c_invert = 1;
12497 ta_ext_d = GR_CMBX_ZERO;
12498 ta_ext_d_invert = 0;
12499 break;
12500 case GR_COMBINE_FUNCTION_SCALE_OTHER:
12501 ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
12502 ta_ext_a_mode = GR_FUNC_MODE_X;
12503 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12504 ta_ext_b_mode = GR_FUNC_MODE_ZERO;
12505 ta_ext_d = GR_CMBX_ZERO;
12506 ta_ext_d_invert = 0;
12507 break;
12508 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
12509 case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
12510 ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
12511 ta_ext_a_mode = GR_FUNC_MODE_X;
12512 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12513 ta_ext_b_mode = GR_FUNC_MODE_ZERO;
12514 ta_ext_d = GR_CMBX_B;
12515 ta_ext_d_invert = 0;
12516 break;
12517 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
12518 ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
12519 ta_ext_a_mode = GR_FUNC_MODE_X;
12520 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12521 ta_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12522 ta_ext_d = GR_CMBX_ZERO;
12523 ta_ext_d_invert = 0;
12524 break;
12525 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
12526 case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12527 ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
12528 ta_ext_a_mode = GR_FUNC_MODE_X;
12529 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12530 ta_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12531 ta_ext_d = GR_CMBX_B;
12532 ta_ext_d_invert = 0;
12533 break;
12534 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
12535 case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
12536 ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12537 ta_ext_a_mode = GR_FUNC_MODE_ZERO;
12538 ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
12539 ta_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
12540 ta_ext_d = GR_CMBX_B;
12541 ta_ext_d_invert = 0;
12542 break;
12543 default:
12544 ta_ext_a = 0;
12545 ta_ext_a_mode = 0;
12546 ta_ext_b = 0;
12547 ta_ext_b_mode = 0;
12548 ta_ext_d = 0;
12549 ta_ext_d_invert = 0;
12550 break;
12553 if (tmu == GR_TMU0)
12555 cmb.t0a_ext_a = ta_ext_a;
12556 cmb.t0a_ext_a_mode = ta_ext_a_mode;
12557 cmb.t0a_ext_b = ta_ext_b;
12558 cmb.t0a_ext_b_mode = ta_ext_b_mode;
12559 cmb.t0a_ext_c = ta_ext_c;
12560 cmb.t0a_ext_c_invert = ta_ext_c_invert;
12561 cmb.t0a_ext_d = ta_ext_d;
12562 cmb.t0a_ext_d_invert = ta_ext_d_invert;
12564 else
12566 cmb.t1a_ext_a = ta_ext_a;
12567 cmb.t1a_ext_a_mode = ta_ext_a_mode;
12568 cmb.t1a_ext_b = ta_ext_b;
12569 cmb.t1a_ext_b_mode = ta_ext_b_mode;
12570 cmb.t1a_ext_c = ta_ext_c;
12571 cmb.t1a_ext_c_invert = ta_ext_c_invert;
12572 cmb.t1a_ext_d = ta_ext_d;
12573 cmb.t1a_ext_d_invert = ta_ext_d_invert;