Skip to content

Commit

Permalink
Merge branch 'master' of gitlab.com:4LT/gif2spr
Browse files Browse the repository at this point in the history
  • Loading branch information
4LT committed Apr 28, 2023
2 parents 590460f + c369cae commit ca5ad5b
Show file tree
Hide file tree
Showing 216 changed files with 3,227 additions and 49,707 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
giflib-5.1.4/* linguist-vendored
giflib-5.1.9/* linguist-vendored
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

# Executables
gif2spr
*.exe
gif2spr.exe
gif2spr-gui.exe
*.out
*.app
*.i*86
Expand All @@ -38,4 +39,19 @@ gif2spr

# Generated files
gif2spr.zip
defpal.h

# Generated giflib programs
/giflib-5.1.9/gif2rgb
/giflib-5.1.9/gifbg
/giflib-5.1.9/gifbuild
/giflib-5.1.9/gifclrmp
/giflib-5.1.9/gifcolor
/giflib-5.1.9/gifecho
/giflib-5.1.9/giffilter
/giflib-5.1.9/giffix
/giflib-5.1.9/gifhisto
/giflib-5.1.9/gifinto
/giflib-5.1.9/gifsponge
/giflib-5.1.9/giftext
/giflib-5.1.9/giftool
/giflib-5.1.9/gifwedge
29 changes: 29 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
image: 4lt4/gif2spr-build

stages:
- build

build-linux:
stage: build
script:
- make

build-windows:
stage: build
script:
- make TARGET_PLAT=win32 win-gui
artifacts:
name: "gif2spr-$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- gif2spr.exe
- gif2spr-gui.exe
- LICENSE.txt
- LICENSE_3rd_party
- README.md
- THANKS.md

# run tests using the binary built before
# test:
# stage: test
# script:
# - ./runmytests.sh
24 changes: 24 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
File renamed without changes.
38 changes: 38 additions & 0 deletions LICENSE_3rd_party/itcl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This software is copyrighted by Lucent Technologies, Inc., and other
parties. The following terms apply to all files associated with the
software unless explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.

GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
38 changes: 38 additions & 0 deletions LICENSE_3rd_party/tclvfs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This software is copyrighted by the Vince Darley, and other
parties. The following terms apply to all files associated with the
software unless explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.

GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
26 changes: 26 additions & 0 deletions LICENSE_3rd_party/vqtcl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This software is copyrighted by Jean-Claude Wippler and Equi4 Software and others.
The following terms apply to all files associated with the software
unless explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
105 changes: 68 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,70 +1,101 @@
GIFLIB=giflib-5.1.4
CFLAGS := -std=c99 -Wall -pedantic -ggdb
LOCAL_OBJECTS= main.o sprite.o
GIFLIB_OBJECTS= $(GIFLIB)/lib/dgif_lib.o $(GIFLIB)/lib/gif_err.o \
$(GIFLIB)/lib/gif_hash.o $(GIFLIB)/lib/gifalloc.o \
$(GIFLIB)/lib/openbsd-reallocarray.o
OBJECTS := $(LOCAL_OBJECTS)

ifeq ($(findstring CYGWIN, $(shell uname)), CYGWIN)
GIFLIB=giflib-5.1.9
BASECFLAGS=-std=c99
DBGCFLAGS=-Wall -pedantic -ggdb
RELEASECFLAGS=-O2
LOCAL_OBJECTS=main.o sprite.o
#GIFLIB_OBJECTS= $(GIFLIB)/dgif_lib.o $(GIFLIB)/gif_err.o \
# $(GIFLIB)/gif_hash.o $(GIFLIB)/gifalloc.o \
# $(GIFLIB)/openbsd-reallocarray.o
GIFLIB_A=$(GIFLIB)/libgif.a
OBJECTS :=$(LOCAL_OBJECTS)
TARGET_PLAT=$(shell uname)
HOST_PLAT=$(shell uname)
SDX=sdx.kit

ifeq ($(findstring CYGWIN,$(TARGET_PLAT)), CYGWIN)
WIN=1
NIX=1
else ifeq ($(findstring win32,$(TARGET_PLAT)), win32)
WIN=1
NIX=0
else ifeq ($(findstring MINGW,$(TARGET_PLAT)), MINGW)
WIN=1
NIX=0
else
WIN=0
NIX=0
endif

ifeq ($(WIN),1)
COMPILE_GIFLIB=true
OUTPUT=gif2spr.exe
CC=i686-w64-mingw32-gcc
else
OUTPUT=gif2spr
endif

ifeq ($(WIN)$(NIX),10)
CC=x86_64-w64-mingw32-gcc
LD=x86_64-w64-mingw32-ld
AR=x86_64-w64-mingw32-ar
else
OUTPUT=gif2spr
CC=cc
LD=ld
AR=ar
endif

ifeq ($(shell uname), Darwin)
COMPILE_GIFLIB=true
else
LDFLAGS := $(LD_FLAGS) -lm
LDFLAGS :=$(LD_FLAGS) -lm
endif

ifdef DEBUG
CFLAGS :=$(BASECFLAGS) $(DBGCFLAGS)
else
CFLAGS :=$(BASECFLAGS) $(RELEASECFLAGS)
endif

ifdef COMPILE_GIFLIB
CFLAGS := $(CFLAGS) -DCOMPILE_GIFLIB
OBJECTS := $(OBJECTS) $(GIFLIB_OBJECTS)
CFLAGS :=$(CFLAGS) -DCOMPILE_GIFLIB
OBJECTS :=$(OBJECTS) $(GIFLIB_A)
else
LDFLAGS := $(LDFLAGS) -lgif
LDFLAGS :=$(LDFLAGS) -lgif
endif

.PHONY: all clean clean-giflib package
.PHONY: all clean clean-giflib win-package win-gui

all: $(OUTPUT)

$(GIFLIB_OBJECTS): $(GIFLIB)/Makefile
$(MAKE) -C $(GIFLIB) SUBDIRS=lib

$(GIFLIB)/Makefile:
cd $(GIFLIB) && \
CC=$(CC) ./configure
$(GIFLIB_A): $(GIFLIB)/Makefile
$(MAKE) -C $(GIFLIB) CC=$(CC) LD=$(LD) AR=$(AR) libgif.a

defpal.h: defpal.h_head defpal.h_foot quakepal
xxd -i quakepal \
| sed 's/\(^.*\)quakepal/static \1 const DEFPAL/' \
| sed 's/^unsigned\ int.*//' \
| cat defpal.h_head - defpal.h_foot \
> defpal.h

main.o: main.c defpal.h sprite.h
main.o: main.c quakepal.h sprite.h
$(CC) $(CFLAGS) -c main.c

sprite.o: sprite.c sprite.h
$(CC) $(CFLAGS) -c sprite.c

$(OUTPUT): $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT) $(OBJECTS)
$(CC) $(LDFLAGS) -o $(OUTPUT) $(OBJECTS)

win-package: gif2spr.zip

gif2spr.zip: COPYING README.md gif2spr.exe gif2spr-gui.exe
zip gif2spr.zip COPYING README.md gif2spr.exe gif2spr-gui.exe

package: gif2spr.zip
win-gui: gif2spr-gui.exe

gif2spr.zip: COPYING README.md $(OUTPUT)
zip gif2spr.zip COPYING README.md $(OUTPUT)
gif2spr-gui.exe: gif2spr.exe
$(SDX) qwrap gif2spr-gui.tcl gif2spr-gui -runtime tclkit-gui.exe &&\
mv gif2spr-gui gif2spr-gui.exe

clean-giflib:
make -C $(GIFLIB) -f Makefile distclean
make -C $(GIFLIB) -f Makefile clean

clean:
clean: clean-giflib
rm -f $(LOCAL_OBJECTS)
rm -f $(OUTPUT)
rm -f defpal.h
rm -f gif2spr
rm -f gif2spr.exe
rm -f gif2spr.zip
rm -f gif2spr-gui.exe
53 changes: 50 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
gif2spr
=======

A utility for converting animated GIF images to Quake sprites.
A utility for converting animated GIF images to Quake and Half-Life sprites.

by Seth "4LT" Rader

MOVED TO https://www.gitlab.com/4LT/gif2spr
-------------------------------------------
How to Use
==========

CLI
---

`gif2spr`

Output usage to stderr.

`gif2spr GIFFILE SPRFILE`

Converts a GIF file to a Quake sprite using default settings.

`gif2spr -hl -dummy GIFFILE SPRFILE`

Converts a GIF file to a Half-Life sprite using default settings, appending a "dummy" frame to the end to (required hack for Half-Life, omit `-dummy` for Sven Co-op sprites).

`gif2spr -align ALIGNMENT GIFFILE SPRFILE`

Creates a sprite with a specified alignment type, one of:
* vp-parallel - Always facing the player. (default)
* upright - Facing the player's XY position, but always upright.
* oriented - Always facing the same direction.

`gif2spr -origin X,Y GIFFILE SPRFILE`

Creates a sprite that is centered on the (X, Y) position of the image. 0,0 centers the sprite on the lower left of the image, and 1,1 centers the sprite on the upper right. The default value is 0.5,0.5.

`gif2spr -palette PALFILE GIFFILE SPRFILE`

Creates a sprite, but color quantization is performed matching the colors from a given file instead of the default Quake palette. The palette format is the same as the palette lump used in Quake: 256 RGB triplets, 8 bits per component.

GUI
---

Run `gif2spr-gui.tcl` on Linux, or `gif2spr-gui.exe` on Windows.

Building
========

Run `make` to create a standalone executable for the CLI on Linux. To install, just copy gif2spr to `/usr/local/bin` or `/usr/bin`.

Run `make TARGET_PLAT=win32 win-gui` to build CLI/GUI for Windows. Make sure the generated executables are in the same directory for the GUI to work.

Source Code
===========

Available at https://github.com/4LT/gif2spr
Loading

0 comments on commit ca5ad5b

Please sign in to comment.