Finished gobpack and included it into the build process.
authorFlorian Schulze <crow@icculus.org>
Mon, 5 Aug 2002 10:59:54 +0000 (10:59 +0000)
committerFlorian Schulze <crow@icculus.org>
Mon, 5 Aug 2002 10:59:54 +0000 (10:59 +0000)
Removed gobs.

24 files changed:
Makefile
VisualC6/jumpnbump.dsp
VisualC6/jumpnbump.dsw
data/.cvsignore
data/Makefile
data/font.gob [deleted file]
data/font.pcx [new file with mode: 0644]
data/font.txt [new file with mode: 0644]
data/level.pcx
data/mask.pcx
data/menu.pcx
data/menumask.pcx
data/numbers.gob [deleted file]
data/numbers.pcx [new file with mode: 0644]
data/numbers.txt [new file with mode: 0644]
data/objects.gob [deleted file]
data/objects.pcx [new file with mode: 0644]
data/objects.txt [new file with mode: 0644]
data/pack.bat
data/rabbit.gob [deleted file]
data/rabbit.pcx [new file with mode: 0644]
data/rabbit.txt [new file with mode: 0644]
gob.txt [new file with mode: 0644]
modify/gobpack.c

index 41bca04..886e2fe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ LIBS = -lm $(shell sdl-config --libs) -lSDL_mixer
 
 .PHONY: data
 
-all: $(TARGET) jnbpack jnbunpack data
+all: $(TARGET) jnbpack jnbunpack gobpack data
 
 $(TARGET): $(OBJS)
        $(CC) $(LFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
@@ -18,6 +18,9 @@ jnbpack: modify/jnbpack.o
 jnbunpack: modify/jnbunpack.o
        $(CC) $(LFLAGS) -o jnbunpack modify/jnbunpack.o $(LIBS)
 
+gobpack: modify/gobpack.o
+       $(CC) $(LFLAGS) -o gobpack modify/gobpack.o $(LIBS)
+
 data: jnbpack
        $(MAKE) -C data
 
index 4fc4734..407ac4f 100644 (file)
@@ -60,9 +60,23 @@ ProjDir=.
 InputPath=.\Release\jumpnbump.exe
 SOURCE="$(InputPath)"
 
-"$(ProjDir)\..\data\jumpbump.dat" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-       call "$(ProjDir)\..\data\pack.bat" "$(ProjDir)\..\data" "..\VisualC6\pack\Release\jnbpack.exe"
+BuildCmds= \
+       call "$(ProjDir)\..\data\pack.bat" "$(ProjDir)\..\data" "..\VisualC6\gobpack\Release\gobpack.exe" "..\VisualC6\pack\Release\jnbpack.exe"
+
+"$(ProjDir)\..\data\font.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
+
+"$(ProjDir)\..\data\rabbit.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
 
+"$(ProjDir)\..\data\numbers.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
+
+"$(ProjDir)\..\data\objects.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
+
+"$(ProjDir)\..\data\jumpbump.dat" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
 # End Custom Build
 
 !ELSEIF  "$(CFG)" == "jumpnbump - Win32 Debug"
@@ -95,9 +109,23 @@ ProjDir=.
 InputPath=.\Debug\jumpnbump.exe
 SOURCE="$(InputPath)"
 
-"$(ProjDir)\..\data\jumpbump.dat" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-       call "$(ProjDir)\..\data\pack.bat" "$(ProjDir)\..\data" "..\VisualC6\pack\Debug\jnbpack.exe"
+BuildCmds= \
+       call "$(ProjDir)\..\data\pack.bat" "$(ProjDir)\..\data" "..\VisualC6\gobpack\Debug\gobpack.exe" "..\VisualC6\pack\Debug\jnbpack.exe"
+
+"$(ProjDir)\..\data\font.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
+
+"$(ProjDir)\..\data\rabbit.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
 
+"$(ProjDir)\..\data\numbers.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
+
+"$(ProjDir)\..\data\objects.gob" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
+
+"$(ProjDir)\..\data\jumpbump.dat" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+   $(BuildCmds)
 # End Custom Build
 
 !ENDIF 
index 64ab918..71c28fc 100644 (file)
@@ -26,6 +26,9 @@ Package=<4>
     Begin Project Dependency
     Project_Dep_Name pack
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name gobpack
+    End Project Dependency
 }}}
 
 ###############################################################################
index 40b815f..8ca1b48 100644 (file)
@@ -1 +1,2 @@
 jumpbump.dat
+*.gob
index 51e2f8a..c7645d3 100644 (file)
@@ -1,7 +1,19 @@
 all: jumpbump.dat
 
+font.gob:
+       ../gobpack font
+
+rabbit.gob:
+       ../gobpack rabbit
+
+numbers.gob:
+       ../gobpack numbers
+
+objects.gob:
+       ../gobpack objects
+
 jumpbump.dat: bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp
        ../jnbpack -o jumpbump.dat bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp
 
 clean:
-       rm -f jumpbump.dat
+       rm -f jumpbump.dat font.gob rabbit.gob numbers.gob objects.gob
diff --git a/data/font.gob b/data/font.gob
deleted file mode 100644 (file)
index ec41321..0000000
Binary files a/data/font.gob and /dev/null differ
diff --git a/data/font.pcx b/data/font.pcx
new file mode 100644 (file)
index 0000000..cda12ef
Binary files /dev/null and b/data/font.pcx differ
diff --git a/data/font.txt b/data/font.txt
new file mode 100644 (file)
index 0000000..f2a1a56
--- /dev/null
@@ -0,0 +1,650 @@
+num_images: 81
+
+image: 1
+x: 0
+y: 0
+width: 4
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 2
+x: 14
+y: 0
+width: 5
+height: 4
+hotspot_x: 0
+hotspot_y: -1
+
+image: 3
+x: 28
+y: 0
+width: 3
+height: 4
+hotspot_x: 0
+hotspot_y: -1
+
+image: 4
+x: 42
+y: 0
+width: 5
+height: 12
+hotspot_x: 0
+hotspot_y: 0
+
+image: 5
+x: 56
+y: 0
+width: 6
+height: 12
+hotspot_x: 0
+hotspot_y: 0
+
+image: 6
+x: 70
+y: 0
+width: 3
+height: 5
+hotspot_x: 0
+hotspot_y: -8
+
+image: 7
+x: 84
+y: 0
+width: 5
+height: 3
+hotspot_x: 0
+hotspot_y: -4
+
+image: 8
+x: 98
+y: 0
+width: 3
+height: 3
+hotspot_x: 0
+hotspot_y: -8
+
+image: 9
+x: 112
+y: 0
+width: 6
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 10
+x: 126
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 11
+x: 140
+y: 0
+width: 5
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 12
+x: 154
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 13
+x: 168
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 14
+x: 182
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 15
+x: 196
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 16
+x: 210
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 17
+x: 224
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 18
+x: 238
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 19
+x: 252
+y: 0
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 20
+x: 266
+y: 0
+width: 4
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 21
+x: 280
+y: 0
+width: 4
+height: 9
+hotspot_x: 0
+hotspot_y: -3
+
+image: 22
+x: 294
+y: 0
+width: 12
+height: 11
+hotspot_x: 0
+hotspot_y: 0
+
+image: 23
+x: 308
+y: 0
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 24
+x: 322
+y: 0
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 25
+x: 336
+y: 0
+width: 9
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 26
+x: 350
+y: 0
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 27
+x: 364
+y: 0
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 28
+x: 378
+y: 0
+width: 8
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 29
+x: 0
+y: 14
+width: 9
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 30
+x: 14
+y: 14
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 31
+x: 28
+y: 14
+width: 4
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 32
+x: 42
+y: 14
+width: 8
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 33
+x: 56
+y: 14
+width: 10
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 34
+x: 70
+y: 14
+width: 7
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 35
+x: 84
+y: 14
+width: 11
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 36
+x: 98
+y: 14
+width: 10
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 37
+x: 112
+y: 14
+width: 9
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 38
+x: 126
+y: 14
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 39
+x: 140
+y: 14
+width: 9
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 40
+x: 154
+y: 14
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 41
+x: 168
+y: 14
+width: 8
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 42
+x: 182
+y: 14
+width: 8
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 43
+x: 196
+y: 14
+width: 9
+height: 10
+hotspot_x: 0
+hotspot_y: -1
+
+image: 44
+x: 210
+y: 14
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 45
+x: 224
+y: 14
+width: 12
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 46
+x: 238
+y: 14
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 47
+x: 252
+y: 14
+width: 8
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 48
+x: 266
+y: 14
+width: 9
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 49
+x: 280
+y: 14
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 50
+x: 294
+y: 14
+width: 8
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 51
+x: 308
+y: 14
+width: 6
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 52
+x: 322
+y: 14
+width: 8
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 53
+x: 336
+y: 14
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 54
+x: 350
+y: 14
+width: 5
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 55
+x: 364
+y: 14
+width: 8
+height: 10
+hotspot_x: 0
+hotspot_y: -3
+
+image: 56
+x: 378
+y: 14
+width: 7
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 57
+x: 0
+y: 28
+width: 4
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 58
+x: 14
+y: 28
+width: 5
+height: 12
+hotspot_x: 0
+hotspot_y: -1
+
+image: 59
+x: 28
+y: 28
+width: 8
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 60
+x: 42
+y: 28
+width: 4
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 61
+x: 56
+y: 28
+width: 11
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 62
+x: 70
+y: 28
+width: 8
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 63
+x: 84
+y: 28
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 64
+x: 98
+y: 28
+width: 8
+height: 10
+hotspot_x: 0
+hotspot_y: -3
+
+image: 65
+x: 112
+y: 28
+width: 8
+height: 10
+hotspot_x: 0
+hotspot_y: -3
+
+image: 66
+x: 126
+y: 28
+width: 6
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 67
+x: 140
+y: 28
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 68
+x: 154
+y: 28
+width: 5
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 69
+x: 168
+y: 28
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 70
+x: 182
+y: 28
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 71
+x: 196
+y: 28
+width: 10
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 72
+x: 210
+y: 28
+width: 8
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 73
+x: 224
+y: 28
+width: 8
+height: 10
+hotspot_x: 0
+hotspot_y: -3
+
+image: 74
+x: 238
+y: 28
+width: 7
+height: 7
+hotspot_x: 0
+hotspot_y: -3
+
+image: 75
+x: 252
+y: 28
+width: 6
+height: 3
+hotspot_x: 0
+hotspot_y: -4
+
+image: 76
+x: 266
+y: 28
+width: 7
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 77
+x: 280
+y: 28
+width: 7
+height: 10
+hotspot_x: 0
+hotspot_y: 0
+
+image: 78
+x: 294
+y: 28
+width: 9
+height: 11
+hotspot_x: 0
+hotspot_y: 1
+
+image: 79
+x: 308
+y: 28
+width: 9
+height: 11
+hotspot_x: 0
+hotspot_y: 1
+
+image: 80
+x: 322
+y: 28
+width: 7
+height: 9
+hotspot_x: 0
+hotspot_y: -1
+
+image: 81
+x: 336
+y: 28
+width: 9
+height: 11
+hotspot_x: 0
+hotspot_y: 1
+
index b7c2f10..ba30d92 100644 (file)
Binary files a/data/level.pcx and b/data/level.pcx differ
index ee207ec..8e5856f 100644 (file)
Binary files a/data/mask.pcx and b/data/mask.pcx differ
index 41ffe1c..b31b9c8 100644 (file)
Binary files a/data/menu.pcx and b/data/menu.pcx differ
index e9ad0ed..6c47bb0 100644 (file)
Binary files a/data/menumask.pcx and b/data/menumask.pcx differ
diff --git a/data/numbers.gob b/data/numbers.gob
deleted file mode 100644 (file)
index 9d91905..0000000
Binary files a/data/numbers.gob and /dev/null differ
diff --git a/data/numbers.pcx b/data/numbers.pcx
new file mode 100644 (file)
index 0000000..d080bac
Binary files /dev/null and b/data/numbers.pcx differ
diff --git a/data/numbers.txt b/data/numbers.txt
new file mode 100644 (file)
index 0000000..3055319
--- /dev/null
@@ -0,0 +1,82 @@
+num_images: 10
+
+image: 1
+x: 0
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 2
+x: 18
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 3
+x: 36
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 4
+x: 54
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 5
+x: 72
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 6
+x: 90
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 7
+x: 108
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 8
+x: 126
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 9
+x: 144
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
+image: 10
+x: 162
+y: 0
+width: 16
+height: 22
+hotspot_x: 0
+hotspot_y: 0
+
diff --git a/data/objects.gob b/data/objects.gob
deleted file mode 100644 (file)
index a3e0d5f..0000000
Binary files a/data/objects.gob and /dev/null differ
diff --git a/data/objects.pcx b/data/objects.pcx
new file mode 100644 (file)
index 0000000..0e1371a
Binary files /dev/null and b/data/objects.pcx differ
diff --git a/data/objects.txt b/data/objects.txt
new file mode 100644 (file)
index 0000000..31a7295
--- /dev/null
@@ -0,0 +1,642 @@
+num_images: 80
+
+image: 1
+x: 0
+y: 0
+width: 17
+height: 7
+hotspot_x: 0
+hotspot_y: 3
+
+image: 2
+x: 32
+y: 0
+width: 17
+height: 8
+hotspot_x: 0
+hotspot_y: 4
+
+image: 3
+x: 64
+y: 0
+width: 17
+height: 12
+hotspot_x: 0
+hotspot_y: 8
+
+image: 4
+x: 96
+y: 0
+width: 17
+height: 10
+hotspot_x: 0
+hotspot_y: 6
+
+image: 5
+x: 128
+y: 0
+width: 17
+height: 8
+hotspot_x: 0
+hotspot_y: 4
+
+image: 6
+x: 160
+y: 0
+width: 17
+height: 7
+hotspot_x: 0
+hotspot_y: 3
+
+image: 7
+x: 192
+y: 0
+width: 12
+height: 6
+hotspot_x: 5
+hotspot_y: 5
+
+image: 8
+x: 224
+y: 0
+width: 16
+height: 8
+hotspot_x: 7
+hotspot_y: 7
+
+image: 9
+x: 256
+y: 0
+width: 20
+height: 10
+hotspot_x: 9
+hotspot_y: 9
+
+image: 10
+x: 288
+y: 0
+width: 23
+height: 11
+hotspot_x: 11
+hotspot_y: 10
+
+image: 11
+x: 320
+y: 0
+width: 25
+height: 12
+hotspot_x: 12
+hotspot_y: 11
+
+image: 12
+x: 352
+y: 0
+width: 27
+height: 11
+hotspot_x: 13
+hotspot_y: 10
+
+image: 13
+x: 0
+y: 14
+width: 29
+height: 10
+hotspot_x: 14
+hotspot_y: 8
+
+image: 14
+x: 32
+y: 14
+width: 30
+height: 7
+hotspot_x: 15
+hotspot_y: 5
+
+image: 15
+x: 64
+y: 14
+width: 29
+height: 4
+hotspot_x: 16
+hotspot_y: 2
+
+image: 16
+x: 96
+y: 14
+width: 2
+height: 2
+hotspot_x: 0
+hotspot_y: 0
+
+image: 17
+x: 128
+y: 14
+width: 4
+height: 4
+hotspot_x: 1
+hotspot_y: 1
+
+image: 18
+x: 160
+y: 14
+width: 5
+height: 5
+hotspot_x: 2
+hotspot_y: 2
+
+image: 19
+x: 192
+y: 14
+width: 5
+height: 5
+hotspot_x: 2
+hotspot_y: 2
+
+image: 20
+x: 224
+y: 14
+width: 5
+height: 5
+hotspot_x: 2
+hotspot_y: 2
+
+image: 21
+x: 256
+y: 14
+width: 7
+height: 5
+hotspot_x: 4
+hotspot_y: 4
+
+image: 22
+x: 288
+y: 14
+width: 8
+height: 4
+hotspot_x: 5
+hotspot_y: 3
+
+image: 23
+x: 320
+y: 14
+width: 9
+height: 3
+hotspot_x: 5
+hotspot_y: 2
+
+image: 24
+x: 352
+y: 14
+width: 8
+height: 3
+hotspot_x: 5
+hotspot_y: 1
+
+image: 25
+x: 0
+y: 28
+width: 8
+height: 4
+hotspot_x: 5
+hotspot_y: 1
+
+image: 26
+x: 32
+y: 28
+width: 7
+height: 5
+hotspot_x: 4
+hotspot_y: 1
+
+image: 27
+x: 64
+y: 28
+width: 7
+height: 5
+hotspot_x: 2
+hotspot_y: 4
+
+image: 28
+x: 96
+y: 28
+width: 8
+height: 4
+hotspot_x: 2
+hotspot_y: 3
+
+image: 29
+x: 128
+y: 28
+width: 9
+height: 3
+hotspot_x: 3
+hotspot_y: 2
+
+image: 30
+x: 160
+y: 28
+width: 8
+height: 3
+hotspot_x: 2
+hotspot_y: 1
+
+image: 31
+x: 192
+y: 28
+width: 8
+height: 4
+hotspot_x: 2
+hotspot_y: 1
+
+image: 32
+x: 224
+y: 28
+width: 7
+height: 5
+hotspot_x: 2
+hotspot_y: 1
+
+image: 33
+x: 256
+y: 28
+width: 7
+height: 5
+hotspot_x: 4
+hotspot_y: 4
+
+image: 34
+x: 288
+y: 28
+width: 8
+height: 4
+hotspot_x: 5
+hotspot_y: 3
+
+image: 35
+x: 320
+y: 28
+width: 9
+height: 3
+hotspot_x: 5
+hotspot_y: 2
+
+image: 36
+x: 352
+y: 28
+width: 8
+height: 3
+hotspot_x: 5
+hotspot_y: 1
+
+image: 37
+x: 0
+y: 42
+width: 8
+height: 4
+hotspot_x: 5
+hotspot_y: 1
+
+image: 38
+x: 32
+y: 42
+width: 7
+height: 5
+hotspot_x: 4
+hotspot_y: 1
+
+image: 39
+x: 64
+y: 42
+width: 7
+height: 5
+hotspot_x: 2
+hotspot_y: 4
+
+image: 40
+x: 96
+y: 42
+width: 8
+height: 4
+hotspot_x: 2
+hotspot_y: 3
+
+image: 41
+x: 128
+y: 42
+width: 9
+height: 3
+hotspot_x: 3
+hotspot_y: 2
+
+image: 42
+x: 160
+y: 42
+width: 8
+height: 3
+hotspot_x: 2
+hotspot_y: 1
+
+image: 43
+x: 192
+y: 42
+width: 8
+height: 4
+hotspot_x: 2
+hotspot_y: 1
+
+image: 44
+x: 224
+y: 42
+width: 7
+height: 5
+hotspot_x: 2
+hotspot_y: 1
+
+image: 45
+x: 256
+y: 42
+width: 6
+height: 4
+hotspot_x: 3
+hotspot_y: 2
+
+image: 46
+x: 288
+y: 42
+width: 6
+height: 5
+hotspot_x: 3
+hotspot_y: 3
+
+image: 47
+x: 320
+y: 42
+width: 4
+height: 6
+hotspot_x: 2
+hotspot_y: 3
+
+image: 48
+x: 352
+y: 42
+width: 5
+height: 6
+hotspot_x: 2
+hotspot_y: 3
+
+image: 49
+x: 0
+y: 56
+width: 6
+height: 4
+hotspot_x: 2
+hotspot_y: 2
+
+image: 50
+x: 32
+y: 56
+width: 6
+height: 5
+hotspot_x: 2
+hotspot_y: 2
+
+image: 51
+x: 64
+y: 56
+width: 4
+height: 6
+hotspot_x: 1
+hotspot_y: 2
+
+image: 52
+x: 96
+y: 56
+width: 5
+height: 6
+hotspot_x: 2
+hotspot_y: 3
+
+image: 53
+x: 128
+y: 56
+width: 6
+height: 4
+hotspot_x: 3
+hotspot_y: 2
+
+image: 54
+x: 160
+y: 56
+width: 6
+height: 5
+hotspot_x: 3
+hotspot_y: 2
+
+image: 55
+x: 192
+y: 56
+width: 4
+height: 6
+hotspot_x: 2
+hotspot_y: 3
+
+image: 56
+x: 224
+y: 56
+width: 5
+height: 6
+hotspot_x: 3
+hotspot_y: 3
+
+image: 57
+x: 256
+y: 56
+width: 6
+height: 4
+hotspot_x: 4
+hotspot_y: 2
+
+image: 58
+x: 288
+y: 56
+width: 6
+height: 5
+hotspot_x: 4
+hotspot_y: 3
+
+image: 59
+x: 320
+y: 56
+width: 4
+height: 6
+hotspot_x: 3
+hotspot_y: 3
+
+image: 60
+x: 352
+y: 56
+width: 5
+height: 6
+hotspot_x: 3
+hotspot_y: 3
+
+image: 61
+x: 0
+y: 70
+width: 6
+height: 4
+hotspot_x: 3
+hotspot_y: 2
+
+image: 62
+x: 32
+y: 70
+width: 6
+height: 5
+hotspot_x: 3
+hotspot_y: 2
+
+image: 63
+x: 64
+y: 70
+width: 4
+height: 6
+hotspot_x: 3
+hotspot_y: 2
+
+image: 64
+x: 96
+y: 70
+width: 5
+height: 6
+hotspot_x: 4
+hotspot_y: 2
+
+image: 65
+x: 128
+y: 70
+width: 6
+height: 4
+hotspot_x: 5
+hotspot_y: 1
+
+image: 66
+x: 160
+y: 70
+width: 6
+height: 5
+hotspot_x: 5
+hotspot_y: 2
+
+image: 67
+x: 192
+y: 70
+width: 4
+height: 6
+hotspot_x: 4
+hotspot_y: 3
+
+image: 68
+x: 224
+y: 70
+width: 5
+height: 6
+hotspot_x: 3
+hotspot_y: 3
+
+image: 69
+x: 256
+y: 70
+width: 6
+height: 4
+hotspot_x: 3
+hotspot_y: 2
+
+image: 70
+x: 288
+y: 70
+width: 6
+height: 5
+hotspot_x: 3
+hotspot_y: 2
+
+image: 71
+x: 320
+y: 70
+width: 4
+height: 6
+hotspot_x: 2
+hotspot_y: 2
+
+image: 72
+x: 352
+y: 70
+width: 5
+height: 6
+hotspot_x: 4
+hotspot_y: 2
+
+image: 73
+x: 0
+y: 84
+width: 6
+height: 4
+hotspot_x: 5
+hotspot_y: 1
+
+image: 74
+x: 32
+y: 84
+width: 6
+height: 5
+hotspot_x: 5
+hotspot_y: 2
+
+image: 75
+x: 64
+y: 84
+width: 4
+height: 6
+hotspot_x: 3
+hotspot_y: 3
+
+image: 76
+x: 96
+y: 84
+width: 5
+height: 6
+hotspot_x: 3
+hotspot_y: 3
+
+image: 77
+x: 128
+y: 84
+width: 5
+height: 4
+hotspot_x: 2
+hotspot_y: 1
+
+image: 78
+x: 160
+y: 84
+width: 4
+height: 4
+hotspot_x: 2
+hotspot_y: 1
+
+image: 79
+x: 192
+y: 84
+width: 2
+height: 3
+hotspot_x: 1
+hotspot_y: 1
+
+image: 80
+x: 224
+y: 84
+width: 1
+height: 1
+hotspot_x: 0
+hotspot_y: 0
+
index 62509ac..94de5b2 100644 (file)
@@ -1,2 +1,6 @@
 cd %1
-%2 -o jumpbump.dat bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp
+%2 font
+%2 rabbit
+%2 numbers
+%2 objects
+%3 -o jumpbump.dat bump.mod calib.dat death.smp fly.smp font.gob jump.mod jump.smp levelmap.txt level.pcx mask.pcx menu.pcx menumask.pcx numbers.gob objects.gob rabbit.gob scores.mod splash.smp spring.smp
diff --git a/data/rabbit.gob b/data/rabbit.gob
deleted file mode 100644 (file)
index 99861e9..0000000
Binary files a/data/rabbit.gob and /dev/null differ
diff --git a/data/rabbit.pcx b/data/rabbit.pcx
new file mode 100644 (file)
index 0000000..6ed26f2
Binary files /dev/null and b/data/rabbit.pcx differ
diff --git a/data/rabbit.txt b/data/rabbit.txt
new file mode 100644 (file)
index 0000000..9902f7c
--- /dev/null
@@ -0,0 +1,578 @@
+num_images: 72
+
+image: 1
+x: 0
+y: 0
+width: 13
+height: 15
+hotspot_x: -2
+hotspot_y: -1
+
+image: 2
+x: 19
+y: 0
+width: 14
+height: 14
+hotspot_x: -2
+hotspot_y: 0
+
+image: 3
+x: 38
+y: 0
+width: 14
+height: 16
+hotspot_x: -2
+hotspot_y: 2
+
+image: 4
+x: 57
+y: 0
+width: 13
+height: 16
+hotspot_x: -3
+hotspot_y: 2
+
+image: 5
+x: 76
+y: 0
+width: 14
+height: 14
+hotspot_x: -3
+hotspot_y: -2
+
+image: 6
+x: 95
+y: 0
+width: 15
+height: 14
+hotspot_x: -1
+hotspot_y: 0
+
+image: 7
+x: 114
+y: 0
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 0
+
+image: 8
+x: 133
+y: 0
+width: 17
+height: 16
+hotspot_x: 1
+hotspot_y: 0
+
+image: 9
+x: 152
+y: 0
+width: 17
+height: 13
+hotspot_x: -1
+hotspot_y: -3
+
+image: 10
+x: 171
+y: 0
+width: 13
+height: 15
+hotspot_x: -1
+hotspot_y: -1
+
+image: 11
+x: 190
+y: 0
+width: 14
+height: 14
+hotspot_x: 0
+hotspot_y: 0
+
+image: 12
+x: 209
+y: 0
+width: 14
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 13
+x: 228
+y: 0
+width: 13
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 14
+x: 247
+y: 0
+width: 14
+height: 14
+hotspot_x: 1
+hotspot_y: -1
+
+image: 15
+x: 266
+y: 0
+width: 15
+height: 14
+hotspot_x: 0
+hotspot_y: 1
+
+image: 16
+x: 285
+y: 0
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 17
+x: 304
+y: 0
+width: 17
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 18
+x: 323
+y: 0
+width: 17
+height: 13
+hotspot_x: 2
+hotspot_y: -4
+
+image: 19
+x: 342
+y: 0
+width: 13
+height: 15
+hotspot_x: -2
+hotspot_y: -1
+
+image: 20
+x: 361
+y: 0
+width: 14
+height: 14
+hotspot_x: -2
+hotspot_y: 0
+
+image: 21
+x: 380
+y: 0
+width: 14
+height: 16
+hotspot_x: -2
+hotspot_y: 2
+
+image: 22
+x: 0
+y: 18
+width: 13
+height: 16
+hotspot_x: -3
+hotspot_y: 2
+
+image: 23
+x: 19
+y: 18
+width: 14
+height: 14
+hotspot_x: -3
+hotspot_y: -2
+
+image: 24
+x: 38
+y: 18
+width: 15
+height: 14
+hotspot_x: -1
+hotspot_y: 0
+
+image: 25
+x: 57
+y: 18
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 0
+
+image: 26
+x: 76
+y: 18
+width: 17
+height: 16
+hotspot_x: 1
+hotspot_y: 0
+
+image: 27
+x: 95
+y: 18
+width: 17
+height: 13
+hotspot_x: -1
+hotspot_y: -3
+
+image: 28
+x: 114
+y: 18
+width: 13
+height: 15
+hotspot_x: -1
+hotspot_y: -1
+
+image: 29
+x: 133
+y: 18
+width: 14
+height: 14
+hotspot_x: 0
+hotspot_y: 0
+
+image: 30
+x: 152
+y: 18
+width: 14
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 31
+x: 171
+y: 18
+width: 13
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 32
+x: 190
+y: 18
+width: 14
+height: 14
+hotspot_x: 1
+hotspot_y: -1
+
+image: 33
+x: 209
+y: 18
+width: 15
+height: 14
+hotspot_x: 0
+hotspot_y: 1
+
+image: 34
+x: 228
+y: 18
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 35
+x: 247
+y: 18
+width: 17
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 36
+x: 266
+y: 18
+width: 17
+height: 13
+hotspot_x: 2
+hotspot_y: -4
+
+image: 37
+x: 285
+y: 18
+width: 13
+height: 15
+hotspot_x: -2
+hotspot_y: -1
+
+image: 38
+x: 304
+y: 18
+width: 14
+height: 14
+hotspot_x: -2
+hotspot_y: 0
+
+image: 39
+x: 323
+y: 18
+width: 14
+height: 16
+hotspot_x: -2
+hotspot_y: 2
+
+image: 40
+x: 342
+y: 18
+width: 13
+height: 16
+hotspot_x: -3
+hotspot_y: 2
+
+image: 41
+x: 361
+y: 18
+width: 14
+height: 14
+hotspot_x: -3
+hotspot_y: -2
+
+image: 42
+x: 380
+y: 18
+width: 15
+height: 14
+hotspot_x: -1
+hotspot_y: 0
+
+image: 43
+x: 0
+y: 36
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 0
+
+image: 44
+x: 19
+y: 36
+width: 17
+height: 16
+hotspot_x: 1
+hotspot_y: 0
+
+image: 45
+x: 38
+y: 36
+width: 17
+height: 13
+hotspot_x: -1
+hotspot_y: -3
+
+image: 46
+x: 57
+y: 36
+width: 13
+height: 15
+hotspot_x: -1
+hotspot_y: -1
+
+image: 47
+x: 76
+y: 36
+width: 14
+height: 14
+hotspot_x: 0
+hotspot_y: 0
+
+image: 48
+x: 95
+y: 36
+width: 14
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 49
+x: 114
+y: 36
+width: 13
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 50
+x: 133
+y: 36
+width: 14
+height: 14
+hotspot_x: 1
+hotspot_y: -1
+
+image: 51
+x: 152
+y: 36
+width: 15
+height: 14
+hotspot_x: 0
+hotspot_y: 1
+
+image: 52
+x: 171
+y: 36
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 53
+x: 190
+y: 36
+width: 17
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 54
+x: 209
+y: 36
+width: 17
+height: 13
+hotspot_x: 2
+hotspot_y: -4
+
+image: 55
+x: 228
+y: 36
+width: 13
+height: 15
+hotspot_x: -2
+hotspot_y: -1
+
+image: 56
+x: 247
+y: 36
+width: 14
+height: 14
+hotspot_x: -2
+hotspot_y: -1
+
+image: 57
+x: 266
+y: 36
+width: 14
+height: 16
+hotspot_x: -2
+hotspot_y: 2
+
+image: 58
+x: 285
+y: 36
+width: 13
+height: 16
+hotspot_x: -3
+hotspot_y: 2
+
+image: 59
+x: 304
+y: 36
+width: 14
+height: 14
+hotspot_x: -3
+hotspot_y: -2
+
+image: 60
+x: 323
+y: 36
+width: 15
+height: 14
+hotspot_x: -1
+hotspot_y: 0
+
+image: 61
+x: 342
+y: 36
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 0
+
+image: 62
+x: 361
+y: 36
+width: 17
+height: 16
+hotspot_x: 1
+hotspot_y: 0
+
+image: 63
+x: 380
+y: 36
+width: 17
+height: 13
+hotspot_x: -1
+hotspot_y: -3
+
+image: 64
+x: 0
+y: 54
+width: 13
+height: 15
+hotspot_x: -1
+hotspot_y: -1
+
+image: 65
+x: 19
+y: 54
+width: 14
+height: 14
+hotspot_x: 0
+hotspot_y: 0
+
+image: 66
+x: 38
+y: 54
+width: 14
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 67
+x: 57
+y: 54
+width: 13
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 68
+x: 76
+y: 54
+width: 14
+height: 14
+hotspot_x: 1
+hotspot_y: -1
+
+image: 69
+x: 95
+y: 54
+width: 15
+height: 14
+hotspot_x: 0
+hotspot_y: 1
+
+image: 70
+x: 114
+y: 54
+width: 16
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 71
+x: 133
+y: 54
+width: 17
+height: 16
+hotspot_x: 0
+hotspot_y: 2
+
+image: 72
+x: 152
+y: 54
+width: 17
+height: 13
+hotspot_x: 2
+hotspot_y: -4
+
diff --git a/gob.txt b/gob.txt
new file mode 100644 (file)
index 0000000..06729c2
--- /dev/null
+++ b/gob.txt
@@ -0,0 +1,52 @@
+             THE FORMAT OF GOBFILES
+
+Do YOU want to make your own GOB-files?
+Then you have to know the GOB format!
+Here you can find a brief desciption of it.
+(this is all about how the file is saved)
+Note: Everything is saved in Intel byteorder,
+ie the least significant byte first.
+
+
+                  THE HEADER
+
+Offset   Size   Description
+ 0        2      Number of images in the file
+
+
+For I=1 to Number of images
+
+   Offset   Size   Description
+    2+I*4    4      Offset in file to image data
+
+End repeat
+
+
+The above offsets are offsets from the beginning of
+the file. Each image has it's own image data.
+The image data is like this:
+
+
+                THE IMAGE DATA
+
+Offset   Size   Description
+ 0        2      Image width in pixels (W)
+ 2        2      Image height in pixels (H)
+ 4        2      Hotspot x
+ 6        2      Hotspot y
+ 8        W*H    Bitmap data
+
+
+The offsets above are offsets in the image data (for each image).
+
+The Hotspot x/y of a specific image works like this:
+Whenever a sprite is drawn at (x, y) with that image,
+the image is drawn at (x - hotspot x, y - hotspot y),
+where hotspot x/y are the hotspots for that image.
+
+The bitmap data is just a block of colordata for each pixel.
+It scans the image horisontally left/down. This means that
+the first byte represents the upper left pixel, the second
+represents the pixel to the right of that and so on.
+If the width is 10  pixels then the 10th byte of bitmap data
+will represent the pixel (0, 1).
index da5dc78..0c586ba 100644 (file)
@@ -12,9 +12,32 @@ typedef struct {
        void **orig_data;
 } gob_t;
 
-//
-// WritePCXfile
-//
+static void read_pcx(FILE * handle, void *buf, int buf_len, char *pal)
+{
+       unsigned char *buffer=buf;
+       short c1;
+       short a, b;
+       long ofs1;
+       if (buffer != 0) {
+               fseek(handle, 128, SEEK_CUR);
+               ofs1 = 0;
+               while (ofs1 < buf_len) {
+                       a = fgetc(handle);
+                       if ((a & 0xc0) == 0xc0) {
+                               b = fgetc(handle);
+                               a &= 0x3f;
+                               for (c1 = 0; c1 < a && ofs1 < buf_len; c1++)
+                                       buffer[ofs1++] = (char) b;
+                       } else
+                               buffer[ofs1++] = (char) a;
+               }
+               if (pal != 0) {
+                       fseek(handle, 1, SEEK_CUR);
+                       for (c1 = 0; c1 < 768; c1++)
+                               pal[c1] = fgetc(handle) >> 2;
+               }
+       }
+}
 
 static void write_pcx(FILE *pcxfile, unsigned char *data, int width, int height, unsigned char *palette)
 {
@@ -105,6 +128,43 @@ int read_gob(FILE *handle, gob_t *gob, int len)
        return 0;
 }
 
+int write_gob(FILE *handle, gob_t *gob)
+{
+       int i;
+       int offset;
+
+       fputc((gob->num_images >> 0) & 0xff, handle);
+       fputc((gob->num_images >> 8) & 0xff, handle);
+
+       offset = 2 + (gob->num_images * 4);
+
+       for (i=0; i<gob->num_images; i++) {
+               fputc((offset >> 0) & 0xff, handle);
+               fputc((offset >> 8) & 0xff, handle);
+               fputc((offset >> 16) & 0xff, handle);
+               fputc((offset >> 24) & 0xff, handle);
+
+               offset += 8;
+               offset += gob->width[i] * gob->height[i];
+       }
+       for (i=0; i<gob->num_images; i++) {
+               fputc((gob->width[i] >> 0) & 0xff, handle);
+               fputc((gob->width[i] >> 8) & 0xff, handle);
+
+               fputc((gob->height[i] >> 0) & 0xff, handle);
+               fputc((gob->height[i] >> 8) & 0xff, handle);
+
+               fputc((gob->hs_x[i] >> 0) & 0xff, handle);
+               fputc((gob->hs_x[i] >> 8) & 0xff, handle);
+
+               fputc((gob->hs_y[i] >> 0) & 0xff, handle);
+               fputc((gob->hs_y[i] >> 8) & 0xff, handle);
+
+               fwrite(gob->data[i], 1, gob->width[i] * gob->height[i], handle);
+       }
+       return 0;
+}
+
 int main(int argc, char **argv)
 {
        int usage = 0;
@@ -112,29 +172,59 @@ int main(int argc, char **argv)
        FILE *f;
        int len;
        gob_t gob;
+       char *filename = NULL;
 
-       if (argc < 4) {
+       if (argc < 2) {
                usage = 1;
-       } else if (argc == 5) {
-               unpack = 1;
-               if ((argv[1][0] != '-') || (argv[1][1] != 'u'))
+       }
+       if (argv[1][0] == '-') {
+               if (argv[1][1] == 'u') {
+                       if (argc < 3)
+                               usage = 1;
+                       unpack = 1;
+               } else
                        usage = 1;
        }
        
        if (usage) {
-               printf("Usage: gobpack [-u] <file.gob> <file.pcx> <filedefs.txt>\n\t-u to unpack the gob\n");
+               printf("Usage: gobpack [-u] <file> [palette.pcx] <\n\t-u to unpack the gob\n");
                return 1;
        }
 
        if (unpack) {
                int width, height;
+               int x_count, y_count;
+               int xi, yi;
                int i;
                unsigned char *data;
                unsigned char *dst;
+               unsigned char palette[768];
+               unsigned char *pal = NULL;
+
+               if (argc > 3) {
+                       f = fopen(argv[3], "rb");
+                       if (f) {
+                               fseek(f, -769, SEEK_END);
+                               i = fgetc(f);
+                               if (i == 0x0c) {
+                                       pal = palette;
+                                       fread(pal, 1, 768, f);
+                               }
+                               fclose(f);
+                       }
+               }
 
-               f = fopen(argv[2], "rb");
+               filename = malloc(strlen(argv[2]) + 5);
+               if (!filename) {
+                       printf("Not enough memory!\n");
+                       return -1;
+               }
+
+               strcpy(filename, argv[2]);
+               strcat(filename, ".gob");
+               f = fopen(filename, "rb");
                if (!f) {
-                       printf("Couldn't open file %s\n", argv[2]);
+                       printf("Couldn't open file %s\n", filename);
                        return -1;
                }
                fseek(f, 0, SEEK_END);
@@ -148,55 +238,182 @@ int main(int argc, char **argv)
                width = 0;
                height = 0;
                for (i = 0; i < gob.num_images; i++) {
-                       height += gob.height[i];
+                       if (gob.height[i] > height)
+                               height = gob.height[i];
                        if (gob.width[i] > width)
                                width = gob.width[i];
                }
+               width+=2;
+               height+=2;
 
-               data = malloc(width*height);
-               memset(data, 0, width*height);
-               dst = data;
+               data = malloc(400*256);
+               if (!data) {
+                       printf("Not enough memory!\n");
+                       return -1;
+               }
+               memset(data, 0, 400*256);
 
-               for (i = 0; i < gob.num_images; i++) {
-                       int x,y;
-                       unsigned char *src;
+               x_count = 400 / width;
+               y_count = 256 / width;
+
+               for (yi = 0; yi < y_count; yi++) {
+                       for (xi = 0; xi < x_count; xi++) {
+                               int x,y;
+                               unsigned char *src;
 
-                       src = gob.data[i];
-                       for (y = 0; y < gob.height[i]; y++) {
-                               for (x = 0; x < gob.width[i]; x++) {
-                                       dst[y * width + x] = src[y * gob.width[i] + x];
+                               i = yi * x_count + xi;
+                               if (i >= gob.num_images)
+                                       continue;
+
+                               src = gob.data[i];
+                               dst = &data[(yi * height) * 400 + (xi * width)];
+                               for (y = 0; y < gob.height[i]; y++) {
+                                       for (x = 0; x < gob.width[i]; x++) {
+                                               dst[y * 400 + x] = src[y * gob.width[i] + x];
+                                       }
                                }
                        }
-                       dst += gob.height[i] * width;
                }
                
-               f = fopen(argv[3], "wb");
+               strcpy(filename, argv[2]);
+               strcat(filename, ".pcx");
+               f = fopen(filename, "wb");
                if (!f) {
-                       printf("Couldn't open file %s\n", argv[3]);
+                       printf("Couldn't open file %s\n", filename);
                        return -1;
                }
 
-               write_pcx(f, data, width, height, NULL);
+               write_pcx(f, data, 400, 256, pal);
 
                fclose(f);
 
-               f = fopen(argv[4], "w");
+               strcpy(filename, argv[2]);
+               strcat(filename, ".txt");
+               f = fopen(filename, "w");
                if (!f) {
-                       printf("Couldn't open file %s\n", argv[4]);
+                       printf("Couldn't open file %s\n", filename);
                        return -1;
                }
 
                fprintf(f, "num_images: %i\n\n", gob.num_images);
-               for (i = 0; i < gob.num_images; i++) {
-                       fprintf(f, "width: %i\n", gob.width[i]);
-                       fprintf(f, "height: %i\n", gob.height[i]);
-                       fprintf(f, "hotspot_x: %i\n", -gob.hs_x[i]);
-                       fprintf(f, "hotspot_y: %i\n", -gob.hs_y[i]);
-                       fprintf(f, "\n");
+               for (yi = 0; yi < y_count; yi++) {
+                       for (xi = 0; xi < x_count; xi++) {
+                               
+                               i = yi * x_count + xi;
+                               if (i >= gob.num_images)
+                                       continue;
+
+                               fprintf(f, "image: %i\n", i + 1);
+                               fprintf(f, "x: %i\n", (xi * width));
+                               fprintf(f, "y: %i\n", (yi * height));
+                               fprintf(f, "width: %i\n", gob.width[i]);
+                               fprintf(f, "height: %i\n", gob.height[i]);
+                               fprintf(f, "hotspot_x: %i\n", gob.hs_x[i]);
+                               fprintf(f, "hotspot_y: %i\n", gob.hs_y[i]);
+                               fprintf(f, "\n");
+                       }
                }
 
                fclose(f);
        } else {
+               unsigned char *data;
+               int i;
+               int x_pos, y_pos;
+
+               data = malloc(400*256);
+               if (!data) {
+                       printf("Not enough memory!\n");
+                       return -1;
+               }
+
+               filename = malloc(strlen(argv[1]) + 5);
+               if (!filename) {
+                       printf("Not enough memory!\n");
+                       return -1;
+               }
+
+               strcpy(filename, argv[1]);
+               strcat(filename, ".pcx");
+               f = fopen(filename, "rb");
+               if (!f) {
+                       printf("Couldn't open file %s\n", filename);
+                       return -1;
+               }
+
+               read_pcx(f, data, 400*256, NULL);
+
+               fclose(f);
+
+               strcpy(filename, argv[1]);
+               strcat(filename, ".txt");
+               f = fopen(filename, "r");
+               if (!f) {
+                       printf("Couldn't open file %s\n", filename);
+                       return -1;
+               }
+
+               gob.num_images = 0;
+
+               while (!feof(f)) {
+                       char buffer[1024];
+                       int value;
+
+                       fscanf(f, "%s %i\n", &buffer, &value);
+                       if (strcmp(buffer, "num_images:") == 0) {
+                               if (gob.num_images != 0) {
+                                       printf("Parse error in %s\n", filename);
+                                       return -1;
+                               }
+                               gob.num_images = value;
+                               gob.width = malloc(gob.num_images*sizeof(int));
+                               gob.height = malloc(gob.num_images*sizeof(int));
+                               gob.hs_x = malloc(gob.num_images*sizeof(int));
+                               gob.hs_y = malloc(gob.num_images*sizeof(int));
+                               gob.data = malloc(gob.num_images*sizeof(void *));
+                               gob.orig_data = malloc(gob.num_images*sizeof(void *));
+                       } else if (strcmp(buffer, "image:") == 0) {
+                               i = value - 1;
+                       } else if (strcmp(buffer, "x:") == 0) {
+                               x_pos = value;
+                       } else if (strcmp(buffer, "y:") == 0) {
+                               y_pos = value;
+                       } else if (strcmp(buffer, "width:") == 0) {
+                               gob.width[i] = value;
+                       } else if (strcmp(buffer, "height:") == 0) {
+                               gob.height[i] = value;
+                       } else if (strcmp(buffer, "hotspot_x:") == 0) {
+                               gob.hs_x[i] = value;
+                       } else if (strcmp(buffer, "hotspot_y:") == 0) {
+                               int x, y;
+                               unsigned char *dst;
+
+                               gob.hs_y[i] = value;
+                               gob.orig_data[i] = malloc(gob.width[i] * gob.height[i]);
+                               gob.data[i] = gob.orig_data[i];
+                               dst = gob.data[i];
+                               for (y = 0; y < gob.height[i]; y++) {
+                                       for (x = 0; x < gob.width[i]; x++) {
+                                               dst[y * gob.width[i] + x] = data[(y_pos + y) * 400 + (x_pos + x)];
+                                       }
+                               }
+                       }
+               }
+
+               fclose(f);
+
+               strcpy(filename, argv[1]);
+               strcat(filename, ".gob");
+               f = fopen(filename, "wb");
+               if (!f) {
+                       printf("Couldn't open file %s\n", filename);
+                       return -1;
+               }
+
+               write_gob(f, &gob);
+
+               fclose(f);
+
+               printf("%s build\n", filename);
        }
 
        return 0;