diff --git a/.hgignore b/.hgignore index b8f24d1..b202373 100644 --- a/.hgignore +++ b/.hgignore @@ -10,3 +10,4 @@ Debug/* *.opensdf *.user *.dll +.DS_Store \ No newline at end of file diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..4c80a93 --- /dev/null +++ b/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.arcade-games + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2016 Raimon Zamora. All rights reserved. + NSPrincipalClass + NSApplication + + diff --git a/aee.xcodeproj/project.pbxproj b/aee.xcodeproj/project.pbxproj new file mode 100644 index 0000000..cd7874b --- /dev/null +++ b/aee.xcodeproj/project.pbxproj @@ -0,0 +1,370 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 02252FB81C764D2E002D1DA1 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02252FB71C764D2E002D1DA1 /* main.cpp */; }; + 02B01D591C767C1700CD186D /* SDL2_image.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02B01D581C767C1700CD186D /* SDL2_image.framework */; }; + 02B01D5B1C767C2C00CD186D /* SDL2_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02B01D5A1C767C2C00CD186D /* SDL2_mixer.framework */; }; + 02EA2BEF1C764B3800E5A247 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02EA2BEE1C764B3800E5A247 /* SDL2.framework */; }; + 02F8247B1C767CE2007AAE83 /* bola.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8245D1C767CE2007AAE83 /* bola.cpp */; }; + 02F8247C1C767CE2007AAE83 /* data.jrf in Resources */ = {isa = PBXBuildFile; fileRef = 02F8245F1C767CE2007AAE83 /* data.jrf */; }; + 02F8247D1C767CE2007AAE83 /* engendro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824601C767CE2007AAE83 /* engendro.cpp */; }; + 02F8247E1C767CE2007AAE83 /* jdraw8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824631C767CE2007AAE83 /* jdraw8.cpp */; }; + 02F8247F1C767CE2007AAE83 /* jfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824651C767CE2007AAE83 /* jfile.cpp */; }; + 02F824801C767CE2007AAE83 /* jgame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824671C767CE2007AAE83 /* jgame.cpp */; }; + 02F824811C767CE2007AAE83 /* jinput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824691C767CE2007AAE83 /* jinput.cpp */; }; + 02F824821C767CE2007AAE83 /* jsound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8246B1C767CE2007AAE83 /* jsound.cpp */; }; + 02F824831C767CE2007AAE83 /* mapa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8246D1C767CE2007AAE83 /* mapa.cpp */; }; + 02F824841C767CE2007AAE83 /* marcador.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F8246F1C767CE2007AAE83 /* marcador.cpp */; }; + 02F824851C767CE2007AAE83 /* modulegame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824711C767CE2007AAE83 /* modulegame.cpp */; }; + 02F824861C767CE2007AAE83 /* modulesequence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824731C767CE2007AAE83 /* modulesequence.cpp */; }; + 02F824871C767CE2007AAE83 /* momia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824751C767CE2007AAE83 /* momia.cpp */; }; + 02F824881C767CE2007AAE83 /* prota.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824771C767CE2007AAE83 /* prota.cpp */; }; + 02F824891C767CE2007AAE83 /* sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 02F824791C767CE2007AAE83 /* sprite.cpp */; }; + 02F8248B1C772310007AAE83 /* gif.c in Sources */ = {isa = PBXBuildFile; fileRef = 02F8248A1C772310007AAE83 /* gif.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 02252FB71C764D2E002D1DA1 /* main.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = main.cpp; sourceTree = ""; }; + 02B01D581C767C1700CD186D /* SDL2_image.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2_image.framework; path = ../../../../../Library/Frameworks/SDL2_image.framework; sourceTree = ""; }; + 02B01D5A1C767C2C00CD186D /* SDL2_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2_mixer.framework; path = ../../../../../Library/Frameworks/SDL2_mixer.framework; sourceTree = ""; }; + 02CF35B91C7649C300180C9F /* aee.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = aee.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 02CF35C71C7649C300180C9F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 02EA2BEE1C764B3800E5A247 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = ../../../../../Library/Frameworks/SDL2.framework; sourceTree = ""; }; + 02F8245D1C767CE2007AAE83 /* bola.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bola.cpp; sourceTree = ""; }; + 02F8245E1C767CE2007AAE83 /* bola.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bola.h; sourceTree = ""; }; + 02F8245F1C767CE2007AAE83 /* data.jrf */ = {isa = PBXFileReference; lastKnownFileType = file; path = data.jrf; sourceTree = ""; }; + 02F824601C767CE2007AAE83 /* engendro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = engendro.cpp; sourceTree = ""; }; + 02F824611C767CE2007AAE83 /* engendro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = engendro.h; sourceTree = ""; }; + 02F824621C767CE2007AAE83 /* info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = info.h; sourceTree = ""; }; + 02F824631C767CE2007AAE83 /* jdraw8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jdraw8.cpp; sourceTree = ""; }; + 02F824641C767CE2007AAE83 /* jdraw8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jdraw8.h; sourceTree = ""; }; + 02F824651C767CE2007AAE83 /* jfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jfile.cpp; sourceTree = ""; }; + 02F824661C767CE2007AAE83 /* jfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jfile.h; sourceTree = ""; }; + 02F824671C767CE2007AAE83 /* jgame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jgame.cpp; sourceTree = ""; }; + 02F824681C767CE2007AAE83 /* jgame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jgame.h; sourceTree = ""; }; + 02F824691C767CE2007AAE83 /* jinput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jinput.cpp; sourceTree = ""; }; + 02F8246A1C767CE2007AAE83 /* jinput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jinput.h; sourceTree = ""; }; + 02F8246B1C767CE2007AAE83 /* jsound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsound.cpp; sourceTree = ""; }; + 02F8246C1C767CE2007AAE83 /* jsound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsound.h; sourceTree = ""; }; + 02F8246D1C767CE2007AAE83 /* mapa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mapa.cpp; sourceTree = ""; }; + 02F8246E1C767CE2007AAE83 /* mapa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mapa.h; sourceTree = ""; }; + 02F8246F1C767CE2007AAE83 /* marcador.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = marcador.cpp; sourceTree = ""; }; + 02F824701C767CE2007AAE83 /* marcador.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = marcador.h; sourceTree = ""; }; + 02F824711C767CE2007AAE83 /* modulegame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = modulegame.cpp; sourceTree = ""; }; + 02F824721C767CE2007AAE83 /* modulegame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modulegame.h; sourceTree = ""; }; + 02F824731C767CE2007AAE83 /* modulesequence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = modulesequence.cpp; sourceTree = ""; }; + 02F824741C767CE2007AAE83 /* modulesequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modulesequence.h; sourceTree = ""; }; + 02F824751C767CE2007AAE83 /* momia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = momia.cpp; sourceTree = ""; }; + 02F824761C767CE2007AAE83 /* momia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = momia.h; sourceTree = ""; }; + 02F824771C767CE2007AAE83 /* prota.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = prota.cpp; sourceTree = ""; }; + 02F824781C767CE2007AAE83 /* prota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prota.h; sourceTree = ""; }; + 02F824791C767CE2007AAE83 /* sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sprite.cpp; sourceTree = ""; }; + 02F8247A1C767CE2007AAE83 /* sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sprite.h; sourceTree = ""; }; + 02F8248A1C772310007AAE83 /* gif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gif.c; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 02CF35B61C7649C300180C9F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 02B01D5B1C767C2C00CD186D /* SDL2_mixer.framework in Frameworks */, + 02B01D591C767C1700CD186D /* SDL2_image.framework in Frameworks */, + 02EA2BEF1C764B3800E5A247 /* SDL2.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 02CF35B01C7649C300180C9F = { + isa = PBXGroup; + children = ( + 02F8248A1C772310007AAE83 /* gif.c */, + 02F8245D1C767CE2007AAE83 /* bola.cpp */, + 02F8245E1C767CE2007AAE83 /* bola.h */, + 02F8245F1C767CE2007AAE83 /* data.jrf */, + 02F824601C767CE2007AAE83 /* engendro.cpp */, + 02F824611C767CE2007AAE83 /* engendro.h */, + 02F824621C767CE2007AAE83 /* info.h */, + 02F824631C767CE2007AAE83 /* jdraw8.cpp */, + 02F824641C767CE2007AAE83 /* jdraw8.h */, + 02F824651C767CE2007AAE83 /* jfile.cpp */, + 02F824661C767CE2007AAE83 /* jfile.h */, + 02F824671C767CE2007AAE83 /* jgame.cpp */, + 02F824681C767CE2007AAE83 /* jgame.h */, + 02F824691C767CE2007AAE83 /* jinput.cpp */, + 02F8246A1C767CE2007AAE83 /* jinput.h */, + 02F8246B1C767CE2007AAE83 /* jsound.cpp */, + 02F8246C1C767CE2007AAE83 /* jsound.h */, + 02252FB71C764D2E002D1DA1 /* main.cpp */, + 02F8246D1C767CE2007AAE83 /* mapa.cpp */, + 02F8246E1C767CE2007AAE83 /* mapa.h */, + 02F8246F1C767CE2007AAE83 /* marcador.cpp */, + 02F824701C767CE2007AAE83 /* marcador.h */, + 02F824711C767CE2007AAE83 /* modulegame.cpp */, + 02F824721C767CE2007AAE83 /* modulegame.h */, + 02F824731C767CE2007AAE83 /* modulesequence.cpp */, + 02F824741C767CE2007AAE83 /* modulesequence.h */, + 02F824751C767CE2007AAE83 /* momia.cpp */, + 02F824761C767CE2007AAE83 /* momia.h */, + 02F824771C767CE2007AAE83 /* prota.cpp */, + 02F824781C767CE2007AAE83 /* prota.h */, + 02F824791C767CE2007AAE83 /* sprite.cpp */, + 02F8247A1C767CE2007AAE83 /* sprite.h */, + 02CF35C71C7649C300180C9F /* Info.plist */, + 02EA2BEE1C764B3800E5A247 /* SDL2.framework */, + 02B01D581C767C1700CD186D /* SDL2_image.framework */, + 02B01D5A1C767C2C00CD186D /* SDL2_mixer.framework */, + 02CF35BA1C7649C300180C9F /* Products */, + ); + sourceTree = ""; + }; + 02CF35BA1C7649C300180C9F /* Products */ = { + isa = PBXGroup; + children = ( + 02CF35B91C7649C300180C9F /* aee.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 02CF35B81C7649C300180C9F /* aee */ = { + isa = PBXNativeTarget; + buildConfigurationList = 02CF35CA1C7649C300180C9F /* Build configuration list for PBXNativeTarget "aee" */; + buildPhases = ( + 02CF35B51C7649C300180C9F /* Sources */, + 02CF35B61C7649C300180C9F /* Frameworks */, + 02CF35B71C7649C300180C9F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = aee; + productName = aee; + productReference = 02CF35B91C7649C300180C9F /* aee.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 02CF35B11C7649C300180C9F /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0720; + ORGANIZATIONNAME = "Raimon Zamora"; + TargetAttributes = { + 02CF35B81C7649C300180C9F = { + CreatedOnToolsVersion = 7.2; + }; + }; + }; + buildConfigurationList = 02CF35B41C7649C300180C9F /* Build configuration list for PBXProject "aee" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 02CF35B01C7649C300180C9F; + productRefGroup = 02CF35BA1C7649C300180C9F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 02CF35B81C7649C300180C9F /* aee */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 02CF35B71C7649C300180C9F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 02F8247C1C767CE2007AAE83 /* data.jrf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 02CF35B51C7649C300180C9F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 02F824841C767CE2007AAE83 /* marcador.cpp in Sources */, + 02F824801C767CE2007AAE83 /* jgame.cpp in Sources */, + 02F824881C767CE2007AAE83 /* prota.cpp in Sources */, + 02F824851C767CE2007AAE83 /* modulegame.cpp in Sources */, + 02252FB81C764D2E002D1DA1 /* main.cpp in Sources */, + 02F824831C767CE2007AAE83 /* mapa.cpp in Sources */, + 02F8247D1C767CE2007AAE83 /* engendro.cpp in Sources */, + 02F824871C767CE2007AAE83 /* momia.cpp in Sources */, + 02F824861C767CE2007AAE83 /* modulesequence.cpp in Sources */, + 02F8247B1C767CE2007AAE83 /* bola.cpp in Sources */, + 02F824811C767CE2007AAE83 /* jinput.cpp in Sources */, + 02F8247E1C767CE2007AAE83 /* jdraw8.cpp in Sources */, + 02F8248B1C772310007AAE83 /* gif.c in Sources */, + 02F824821C767CE2007AAE83 /* jsound.cpp in Sources */, + 02F8247F1C767CE2007AAE83 /* jfile.cpp in Sources */, + 02F824891C767CE2007AAE83 /* sprite.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 02CF35C81C7649C300180C9F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 02CF35C91C7649C300180C9F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 02CF35CB1C7649C300180C9F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(LOCAL_LIBRARY_DIR)/Frameworks/SDL2.framework/headers", + "$(LOCAL_LIBRARY_DIR)/Frameworks/SDL2_image.framework/headers", + "$(LOCAL_LIBRARY_DIR)/Frameworks/SDL2_mixer.framework/headers", + ); + INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = net.jailers.aee; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 02CF35CC1C7649C300180C9F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + HEADER_SEARCH_PATHS = ( + "$(LOCAL_LIBRARY_DIR)/Frameworks/SDL2.framework/headers", + "$(LOCAL_LIBRARY_DIR)/Frameworks/SDL2_image.framework/headers", + "$(LOCAL_LIBRARY_DIR)/Frameworks/SDL2_mixer.framework/headers", + ); + INFOPLIST_FILE = "$(SRCROOT)/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = net.jailers.aee; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 02CF35B41C7649C300180C9F /* Build configuration list for PBXProject "aee" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 02CF35C81C7649C300180C9F /* Debug */, + 02CF35C91C7649C300180C9F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 02CF35CA1C7649C300180C9F /* Build configuration list for PBXNativeTarget "aee" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 02CF35CB1C7649C300180C9F /* Debug */, + 02CF35CC1C7649C300180C9F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 02CF35B11C7649C300180C9F /* Project object */; +} diff --git a/aee.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/aee.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e23a578 --- /dev/null +++ b/aee.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/aee.xcodeproj/project.xcworkspace/xcuserdata/raimonzamora.xcuserdatad/UserInterfaceState.xcuserstate b/aee.xcodeproj/project.xcworkspace/xcuserdata/raimonzamora.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..7fb0dd6 Binary files /dev/null and b/aee.xcodeproj/project.xcworkspace/xcuserdata/raimonzamora.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..71ef2fe --- /dev/null +++ b/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcschemes/aee.xcscheme b/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcschemes/aee.xcscheme new file mode 100644 index 0000000..0937597 --- /dev/null +++ b/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcschemes/aee.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcschemes/xcschememanagement.plist b/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..1141490 --- /dev/null +++ b/aee.xcodeproj/xcuserdata/raimonzamora.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + aee.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 02CF35B81C7649C300180C9F + + primary + + + + + diff --git a/gif.c b/gif.c new file mode 100644 index 0000000..061feae --- /dev/null +++ b/gif.c @@ -0,0 +1,533 @@ +#include +#include +#include +#include + +#define EXTENSION_INTRODUCER 0x21 +#define IMAGE_DESCRIPTOR 0x2C +#define TRAILER 0x3B + +#define GRAPHIC_CONTROL 0xF9 +#define APPLICATION_EXTENSION 0xFF +#define COMMENT_EXTENSION 0xFE +#define PLAINTEXT_EXTENSION 0x01 + +typedef struct +{ + unsigned short width; + unsigned short height; + unsigned char fields; + unsigned char background_color_index; + unsigned char pixel_aspect_ratio; +} +screen_descriptor_t; + +typedef struct +{ + unsigned char r; + unsigned char g; + unsigned char b; +} +rgb; + +typedef struct +{ + unsigned short image_left_position; + unsigned short image_top_position; + unsigned short image_width; + unsigned short image_height; + unsigned char fields; +} +image_descriptor_t; + +typedef struct +{ + unsigned char byte; + int prev; + int len; +} +dictionary_entry_t; + +typedef struct +{ + unsigned char extension_code; + unsigned char block_size; +} +extension_t; + +typedef struct +{ + unsigned char fields; + unsigned short delay_time; + unsigned char transparent_color_index; +} +graphic_control_extension_t; + +typedef struct +{ + unsigned char application_id[ 8 ]; + unsigned char version[ 3 ]; +} +application_extension_t; + +typedef struct +{ + unsigned short left; + unsigned short top; + unsigned short width; + unsigned short height; + unsigned char cell_width; + unsigned char cell_height; + unsigned char foreground_color; + unsigned char background_color; +} +plaintext_extension_t; + +static unsigned short width = 0; +static unsigned short height = 0; +static unsigned char* uncompressed_data = NULL; + +void uncompress( int code_length, + const unsigned char *input, + int input_length, + unsigned char *out ) +{ + //int maxbits; + int i, bit; + int code, prev = -1; + dictionary_entry_t *dictionary; + int dictionary_ind; + unsigned int mask = 0x01; + int reset_code_length; + int clear_code; // This varies depending on code_length + int stop_code; // one more than clear code + int match_len; + + clear_code = 1 << ( code_length ); + stop_code = clear_code + 1; + // To handle clear codes + reset_code_length = code_length; + + // Create a dictionary large enough to hold "code_length" entries. + // Once the dictionary overflows, code_length increases + dictionary = ( dictionary_entry_t * ) + malloc( sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) ); + + // Initialize the first 2^code_len entries of the dictionary with their + // indices. The rest of the entries will be built up dynamically. + + // Technically, it shouldn't be necessary to initialize the + // dictionary. The spec says that the encoder "should output a + // clear code as the first code in the image data stream". It doesn't + // say must, though... + for ( dictionary_ind = 0; + dictionary_ind < ( 1 << code_length ); + dictionary_ind++ ) + { + dictionary[ dictionary_ind ].byte = dictionary_ind; + // XXX this only works because prev is a 32-bit int (> 12 bits) + dictionary[ dictionary_ind ].prev = -1; + dictionary[ dictionary_ind ].len = 1; + } + + // 2^code_len + 1 is the special "end" code; don't give it an entry here + dictionary_ind++; + dictionary_ind++; + + // TODO verify that the very last byte is clear_code + 1 + while ( input_length ) + { + code = 0x0; + // Always read one more bit than the code length + for ( i = 0; i < ( code_length + 1 ); i++ ) + { + // This is different than in the file read example; that + // was a call to "next_bit" + bit = ( *input & mask ) ? 1 : 0; + mask <<= 1; + + if ( mask == 0x100 ) + { + mask = 0x01; + input++; + input_length--; + } + + code = code | ( bit << i ); + } + + if ( code == clear_code ) + { + code_length = reset_code_length; + dictionary = ( dictionary_entry_t * ) realloc( dictionary, + sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) ); + + for ( dictionary_ind = 0; + dictionary_ind < ( 1 << code_length ); + dictionary_ind++ ) + { + dictionary[ dictionary_ind ].byte = dictionary_ind; + // XXX this only works because prev is a 32-bit int (> 12 bits) + dictionary[ dictionary_ind ].prev = -1; + dictionary[ dictionary_ind ].len = 1; + } + dictionary_ind++; + dictionary_ind++; + prev = -1; + continue; + } + else if ( code == stop_code ) + { + if ( input_length > 1 ) + { + fprintf( stderr, "Malformed GIF (early stop code)\n" ); + exit( 0 ); + } + break; + } + + // Update the dictionary with this character plus the _entry_ + // (character or string) that came before it + if ( ( prev > -1 ) && ( code_length < 12 ) ) + { + if ( code > dictionary_ind ) + { + fprintf( stderr, "code = %.02x, but dictionary_ind = %.02x\n", + code, dictionary_ind ); + exit( 0 ); + } + + // Special handling for KwKwK + if ( code == dictionary_ind ) + { + int ptr = prev; + + while ( dictionary[ ptr ].prev != -1 ) + { + ptr = dictionary[ ptr ].prev; + } + dictionary[ dictionary_ind ].byte = dictionary[ ptr ].byte; + } + else + { + int ptr = code; + while ( dictionary[ ptr ].prev != -1 ) + { + ptr = dictionary[ ptr ].prev; + } + dictionary[ dictionary_ind ].byte = dictionary[ ptr ].byte; + } + + dictionary[ dictionary_ind ].prev = prev; + + dictionary[ dictionary_ind ].len = dictionary[ prev ].len + 1; + + dictionary_ind++; + + // GIF89a mandates that this stops at 12 bits + if ( ( dictionary_ind == ( 1 << ( code_length + 1 ) ) ) && + ( code_length < 11 ) ) + { + code_length++; + + dictionary = ( dictionary_entry_t * ) realloc( dictionary, + sizeof( dictionary_entry_t ) * ( 1 << ( code_length + 1 ) ) ); + } + } + + prev = code; + + // Now copy the dictionary entry backwards into "out" + match_len = dictionary[ code ].len; + while ( code != -1 ) + { + out[ dictionary[ code ].len - 1 ] = dictionary[ code ].byte; + if ( dictionary[ code ].prev == code ) + { + fprintf( stderr, "Internal error; self-reference." ); + exit( 0 ); + } + code = dictionary[ code ].prev; + } + + out += match_len; + } +} + +static int read_sub_blocks( FILE* gif_file, unsigned char **data ) +{ + int data_length; + int index; + unsigned char block_size; + + // Everything following are data sub-blocks, until a 0-sized block is + // encountered. + data_length = 0; + *data = NULL; + index = 0; + + while ( 1 ) + { + if ( fread( &block_size, 1, 1, gif_file ) < 1 ) + { + perror( "Invalid GIF file (too short): " ); + return -1; + } + + if ( block_size == 0 ) // end of sub-blocks + { + break; + } + + data_length += block_size; + *data = realloc( *data, data_length ); + + // TODO this could be split across block size boundaries + if ( fread( *data + index, 1, block_size, gif_file ) < + block_size ) + { + perror( "Invalid GIF file (too short): " ); + return -1; + } + + index += block_size; + } + + return data_length; +} + +static int process_image_descriptor( FILE* gif_file, + rgb *gct, + int gct_size, + int resolution_bits ) +{ + image_descriptor_t image_descriptor; + int disposition; + int compressed_data_length; + unsigned char *compressed_data = NULL; + unsigned char lzw_code_size; + int uncompressed_data_length = 0; + //unsigned char *uncompressed_data = NULL; + + // TODO there could actually be lots of these + if ( fread( &image_descriptor, 1, 9, gif_file ) < 9 ) + { + perror( "Invalid GIF file (too short)" ); + disposition = 0; + goto done; + } + + // TODO if LCT = true, read the LCT + + disposition = 1; + + if ( fread( &lzw_code_size, 1, 1, gif_file ) < 1 ) + { + perror( "Invalid GIF file (too short): " ); + disposition = 0; + goto done; + } + + compressed_data_length = read_sub_blocks( gif_file, &compressed_data ); + + width = image_descriptor.image_width; + height = image_descriptor.image_height; + uncompressed_data_length = image_descriptor.image_width * + image_descriptor.image_height; + uncompressed_data = malloc( uncompressed_data_length ); + + uncompress( lzw_code_size, compressed_data, compressed_data_length, + uncompressed_data ); + +done: + if ( compressed_data ) + free( compressed_data ); + + //if ( uncompressed_data ) + // free( uncompressed_data ); + + return disposition; +} + +static int process_extension( FILE* gif_file ) +{ + extension_t extension; + graphic_control_extension_t gce; + application_extension_t application; + plaintext_extension_t plaintext; + unsigned char *extension_data = NULL; + int extension_data_length; + + if ( fread( &extension, 1, 2, gif_file ) < 2 ) + { + perror( "Invalid GIF file (too short): " ); + return 0; + } + + switch ( extension.extension_code ) + { + case GRAPHIC_CONTROL: + if ( fread( &gce, 1, 4, gif_file ) < 4 ) + { + perror( "Invalid GIF file (too short): " ); + return 0; + } + + break; + case APPLICATION_EXTENSION: + if ( fread( &application, 1, 11, gif_file ) < 11 ) + { + perror( "Invalid GIF file (too short): " ); + return 0; + } + break; + case 0xFE: + // comment extension; do nothing - all the data is in the + // sub-blocks that follow. + break; + case 0x01: + if ( fread( &plaintext, 1, 12, gif_file ) < 12 ) + { + perror( "Invalid GIF file (too short): " ); + return 0; + } + break; + default: + fprintf( stderr, "Unrecognized extension code.\n" ); + exit( 0 ); + } + + // All extensions are followed by data sub-blocks; even if it's + // just a single data sub-block of length 0 + extension_data_length = read_sub_blocks( gif_file, &extension_data ); + + if ( extension_data != NULL ) + free( extension_data ); + + return 1; +} + +/** + * @param gif_file the file descriptor of a file containing a + * GIF-encoded file. This should point to the first byte in + * the file when invoked. + */ +static void process_gif_stream( FILE* gif_file ) +{ + unsigned char header[ 7 ]; + screen_descriptor_t screen_descriptor; + int color_resolution_bits; + + int global_color_table_size =0; // number of entries in global_color_table + rgb *global_color_table = NULL; + + unsigned char block_type = 0x0; + + // A GIF file starts with a Header (section 17) + if ( fread( header, 1, 6, gif_file ) != 6 ) + { + perror( "Invalid GIF file (too short)" ); + return; + } + header[ 6 ] = 0x0; + + // XXX there's another format, GIF87a, that you may still find + // floating around. + if ( strcmp( "GIF89a", (char*)header ) ) + { + fprintf( stderr, + "Invalid GIF file (header is '%s', should be 'GIF89a')\n", + header ); + return; + } + + // Followed by a logical screen descriptor + // Note that this works because GIFs specify little-endian order; on a + // big-endian machine, the height & width would need to be reversed. + + // Can't use sizeof here since GCC does byte alignment; + // sizeof( screen_descriptor_t ) = 8! + if ( fread( &screen_descriptor, 1, 7, gif_file ) < 7 ) + { + perror( "Invalid GIF file (too short)" ); + return; + } + + color_resolution_bits = ( ( screen_descriptor.fields & 0x70 ) >> 4 ) + 1; + + if ( screen_descriptor.fields & 0x80 ) + { + //int i; + // If bit 7 is set, the next block is a global color table; read it + global_color_table_size = 1 << + ( ( ( screen_descriptor.fields & 0x07 ) + 1 ) ); + + global_color_table = ( rgb * ) malloc( 3 * global_color_table_size ); + + // XXX this could conceivably return a short count... + if ( fread( global_color_table, 1, 3 * global_color_table_size, gif_file ) < + 3 * global_color_table_size ) + { + perror( "Unable to read global color table" ); + return; + } + } + + while ( block_type != TRAILER ) + { + if ( fread( &block_type, 1, 1, gif_file ) < 1 ) + { + perror( "Invalid GIF file (too short)" ); + return; + } + + switch ( block_type ) + { + case IMAGE_DESCRIPTOR: + if ( !process_image_descriptor( gif_file, + global_color_table, + global_color_table_size, + color_resolution_bits ) ) + { + return; + } + break; + case EXTENSION_INTRODUCER: + if ( !process_extension( gif_file ) ) + { + return; + } + break; + case TRAILER: + break; + default: + fprintf( stderr, "Bailing on unrecognized block type %.02x\n", + block_type ); + return; + } + } +} + + +int main( int argc, char *argv[] ) +{ + FILE* gif_file; + + if ( argc < 2 ) + { + fprintf( stderr, "Usage: %s \n", argv[ 0 ] ); + exit( 0 ); + } + + gif_file = fopen( argv[ 1 ], "rb" ); + + if ( gif_file == NULL ) + { + fprintf( stderr, "Unable to open file '%s'", argv[ 1 ] ); + perror( ": " ); + } + + process_gif_stream( gif_file ); + + fclose( gif_file ); +} diff --git a/jdraw8.cpp b/jdraw8.cpp index 2cca36f..e2ea80f 100755 --- a/jdraw8.cpp +++ b/jdraw8.cpp @@ -19,7 +19,7 @@ SDL_Window* sdlWindow = NULL; SDL_Renderer* sdlRenderer = NULL; SDL_Texture* sdlTexture = NULL; -void JD8_Init(char *title) { +void JD8_Init(const char *title) { screen = (JD8_Surface)calloc( 1, 64000 ); main_palette = (JD8_Palette)calloc( 1, 768 ); pixel_data = (Uint32*)calloc(1, 320 * 200 * 4); // 1048576 ); @@ -50,7 +50,7 @@ JD8_Surface JD8_NewSurface() { return surface; } -JD8_Surface JD8_LoadSurface(char *file) { +JD8_Surface JD8_LoadSurface(const char *file) { int filesize = 0; char *buffer = JF_GetBufferFromResource(file, filesize); @@ -71,7 +71,7 @@ JD8_Surface JD8_LoadSurface(char *file) { return image; } -JD8_Palette JD8_LoadPalette(char *file) { +JD8_Palette JD8_LoadPalette(const char *file) { int filesize = 0; char *buffer = NULL; buffer = JF_GetBufferFromResource(file, filesize); diff --git a/jdraw8.h b/jdraw8.h index 7005a2f..8e83462 100755 --- a/jdraw8.h +++ b/jdraw8.h @@ -10,7 +10,7 @@ struct Color { typedef Uint8* JD8_Surface; typedef Color* JD8_Palette; -void JD8_Init(char *title); +void JD8_Init(const char *title); void JD8_Quit(); @@ -18,9 +18,9 @@ void JD8_ClearScreen(Uint8 color); JD8_Surface JD8_NewSurface(); -JD8_Surface JD8_LoadSurface(char *file); +JD8_Surface JD8_LoadSurface(const char *file); -JD8_Palette JD8_LoadPalette(char *file); +JD8_Palette JD8_LoadPalette(const char *file); void JD8_SetScreenPalette(JD8_Palette palette); diff --git a/jfile.cpp b/jfile.cpp index b3f4c3a..57b7c3f 100755 --- a/jfile.cpp +++ b/jfile.cpp @@ -30,7 +30,7 @@ struct DATA_File { const char *resourceFileName = "data.jrf"; DATA_File *data_file = NULL; -void JF_SetResourceFile(char *p_resourceFileName) { +void JF_SetResourceFile(const char *p_resourceFileName) { resourceFileName = p_resourceFileName; } @@ -56,7 +56,7 @@ void JF_GetDataFile() { fd.close(); } -char *JF_GetBufferFromResource(char *resourcename, int& filesize) { +char *JF_GetBufferFromResource(const char *resourcename, int& filesize) { if( data_file == NULL ) { JF_GetDataFile(); diff --git a/jfile.h b/jfile.h index 3f36d29..57155bc 100755 --- a/jfile.h +++ b/jfile.h @@ -1,7 +1,7 @@ #pragma once -void JF_SetResourceFile(char *p_resourceFileName); +void JF_SetResourceFile(const char *p_resourceFileName); -char *JF_GetBufferFromResource(char *resourcename, int& filesize); +char *JF_GetBufferFromResource(const char *resourcename, int& filesize); void JF_Quit(); \ No newline at end of file diff --git a/jgame.h b/jgame.h index b9c86bf..3dc2944 100755 --- a/jgame.h +++ b/jgame.h @@ -1,16 +1,5 @@ #pragma once #include "SDL.h" - -#ifndef NDEBUG - #ifndef DPRINT(text, ...) - #define DPRINT(text, ...) dprintf(__FILE__, __LINE__, text, __VA_ARGS__) - void dprintf(const char* szFile, long lLine, const char* fmt, ...); - #endif -#else // #ifdef NDEBUG - #ifndef DPRINT(text, ...) - #define DPRINT(text, ...) ((void)0) - #endif -#endif void JG_Init(); diff --git a/main.cpp b/main.cpp index c4b4c01..32391f5 100755 --- a/main.cpp +++ b/main.cpp @@ -18,12 +18,16 @@ int main( int argc, char* args[] ) { #else char res_file[255] = ""; strcpy(res_file, dirname(args[0])); - strcat(res_file, "/data.jrf"); +#ifdef __APPLE__ + strcat(res_file, "/../Resources/data.jrf"); +#else + strcat(res_file, "/data.jrf"); +#endif printf("ARXIU DE RECURSOS: %s\n", res_file); JF_SetResourceFile(res_file); #endif - srand( time(NULL) ); + srand( unsigned(time(NULL)) ); JG_Init(); JD8_Init("Aventures En Egipte"); diff --git a/modulesequence.cpp b/modulesequence.cpp index 4d751b6..0e842a9 100755 --- a/modulesequence.cpp +++ b/modulesequence.cpp @@ -63,6 +63,7 @@ int ModuleSequence::Go() { } } + return 0; } const int minim( const int a, const int b ) { @@ -619,7 +620,7 @@ void ModuleSequence::doMenu() { void ModuleSequence::doSlides() { JG_SetUpdateTicks(20); - char* arxiu; + const char* arxiu; if( this->info->num_piramide == 7 ) { if( this->info->diners < 200 ) { arxiu = "intro2.gif";