Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
# LSL2 per-resource palette configuration
# Copyright (C) 2006 Matt Hargett
gameid = LSL2;
#ego
view(507,155,161,163,170,197,198,431,432,145..159,131..141,191,104,244,215,217,219,100,101,110,111,112,113,192,193,604,704..706,717,718,818,819,822,823,824,831,832,833,834,835) *= 1.25;
pic(28,99) *= 1.25;
view(218)(3) *= 1.25;
view(218)(0..2) *= 0.9;
view(820)(0,1) *= 0.9;
view(227,224,206,208,209,220) *= 0.9;
view(221,254,252) *= 0.7;
view(820)(2..4) *= 1.2;
view(816)(5)(0) *= 1.2;
view(516,509,501..504,401..403,408,409,411,413,414,417,418,419,430,310,302,303,120..124,232,223,208,710,716,714) *=1.1;
view(434..438,311,313,316,319,321,323,324,306..309,248,245,246,233..235,237,226,229,222,203,204,205,600,525,524,523,522,520,602,605,608,707..708) *=1.2;
view(305)(4) *= 1.1;
view(305)(0..3) *= 0.6;
view(661)(0,1,3..5) *= 1.2;
view(661)(2) *= 0.7;
view(711,712,713,60) *= (0.9, 1.0, 1.0);
view(816)(0..4) *= 0.9;
view(506,508,500,252,803,804,433) *= 0.6;
view(513)(0..5) *= 0.5;
view(240..243,701,722) *= 0.8;
view(700)(1) *= (0.6, 0.9, 1.0);
view(610,611) *= (0.9, 1.0, 1.1);
view(607)(1) *= 0.8;
view(253,228,247,300,326) *= 0.8;
view(412) *= 1.3;
pic(96) *= 1.1;
pic(92,93,18,20..26,134,40,50,76..82,181) *= 0.9;
pic(114..118,125,11..17,19,43,70..74,44,86,101..104,32,33,35,36,95) *= 0.85;
#titles
view(800,801) *= 1.5;
pic(10,90,91) *= 0.4;
#misc effects
view(702) *= (1.1, 1.0, 1.0);
view(519) *= 0.8;
view(200)(0) *= 0.7;
view(201,202) *= 0.8;

View File

@@ -0,0 +1,232 @@
from __future__ import print_function
import sys
from typing import List, Tuple, Any
def Chunker(seq: List[Any], size: int) -> List[List[Any]]:
return (seq[pos:pos + size] for pos in range(0, len(seq), size))
def ModToIndex(mods: List[Tuple[int]], m: int):
try:
return mods.index(m)
except ValueError:
mods.append(m)
return len(mods)-1
def PrintMods(gid: str, mods: List[Tuple[int]]):
L = [ "\t{ " + ", ".join( [ "%4d" % (round(128 * (val - 1)),) for val in m ] ) + " }" for m in mods ]
print("static const PaletteMod paletteMods" + gid + "[] = {")
print( ",\n".join(L) )
print("};")
def PrintPic(gid: str, pics: List[List[int]], comments: List[str]):
print("static const PicMod picMods" + gid + "[] = {")
for comment in comments:
print("\t// " + comment)
for chunk in Chunker(pics, 5):
t = ""
for pic in chunk:
t = t + "{ " + str(pic[0]).rjust(3, ' ') + ", " + str(pic[1]).rjust(2, ' ') + " }, "
print("\t" + t)
print("};")
def PrintView(gid: str, views: List[List[int]], comments: List[str]):
print("static const ViewMod viewMods" + gid + "[] = {")
for comment in comments:
print("\t// " + comment)
for chunk in Chunker(views, 5):
t = ""
for view in chunk:
t = t + "{ " + str(view[0]).rjust(3, ' ') + ", " + str(view[1]).rjust(2, ' ') + ", " + str(view[2]).rjust(2, ' ') + ", " + str(view[3]).rjust(2, ' ') + " }, "
print("\t" + t)
print("};")
def ParseList(l: str) -> Tuple[str, List[str]]:
assert(l[0] == '(')
e = l.find(")")
L = l[1:e].split(",")
tests = []
for t in L:
t = t.strip()
ell = t.find('..')
if ell >= 0:
start = int(t[0:ell])
end = int(t[ell+2:])
# interval
for x in range(start, end + 1):
tests.append(str(x))
else:
tests.append(t)
return l[e+1:], tests
def ParseTriple(l: str) -> List[str]:
assert(l[0] == '(')
e = l.find(")")
L = l[1:e].split(",")
assert(len(L) == 3)
return L
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python scifx_to_header.py [scifx files] > scifx.cpp")
sys.exit(-1)
print("""
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// NB: This file is AUTO-GENERATED by devtools/sci/scifx/scifx_to_cpp.py
// from devtools/sci/scifx/*.scifx
#include "sci/graphics/helpers.h"
#include "sci/graphics/screen.h"
namespace Sci {
""")
input_files = sys.argv[1:]
gids = []
for F in input_files:
comments = []
pics = []
views = []
mods = [(1.,1.,1.)]
gid = ""
for l in open(F, "r").readlines():
l = l.strip()
if len(l) == 0:
continue
if l[0] == '#':
comment = l[1:].strip()
# Only add the top comments (before the game ID is set)
if (gid == ""):
comments.append(comment)
continue
if l[0:6] == "gameid":
assert(gid == "")
l = l[6:].strip()
l = l.strip()
assert(l[0] == "=")
assert(l[-1] == ";")
l = l[1:-1].strip()
gid = l
continue
if l[0:4] == "view":
ruletype = "view"
l = l[4:]
elif l[0:3] == "pic":
ruletype = "pic"
l = l[3:]
else:
assert(False)
ids = []
loops = [-1]
cels = [-1]
l,ids = ParseList(l)
if l[0] == "(":
l,loops = ParseList(l)
if l[0] == "(":
l,cels = ParseList(l)
l = l.strip()
assert(l[0:2] == "*=")
assert(l[-1] == ";")
l = l[2:-1].strip()
if l[0] == "(":
val = ParseTriple(l)
val = (float(v) for v in val)
else:
val = (float(l), float(l), float(l))
if ruletype == "pic":
for pic in ids:
pics.append([pic, ModToIndex(mods, val)])
elif ruletype == "view":
for view in ids:
for loop in loops:
for cel in cels:
views.append([view, loop, cel, ModToIndex(mods, val)])
if gid == "":
raise ValueError("No gameid specified")
gids.append(gid)
PrintMods(gid, mods)
print()
PrintPic(gid, pics, comments)
print()
PrintView(gid, views, comments)
print()
print("static const SciFxMod mods[] = {")
for gid in gids:
print("\t{{ gid_{0}, paletteMods{0}, ARRAYSIZE(paletteMods{0}), picMods{0}, ARRAYSIZE(picMods{0}), viewMods{0}, ARRAYSIZE(viewMods{0}) }},".format(gid));
print("};")
print("""
void setupCustomPaletteMods(GfxScreen *screen) {
for (int i = 0; i < ARRAYSIZE(mods); i++) {
if (mods[i].gameId == g_sci->getGameId()) {
screen->setPaletteMods(mods[i].paletteMods, mods[i].paletteModsSize);
break;
}
}
}
void doCustomViewPalette(GfxScreen *screen, GuiResourceId view, int16 loop, int16 cel) {
for (int i = 0; i < ARRAYSIZE(mods); i++) {
SciFxMod mod = mods[i];
if (mod.gameId == g_sci->getGameId()) {
for (int j = 0; j < mod.viewModsSize; j++) {
ViewMod m = mod.viewMods[j];
if (m.id == view && (m.loop == -1 || m.loop == loop) && (m.cel == -1 || m.cel == cel)) {
screen->setCurPaletteMapValue(m.multiplier);
break;
}
}
break;
}
}
}
void doCustomPicPalette(GfxScreen *screen, GuiResourceId pic) {
for (int i = 0; i < ARRAYSIZE(mods); i++) {
SciFxMod mod = mods[i];
if (mod.gameId == g_sci->getGameId()) {
for (int j = 0; j < mod.picModsSize; j++) {
PicMod m = mod.picMods[j];
if (m.id == pic) {
screen->setCurPaletteMapValue(m.multiplier);
break;
}
}
break;
}
}
}
}""")

View File

@@ -0,0 +1,83 @@
# SQ3 per-resource palette configuration
# Copyright (C) 2006 Matt Hargett
gameid = SQ3;
# ego
view(0,8,11,12,14,68,17,22..26,32,35, 751, 289, 288, 261, 260, 257, 213, 199, 193, 192, 138, 137, 134, 109, 110, 113, 114, 117, 122, 123,100, 99, 97, 95, 89, 88, 87, 85, 84, 82, 76, 68, 63, 104 ) *= 1.25 ;
view(136) *= 1.15;
view(106)(4,5,9) *= 1.25;
view(105)(0,1) *= 1.25;
# ego on garbage lifter -- lighten but not so as to make the lifter be obviously weird
view(13)(0)(2) *= 1.15 ;
view(31) *= 1.15;
view(15)(3)(0) *= 1.25 ;
view(16,19)(0) *= 1.25;
view(57)(5..6) *= 1.25 ;
view(21)(1) *= 1.25 ;
# ego's shadow
view(7,18) *= 0.5;
view(6..8,18) *= 0.9;
view(901) *= 1.25;
view(751) *= 1.25;
view(750)(1) *= 1.25;
view(92)(4) *= 1.25;
view(83)(0) *= 1.25;
view(83)(1)(2) *=1.15;
view(83)(2)(2) *=1.15;
view(78)(3) *= 1.25;
view(64)(2,3) *= 1.25;
# ego's hands controlling robot
pic(96) *= 1.15;
# peeking at scumsoft
pic(81,82) *= 1.15;
#lifted by robot
pic(430) *= 1.15;
# computer controls
view(40,41,42,149,146,141,151,152) *= 0.8;
view(70,2) *= 0.9;
pic(17,18,162..164,170,180,191,300) *= 0.75;
# title screen
view(900) *= 0.9;
pic(1) *= 0.9 ;
pic(926) *= 0.9;
# humans(?)
view(593,93,103,131..133,210,130,115) *= 1.2;
pic(117) *=1.15;
view(116)(1..2) *= 1.2;
#ships, planets, and robots
view(39) *= 0.9;
view(1) *= 0.75;
pic(205..209,112..115) *= 0.9;
pic(60..72) *= 0.9;
pic(153) *= 0.8;
view(96) *= 0.9;
pic(690) *= 0.9;
view(77)(0..2) *= 0.7;
view(259) *= 1.15;
# in the garbage scow
pic(1..20) *= 0.75 ;
pic(157) *= 0.6;
view(20)(0) *= 0.5;
# rats
view(15)(0,1) *= 0.6;
view(34) *= 0.6;
# guys from andromeda
view(128) *= 0.9;
view(601, 602) *= 0.9;
# misc text bubbles, effects, etc
view(94) *= 1.1;
view(91, 73) *= 1.5;
view(57)(3,4) *= 1.5;
view(15)(4) *= 1.5;
view(64)(0) *= 1.5;
view(71)(8) *= 1.5;
view(10)(6) *= 1.5;