[Scummvm-cvs-logs] SF.net SVN: scummvm:[50195] tools/trunk
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Thu Jun 24 00:23:52 CEST 2010
Revision: 50195
http://scummvm.svn.sourceforge.net/scummvm/?rev=50195&view=rev
Author: tdhs
Date: 2010-06-23 22:23:51 +0000 (Wed, 23 Jun 2010)
Log Message:
-----------
Adding gob_loadcalc tool to aid testing.
This tool will calculate Gobliiins (gob1) Load Codes from Level and Health.
Modified Paths:
--------------
tools/trunk/Makefile
tools/trunk/Makefile.common
Added Paths:
-----------
tools/trunk/engines/gob/gob_loadcalc.cpp
Modified: tools/trunk/Makefile
===================================================================
--- tools/trunk/Makefile 2010-06-23 22:02:00 UTC (rev 50194)
+++ tools/trunk/Makefile 2010-06-23 22:23:51 UTC (rev 50195)
@@ -97,6 +97,7 @@
strip desword2.exe -o $(WIN32PATH)/tools/desword2.exe
strip extract_mohawk.exe -o $(WIN32PATH)/tools/extract_mohawk.exe
strip construct_mohawk.exe -o $(WIN32PATH)/tools/construct_mohawk.exe
+ strip gob_loadcalc.exe -o $(WIN32PATH)/tools/gob_loadcalc.exe
strip scummvm-tools.exe -o $(WIN32PATH)/tools/scummvm-tools.exe
strip scummvm-tools-cli.exe -o $(WIN32PATH)/tools/scummvm-tools-cli.exe
cp *.bat $(WIN32PATH)/tools
Modified: tools/trunk/Makefile.common
===================================================================
--- tools/trunk/Makefile.common 2010-06-23 22:02:00 UTC (rev 50194)
+++ tools/trunk/Makefile.common 2010-06-23 22:23:51 UTC (rev 50195)
@@ -58,6 +58,7 @@
extract_mohawk$(EXEEXT) \
construct_mohawk$(EXEEXT) \
degob$(EXEEXT) \
+ gob_loadcalc$(EXEEXT) \
scummvm-tools-cli$(EXEEXT)
ifdef USE_FREETYPE
@@ -111,6 +112,7 @@
descumm \
desword2 \
degob \
+ gob_loadcalc \
extract_mohawk \
construct_mohawk \
create_sjisfnt \
@@ -166,6 +168,9 @@
version.o \
$(UTILS)
+gob_loadcalc_OBJS := \
+ engines/gob/gob_loadcalc.o
+
extract_mohawk_OBJS := \
engines/mohawk/archive.o \
engines/mohawk/extract_mohawk.o \
@@ -178,7 +183,7 @@
construct_mohawk_OBJS := \
engines/mohawk/construct_mohawk.o \
- $(UTILS)
+ $(UTILS)
create_sjisfnt_OBJS := create_sjisfnt.o $(UTILS)
create_sjisfnt_LIBS := $(FREETYPELIBS) $(ICONVLIBS)
Added: tools/trunk/engines/gob/gob_loadcalc.cpp
===================================================================
--- tools/trunk/engines/gob/gob_loadcalc.cpp (rev 0)
+++ tools/trunk/engines/gob/gob_loadcalc.cpp 2010-06-23 22:23:51 UTC (rev 50195)
@@ -0,0 +1,112 @@
+/* gob_loadcalc - Gobliiins (Gob1) Load Code Calculator
+ * Copyright (C) 2010 The ScummVM project
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdlib.h>
+#include <string.h>
+
+void print_usage(void) {
+ printf("Usage : ./gob-loadcalc [Level/Screen = 0 to 23] [Health = 0 to 10]\n");
+}
+
+const char base_codes[24][6] = {
+ "GAGEA", /* 0 = Level 3 */
+ "BULBE", /* 1 = Level 7 */
+ "CANON", /* 2 = Level 4 */
+ "TOTOD", /* 3 = Level 2 */
+ "DRUID", /* 4 = Level 5 */
+ "FOUDR", /* 5 = Level 6 */
+ "GATEA", /* 6 = Level 9 */
+ "HAHAH", /* 7 = Level 8 */
+ "HIHIH", /* 8 = ???? - Unknown Screen with Watchdog Outside Wizard's House */
+ "JONAS", /* 9 = Level 10 */
+ "FLUTE", /* 10 = Level 11 */
+ "DROIT", /* 11 = Level 12 */
+ "BANJO", /* 12 = Level 13 */
+ "CUBEN", /* 13 = Level 14 */
+ "RALER", /* 14 = Level 15 */
+ "RATOP", /* 15 = Level 16 */
+ "GOBLI", /* 16 = Level 17 */
+ "IIINS", /* 17 = Level 18 */
+ "LEMEI", /* 18 = Level 19 */
+ "LLEUR", /* 19 = Level 20 */
+ "JEUDE", /* 20 = ???? - Unknown Screen Outside Castle with Catapult */
+ "ROLED", /* 21 = Level 21 */
+ "ETOUT", /* 22 = Level 1 */
+ "LESTP" /* 23 = ???? - Start Screen With Palette Scramble */
+};
+
+int main(int argc, char *argv[]) {
+ int i, temp, level, health;
+
+ char code[8];
+
+ for (i = 0; i < 8; i++)
+ code[i] = '\0';
+
+ if (argc != 3) {
+ print_usage();
+ return EXIT_FAILURE;
+ } else {
+ level = atoi(argv[1]);
+ if (level < 0 || level > 23) {
+ print_usage();
+ return EXIT_FAILURE;
+ }
+ health = atoi(argv[2]);
+ if (health < 0 || health > 10) {
+ print_usage();
+ return EXIT_FAILURE;
+ }
+ }
+
+ printf("Level: %d\n", level);
+ printf("Health: %d\n", health);
+
+ strncpy(code, base_codes[level], 5*sizeof(char));
+
+ /* Used by Load to determine Level */
+ code[5] = level + 'A';
+
+ /* Adjust Code for Health */
+ for (i = 0; i < 5; i++) {
+ if (health >= 2) {
+ code[i] += 2;
+ health -= 2;
+ } else if (health >= 1) {
+ code[i] += 1;
+ health -= 1;
+ }
+ }
+
+ /* Calculate Checksum Character */
+ temp = 0;
+ for (i = 0; i < 6; i++)
+ temp += code[i];
+ temp %= 26;
+ code[6] = 'A' + (char)temp;
+
+ printf("Code :\"%s\"\n", code);
+
+ return EXIT_SUCCESS;
+}
\ No newline at end of file
Property changes on: tools/trunk/engines/gob/gob_loadcalc.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list