From b357615aba1dbde81e3c6999366604e6001010a7 Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Mon, 11 Jan 2010 17:12:51 -0700 Subject: [PATCH] simplified win32 installer build script --- COPYING | 4 +- README | 2 +- configure.ac | 32 ++- data/scenes/Classic.lua | 148 ++++++------ data/textures/Particles.png | Bin 9884 -> 2387 bytes data/yoinkrc | 4 +- doc/licenses/MIT | 26 +- extra/yoink.ebuild | 3 +- src/Animation.cc | 2 +- src/Character.cc | 24 +- src/Character.hh | 11 +- src/GameLayer.cc | 58 +++-- src/GameLayer.hh | 8 +- src/Heroine.cc | 2 +- src/MainLayer.cc | 7 +- src/Makefile.am | 2 + src/Moof/Engine.cc | 12 +- src/Moof/Image.cc | 325 +++++++++++++++++++++++++ src/Moof/Image.hh | 79 ++++++ src/Moof/Log.cc | 14 +- src/Moof/Log.hh | 13 +- src/Moof/Math.hh | 41 ++++ src/Moof/ModalDialog.hh | 23 +- src/Moof/Octree.hh | 8 +- src/Moof/Ray.hh | 1 + src/Moof/Script.hh | 5 +- src/Moof/Settings.cc | 2 +- src/Moof/Settings.hh | 18 +- src/Moof/Texture.cc | 95 ++------ src/Moof/Transition.hh | 2 +- src/Moof/Video.cc | 11 +- src/Scene.cc | 2 +- src/Tilemap.cc | 2 +- tools/unix2dos | 4 +- win32/mkpackage.sh.in | 469 +++--------------------------------- win32/yoink.nsi.in | 151 ++++++++++++ 36 files changed, 886 insertions(+), 724 deletions(-) create mode 100644 src/Moof/Image.cc create mode 100644 src/Moof/Image.hh create mode 100644 win32/yoink.nsi.in diff --git a/COPYING b/COPYING index d0975dc..1948e77 100644 --- a/COPYING +++ b/COPYING @@ -55,7 +55,7 @@ Copyright: (c) 2000-2004 Unicode, Inc. Copyright: (c) 2002 Bob Pendleton License: LGPL-2.1 - Portion: libpng12-0.dll + Portion: libpng-3.dll Source: http://www.libpng.org/pub/png/libpng.html Copyright: (c) 2004, 2006-2009 Glenn Randers-Pehrson License: libpng @@ -85,7 +85,7 @@ Copyright: (c) 2009 Chris Robinson Copyright: (c) 2003 Neil Carter License: zlib-libpng - Portion: SDL.dll, SDL_image.dll + Portion: SDL.dll Source: http://www.libsdl.org/ Copyright: (c) 2009 Sam Lantinga et al. License: LGPL-2.1 diff --git a/README b/README index 529d3d6..6f5e024 100644 --- a/README +++ b/README @@ -31,12 +31,12 @@ this simple, fast-moving action game to a wider audience. b) Requirements boost headers +libpng libvorbis Lua OpenAL OpenGL SDL -SDL_image (with libpng support) c) License diff --git a/configure.ac b/configure.ac index 7ee82d3..054c4ac 100644 --- a/configure.ac +++ b/configure.ac @@ -10,11 +10,10 @@ AC_INIT([Yoink], [0.1], [chaz@dogcows.com], [yoink]) AC_CANONICAL_TARGET -AC_CONFIG_SRCDIR([src/GameLayer.cc]) +AC_CONFIG_SRCDIR([src/version.c]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # @@ -139,7 +138,7 @@ fi if test x$threads = xyes then AC_DEFINE([USE_THREADS], 1, - [Define to 1 if you want to use threads for parallel tasks.]) + [Define to 1 if you want to use threads when applicable.]) fi if test x$gtk = xyes @@ -149,7 +148,7 @@ then elif test x$qt4 = xyes then AC_DEFINE([USE_QT4], 1, - [Define to 1 if you want to use QT info/error dialogs.]) + [Define to 1 if you want to use QT4 info/error dialogs.]) fi AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level], @@ -267,14 +266,14 @@ AC_SEARCH_LIBS([alEnable], [openal OpenAL32],, [missing=yes echo "***** Missing libopenal ($website) *****"]) -##### SDL_image ##### -website="http://www.libsdl.org/projects/SDL_image/" -AC_CHECK_HEADERS([SDL/SDL_image.h],, +##### libpng ##### +website="http://www.libpng.org/pub/png/libpng.html" +AC_CHECK_HEADERS([png.h],, [missing=yes - echo "***** Missing SDL_image header ($website) *****"]) -AC_SEARCH_LIBS([IMG_Load], [SDL_image],, + echo "***** Missing libpng header ($website) *****"]) +AC_SEARCH_LIBS([png_sig_cmp], [png],, [missing=yes - echo "***** Missing libSDL_image ($website) *****"]) + echo "***** Missing libpng ($website) *****"]) ##### libvorbis ##### website="http://www.xiph.org/downloads/" @@ -331,14 +330,13 @@ fi # -# Find the data files to install. +# Find the game resources to install. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -DATA_FILES=$(echo $(cd data; \ - find . -name "*.lua" \ - -o -name "*.ogg" \ - -o -name "*.png" \ - -o -name "yoinkrc")) +DATA_FILES=$(echo $(cd data && find . -name "*.lua" \ + -o -name "*.ogg" \ + -o -name "*.png" \ + -o -name "yoinkrc")) AC_SUBST([DATA_FILES]) @@ -354,7 +352,7 @@ AC_CONFIG_FILES([Makefile if test x$WIN32 = xyes then - AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh]) + AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh win32/yoink.nsi]) fi diff --git a/data/scenes/Classic.lua b/data/scenes/Classic.lua index e8ba272..5709632 100644 --- a/data/scenes/Classic.lua +++ b/data/scenes/Classic.lua @@ -3,6 +3,9 @@ -- created by Neil Carter -- converted to Lua by Charles McGarvey +LogInfo("-----", "Scene: Classic", "Created by Neil Carter", + "Converted to Lua by Charles McGarvey", "-----") + -- Scene API: -- -- Functions: @@ -28,7 +31,7 @@ SetBounds({-5, 0, -6}, {45, 15, 7}) -- Front ResetTransform() -Translate(-5, 0, 5) +Translate(-5, 0, 2) SetTexture("TowerBlock1") DrawTilemap({ width = 5, @@ -52,7 +55,7 @@ DrawTilemap({ ResetTransform() Rotate(Y, 90) -Translate(0, 0, 5) +Translate(0, 0, 2) DrawTilemap({ width = 5, surface = RIGHT, @@ -76,7 +79,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 90) -Translate(-5, 15, 0) +Translate(-5, 15, -3) DrawTilemap({ width = 5, surface = TOP, @@ -93,6 +96,7 @@ DrawTilemap({ if detail > LOW then ResetTransform() + Translate(0, 0, -3) DrawTilemap({ width = 7, 2, 2, 2, 2, 2, 2, 2, @@ -108,7 +112,7 @@ if detail > LOW then ResetTransform() Rotate(Y, 90) - Translate(7, 0, 0) + Translate(7, 0, -3) DrawTilemap({ width = 6, 2, 2, 2, 2, 2, 2, @@ -124,7 +128,7 @@ if detail > LOW then ResetTransform() Rotate(X, 90) - Translate(-2, 8, -6) + Translate(-2, 8, -9) DrawTilemap({ width = 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -142,7 +146,7 @@ end ResetTransform() Rotate(Y, -90) -Translate(10, 0, 1) +Translate(10, 0, -2) SetTexture("Building") DrawTilemap({ width = 4, @@ -157,7 +161,7 @@ DrawTilemap({ ResetTransform() Rotate(Y, -90) -Translate(13, 0, 1) +Translate(13, 0, -2) DrawTilemap({ width = 4, surface = RIGHT, @@ -170,7 +174,7 @@ DrawTilemap({ -- Front wall ResetTransform() -Translate(10, 0, 5) +Translate(10, 0, 2) DrawTilemap({ width = 3, 15, 7, 16, @@ -182,7 +186,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 135) Scale(1, 1.5, 1.5) -Translate(10, 5, 3) +Translate(10, 5, 0) DrawTilemap({ width = 3, 13, 13, 13, @@ -191,7 +195,7 @@ DrawTilemap({ -- Finial ResetTransform() -Translate(10, 5, 3) +Translate(10, 5, -0.00001) DrawTilemap({ width = 3, 18, 18, 18}) @@ -214,7 +218,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 90) -Translate(-3, 0, 0) +Translate(-3, 0, -3) SetTexture("Scenery") DrawTilemap({ width = 13, @@ -232,7 +236,7 @@ DrawTilemap({ if detail > MEDIUM then ResetTransform() Scale(8, 1, 1) - Translate(1, -0.5, 5) + Translate(1, -0.5, 2) DrawTile({ 2, u_scale = 8}) @@ -241,7 +245,7 @@ if detail > MEDIUM then ResetTransform() Scale(8, 1, 1) - Translate(1, -0.5, 1) + Translate(1, -0.5, -2) DrawTile({ 2, u_scale = 8 @@ -252,7 +256,7 @@ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) Rotate(Y, -90) - Translate(1, -0.5, 1) + Translate(1, -0.5, -2) DrawTile({ 2, u_scale = 4 @@ -263,7 +267,7 @@ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) Rotate(Y, -90) - Translate(9, -0.5, 1) + Translate(9, -0.5, -2) DrawTile({ 2, u_scale = 4 @@ -273,7 +277,7 @@ if detail > MEDIUM then ResetTransform() Scale(11, 1, 1) - Translate(7, 0, 0) + Translate(7, 0, -3) DrawTile({ 4, u_scale = 11 @@ -287,7 +291,7 @@ end if detail > LOW then ResetTransform() - Translate(19, 0, 0) + Translate(19, 0, -3) SetTexture("Building") DrawTilemap({ width = 4, @@ -302,7 +306,7 @@ if detail > LOW then ResetTransform() Rotate(Y, -90) - Translate(19, 0, -3) + Translate(19, 0, -6) DrawTilemap({ width = 3, 15, 1, 16, @@ -314,7 +318,7 @@ if detail > LOW then ResetTransform() Rotate(Y, -90) - Translate(23, 0, -3) + Translate(23, 0, -6) DrawTilemap({ width = 3, 15, 0, 16, @@ -328,7 +332,7 @@ if detail > LOW then Rotate(X, 135) Scale(1, 1.5, 1.5) Rotate(Y, -90) - Translate(21, 6, -3) + Translate(21, 6, -6) DrawTilemap({ width = 3, 13, 13, 13, @@ -340,7 +344,7 @@ if detail > LOW then Rotate(X, -135) Scale(1, 1.5, 1.5) Rotate(Y, -90) - Translate(21, 6, -3) + Translate(21, 6, -6) DrawTilemap({ width = 3, 13, 13, 13, @@ -350,7 +354,7 @@ if detail > LOW then ResetTransform() Rotate(Y, -90) - Translate(21, 6, -3) + Translate(21, 6, -6) DrawTilemap({ width = 3, 18, 18, 18}) @@ -363,7 +367,7 @@ end ResetTransform() Rotate(X, 90) -Translate(10, 0, 0) +Translate(10, 0, -3) SetTexture("Scenery") DrawTilemap({ width = 3, @@ -380,7 +384,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 90) -Translate(13, 0, 0) +Translate(13, 0, -3) DrawTilemap({ width = 8, surface = TOP, @@ -397,7 +401,7 @@ DrawTilemap({ if detail > MEDIUM then ResetTransform() Scale(12, 1, 1) - Translate(14, -0.5, 5) + Translate(14, -0.5, 2) DrawTile({ 2, u_scale = 12 @@ -407,7 +411,7 @@ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) - Translate(14, -0.5, 1) + Translate(14, -0.5, -2) DrawTile({ 2, u_scale = 4 @@ -416,7 +420,7 @@ if detail > MEDIUM then -- Front grass next to door ResetTransform() - Translate(13, -0.5, 3) + Translate(13, -0.5, 0) DrawTile({ 2, u_scale = 1 @@ -425,7 +429,7 @@ if detail > MEDIUM then -- Back grass next to door ResetTransform() - Translate(13, -0.5, 2) + Translate(13, -0.5, -1) DrawTile({ 2, u_scale = 1 @@ -435,7 +439,7 @@ if detail > MEDIUM then ResetTransform() Rotate(Y, -90) - Translate(14, -0.5, 1) + Translate(14, -0.5, -2) DrawTilemap({ width = 4, 2, -1, 2, 2}) @@ -444,7 +448,7 @@ if detail > MEDIUM then ResetTransform() Rotate(Y, -90) - Translate(18, -0.5, 0) + Translate(18, -0.5, -3) DrawTile({ 2, u_scale = 1 @@ -454,7 +458,7 @@ if detail > MEDIUM then ResetTransform() Rotate(Y, -90) - Translate(24, -0.5, 0) + Translate(24, -0.5, -3) DrawTile({ 2, u_scale = 1 @@ -464,7 +468,7 @@ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) - Translate(19, -0.5, 4) + Translate(19, -0.5, 1) DrawTile({ 2, u_scale = 4 @@ -474,7 +478,7 @@ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) - Translate(19, -0.5, 2) + Translate(19, -0.5, -1) DrawTile({ 2, u_scale = 4 @@ -485,7 +489,7 @@ if detail > MEDIUM then ResetTransform() Scale(2, 1, 1) Rotate(Y, -90) - Translate(19, -0.5, 2) + Translate(19, -0.5, -1) DrawTile({ 2, u_scale = 2 @@ -496,7 +500,7 @@ if detail > MEDIUM then ResetTransform() Scale(2, 1, 1) Rotate(Y, -90) - Translate(23, -0.5, 2) + Translate(23, -0.5, -1) DrawTile({ 2, u_scale = 2 @@ -507,7 +511,7 @@ end ResetTransform() Rotate(X, 90) -Translate(21, 0, 0) +Translate(21, 0, -3) DrawTilemap({ width = 7, surface = TOP, @@ -524,7 +528,7 @@ DrawTilemap({ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) - Translate(24, 0, 0) + Translate(24, 0, -3) DrawTile({ 4, u_scale = 4 @@ -534,7 +538,7 @@ if detail > MEDIUM then ResetTransform() Scale(4, 1, 1) - Translate(24, -0.5, 1) + Translate(24, -0.5, -2) DrawTile({ 2, u_scale = 4 @@ -545,7 +549,7 @@ if detail > MEDIUM then ResetTransform() Scale(2, 1, 1) Rotate(Y, -90) - Translate(26, -0.5, 5) + Translate(26, -0.5, 2) DrawTile({ 2, u_scale = 2 @@ -556,7 +560,7 @@ if detail > MEDIUM then ResetTransform() Scale(2, 1, 1) Rotate(Y, -90) - Translate(35, -0.5, 5) + Translate(35, -0.5, 2) DrawTile({ 2, u_scale = 2 @@ -566,7 +570,7 @@ if detail > MEDIUM then ResetTransform() Scale(5, 1, 1) - Translate(35, -0.5, 5) + Translate(35, -0.5, 2) DrawTile({ 2, u_scale = 5 @@ -576,7 +580,7 @@ if detail > MEDIUM then ResetTransform() Scale(6, 1, 1) - Translate(34, -0.5, 1) + Translate(34, -0.5, -2) DrawTile({ 2, u_scale = 6 @@ -586,7 +590,7 @@ if detail > MEDIUM then ResetTransform() Rotate(Y, -90) - Translate(34, -0.5, 0) + Translate(34, -0.5, -3) DrawTile({ 2, u_scale = 1 @@ -597,7 +601,7 @@ end ResetTransform() Rotate(X, 90) -Translate(28, 0, 4) +Translate(28, 0, 1) DrawTilemap({ width = 5, surface = TOP, @@ -609,7 +613,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 90) -Translate(33, 0, 0) +Translate(33, 0, -3) DrawTilemap({ width = 10, surface = TOP, @@ -627,7 +631,7 @@ DrawTilemap({ -- Front ResetTransform() -Translate(28, 0, 4) +Translate(28, 0, 1) SetTexture("TowerBlock1") DrawTilemap({ width = 5, @@ -643,7 +647,7 @@ DrawTilemap({ ResetTransform() Rotate(Y, 90) -Translate(33, 0, 4) +Translate(33, 0, 1) DrawTilemap({ width = 6, surface = RIGHT, @@ -659,7 +663,7 @@ DrawTilemap({ ResetTransform() Rotate(Y, 90) -Translate(28, 0, 4) +Translate(28, 0, 1) DrawTilemap({ width = 6, surface = LEFT, @@ -675,7 +679,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 90) -Translate(28, 7, -2) +Translate(28, 7, -5) DrawTilemap({ width = 5, surface = TOP, @@ -692,7 +696,7 @@ DrawTilemap({ -- Front ResetTransform() -Translate(40, 0, 5) +Translate(40, 0, 2) DrawTilemap({ width = 5, 2, 2, 2, 2, 2, @@ -715,7 +719,7 @@ DrawTilemap({ ResetTransform() Rotate(Y, 90) -Translate(40, 0, 5) +Translate(40, 0, 2) DrawTilemap({ width = 5, surface = LEFT, @@ -739,7 +743,7 @@ DrawTilemap({ ResetTransform() Rotate(X, 90) -Translate(40, 15, 0) +Translate(40, 15, -3) DrawTilemap({ width = 5, surface = TOP, @@ -753,7 +757,7 @@ DrawTilemap({ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ResetTransform() -Translate(-0.32, -0.28, -24) +Translate(-0.32, -0.28, -27) Scale(105, 52, 1) SetTexture("BackgroundFar") DrawTile() @@ -774,21 +778,20 @@ SetTexture("Trees") if detail > LOW then ResetTransform() Scale(3) - Translate(7.75, -0.1, 0.5) + Translate(7.75, -0.1, -2.5) DrawTile(1) end -- Center courtyard ResetTransform() ---Translate(610, -2.5, 85) Scale(3) -Translate(19, -0.1, 2.5) +Translate(19, -0.1, -0.5) DrawTile(0) ResetTransform() Scale(3) -Translate(20.25, -0.1, 3.5) +Translate(20.25, -0.1, 0.5) DrawTile(1) -- Right courtyard @@ -796,27 +799,22 @@ DrawTile(1) if detail > LOW then ResetTransform() Scale(3) - Translate(34, -0.1, 0.25) + Translate(34, -0.1, -2.75) DrawTile(1) ResetTransform() Scale(3) - Translate(36, -0.1, -0.5) + Translate(36, -0.1, -3.5) DrawTile(0) ResetTransform() Scale(3) - Translate(37, -0.1, 0.75) + Translate(37, -0.1, -2.25) DrawTile(1) end -function GetZCoord(x, y) - return 3.00001 -end - - -- Functions: -- DisplayText(text, seconds) -- Yield(seconds) @@ -829,23 +827,27 @@ end -- BeginNewWave() -- Events: +-- Think() is called periodically -- BadGuyDied(enemy) --- PlayedDied(player) --- SceneLoaded() +-- HeroineDied(player) -- Globals: -- numberOfBadGuys +--do + --SpawnHeroine({5, 5}) + --local waveNum = BeginNewWave() + --PopulateScene(waveNum) +--end + + -- Events --------- Event = {} -function Event:SceneLoaded() - SpawnHeroine({500, 500}) - local waveNum = BeginNewWave() - PopulateScene(waveNum) +function Event:Think() end function Event:BadGuyDied(enemy) @@ -887,7 +889,7 @@ function PopulateScene(waveNum) end function RandomSpawnPlace() - return {500, 500} + return {5, 5} end function RandomSkillLevel() @@ -895,5 +897,5 @@ function RandomSkillLevel() end --- vim: tw=80 ts=4 +-- vim: ts=4 sw=4 tw=80 diff --git a/data/textures/Particles.png b/data/textures/Particles.png index 3d8695f66733f9003a6d3d96560e30e208f516c9..659fae5758fa1007dfc89f3df7996b6c3bda18e7 100644 GIT binary patch delta 2376 zcmV-O3Agr~P16#PB!2;OQb$4nuFf3k00006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru+5rOs6De?g9wz_*08ey9Sad^gZEa<4bO3Z|Y-MvG zJs^8HEFd&}3Tj*0) z;Q1b=`Qv0RP#7KqM~s`vXlV9_FF3SOc9W=n9zZW`BJA@w4{E3mrGrcl-=3!8a1l zqOEi&=7w}|$D$SZ2f4ua77lU<({)TO1mJQ3c?(8ZGq=d|PsC#<3+5+r{t4hQAXL{P zhYf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W~rm3 z6H0%W9K*J91+|;2xaxM2U-nC@GzWz@2Q}P#tmR8QYoi>uV3g>Pf!5(et|kX=UdRyb z4SPPGfKo;i=b!gPydS9t>Z7203*ieOkQ+7`R+wwI_e=K?B7D{1iI9;Ih?l;877&1t zl3=TQ)zmh$-V>v_jDOQv<;5804vemmdyZ+OhvM`xc}8wET8= z3sW!idmsG_W>z|}%_~BBHjFKQ`HA|+dx1a=y?}sh_>u$&5+cPb0tWd&`bY;@<1^x{ zmz&2OImj#3bu(2ofP8ps#tvrLJt&4E0{My=^TA6$PfBdG>!3h4RPZuk5bAE`8gCzvuY6o$4wl}eQ z8?$K)JzUcpg8R?ye2bs056CO@BGd4aJb1ptG r3mcm$4-16X)Rcvf*BruYY|L#8F=Y=U{u%SuEkI66NwQYlDCoZcR}QZI diff --git a/data/yoinkrc b/data/yoinkrc index 5660ffa..79fa707 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -50,12 +50,12 @@ resizable = true -- that make up the video mode. A typical value is 800,600 for a size of -- 800x600 pixels with millions of colors (the third number is optional). -videomode = {1024, 786} +videomode = {800, 600} -- Set whether or not the cursor will be visible when you mouse over the -- display of the game. -showcursor = false +showcursor = true -- Set whether or not the drawing should use two buffers. This results in -- a higher quality animation. You should usually leave this as true. diff --git a/doc/licenses/MIT b/doc/licenses/MIT index 0ee603d..4110670 100644 --- a/doc/licenses/MIT +++ b/doc/licenses/MIT @@ -1,14 +1,20 @@ Copyright (c) -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/extra/yoink.ebuild b/extra/yoink.ebuild index ce20adb..3646f82 100644 --- a/extra/yoink.ebuild +++ b/extra/yoink.ebuild @@ -17,10 +17,11 @@ KEYWORDS="amd64 ~ppc x86" IUSE="debug double-precision gtk qt4 threads" RDEPEND="dev-lang/lua + media-libs/libpng media-libs/libsdl[opengl] media-libs/libvorbis media-libs/openal - media-libs/sdl-image[png] + virtual/glu virtual/opengl" DEPEND="${RDEPEND} dev-libs/boost diff --git a/src/Animation.cc b/src/Animation.cc index 593f44e..598361b 100644 --- a/src/Animation.cc +++ b/src/Animation.cc @@ -167,7 +167,7 @@ class Animation::Impl std::string filePath = Animation::getPath(getName()); script.importBaseLibrary(); - importLogPrintFunction(script); + importLogFunctions(script); importAnimationBindings(script); if (script.doFile(filePath) != Mf::Script::SUCCESS) diff --git a/src/Character.cc b/src/Character.cc index 3022c31..52a13e6 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -79,7 +79,7 @@ private: Character::Character(const std::string& name) : - tilemap(name), + tilemap("Particles"), animation(name) { mState.init(); @@ -108,9 +108,9 @@ void Character::update(Mf::Scalar t, Mf::Scalar dt) animation.update(t, dt); - Mf::Vector3 center(mState.position[0], mState.position[1], mZCoord); - Mf::Vector3 a(mState.position[0] - 0.5, mState.position[1] - 0.5, mZCoord); - Mf::Vector3 b(mState.position[0] + 0.5, mState.position[1] + 0.5, mZCoord); + Mf::Vector3 center(mState.position[0], mState.position[1], 0.0); + Mf::Vector3 a(mState.position[0] - 0.5, mState.position[1] - 0.5, 0.0); + Mf::Vector3 b(mState.position[0] + 0.5, mState.position[1] + 0.5, 0.0); mAabb.init(a, b); mSphere.init(center, a); @@ -139,23 +139,18 @@ void Character::draw(Mf::Scalar alpha) const glBegin(GL_TRIANGLE_FAN); glTexCoord(coords[0], coords[1]); - glVertex(position[0]-s, position[1]-s, mZCoord); + glVertex(position[0]-s, position[1]-s); glTexCoord(coords[2], coords[3]); - glVertex(position[0]+s, position[1]-s, mZCoord); + glVertex(position[0]+s, position[1]-s); glTexCoord(coords[4], coords[5]); - glVertex(position[0]+s, position[1]+s, mZCoord); + glVertex(position[0]+s, position[1]+s); glTexCoord(coords[6], coords[7]); - glVertex(position[0]-s, position[1]+s, mZCoord); + glVertex(position[0]-s, position[1]+s); glEnd(); } -void Character::setZCoord(Mf::Scalar z) -{ - mZCoord = z; -} - -int Character::getOctant(const Mf::Aabb<3>& aabb) const +/*int Character::getOctant(const Mf::Aabb<3>& aabb) const { int octantNum = -1; @@ -263,6 +258,7 @@ int Character::getOctant(const Mf::Aabb<3>& aabb) const return octantNum; } +*/ void Character::addImpulse(Mf::Vector2 impulse) diff --git a/src/Character.hh b/src/Character.hh index 2173422..6507906 100644 --- a/src/Character.hh +++ b/src/Character.hh @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -52,7 +51,7 @@ typedef boost::shared_ptr CharacterP; * includes the heroine herself and the bad guys. */ -class Character : public Mf::RigidBody2, public Mf::OctreeInsertable +class Character : public Mf::RigidBody2 { public: @@ -62,20 +61,14 @@ public: virtual void update(Mf::Scalar t, Mf::Scalar dt); virtual void draw(Mf::Scalar alpha) const; - void setZCoord(Mf::Scalar z); - void addImpulse(Mf::Vector2 impulse); void addForce(Mf::Vector2 force); void setPosition(Mf::Vector2 position); - virtual int getOctant(const Mf::Aabb<3>& aabb) const; + //virtual int getOctant(const Mf::Aabb<3>& aabb) const; Tilemap tilemap; Animation animation; - -private: - - mutable Mf::Scalar mZCoord; }; diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 3f5a7a8..0ed249c 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -42,25 +42,10 @@ #endif - -Mf::Scalar GameLayer::getZCoord(const Mf::Vector2& position) const -{ - Mf::Scalar z; - - mState.script.getGlobalTable().pushField("GetZCoord"); - mState.script.push(position[0]); - mState.script.push(position[1]); - mState.script.call(2, 1); - mState.script.getTop().get(z); - mState.script.pop(); - - return z; -} - void GameLayer::loadSceneLoader() { mState.script.importStandardLibraries(); - importLogPrintFunction(mState.script); + importLogFunctions(mState.script); std::string loaderPath = Scene::getPath("loader"); if (loaderPath == "") @@ -101,6 +86,18 @@ void GameLayer::advanceScene() throw Mf::Exception(Mf::ErrorCode::SCRIPT_ERROR, str); } + + mState.script.getGlobalTable().pushField("Event"); + if (mState.script[-1].isTable()) + { + mState.script[-1].pushField("Think"); + mState.script.set("Think", Mf::Script::REGISTRY); + mState.script.pop(2); + } + else + { + mState.script.pop(); + } } } @@ -121,11 +118,14 @@ GameLayer::GameLayer() : loadSceneLoader(); advanceScene(); // load the first scene + mThinkTimer.init(boost::bind(&GameLayer::thinkTimer, this), + 0.1, Mf::Timer::REPEAT); + mState.heroine = Heroine::alloc(); - mState.heroine->animation.startSequence("FlyDiagonallyUp"); + mState.heroine->animation.startSequence("GreenDiamond"); Mf::Scalar a[6] = {0.0, 1.5, -0.5, 3.0, -2.0, 1.0}; - mState.interp.init(a, 2.0, Mf::Interpolator::OSCILLATE); + mState.interp.init(a, 5.0, Mf::Interpolator::OSCILLATE); setProjection(); } @@ -155,12 +155,19 @@ void GameLayer::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt) mState.scene->checkForCollision(*mState.heroine); mState.camera.setPosition(Mf::Vector3(-mState.heroine->getState().position[0], - -mState.heroine->getState().position[1], -9)); + -mState.heroine->getState().position[1], -6)); //mState.camera.lookAt(Mf::promote(mState.heroine->getState().position)); mRay.point = mState.heroine->getState().position; } +void GameLayer::thinkTimer() +{ + mState.script.getRegistryTable().pushField("Think"); + if (mState.script[-1].isFunction()) mState.script.call(); + else mState.script.pop(); +} + void GameLayer::rayTimer() { @@ -186,9 +193,9 @@ void GameLayer::rayTimer() { hits.front().normal.normalize(); mRay.solve(point, hits.front().distance); - Mf::logDebug << "scene: d = " << hits.front().distance << std::endl; - Mf::logDebug << " P = " << point << std::endl; - Mf::logDebug << " n = " << hits.front().normal << std::endl; + Mf::logInfo << "scene: d = " << hits.front().distance << std::endl; + Mf::logInfo << " P = " << point << std::endl; + Mf::logInfo << " n = " << hits.front().normal << std::endl; } } @@ -205,7 +212,6 @@ void GameLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const mState.scene->drawIfVisible(alpha, mState.camera.getFrustum()); - mState.heroine->setZCoord(getZCoord(mState.heroine->getState().position)); mState.heroine->draw(alpha); mRay.draw(); @@ -242,6 +248,12 @@ bool GameLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event) cml::rad(-10.0)); return true; } + else if (event.key.keysym.sym == SDLK_r) + { + loadSceneLoader(); + advanceScene(); + return true; + } return mState.heroine->handleEvent(event); case SDL_KEYUP: diff --git a/src/GameLayer.hh b/src/GameLayer.hh index 4e0a84f..73b6a23 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -80,9 +80,7 @@ public: struct State { - // the script object must be mutable because some script functions must be - // called during draw - mutable Mf::Script script; + Mf::Script script; std::vector sceneList; HeroineP heroine; @@ -98,12 +96,14 @@ private: void loadSceneLoader(); void advanceScene(); - Mf::Scalar getZCoord(const Mf::Vector2& position) const; + void thinkTimer(); void setProjection(); void setProjection(Mf::Scalar width, Mf::Scalar height); State mState; + Mf::Timer mThinkTimer; + Mf::SoundStream mMusic; Mf::Sound mPunchSound; diff --git a/src/Heroine.cc b/src/Heroine.cc index a70b798..5df1031 100644 --- a/src/Heroine.cc +++ b/src/Heroine.cc @@ -33,7 +33,7 @@ Heroine::Heroine() : - Character("Heroine") {} + Character("Effects") {} void Heroine::update(Mf::Scalar t, Mf::Scalar dt) diff --git a/src/MainLayer.cc b/src/MainLayer.cc index 0b2ef36..4037736 100644 --- a/src/MainLayer.cc +++ b/src/MainLayer.cc @@ -77,6 +77,7 @@ void MainLayer::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt) { // this is the only layer left on the stack //engine.push(TitleLayer::alloc()); + engine.clear(); } } @@ -270,12 +271,10 @@ int main(int argc, char* argv[]) atexit(goodbye); -#if YOINK_LOGLEVEL >= 4 - Mf::Log::setLevel(Mf::Log::DEBUGG); -#elif YOINK_LOGLEVEL >= 3 +#if YOINK_LOGLEVEL >= 3 Mf::Log::setLevel(Mf::Log::INFO); #elif YOINK_LOGLEVEL >= 2 - Mf::Log::setLevel(Mf::Log::SCRIPT); + Mf::Log::setLevel(Mf::Log::WARNING); #elif YOINK_LOGLEVEL >= 1 Mf::Log::setLevel(Mf::Log::ERROR); #elif YOINK_LOGLEVEL diff --git a/src/Makefile.am b/src/Makefile.am index 766d4ce..ee59088 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,6 +31,8 @@ libmoof_a_SOURCES = \ Moof/Frustum.hh \ Moof/Hash.cc \ Moof/Hash.hh \ + Moof/Image.cc \ + Moof/Image.hh \ Moof/Interpolator.hh \ Moof/Layer.hh \ Moof/Library.hh \ diff --git a/src/Moof/Engine.cc b/src/Moof/Engine.cc index ccfaf81..56e98b9 100644 --- a/src/Moof/Engine.cc +++ b/src/Moof/Engine.cc @@ -73,7 +73,7 @@ public: { char vdName[128]; SDL_VideoDriverName(vdName, sizeof(vdName)); - logDebug << "initialized SDL; using video driver `" + logInfo << "initialized SDL; using video driver `" << vdName << "'" << std::endl; } @@ -94,7 +94,7 @@ public: else { alcMakeContextCurrent(mAlContext); - logDebug << "opened sound device `" + logInfo << "opened sound device `" << alcGetString(mAlDevice, ALC_DEFAULT_DEVICE_SPECIFIER) << "'" << std::endl; } @@ -282,7 +282,7 @@ public: { ASSERT(layer && "cannot push null layer"); mStack.push_front(layer); - logDebug << "stack: " << mStack.size() + logInfo << "stack: " << mStack.size() << " [pushed " << layer.get() << "]" << std::endl; layer->pushed(mInterface); } @@ -294,7 +294,7 @@ public: LayerP layer = mStack.front(); mStack.pop_front(); - logDebug << "stack: " << mStack.size() + logInfo << "stack: " << mStack.size() << " [popped " << layer.get() << "]" << std::endl; layer->popped(mInterface); @@ -324,7 +324,7 @@ public: for (it = layers.begin(); it != layers.end(); ++it) { (*it)->popped(mInterface); - logDebug << "stack: " << mStack.size() + logInfo << "stack: " << mStack.size() << " [popped " << (*it).get() << "]" << std::endl; } @@ -341,7 +341,7 @@ public: { mStack.clear(); mStackIt = mStack.begin(); - logDebug("stack: 0 [cleared]"); + logInfo("stack: 0 [cleared]"); } diff --git a/src/Moof/Image.cc b/src/Moof/Image.cc new file mode 100644 index 0000000..31d6b02 --- /dev/null +++ b/src/Moof/Image.cc @@ -0,0 +1,325 @@ + +/******************************************************************************* + + Copyright (c) 2009, Charles McGarvey + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ + +#include // FILE +#include // strncmp + +#include +#include + +#include "Image.hh" +#include "Library.hh" +#include "Log.hh" + + +namespace Mf { + + +class Image::Impl : public Library +{ +public: + + explicit Impl(const std::string& name, bool flipped = false) : + Library(name), + mContext(0), + mPixels(0) + { + init(getName(), flipped); + } + + ~Impl() + { + SDL_FreeSurface(mContext); + delete[] mPixels; + } + + + void flip() + { + unsigned char* pixels = (Uint8*)(mContext->pixels); + + unsigned pitch = mContext->pitch; + unsigned char line[pitch]; + + int yBegin = 0; + int yEnd = mContext->h - 1; + + if (SDL_MUSTLOCK(mContext)) SDL_LockSurface(mContext); + while (yBegin < yEnd) + { + memcpy(line, pixels + pitch * yBegin, pitch); + memcpy(pixels + pitch * yBegin, pixels + pitch * yEnd, pitch); + memcpy(pixels + pitch * yEnd, line, pitch); + yBegin++; + yEnd--; + } + if (SDL_MUSTLOCK(mContext)) SDL_UnlockSurface(mContext); + } + + void setAsIcon() const + { + SDL_WM_SetIcon(mContext, 0); + } + + + SDL_Surface* mContext; + char* mPixels; + + unsigned mDepth; + GLuint mColorMode; + + std::string mComment; + + +private: + + bool init(const std::string& filePath, bool flipped) + { + logInfo("opening image file..."); + FILE* fp = fopen(filePath.c_str(), "rb"); + if (!fp) return false; + + png_byte signature[8]; + size_t bytesRead; + + png_infop pngInfo = 0; + png_infop pngInfoEnd = 0; + png_structp pngObj = 0; + + int width; + int height; + int pitch; + int bpp; + int channels; + + png_byte colors; + png_bytepp rows = 0; + + png_textp texts = 0; + int numTexts; + + logInfo("checking signature..."); + bytesRead = fread(signature, 1, sizeof(signature), fp); + logInfo << "reading " << bytesRead << " bytes of signature" << std::endl; + if (bytesRead < sizeof(signature) || + png_sig_cmp(signature, 0, sizeof(signature)) != 0) goto cleanup; + + logInfo("creating png structures..."); + pngObj = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); + if (!pngObj) goto cleanup; + + pngInfo = png_create_info_struct(pngObj); + if (!pngInfo) goto cleanup; + + pngInfoEnd = png_create_info_struct(pngObj); + if (!pngInfoEnd) goto cleanup; + + logInfo("setting up long jump..."); + if (setjmp(png_jmpbuf(pngObj))) goto cleanup; + + png_init_io(pngObj, fp); + png_set_sig_bytes(pngObj, sizeof(signature)); + png_read_info(pngObj, pngInfo); + + bpp = png_get_bit_depth(pngObj, pngInfo); + logInfo << "texture bpp: " << bpp << std::endl; + colors = png_get_color_type(pngObj, pngInfo); + switch (colors) + { + case PNG_COLOR_TYPE_PALETTE: + png_set_palette_to_rgb(pngObj); + break; + + case PNG_COLOR_TYPE_GRAY: + if (bpp < 8) png_set_gray_1_2_4_to_8(pngObj); + break; + + case PNG_COLOR_TYPE_GRAY_ALPHA: + png_set_gray_to_rgb(pngObj); + break; + } + + if (bpp == 16) png_set_strip_16(pngObj); + + png_read_update_info(pngObj, pngInfo); + + bpp = png_get_bit_depth(pngObj, pngInfo); + channels = png_get_channels(pngObj, pngInfo); + mDepth = bpp * channels; + + logInfo << "texture channels: " << channels << std::endl; + if (channels == 3) mColorMode = GL_RGB; + else mColorMode = GL_RGBA; + + // read comments + png_get_text(pngObj, pngInfo, &texts, &numTexts); + logInfo << "num texts: " << numTexts << std::endl; + for (int i = 0; i < numTexts; ++i) + { + if (strncmp(texts[i].key, "Comment", 7) == 0) + { + mComment = texts[i].text; + break; + } + } + + width = png_get_image_width(pngObj, pngInfo); + height = png_get_image_height(pngObj, pngInfo); + + pitch = png_get_rowbytes(pngObj, pngInfo); + mPixels = new char[width * pitch]; + + rows = new png_bytep[height]; + if (flipped) + { + for (int i = 0; i < height; ++i) + { + rows[height - 1 - i] = (png_bytep)(mPixels + i * channels * width); + } + } + else + { + for (int i = 0; i < height; ++i) + { + rows[i] = (png_bytep)(mPixels + i * channels * width); + } + } + + png_read_image(pngObj, rows); + png_read_end(pngObj, 0); + + mContext = SDL_CreateRGBSurfaceFrom + ( + mPixels, + width, + height, + bpp * channels, + pitch, +#if SDL_BYTEORDER == SDL_LIL_ENDIAN + 0x000000FF, + 0x0000FF00, + 0x00FF0000, + 0xFF000000 +#else + 0xFF000000, + 0x00FF0000, + 0x0000FF00, + 0x000000FF +#endif + ); + + cleanup: + + logInfo("cleaning up..."); + delete[] rows; + png_destroy_read_struct(pngObj ? &pngObj : 0, + pngInfo ? &pngInfo : 0, + pngInfoEnd ? &pngInfoEnd : 0); + fclose(fp); + + return mContext; + } +}; + + +Image::Image(const std::string& name) : + // pass through + mImpl(Image::Impl::getInstance(name)) {} + + +bool Image::isValid() const +{ + return mImpl->mContext; +} + +int Image::getWidth() const +{ + return mImpl->mContext->w; +} + +int Image::getHeight() const +{ + return mImpl->mContext->h; +} + +unsigned Image::getDepth() const +{ + return mImpl->mDepth; +} + +unsigned Image::getPitch() const +{ + return mImpl->mContext->pitch; +} + +GLuint Image::getColorMode() const +{ + return mImpl->mColorMode; +} + +std::string Image::getComment() const +{ + return mImpl->mComment; +} + +const char* Image::getPixels() const +{ + return mImpl->mPixels; +} + +char* Image::getPixels() +{ + return mImpl->mPixels; +} + + +void Image::flip() +{ + // pass through + mImpl->flip(); +} + +void Image::setAsIcon() const +{ + // pass through + mImpl->setAsIcon(); +} + + + +std::string Image::getPath(const std::string& name) +{ + std::string path = Resource::getPath("images/" + name + ".png"); + return path; +} + + +} // namespace Mf + +/** vim: set ts=4 sw=4 tw=80: *************************************************/ + diff --git a/src/Moof/Image.hh b/src/Moof/Image.hh new file mode 100644 index 0000000..5f7c5a3 --- /dev/null +++ b/src/Moof/Image.hh @@ -0,0 +1,79 @@ + +/******************************************************************************* + + Copyright (c) 2009, Charles McGarvey + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*******************************************************************************/ + +#ifndef _MOOF_IMAGE_HH_ +#define _MOOF_IMAGE_HH_ + +#include + +#include +#include + + +namespace Mf { + + +class Image : public Resource +{ +public: + + explicit Image(const std::string& name); + + bool isValid() const; + + int getWidth() const; + int getHeight() const; + + unsigned getDepth() const; + unsigned getPitch() const; + GLuint getColorMode() const; + + std::string getComment() const; + + const char* getPixels() const; + char* getPixels(); + + void flip(); + + void setAsIcon() const; + + static std::string getPath(const std::string& name); + +private: + + class Impl; + boost::shared_ptr mImpl; +}; + + +} // namespace Mf + +#endif // _MOOF_IMAGE_HH_ + +/** vim: set ts=4 sw=4 tw=80: *************************************************/ + diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc index 2ea6c57..9809771 100644 --- a/src/Moof/Log.cc +++ b/src/Moof/Log.cc @@ -57,18 +57,17 @@ std::ostream& nullLog(nullLog_); Log logError(Log::ERRORR, " error: "); Log logWarning(Log::WARNING, "warning: "); Log logInfo(Log::INFO, " info: "); -Log logDebug(Log::DEBUGG, " debug: "); -static int logScript_(Script& script) +static int logScript_(Script& script, Log::Level level) { - static Log logScript(Log::SCRIPT, " script: "); + static Log* logs[] = {0, &logError, &logWarning, &logInfo}; Script::Slot param = script[1]; while (!param.isNone()) { - logScript(param); + (*logs[level])(param); ++param.index; } @@ -76,9 +75,12 @@ static int logScript_(Script& script) } -void importLogPrintFunction(Script& script) +void importLogFunctions(Script& script) { - script.importFunction("print", logScript_); + script.importFunction("LogError", boost::bind(logScript_, _1, Log::ERRORR)); + script.importFunction("LogWarning", boost::bind(logScript_, _1, Log::WARNING)); + script.importFunction("LogInfo", boost::bind(logScript_, _1, Log::INFO)); + script.importFunction("print", boost::bind(logScript_, _1, Log::INFO)); } diff --git a/src/Moof/Log.hh b/src/Moof/Log.hh index c7ee507..96585a1 100644 --- a/src/Moof/Log.hh +++ b/src/Moof/Log.hh @@ -64,12 +64,10 @@ public: enum Level { - NONE = -1, ///< Disable all logging. - ERRORR = 1, ///< Log only errors. - WARNING = 2, ///< Log warnings and errors. - SCRIPT = 3, ///< Log messages from Lua, too. - INFO = 4, ///< Log info, warnings, errors. - DEBUGG = 5, ///< Log all messages. + NONE = 0, ///< Disable all logging. + ERRORR = 1, ///< Log only errors. + WARNING = 2, ///< Log warnings and errors. + INFO = 3, ///< Log everything. }; static void setLevel(Level level); @@ -104,7 +102,6 @@ extern std::ostream& nullLog; extern Log logError; extern Log logWarning; extern Log logInfo; -extern Log logDebug; template @@ -116,7 +113,7 @@ inline std::ostream& operator << (Log& logObj, const T& item) class Script; -void importLogPrintFunction(Script& script); +void importLogFunctions(Script& script); } // namespace Mf diff --git a/src/Moof/Math.hh b/src/Moof/Math.hh index 05aa9ec..45c6e90 100644 --- a/src/Moof/Math.hh +++ b/src/Moof/Math.hh @@ -102,6 +102,47 @@ inline Vector3 promote(const Vector2& vec, Scalar extra = 0.0) } +template +inline R convert(const P& p) +{ + return R(p); +} + +template <> +inline Vector3 convert(const Vector4& vec) +{ + return Vector3(vec[0], vec[1], vec[2]); +} + +template <> +inline Vector2 convert(const Vector3& vec) +{ + return Vector2(vec[0], vec[1]); +} + +template <> +inline Vector4 convert(const Vector3& vec) +{ + return Vector4(vec[0], vec[1], vec[2], SCALAR(0.0)); +} + +template <> +inline Vector3 convert(const Vector2& vec) +{ + return Vector3(vec[0], vec[1], SCALAR(0.0)); +} + +template +struct cast +{ + cast(const P& p) : param(p) {} + template + operator R() { return convert(param); } +private: + const P& param; +}; + + const Scalar EPSILON = SCALAR(0.000001); diff --git a/src/Moof/ModalDialog.hh b/src/Moof/ModalDialog.hh index 9b3820a..f630cb6 100644 --- a/src/Moof/ModalDialog.hh +++ b/src/Moof/ModalDialog.hh @@ -92,7 +92,26 @@ struct ModalDialog break; } -#if USE_GTK +#if defined(_WIN32) || defined(__WIN32__) + + int iconType; + switch (type) + { + case WARNING: + iconType = MB_ICONWARNING; + break; + case CRITICAL: + iconType = MB_ICONERROR; + break; + default: + iconType = MB_ICONINFORMATION; + break; + } + + MessageBox(0, (text1 + "\n" + text2).c_str(), title.c_str(), + MB_OK | iconType); + +#elif USE_GTK int argc = 0; char** argv; @@ -126,7 +145,7 @@ struct ModalDialog gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); // FIXME - this doesn't seem to actually remove the window from the - // screen when it closes, not sure why... + // screen when it closes #elif USE_QT4 diff --git a/src/Moof/Octree.hh b/src/Moof/Octree.hh index 4657aec..301b420 100644 --- a/src/Moof/Octree.hh +++ b/src/Moof/Octree.hh @@ -79,7 +79,7 @@ class Octree : public Entity void printSize() { - logDebug << "size of node " << objects.size() << std::endl; + logInfo << "size of node " << objects.size() << std::endl; } void getAll(std::list& insertables) const @@ -194,7 +194,7 @@ private: } else { - logDebug("getting all the rest..."); + logInfo("getting all the rest..."); getAll(insertables, node); } } @@ -357,9 +357,9 @@ public: void getNearbyObjects(std::list& insertables, const OctreeInsertable& entity) const { - logDebug("--- GETTING NEARBY"); + logInfo("--- GETTING NEARBY"); getNearbyObjects(insertables, entity, mTree.root()); - logDebug("---"); + logInfo("---"); savedObj = &entity; } }; diff --git a/src/Moof/Ray.hh b/src/Moof/Ray.hh index 23ebd76..5a693d2 100644 --- a/src/Moof/Ray.hh +++ b/src/Moof/Ray.hh @@ -70,6 +70,7 @@ struct Ray : public Drawable void draw(Scalar alpha = 0.0) const { Vector end = point + 1000.0 * direction; + // TODO this is kinda cheesy Mf::Texture::resetBind(); glBegin(GL_LINES); diff --git a/src/Moof/Script.hh b/src/Moof/Script.hh index 05b9da9..9e8827a 100644 --- a/src/Moof/Script.hh +++ b/src/Moof/Script.hh @@ -789,7 +789,7 @@ public: * is any number of return values, depending on the callee). */ - Result call(int nargs, int nresults = LUA_MULTRET) + Result call(int nargs = 0, int nresults = LUA_MULTRET) { return (Result)lua_pcall(mState, nargs, nresults, 0); } @@ -916,8 +916,7 @@ inline std::ostream& operator << (std::ostream& stream, } else { - stream << slot.getTypeName() - << " (" << slot.getIdentifier() << ")" << std::endl; + stream << slot.getTypeName() << " (" << slot.getIdentifier() << ")"; } return stream; diff --git a/src/Moof/Settings.cc b/src/Moof/Settings.cc index c5c3734..9f0538b 100644 --- a/src/Moof/Settings.cc +++ b/src/Moof/Settings.cc @@ -88,7 +88,7 @@ void Settings::loadFromFiles(const std::vector& filePaths) { std::string str; mScript[-1].get(str); - logInfo(str); + logWarning(str); mScript.clear(); } } diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index 2a2a926..d31b57d 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -50,12 +50,10 @@ class Settings { public: - Settings() : - mGlobals(mScript.getGlobalTable()), - mTop(mScript[-1]) + Settings() { mScript.importBaseLibrary(); - importLogPrintFunction(mScript); + importLogFunctions(mScript); } ~Settings(); @@ -79,7 +77,6 @@ public: private: Script mScript; - Script::Slot mGlobals, mTop; std::string mUserFile; }; @@ -88,17 +85,20 @@ private: template bool Settings::get(const std::string& key, T& value) { + Script::Slot top = mScript[-1]; + Script::Slot globals = mScript.getGlobalTable(); + std::vector fields; boost::split(fields, key, boost::is_any_of(".")); - mGlobals.pushCopy(); + globals.pushCopy(); std::vector::iterator it; for (it = fields.begin(); it != fields.end(); ++it) { - if (mTop.isTable()) + if (top.isTable()) { - mTop.pushField(*it); + top.pushField(*it); } else { @@ -107,7 +107,7 @@ bool Settings::get(const std::string& key, T& value) } } - bool got = mTop.get(value); + bool got = top.get(value); mScript.clear(); return got; } diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 61cabd2..22d3f15 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -26,16 +26,15 @@ *******************************************************************************/ -#include // memcpy +#include // FILE +#include // strncmp #include -#include -#include - #include "Dispatch.hh" #include "Engine.hh" #include "Exception.hh" +#include "Image.hh" #include "Library.hh" #include "Log.hh" #include "OpenGL.hh" @@ -50,8 +49,8 @@ namespace Mf { * which is worth having in memory. The image data itself is not worth keeping * in memory if the texture has been loaded to GL, but the name of the resource * is retained so that it can be reloaded if necessary. The implementation is a - * mippleton so that multiple texture objects can share the same internal - * objects and avoid having duplicate textures loaded to GL. + * library so that multiple texture objects can share the same internal objects + * and avoid having duplicate textures loaded to GL. */ class Texture::Impl : public Library @@ -103,29 +102,6 @@ class Texture::Impl : public Library return value; } - - static void flipSurface(SDL_Surface* image) - { - unsigned char* pixels = (Uint8*)(image->pixels); - - unsigned pitch = image->pitch; - unsigned char line[pitch]; - - int yBegin = 0; - int yEnd = image->h - 1; - - if (SDL_MUSTLOCK(image)) SDL_LockSurface(image); - while (yBegin < yEnd) - { - memcpy(line, pixels + pitch * yBegin, pitch); - memcpy(pixels + pitch * yBegin, pixels + pitch * yEnd, pitch); - memcpy(pixels + pitch * yEnd, line, pitch); - yBegin++; - yEnd--; - } - if (SDL_MUSTLOCK(image)) SDL_UnlockSurface(image); - } - public: /** @@ -134,7 +110,8 @@ public: explicit Impl(const std::string& name) : Library(name), - mContext(0), + //mContext(0), + mImage(Texture::getPath(getName())), mWidth(0), mHeight(0), mMode(0), @@ -158,11 +135,6 @@ public: ~Impl() { - if (mContext) - { - SDL_FreeSurface(mContext); - } - unloadFromGL(); } @@ -174,6 +146,7 @@ public: * method makes them ready. */ + /* static SDL_Surface* prepareImageForGL(SDL_Surface* surface) { int w = powerOfTwo(surface->w); @@ -234,6 +207,7 @@ public: return image; } + */ /** * Use SDL_image to load images from file. A surface with the image data is @@ -243,42 +217,17 @@ public: void loadFromFile() { - SDL_Surface* surface; - - surface = IMG_Load(Texture::getPath(getName()).c_str()); - - if (!surface) + if (!mImage.isValid()) { logWarning << "texture not found: " << getName() << std::endl; - throw Exception(ErrorCode::FILE_NOT_FOUND, getName()); - } - - SDL_Surface* temp = prepareImageForGL(surface); - SDL_FreeSurface(surface); - - if (!temp) - { - throw Exception(ErrorCode::UNKNOWN_IMAGE_FORMAT, getName()); - } - - if (temp->format->BytesPerPixel == 3) - { - mMode = GL_RGB; - } - else if (temp->format->BytesPerPixel == 4) - { - mMode = GL_RGBA; - } - else - { - SDL_FreeSurface(temp); - throw Exception(ErrorCode::UNKNOWN_IMAGE_FORMAT, getName()); + throw Exception(ErrorCode::RESOURCE_NOT_FOUND, getName()); } - mWidth = temp->w; - mHeight = temp->h; + mImage.flip(); - mContext = temp; + mWidth = mImage.getWidth(); + mHeight = mImage.getHeight(); + mMode = mImage.getColorMode(); } @@ -295,7 +244,7 @@ public: return; } - if (!mContext) loadFromFile(); + //if (!mContext) loadFromFile(); glGenTextures(1, &mObject); glBindTexture(GL_TEXTURE_2D, mObject); @@ -307,18 +256,18 @@ public: 0, mMode, //3, - mContext->w, - mContext->h, + mWidth, + mHeight, 0, mMode, GL_UNSIGNED_BYTE, - mContext->pixels + mImage.getPixels() ); setProperties(); - SDL_FreeSurface(mContext); - mContext = 0; + //SDL_FreeSurface(mContext); + //mContext = 0; } @@ -378,7 +327,7 @@ public: } - SDL_Surface* mContext; + Image mImage; unsigned mWidth; ///< Horizontal dimension of the image. unsigned mHeight; ///< Vertical dimension. diff --git a/src/Moof/Transition.hh b/src/Moof/Transition.hh index 07addc3..5f8a248 100644 --- a/src/Moof/Transition.hh +++ b/src/Moof/Transition.hh @@ -121,7 +121,7 @@ public: void draw(Engine& engine, Scalar alpha) const { Scalar a = mInterp.getState(alpha); - logDebug << "transition state: " << a << std::endl; + logInfo << "transition state: " << a << std::endl; //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index eeec47e..e4579fb 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -26,11 +26,10 @@ *******************************************************************************/ -#include - #include "Dispatch.hh" #include "Engine.hh" #include "Exception.hh" +#include "Image.hh" #include "Log.hh" #include "Settings.hh" #include "Video.hh" @@ -173,12 +172,8 @@ void Video::setIcon() { if (mAttribs.icon != "") { - SDL_Surface* icon = IMG_Load(mAttribs.icon.c_str()); - if (icon) - { - SDL_WM_SetIcon(icon, 0); - SDL_FreeSurface(icon); - } + Image icon(mAttribs.icon); + icon.setAsIcon(); } } diff --git a/src/Scene.cc b/src/Scene.cc index a45b1fb..43bdf02 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -415,7 +415,7 @@ struct Scene::Impl : public Mf::Library Mf::Vector2 tr = Mf::demote(vertices[height][width]); mLines.push_back(Mf::Line<2>(bl, tr)); - Mf::logDebug("new line"); + Mf::logInfo("new line"); } return 0; diff --git a/src/Tilemap.cc b/src/Tilemap.cc index c45d169..dc3785a 100644 --- a/src/Tilemap.cc +++ b/src/Tilemap.cc @@ -66,7 +66,7 @@ struct Tilemap::Impl : public Mf::Library std::string filePath = Tilemap::getPath(getName()); script.importStandardLibraries(); - importLogPrintFunction(script); + importLogFunctions(script); bindScriptConstants(script); if (script.doFile(filePath) != Mf::Script::SUCCESS) diff --git a/tools/unix2dos b/tools/unix2dos index 31fa7c6..3c171e5 100755 --- a/tools/unix2dos +++ b/tools/unix2dos @@ -9,9 +9,9 @@ then sed 's/\r*$/\r/' "$1" >$TMPFILE if [ ! "$2" ]; then - cp -f "$TMPFILE" "$1" + mv -f "$TMPFILE" "$1" else - cp -f "$TMPFILE" "$2" + mv -f "$TMPFILE" "$2" fi rm -f "$TMPFILE" else diff --git a/win32/mkpackage.sh.in b/win32/mkpackage.sh.in index e6dffa2..d3b28ee 100644 --- a/win32/mkpackage.sh.in +++ b/win32/mkpackage.sh.in @@ -6,458 +6,53 @@ # This was blatantly yoinked and adapted from the Wormux Project. # +# Paths +SCRIPT="$PWD/yoink.nsi" +BUILD_DIR="$PWD/build" +ROOT_DIR="$PWD/.." + # Programs MAKENSIS="@MAKENSIS@" STRIP="@STRIP@" - -# Anchor paths -ROOT_DIR="$PWD/.." - -# Stuff -COMPRESSION="/solid lzma" -DEST="tmp-yoink-win32" -SCRIPT="$DEST/yoink.nsi" -OUT_FILE=${1:-yoinksetup-@VERSION@.exe} +UNIX2DOS="$ROOT_DIR/tools/unix2dos" # DLL dependencies -DLLS="SDL SDL_image zlib1 libpng12-0 OpenAL32 libvorbis-0 libogg-0" -DLLS="$DLLS libvorbisfile-3 lua51" +DLLS="libogg-0 libpng-3 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1" # Prepare -${STRIP:-strip} "$ROOT_DIR/src/yoink.exe" -rm -rf "$DEST" -mkdir -p "$DEST" - - -# -# Set installer definitions and strings. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -HKLM_PATH='SOFTWARE\Games\Yoink' -UNINSTALL_KEY='SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Yoink' -APP_PATHS_KEY='SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\yoink.exe' -START_RUN_KEY='SOFTWARE\Microsoft\Windows\CurrentVersion\Run' - - -PROMPT1="Not enough rights to install, aborting. :-(" -PROMPT2="Unable to uninstall the currently installed version of Yoink. The new version will be installed without removing the currently installed version." - -SEC_INSTALL="Install Yoink!" -SEC_INSTALL_DESC="Installs Yoink to your computer." -SEC_UNINSTALL="Uninstall previous version." -SEC_SHORTCUTS="Install Shortcuts." -SEC_SHORTCUTS_DESC="Install shortcuts at various locations." -SEC_SHORTCUT1="Place a shortcut on the desktop." -SEC_SHORTCUT2="Place a shortcut in the start menu." -SEC_SHORTCUT3="Place an uninstall shortcut in the start menu." - -WEBSITE_LINK="Visit the Yoink website" - - -# -# Begin output of installer script. -#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -cat > "$SCRIPT" <