├── .gitignore ├── ChangeLog ├── INSTALL ├── LICENSE ├── Makefile ├── Makefile.beos ├── Makefile.osx ├── Makefile.w32 ├── README ├── README.SDL ├── README.ifyoumakechanges ├── README.themes ├── TODO ├── atom.bmp ├── benchmark.c ├── benchmark.h ├── blocks.ibt ├── bwop.wav ├── cheese.ibt ├── cow.bmp ├── cows.ibt ├── crash.wav ├── cursor.c ├── cursor.h ├── delay.c ├── delay.h ├── dialog.c ├── dialog.h ├── drum.wav ├── event.c ├── event.h ├── ewww.wav ├── fullscreen.c ├── fullscreen.h ├── globals.h ├── grid.c ├── grid.h ├── hiscore.c ├── hiscore.h ├── icebreaker.c ├── icebreaker.desktop ├── icebreaker.h ├── icebreaker.man.in ├── icebreaker.nsi.in ├── icebreaker.spec ├── icebreaker_128.png ├── icebreaker_16c.ico ├── icebreaker_32.ico ├── icebreaker_48.bmp ├── intro.c ├── intro.h ├── jz-like.ibt ├── kitty.bmp ├── kitty.ibt ├── laundry.c ├── laundry.h ├── level.c ├── level.h ├── line.c ├── line.h ├── linux.ibt ├── lock.c ├── lock.h ├── menu.c ├── menu.h ├── metainfo.xml ├── misc.c ├── misc.h ├── moo.wav ├── mouse-r.bmp ├── mouse.bmp ├── nbwoanp.wav ├── options.c ├── options.h ├── ouch.wav ├── penguin.bmp ├── penguin.c ├── penguin.h ├── penguinicon_32.bmp ├── phase.wav ├── pop.wav ├── screenshot-level5-jz-like.png ├── screenshot-mid-game.png ├── screenshot-title.png ├── screenshots ├── icebreaker1.png ├── icebreaker2.png └── icebreaker3.png ├── scrunch.wav ├── sound.c ├── sound.h ├── splash.wav ├── splat.wav ├── squeak.wav ├── star.bmp ├── stars.ibt ├── status.c ├── status.h ├── tap.wav ├── text.c ├── text.h ├── themes.c ├── themes.h ├── titlebar.c ├── titlebar.h ├── transition.c ├── transition.h ├── turtle.bmp ├── turtles.ibt ├── win32_compatibility.c ├── win32_compatibility.h ├── win32_resources.rc └── woodblock.bmp /.gitignore: -------------------------------------------------------------------------------- 1 | icebreaker 2 | icebreaker.6 3 | *.xz 4 | *.zip 5 | *.exe 6 | *.nsi 7 | *.rpm 8 | *.[od] -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | July 13, 2023: released 2.2.2 2 | - fix a not-likely but potetially real string overflow from my year-2000 3 | (yes, the irony!) assumption that integers won't possibly be bigger than 4 | the size of a 32 bit number. 5 | 6 | October 2nd, 2021: released 2.2.1 7 | - minor build improvements from Reiner Herrmann (thanks!) 8 | - keywords in desktop file (also thanks Reiner!) 9 | 10 | March 1st, 2021: released 2.2.0 11 | - clean up some more buffer overflows 12 | - add AppStream metainfo 13 | - make Windows build work for first time in a decade 14 | 15 | August 31, 2020: released 2.1.0 16 | - clean up a bunch of buffer overflows 17 | - make build on Fedora 32 without warnings 18 | 19 | August 30, 2020: released 2.0.0 20 | - hey, let's just release this already. 21 | - move high score to home directory. 22 | - don't install setguid games. 23 | - fix some bad snprintf() calls. ("fix") 24 | - help wanted with windows and mac ports! 25 | - help wanted with porting to SDL 2.x! 26 | 27 | November 16, 2006: unreleased 1.9.8 28 | - win32 version now uses registry for configuration options 29 | - some other minor tweaks 30 | 31 | June 8, 2002: released 1.9.7 32 | - game loop timing more precise -- now busy-waits if need be (but still 33 | tries to sleep when possible). This will improve game speed on slower 34 | systems. 35 | - now sets initial username to that of logged-in user in win32, instead 36 | of defaulting to "Nobody". 37 | - username length can be whatever happens to fit the dialog (depends on 38 | character width) instead of being limited to 12 regardless of size 39 | - minor cleanup 40 | - tweaking of theme sounds 41 | 42 | May 31, 2002: released 1.9.6 43 | - decreased score factor in Easy mode. Don't be a wimp. 44 | - changed sounds to 22050Hz -- this will allow better high-pitched effects 45 | - changed default chunksize from 256 to 1024 -- this'll put alway the bad 46 | sound-echo bug on some systems. 47 | - minor memory leak cleanup in theme switching 48 | - menu handler and dialog code cleanup 49 | - right-clicking in options menu now cycles backwards, and right-clicking 50 | on non-options menu items does nothing. scroll wheel cycles options 51 | - arrow keys move around playing field 52 | - keyboard now works in menu; other keyboard cleanup 53 | - added a few new sounds 54 | - beep (ouch, actually) on errors in high-score-name entry dialog 55 | 56 | May 27, 2002: released 1.9.5 (public beta) 57 | - little bits of code cleanup 58 | - slightly increase bonus for clearing more than 80 on higher levels to 59 | help counteract the fact that having more penguins make that more and 60 | more impossible 61 | 62 | May 26, 2002: released v1.9.4 63 | - mouse cursor code cleanup 64 | - made it so broken line sound doesn't play if that sound was last 65 | started playing less than 30ms ago -- that way if two lines are broken 66 | at once, the sound isn't double loud (but this still needs work -- 67 | proper behavior would be to play the sound with a slight delay) 68 | - fixed race condition in readhiscore()/checkhiscore()/addhiscore() -- 69 | added file locking (thanks Enrico!) 70 | - fixed memory leak in theme-sound-switching 71 | - fixed draw bug in autopause mode 72 | - no gameover if game is terminated/restarted before you've done anything 73 | - added confirm dialog for changing difficulty level 74 | - cleanup in dialog.c -- theme switching code now not quite so ugly 75 | (redraw bug when both theme and difficulty were changed) 76 | - added NSIS install script to generate Win32 installer. See: 77 | . It's open source software, but as 78 | far as I can tell there's no native Linux version yet. Luckily, runs 79 | under Wine. If anyone knows of a port, let me know. 80 | - mucking with some makefile stuff to make it easier to build on OS X or 81 | BeOS. More to come on that front. 82 | 83 | May 23, 2002: released v1.9.3 84 | - -b option for benchmark mode (will be disabled in stable releases). 85 | - added command line options for themes 86 | - added README.themes 87 | - moved some of the stuff from the event loop in the main level function to 88 | helper functions. It's still pretty ugly, but this tiny bit of cleanup 89 | made it much easier to do the next thing on this list: 90 | - added basic keyboard support: 91 | * ESC to exit full-screen mode and to cancel menus. 92 | * SPACE or X or . for toggle direction 93 | * ENTER or Z or , for start lines 94 | - made srandom use pid in addition to current time -- wouldn't want to 95 | have the exact same game twice at once 96 | - tweaked makefile for better cross-compiling and dist. package generation 97 | - fixed fullscreen command-line option for case when config file doesn't 98 | exist (and made the code better in the process) 99 | - special "random" theme that actually causes theme to be chosen at random 100 | - you can now define a "mirror" sprite to provide different images 101 | depending on left/right direction 102 | - BeOS compatibility stuff -- should be mostly un-broken now 103 | 104 | May 19, 2002: released v1.9.2 105 | - added command-line options for sound, fullscreen mode, help, and version 106 | - more themes! 107 | - made 'gridhighlight' for themes, allowing pseudo-3d (button-style) 108 | blocks 109 | - full-screen mode now actually 640x480. This should make it work on 110 | more platforms, and gives us a place to put a titlebar showing the 111 | current level 112 | - added erasepenguin routine -- fix some leaking surfaces 113 | - improved text-handling routines -- scores in the transitions between 114 | levels and at the end of the game are now centered properly, and the 115 | highscore scroller at the beginning is done much more nicely 116 | 117 | 118 | May 16, 2002: released v1.9.1 119 | - first cut at themes 120 | - lack of object-oriented design forced me to create more global 121 | variables. someday in the far future, this will become a C++ project. 122 | - now can coexist with Winamp on win32 -- not sure if this is because 123 | of fixes in SDL 1.2.4, or in the Winamp 2.80. It wasn't anything I did, 124 | but hey, now you can listen to music while you play. 125 | - linked against much smaller version of SDL_mixer DLL for win32 -- 126 | should cut the distribution archive in half or better. 127 | - cleanup in the transition screen routines 128 | - kludge around broken _snprintf in mingw32 -- cures potential overflow 129 | - minor cleanup in the text routines 130 | 131 | 132 | August 30, 2001: released v1.9.0 133 | - no significant changes; just starting new devel branch 134 | 135 | July 30, 2001: released v1.2.1 136 | - fixed minor bug where highest-score line cut off letters that dip below 137 | the baseline (gjpqy...). Thanks to Jonathan DePrizio for catching this. 138 | - tiny little bugfixes, makefile cleanup 139 | - switched to much more sensible linux-kernel-style numbering scheme. 140 | (n.oddnumber.n for development releases, and n.evenumber.n for 141 | stable "production" releases -- for example, 1.2.1 is a stable release, 142 | so any excitement/surprises should come from the game, not from 143 | bugs. 1.9.0 will be a devel release, and some features may not work 144 | completely, or at all.) 145 | 146 | July 28, 2001: released v1.2 147 | - added "score decay" timer, to discourage obsessive-compulsive types from 148 | taking hours on one level. Sure, I want you to be obsessed with the 149 | game, but have fun playing, not tediously waiting. :) 150 | - added easy and hard difficulty settings 151 | - added options for sound 152 | - added option for auto pause (which makes the game stop when the window 153 | loses focus -- note that it always pauses when minimized regardless of 154 | this setting). 155 | - now, when a line is stuck (against another line) for a long time, 156 | the line completes instead of exploding. ("A long time" == approximately 157 | 5 seconds) 158 | - merged in Enrico Tassi's win32 compatibility stuff -- win32 version 159 | is now completely functional, except: 160 | - added fullscreen option! (Unfortunately, still has problems in Win32, 161 | so you'll have to edit the icebreaker.cfg manually if you want to enable 162 | this feature on a MS Windows system. I'll get the problem figured out 163 | for a future release.) 164 | - fixed busy waits in dialog.c (thanks again to Enrico) 165 | - code cleanup 166 | 167 | July 23, 2001: released v1.1 168 | - added man page 169 | - tiny change to error message when high score file can't be read 170 | 171 | July 18, 2001: released v1.09 172 | - Gameplay change: changed behavior when a line hits another 173 | partially-completed line -- now, instead of the line completing 174 | successfully, it waits until the other completes or is destroyed. In 175 | the event that neither of those happens after a little while, new line 176 | dies. (I've considered making it complete successfully in this case; 177 | opinions, anyone?) This change makes the game much harder, in a good way. 178 | - moved center of vertical cursor to proper location (oops) 179 | - modified high score code to reread from disk, so that multiple players 180 | on the same system don't cause confusion. A race condition still exists, 181 | but it's much narrower. :) A future version will have proper locking. 182 | - include fix for cmpscore bug thanks to Enrico Tassi 183 | 184 | October 5, 2000: released v1.0 185 | - one-point-oh! 186 | 187 | October 3, 2000: released v0.995 188 | - minor cosmetic fixes 189 | - made 'make install' work; made it easier to redefine file locations 190 | - made it so three-decimal-place version numbers work :) 191 | - made level 100 loop forever instead of just ending the game there. 192 | not that level 100 is any fun, really -- too many penguins! 193 | 194 | October 2, 2000: released v0.98 195 | - first public release 196 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | The easiest way to install this is via RPM. If the binary RPM doesn't work 2 | on your system, or you don't trust it, just download the src.rpm and rebuild 3 | it. (If you've never done that before, don't worry -- it's actually 4 | amazingly easy -- just do "rpm --rebuild icebreaker.src.rpm".) 5 | 6 | You can of course also install from Plain Old Source. You should be able to 7 | just do "make", and then as root, "make install". You'll need the SDL 8 | libraries from , if you don't have them already. 9 | 10 | Note that if you don't have the data files in the right place ("make 11 | install" should do it), the game will crash ignominiously on startup. 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | 3 | PKG_CONFIG ?= pkg-config 4 | 5 | ifndef prefix 6 | prefix=/usr/local 7 | #prefix=/usr 8 | endif 9 | 10 | ifndef datadir 11 | datadir=$(prefix)/share 12 | endif 13 | 14 | ifndef mandir 15 | mandir=$(prefix)/share/man 16 | endif 17 | 18 | ifndef bindir 19 | bindir=$(prefix)/bin 20 | endif 21 | 22 | 23 | CFLAGS+=-Wall -Werror $(OPTIMIZE) $(SDL_CFLAGS) -DDATAPREFIX=\"$(datadir)/icebreaker\" 24 | 25 | SRC=icebreaker.c cursor.c grid.c laundry.c line.c penguin.c sound.c \ 26 | level.c intro.c text.c status.c transition.c hiscore.c dialog.c \ 27 | menu.c options.c fullscreen.c themes.c event.c titlebar.c benchmark.c \ 28 | misc.c lock.c delay.c 29 | 30 | DISTFILES=$(wildcard *.c *.h *.bmp *.png *.ibt *.wav *.sh *.rc *.ico *.desktop *.man.in *.nsi.in *.spec README* TODO LICENSE INSTALL ChangeLog Makefile*) 31 | 32 | SDL_MIXER := $(shell $(PKG_CONFIG) SDL_mixer --libs) 33 | SDL_LIB=$(SDL_MIXER) $(SDL_LDFLAGS) 34 | SDL_CFLAGS := $(shell $(PKG_CONFIG) sdl --cflags) 35 | SDL_LDFLAGS := $(shell $(PKG_CONFIG) sdl --libs) 36 | VERSION := $(shell awk '/^#define VERSION/ { print $$3 }' icebreaker.h) 37 | VERDATE := $(shell LC_ALL=C date -u -r icebreaker.h +"%d %B %Y") 38 | 39 | WINARCH=i686 40 | CROSSTOOLSPATH=/usr/$(WINARCH)-w64-mingw32 41 | UNIX2DOS=unix2dos 42 | MAKENSIS=makensis 43 | WINDLLS=SDL.dll SDL_mixer.dll libgcc_s_dw2-1.dll libvorbisfile-3.dll libvorbis-0.dll libogg-0.dll libssp-0.dll libwinpthread-1.dll 44 | export WINARCH 45 | 46 | RPMARCH := $(shell rpm --eval %{_arch} ) 47 | RPMOPTS= 48 | RPMCRAZYDEFINES := --define "_topdir %(pwd)/rpmbuild" --define "_sourcedir %(pwd)" --define "_specdir %(pwd)" --define "_tmppath %(pwd)/rpmbuild/tmp/" --define "_builddir %(pwd)/rpmbuild/build/" --define "_rpmdir %(pwd)" --define "_srcrpmdir %(pwd)" --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" 49 | 50 | ifneq ($(VERSION),$(shell awk '/^Version:/ { print $$2 }' icebreaker.spec)) 51 | $(error Version in spec file doesn't match version in icebreaker.h! ) 52 | endif 53 | 54 | RPMRELEASE := $(shell awk '/^Release:/ { print $$2 }' icebreaker.spec) 55 | PRERELEASE := $(shell awk '/^Release:/ { print $$2 }' icebreaker.spec | grep pre) 56 | 57 | ifneq ($(strip $(PRERELEASE)),) 58 | ifeq ($(shell awk '/^%define.*isprerelease/ { print $$3 }' icebreaker.spec),0) 59 | $(error .spec file has -pre release tag, but sets "isprerelease" to 0. Fix that) 60 | endif 61 | ifndef OPTIMIZE 62 | OPTIMIZE=-g 63 | endif 64 | VERSIONSTRING := $(VERSION)-$(PRERELEASE) 65 | $(warning Building prerelease version.) 66 | else 67 | ifeq ($(shell awk '/^%define.*isprerelease/ { print $$3 }' icebreaker.spec),1) 68 | $(error .spec file has final release tag, but sets "isprerelease" to 1. Fix that) 69 | endif 70 | ifndef OPTIMIZE 71 | OPTIMIZE=-O2 72 | endif 73 | VERSIONSTRING := $(VERSION) 74 | endif 75 | 76 | 77 | all: icebreaker man 78 | 79 | .PHONY: clean 80 | clean: 81 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 82 | [ -d rpmbuild ] && rm -rf rpmbuild || true 83 | [ -d win32.build ] && rm -rf win32.build || true 84 | -rm -f icebreaker 85 | -rm -f icebreaker.6 86 | -rm -f icebreaker.nsi 87 | -rm -f *.o 88 | -rm -f *.d 89 | -rm -f *.tar.xz 90 | -rm -f *.zip 91 | -rm -f *.exe 92 | -rm -f *.rpm 93 | 94 | dist: tgz win32 rpm 95 | ls -lh --color=yes icebreaker-$(VERSION)* 96 | 97 | tgz: icebreaker-$(VERSIONSTRING).tar.xz 98 | 99 | icebreaker-$(VERSIONSTRING).tar.xz: $(DISTFILES) 100 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 101 | mkdir icebreaker-$(VERSIONSTRING) 102 | cp -p * icebreaker-$(VERSIONSTRING) || true 103 | (cd icebreaker-$(VERSIONSTRING); make clean) 104 | tar cJf icebreaker-$(VERSIONSTRING).tar.xz icebreaker-$(VERSIONSTRING) 105 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 106 | tar tf icebreaker-$(VERSIONSTRING).tar.xz 107 | 108 | rpm: srcrpm binrpm 109 | 110 | srcrpm: icebreaker-$(VERSION)-$(RPMRELEASE).src.rpm 111 | binrpm: $(RPMARCH)rpm 112 | $(RPMARCH)rpm: icebreaker-$(VERSION)-$(RPMRELEASE).$(RPMARCH).rpm 113 | 114 | icebreaker-$(VERSION)-$(RPMRELEASE).src.rpm: icebreaker-$(VERSIONSTRING).tar.xz icebreaker.spec 115 | [ -d rpmbuild ] && rm -rf rpmbuild || true 116 | mkdir -p rpmbuild/tmp 117 | rpmbuild $(RPMCRAZYDEFINES) -bs icebreaker.spec 118 | [ -d rpmbuild ] && rm -rf rpmbuild || true 119 | 120 | icebreaker-$(VERSION)-$(RPMRELEASE).$(RPMARCH).rpm: icebreaker-$(VERSIONSTRING).tar.xz icebreaker.spec 121 | [ -d rpmbuild ] && rm -rf rpmbuild || true 122 | mkdir -p rpmbuild/tmp; mkdir -p rpmbuild/build 123 | rpmbuild $(RPMCRAZYDEFINES) -bb icebreaker.spec 124 | [ -d rpmbuild ] && rm -rf rpmbuild || true 125 | 126 | win32: icebreaker-$(VERSIONSTRING).exe 127 | 128 | icebreaker-$(VERSIONSTRING).exe: icebreaker.nsi icebreaker-$(VERSIONSTRING).zip 129 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 130 | unzip -b icebreaker-$(VERSIONSTRING).zip 131 | touch icebreaker-$(VERSIONSTRING)/lockhelper.lck 132 | (cd icebreaker-$(VERSIONSTRING); \ 133 | $(MAKENSIS) -NOCD -INPUTCHARSET UTF8 ../icebreaker.nsi; \ 134 | test -f icebreaker-$(VERSIONSTRING).exe) 135 | mv -f icebreaker-$(VERSIONSTRING)/icebreaker-$(VERSIONSTRING).exe icebreaker-$(VERSIONSTRING).exe 136 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 137 | ls -l icebreaker-$(VERSIONSTRING).exe 138 | 139 | zip: icebreaker-$(VERSIONSTRING).zip 140 | 141 | icebreaker-$(VERSIONSTRING).zip: icebreaker.exe icebreaker-$(VERSIONSTRING).tar.xz 142 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 143 | mkdir icebreaker-$(VERSIONSTRING) 144 | cp icebreaker.exe icebreaker-$(VERSIONSTRING) 145 | cp icebreaker-$(VERSIONSTRING).tar.xz icebreaker-$(VERSIONSTRING)/icebreaker-$(VERSIONSTRING)-src.tar.xz 146 | for dll in $(WINDLLS); do cp $(CROSSTOOLSPATH)/sys-root/mingw/bin/$$dll icebreaker-$(VERSIONSTRING); done 147 | cp *.wav icebreaker-$(VERSIONSTRING) 148 | cp *.bmp icebreaker-$(VERSIONSTRING) 149 | cp *.png icebreaker-$(VERSIONSTRING) 150 | for i in *.ibt; do $(UNIX2DOS) -n $$i icebreaker-$(VERSIONSTRING)/$$i; done 151 | $(UNIX2DOS) -n ChangeLog icebreaker-$(VERSIONSTRING)/ChangeLog.txt 152 | $(UNIX2DOS) -n LICENSE icebreaker-$(VERSIONSTRING)/LICENSE.txt 153 | $(UNIX2DOS) -n README icebreaker-$(VERSIONSTRING)/README.txt 154 | $(UNIX2DOS) -n README.SDL icebreaker-$(VERSIONSTRING)/README-SDL.txt 155 | $(UNIX2DOS) -n README.themes icebreaker-$(VERSIONSTRING)/README-themes.txt 156 | $(UNIX2DOS) -n TODO icebreaker-$(VERSIONSTRING)/TODO.txt 157 | zip -r icebreaker-$(VERSIONSTRING).zip icebreaker-$(VERSIONSTRING) 158 | [ -d icebreaker-$(VERSIONSTRING) ] && rm -rf icebreaker-$(VERSIONSTRING) || true 159 | unzip -t icebreaker-$(VERSIONSTRING).zip 160 | 161 | beos: 162 | make -f Makefile.beos 163 | 164 | osx: 165 | make -f Makefile.osx 166 | 167 | icebreaker.exe: $(DISTFILES) 168 | [ -f $(CROSSTOOLSPATH)/sys-root/mingw/bin/SDL.dll ] 169 | [ -d win32.build ] && rm -rf win32.build || true 170 | mkdir win32.build 171 | cp -p * win32.build || true 172 | (cd win32.build; make clean; make -f Makefile.w32; mv icebreaker.exe ..) 173 | [ -d win32.build ] && rm -rf win32.build || true 174 | 175 | icebreaker: $(SRC:.c=.o) 176 | $(CC) $(CFLAGS) $^ -o icebreaker $(SDL_LIB) $(LDFLAGS) 177 | 178 | man: icebreaker.6 179 | 180 | %.nsi: %.nsi.in icebreaker.spec icebreaker.h 181 | sed 's/\%ICEBREAKERVERSION/$(VERSIONSTRING)/' $< > $@ 182 | 183 | %.6: %.man.in 184 | sed 's/\$$VERSION/$(VERSION)/' $< | \ 185 | sed 's/\$$VERDATE/$(VERDATE)/' > $@ 186 | 187 | install-mkdirs: 188 | install -m 755 -d $(datadir)/icebreaker 189 | install -m 755 -d $(bindir) 190 | install -m 755 -d $(mandir)/man6 191 | 192 | themes-install: install-themes 193 | 194 | install-themes: install-mkdirs 195 | install -m 644 *.ibt $(datadir)/icebreaker 196 | install -m 644 *.wav *.bmp *.png $(datadir)/icebreaker 197 | 198 | install-bin: install-mkdirs icebreaker 199 | install -m 755 icebreaker $(bindir) 200 | 201 | install-man: install-mkdirs icebreaker.6 202 | install -m 644 icebreaker.6 $(mandir)/man6 203 | 204 | install: all install-mkdirs install-themes install-bin install-man 205 | 206 | %.d: %.c 207 | set -e; $(CC) -M $(CFLAGS) $< \ 208 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ 209 | [ -s $@ ] || rm -f $@ 210 | 211 | include $(SRC:.c=.d) 212 | -------------------------------------------------------------------------------- /Makefile.beos: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | 3 | SDLCONFIG=sdl-config 4 | 5 | ifndef datadir 6 | datadir=. 7 | endif 8 | 9 | ifndef highscoredir 10 | highscoredir=. 11 | endif 12 | 13 | CFLAGS=-Wall $(OPTIMIZE) $(SDL_CFLAGS) -DDATAPREFIX=\"$(datadir)\" -DHISCOREPREFIX=\"$(highscoredir)\" 14 | 15 | SRC=icebreaker.c cursor.c grid.c laundry.c line.c penguin.c sound.c \ 16 | level.c intro.c text.c status.c transition.c hiscore.c dialog.c \ 17 | menu.c options.c fullscreen.c themes.c event.c titlebar.c benchmark.c \ 18 | misc.c lock.c delay.c 19 | 20 | SDL_MIXER=-lSDL_mixer 21 | SDL_LIB=$(SDL_MIXER) $(SDL_LDFLAGS) 22 | SDL_CFLAGS := $(shell $(SDLCONFIG) --cflags) 23 | SDL_LDFLAGS := $(shell $(SDLCONFIG) --libs) 24 | 25 | all: icebreaker 26 | 27 | icebreaker: $(SRC:.c=.o) 28 | $(CC) $(CFLAGS) $^ -o icebreaker $(SDL_LIB) 29 | 30 | %.d: %.c 31 | set -e; $(CC) -M $(CFLAGS) $< \ 32 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ 33 | [ -s $@ ] || rm -f $@ 34 | 35 | include $(SRC:.c=.d) 36 | -------------------------------------------------------------------------------- /Makefile.osx: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | 3 | SDLCONFIG=sdl-config 4 | 5 | ifndef datadir 6 | datadir=. 7 | endif 8 | 9 | ifndef highscoredir 10 | highscoredir=. 11 | endif 12 | 13 | 14 | CFLAGS=-Wall $(OPTIMIZE) $(SDL_CFLAGS) -DDATAPREFIX=\"$(datadir)\" -DHISCOREPREFIX=\"$(highscoredir)\" 15 | 16 | SRC=icebreaker.c cursor.c grid.c laundry.c line.c penguin.c sound.c \ 17 | level.c intro.c text.c status.c transition.c hiscore.c dialog.c \ 18 | menu.c options.c fullscreen.c themes.c event.c titlebar.c benchmark.c \ 19 | misc.c lock.c delay.c 20 | 21 | SDL_MIXER=-lSDL_mixer 22 | SDL_LIB=$(SDL_MIXER) $(SDL_LDFLAGS) 23 | SDL_CFLAGS := $(shell $(SDLCONFIG) --cflags) 24 | SDL_LDFLAGS := $(shell $(SDLCONFIG) --libs) 25 | 26 | all: icebreaker 27 | 28 | icebreaker: $(SRC:.c=.o) 29 | $(CC) $(CFLAGS) $^ -o icebreaker $(SDL_LIB) 30 | 31 | %.d: %.c 32 | set -e; $(CC) -M $(CFLAGS) $< \ 33 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ 34 | [ -s $@ ] || rm -f $@ 35 | 36 | include $(SRC:.c=.d) 37 | -------------------------------------------------------------------------------- /Makefile.w32: -------------------------------------------------------------------------------- 1 | # standard path for mingw32 cross compiler 2 | # see 3 | CROSSTOOLSPATH=/usr/$(WINARCH)-w64-mingw32 4 | MINGW32BIN=$(CROSSTOOLSPATH)/bin 5 | 6 | CC=$(WINARCH)-w64-mingw32-gcc 7 | WINDRES=$(WINARCH)-w64-mingw32-windres 8 | 9 | SDLCONFIG=$(CROSSTOOLSPATH)/sys-root/mingw/bin/sdl-config 10 | 11 | ifndef OPTIMIZE 12 | OPTIMIZE=-O2 13 | endif 14 | 15 | CFLAGS=-Wall -Werror -Wno-error=pointer-sign $(OPTIMIZE) $(SDL_CFLAGS) -DDATAPREFIX=\".\" -DHISCOREPREFIX=\".\" -DWIN32 -fstack-protector 16 | 17 | SRC=icebreaker.c cursor.c grid.c laundry.c line.c penguin.c sound.c \ 18 | level.c intro.c text.c status.c transition.c hiscore.c dialog.c \ 19 | menu.c options.c fullscreen.c themes.c event.c titlebar.c benchmark.c \ 20 | misc.c lock.c delay.c \ 21 | win32_compatibility.c 22 | 23 | RES=win32_resources.rc 24 | 25 | SDL_MIXER=-lSDL_mixer 26 | SDL_LIB=$(SDL_LDFLAGS) $(SDL_MIXER) 27 | SDL_CFLAGS := $(shell $(SDLCONFIG) --cflags) 28 | SDL_LDFLAGS := $(shell $(SDLCONFIG) --libs) 29 | 30 | 31 | all: icebreaker.exe 32 | 33 | %.d: %.c 34 | set -e; $(CC) -M $(CFLAGS) $< \ 35 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ 36 | [ -s $@ ] || rm -f $@ 37 | 38 | %.o:%.rc 39 | $(WINDRES) $< $(subst .rc,.o,$<) 40 | 41 | icebreaker.exe: $(SRC:.c=.o) $(RES:.rc=.o) 42 | $(CC) $(CFLAGS) $^ -o $@ $(SDL_LIB) 43 | 44 | 45 | include $(SRC:.c=.d) 46 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | WHAT: 2 | 3 | So, uh, there's a bunch of penguins on an iceberg in Antarctica. You have 4 | been selected to catch them so they can be shipped to Finland, where they 5 | are essential to a secret plot for world domination. 6 | 7 | In order to trap the penguins, you'll need to break the iceberg into small 8 | chunks. (They're afraid of water, for no apparent reason. Ah well. "The 9 | Matrix" had more plot holes than this, and it still was a hit.) You do 10 | this by melting lines in the ice with Special High-Tech GNU Tools. 11 | 12 | If a penguin hits a line in progress, however, it vanishes with a loud 13 | noise, and you lose a life. (Yes, a life. This story is really breaking 14 | down, isn't it? But never fear -- I'll keep going until it's completely 15 | dead.) 16 | 17 | Once 80% or more of the iceberg is gone, the remaining chunks are small 18 | enough for shipping. Of course, if you manage to get rid of more than 19 | that, you'll save on postage, thus earning you exponential amounts of Geek 20 | Cred (a.k.a. "score"). 21 | 22 | After you ship off one batch of penguins, it's time to move on to the 23 | next. Each subsequent 'berg will have one more penguin, and you'll have 24 | one more life. This will continue until you lose, or until you exceed 25 | level one hundred or so, which Ain't Gonna Happen. 26 | 27 | Of course, this is an urgent mission, so you'll be penalized if you're 28 | slow -- every second or so, your score drops down by one. But don't worry, 29 | I'm not completely cruel, so any points you earn on one level are yours to 30 | keep forever, no matter how long you take on subsequent icebergs. 31 | 32 | As far as I can tell, this makes no narrative sense whatsoever, so at this 33 | point, I declare the backstory / game metaphor completely collapsed. Just 34 | go play. 35 | 36 | 37 | HOW: 38 | 39 | The left mouse button starts drawing lines; the right (and/or middle) 40 | button toggles between making vertical and horizontal lines. Note that 41 | left clicking actually starts *two* lines: either up and down or left and 42 | right. (This will make plenty of sense when you're actually playing.) If 43 | one of these lines is hit before it reaches the edge of the iceberg, 44 | you'll lose a life. If both are hit, you'll lose two lives. 45 | 46 | As a tiny bit of grace, if you click directly on a penguin, it'll say 47 | "Ouch" and nothing else will happen. 48 | 49 | Once a line is completed, any area containing no penguins is cleared. 50 | Falls into the ocean, so to speak. Once 80% has been cleared, the level is 51 | complete. However, you get an exponential bonus for every percentage point 52 | above that, so you want to try to make your last line suddenly clear a 53 | huge chunk of ice. (Again, this will make sense once you've played for a 54 | while.) Oh, and you also get a (much smaller) bonus for having lives left 55 | over at the end of a level. 56 | 57 | Taking a long time on a level doesn't affect these bonuses, but it can 58 | chip away at your score, so you have to balance the time it takes to set 59 | up a situation where you can clear 99% of the iceberg against the bonus 60 | you'll get for doing so. 61 | 62 | Having trouble? A hint: it's useful to make traps by intentionally letting 63 | some of your lines get broken. That way, you can create smaller areas in 64 | which you can catch the pesky little things easily. 65 | 66 | 67 | WHY: 68 | 69 | There's a game for MS Windows called "Jezzball". You may notice that this 70 | one is extremely similar. There's a reason for that. See, our main 71 | computer at home runs Linux most of the time, but it has Win95 set up to 72 | dual-boot if need be. (Unfortunately, it's too slow to run VMware or Wine 73 | well.) Ideally, of course, the machine stays in Linux, but my wife, Karen, 74 | really likes puzzle sorts of games and became highly addicted to this 75 | Jezzball thing. Well, we simply couldn't have the system wasting its life 76 | in Windows all that time, so I took it upon myself to create a 77 | sort-of-clone. (It's not a pure clone, because I like to think that I've 78 | done many things in a far superior way.) So this game can be thought of, 79 | in a simultaneously dangerously geeky and dangerously mushy way, as sort 80 | of a dual love-letter, to both Karen and Linux. :) 81 | 82 | It's therefore somewhat ironic that IceBreaker now exists in a MS 83 | Windows version. Ah well. I know not all of you have been converted yet, 84 | and you might as well enjoy the game too. 85 | 86 | 87 | WHO: 88 | 89 | This game was written by Matthew Miller . 90 | 91 | Recent versions have benefited immensely from the help of Enrico Tassi 92 | . He's responsible for getting the Win32 port 93 | to work so nicely, and for a lot of fancy new features. Enrico doesn't 94 | live here in Boston, but he's a huge fan of Boston band Letters To Cleo, 95 | so that counts for something. 96 | 97 | Much thanks to Karen for everything. In fact, if you really love this 98 | game, check out Ten Thousand Villages , 99 | the non-profit organization for which she works. And if you live near 100 | Boston, MA, stop by the store downtown by the Freedom Trail and perhaps 101 | buy something -- they have cool stuff and it's a really great 102 | organization. 103 | 104 | Thanks also to Tae-Jin, for helping me squash a nasty bug, and to Paul for 105 | testing and suggestions and proofreading this document. And to the folks 106 | at the helpdesk downstairs for playing this game instead of working. 107 | 108 | The sounds were either originally created or borrowed from freely-licensed 109 | sources and modified heavily. Thanks to Wesley Crossman for his 110 | contributions. I'd still like lots more cool good ones -- either 111 | improvements of the existing sounds or for new themes. 112 | 113 | The penguin image is mostly my own work, but is based on a graphic 114 | from Pingus . 115 | 116 | Actually, I'm quite open to accepting any help anyone wants to give. 117 | 118 | 119 | WHEN: 120 | 121 | A week or two in September 2000, and then some more time in July 2001, 122 | and then in May 2002, and so on. 123 | 124 | And now! Updated in August 2020 for a 2.0 release and inclusion 125 | in the Fedora distro. Because it's about time. 126 | 127 | 128 | WHERE: 129 | 130 | Get it from: 131 | 132 | Report bugs: 133 | 134 | 135 | WHICH: 136 | 137 | (As in, "On which libraries does icebreaker depend?") 138 | 139 | libSDL and libSDL_mixer. 140 | 141 | Currently, it requirees the 1.2 version; porting to 2.x would be a good 142 | idea. 143 | 144 | 145 | WHITHER: 146 | 147 | I'm not actively working on IceBreaker, but I'll take patches. 148 | 149 | 150 | ------------------------------------------------------------------------------ 151 | Copyright (C) 2000-2020 Matthew Miller and others and released under the 152 | terms of the GNU General Public License, version 2 or later. 153 | 154 | This project uses the Simple DirectMedia Layer and SDL Mixer libraries which 155 | are available under the GNU LGPL license. SDL and SDL_mixer source code 156 | should be available from wherever you got IceBreaker; if you can't find it, 157 | it is available at or at the main SDL 158 | site . 159 | -------------------------------------------------------------------------------- /README.SDL: -------------------------------------------------------------------------------- 1 | The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library 2 | designed to make it easy to write multi-media software, such as games and 3 | emulators. 4 | 5 | The Simple DirectMedia Layer library source code is available from: 6 | http://www.libsdl.org/ 7 | 8 | This library is distributed under the terms of the GNU LGPL license: 9 | http://www.gnu.org/copyleft/lesser.html 10 | -------------------------------------------------------------------------------- /README.ifyoumakechanges: -------------------------------------------------------------------------------- 1 | IceBreaker is free software -- you're welcome to do anything you like with 2 | it under the terms of the GNU GPL. However, as a courtesy, if you do make 3 | changes to the code, packaging, themes, or whatever, I really would 4 | appreciate it if you'd send me what you've done (e-mail , 5 | but check before sending binary attachments). That way, improvements can get 6 | rolled into the main version and everyone can benefit. Thanks! 7 | -------------------------------------------------------------------------------- /README.themes: -------------------------------------------------------------------------------- 1 | IceBreaker themes are simple to create. They're are definined in text files 2 | with the extension .ibt (that's _I_ce_B_reaker _T_heme) in the IceBreaker 3 | data directory. The filename is the name of the theme itself, which must be 4 | seven characters or less -- not because of the DOS 8.3 limit but because 5 | more than seven requires the options menubox to be really big and ugly and 6 | we don't want that. 7 | 8 | The file consists mostly of color definitions, and also gives the location 9 | of the two sound files and the one sprite bitmap. Color definitions begin 10 | with a keyword ("Background", "NormalText", etc.) and then give decimal 11 | values from 0-255 for red, green, and blue, respectively. 12 | 13 | The sound and image defintions are just the keyword followed by a filename. 14 | More info on file formats in a bit. 15 | 16 | The keywords aren't case sensitive, and you can use any amount of whitespace 17 | you want. If you leave out a particular keyword, IceBreaker will use the 18 | default but spit out a complaint on stderr -- so don't do that. (There's 19 | currently one exception -- SpriteMirrorBitmap, which I'll get to in a bit.) 20 | 21 | 22 | The default theme is "linux", and the file linux.ibt looks approximately 23 | like this: 24 | 25 | Background 0 64 128 26 | NormalText 255 255 255 27 | BoardFillMin 224 224 224 28 | BoardFillMax 255 255 255 29 | Gridline 192 192 192 30 | GridHighlight 192 192 192 31 | Line1 0 0 0 32 | Line2 192 0 64 33 | MenuHighlight 255 255 255 34 | GameoverText 192 0 64 35 | ScorescrollText 0 0 0 36 | BonusscrollText 192 0 64 37 | TextentryBox 0 0 0 38 | TextentryText 255 255 255 39 | CopyrightText 192 192 192 40 | SpriteTransparent 255 0 0 41 | SpriteBitmap penguin.bmp 42 | SoundOuch ouch.wav 43 | SoundCrash crash.wav 44 | 45 | The names should mostly be self-explanatory. If something is unclear, let me 46 | know, and I'll either change the name in a future version or write better 47 | documentation here. A few things bear mentioning: 48 | 49 | BoardFillMin and BoardFillMax define the colors of the game play area. The 50 | values will be randomly selected from the range given, but there's a twist 51 | -- if two (or three) of the red, green, or blue values have identical Min 52 | *and* identical Max values, those two will be "locked" together. This way, 53 | you can produce grey or monotone backgrounds instead of having every theme 54 | look like the mutant love child of Rainbow Brite and the Swamp Thing. 55 | 56 | SpriteTransparent is the color value which will be treated as clear when 57 | drawing the bitmap. In the above example, the penguin.bmp has a bright red 58 | background, and since SpriteTransparent is set to the matching value, the 59 | background isn't shown. 60 | 61 | The bitmap file should be a 24-bit MS-Windows-style .bmp format. I know that 62 | this is Lame(tm) but the SDL library which IceBreaker uses understands this 63 | format natively, and so using it allows us to avoid having a whole extra 64 | library just to load some really tiny bitmaps. They should be 14x14, by the 65 | way. If you want, you can make them as small as 12x12, but that's basically 66 | treated as the top-left of 14x14, and support for that may vanish in a 67 | future version. (If you want smaller, just mask out most of the image.) 68 | 69 | Don't underestimate how hard it is to make a sprite image look good at such 70 | a tiny size. Making a theme which represents something in real life rather 71 | than being abstract or iconic is a challenge. A future version of IceBreaker 72 | may allow you to include background and playing board graphics instead of 73 | just colors -- but don't hold your breath for that. 74 | 75 | In addition to SpriteBitmap, you may also set SpriteMirrorBitmap. If this 76 | tag exists, the given image will be used when the sprite is moving to the 77 | right, and the main SpriteBitmap when it's moving to the left. If you leave 78 | out this tag, there will be no warning -- the main bitmap will be used for 79 | both. In fact, leaving it out is the best thing to do if you don't want your 80 | image to flip, because it saves, like, 500 bytes of RAM over defining the 81 | same image twice. And we all know how important those few bytes of RAM are 82 | these days, right? 83 | 84 | The sound files are 8 bit mono PCM at 22050. They should also be really 85 | short -- under a second. This'll mean the total size will be easily less 86 | than 30k -- if it's not, something's not right. 87 | 88 | If you do produce a good theme, let me know -- send it to 89 | , and I'll consider including it with the main 90 | distribution. All themes must be licensed under the GPL. 91 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Next things that should be done 2 | ------------------------------- 3 | 4 | 1. Update to SDL2. 5 | 2. Integer-scaled 2x and 3x window sizes for modern screen resolutions. 6 | 3. Find someone to update for Mac. 7 | 4. Modernize the Windows install script. 8 | 9 | 10 | Also, there's a performance optimization I made which either created or 11 | uncovered the "collapsing iceberg" bug (see below). I bet with computers 12 | being several times faster than a Pentium 75, I can just back out the 13 | optimization. If I can remember the details (this was in CVS and I lost all 14 | that, which is probably mostly fine because my commit messages did not 15 | follow whatchamightcall "best practices"). 16 | 17 | Below this, find the _previous_ todo list, circa 2003. Some of these are 18 | still good ideas. Other parts, like the BeOS port, can probably be dropped. 19 | Also, please no one rewrite this in C++. (Um, and don't tempt me with Rust 20 | suggestions.) 21 | 22 | 23 | --- 24 | 25 | Some of this is work in progress, and some it is just stuff I'd like to see. 26 | Check out for details. 27 | 28 | * many (65 at last count) sections of the code are marked with "FIX", in 29 | places where I know I did something messy, foolish, or inefficient. 30 | * there are likely other bits of messiness, foolishness, and inefficiency 31 | which I haven't realized are there 32 | * this is part of the above, but bears mentioning separately: some of the 33 | code is the product of late-night hacking and, while it works fine, 34 | desperately needs cleaning up 35 | 36 | For 2.0: 37 | - make MacOS X port 38 | - have a dozen themes or more (currently at nine) 39 | 40 | For 2.2: (but sooner if we're lucky): 41 | - find and use user's home dir on WinNT/2k/XP 42 | - do something sensible if selected theme is invalid 43 | - make it so when both lines get broken exactly at once, the second sound 44 | is played with a very slight delay so that the user gets audio 45 | feedback that two lives were lost 46 | - make spaces-in-username work -- convert to/from some special character in 47 | high score file 48 | - make ctrl-q quit (or perhaps just q, with a confirm dialog) 49 | - check for high scores on 'quit' when in the midst of a game 50 | - option to turn off scrolling level-end text ("transitions = normal/fast") 51 | - more code cleanup in the event loops -- such big hairy functions.... 52 | - "help" command line options redirected to files on win32 -- what to do 53 | about that? 54 | - clean up intro -- remove stupid 'w' thing (either add ability to tell a 55 | line to kill itself after a certain length, or add code to the intro to 56 | know when to kill which lines.) 57 | - make the program not crash if data files can't be found. (Of course, on 58 | Win32, we're SOL without the SDL DLLs anyway.) 59 | - make help key (F1) work in intro 60 | - look for themes in an os-specific directory -- ~/.icebreaker on Linux 61 | (which means migrating the current ~/.icebreaker to either ~/.icebreakerrc 62 | or ~/.icebreaker/icebreakerrc) -- in addition to the standard directory. 63 | on BeOS, this might mean looking in the same dir in which the executable 64 | resides... need to check about that. 65 | - make man page version of themes help? 66 | - unbreak BeOS port (looking to be a pain, and let's face it, this is an 67 | increasingly marginal platform. even the person who did the initial port 68 | doesn't actually seem to run the OS very often....) 69 | - ability to use bitmaps for backgrounds 70 | - ability to use png instead of bmp -- use SDL_image. 71 | 72 | For 3.0: 73 | - add music courtesy of my brother Joel at Red Reactor Sound Studio 74 | and intelligent (context-sensitive) music 75 | system 76 | - that annoying "entire iceshelf collapses" bug is *still* there. happens 77 | very very very very rarely, though, so I can't figure out what exactly 78 | the problem is. probably something wrong with squarefill() or some other 79 | part of checkempty() in grid.c. I tried changing a few things, but it's 80 | hard to prove that the problem is solved when you can't recreate it.... 81 | - there is a little bug where in certain situations you can start an 82 | opposing line directly in the path of an oncoming line, causing lines 83 | which are essentially on top of each other. Not a terribly fatal flaw, 84 | but still. 85 | - faster better smarter collision detection (not a change to be taken 86 | lightly since that's basically rewriting the core of the engine). this 87 | will solve the two bugs above once and for all, and should 88 | be a significant speed increase if done right. My goal is to make this 89 | play on acceptably on my Toshiba Libretto CT50 (pentium 75). 90 | - make option parsing a bit more flexible -- gnu getopt style 91 | - animated sprites 92 | - replace randomized "demo" with a real demo that at least follows the 93 | rules -- and ideally plays a decent game. random semi-AI play would be 94 | great; a recording mechanism of some sort is second-best 95 | - make playing area able to be a bitmap instead of just a colored grid 96 | (maybe lines also) 97 | 98 | Possibly: 99 | - convert to C++ -- reduce global variables 100 | - have bonus Things which get you points (or change game mechanics) for 101 | trapping with a single penguin. (in a small enough space?) 102 | - user-definable keys 103 | - internationalization - translations and fonts 104 | - move themes to a subdir 105 | a) in the source tree 106 | b) in the datadir? 107 | 108 | 109 | Probably never: 110 | - make GNOME/KDE versions? 111 | - Mac OS 9 port? 112 | - the animation is really jerky with some refresh rates. what to do about 113 | this? last time I wrote a game was under DOS, and you could easily 114 | sync to the vertical refresh..... 115 | -------------------------------------------------------------------------------- /atom.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/atom.bmp -------------------------------------------------------------------------------- /benchmark.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include 27 | #include 28 | #include "icebreaker.h" 29 | 30 | #if DEVELRELEASE 31 | 32 | #include "cursor.h" 33 | #include "penguin.h" 34 | #include "line.h" 35 | #include "grid.h" 36 | #include "sound.h" 37 | #include "laundry.h" 38 | #include "globals.h" 39 | #include "status.h" 40 | #include "text.h" 41 | #include "themes.h" 42 | #include "event.h" 43 | #include "fullscreen.h" 44 | 45 | static void setupbenchmark(void); 46 | 47 | void setupbenchmark() 48 | { 49 | int x,y; 50 | 51 | setcursor(CURSORARROW); 52 | SDL_FillRect(screen,NULL,color.background); 53 | 54 | for (x=0;x=BORDERRIGHT || y =BORDERBOTTOM) 58 | grid[x][y]='X'; 59 | else 60 | grid[x][y]=' '; 61 | } 62 | 63 | drawgridblocks(); 64 | 65 | updateall(); 66 | } 67 | 68 | 69 | 70 | int benchmark(void) 71 | { 72 | int penguincount=MAXPENGUINS; 73 | int i; 74 | SDL_Event event; 75 | SDL_Rect fpsrect; 76 | char fpstext[20]; 77 | int done = false; 78 | 79 | Penguin pg_flock[MAXPENGUINS]; 80 | Uint32 starttime, endtime, tmptime, framecount, tmpframecount; 81 | 82 | 83 | setupbenchmark(); 84 | 85 | fpsrect.x=BORDERLEFT; fpsrect.y=BOTTOMSTATUSY; 86 | fpsrect.h=CHARHEIGHT*3;; fpsrect.w=CHARWIDTH*2*20; 87 | 88 | for (i=0;i= tmptime+1000) 149 | { 150 | snprintf(fpstext,20,"FPS: %.2f",((framecount-tmpframecount)*1000.0)/(SDL_GetTicks()-tmptime)); 151 | tmptime=SDL_GetTicks(); 152 | tmpframecount=framecount; 153 | SDL_FillRect(screen,&fpsrect,color.background); 154 | puttext(fpsrect.x,fpsrect.y+3,2,color.normaltext,fpstext); 155 | soil(fpsrect); 156 | } 157 | framecount++; 158 | 159 | } while (!done); 160 | endtime=SDL_GetTicks(); 161 | if (endtime>starttime) 162 | printf("Overall: %.2f frames per second.\n", (framecount*1000.0)/(endtime-starttime) ); 163 | 164 | clean(); 165 | 166 | while (penguincount) 167 | { 168 | penguincount--; 169 | deletepenguin(&pg_flock[penguincount]); 170 | } 171 | 172 | return(false); 173 | } 174 | 175 | #endif /* DEVELRELEASE */ 176 | -------------------------------------------------------------------------------- /benchmark.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef BENCHMARK_H 24 | #define BENCHMARK_H 25 | #if DEVELRELEASE 26 | 27 | extern int benchmark(void); 28 | 29 | #endif /* DEVELRELEASE */ 30 | #endif /* BENCHMARK_H */ 31 | -------------------------------------------------------------------------------- /blocks.ibt: -------------------------------------------------------------------------------- 1 | Background 120 0 140 2 | NormalText 255 255 255 3 | BoardFillMin 0 0 0 4 | BoardFillMax 0 0 0 5 | Gridline 32 32 32 6 | GridHighlight 64 64 64 7 | Line1 161 81 36 8 | Line2 226 123 40 9 | MenuHighlight 255 255 255 10 | GameoverText 192 192 192 11 | ScorescrollText 226 123 40 12 | BonusscrollText 192 192 192 13 | TextentryBox 0 0 0 14 | TextentryText 226 123 40 15 | CopyrightText 192 192 192 16 | SpriteTransparent 255 0 0 17 | SpriteBitmap woodblock.bmp 18 | SoundOuch scrunch.wav 19 | SoundCrash tap.wav 20 | -------------------------------------------------------------------------------- /bwop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/bwop.wav -------------------------------------------------------------------------------- /cheese.ibt: -------------------------------------------------------------------------------- 1 | Background 80 0 0 2 | NormalText 255 255 255 3 | BoardFillMin 192 192 108 4 | BoardFillMax 255 255 128 5 | Gridline 255 255 128 6 | GridHighlight 255 255 192 7 | Line1 0 0 96 8 | Line2 64 64 64 9 | MenuHighlight 255 255 128 10 | GameoverText 0 0 160 11 | ScorescrollText 0 0 0 12 | BonusscrollText 0 0 160 13 | TextentryBox 0 0 0 14 | TextentryText 255 255 255 15 | CopyrightText 192 192 192 16 | SpriteTransparent 255 255 160 17 | SpriteBitmap mouse.bmp 18 | SpriteMirrorBitmap mouse-r.bmp 19 | SoundOuch squeak.wav 20 | SoundCrash scrunch.wav 21 | -------------------------------------------------------------------------------- /cow.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/cow.bmp -------------------------------------------------------------------------------- /cows.ibt: -------------------------------------------------------------------------------- 1 | Background 0 64 0 2 | NormalText 255 255 255 3 | BoardFillMin 20 148 20 4 | BoardFillMax 52 180 52 5 | Gridline 192 192 192 6 | GridHighlight 192 192 192 7 | Line1 192 192 0 8 | Line2 96 32 0 9 | MenuHighlight 255 255 255 10 | GameoverText 192 64 0 11 | ScorescrollText 255 255 0 12 | BonusscrollText 255 85 0 13 | TextentryBox 0 0 0 14 | TextentryText 52 180 52 15 | SpriteTransparent 255 0 0 16 | CopyrightText 192 192 192 17 | SpriteBitmap cow.bmp 18 | SoundOuch moo.wav 19 | SoundCrash splat.wav 20 | -------------------------------------------------------------------------------- /crash.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/crash.wav -------------------------------------------------------------------------------- /cursor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * except the init_system_cursor function, which was lovingly stolen from 5 | * the SDL documentation 6 | * 7 | * 8 | * 9 | * This program is free software; you can redistribute it and/or modify it 10 | * under the terms of the GNU General Public License as published by the Free 11 | * Software Foundation; either version 2 of the License, or (at your option) 12 | * any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, but 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17 | * for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License along 20 | * with this program; if not, write to the Free Software Foundation, Inc., 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | * 23 | */ 24 | 25 | 26 | 27 | #include 28 | #include "cursor.h" 29 | #include "icebreaker.h" 30 | 31 | static SDL_Cursor* createcursor(const char *image[]); 32 | 33 | static SDL_Cursor* cursorarrow; 34 | static SDL_Cursor* cursorhorizontal; 35 | static SDL_Cursor* cursorvertical; 36 | static SDL_Cursor* cursorclick; 37 | 38 | 39 | /* XPM */ 40 | static const char *cursorarrowxpm[] = { 41 | /* width height num_colors chars_per_pixel */ 42 | " 32 32 3 1", 43 | /* colors */ 44 | "X c #000000", 45 | ". c #ffffff", 46 | " c None", 47 | /* pixels */ 48 | "X ", 49 | "XX ", 50 | "X.X ", 51 | "X..X ", 52 | "X...X ", 53 | "X....X ", 54 | "X.....X ", 55 | "X......X ", 56 | "X.......X ", 57 | "X........X ", 58 | "X.....XXXXX ", 59 | "X..X..X ", 60 | "X.X X..X ", 61 | "XX X..X ", 62 | "X X..X ", 63 | " X..X ", 64 | " X..X ", 65 | " X..X ", 66 | " XX ", 67 | " ", 68 | " ", 69 | " ", 70 | " ", 71 | " ", 72 | " ", 73 | " ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " ", 79 | " ", 80 | "0,0" 81 | }; 82 | 83 | 84 | /* XPM */ 85 | static const char *cursorhorizontalxpm[] = { 86 | /* width height num_colors chars_per_pixel */ 87 | " 32 32 3 1", 88 | /* colors */ 89 | "X c #000000", 90 | ". c #ffffff", 91 | " c None", 92 | /* pixels */ 93 | " X X ", 94 | " XX XX ", 95 | " X.X X.X ", 96 | " X..X X..X ", 97 | " X...X X...X ", 98 | " X....X X....X ", 99 | " X.....XXX.....X ", 100 | " X...............X ", 101 | "X.................X ", 102 | " X...............X ", 103 | " X.....XXX.....X ", 104 | " X....X X....X ", 105 | " X...X X...X ", 106 | " X..X X..X ", 107 | " X.X X.X ", 108 | " XX XX ", 109 | " X X ", 110 | " ", 111 | " ", 112 | " ", 113 | " ", 114 | " ", 115 | " ", 116 | " ", 117 | " ", 118 | " ", 119 | " ", 120 | " ", 121 | " ", 122 | " ", 123 | " ", 124 | " ", 125 | "9,8" 126 | }; 127 | 128 | /* XPM */ 129 | static const char *cursorverticalxpm[] = { 130 | /* width height num_colors chars_per_pixel */ 131 | " 32 32 3 1", 132 | /* colors */ 133 | "X c #000000", 134 | ". c #ffffff", 135 | " c None", 136 | /* pixels */ 137 | " X ", 138 | " X.X ", 139 | " X...X ", 140 | " X.....X ", 141 | " X.......X ", 142 | " X.........X ", 143 | " X...........X ", 144 | " X.............X ", 145 | "XXXXXXX...XXXXXXX ", 146 | " X...X ", 147 | "XXXXXXX...XXXXXXX ", 148 | " X.............X ", 149 | " X...........X ", 150 | " X.........X ", 151 | " X.......X ", 152 | " X.....X ", 153 | " X...X ", 154 | " X.X ", 155 | " X ", 156 | " ", 157 | " ", 158 | " ", 159 | " ", 160 | " ", 161 | " ", 162 | " ", 163 | " ", 164 | " ", 165 | " ", 166 | " ", 167 | " ", 168 | " ", 169 | "8,9" 170 | }; 171 | 172 | /* XPM */ 173 | static const char *cursorclickxpm[] = { 174 | /* width height num_colors chars_per_pixel */ 175 | " 32 32 3 1", 176 | /* colors */ 177 | "X c #000000", 178 | ". c #ffffff", 179 | " c None", 180 | /* pixels */ 181 | " XXXX XXX XXX XXXX XXX XX ", 182 | "X....X X.X X.X X....X X.X X.X ", 183 | "X.XXX X.X X.X X.XXX X.XX.X ", 184 | "X.X X.X X.X X.X X...X ", 185 | "X.X X.X X.X X.X X.XX.X ", 186 | "X.XXX X.XXX X.X X.XXX X.X X.X ", 187 | "X....X X...X X.X X....X X.X X.X ", 188 | " XXXX XXXXX XXX XXXX XXX XXX ", 189 | " ", 190 | " ", 191 | " XXXXXXX XXXXX ", 192 | " X.....X X.....X ", 193 | " XXX.XXX X.XXX.X ", 194 | " X.X X.X X.X ", 195 | " X.X X.X X.X ", 196 | " X.X X.XXX.X ", 197 | " X.X X.....X ", 198 | " XXX XXXXX ", 199 | " ", 200 | " ", 201 | " XXXX XXXXXX X XXXX XXXXXX", 202 | "X....X X....X X.X X...X X....X", 203 | "X.XXX XX.XXX X..X X.XX.X X.XXX", 204 | "X....X X.X X.XX.X X...X X.X ", 205 | " XXX.X X.X X.....X X.X.X X.X ", 206 | " XXX.X X.X X.XXX.X X.XX.X X.X ", 207 | "X....X X.X X.X X.X X.XX.X X.X ", 208 | " XXXX XXX XXX XXX XXX XX XXX ", 209 | " ", 210 | " ", 211 | " ", 212 | " ", 213 | "15,15" 214 | }; 215 | 216 | 217 | static SDL_Cursor* createcursor(const char *image[]) 218 | { 219 | int i, row, col; 220 | Uint8 data[4*32]; 221 | Uint8 mask[4*32]; 222 | int hot_x, hot_y; 223 | 224 | i = -1; 225 | for ( row=0; row<32; ++row ) 226 | { 227 | for ( col=0; col<32; ++col ) 228 | { 229 | if ( col % 8 ) 230 | { 231 | data[i] <<= 1; 232 | mask[i] <<= 1; 233 | } 234 | else 235 | { 236 | ++i; 237 | data[i] = mask[i] = 0; 238 | } 239 | switch (image[4+row][col]) 240 | { 241 | case '.': 242 | data[i] |= 0x01; 243 | mask[i] |= 0x01; 244 | break; 245 | case 'X': 246 | mask[i] |= 0x01; 247 | break; 248 | case ' ': 249 | break; 250 | } 251 | } 252 | } 253 | sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); 254 | return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y); 255 | } 256 | 257 | void setcursor(CursorType c) 258 | { 259 | static CursorType current=CURSORDEFAULT; 260 | if (c != current) 261 | { 262 | switch (c) 263 | { 264 | case CURSORDEFAULT: //falls through 265 | case CURSORARROW: 266 | SDL_SetCursor(cursorarrow); 267 | break; 268 | case CURSORHORIZONTAL: 269 | SDL_SetCursor(cursorhorizontal); 270 | break; 271 | case CURSORVERTICAL: 272 | SDL_SetCursor(cursorvertical); 273 | break; 274 | case CURSORCLICK: 275 | SDL_SetCursor(cursorclick); 276 | break; 277 | } 278 | current=c; 279 | } 280 | } 281 | 282 | void initcursors(void) 283 | { 284 | // fix -- add error checking 285 | cursorarrow=createcursor(cursorarrowxpm); 286 | cursorhorizontal=createcursor(cursorhorizontalxpm); 287 | cursorvertical=createcursor(cursorverticalxpm); 288 | cursorclick=createcursor(cursorclickxpm); 289 | } 290 | 291 | 292 | void quitcursors(void) 293 | { 294 | SDL_FreeCursor(cursorarrow); 295 | SDL_FreeCursor(cursorhorizontal); 296 | SDL_FreeCursor(cursorvertical); 297 | SDL_FreeCursor(cursorclick); 298 | } 299 | -------------------------------------------------------------------------------- /cursor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef CURSOR_H 24 | #define CURSOR_H 25 | 26 | typedef enum { CURSORDEFAULT, CURSORCLICK, CURSORARROW, CURSORHORIZONTAL, CURSORVERTICAL } CursorType; 27 | 28 | extern void initcursors(void); 29 | extern void quitcursors(void); 30 | extern void setcursor(CursorType c); 31 | 32 | 33 | #endif /* CURSOR_H */ 34 | -------------------------------------------------------------------------------- /delay.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | #include 25 | #include 26 | #include "icebreaker.h" 27 | 28 | 29 | // oh, if only we could sleep for less than 10ms on 30 | // intel. too bad alpha systems suck so much in other 31 | // ways -- they can sleep with 1ms resolution. 32 | // (we could on intel with nanosleep, if we were suid root...) 33 | int delaytil(int futuretime) 34 | { 35 | int slept=false; 36 | 37 | // first, soft-wait for 10ms intervals until there's less than 10ms 38 | // left to go 39 | while (futuretime-10 >= SDL_GetTicks()) 40 | { 41 | SDL_Delay(10); 42 | slept=true; 43 | } 44 | 45 | 46 | // and then busy-wait for the leftover bits 47 | 48 | #ifdef FUZZYFPS 49 | if (!slept) 50 | #endif 51 | while (futuretime > SDL_GetTicks()) 52 | { 53 | // busy loop! 54 | // FIX -- calculate PI or something interesting here. :) 55 | } 56 | 57 | 58 | return 0; // fix -- return time actually slept? 59 | } 60 | 61 | -------------------------------------------------------------------------------- /delay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | 25 | #ifndef DELAY_H 26 | #define DELAY_H 27 | 28 | int delaytil(int futuretime); 29 | 30 | #endif /* DELAY_H */ 31 | -------------------------------------------------------------------------------- /dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef DIALOG_H 24 | #define DIALOG_H 25 | 26 | typedef enum { POPUPDONOTHING, POPUPEXITMENU, POPUPQUITGAME, POPUPNEWGAME, 27 | POPUPREDRAWME, POPUPNO, POPUPYES, POPUPOK, POPUPCANCEL } PopupReturnType; 28 | 29 | extern PopupReturnType gethighusername(int highest); 30 | 31 | extern PopupReturnType popuphelp(void); 32 | extern PopupReturnType popuphighscores(void); 33 | 34 | extern PopupReturnType yesnodialog(char* text1, char* text2, char* text3); 35 | extern PopupReturnType waitforuser(void); 36 | 37 | #endif /* DIALOG_H */ 38 | -------------------------------------------------------------------------------- /drum.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/drum.wav -------------------------------------------------------------------------------- /event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | 25 | #include 26 | #include "icebreaker.h" 27 | #include "globals.h" 28 | #include "event.h" 29 | #include "options.h" 30 | #include "laundry.h" 31 | #include "text.h" 32 | #include "fullscreen.h" 33 | 34 | static void alignmouse(SDL_Event* e); 35 | 36 | int pollevent(SDL_Event* e) 37 | { 38 | int result = SDL_PollEvent(e); 39 | if ( gameflags.isfullscreen && e != NULL ) 40 | alignmouse(e); 41 | return result; 42 | } 43 | 44 | Uint8 getmousestate(int* mx, int* my) 45 | { 46 | Uint8 rc; 47 | rc=SDL_GetMouseState(mx, my); 48 | 49 | if (gameflags.isfullscreen) 50 | { 51 | *mx -= (FULLWIDTH - WIDTH) / 2; 52 | *my -= FULLTOPMARGIN; 53 | } 54 | 55 | return rc; 56 | } 57 | 58 | void jumpmouse(int mx, int my) 59 | { 60 | if (gameflags.isfullscreen) 61 | SDL_WarpMouse(mx+(FULLWIDTH - WIDTH) / 2,my+FULLTOPMARGIN); 62 | else 63 | SDL_WarpMouse(mx,my); 64 | } 65 | 66 | KeyboardActionType translatekeyevent(SDL_Event* e) 67 | { 68 | if ((e->type != SDL_KEYUP) && (e->type != SDL_KEYDOWN)) 69 | return KEYNONE; 70 | 71 | switch (e->key.keysym.sym) 72 | { 73 | case SDLK_ESCAPE: 74 | return KEYCANCEL; 75 | break; 76 | 77 | case SDLK_m: 78 | return KEYMENU; 79 | break; 80 | 81 | case SDLK_p: 82 | case SDLK_PAUSE: 83 | return KEYPAUSE; 84 | break; 85 | 86 | case SDLK_F1: 87 | return KEYHELP; 88 | break; 89 | 90 | case SDLK_RETURN: 91 | case SDLK_KP_ENTER: 92 | case SDLK_z: 93 | case SDLK_COMMA: 94 | case SDLK_KP0: 95 | return KEYSTARTLINE; 96 | break; 97 | 98 | case SDLK_SPACE: 99 | case SDLK_x: 100 | case SDLK_PERIOD: 101 | case SDLK_KP5: 102 | return KEYSWITCHLINE; 103 | break; 104 | 105 | case SDLK_LEFT: 106 | case SDLK_h: 107 | case SDLK_KP4: 108 | return KEYMOVELEFT; 109 | break; 110 | 111 | case SDLK_RIGHT: 112 | case SDLK_l: 113 | case SDLK_KP6: 114 | return KEYMOVERIGHT; 115 | break; 116 | 117 | case SDLK_UP: 118 | case SDLK_k: 119 | case SDLK_KP8: 120 | return KEYMOVEUP; 121 | break; 122 | 123 | case SDLK_DOWN: 124 | case SDLK_j: 125 | case SDLK_KP2: 126 | return KEYMOVEDOWN; 127 | break; 128 | 129 | case SDLK_KP7: 130 | case SDLK_HOME: 131 | return KEYMOVELEFTUP; 132 | break; 133 | 134 | case SDLK_KP9: 135 | case SDLK_PAGEUP: 136 | return KEYMOVERIGHTUP; 137 | break; 138 | 139 | case SDLK_KP1: 140 | case SDLK_END: 141 | return KEYMOVELEFTDOWN; 142 | break; 143 | 144 | case SDLK_KP3: 145 | case SDLK_PAGEDOWN: 146 | return KEYMOVERIGHTDOWN; 147 | break; 148 | 149 | default: 150 | return KEYNONE; 151 | break; 152 | } 153 | 154 | return KEYNONE; 155 | } 156 | 157 | void alignmouse(SDL_Event* e) 158 | { 159 | 160 | switch(e->type) 161 | { 162 | case SDL_MOUSEMOTION: 163 | e->motion.x -= (FULLWIDTH - WIDTH) / 2; 164 | e->motion.y -= FULLTOPMARGIN; 165 | e->motion.xrel -= (FULLWIDTH - WIDTH) / 2; 166 | e->motion.yrel -= FULLTOPMARGIN; 167 | break; 168 | 169 | case SDL_MOUSEBUTTONDOWN: // falls through 170 | case SDL_MOUSEBUTTONUP: 171 | e->button.x -= (FULLWIDTH - WIDTH) / 2; 172 | e->button.y -= FULLTOPMARGIN; 173 | break; 174 | 175 | default: 176 | return; 177 | } 178 | } 179 | 180 | -------------------------------------------------------------------------------- /event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef EVENT_H 25 | #define EVENT_H 26 | 27 | typedef enum { KEYNONE, KEYCANCEL, KEYMENU, KEYPAUSE, KEYHELP, 28 | KEYSTARTLINE, KEYSWITCHLINE, 29 | KEYMOVELEFT, KEYMOVERIGHT, KEYMOVEUP, KEYMOVEDOWN, 30 | KEYMOVELEFTUP, KEYMOVERIGHTUP, KEYMOVELEFTDOWN, KEYMOVERIGHTDOWN 31 | } KeyboardActionType; 32 | 33 | 34 | 35 | extern int pollevent(SDL_Event* e); 36 | extern Uint8 getmousestate(int* mx, int* my); 37 | extern void jumpmouse(int mx, int my); 38 | extern KeyboardActionType translatekeyevent(SDL_Event* e); 39 | 40 | 41 | 42 | #endif // EVENT_H 43 | -------------------------------------------------------------------------------- /ewww.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/ewww.wav -------------------------------------------------------------------------------- /fullscreen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | 25 | #include 26 | #include 27 | #include "icebreaker.h" 28 | #include "globals.h" 29 | #include "laundry.h" 30 | #include "options.h" 31 | #include "text.h" 32 | #include "titlebar.h" 33 | 34 | int makefullscreen() 35 | { 36 | SDL_Surface* fullscreensave = NULL; 37 | 38 | 39 | //for window manager caption -- the title bar 40 | char *curcaptiontitle=NULL,*curcaptionicon=NULL; 41 | char newcaptiontitle[35]; 42 | 43 | 44 | 45 | if (screen!=NULL) 46 | { 47 | clean(); // very important! 48 | 49 | fullscreensave=SDL_CreateRGBSurface(SDL_SWSURFACE,WIDTH,HEIGHT,screen->format->BitsPerPixel,0,0,0,0); 50 | SDL_BlitSurface(screen, NULL, fullscreensave, NULL); 51 | 52 | // the resolution switch is ugly if we don't do this, since 53 | // sometimes the window gets resized a second before the mode 54 | // switch. ugh. 55 | SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format, 0, 0, 0)); 56 | SDL_UpdateRect(screen,0,0,0,0); 57 | } 58 | 59 | fullscreen = SDL_SetVideoMode(FULLWIDTH, FULLHEIGHT, VIDEODEPTH, SDL_SWSURFACE | SDL_FULLSCREEN ); 60 | if (fullscreen == NULL) 61 | { 62 | // FIX -- if this happens, don't die: just stay in windowed 63 | // mode and return failure (and change calling code to 64 | // deal with the return value). 65 | fprintf(stderr, "Couldn't switch to full screen mode.\n" 66 | "SDL error: " 67 | "%s\n\n", SDL_GetError()); 68 | exit(1); 69 | } 70 | 71 | screen = NULL; 72 | 73 | // very clever idea from Enrico 74 | screen = SDL_CreateRGBSurfaceFrom(fullscreen->pixels + 75 | fullscreen->format->BytesPerPixel * FULLLEFTMARGIN + 76 | FULLTOPMARGIN*fullscreen->format->BytesPerPixel * FULLWIDTH, 77 | WIDTH, HEIGHT, VIDEODEPTH, 78 | FULLWIDTH * fullscreen->format->BytesPerPixel,0,0,0,0); 79 | 80 | if (screen == NULL) 81 | { 82 | // fix -- same as above -- try to recover gracefully if this 83 | // happens 84 | fprintf(stderr, "Couldn't access full screen surface. That's not good.\n" 85 | "SDL error: " 86 | "%s\n\n", SDL_GetError()); 87 | exit(1); 88 | } 89 | gameflags.isfullscreen=true; 90 | 91 | // if we wanted to something interesting in the border in full-screen 92 | // mode, here would be the place. 93 | SDL_FillRect(fullscreen,NULL,SDL_MapRGB(screen->format, 0, 0, 0)); 94 | 95 | if (fullscreensave!=NULL) 96 | SDL_BlitSurface(fullscreensave, NULL, screen, NULL); 97 | 98 | // Set Window Caption For some odd reason, you can't feed the result 99 | // of GetCaption directly back into SetCaption. So we have to do this. 100 | SDL_WM_GetCaption(&curcaptiontitle, &curcaptionicon); 101 | if (curcaptiontitle != NULL && curcaptionicon != NULL) 102 | { 103 | snprintf(newcaptiontitle,35,"%s",curcaptiontitle); 104 | drawtitlebar(newcaptiontitle); 105 | } 106 | 107 | SDL_UpdateRect(fullscreen,0,0,0,0); 108 | 109 | SDL_FreeSurface(fullscreensave); 110 | 111 | 112 | // hmmm -- we might need to recalculate the colors if the video 113 | // depth happens to change when switching to fullscreen. could 114 | // happen.... 115 | 116 | return 0; 117 | } 118 | 119 | int makewindowed() 120 | { 121 | SDL_Surface * fullscreensave=SDL_CreateRGBSurface(SDL_SWSURFACE,WIDTH,HEIGHT,screen->format->BitsPerPixel,0,0,0,0); 122 | 123 | clean(); // very important! 124 | 125 | SDL_BlitSurface(screen, NULL, fullscreensave, NULL); 126 | 127 | screen = SDL_SetVideoMode(WIDTH, HEIGHT, VIDEODEPTH, SDL_SWSURFACE); 128 | if (screen == NULL) 129 | { 130 | fprintf(stderr, "Couldn't switch to windowed screen mode.\n" 131 | "SDL error: " 132 | "%s\n\n", SDL_GetError()); 133 | exit(1); 134 | } 135 | gameflags.isfullscreen=false; 136 | 137 | SDL_BlitSurface(fullscreensave, NULL, screen, NULL); 138 | 139 | SDL_UpdateRect(screen,0,0,0,0); 140 | 141 | SDL_FreeSurface(fullscreensave); 142 | 143 | return 0; 144 | } 145 | -------------------------------------------------------------------------------- /fullscreen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2001-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef FULLSCREEN_H 24 | #define FULLSCREEN_H 25 | 26 | extern int makefullscreen(void); extern int makewindowed(void); 27 | 28 | #endif /* FULLSCREEN_H */ 29 | -------------------------------------------------------------------------------- /globals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef GLOBALS_H 24 | #define GLOBALS_H 25 | 26 | // fix -- move this file to "icebreaker.h", after moving that stuff 27 | // to config.h 28 | 29 | extern SDL_Surface* screen; 30 | extern SDL_Surface* fullscreen; 31 | 32 | extern char username[50]; 33 | extern char homedir[255]; 34 | 35 | #endif /* GLOBALS_H */ 36 | -------------------------------------------------------------------------------- /grid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include "icebreaker.h" 27 | #include "laundry.h" 28 | #include "grid.h" 29 | #include "penguin.h" 30 | #include "globals.h" 31 | #include "themes.h" 32 | 33 | SDL_Surface* gridsave; 34 | char grid[WIDTH][HEIGHT]; 35 | 36 | 37 | static char maskgrid[WIDTH][HEIGHT]; 38 | 39 | // kludge-o-rama 40 | static long rcount; 41 | #define MAXRCOUNT 80000 42 | 43 | 44 | int initgrid() 45 | { 46 | // fix -- add error checking 47 | gridsave = SDL_CreateRGBSurface(SDL_SWSURFACE,WIDTH,HEIGHT,screen->format->BitsPerPixel,0,0,0,0); 48 | return 0; 49 | } 50 | 51 | void quitgrid() 52 | { 53 | SDL_FreeSurface(gridsave); 54 | } 55 | 56 | void drawgridblocks() 57 | { 58 | int r,g,b; 59 | SDL_Rect tmprect; 60 | 61 | SDL_FillRect(gridsave,NULL,color.background); 62 | 63 | 64 | for (tmprect.x=BORDERLEFT;tmprect.xformat, r, g, b)); 90 | } 91 | else 92 | { 93 | tmprect.w=BLOCKWIDTH-1; tmprect.h=BLOCKHEIGHT-1; 94 | SDL_FillRect(gridsave,&tmprect,color.gridhighlight); 95 | 96 | tmprect.w=BLOCKWIDTH-2; tmprect.h=BLOCKHEIGHT-2; 97 | // FIX! this is kludgy! changing the index variable on the fly bad bad bad. (even if I do put it back!) 98 | tmprect.x++; tmprect.y++; 99 | SDL_FillRect(gridsave,&tmprect,SDL_MapRGB(screen->format, r, g, b)); 100 | tmprect.x--; tmprect.y--; 101 | 102 | } 103 | } 104 | } 105 | 106 | tmprect.x=BORDERLEFT; tmprect.y=BORDERTOP; 107 | tmprect.w=PLAYWIDTH; tmprect.h=PLAYHEIGHT; 108 | SDL_BlitSurface(gridsave, &tmprect, screen, &tmprect); 109 | } 110 | 111 | void markgrid(int x, int y, int w, int h, char fillchar) 112 | { 113 | int i; 114 | 115 | // Optimizing this routine much further seems about impossible to me 116 | // but if you know how to do it, let me know. This is by far the 117 | // most frequently-called function in the whole game. Short of 118 | // rethinking the collision detection -- which could stand a rethink 119 | // anyway -- there's not much that can be done. 120 | 121 | for (i=x;iMAXRCOUNT) // bail 261 | { 262 | fprintf(stderr,"Damn. Ran out of recursions.\n"); 263 | return(2); 264 | } 265 | 266 | 267 | // shouldn't need to check bounds because we're only painting in the 268 | // middle. and we call this function so much that the time saved 269 | // is worth it 270 | //if (i<0 || j<0 || i>=WIDTH || j>=HEIGHT) 271 | //{ 272 | // fprintf(stderr,"That shouldn't have happened (penguinsearch)! (%d,%d)\n",i,j); 273 | // exit(1); 274 | //} 275 | 276 | 277 | if (maskgrid[i][j]==' ' 278 | || maskgrid[i][j]=='1' || maskgrid[i][j]=='2' || maskgrid[i][j]=='w') // Ah ha! The nefarious "instant melting ice" bug solved! NOTE: if more lines are added to the game, add them here too! 279 | { 280 | maskgrid[i][j]=','; 281 | 282 | // hmmm. the "ice-shelf-collapse" bug *isn't* fixed. :( 283 | 284 | searchval=penguinsearch(i+BLOCKWIDTH, j); 285 | if (!searchval) searchval=penguinsearch(i-BLOCKWIDTH, j); 286 | if (!searchval) searchval=penguinsearch(i, j-BLOCKHEIGHT); 287 | if (!searchval) searchval=penguinsearch(i, j+BLOCKHEIGHT); 288 | 289 | } 290 | else if (maskgrid[i][j]=='*') // found a penguin! 291 | { 292 | searchval=1; 293 | } 294 | return(searchval); 295 | } 296 | 297 | 298 | void floodfill(int x, int y) 299 | { 300 | // shouldn't need to check bounds because we're only painting in the 301 | // middle. ie (x<0 || y<0 || x>WIDTH || y>HEIGHT) is always false. 302 | if (grid[x][y]==' ' || grid[x][y]=='1' || grid[x][y]=='2' || grid[x][y]=='w') 303 | { 304 | grid[x][y]='.'; 305 | floodfill(x+1, y); 306 | floodfill(x-1, y); 307 | floodfill(x, y+1); 308 | floodfill(x, y-1); 309 | } 310 | } 311 | 312 | void squarefill(int x, int y) 313 | { 314 | // x and y must be the top left corner of a square, or else this 315 | // will look silly. and there's no bounds checking! 316 | 317 | if (grid[x][y]==' ' || grid[x][y]=='1' || grid[x][y]=='2' || grid[x][y]=='w') 318 | { 319 | markgrid(x,y,BLOCKWIDTH,BLOCKHEIGHT,'.'); 320 | squarefill(x+BLOCKWIDTH, y); 321 | squarefill(x-BLOCKWIDTH, y); 322 | squarefill(x, y+BLOCKHEIGHT); 323 | squarefill(x, y-BLOCKHEIGHT); 324 | } 325 | } 326 | 327 | -------------------------------------------------------------------------------- /grid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef GRID_H 24 | #define GRID_H 25 | 26 | extern SDL_Surface* gridsave; 27 | extern char grid[WIDTH][HEIGHT]; 28 | 29 | 30 | extern int initgrid(void); 31 | extern void quitgrid(void); 32 | 33 | extern void drawgridblocks(void); 34 | 35 | extern void printboard(void); 36 | extern void printwholegrid(void); 37 | extern void printwholemaskgrid(); 38 | 39 | extern void markgrid(int x, int y, int w, int h, char fillchar); 40 | extern long countcleared(void); 41 | extern void checkempty(int x, int y); 42 | extern int penguinsearch(int i, int j); 43 | extern void floodfill(int x, int y); 44 | extern void squarefill(int x, int y); 45 | 46 | #endif /* GRID_H */ 47 | -------------------------------------------------------------------------------- /hiscore.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "icebreaker.h" 28 | #include "globals.h" 29 | #include "hiscore.h" 30 | #include "lock.h" 31 | 32 | char hiscorename[HISCORENUM][50]; 33 | long hiscoreval[HISCORENUM]; 34 | 35 | static char temphiscorename[HISCORENUM+1][50]; //used for sorting 36 | static long temphiscoreval[HISCORENUM+1]; 37 | 38 | // used if we can't get write access to the high score file immediately 39 | static char delayedhiscorename[HISCORENUM+1][50]; 40 | static long delayedhiscoreval[HISCORENUM+1]; 41 | 42 | static int cmpscore(int * a, int * b); 43 | static void sorthiscore(char hiname[HISCORENUM][50],long hival[HISCORENUM],char * username, long score); 44 | static void writehiscores(char * username, long thisgamescore); 45 | static void adddelayedhiscore(char* username,long finalscore); 46 | 47 | void inithiscores() 48 | { 49 | int i; 50 | readhiscores(); 51 | 52 | // zero out the just-in-case array 53 | for (i=0;ihiscoreval[HISCORENUM-1]); 123 | } 124 | 125 | int addhiscore(char* username, long finalscore, int candelay) 126 | { 127 | int gotlock=false; 128 | int rc=-1; 129 | FILE_DESC filelock; 130 | char filename[274]; // fix -- use defined OS constant 131 | 132 | snprintf(filename,274,"%s/%s",homedir,HISCORELOCKFILE); 133 | 134 | filelock = openlockfile(filename); 135 | if (filelock == INVALID_FILE_DESC) 136 | { 137 | fprintf(stderr,"Can't access lock file -- this means we can't save the high scores.\n" 138 | "You may want to ask your sysadmin to make sure this program can write to\n" 139 | "<%s>.\n",filename); 140 | } 141 | else 142 | { 143 | gotlock = lock(filelock); 144 | if (!gotlock) 145 | { 146 | if (checkhiscore(finalscore)) 147 | writehiscores(username,finalscore); 148 | else 149 | rc=0; 150 | 151 | gotlock=unlock(filelock); 152 | 153 | if (gotlock) 154 | { 155 | fprintf(stderr,"Warning: something very strange has happened. This isn't good.\n" 156 | "Can't unlock <%s>!\n",filename); 157 | } 158 | } 159 | else if (candelay) 160 | { 161 | adddelayedhiscore(username,finalscore); 162 | } 163 | else 164 | { 165 | fprintf(stderr,"Someone is holding onto the lock file and we can't save high scores, so\n" 166 | "despite our best efforts, %s's high score of %ld was dropped.\n",username,finalscore); 167 | } 168 | 169 | closelockfile(filelock); 170 | } 171 | 172 | return rc; 173 | 174 | } 175 | 176 | void writedelayedhiscores() 177 | { 178 | int i; 179 | 180 | for (i=0;i.\n",filename); 251 | } 252 | else 253 | { 254 | // FIX -- make this go so people can have spaces in their names 255 | //for (i=0;hiscorename[i]!='\0';i++) 256 | // if (hiscorename[i]==' ') hiscorename[i]='_'; 257 | 258 | for (i=0;i 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef HISCORE_H 24 | #define HISCORE_H 25 | 26 | extern void inithiscores(void); 27 | extern void readhiscores(void); 28 | extern int checkhiscore(long thisgamescore); 29 | extern int addhiscore(char* username, long finalscore, int candelay); 30 | extern void writedelayedhiscores(void); 31 | 32 | #define HISCORENUM 10 33 | 34 | 35 | extern char hiscorename[HISCORENUM][50]; 36 | extern long hiscoreval[HISCORENUM]; 37 | 38 | #endif /* HISCORE_H */ 39 | -------------------------------------------------------------------------------- /icebreaker.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #ifndef __MINGW32__ 29 | #include 30 | #endif 31 | #include 32 | #include 33 | 34 | 35 | #include "icebreaker.h" 36 | #include "penguin.h" 37 | #include "line.h" 38 | #include "sound.h" 39 | #include "globals.h" 40 | #include "grid.h" 41 | #include "level.h" 42 | #include "intro.h" 43 | #include "text.h" 44 | #include "transition.h" 45 | #include "hiscore.h" 46 | #include "dialog.h" 47 | #include "options.h" 48 | #include "fullscreen.h" 49 | #include "cursor.h" 50 | #include "themes.h" 51 | #include "titlebar.h" 52 | #include "benchmark.h" 53 | #include "misc.h" 54 | 55 | // global 56 | SDL_Surface* screen; 57 | SDL_Surface* fullscreen; 58 | 59 | char username[50]; // FIX -- move this into the options struct? 60 | char homedir[255]; 61 | 62 | SDL_Surface * penguinicon; 63 | 64 | // functions 65 | 66 | int setup(void); 67 | void cleanup(void); 68 | 69 | /************************************************************************/ 70 | 71 | int setup(void) 72 | { 73 | struct passwd * userinfo; 74 | int newuser=false; 75 | 76 | srandom(time(NULL)+getpid()); 77 | 78 | //stupid buffers 79 | setvbuf(stdout,(char *)NULL, _IOLBF, 0); 80 | 81 | userinfo = getpwuid(getuid()); // FIX -- make this part of the options struct; and maybe save in options file 82 | snprintf(username,50,"%s",userinfo->pw_name); // not like it's gonna be fifty characters. but y'know. note: gets chopped to fit in gethighusername(). 83 | snprintf(homedir,255,"%s",userinfo->pw_dir); // fix - use OS define for length 84 | 85 | inithiscores(); 86 | newuser=readoptions(); 87 | 88 | if (commandline.fullscreen==FULLSCREENOFF) 89 | options.fullscreen=FULLSCREENOFF; 90 | else if (commandline.fullscreen==FULLSCREENON && options.fullscreen==FULLSCREENOFF) 91 | options.fullscreen=FULLSCREENON; 92 | 93 | 94 | if (SDL_Init(SDL_INIT_VIDEO)) 95 | { 96 | fprintf(stderr, "Hey. We're gonna need some graphics.\n" 97 | "SDL error: " 98 | "%s\n\n", SDL_GetError()); 99 | exit(1); 100 | } 101 | 102 | 103 | atexit(cleanup); 104 | 105 | 106 | penguinicon = SDL_LoadBMP(DATAPREFIX "/" PENGUINICONFILE); 107 | if (penguinicon==NULL) fprintf(stderr, "Icon not loaded!\n\n*** IceBreaker probably wasn't installed properly. ***\n\n"); 108 | SDL_WM_SetIcon(penguinicon,NULL); 109 | 110 | if (options.fullscreen==FULLSCREENOFF) 111 | { 112 | // gotta do this right away or else we risk getting an ugly "SDL_App" 113 | // in the titlebar for a few milliseconds -- can't have that! 114 | SDL_WM_SetCaption("IceBreaker","IceBreaker"); 115 | screen = SDL_SetVideoMode(WIDTH, HEIGHT, VIDEODEPTH, SDL_SWSURFACE); 116 | 117 | } 118 | else 119 | { 120 | screen = NULL; 121 | makefullscreen(); 122 | } 123 | 124 | if (screen == NULL) 125 | { 126 | fprintf(stderr, "Help! Couldn't get a window.\n" 127 | "SDL error: " 128 | "%s\n\n", SDL_GetError()); 129 | exit(1); 130 | } 131 | 132 | initsound(); 133 | 134 | inittext(); 135 | 136 | initgrid(); 137 | 138 | initcursors(); 139 | 140 | if (strlen(commandline.theme)>0) 141 | settheme(commandline.theme); 142 | else 143 | settheme(options.theme); 144 | 145 | return newuser; 146 | } 147 | 148 | void cleanup() 149 | { 150 | quitgrid(); 151 | quitsound(); 152 | quitcursors(); 153 | SDL_Quit(); 154 | writeoptions(); 155 | writedelayedhiscores(); 156 | } 157 | 158 | 159 | 160 | int main(int argc,char** argv) 161 | { 162 | int done = false; 163 | int level=0; 164 | ScoreSheet levelscore; 165 | long totalscore=0; 166 | char windowtitle[39]; 167 | LevelExitType levelresult; 168 | int newuser=false; 169 | int rc=0; 170 | 171 | #ifdef NEEDCHANGETOARGV0PATH 172 | changetoargv0path(argv[0]); 173 | #endif 174 | 175 | rc=parsecommandline(argc,argv); 176 | if (rc) return rc; 177 | 178 | newuser=setup(); 179 | 180 | drawtitlebar("IceBreaker"); 181 | 182 | #if DEVELRELEASE 183 | if (gameflags.benchmarkmode) 184 | { 185 | drawtitlebar("IceBreaker -- Benchmark mode"); 186 | rc=benchmark(); 187 | return rc; 188 | } 189 | #endif /* DEVELRELEASE */ 190 | 191 | done=intro(); 192 | 193 | if (!done && newuser) 194 | { // no options file; using the default 195 | setcursor(CURSORCLICK); 196 | if (popuphelp()==POPUPQUITGAME) done=true; 197 | setcursor(CURSORARROW); 198 | } 199 | 200 | 201 | while(!done) 202 | { 203 | level++; 204 | if (level>=MAXPENGUINS) level=MAXPENGUINS-1; 205 | 206 | switch (options.difficulty) 207 | { 208 | case NORMAL: 209 | snprintf(windowtitle,39,"IceBreaker -- Level %d",level); 210 | break; 211 | case HARD: 212 | snprintf(windowtitle,39,"IceBreaker -- Level %d (Hard)",level); 213 | break; 214 | case EASY: 215 | snprintf(windowtitle,39,"IceBreaker -- Level %d (Easy)",level); 216 | break; 217 | } 218 | drawtitlebar(windowtitle); 219 | 220 | if (!strcmp(commandline.theme,"random") || (strlen(commandline.theme)==0 && !strcmp(options.theme,"random"))) 221 | settheme("random"); 222 | 223 | levelresult=playlevel(level,totalscore,&levelscore); 224 | 225 | drawtitlebar("IceBreaker"); 226 | 227 | totalscore+= levelscore.basescore + levelscore.clearbonus + levelscore.lifebonus; 228 | 229 | switch (levelresult) 230 | { 231 | case QUIT: 232 | done=true; 233 | break; 234 | case DEAD: 235 | done=gameover(totalscore); 236 | // falls through 237 | case ZERO: 238 | // hooray! modifying the index variable in the loop! 239 | // good coding practice at its finest! 240 | level=0; 241 | totalscore=0; 242 | break; 243 | case ERROR: 244 | fprintf(stderr,"Level error -- this should never happen.\n"); 245 | break; 246 | case PASS: 247 | // level completed successfully 248 | done=intermission(&levelscore,level+1); 249 | break; 250 | } 251 | 252 | } 253 | 254 | return rc; 255 | } 256 | -------------------------------------------------------------------------------- /icebreaker.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=IceBreaker 3 | Type=Application 4 | Comment=addictive action-puzzle game involving bouncing penguins 5 | Exec=icebreaker 6 | Icon=/usr/share/icebreaker/icebreaker_128.png 7 | Terminal=false 8 | Keywords=puzzle;game;penguins;ice; 9 | Categories=Game;LogicGame; 10 | -------------------------------------------------------------------------------- /icebreaker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2021 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | // fix -- move most of this to be config.h, and make the current globals.h 24 | // be icebreaker.h 25 | 26 | #ifndef ICEBREAKER_H 27 | #define ICEBREAKER_H 28 | 29 | /************************************************************************/ 30 | /* Versions and so forth -- you probably shouldn't change this. */ 31 | 32 | #define VERSION 2.2.2 33 | #define VERMAJOR 2 34 | #define VERMINOR 2 35 | #define VERSUB 2 36 | 37 | #ifndef DEVELRELEASE 38 | #define DEVELRELEASE VERMINOR & 1 39 | #endif 40 | 41 | /************************************************************************/ 42 | /* Platform-specific stuff */ 43 | 44 | 45 | #ifdef __MINGW32__ 46 | #ifndef WIN32 47 | #define WIN32 48 | #endif 49 | #endif 50 | 51 | 52 | #ifdef WIN32 53 | 54 | #include "win32_compatibility.h" 55 | 56 | #ifndef OPTIONFILE 57 | #define OPTIONFILE "icebreaker.cfg" 58 | #endif 59 | 60 | #define PENGUINICONFILE "penguinicon_32.bmp" 61 | 62 | #define HISCORELOCKFILE "./lockhelper.lck" 63 | 64 | // HISCOREPREFIX and DATAPREFIX should probably be ".". Set in Makefile.w32 65 | #endif 66 | 67 | 68 | #ifdef __BEOS__ 69 | 70 | #define NEEDCHANGETOARGV0PATH 71 | 72 | #ifndef OPTIONFILE 73 | #define OPTIONFILE "config/settings/icebreaker.cfg" 74 | #endif 75 | 76 | // HISCOREPREFIX and DATAPREFIX should probably be ".". Set in Makefile.beos 77 | #endif 78 | 79 | 80 | #ifdef __MACOSX__ 81 | 82 | #error "Mac OS probably doesn't actually work yet -- help wanted." 83 | 84 | #define ONEBUTTONMICEARESILLY 85 | 86 | // HISCOREPREFIX and DATAPREFIX should probably be ".". Set in Makefile.osx 87 | #endif 88 | 89 | 90 | /************************************************************************/ 91 | /* and here's the defaults */ 92 | 93 | 94 | 95 | #ifndef DATAPREFIX 96 | #define DATAPREFIX "/usr/local/share/icebreaker" 97 | #endif 98 | 99 | #ifndef OPTIONFILE 100 | #define OPTIONFILE ".icebreaker" 101 | #endif 102 | 103 | #ifndef HISCOREFILE 104 | #define HISCOREFILE ".icebreaker.scores" 105 | #endif 106 | 107 | #ifndef HISCORELOCKFILE 108 | #define HISCORELOCKFILE HISCOREFILE 109 | #endif 110 | 111 | #ifndef PENGUINICONFILE 112 | #define PENGUINICONFILE "icebreaker_48.bmp" 113 | #endif 114 | 115 | /************************************************************************/ 116 | /* themes stuff */ 117 | 118 | #define THEMEFILEEXTENSION ".ibt" 119 | // this isn't because of filesystem restrictions, although it might help 120 | // with portability. It's because of display space in the options menu. 121 | #define MAXTHEMENAMELENGTH 7 122 | 123 | // these are used if no themes are found -- probably could remove this 124 | // completely now that themes are working well. 125 | #define SNDFILEOUCH "ouch.wav" 126 | #define SNDFILEBREAK "crash.wav" 127 | #define PENGUINBMPFILE "penguin.bmp" 128 | 129 | 130 | /************************************************************************/ 131 | /* Changing these will significantly affect game play. */ 132 | 133 | #define BLOCKWIDTH 14 134 | #define BLOCKHEIGHT 14 135 | 136 | #define COLS 32 137 | #define ROWS 20 138 | 139 | #define PLAYWIDTH (COLS*BLOCKWIDTH) 140 | #define PLAYHEIGHT (ROWS*BLOCKHEIGHT) 141 | 142 | #define MARGINTOP 39 143 | #define MARGINBOTTOM 38 144 | #define MARGINLEFT 26 145 | #define MARGINRIGHT 26 146 | 147 | #define FULLWIDTH 1920 148 | #define FULLHEIGHT 1080 149 | #define FULLTOPMARGIN 80 150 | #define FULLLEFTMARGIN ( (FULLWIDTH - WIDTH)/2 ) 151 | 152 | #define WIDTH (MARGINLEFT+PLAYWIDTH+MARGINRIGHT) 153 | #define HEIGHT (MARGINTOP+PLAYHEIGHT+MARGINBOTTOM) 154 | 155 | #define BORDERTOP MARGINTOP 156 | #define BORDERBOTTOM (MARGINTOP+PLAYHEIGHT) 157 | #define BORDERLEFT MARGINLEFT 158 | #define BORDERRIGHT (MARGINLEFT+PLAYWIDTH) 159 | 160 | #define VIDEODEPTH 16 161 | 162 | #define MAXPENGUINS 100 163 | 164 | #define PENGUINSPEED 2 165 | 166 | #define LINESPEED 2 167 | 168 | #define LINEMAXSTUCK 750 169 | 170 | // fps = 1000/MSECPERFRAME (not counting fuzziness, which will round this 171 | // down to the nearest 10) 172 | #define MSECPERFRAME 11 173 | 174 | #define FUZZYFPS 175 | 176 | #define PERCENTREQUIRED 80 177 | #define PERCENTBONUS 80 178 | #define PERCENTEXTRABONUS 85 179 | 180 | 181 | #define KEYBOARDARROWTHROTTLER 5 182 | #define KEYBOARDARROWACCELPOINT 5 183 | 184 | /************************************************************************/ 185 | /* and, always useful: */ 186 | #ifndef true 187 | #define true -1 188 | #endif 189 | 190 | #ifndef false 191 | #define false 0 192 | #endif 193 | 194 | 195 | 196 | 197 | #endif /* ICEBREAKER_H */ 198 | -------------------------------------------------------------------------------- /icebreaker.man.in: -------------------------------------------------------------------------------- 1 | .de Y 2 | .ft CW 3 | .in +4n 4 | .nf 5 | \&\\$1 6 | .ft 7 | .in 8 | .fi 9 | .. 10 | .TH icebreaker 6 "v$VERSION: $VERDATE" 11 | .SH NAME 12 | icebreaker - An addictive action-puzzle game for X. 13 | .SH SYNOPSIS 14 | .B icebreaker 15 | .SH DESCRIPTION 16 | So, uh, there's a bunch of penguins on an iceberg in Antarctica. You 17 | have been selected to catch them so they can be shipped to Finland, where 18 | they are essential to a secret plot for world domination. 19 | .PP 20 | In order to trap the penguins, you'll need to break the iceberg into small 21 | chunks by melting lines without hitting any of the birds. Once 80% or more 22 | of the 'berg is gone, you advance to the next level. 23 | .PP 24 | Use the left mouse button to start lines, and the right (and/or middle) 25 | button to toggle between horizontal and vertical. Beyond that, it's probably 26 | easier for you go figure out the game by playing than by reading. So go. 27 | .PP 28 | Go! 29 | .SH OPTIONS 30 | .TP 31 | .B \-n, \-\-nosound 32 | do not attempt to initialize sound system. Causes the in-game Sound option to 33 | be marked N/A, and the config file setting to be ignored. 34 | .TP 35 | .B \-f, \-\-fullscreen 36 | start in fullscreen mode if possible. Ignores config file setting. 37 | .TP 38 | .B \-w, \-\-windowed 39 | start in windowed mode. Resets config file so that this is the default. You 40 | probably won't ever need to use this, but it's there in case 41 | fullscreen somehow is broken and you're too lazy to edit the config file 42 | manually. 43 | .TP 44 | \fB\-t\fIthemename\fP, \fB\--theme=\fIthemename\fP 45 | select theme \fIthemename\fR -- overrides config file. For more information 46 | on themes, see README.themes or the IceBreaker web site. 47 | .TP 48 | .B \-l, \-\-listthemes 49 | show available themes. 50 | .TP 51 | .B \-v, \-\-version 52 | display version and copyright information 53 | .TP 54 | .B \-h, \-\-help 55 | display simple command-line option help screen 56 | .SH FILES 57 | .TP 58 | .I $HIGHSCOREDIRicebreaker.scores 59 | The system-wide list of high scores. 60 | .TP 61 | .I ~/.icebreaker 62 | The per-user options file; see comments in the file itself for more info. 63 | .SH BUGS 64 | See the included TODO file. And I'm sure there's a few that have slipped in 65 | without my knowledge. Please report anything you find to 66 | .IR mattdm@mattdm.org . 67 | 68 | .SH SEE ALSO 69 | There's an included README file. It's very clever. (I know because I wrote 70 | it.) And there's a web site at 71 | .IR http://www.mattdm.org/icebreaker/ . 72 | 73 | .SH COPYRIGHT 74 | icebreaker is Copyright (C) 2000-2002 Matthew Miller and released under the 75 | terms of the GNU General Public License. See the documentation included with 76 | the program for more details. 77 | .SH AUTHOR 78 | Matthew Miller (mattdm@mattdm.org) 79 | -------------------------------------------------------------------------------- /icebreaker.nsi.in: -------------------------------------------------------------------------------- 1 | ; icebreaker.nsi 2 | ; 3 | ; This script is used by the Nullsoft Scriptable Install System 4 | ; 5 | ; This is part of MingW on Fedora Linux, so we can cross-build 6 | ; the installer as well as the program itself. 7 | 8 | Name "IceBreaker" 9 | OutFile "icebreaker-%ICEBREAKERVERSION.exe" 10 | 11 | BrandingText "Install System by Nullsoft" 12 | 13 | Icon "../icebreaker_16c.ico" 14 | WindowIcon on 15 | BGGradient off 16 | CRCCheck on 17 | 18 | InstallDir $PROGRAMFILES\IceBreaker 19 | InstallDirRegKey HKLM "Software\IceBreaker" "InstallDir" 20 | 21 | LicenseText "IceBreaker is Free Software; you can redistribute or modify it under the terms of the GNU GPL. Copyright (c) 2000-2021 Matthew Miller , et al." "Continue" 22 | LicenseData "LICENSE.txt" 23 | 24 | InstallColors C0C0C0 404040 25 | InstProgressFlags smooth colored 26 | ShowInstDetails show 27 | 28 | SetOverwrite on 29 | SetCompress auto 30 | SetDatablockOptimize on 31 | SetDateSave on 32 | AutoCloseWindow true 33 | 34 | Section "IceBreaker" 35 | SetOutPath $INSTDIR 36 | File icebreaker.exe 37 | File *.dll 38 | File lockhelper.lck 39 | SetFileAttributes $INSTDIR\lockhelper.lck FILE_ATTRIBUTE_HIDDEN 40 | DetailPrint "Linux rules." 41 | File *.wav 42 | File *.bmp 43 | File *.ibt 44 | File *.txt 45 | File *.tar.xz 46 | WriteRegStr HKLM "Software\IceBreaker" "InstallDir" "$INSTDIR" 47 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\IceBreaker" "DisplayName" "IceBreaker" 48 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\IceBreaker" "UninstallString" '"$INSTDIR\uninstall.exe"' 49 | WriteUninstaller "uninstall.exe" 50 | SectionEnd 51 | 52 | Section "Start Menu Shortcuts" 53 | CreateDirectory "$SMPROGRAMS\IceBreaker" 54 | CreateShortCut "$SMPROGRAMS\IceBreaker\IceBreaker.lnk" "$INSTDIR\icebreaker.exe" "" "$INSTDIR\icebreaker.exe" 0 55 | CreateShortCut "$SMPROGRAMS\IceBreaker\ReadMe.lnk" "$INSTDIR\README.txt" "" "" 0 56 | CreateShortCut "$SMPROGRAMS\IceBreaker\IceBreaker - fullscreen.lnk" "$INSTDIR\icebreaker.exe" "-f" "$INSTDIR\icebreaker.exe" 0 57 | CreateShortCut "$SMPROGRAMS\IceBreaker\IceBreaker - random themes.lnk" "$INSTDIR\icebreaker.exe" "-trandom" "$INSTDIR\icebreaker.exe" 0 58 | CreateShortCut "$SMPROGRAMS\IceBreaker\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 59 | DetailPrint "Installation Finished." 60 | SectionEnd 61 | 62 | UninstallText "This will delete IceBreaker from your computer. Hit Uninstall to continue, sadly." 63 | 64 | Section "Uninstall" 65 | SetAutoClose false 66 | SetDetailsView show 67 | 68 | Delete "$SMPROGRAMS\IceBreaker\*.*" 69 | RMDir "$SMPROGRAMS\IceBreaker" 70 | 71 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\IceBreaker" 72 | DeleteRegKey HKLM "Software\IceBreaker" 73 | 74 | Delete $INSTDIR\lockhelper.lck 75 | Delete $INSTDIR\icebreaker.exe 76 | Delete $INSTDIR\*.dll 77 | Delete $INSTDIR\*.wav 78 | Delete $INSTDIR\*.bmp 79 | Delete $INSTDIR\*.ibt 80 | Delete $INSTDIR\*.txt 81 | Delete $INSTDIR\*.tar.xz 82 | Delete $INSTDIR\uninstall.exe 83 | 84 | IfFileExists $INSTDIR\icebreaker.cfg HaveCSFiles 85 | IfFileExists $INSTDIR\icebreaker.scores HaveCSFiles EndDelCSFiles 86 | HaveCSFiles: 87 | MessageBox MB_YESNO "Remove high score / configuration files?" IDNO NoDelCSFiles 88 | Delete $INSTDIR\icebreaker.cfg 89 | Delete $INSTDIR\icebreaker.scores 90 | Goto EndDelCSFiles 91 | NoDelCSFiles: 92 | IfFileExists $INSTDIR\icebreaker.cfg NotRemCMesg CheckRemSMesg 93 | NotRemCMesg: 94 | DetailPrint "Not removing file $INSTDIR\icebreaker.cfg" 95 | CheckRemSMesg: 96 | IfFileExists $INSTDIR\icebreaker.scores NotRemSMesg EndDelCSFiles 97 | NotRemSMesg: 98 | DetailPrint "Not removing file $INSTDIR\icebreaker.scores" 99 | EndDelCSFiles: 100 | 101 | IfFileExists $INSTDIR\icebreaker.* NoRMDir 102 | RMDir "$INSTDIR" 103 | Goto EndRMDir 104 | NoRMDir: 105 | DetailPrint "Not removing directory $INSTDIR" 106 | EndRMDir: 107 | SectionEnd 108 | 109 | Function .onInstSuccess 110 | MessageBox MB_YESNO "Installation Successful. Run IceBreaker now?" IDNO NoReadme 111 | Exec $INSTDIR\icebreaker.exe 112 | NoReadme: 113 | FunctionEnd 114 | 115 | 116 | ; eof 117 | -------------------------------------------------------------------------------- /icebreaker.spec: -------------------------------------------------------------------------------- 1 | Name: icebreaker 2 | Version: 2.2.2 3 | Release: 1 4 | Summary: An addictive action-puzzle game involving bouncing penguins 5 | %define isprerelease 0 6 | %define isdevelrelease 0 7 | License: GPLv2+ 8 | 9 | %if %{isprerelease} 10 | Source: icebreaker-%{version}-%{release}.tar.xz 11 | %else 12 | Source: https://mattdm.org/icebreaker/2.1.x/icebreaker-%{version}.tar.xz 13 | %endif 14 | 15 | URL: http://www.mattdm.org/icebreaker/ 16 | 17 | BuildRequires: gcc, make 18 | BuildRequires: SDL-devel, SDL_mixer-devel 19 | BuildRequires: gawk, sed, grep 20 | BuildRequires: desktop-file-utils 21 | 22 | %if %{isprerelease} 23 | %define extradescription *** Warning *** This is a prerelease build not meant for general public use. 24 | %elseif %{isdevelrelease} 25 | %define extradescription NOTE: This is a development release. Bug-testers only, please. 26 | %endif 27 | 28 | %description 29 | IceBreaker is an action-puzzle game in which you must capture penguins from 30 | an Antarctic iceberg so they can be shipped to Finland, where they are 31 | essential to a secret plot for world domination. To earn the highest Geek 32 | Cred, trap them in the smallest space in the shortest time while losing the 33 | fewest lives. IceBreaker was inspired by (but is far from an exact clone of) 34 | Jezzball by Dima Pavlovsky. 35 | %{extradescription} 36 | 37 | %prep 38 | %if %{isprerelease} 39 | %setup -q -n %{name}-%{version}-%{release} 40 | %else 41 | %setup -q 42 | %endif 43 | 44 | %build 45 | make OPTIMIZE="$RPM_OPT_FLAGS" prefix=%{_prefix} 46 | 47 | %install 48 | make install prefix=${RPM_BUILD_ROOT}%{_prefix} 49 | desktop-file-install --dir=%{buildroot}%{_datadir}/applications icebreaker.desktop 50 | mkdir ${RPM_BUILD_ROOT}%{_datadir}/metainfo 51 | cp metainfo.xml ${RPM_BUILD_ROOT}%{_datadir}/metainfo/org.mattdm.icebreaker.metainfo.xml 52 | 53 | %files 54 | %license LICENSE 55 | %doc README README.themes TODO ChangeLog 56 | %{_bindir}/icebreaker 57 | %{_datadir}/applications/icebreaker.desktop 58 | %{_datadir}/metainfo/org.mattdm.icebreaker.metainfo.xml 59 | %{_datadir}/icebreaker 60 | %{_mandir}/man6/* 61 | 62 | 63 | %changelog 64 | * Thu Jul 13 2023 Matthew Miller - 2.2.2-1 65 | - fix some really dumb stuff :) 66 | 67 | * Sun Oct 2 2021 Matthew Miller - 2.2.1-1 68 | - minor build improvements via PR from reinerh 69 | 70 | * Mon Mar 1 2021 Matthew Miller - 2.2.0-1[A 71 | - made Windows work so I'm going to call this 2.2 72 | 73 | * Mon Mar 1 2021 Matthew Miller - 2.1.3-1 74 | - fix metainfo oops 75 | 76 | * Mon Mar 1 2021 Matthew Miller - 2.1.2-1 77 | - update metainfo for GNOME Software 78 | 79 | * Tue Feb 23 2021 Matthew Miller - 2.1.1-1 80 | - update to 2.1.1 to fix some more buffer overflows 81 | 82 | * Wed Sep 2 2020 Matthew Miller - 2.1.0-1 83 | - update to 2.1 84 | - include metainfo 85 | 86 | * Sun Aug 30 2020 Matthew Miller - 2.0.2-1 87 | - minor tweaks 88 | 89 | * Sun Aug 30 2020 Matthew Miller - 2.0.0-1 90 | - high scores are going to be local to each home directory; no more setgid 91 | - update to 2.0.0 92 | 93 | * Thu Nov 16 2006 Matthew Miller 94 | - working towards 1.9.9 :) 95 | 96 | * Fri May 31 2002 Matthew Miller 97 | - 1.9.6 98 | 99 | * Mon May 27 2002 Matthew Miller 100 | - 1.9.5 101 | 102 | * Thu May 23 2002 Matthew Miller 103 | - more complex makefile allows simpler specfile 104 | 105 | * Tue May 21 2002 Matthew Miller 106 | - added themes docs 107 | 108 | * Sun May 19 2002 Matthew Miller 109 | - inserted some convenience stuff to enable "make rpm" magic to work 110 | - added "isprerelease" check. No one but me should care about this. 111 | 112 | * Sun May 19 2002 Matthew Miller 113 | - 1.9.2 114 | 115 | * Fri May 17 2002 Matthew Miller 116 | - REALLY add .ibt files for themes 117 | 118 | * Mon May 13 2002 Matthew Miller 119 | - add .ibt files for themes 120 | 121 | * Wed May 08 2002 Matthew Miller 122 | - 1.9.1 123 | 124 | * Wed Aug 01 2001 Matthew Miller 125 | - 1.9.0 126 | 127 | * Mon Jul 30 2001 Matthew Miller 128 | - 1.2.1 129 | 130 | * Sat Jul 28 2001 Matthew Miller 131 | - 1.2 132 | 133 | * Tue Jul 24 2001 Matthew Miller 134 | - move man page section 6 135 | 136 | * Sun Jul 22 2001 Matthew Miller 137 | - 1.1 138 | 139 | * Fri Jul 20 2001 Matthew Miller 140 | - borrowed idea of using post-script to create high score file 141 | from Mandrake RPM. That way, it doesn't have to be marked as a config 142 | file, and yet won't get zapped on upgrade. 143 | - also, modified Makefile to cope with RPM_OPT_FLAGS, again as per 144 | Mandrake. 145 | 146 | * Thu Jul 19 2001 Matthew Miller 147 | - added man page 148 | 149 | * Tue Jul 18 2001 Matthew Miller 150 | - updated to 1.09 151 | 152 | * Thu Oct 5 2000 Matthew Miller 153 | - looks good to me. one-point-oh 154 | 155 | * Tue Oct 3 2000 Matthew Miller 156 | - updated to 0.995 157 | - better make process 158 | 159 | * Mon Oct 2 2000 Matthew Miller 160 | - updated to 0.99 :) 161 | 162 | * Mon Oct 2 2000 Matthew Miller 163 | - updated to 0.98 164 | 165 | * Fri Sep 15 2000 Matthew Miller 166 | - first package 167 | -------------------------------------------------------------------------------- /icebreaker_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/icebreaker_128.png -------------------------------------------------------------------------------- /icebreaker_16c.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/icebreaker_16c.ico -------------------------------------------------------------------------------- /icebreaker_32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/icebreaker_32.ico -------------------------------------------------------------------------------- /icebreaker_48.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/icebreaker_48.bmp -------------------------------------------------------------------------------- /intro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef INTRO_H 24 | #define INTRO_H 25 | 26 | extern int intro(void); 27 | 28 | #endif /* INTRO_H */ 29 | -------------------------------------------------------------------------------- /jz-like.ibt: -------------------------------------------------------------------------------- 1 | Background 32 32 32 2 | NormalText 255 255 255 3 | BoardFillMin 192 192 192 4 | BoardFillMax 192 192 192 5 | Gridline 128 128 128 6 | GridHighlight 255 255 255 7 | Line1 192 0 0 8 | Line2 0 0 192 9 | MenuHighlight 192 192 192 10 | GameoverText 192 0 64 11 | ScorescrollText 0 0 192 12 | BonusscrollText 192 0 64 13 | TextentryBox 192 192 192 14 | TextentryText 0 0 0 15 | CopyrightText 192 192 192 16 | SpriteTransparent 0 0 255 17 | SpriteBitmap atom.bmp 18 | SoundOuch pop.wav 19 | SoundCrash drum.wav 20 | -------------------------------------------------------------------------------- /kitty.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/kitty.bmp -------------------------------------------------------------------------------- /kitty.ibt: -------------------------------------------------------------------------------- 1 | Background 255 102 153 2 | NormalText 255 255 255 3 | BoardFillMin 224 224 224 4 | BoardFillMax 255 255 255 5 | Gridline 192 192 192 6 | GridHighlight 255 255 255 7 | Line1 164 196 225 8 | Line2 255 168 255 9 | MenuHighlight 255 255 255 10 | GameoverText 255 204 51 11 | ScorescrollText 96 96 255 12 | BonusscrollText 255 204 51 13 | TextentryBox 96 96 255 14 | TextentryText 255 204 51 15 | CopyrightText 255 204 51 16 | SpriteTransparent 0 255 0 17 | SpriteBitmap kitty.bmp 18 | SoundOuch ewww.wav 19 | SoundCrash pop.wav 20 | -------------------------------------------------------------------------------- /laundry.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include "icebreaker.h" 27 | #include "globals.h" 28 | #include "laundry.h" 29 | #include "options.h" 30 | #include "fullscreen.h" 31 | 32 | static SDL_Rect laundrylist[MAXDIRTY]; 33 | static int laundrycount; 34 | 35 | void initlaundry() 36 | { 37 | laundrycount=0; 38 | } 39 | 40 | 41 | void soil(SDL_Rect r) 42 | { // makes stuff dirty, of course. 43 | if (laundrycount 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef LAUNDRY_H 24 | #define LAUNDRY_H 25 | 26 | extern void soil(SDL_Rect r); 27 | extern void clean(void); 28 | extern void updateall(void); 29 | extern void initlaundry(void); 30 | 31 | #define MAXDIRTY 2000 32 | 33 | #endif /* LAUNDRY_H */ 34 | -------------------------------------------------------------------------------- /level.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef LEVEL_H 24 | #define LEVEL_H 25 | 26 | #include "line.h" 27 | #include "penguin.h" 28 | 29 | typedef enum { ERROR, PASS, DEAD, ZERO, QUIT } LevelExitType; 30 | 31 | typedef struct 32 | { 33 | int basescore; 34 | int clearbonus; 35 | int lifebonus; 36 | } ScoreSheet; 37 | 38 | 39 | extern LevelExitType playlevel(int level, long oldscore, ScoreSheet * score); 40 | 41 | extern void redrawwholelevel(void); 42 | extern int checkiflevelatstart(void); 43 | 44 | // FIX -- these shouldn't need to be globals 45 | extern Line line1; 46 | extern Line line2; 47 | extern Penguin pg_flock[MAXPENGUINS]; 48 | extern int penguincount; 49 | 50 | 51 | #endif /* LEVEL_H */ 52 | -------------------------------------------------------------------------------- /line.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * http://www.mattdm.org/ 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the Free 8 | * Software Foundation; either version 2 of the License, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 | * for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | 23 | #include 24 | #include "icebreaker.h" 25 | #include "globals.h" 26 | #include "line.h" 27 | #include "laundry.h" 28 | #include "grid.h" 29 | #include "themes.h" 30 | 31 | Line createline(int linenum) 32 | { 33 | Line l; 34 | 35 | switch (linenum) 36 | { 37 | case 1: 38 | l.id='1'; 39 | l.colorpointer=&(color.line1); 40 | break; 41 | case 2: 42 | l.id='2'; 43 | l.colorpointer=&(color.line2); 44 | break; 45 | default: 46 | l.id='L'; 47 | l.colorpointer=&(color.background); 48 | break; 49 | } 50 | 51 | l.on=false; 52 | l.dir=UP; 53 | l.geom.x=0; 54 | l.geom.y=0; 55 | l.geom.w=BLOCKWIDTH; 56 | l.geom.h=BLOCKHEIGHT; 57 | l.mark=l.geom; 58 | l.dead=false; 59 | l.speedslower=false; 60 | l.stuckcount=0; 61 | return(l); 62 | } 63 | 64 | void startline(Line * l, LineDir d, int x, int y) 65 | { 66 | l->on=true; 67 | l->dir=d; 68 | l->stuckcount=0; 69 | 70 | switch (d) 71 | { 72 | case UP: 73 | l->geom.w=BLOCKWIDTH; 74 | l->geom.h=1; 75 | l->geom.x=x; 76 | l->geom.y=y-1; 77 | break; 78 | case DOWN: 79 | l->geom.w=BLOCKWIDTH; 80 | l->geom.h=1; 81 | l->geom.x=x; 82 | l->geom.y=y; 83 | break; 84 | case LEFT: 85 | l->geom.w=1; 86 | l->geom.h=BLOCKHEIGHT; 87 | l->geom.x=x-1; 88 | l->geom.y=y; 89 | break; 90 | case RIGHT: 91 | l->geom.w=1; 92 | l->geom.h=BLOCKHEIGHT; 93 | l->geom.x=x; 94 | l->geom.y=y; 95 | break; 96 | } 97 | l->mark=l->geom; 98 | } 99 | 100 | 101 | int moveline(Line * l) 102 | { 103 | int finish=false; 104 | char check1; 105 | char check2; 106 | 107 | markgrid(l->mark.x,l->mark.y,l->mark.w,l->mark.h,l->id); 108 | SDL_FillRect(screen,&(l->mark),*(l->colorpointer)); 109 | soil(l->mark); 110 | 111 | switch (l->dir) 112 | { 113 | case UP: 114 | check1=grid[l->geom.x][l->geom.y-1]; 115 | check2=grid[l->geom.x+BLOCKWIDTH-1][l->geom.y-1]; 116 | break; 117 | case DOWN: 118 | check1=grid[l->geom.x][l->geom.y+l->geom.h]; 119 | check2=grid[l->geom.x+BLOCKWIDTH-1][l->geom.y+l->geom.h]; 120 | break; 121 | case LEFT: 122 | check1=grid[l->geom.x-1][l->geom.y]; 123 | check2=grid[l->geom.x-1][l->geom.y+BLOCKHEIGHT-1]; 124 | break; 125 | case RIGHT: 126 | check1=grid[l->geom.x+l->geom.w][l->geom.y]; 127 | check2=grid[l->geom.x+l->geom.w][l->geom.y+BLOCKHEIGHT-1]; 128 | break; 129 | default: // this will never happen. really. 130 | fprintf(stderr,"Line has no direction. That shouldn't have happened.\n"); 131 | check1='!'; 132 | check2='!'; 133 | break; 134 | } 135 | 136 | 137 | if (check1 == ' ' && check2 == ' ') 138 | { // next space is empty 139 | switch (l->dir) 140 | { 141 | case UP: 142 | l->geom.y--; 143 | l->geom.h++; 144 | l->mark.y--; 145 | l->mark.h=1; 146 | break; 147 | case DOWN: 148 | l->geom.h++; // increase length of line -- top stays same 149 | l->mark.y+=l->mark.h; 150 | l->mark.h=1; 151 | break; 152 | case LEFT: 153 | l->geom.x--; 154 | l->geom.w++; 155 | l->mark.x--; 156 | l->mark.w=1; 157 | break; 158 | case RIGHT: 159 | l->geom.w++; // increase width of line -- left side stays same 160 | l->mark.x+=l->mark.w; 161 | l->mark.w=1; 162 | break; 163 | } 164 | } 165 | else if (check1 == '*' || check2 == '*') 166 | { // hit a penguin. kills line. 167 | l->dead=true; 168 | } 169 | else if (check1 == '1' || check2 == '1' || check1 == '2' || check2 == '2') 170 | { 171 | if (l->stuckcount>LINEMAXSTUCK) 172 | { 173 | // FIX -- should play sound when this happens, to 174 | // let users know that this isn't a mistake. 175 | finish=true; 176 | } 177 | else 178 | { 179 | l->stuckcount++; 180 | 181 | // FIX: kludge-o-rama!! 182 | // this could work around the irritating thing where 183 | // a line gets started 'on top' of another line. but it 184 | // is totally repairing the symptom, not the bug. *sigh* 185 | //if (l->geom.w==1 || l->geom.h==1) finish=true; 186 | } 187 | } 188 | else 189 | { // hit something else 190 | finish=true; 191 | } 192 | 193 | if (finish) 194 | { 195 | markgrid(l->mark.x,l->mark.y,l->mark.w,l->mark.h,l->id); 196 | SDL_FillRect(screen,&(l->mark),*(l->colorpointer)); 197 | soil(l->mark); 198 | finishline(l); 199 | return(1); 200 | } 201 | 202 | return(0); 203 | } 204 | 205 | void finishline(Line * l) 206 | { 207 | int i; 208 | int quick1=false; 209 | int quick2=false; 210 | 211 | l->on=false; 212 | 213 | //printwholegrid(); 214 | 215 | switch (l->dir) 216 | { 217 | case DOWN: 218 | // falls through. 219 | case UP: 220 | markgrid(l->geom.x,l->geom.y,l->geom.w,l->geom.h,'|'); 221 | SDL_FillRect(screen,&l->geom,color.background); 222 | soil(l->geom); 223 | 224 | // scan along edges to quickly determine if this 225 | // is going to be complicated. 226 | quick1=true; quick2=true; 227 | for (i=l->geom.y+BLOCKHEIGHT/2;igeom.y+l->geom.h;i++) 228 | { 229 | if (grid[l->geom.x-1][i] != ' ' && grid[l->geom.x-1][i] != '*') quick1=false; 230 | if (grid[l->geom.x+BLOCKWIDTH][i] != ' ' && grid[l->geom.x+BLOCKWIDTH][i] != '*') quick2=false; 231 | } 232 | 233 | //printf("Quick %d %d\n",quick1,quick2); 234 | 235 | checkempty(l->geom.x-BLOCKWIDTH/2,l->geom.y+BLOCKHEIGHT/2); 236 | checkempty(l->geom.x+BLOCKWIDTH+BLOCKWIDTH/2/2,l->geom.y+BLOCKHEIGHT/2); 237 | 238 | if (!quick1) 239 | for (i=l->geom.y+BLOCKHEIGHT/2+BLOCKHEIGHT;igeom.y+l->geom.h;i+=BLOCKHEIGHT) 240 | checkempty(l->geom.x-BLOCKWIDTH/2,i); 241 | if (!quick2) 242 | for (i=l->geom.y+BLOCKHEIGHT/2+BLOCKHEIGHT;igeom.y+l->geom.h;i+=BLOCKHEIGHT) 243 | checkempty(l->geom.x+BLOCKWIDTH+BLOCKWIDTH/2,i); 244 | break; 245 | case RIGHT: 246 | // falls through 247 | case LEFT: 248 | markgrid(l->geom.x,l->geom.y,l->geom.w,l->geom.h,'-'); 249 | SDL_FillRect(screen,&l->geom,color.background); 250 | soil(l->geom); 251 | 252 | // scan along edges to quickly determine if this 253 | // is going to be complicated. 254 | quick1=true; quick2=true; 255 | for (i=l->geom.x+BLOCKWIDTH/2;igeom.x+l->geom.w;i++) 256 | { 257 | if (grid[i][l->geom.y-1] != ' ' && grid[i][l->geom.y-1] != '*') quick1=false; 258 | if (grid[i][l->geom.y+BLOCKHEIGHT] != ' ' && grid[i][l->geom.y+BLOCKHEIGHT] != '*') quick2=false; 259 | } 260 | 261 | //printf("Quick %d %d\n",quick1,quick2); 262 | 263 | checkempty(l->geom.x+BLOCKWIDTH/2,l->geom.y-BLOCKHEIGHT/2); 264 | checkempty(l->geom.x+BLOCKWIDTH/2,l->geom.y+BLOCKHEIGHT+BLOCKHEIGHT/2); 265 | 266 | if (!quick1) 267 | for (i=l->geom.x+BLOCKWIDTH/2+BLOCKWIDTH;igeom.x+l->geom.w;i+=BLOCKWIDTH) 268 | checkempty(i,l->geom.y-BLOCKHEIGHT/2); 269 | 270 | if (!quick2) 271 | for (i=l->geom.x+BLOCKWIDTH/2+BLOCKWIDTH;igeom.x+l->geom.w;i+=BLOCKWIDTH) 272 | checkempty(i,l->geom.y+BLOCKHEIGHT+BLOCKHEIGHT/2); 273 | 274 | break; 275 | } 276 | 277 | } 278 | 279 | 280 | void killline(Line * l) 281 | { 282 | l->on=false; 283 | l->dead=false; 284 | 285 | switch (l->dir) 286 | { 287 | case DOWN: 288 | // falls through. 289 | case UP: 290 | markgrid(l->geom.x,l->geom.y,l->geom.w,l->geom.h,' '); 291 | // FIXORAMA 292 | SDL_BlitSurface(gridsave,&l->geom, screen, &l->geom); 293 | soil(l->geom); 294 | break; 295 | case RIGHT: 296 | // falls through 297 | case LEFT: 298 | markgrid(l->geom.x,l->geom.y,l->geom.w,l->geom.h,' '); 299 | // FIXORAMA 300 | SDL_BlitSurface(gridsave,&l->geom, screen, &l->geom); 301 | soil(l->geom); 302 | break; 303 | } 304 | } 305 | -------------------------------------------------------------------------------- /line.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef LINE_H 24 | #define LINE_H 25 | 26 | typedef enum { UP, DOWN, LEFT, RIGHT } LineDir; 27 | typedef enum { HORIZONTAL, VERTICAL } LineType; 28 | 29 | typedef struct 30 | { 31 | int on; 32 | SDL_Rect geom; 33 | SDL_Rect mark; 34 | LineDir dir; 35 | Uint32* colorpointer; // to match the sprite pointer 36 | char id; 37 | int dead; 38 | int speedslower; 39 | int stuckcount; 40 | } Line; 41 | 42 | 43 | extern Line createline(int linenum); 44 | extern void startline(Line * l, LineDir d, int x, int y); 45 | extern int moveline(Line * l); 46 | extern void finishline(Line * l); 47 | extern void killline(Line * l); 48 | 49 | #endif /* LINE_H */ 50 | -------------------------------------------------------------------------------- /linux.ibt: -------------------------------------------------------------------------------- 1 | Background 0 64 128 2 | NormalText 255 255 255 3 | BoardFillMin 224 224 224 4 | BoardFillMax 255 255 255 5 | Gridline 192 192 192 6 | GridHighlight 192 192 192 7 | Line1 0 0 0 8 | Line2 192 0 64 9 | MenuHighlight 255 255 255 10 | GameoverText 192 0 64 11 | ScorescrollText 0 0 0 12 | BonusscrollText 192 0 64 13 | TextentryBox 0 0 0 14 | TextentryText 255 255 255 15 | CopyrightText 192 192 192 16 | SpriteTransparent 255 0 0 17 | SpriteBitmap penguin.bmp 18 | SoundOuch ouch.wav 19 | SoundCrash crash.wav 20 | -------------------------------------------------------------------------------- /lock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | 25 | #ifndef WIN32 26 | #include 27 | #include 28 | #include 29 | #endif 30 | 31 | #include "lock.h" 32 | 33 | // the return value of lock/unlock system calls 34 | static int sysret; 35 | 36 | // the number of times to retry before returning from lock() 37 | #define RETRY_N 3 38 | 39 | // the number of seconds between two lock syscalls (in seconds) 40 | #define INTERVAL 1 41 | 42 | //***************** OH MY ******************************************* 43 | // And now for a bunch of crazy cross-platform macros devised 44 | // by Enrico. :) 45 | 46 | 47 | //***************** LOCK_DEBUG MACRO ********************************* 48 | //#include "stdio.h" 49 | //#define LOCK_DEBUG(a...) fprintf(stderr,a) 50 | #define LOCK_DEBUG(a...) 51 | 52 | //***************** SYSCALL WRAPPING ********************************* 53 | #ifdef WIN32 54 | 55 | # define DELAY (INTERVAL * 1000) 56 | # define LOCK_SYSCALL(a) {sysret=LockFile(a,0,0,1,0);} 57 | # define UNLOCK_SYSCALL(a) {sysret=UnlockFile(a,0,0,1,0);} 58 | # define OPEN_SYSCALL(a) CreateFile(a,GENERIC_READ,1,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM,NULL) 59 | # define CLOSE_SYSCALL(a) CloseHandle(a) 60 | # define SLEEP_SYSCALL() Sleep(DELAY) 61 | # define BAD_VALUE 0 62 | # define IS_OK(a) (a != BAD_VALUE) 63 | 64 | #else 65 | 66 | static struct flock lockstr; // used by fcntl 67 | # define DELAY INTERVAL 68 | # define LOCK_SYSCALL(a) {memset(&lockstr,0,sizeof(lockstr));lockstr.l_type = F_WRLCK;sysret = fcntl(a, F_SETLK , &lockstr);} 69 | # define UNLOCK_SYSCALL(a) {memset(&lockstr,0,sizeof(lockstr));lockstr.l_type = F_UNLCK;sysret = fcntl(a, F_SETLK , &lockstr);} 70 | # define OPEN_SYSCALL(a) open(a,O_RDWR) 71 | # define CLOSE_SYSCALL(a) close(a) 72 | # define SLEEP_SYSCALL() sleep(DELAY) 73 | # define BAD_VALUE -1 74 | # define IS_OK(a) (a != BAD_VALUE) 75 | 76 | #endif 77 | 78 | //************************ REAL FUNCTIONS **************************** 79 | 80 | /* return values: 81 | * 0 = success 82 | * -1 = lock failed 83 | */ 84 | int lock(FILE_DESC f) 85 | { 86 | int i; 87 | sysret = BAD_VALUE; 88 | 89 | for( i = 0 ; i < RETRY_N && !IS_OK(sysret) ; i++ ) 90 | { 91 | LOCK_SYSCALL(f); 92 | 93 | if(!IS_OK(sysret) && i < RETRY_N -1) 94 | { 95 | SLEEP_SYSCALL(); 96 | } 97 | } 98 | 99 | if(IS_OK(sysret)) 100 | { 101 | LOCK_DEBUG("lock obtained\n"); 102 | return 0; 103 | } 104 | else 105 | { 106 | LOCK_DEBUG("lock denied\n"); 107 | return -1; 108 | } 109 | } 110 | 111 | /* return values: 112 | * 0 = success 113 | * -1 = unlock failed 114 | */ 115 | int unlock(FILE_DESC f) 116 | { 117 | 118 | UNLOCK_SYSCALL(f); 119 | 120 | if(!IS_OK(sysret)) 121 | { 122 | LOCK_DEBUG("unlock failed\n"); 123 | // FIX: do something to warn about this, because it shouldn't 124 | // happen and will definitely cause problems if it does. 125 | return -1; 126 | } 127 | else 128 | { 129 | LOCK_DEBUG("unlocked\n"); 130 | return 0; 131 | } 132 | 133 | } 134 | 135 | /* return values: 136 | * ? = success 137 | * INVALID_FILE_DESC = failed 138 | */ 139 | FILE_DESC openlockfile(char* fname) 140 | { 141 | return OPEN_SYSCALL(fname); 142 | } 143 | 144 | void closelockfile(FILE_DESC f) 145 | { 146 | CLOSE_SYSCALL(f); 147 | } 148 | 149 | -------------------------------------------------------------------------------- /lock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | 25 | #ifndef LOCK_H 26 | #define LOCK_H 27 | 28 | // fix -- should this stuff go in win32_compatibility.h? it's a tradeoff 29 | // between putting stuff closer to where it's used and isolating platform- 30 | // specific stuff 31 | 32 | #ifdef WIN32 33 | #include 34 | #define FILE_DESC HANDLE 35 | #define INVALID_FILE_DESC INVALID_HANDLE_VALUE 36 | #else 37 | #define FILE_DESC int 38 | #define INVALID_FILE_DESC -1 39 | #endif 40 | 41 | extern int lock(FILE_DESC fd); 42 | extern int unlock(FILE_DESC fd); 43 | 44 | extern FILE_DESC openlockfile(char* fname); 45 | extern void closelockfile(FILE_DESC f); 46 | 47 | #endif /* LOCK_H */ 48 | -------------------------------------------------------------------------------- /menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef MENU_H 24 | #define MENU_H 25 | 26 | 27 | extern PopupReturnType popuplevelmenu(void); 28 | extern PopupReturnType popupoptionsmenu(void); 29 | 30 | extern void drawmenubutton(SDL_Rect* mbrect,int highlighted); 31 | 32 | #endif /* MENU_H */ 33 | -------------------------------------------------------------------------------- /metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.mattdm.icebreaker 4 | 5 | IceBreaker 6 | An addictive action-puzzle game involving bouncing penguins 7 | 8 | CC-BY-SA-4.0 9 | GPL-2.0-or-later 10 | 11 | 12 |

13 | IceBreaker is an action-puzzle game in which you must capture penguins from an Antarctic iceberg so they can be shipped to Finland, where they are essential to a secret plot for world domination. To earn the highest Geek Cred, trap them in the smallest space in the shortest time while losing the fewest lives. 14 |

15 |

16 | IceBreaker was inspired by (but is far from an exact clone of) Jezzball by Dima Pavlovsky. 17 |

18 |
19 | 20 | https://mattdm.org/icebreaker/ 21 | https://github.com/mattdm/icebreaker/issues 22 | 23 | icebreaker.desktop 24 | 25 | 26 | https://mattdm.org/icebreaker/appstream/screenshot-title.png 27 | 28 | 29 | https://mattdm.org/icebreaker/appstream/screenshot-mid-game.png 30 | 31 | 32 | https://mattdm.org/icebreaker/appstream/screenshot-level5-jz-like.png 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Matthew Miller 44 | mattdm_AT_mattdm.org 45 | 46 |
47 | -------------------------------------------------------------------------------- /misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include "icebreaker.h" 27 | #include "globals.h" 28 | 29 | #ifdef NEEDCHANGETOARGV0PATH 30 | #include 31 | #include 32 | #include 33 | #endif 34 | 35 | 36 | #ifdef NEEDCHANGETOARGV0PATH 37 | void changetoargv0path(char* argv0) 38 | { 39 | int chari; 40 | struct stat st; 41 | char argv0path[256]; // fix -- should use OS-specific define 42 | 43 | if (strlen(argv0)>256) 44 | { 45 | fprintf(stderr,"Hmmm -- the executable path seems to be longer than pathnames are allowed\n" 46 | "to be. That should never ever happen -- please report this bug.\n"); 47 | return; 48 | } 49 | 50 | for (chari=strlen(argv0); chari>0 && argv0[chari]!='/'; chari--); 51 | 52 | if (chari==0 && (!strcmp(".",homedir) || !strcmp(".",HISCOREPREFIX) || !strcmp(".",DATAPREFIX))) 53 | { 54 | // check if argv0 is in current directory, in case . is in the path 55 | if (stat(argv0,&st) || (!stat(argv0,&st) && !S_ISREG(st.st_mode))) 56 | { 57 | fprintf(stderr,"Error: you are running me on a platform where I need to look in the current\n" 58 | "directory for some of my files, but I can't find the right place to look --\n" 59 | "possibly because %s is in your PATH and you just typed the command\n" 60 | "name without any path information. Everything is probably going to break.\n\n" 61 | "If you would like to write a smarter function (perhaps one that searches\n" 62 | "your path for the executable) for your operating system, please contact me.\n" 63 | "See for more info.\n\n" 64 | "Meanwhile, I'm going to try to run, but probably not successfully....\n",argv0); 65 | return; 66 | } 67 | } 68 | else 69 | { 70 | snprintf(argv0path, chari+1, argv0); 71 | chdir(argv0path); 72 | } 73 | } 74 | #endif /* NEEDCHANGETOARGV0PATH */ 75 | -------------------------------------------------------------------------------- /misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef MISC_H 25 | #define MISC_H 26 | 27 | // a few functions that don't have a logical home elsewhere 28 | 29 | #ifdef NEEDCHANGETOARGV0PATH 30 | extern void changetoargv0path(char* argv0); 31 | #endif /* NEEDCHANGETOARGV0PATH */ 32 | 33 | #endif // MISC_H 34 | -------------------------------------------------------------------------------- /moo.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/moo.wav -------------------------------------------------------------------------------- /mouse-r.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/mouse-r.bmp -------------------------------------------------------------------------------- /mouse.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/mouse.bmp -------------------------------------------------------------------------------- /nbwoanp.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/nbwoanp.wav -------------------------------------------------------------------------------- /options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef OPTIONS_H 25 | #define OPTIONS_H 26 | 27 | typedef enum { SOUNDON,SOUNDOFF } SoundSettingType; 28 | typedef enum { AUTOPAUSEON,AUTOPAUSEOFF } AutoPauseType; 29 | typedef enum { NORMAL, EASY, HARD } GameDifficultyType; 30 | typedef enum { FULLSCREENOFF, FULLSCREENON, FULLSCREENALWAYS, FULLSCREENUNKNOWN } FullscreenSettingType; 31 | 32 | typedef struct 33 | { 34 | SoundSettingType sound; 35 | AutoPauseType autopause; 36 | GameDifficultyType difficulty; 37 | FullscreenSettingType fullscreen; 38 | char theme[11+MAXTHEMENAMELENGTH]; 39 | } GameOptionsType; 40 | 41 | typedef struct 42 | { 43 | int isfullscreen; 44 | int benchmarkmode; 45 | int soundsystemworks; 46 | int themechanged; 47 | } GameFlagsType; 48 | 49 | extern GameOptionsType options; 50 | extern GameOptionsType commandline; 51 | 52 | extern GameFlagsType gameflags; 53 | 54 | void setdefaultoptions(void); 55 | extern int readoptions(void); 56 | extern int writeoptions(void); 57 | 58 | extern int parsecommandline(int argc, char** argv); 59 | 60 | #endif /* OPTIONS_H */ 61 | -------------------------------------------------------------------------------- /ouch.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/ouch.wav -------------------------------------------------------------------------------- /penguin.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/penguin.bmp -------------------------------------------------------------------------------- /penguin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include "icebreaker.h" 26 | #include "globals.h" 27 | #include "penguin.h" 28 | #include "grid.h" 29 | #include "line.h" 30 | #include "level.h" 31 | #include "options.h" 32 | #include "themes.h" 33 | 34 | static int createpenguinbgsave(Penguin* p); 35 | 36 | Penguin createpenguin() 37 | { 38 | return(createpenguinxy(BORDERLEFT + (random() % (PLAYWIDTH-BLOCKWIDTH)),BORDERTOP + (random() % (PLAYHEIGHT-BLOCKWIDTH)))); 39 | } 40 | 41 | Penguin createpenguinxy(int x, int y) 42 | { 43 | Penguin p; 44 | 45 | switch (random() % 4) 46 | { 47 | case 0: 48 | p.xdelta= PENGUINSPEED;p.ydelta= PENGUINSPEED; 49 | p.image = spritemirrorimage; 50 | break; 51 | case 1: 52 | p.xdelta= PENGUINSPEED;p.ydelta=-PENGUINSPEED; 53 | p.image = spritemirrorimage; 54 | break; 55 | case 2: 56 | p.xdelta=-PENGUINSPEED;p.ydelta= PENGUINSPEED; 57 | p.image = spriteimage; 58 | break; 59 | case 3: 60 | p.xdelta=-PENGUINSPEED;p.ydelta=-PENGUINSPEED; 61 | p.image = spriteimage; 62 | break; 63 | default: // this won't happen, but it shuts up the warning. 64 | p.xdelta=-PENGUINSPEED;p.ydelta=-PENGUINSPEED; 65 | p.image = spriteimage; 66 | break; 67 | } 68 | 69 | // For debugging only, of course -- this makes crippled penguins. 70 | //p.xdelta=0; p.ydelta=0; 71 | 72 | p.speedslower=0; 73 | 74 | p.geom.w=p.image->w; 75 | p.geom.h=p.image->h; 76 | 77 | //p.geom.x=BORDERLEFT + (PLAYWIDTH +BLOCKWIDTH )/2; 78 | //p.geom.y=BORDERTOP + (PLAYHEIGHT+BLOCKHEIGHT)/2; 79 | 80 | p.geom.x=x; 81 | p.geom.y=y; 82 | 83 | createpenguinbgsave(&p); 84 | 85 | return(p); 86 | } 87 | 88 | void deletepenguin(Penguin* p) 89 | { 90 | SDL_FreeSurface(p->bgsave); 91 | } 92 | 93 | void resetpenguinimage(Penguin* p) 94 | { 95 | SDL_FreeSurface(p->bgsave); 96 | 97 | if (p->xdelta>0) 98 | p->image=spritemirrorimage; 99 | else 100 | p->image=spriteimage; 101 | 102 | p->geom.w=p->image->w; 103 | p->geom.h=p->image->h; 104 | 105 | 106 | createpenguinbgsave(p); 107 | } 108 | 109 | 110 | void savebehindpenguin(Penguin* p) 111 | { 112 | SDL_BlitSurface(screen, &(p->geom), p->bgsave, NULL); 113 | } 114 | 115 | void drawpenguin(Penguin* p) 116 | { 117 | SDL_BlitSurface(p->image, NULL, screen, &(p->geom)); 118 | } 119 | 120 | void erasepenguin(Penguin* p) 121 | { 122 | SDL_BlitSurface(p->bgsave, NULL, screen, &(p->geom)); 123 | } 124 | 125 | void movepenguin(Penguin* p) 126 | { 127 | int newx, newy; 128 | int checkx,checky; 129 | int movex=0,movey=0; 130 | 131 | switch (options.difficulty) 132 | { 133 | case NORMAL: 134 | if (p->speedslower) 135 | { movex=p->xdelta/2; movey=p->ydelta/2; } 136 | else 137 | { movex=p->xdelta; movey=p->ydelta; } 138 | p->speedslower=!p->speedslower; 139 | break; 140 | case HARD: 141 | movex=p->xdelta; movey=p->ydelta; 142 | break; 143 | case EASY: 144 | movex=p->xdelta/2; movey=p->ydelta/2; 145 | break; 146 | } 147 | 148 | newx=p->geom.x+movex; 149 | newy=p->geom.y+movey; 150 | 151 | 152 | markgrid(p->geom.x,p->geom.y,BLOCKWIDTH,BLOCKHEIGHT,' '); 153 | 154 | if (movex>0) checkx = newx+BLOCKWIDTH; 155 | else checkx = newx; 156 | 157 | if (grid[checkx][p->geom.y]==' ' && grid[checkx][p->geom.y+BLOCKHEIGHT-1]==' ') 158 | { 159 | p->geom.x+=movex; 160 | } 161 | else if (grid[checkx][p->geom.y]=='1' || grid[checkx][p->geom.y+BLOCKHEIGHT-1]=='1') 162 | { 163 | line1.dead=true; 164 | p->geom.x+=movex; 165 | } 166 | else if (grid[checkx][p->geom.y]=='2' || grid[checkx][p->geom.y+BLOCKHEIGHT-1]=='2') 167 | { 168 | line2.dead=true; 169 | p->geom.x+=movex; 170 | } 171 | else if ((grid[checkx][p->geom.y]=='w' || grid[checkx][p->geom.y]==' ' ) 172 | && (grid[checkx][p->geom.y+BLOCKHEIGHT-1]=='w' || grid[checkx][p->geom.y+BLOCKHEIGHT-1]==' ')) 173 | { 174 | // this is used in the intro. maybe some place else too in the future. 175 | // should it be merged into the first line above? maybe. 176 | p->geom.x+=movex; 177 | } 178 | else 179 | { 180 | p->xdelta=-p->xdelta; 181 | if (p->image==spriteimage) 182 | p->image=spritemirrorimage; 183 | else 184 | p->image=spriteimage; 185 | } 186 | 187 | if (movey>0) checky = newy+BLOCKHEIGHT; 188 | else checky = newy; 189 | 190 | if (grid[p->geom.x][checky]==' ' && grid[p->geom.x+BLOCKWIDTH-1][checky]==' ') 191 | { 192 | p->geom.y+=movey; 193 | } 194 | else if (grid[p->geom.x][checky]=='1' || grid[p->geom.x+BLOCKWIDTH-1][checky]=='1') 195 | { 196 | //printf("Hit 1\n"); 197 | line1.dead=true; 198 | p->geom.y+=movey; 199 | } 200 | else if (grid[p->geom.x][checky]=='2' || grid[p->geom.x+BLOCKWIDTH-1][checky]=='2') 201 | { 202 | //printf("Hit 2\n"); 203 | line2.dead=true; 204 | p->geom.y+=movey; 205 | } 206 | else if ((grid[p->geom.x][checky]=='w' || grid[p->geom.x][checky]==' ') 207 | && (grid[p->geom.x+BLOCKWIDTH-1][checky]=='w' || grid[p->geom.x+BLOCKWIDTH-1][checky]==' ')) 208 | { 209 | // this is used in the intro. maybe some place else too in the future. 210 | // should it be merged into the first line above? maybe. 211 | p->geom.y+=movey; 212 | } 213 | 214 | else 215 | { 216 | p->ydelta=-p->ydelta; 217 | } 218 | 219 | markgrid(p->geom.x,p->geom.y,BLOCKWIDTH,BLOCKHEIGHT,'*'); 220 | } 221 | 222 | int createpenguinbgsave(Penguin* p) 223 | { 224 | SDL_Surface* tmpsurface; 225 | 226 | tmpsurface = SDL_CreateRGBSurface(SDL_SWSURFACE,p->geom.w,p->geom.h,screen->format->BitsPerPixel,0,0,0,0); 227 | // fix -- add error checking 228 | p->bgsave = SDL_DisplayFormat(tmpsurface); 229 | if (p->bgsave==NULL) 230 | p->bgsave=tmpsurface; 231 | else 232 | SDL_FreeSurface(tmpsurface); 233 | 234 | return 0; 235 | } 236 | 237 | -------------------------------------------------------------------------------- /penguin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef PENGUIN_H 24 | #define PENGUIN_H 25 | 26 | typedef struct 27 | { 28 | SDL_Surface *image; // having this here will make future animation easier 29 | SDL_Surface *bgsave; 30 | SDL_Rect geom; 31 | int xdelta; 32 | int ydelta; 33 | int speedslower; 34 | } Penguin; 35 | 36 | 37 | 38 | extern Penguin createpenguin(); 39 | extern Penguin createpenguinxy(int x, int y); 40 | extern void resetpenguinimage(Penguin* p); 41 | extern void deletepenguin(Penguin* p); 42 | extern void savebehindpenguin(Penguin* p); 43 | extern void drawpenguin(Penguin* p); 44 | extern void erasepenguin(Penguin* p); 45 | extern void movepenguin(Penguin* p); 46 | 47 | #endif /* PENGUIN_H */ 48 | -------------------------------------------------------------------------------- /penguinicon_32.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/penguinicon_32.bmp -------------------------------------------------------------------------------- /phase.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/phase.wav -------------------------------------------------------------------------------- /pop.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/pop.wav -------------------------------------------------------------------------------- /screenshot-level5-jz-like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/screenshot-level5-jz-like.png -------------------------------------------------------------------------------- /screenshot-mid-game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/screenshot-mid-game.png -------------------------------------------------------------------------------- /screenshot-title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/screenshot-title.png -------------------------------------------------------------------------------- /screenshots/icebreaker1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/screenshots/icebreaker1.png -------------------------------------------------------------------------------- /screenshots/icebreaker2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/screenshots/icebreaker2.png -------------------------------------------------------------------------------- /screenshots/icebreaker3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/screenshots/icebreaker3.png -------------------------------------------------------------------------------- /scrunch.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/scrunch.wav -------------------------------------------------------------------------------- /sound.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include "icebreaker.h" 26 | #include "sound.h" 27 | #include "options.h" 28 | 29 | 30 | static Mix_Chunk *sndouch = NULL; 31 | static Mix_Chunk *sndbreak = NULL; 32 | 33 | 34 | void initsound() 35 | { 36 | gameflags.soundsystemworks=false; 37 | 38 | if (commandline.sound==SOUNDOFF) 39 | return; 40 | 41 | if (SDL_InitSubSystem(SDL_INIT_AUDIO)) 42 | { 43 | fprintf(stderr, "Can't start sound subsystem: %s.\nContinuing without it.\n", SDL_GetError()); 44 | } 45 | else if (Mix_OpenAudio(22050, AUDIO_U8, 2, 1024)) 46 | { 47 | fprintf(stderr, "Can't open audio: %s.\nContinuing without sound support.\n", SDL_GetError()); 48 | fprintf(stderr, "You may see some other errors from system sound libraries. Ignore them.\n"); 49 | } 50 | else 51 | { 52 | gameflags.soundsystemworks=true; 53 | loadsounds(NULL,DATAPREFIX "/" SNDFILEOUCH,DATAPREFIX "/" SNDFILEBREAK); 54 | } 55 | } 56 | 57 | int loadsounds(char* themename, char* soundouchfile, char* soundcrashfile) 58 | { 59 | int rc=0; 60 | 61 | if (gameflags.soundsystemworks==false) 62 | return 0; 63 | 64 | if (soundouchfile!=NULL) 65 | { 66 | while (Mix_Playing(-1)); 67 | if (sndouch) { Mix_FreeChunk(sndouch); sndouch = NULL; } 68 | if ( (sndouch=Mix_LoadWAV(soundouchfile)) == NULL) 69 | { 70 | fprintf(stderr, "Error loading " DATAPREFIX "/" SNDFILEOUCH "\n%s\n", SDL_GetError()); 71 | rc--; 72 | } 73 | } 74 | 75 | if (soundcrashfile!=NULL) 76 | { 77 | while (Mix_Playing(-1)); 78 | if (sndbreak) { Mix_FreeChunk(sndbreak); sndbreak = NULL; } 79 | if ( (sndbreak=Mix_LoadWAV(soundcrashfile)) == NULL) 80 | { 81 | fprintf(stderr, "Error loading " DATAPREFIX "/" SNDFILEBREAK "\n%s\n", SDL_GetError()); // fix -- is "break" or "crash" a better generic term? 82 | rc--; 83 | } 84 | } 85 | 86 | return rc; 87 | } 88 | void quitsound() 89 | { 90 | while (Mix_Playing(-1)); 91 | 92 | if (sndouch) { Mix_FreeChunk(sndouch); sndouch = NULL; } 93 | if (sndbreak) { Mix_FreeChunk(sndbreak); sndbreak = NULL; } 94 | 95 | if (gameflags.soundsystemworks) Mix_CloseAudio(); 96 | } 97 | 98 | #define MAXBREAKSOUNDOVERLAP 30 99 | void playsound(SoundSample s) 100 | { 101 | static Uint32 lastplayedbreak=0; 102 | 103 | if (gameflags.soundsystemworks && options.sound==SOUNDON) 104 | { 105 | switch (s) 106 | { 107 | case SNDOUCH: 108 | Mix_PlayChannel(-1, sndouch, 0); 109 | break; 110 | case SNDBREAK: 111 | if (SDL_GetTicks()-lastplayedbreak>=MAXBREAKSOUNDOVERLAP) 112 | { // fix -- this is on the right track, but it'd be better 113 | // to some how schedule the sound to be played later. 114 | lastplayedbreak=SDL_GetTicks(); 115 | Mix_PlayChannel(-1, sndbreak, 0); 116 | } 117 | break; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /sound.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef SOUND_H 24 | #define SOUND_H 25 | 26 | typedef enum { SNDOUCH, SNDBREAK } SoundSample; 27 | 28 | extern void initsound(void); 29 | extern int loadsounds(char* themename, char* soundouchfile, char* soundcrashfile); 30 | extern void quitsound(void); 31 | extern void playsound(SoundSample s); 32 | 33 | #endif /* SOUND_H */ 34 | -------------------------------------------------------------------------------- /splash.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/splash.wav -------------------------------------------------------------------------------- /splat.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/splat.wav -------------------------------------------------------------------------------- /squeak.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/squeak.wav -------------------------------------------------------------------------------- /star.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/star.bmp -------------------------------------------------------------------------------- /stars.ibt: -------------------------------------------------------------------------------- 1 | Background 0 0 64 2 | NormalText 255 255 255 3 | BoardFillMin 0 0 0 4 | BoardFillMax 32 32 32 5 | Gridline 0 0 32 6 | GridHighlight 96 96 96 7 | Line1 96 96 128 8 | Line2 224 192 0 9 | MenuHighlight 255 255 255 10 | GameoverText 160 160 192 11 | ScorescrollText 224 192 0 12 | BonusscrollText 160 160 192 13 | TextentryBox 0 0 0 14 | TextentryText 255 255 255 15 | CopyrightText 160 160 192 16 | SpriteTransparent 0 0 0 17 | SpriteBitmap star.bmp 18 | SoundOuch nbwoanp.wav 19 | SoundCrash scrunch.wav 20 | -------------------------------------------------------------------------------- /status.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | #include 24 | 25 | #include "icebreaker.h" 26 | #include "text.h" 27 | #include "globals.h" 28 | #include "hiscore.h" 29 | #include "laundry.h" 30 | #include "status.h" 31 | #include "themes.h" 32 | 33 | void updatestatuslives(int lives) 34 | { 35 | SDL_Rect tmprect; 36 | char tmptext[30]; // should be plenty big. 37 | 38 | tmprect.h=CHARHEIGHT*2; tmprect.w=LIVESW; 39 | tmprect.x=LIVESX; tmprect.y=STATUSY; 40 | 41 | SDL_FillRect(screen,&tmprect,color.background); 42 | 43 | snprintf(tmptext,30,"LIVES: %d",lives); 44 | puttext(LIVESX,STATUSY,2,color.normaltext,tmptext); 45 | 46 | soil(tmprect); 47 | 48 | } 49 | 50 | void updatestatuscleared(int clear) 51 | { 52 | SDL_Rect tmprect; 53 | char tmptext[30]; // should be plenty big. 54 | 55 | tmprect.h=CHARHEIGHT*2; tmprect.w=CLEAREDW; 56 | tmprect.x=CLEAREDX; tmprect.y=STATUSY; 57 | 58 | 59 | SDL_FillRect(screen,&tmprect,color.background); 60 | 61 | snprintf(tmptext,30, "CLEARED: %d%%",clear); 62 | puttext(CLEAREDX,STATUSY,2,color.normaltext,tmptext); 63 | 64 | soil(tmprect); 65 | 66 | } 67 | 68 | void updatestatusscore(long score) 69 | { 70 | SDL_Rect tmprect; 71 | char tmptext[30]; // should be plenty big. 72 | 73 | tmprect.h=CHARHEIGHT*2; tmprect.w=SCOREW; 74 | tmprect.x=SCOREX; tmprect.y=STATUSY; 75 | 76 | SDL_FillRect(screen,&tmprect,color.background); 77 | 78 | snprintf(tmptext,30, "SCORE: %ld",score); 79 | puttext(SCOREX,STATUSY,2,color.normaltext,tmptext); 80 | 81 | soil(tmprect); 82 | } 83 | 84 | 85 | 86 | extern void updatehiscorebox() 87 | { 88 | SDL_Rect tmprect; 89 | 90 | char tmptext[100]; // should be plenty big. 91 | 92 | tmprect.x=LIVESX; tmprect.y=BOTTOMSTATUSY; 93 | tmprect.h=CHARHEIGHT*3;; tmprect.w=WIDTH-(CHARWIDTH*2*4)-MARGINRIGHT-4-LIVESX-2; 94 | 95 | 96 | SDL_FillRect(screen,&tmprect,color.background); 97 | 98 | snprintf(tmptext,100,"HIGH SCORE: %ld (%s)",hiscoreval[0],hiscorename[0]); 99 | puttext(tmprect.x,tmprect.y+3,2,color.normaltext,tmptext); 100 | 101 | soil(tmprect); 102 | } 103 | -------------------------------------------------------------------------------- /status.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef STATUS_H 24 | #define STATUS_H 25 | 26 | extern void updatestatuslives(int lives); 27 | extern void updatestatuscleared(int clear); 28 | extern void updatestatusscore(long score); 29 | 30 | extern void updatehiscorebox(); 31 | 32 | #define STATUSY (BORDERTOP-(4*CHARHEIGHT)) 33 | 34 | #define LIVESX (BORDERLEFT) 35 | #define CLEAREDX (LIVESX+165) 36 | #define SCOREX (BORDERRIGHT-120) 37 | 38 | #define LIVESW (CLEAREDX - LIVESX) 39 | #define CLEAREDW (SCOREX - CLEAREDX) 40 | #define SCOREW (WIDTH - SCOREX) 41 | 42 | #define BOTTOMSTATUSY (MARGINTOP+PLAYHEIGHT+CHARHEIGHT*2) 43 | 44 | #endif /* STATUS_H */ 45 | -------------------------------------------------------------------------------- /tap.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/tap.wav -------------------------------------------------------------------------------- /text.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | #include "icebreaker.h" 28 | #include "text.h" 29 | #include "globals.h" 30 | 31 | static char * letterindex; 32 | static char * letterdata[6]; 33 | 34 | 35 | void inittext() 36 | { 37 | letterindex = " AAAAA BBBBB CCCCC DDDDD EEEEE FFFFF GGGGG HHHHH III JJJJJ KKKK LLLLL MMMMM NNNNN OOOOO PPPPP QQQQQ RRRRR SSSSS TTTTT UUUUU VVVVV WWWWW XXXXX YYYYY ZZZZZ aaaaa bbbbb cccc ddddd eeeee fffff ggggg hhhhh i jjjj kkkk lll mmmmm nnnnn ooooo ppppp qqqqq rrrr sssss tttt uuuuu vvvvv wwwww xxxx yyyyy zzzz 00000 11 22222 33333 44444 55555 66666 77777 88888 99999 ~~~~~ `` ! @@@@ ##### $$$$$ %%%%% ^^^^^ &&&&& ***** (( )) _____ ----- +++++ ===== {{{ [[[ }}} ]]] | : ;; '' <<<<<< ,, >>>>>> . ???? ///// \"\"\" \\\\\\\\\\"; 38 | letterdata[0]=" # #### ### #### ##### ##### #### # # ### ### # # # # # # # ### #### ### #### #### ##### # # # # # # # # # # ##### # # ### # # # # ## # ### # #### #### ## ##### ### ##### ### ### # # # ## # # ### ## # # ## # # # # # ### # ### # # ## ## ### # # # # "; 39 | letterdata[1]=" # # # # # # # # # # # # # # # # # # ## ## ## # # # # # # # # # # # # # # # # # # # # # # # #### #### ### #### ### # #### #### # ## # ## # # ## ### #### #### # ## #### #### # # # # # # # # # # #### # # ## # # # # # # # # # # # # # # # # # ## ##### # # ## # # # # # # # # # # ##### # # # # # # # # ## ## # # # # # "; 40 | letterdata[2]=" # # #### # # # #### #### # ## ##### # # ## # # # # # # # # # #### # # #### ### # # # # # # # # # # # # # # # # # # ## ## #### # # # # # # ## # # # # ## # # # # # # # ## ### # # # # # # # # ## # # # # # # ### ### # # #### #### # ### #### # # # ## # # ### # # # ## # ### # # ##### ##### ## # ## # # ## ## ## # # "; 41 | letterdata[3]=" ##### # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # # # # # # ## ## # # # # # ## # # # # # ### # #### # # # # # # # # # # # # # # # # # # # ### # # ## # # # # # ## #### # # # # # # ##### # # # # # # # # ##### # # # ## # # # # # # # # ##### # # # # # # # ## # ## # # # "; 42 | letterdata[4]=" # # #### ### #### ##### # #### # # ### ### # # ##### # # # # ### # ### # # #### # ### # # # # # # ##### ## # #### ### #### ### # # # # # # # # # ### # # # # ### #### #### # #### ## ## # # # # # # # #### ### # ##### #### # #### ### # ### ### # ## # # ### # ## ## # # # # # # ### # ### # # ## # ## # # # #"; 43 | letterdata[5]=" ## ### ## # # ### ##### # # "; 44 | } 45 | 46 | int gettextwidth(int size, const char * text) 47 | { 48 | unsigned int l; 49 | int width=0; 50 | 51 | for (l=0; l1) 98 | { 99 | tmprect.h=(int)(size/2.0+0.5); 100 | tmprect.w=(int)(size/2.0+0.5); 101 | } 102 | else 103 | { 104 | tmprect.h=1; tmprect.w=1; 105 | } 106 | startx=x; 107 | 108 | for (l=0; l 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef TEXT_H 24 | #define TEXT_H 25 | 26 | #define CHARHEIGHT 6 27 | #define CHARWIDTH 6 28 | #define BIGCHARHEIGHT 25 29 | #define BIGCHARWIDTH 35 30 | #define CHARSPACE 2 31 | 32 | extern int gettextwidth(int size, const char * text); 33 | extern int getletterwidth(int size, const char letter); 34 | extern void puttext(int x, int y, int size, Uint32 color, char * text); 35 | extern void sputtext(SDL_Surface* scr,int x, int y, int size, Uint32 color, char * text); 36 | extern void inittext(); 37 | 38 | #endif /* TEXT_H */ 39 | -------------------------------------------------------------------------------- /themes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2002-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef THEMES_H 24 | #define THEMES_H 25 | 26 | typedef struct 27 | { 28 | Uint32 background; 29 | Uint32 normaltext; 30 | Uint8 boardfillminr; 31 | Uint8 boardfillming; 32 | Uint8 boardfillminb; 33 | Uint8 boardfillmaxr; 34 | Uint8 boardfillmaxg; 35 | Uint8 boardfillmaxb; 36 | Uint32 gridline; 37 | Uint32 gridhighlight; 38 | Uint32 line1; 39 | Uint32 line2; 40 | Uint32 menuhighlight; 41 | Uint32 gameovertext; 42 | Uint32 scorescrolltext; 43 | Uint32 bonusscrolltext; 44 | Uint32 textentrybox; 45 | Uint32 textentrytext; 46 | Uint32 copyrighttext; 47 | Uint32 spritetransparent; // fix -- this doesn't really belong here 48 | 49 | } ThemeColorsType; 50 | 51 | extern ThemeColorsType color; 52 | 53 | extern SDL_Surface * spriteimage; 54 | extern SDL_Surface * spritemirrorimage; 55 | 56 | 57 | 58 | // you might expect sounds to go here, but in the interest of keeping 59 | // SDL_mixer stuff confined to the sound module, it's done separately 60 | 61 | int getthemenames(char*** themenamelist); 62 | void freethemenames(char*** themenamelist,int numthemes); 63 | int getthemenumber(char** themenamelist,int numthemes,char* themename); 64 | int settheme(char* themename); 65 | 66 | #endif /* THEMES_H */ 67 | -------------------------------------------------------------------------------- /titlebar.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | #include 25 | #include "icebreaker.h" 26 | #include "globals.h" 27 | #include "options.h" 28 | #include "laundry.h" 29 | #include "text.h" 30 | #include "fullscreen.h" 31 | 32 | #define CAPTIONSIZE 3 33 | #define TITLEBORDER 5 34 | 35 | void drawtitlebar(const char *title) 36 | { 37 | SDL_Rect titlebar; 38 | 39 | if (gameflags.isfullscreen) 40 | { 41 | titlebar.h=CHARHEIGHT*CAPTIONSIZE+TITLEBORDER*2; 42 | titlebar.w=WIDTH; // gettextwidth(CAPTIONSIZE,title)+TITLEBORDER*2; 43 | titlebar.x=(FULLWIDTH - WIDTH)/2; 44 | titlebar.y=FULLTOPMARGIN - titlebar.h - TITLEBORDER*3; 45 | 46 | SDL_FillRect(fullscreen,&titlebar,SDL_MapRGB(screen->format,0,0,0)); 47 | sputtext(fullscreen,titlebar.x+TITLEBORDER, titlebar.y+TITLEBORDER, CAPTIONSIZE,SDL_MapRGB(screen->format,192,192,192),(char*)title); 48 | soil(titlebar); 49 | } 50 | 51 | SDL_WM_SetCaption(title,"IceBreaker"); 52 | } 53 | -------------------------------------------------------------------------------- /titlebar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | #ifndef CAPTION_H 25 | #define CAPTION_H 26 | 27 | extern void drawtitlebar(const char *title); 28 | 29 | #endif // CAPTION_H 30 | -------------------------------------------------------------------------------- /transition.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | */ 22 | 23 | #include 24 | #include "icebreaker.h" 25 | #include "globals.h" 26 | #include "line.h" 27 | #include "penguin.h" 28 | #include "level.h" 29 | #include "text.h" 30 | #include "cursor.h" 31 | #include "laundry.h" 32 | #include "hiscore.h" 33 | #include "dialog.h" 34 | #include "themes.h" 35 | #include "event.h" 36 | 37 | // FIX -- it'd be better to draw text once and then scroll that graphic, 38 | // of course. 39 | 40 | static int scrolltext(char * firsttext, SDL_Rect* firstrect, Uint32 firstcolor, char * secondtext, SDL_Rect* secondrect, Uint32 secondcolor, int doneonfinish); 41 | 42 | int intermission(ScoreSheet * levelscore, int nextlevel) 43 | { 44 | int quit=false; 45 | SDL_Event event; 46 | SDL_Rect scorerect, bonusrect; 47 | char scoretext[30]; 48 | char bonustext[30]; 49 | 50 | snprintf(scoretext,30,"SCORE: %d",levelscore->basescore); 51 | snprintf(bonustext,30, "BONUS: %d",levelscore->clearbonus + levelscore->lifebonus); 52 | 53 | // FIX -- play some truimphant but not annoying sound 54 | 55 | // clear any pending events 56 | SDL_Delay(10); // needed? probably not. 57 | while (pollevent(&event)) if (event.type == SDL_QUIT) { quit=true; } 58 | 59 | setcursor(CURSORCLICK); 60 | 61 | scorerect.h=CHARHEIGHT*4; 62 | scorerect.w=gettextwidth(4,scoretext); 63 | 64 | bonusrect.h=CHARHEIGHT*4; 65 | bonusrect.w=gettextwidth(4,bonustext); 66 | 67 | if (scorerect.w>bonusrect.w) 68 | scorerect.x=(screen->w - scorerect.w) / 2; 69 | else 70 | scorerect.x=(screen->w - bonusrect.w) / 2; 71 | scorerect.y=HEIGHT-CHARHEIGHT*5; // extra space for separation 72 | 73 | bonusrect.x=scorerect.x; 74 | bonusrect.y=HEIGHT-CHARHEIGHT*4; 75 | 76 | // wait for click, scroll score 77 | quit=scrolltext(scoretext, &scorerect, color.scorescrolltext, bonustext, &bonusrect, color.bonusscrolltext, false); 78 | 79 | // and clear any more events, for good luck. 80 | while (pollevent(&event)) if (event.type == SDL_QUIT) quit=true; 81 | 82 | //printf("Level %d completed. ",level); 83 | return(quit); 84 | } 85 | 86 | int gameover(long finalscore) 87 | { 88 | int quit=false; 89 | SDL_Event event; 90 | SDL_Rect loserrect, finalrect; 91 | 92 | char finaltext[30]; 93 | 94 | snprintf(finaltext,30,"FINAL SCORE: %ld",finalscore); 95 | 96 | 97 | loserrect.h=CHARHEIGHT*4; 98 | loserrect.w=gettextwidth(4,"GAME OVER"); 99 | loserrect.x=(screen->w - loserrect.w) / 2; 100 | loserrect.y=HEIGHT-CHARHEIGHT*4; 101 | 102 | finalrect.h=CHARHEIGHT*4; 103 | finalrect.w=gettextwidth(4,finaltext); 104 | finalrect.x=(screen->w - finalrect.w) / 2; 105 | finalrect.y=HEIGHT-CHARHEIGHT*4; 106 | 107 | // clear any pending events 108 | SDL_Delay(10); // needed? probably not. 109 | while (pollevent(&event)) if (event.type == SDL_QUIT) { quit=true; } 110 | 111 | if (!checkhiscore(finalscore)) 112 | setcursor(CURSORCLICK); 113 | else 114 | setcursor(CURSORARROW); 115 | 116 | 117 | // wait for click, scroll score 118 | quit=scrolltext("GAME OVER", &loserrect, color.gameovertext, finaltext, &finalrect, color.scorescrolltext, false); 119 | 120 | if (checkhiscore(finalscore)) 121 | { 122 | // FIX -- play some truimphant but not annoying sound 123 | 124 | if (gethighusername(finalscore>hiscoreval[0])==POPUPQUITGAME) 125 | quit=true; 126 | 127 | if(!addhiscore(username,finalscore,true)) 128 | { // I don't think we need to say this; people can figure it out by looking at the numbers 129 | // but don't comment out the addhighscore function call above, of course. :) 130 | // fprintf(stderr,"Ouch: looks like someone beat your score while you were typing your name!\n"); 131 | } 132 | 133 | // jump text to top 134 | loserrect.y=(HEIGHT/2-31); 135 | puttext(loserrect.x,loserrect.y,4,color.gameovertext,"GAME OVER"); 136 | soil(loserrect); 137 | finalrect.y=(HEIGHT/2); 138 | puttext(finalrect.x,finalrect.y,4,color.scorescrolltext,finaltext); 139 | soil(loserrect); 140 | clean(); 141 | } 142 | 143 | 144 | // and clear any more events, for good luck. 145 | while (pollevent(&event)) if (event.type == SDL_QUIT) quit=true; 146 | 147 | //printf("Game over.\n"); 148 | return(quit); 149 | } 150 | 151 | 152 | int scrolltext(char * firsttext, SDL_Rect* firstrect, Uint32 firstcolor, char * secondtext, SDL_Rect* secondrect, Uint32 secondcolor, int doneonfinish) 153 | { 154 | int quit=false; 155 | int done=false; 156 | SDL_Event event; 157 | 158 | SDL_Surface * bgsave=SDL_CreateRGBSurface(SDL_SWSURFACE,WIDTH,HEIGHT,screen->format->BitsPerPixel,0,0,0,0); 159 | 160 | // get background 161 | SDL_BlitSurface(screen, NULL, bgsave, NULL); 162 | 163 | 164 | // wait for click, scroll score (or whatever) 165 | while (!done) 166 | { 167 | while(pollevent(&event)); 168 | 169 | if (event.type == SDL_QUIT) 170 | { 171 | done=true; quit=true; 172 | } 173 | else if (event.type==SDL_MOUSEBUTTONDOWN) 174 | { 175 | if (event.button.button==1) 176 | { 177 | done=true; 178 | } 179 | } 180 | else if (event.type == SDL_KEYUP) 181 | { 182 | switch(translatekeyevent(&event)) 183 | { 184 | case KEYCANCEL: // falls through 185 | case KEYMENU: // falls through 186 | case KEYSWITCHLINE: // falls through 187 | case KEYSTARTLINE: 188 | done=true; 189 | default: 190 | break; 191 | } 192 | } 193 | 194 | if (firstrect->y>(HEIGHT/2-30)) 195 | { 196 | firstrect->y--; 197 | puttext(firstrect->x,firstrect->y,4,firstcolor,firsttext); 198 | soil(*firstrect); 199 | clean(); 200 | SDL_BlitSurface(bgsave,firstrect, screen, firstrect); 201 | } 202 | else if (firstrect->y==(HEIGHT/2-30)) 203 | { 204 | // un-clean. :) 205 | firstrect->y--; 206 | puttext(firstrect->x,firstrect->y,4,firstcolor,firsttext); 207 | soil(*firstrect); 208 | clean(); 209 | } 210 | else if (secondrect->y>(HEIGHT/2)) 211 | { 212 | secondrect->y--; 213 | puttext(secondrect->x,secondrect->y,4,secondcolor,secondtext); 214 | soil(*secondrect); 215 | clean(); 216 | SDL_BlitSurface(bgsave,secondrect, screen, secondrect); 217 | } 218 | else if (secondrect->y==(HEIGHT/2)) 219 | { 220 | // un-clean. :) 221 | secondrect->y--; 222 | puttext(secondrect->x,secondrect->y,4,secondcolor,secondtext); 223 | soil(*secondrect); 224 | clean(); 225 | } 226 | else 227 | { 228 | if (doneonfinish) done=true; 229 | clean(); 230 | } 231 | 232 | SDL_Delay(10); 233 | } 234 | SDL_FreeSurface(bgsave); 235 | return(quit); 236 | } 237 | -------------------------------------------------------------------------------- /transition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller 4 | * 5 | * 6 | * 7 | * This program is free software; you can redistribute it and/or modify it 8 | * under the terms of the GNU General Public License as published by the Free 9 | * Software Foundation; either version 2 of the License, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 | * for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License along 18 | * with this program; if not, write to the Free Software Foundation, Inc., 59 19 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef TRANSITION_H 24 | #define TRANSITION_H 25 | 26 | extern int intermission(ScoreSheet * levelscore, int nextlevel); 27 | extern int gameover(long finalscore); 28 | 29 | #endif /* TRANSITION_H */ 30 | -------------------------------------------------------------------------------- /turtle.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/turtle.bmp -------------------------------------------------------------------------------- /turtles.ibt: -------------------------------------------------------------------------------- 1 | Background 0 128 64 2 | NormalText 255 255 255 3 | BoardFillMin 0 0 128 4 | BoardFillMax 0 32 192 5 | Gridline 0 0 160 6 | GridHighlight 0 0 96 7 | Line1 128 32 0 8 | Line2 192 192 0 9 | MenuHighlight 255 255 255 10 | GameoverText 128 32 0 11 | ScorescrollText 192 192 0 12 | BonusscrollText 128 32 0 13 | TextentryBox 0 0 0 14 | TextentryText 255 255 255 15 | CopyrightText 192 192 192 16 | SpriteTransparent 0 0 128 17 | SpriteBitmap turtle.bmp 18 | SoundOuch ouch.wav 19 | SoundCrash splash.wav 20 | -------------------------------------------------------------------------------- /win32_compatibility.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | * 22 | */ 23 | 24 | 25 | /************************************************************************/ 26 | /* 27 | * This file contains varibles and functions to aid in win32 cross-compiling 28 | * using mingw32. 29 | * 30 | * Enrico Tassi contributed the initial work. 31 | */ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include "win32_compatibility.h" 38 | 39 | 40 | #ifdef __MINGW32__ 41 | 42 | /* This is the structure that getpwuid returns. fix -- how to get username 43 | in winNT, etc? */ 44 | struct passwd pwdwin32_standard={NULL,"*",1,1,"Win32 User",".","command.com"}; 45 | 46 | /* mingw32's string.h is missing index() */ 47 | char *index(const char *s, int c) 48 | { 49 | while( *s != '\0'&& *s != (char)c ) s++; 50 | return((char*)s); 51 | } 52 | 53 | /* foolish foolish windows. the _snprintf function writes size+1 chars, not 54 | just size as it is supposed to. */ 55 | int snprintf_mingw32kludge(char *str, size_t size, const char *fmt, ...) 56 | { 57 | int rc; 58 | va_list args; 59 | va_start(args, fmt); 60 | rc=_vsnprintf(str,size-1,fmt,args); 61 | va_end(args); 62 | *(str+size-1)='\0'; 63 | return rc; 64 | } 65 | 66 | int vsnprintf_mingw32kludge(char *str, size_t size, const char *fmt, va_list ap) 67 | { 68 | int rc; 69 | rc=_vsnprintf(str,size-1,fmt,ap); 70 | *(str+size-1)='\0'; 71 | return rc; 72 | } 73 | 74 | 75 | struct passwd *getpwuid(int id) 76 | { 77 | static CHAR name[UNLEN + 1]="Nobody"; 78 | DWORD width=UNLEN + 1; 79 | int i; 80 | 81 | GetUserName(name,&width); 82 | for (i=0;i<50 && name[i]!='\0';i++) 83 | { 84 | if (name[i]==' ') 85 | { 86 | name[i]='\0'; 87 | break; 88 | } 89 | } 90 | 91 | pwdwin32_standard.pw_name = name; 92 | 93 | return &pwdwin32_standard; 94 | } 95 | 96 | #endif /* __MINGW32__ */ 97 | -------------------------------------------------------------------------------- /win32_compatibility.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IceBreaker 3 | * Copyright (c) 2000-2020 Matthew Miller and 4 | * Enrico Tassi 5 | * 6 | * 7 | * 8 | * This program is free software; you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by the Free 10 | * Software Foundation; either version 2 of the License, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16 | * for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along 19 | * with this program; if not, write to the Free Software Foundation, Inc., 59 20 | * Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | 24 | /* 25 | * This file contains function prototypes, macros, etc. to aid in win32 26 | * cross-compiling using mingw32 (based on gcc version 2.95.2 19991024 27 | * (release)) 28 | * 29 | * This is Enrico Tassi's domain. :) 30 | */ 31 | 32 | 33 | #ifndef WIN32_COMPATIBILITY_H 34 | #define WIN32_COMPATIBILITY_H 35 | 36 | // fix -- make this also work with cygwin 37 | 38 | #ifdef __MINGW32__ 39 | 40 | #include 41 | 42 | /* mingw32 is missing snprintf. It has _snprintf, 43 | but unfortunately and stupidly, the size parameter has an off-by-one 44 | error causing it to write one more char than requested. this is a 45 | workaround.... */ 46 | #define snprintf snprintf_mingw32kludge 47 | #define vsnprintf vsnprintf_mingw32kludge 48 | int snprintf_mingw32kludge(char *str, size_t size, const char *format, ...); 49 | int vsnprintf_mingw32kludge(char *str, size_t size, const char *format, va_list ap); 50 | 51 | /* mingw32 has no index() in string.h */ 52 | extern char *index(const char *s, int c); 53 | 54 | /* mingw32 has 'short' random functions */ 55 | #define srandom(A) srand(A) 56 | #define random() rand() 57 | 58 | 59 | /* No pwd.h in mingw32 */ 60 | #define uid_t int 61 | #define gid_t int 62 | 63 | struct passwd{ 64 | char *pw_name; /* user name */ 65 | char *pw_passwd; /* user password */ 66 | uid_t pw_uid; /* user id */ 67 | gid_t pw_gid; /* group id */ 68 | char *pw_gecos; /* real name */ 69 | char *pw_dir; /* home directory */ 70 | char *pw_shell; /* shell program */ 71 | }; 72 | 73 | 74 | /* No pwd.h -> no getpw... */ 75 | #define getuid() 0 76 | 77 | extern struct passwd *getpwuid(int id); 78 | 79 | #else 80 | 81 | #error Please configure win32_compatibility.h / win32_compatibility.c for your compiler and send the results to . Thank you! 82 | 83 | #endif // __MINGW__ 84 | 85 | 86 | #endif /* WIN32_COMPATIBILITY_H */ 87 | -------------------------------------------------------------------------------- /win32_resources.rc: -------------------------------------------------------------------------------- 1 | 1 ICON icebreaker_32.ico 2 | -------------------------------------------------------------------------------- /woodblock.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattdm/icebreaker/6f9fd2a221b47600cbea5fe89f2c3d43d0782954/woodblock.bmp --------------------------------------------------------------------------------