Compare commits
6 Commits
7532cac83f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 6474d731d0 | |||
| 83cf446c37 | |||
| d7c965ff0b | |||
| a95c9bd65c | |||
| 8805799f2e | |||
| 7e5318c501 |
19
.gitignore
vendored
@@ -1,21 +1,8 @@
|
||||
syntax: glob
|
||||
|
||||
aee
|
||||
recursos/*
|
||||
bin/*
|
||||
obj/*
|
||||
Debug/*
|
||||
Release/*
|
||||
data/*
|
||||
*.suo
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.user
|
||||
*.dll
|
||||
*.exe
|
||||
.DS_Store
|
||||
trick.ini
|
||||
*.xcuserstate
|
||||
project.xcworkspace/
|
||||
xcuserdata/
|
||||
*.opk
|
||||
.vscode/*
|
||||
data.jrf
|
||||
build/*
|
||||
|
||||
1
.vscode/configurationCache.log
vendored
@@ -1 +0,0 @@
|
||||
{"buildTargets":["all","clean","debug"],"launchTargets":["/Users/raimonzamora/dev/proj/aee>aee()"],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":["/Users/raimonzamora/dev/proj/aee"],"compilerArgs":["-lSDL2","-lSDL2_mixer","-o","aee","-lSDL2","-lSDL2_mixer","-o","aee","-lSDL2","-lSDL2_mixer","-o","aee","-g","-lSDL2","-lSDL2_mixer","-o","aee"],"compilerPath":"/usr/bin/g++","standard":"c++11","windowsSdkVersion":""},"fileIndex":[["/Users/raimonzamora/dev/proj/aee/*.cpp",{"uri":{"$mid":1,"fsPath":"/Users/raimonzamora/dev/proj/aee/*.cpp","path":"/Users/raimonzamora/dev/proj/aee/*.cpp","scheme":"file"},"configuration":{"defines":[],"standard":"c++11","includePath":[],"forcedInclude":[],"intelliSenseMode":"gcc-x64","compilerPath":"/usr/bin/g++","compilerArgs":["-g","-lSDL2","-lSDL2_mixer","-o","aee"],"windowsSdkVersion":""}}]]}}
|
||||
5
.vscode/dryrun.log
vendored
@@ -1,5 +0,0 @@
|
||||
make debug --dry-run --keep-going --print-directory
|
||||
make: Entering directory `/Users/raimonzamora/dev/proj/aee'
|
||||
g++ *.cpp -g -std=c++11 -lSDL2 -lSDL2_mixer -o aee
|
||||
make: Leaving directory `/Users/raimonzamora/dev/proj/aee'
|
||||
|
||||
10
.vscode/settings.json
vendored
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"makefile.extensionOutputFolder": "./.vscode",
|
||||
"makefile.launchConfigurations": [
|
||||
{
|
||||
"cwd": "/Users/raimonzamora/dev/proj/aee",
|
||||
"binaryPath": "/Users/raimonzamora/dev/proj/aee/aee",
|
||||
"binaryArgs": []
|
||||
}
|
||||
]
|
||||
}
|
||||
257
.vscode/targets.log
vendored
@@ -1,257 +0,0 @@
|
||||
make all --print-data-base --no-builtin-variables --no-builtin-rules --question
|
||||
# GNU Make 3.81
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# This is free software; see the source for copying conditions.
|
||||
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# This program built for i386-apple-darwin11.3.0
|
||||
|
||||
|
||||
# Make data base, printed on Wed Sep 1 20:00:35 2021
|
||||
|
||||
|
||||
# Variables
|
||||
|
||||
# automatic
|
||||
<D = $(patsubst %/,%,$(dir $<))
|
||||
# automatic
|
||||
?F = $(notdir $?)
|
||||
# environment
|
||||
ELECTRON_NO_ATTACH_CONSOLE = 1
|
||||
# environment
|
||||
VSCODE_LOG_NATIVE = false
|
||||
# makefile (from `makefile', line 1)
|
||||
TARGET = aee
|
||||
# automatic
|
||||
?D = $(patsubst %/,%,$(dir $?))
|
||||
# automatic
|
||||
@D = $(patsubst %/,%,$(dir $@))
|
||||
# automatic
|
||||
@F = $(notdir $@)
|
||||
# makefile
|
||||
CURDIR := /Users/raimonzamora/dev/proj/aee
|
||||
# makefile
|
||||
SHELL = /bin/sh
|
||||
# environment
|
||||
VSCODE_NLS_CONFIG = {"locale":"es","availableLanguages":{},"_languagePackSupport":true}
|
||||
# environment
|
||||
_ = /usr/bin/make
|
||||
# makefile (from `makefile', line 1)
|
||||
MAKEFILE_LIST := makefile
|
||||
# environment
|
||||
VSCODE_VERBOSE_LOGGING = true
|
||||
# environment
|
||||
__CFBundleIdentifier = com.apple.Terminal
|
||||
# environment
|
||||
VSCODE_IPC_HOOK_EXTHOST = /var/folders/jb/tqpp4m1j50d3gjsyry8hwypm0000gn/T/vscode-ipc-95aab8ae-a614-48ae-9f29-d3d97e7c17ff.sock
|
||||
# environment
|
||||
VSCODE_CWD = /Users/raimonzamora/dev/proj/aee
|
||||
# environment
|
||||
PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/raimonzamora/Library/Python/3.7/bin:/Library/Apple/usr/bin:/usr/local/CrossPack-AVR/bin
|
||||
# environment
|
||||
VSCODE_LOG_STACK = false
|
||||
# environment
|
||||
ELECTRON_RUN_AS_NODE = 1
|
||||
# default
|
||||
.FEATURES := target-specific order-only second-expansion else-if archives jobserver check-symlink
|
||||
# environment
|
||||
SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.PIAYv9VDcK/Listeners
|
||||
# automatic
|
||||
%F = $(notdir $%)
|
||||
# environment
|
||||
VSCODE_PIPE_LOGGING = true
|
||||
# environment
|
||||
PWD = /Users/raimonzamora/dev/proj/aee
|
||||
# environment
|
||||
ORIGINAL_XDG_CURRENT_DESKTOP = undefined
|
||||
# environment
|
||||
VSCODE_AMD_ENTRYPOINT = vs/workbench/services/extensions/node/extensionHostProcess
|
||||
# environment
|
||||
HOME = /Users/raimonzamora
|
||||
# default
|
||||
MAKEFILEPATH = $(shell /usr/bin/xcode-select -print-path 2>/dev/null || echo /Developer)/Makefiles
|
||||
# environment
|
||||
VSCODE_CLI = 1
|
||||
# environment
|
||||
VSCODE_CODE_CACHE_PATH = /Users/raimonzamora/Library/Application Support/Code/CachedData/3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
|
||||
# environment
|
||||
LOGNAME = raimonzamora
|
||||
# environment
|
||||
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = true
|
||||
# environment
|
||||
VSCODE_HANDLES_UNCAUGHT_ERRORS = true
|
||||
# automatic
|
||||
^D = $(patsubst %/,%,$(dir $^))
|
||||
# environment
|
||||
XPC_FLAGS = 0x0
|
||||
# default
|
||||
MAKE = $(MAKE_COMMAND)
|
||||
# default
|
||||
MAKECMDGOALS := all
|
||||
# environment
|
||||
SHLVL = 3
|
||||
# default
|
||||
MAKE_VERSION := 3.81
|
||||
# environment
|
||||
USER = raimonzamora
|
||||
# makefile
|
||||
.DEFAULT_GOAL := all
|
||||
# environment
|
||||
TERM_SESSION_ID = 765A9C16-03F5-46AC-A0BE-B297B910335E
|
||||
# automatic
|
||||
%D = $(patsubst %/,%,$(dir $%))
|
||||
# default
|
||||
MAKE_COMMAND := /Library/Developer/CommandLineTools/usr/bin/make
|
||||
# environment
|
||||
TERM_PROGRAM = Apple_Terminal
|
||||
# default
|
||||
.VARIABLES :=
|
||||
# environment
|
||||
TMPDIR = /var/folders/jb/tqpp4m1j50d3gjsyry8hwypm0000gn/T/
|
||||
# automatic
|
||||
*F = $(notdir $*)
|
||||
# environment
|
||||
VSCODE_IPC_HOOK = /Users/raimonzamora/Library/Application Support/Code/1.59.1-main.sock
|
||||
# makefile
|
||||
MAKEFLAGS = Rrqp
|
||||
# environment
|
||||
MFLAGS = -Rrqp
|
||||
# automatic
|
||||
*D = $(patsubst %/,%,$(dir $*))
|
||||
# environment
|
||||
TERM_PROGRAM_VERSION = 440
|
||||
# environment
|
||||
XPC_SERVICE_NAME = 0
|
||||
# automatic
|
||||
+D = $(patsubst %/,%,$(dir $+))
|
||||
# automatic
|
||||
+F = $(notdir $+)
|
||||
# environment
|
||||
__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x8
|
||||
# environment
|
||||
COMMAND_MODE = unix2003
|
||||
# default
|
||||
MAKEFILES :=
|
||||
# environment
|
||||
VSCODE_BROWSER_CODE_LOADING = bypassHeatCheck
|
||||
# automatic
|
||||
<F = $(notdir $<)
|
||||
# environment
|
||||
LC_ALL = C
|
||||
# automatic
|
||||
^F = $(notdir $^)
|
||||
# default
|
||||
SUFFIXES :=
|
||||
# default
|
||||
.INCLUDE_DIRS = /usr/local/include
|
||||
# environment
|
||||
MAKELEVEL := 0
|
||||
# environment
|
||||
LANG = C
|
||||
# environment
|
||||
TERM = xterm-256color
|
||||
# environment
|
||||
VSCODE_PID = 65860
|
||||
# variable set hash-table stats:
|
||||
# Load=70/1024=7%, Rehash=0, Collisions=1/97=1%
|
||||
|
||||
# Pattern-specific Variable Values
|
||||
|
||||
# No pattern-specific variable values.
|
||||
|
||||
# Directories
|
||||
|
||||
# . (device 16777220, inode 8187547): 48 files, no impossibilities.
|
||||
|
||||
# 48 files, no impossibilities in 1 directories.
|
||||
|
||||
# Implicit Rules
|
||||
|
||||
# No implicit rules.
|
||||
|
||||
# Files
|
||||
|
||||
all:
|
||||
# Command-line target.
|
||||
# Implicit rule search has not been done.
|
||||
# Implicit/static pattern stem: `'
|
||||
# File does not exist.
|
||||
# File has been updated.
|
||||
# Needs to be updated (-q is set).
|
||||
# automatic
|
||||
# @ := all
|
||||
# automatic
|
||||
# % :=
|
||||
# automatic
|
||||
# * :=
|
||||
# automatic
|
||||
# + :=
|
||||
# automatic
|
||||
# | :=
|
||||
# automatic
|
||||
# < :=
|
||||
# automatic
|
||||
# ^ :=
|
||||
# automatic
|
||||
# ? :=
|
||||
# variable set hash-table stats:
|
||||
# Load=8/32=25%, Rehash=0, Collisions=1/11=9%
|
||||
# commands to execute (from `makefile', line 3):
|
||||
g++ *.cpp -std=c++11 -lSDL2 -lSDL2_mixer -o $(TARGET)
|
||||
|
||||
|
||||
# Not a target:
|
||||
.SUFFIXES:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
|
||||
debug:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
# commands to execute (from `makefile', line 6):
|
||||
g++ *.cpp -g -std=c++11 -lSDL2 -lSDL2_mixer -o $(TARGET)
|
||||
|
||||
|
||||
# Not a target:
|
||||
makefile:
|
||||
# Implicit rule search has been done.
|
||||
# Last modified 2021-09-01 20:00:32
|
||||
# File has been updated.
|
||||
# Successfully updated.
|
||||
# variable set hash-table stats:
|
||||
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
|
||||
|
||||
# Not a target:
|
||||
.DEFAULT:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
|
||||
clean:
|
||||
# Implicit rule search has not been done.
|
||||
# Modification time never checked.
|
||||
# File has not been updated.
|
||||
# commands to execute (from `makefile', line 9):
|
||||
rm -rf ./$(TARGET)
|
||||
|
||||
|
||||
# files hash-table stats:
|
||||
# Load=6/1024=1%, Rehash=0, Collisions=0/20=0%
|
||||
# VPATH Search Paths
|
||||
|
||||
# No `vpath' search paths.
|
||||
|
||||
# No general (`VPATH' variable) search path.
|
||||
|
||||
# # of strings in strcache: 1
|
||||
# # of strcache buffers: 1
|
||||
# strcache size: total = 4096 / max = 4096 / min = 4096 / avg = 4096
|
||||
# strcache free: total = 4087 / max = 4087 / min = 4087 / avg = 4087
|
||||
|
||||
|
||||
# Finished Make data base on Wed Sep 1 20:00:35 2021
|
||||
|
||||
|
||||
8
bola.cpp
Executable file → Normal file
@@ -1,8 +1,8 @@
|
||||
#include "bola.h"
|
||||
#include "jgame.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Bola::Bola( JD8_Surface gfx, Info* info, Prota* sam ) : Sprite( gfx ) {
|
||||
this->info = info;
|
||||
Bola::Bola( JD8_Surface gfx, Prota* sam ) : Sprite( gfx ) {
|
||||
this->sam = sam;
|
||||
|
||||
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
|
||||
@@ -57,8 +57,8 @@ void Bola::update() {
|
||||
// Comprovem si ha tocat a Sam
|
||||
if( this->x > ( this->sam->x - 7 ) && this->x < ( this->sam->x + 7 ) && this->y > ( this->sam->y - 7 ) && this->y < ( this->sam->y + 7 ) ) {
|
||||
this->contador = 200;
|
||||
this->info->vida--;
|
||||
if( this->info->vida == 0 ) this->sam->o = 5;
|
||||
info::vida--;
|
||||
if( info::vida == 0 ) this->sam->o = 5;
|
||||
}
|
||||
} else {
|
||||
this->contador--;
|
||||
|
||||
3
bola.h
Executable file → Normal file
@@ -8,7 +8,7 @@ class Bola : public Sprite {
|
||||
|
||||
public:
|
||||
|
||||
Bola( JD8_Surface gfx, Info* info, Prota* sam );
|
||||
Bola( JD8_Surface gfx, Prota* sam );
|
||||
|
||||
void draw();
|
||||
void update();
|
||||
@@ -18,6 +18,5 @@ protected:
|
||||
|
||||
Uint8 contador;
|
||||
Prota* sam;
|
||||
Info* info;
|
||||
|
||||
};
|
||||
|
||||
BIN
data/00000001.ogg
Normal file
BIN
data/00000002.ogg
Normal file
BIN
data/00000003.ogg
Normal file
BIN
data/00000004.ogg
Normal file
BIN
data/00000005.ogg
Normal file
BIN
data/00000006.ogg
Normal file
BIN
data/00000007.ogg
Normal file
BIN
data/00000008.ogg
Normal file
234
data/crtpi.glsl
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
crt-pi - A Raspberry Pi friendly CRT shader.
|
||||
|
||||
Copyright (C) 2015-2016 davej
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
This shader is designed to work well on Raspberry Pi GPUs (i.e. 1080P @ 60Hz on a game with a 4:3 aspect ratio). It pushes the Pi's GPU hard and enabling some features will slow it down so that it is no longer able to match 1080P @ 60Hz. You will need to overclock your Pi to the fastest setting in raspi-config to get the best results from this shader: 'Pi2' for Pi2 and 'Turbo' for original Pi and Pi Zero. Note: Pi2s are slower at running the shader than other Pis, this seems to be down to Pi2s lower maximum memory speed. Pi2s don't quite manage 1080P @ 60Hz - they drop about 1 in 1000 frames. You probably won't notice this, but if you do, try enabling FAKE_GAMMA.
|
||||
|
||||
SCANLINES enables scanlines. You'll almost certainly want to use it with MULTISAMPLE to reduce moire effects. SCANLINE_WEIGHT defines how wide scanlines are (it is an inverse value so a higher number = thinner lines). SCANLINE_GAP_BRIGHTNESS defines how dark the gaps between the scan lines are. Darker gaps between scan lines make moire effects more likely.
|
||||
|
||||
GAMMA enables gamma correction using the values in INPUT_GAMMA and OUTPUT_GAMMA. FAKE_GAMMA causes it to ignore the values in INPUT_GAMMA and OUTPUT_GAMMA and approximate gamma correction in a way which is faster than true gamma whilst still looking better than having none. You must have GAMMA defined to enable FAKE_GAMMA.
|
||||
|
||||
CURVATURE distorts the screen by CURVATURE_X and CURVATURE_Y. Curvature slows things down a lot.
|
||||
|
||||
By default the shader uses linear blending horizontally. If you find this too blury, enable SHARPER.
|
||||
|
||||
BLOOM_FACTOR controls the increase in width for bright scanlines.
|
||||
|
||||
MASK_TYPE defines what, if any, shadow mask to use. MASK_BRIGHTNESS defines how much the mask type darkens the screen.
|
||||
|
||||
*/
|
||||
|
||||
#pragma parameter CURVATURE_X "Screen curvature - horizontal" 0.10 0.0 1.0 0.01
|
||||
#pragma parameter CURVATURE_Y "Screen curvature - vertical" 0.15 0.0 1.0 0.01
|
||||
#pragma parameter MASK_BRIGHTNESS "Mask brightness" 0.70 0.0 1.0 0.01
|
||||
#pragma parameter SCANLINE_WEIGHT "Scanline weight" 6.0 0.0 15.0 0.1
|
||||
#pragma parameter SCANLINE_GAP_BRIGHTNESS "Scanline gap brightness" 0.12 0.0 1.0 0.01
|
||||
#pragma parameter BLOOM_FACTOR "Bloom factor" 1.5 0.0 5.0 0.01
|
||||
#pragma parameter INPUT_GAMMA "Input gamma" 2.4 0.0 5.0 0.01
|
||||
#pragma parameter OUTPUT_GAMMA "Output gamma" 2.2 0.0 5.0 0.01
|
||||
|
||||
// Haven't put these as parameters as it would slow the code down.
|
||||
#define SCANLINES
|
||||
#define MULTISAMPLE
|
||||
#define GAMMA
|
||||
//#define FAKE_GAMMA
|
||||
#define CURVATURE
|
||||
//#define SHARPER
|
||||
// MASK_TYPE: 0 = none, 1 = green/magenta, 2 = trinitron(ish)
|
||||
#define MASK_TYPE 1
|
||||
|
||||
|
||||
#ifdef GL_ES
|
||||
#define COMPAT_PRECISION mediump
|
||||
precision mediump float;
|
||||
#else
|
||||
#define COMPAT_PRECISION
|
||||
#endif
|
||||
|
||||
#ifdef PARAMETER_UNIFORM
|
||||
uniform COMPAT_PRECISION float CURVATURE_X;
|
||||
uniform COMPAT_PRECISION float CURVATURE_Y;
|
||||
uniform COMPAT_PRECISION float MASK_BRIGHTNESS;
|
||||
uniform COMPAT_PRECISION float SCANLINE_WEIGHT;
|
||||
uniform COMPAT_PRECISION float SCANLINE_GAP_BRIGHTNESS;
|
||||
uniform COMPAT_PRECISION float BLOOM_FACTOR;
|
||||
uniform COMPAT_PRECISION float INPUT_GAMMA;
|
||||
uniform COMPAT_PRECISION float OUTPUT_GAMMA;
|
||||
#else
|
||||
#define CURVATURE_X 0.25
|
||||
#define CURVATURE_Y 0.45
|
||||
#define MASK_BRIGHTNESS 0.70
|
||||
#define SCANLINE_WEIGHT 6.0
|
||||
#define SCANLINE_GAP_BRIGHTNESS 0.12
|
||||
#define BLOOM_FACTOR 1.5
|
||||
#define INPUT_GAMMA 2.4
|
||||
#define OUTPUT_GAMMA 2.2
|
||||
#endif
|
||||
|
||||
/* COMPATIBILITY
|
||||
- GLSL compilers
|
||||
*/
|
||||
|
||||
//uniform vec2 TextureSize;
|
||||
#if defined(CURVATURE)
|
||||
varying vec2 screenScale;
|
||||
#endif
|
||||
varying vec2 TEX0;
|
||||
varying float filterWidth;
|
||||
|
||||
#if defined(VERTEX)
|
||||
//uniform mat4 MVPMatrix;
|
||||
//attribute vec4 VertexCoord;
|
||||
//attribute vec2 TexCoord;
|
||||
//uniform vec2 InputSize;
|
||||
//uniform vec2 OutputSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
#if defined(CURVATURE)
|
||||
screenScale = vec2(1.0, 1.0); //TextureSize / InputSize;
|
||||
#endif
|
||||
filterWidth = (768.0 / 240.0) / 3.0;
|
||||
TEX0 = vec2(gl_MultiTexCoord0.x, 1.0-gl_MultiTexCoord0.y)*1.0001;
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
}
|
||||
#elif defined(FRAGMENT)
|
||||
|
||||
uniform sampler2D Texture;
|
||||
|
||||
#if defined(CURVATURE)
|
||||
vec2 Distort(vec2 coord)
|
||||
{
|
||||
vec2 CURVATURE_DISTORTION = vec2(CURVATURE_X, CURVATURE_Y);
|
||||
// Barrel distortion shrinks the display area a bit, this will allow us to counteract that.
|
||||
vec2 barrelScale = 1.0 - (0.23 * CURVATURE_DISTORTION);
|
||||
coord *= screenScale;
|
||||
coord -= vec2(0.5);
|
||||
float rsq = coord.x * coord.x + coord.y * coord.y;
|
||||
coord += coord * (CURVATURE_DISTORTION * rsq);
|
||||
coord *= barrelScale;
|
||||
if (abs(coord.x) >= 0.5 || abs(coord.y) >= 0.5)
|
||||
coord = vec2(-1.0); // If out of bounds, return an invalid value.
|
||||
else
|
||||
{
|
||||
coord += vec2(0.5);
|
||||
coord /= screenScale;
|
||||
}
|
||||
|
||||
return coord;
|
||||
}
|
||||
#endif
|
||||
|
||||
float CalcScanLineWeight(float dist)
|
||||
{
|
||||
return max(1.0-dist*dist*SCANLINE_WEIGHT, SCANLINE_GAP_BRIGHTNESS);
|
||||
}
|
||||
|
||||
float CalcScanLine(float dy)
|
||||
{
|
||||
float scanLineWeight = CalcScanLineWeight(dy);
|
||||
#if defined(MULTISAMPLE)
|
||||
scanLineWeight += CalcScanLineWeight(dy-filterWidth);
|
||||
scanLineWeight += CalcScanLineWeight(dy+filterWidth);
|
||||
scanLineWeight *= 0.3333333;
|
||||
#endif
|
||||
return scanLineWeight;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 TextureSize = vec2(320.0, 240.0);
|
||||
#if defined(CURVATURE)
|
||||
vec2 texcoord = Distort(TEX0);
|
||||
if (texcoord.x < 0.0)
|
||||
gl_FragColor = vec4(0.0);
|
||||
else
|
||||
#else
|
||||
vec2 texcoord = TEX0;
|
||||
#endif
|
||||
{
|
||||
vec2 texcoordInPixels = texcoord * TextureSize;
|
||||
#if defined(SHARPER)
|
||||
vec2 tempCoord = floor(texcoordInPixels) + 0.5;
|
||||
vec2 coord = tempCoord / TextureSize;
|
||||
vec2 deltas = texcoordInPixels - tempCoord;
|
||||
float scanLineWeight = CalcScanLine(deltas.y);
|
||||
vec2 signs = sign(deltas);
|
||||
deltas.x *= 2.0;
|
||||
deltas = deltas * deltas;
|
||||
deltas.y = deltas.y * deltas.y;
|
||||
deltas.x *= 0.5;
|
||||
deltas.y *= 8.0;
|
||||
deltas /= TextureSize;
|
||||
deltas *= signs;
|
||||
vec2 tc = coord + deltas;
|
||||
#else
|
||||
float tempY = floor(texcoordInPixels.y) + 0.5;
|
||||
float yCoord = tempY / TextureSize.y;
|
||||
float dy = texcoordInPixels.y - tempY;
|
||||
float scanLineWeight = CalcScanLine(dy);
|
||||
float signY = sign(dy);
|
||||
dy = dy * dy;
|
||||
dy = dy * dy;
|
||||
dy *= 8.0;
|
||||
dy /= TextureSize.y;
|
||||
dy *= signY;
|
||||
vec2 tc = vec2(texcoord.x, yCoord + dy);
|
||||
#endif
|
||||
|
||||
vec3 colour = texture2D(Texture, tc).rgb;
|
||||
|
||||
#if defined(SCANLINES)
|
||||
#if defined(GAMMA)
|
||||
#if defined(FAKE_GAMMA)
|
||||
colour = colour * colour;
|
||||
#else
|
||||
colour = pow(colour, vec3(INPUT_GAMMA));
|
||||
#endif
|
||||
#endif
|
||||
scanLineWeight *= BLOOM_FACTOR;
|
||||
colour *= scanLineWeight;
|
||||
|
||||
#if defined(GAMMA)
|
||||
#if defined(FAKE_GAMMA)
|
||||
colour = sqrt(colour);
|
||||
#else
|
||||
colour = pow(colour, vec3(1.0/OUTPUT_GAMMA));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if MASK_TYPE == 0
|
||||
gl_FragColor = vec4(colour, 1.0);
|
||||
#else
|
||||
#if MASK_TYPE == 1
|
||||
float whichMask = fract((gl_FragCoord.x*1.0001) * 0.5);
|
||||
vec3 mask;
|
||||
if (whichMask < 0.5)
|
||||
mask = vec3(MASK_BRIGHTNESS, 1.0, MASK_BRIGHTNESS);
|
||||
else
|
||||
mask = vec3(1.0, MASK_BRIGHTNESS, 1.0);
|
||||
#elif MASK_TYPE == 2
|
||||
float whichMask = fract((gl_FragCoord.x*1.0001) * 0.3333333);
|
||||
vec3 mask = vec3(MASK_BRIGHTNESS, MASK_BRIGHTNESS, MASK_BRIGHTNESS);
|
||||
if (whichMask < 0.3333333)
|
||||
mask.x = 1.0;
|
||||
else if (whichMask < 0.6666666)
|
||||
mask.y = 1.0;
|
||||
else
|
||||
mask.z = 1.0;
|
||||
#endif
|
||||
|
||||
gl_FragColor = vec4(colour * mask, 1.0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
BIN
data/ffase.gif
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/final.gif
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
data/finals.gif
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
data/frames.gif
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
data/frames2.gif
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
data/gameover.gif
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
data/intro.gif
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
data/intro2.gif
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
data/intro3.gif
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
data/logo.gif
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
data/menu.gif
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
data/menu2.gif
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
data/tomba1.gif
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
data/tomba2.gif
Normal file
|
After Width: | Height: | Size: 15 KiB |
@@ -1,10 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=AEE
|
||||
Comment=Aventures En Egipte
|
||||
Icon=icon
|
||||
Exec=aee
|
||||
Categories=games;Game;SDL;
|
||||
Terminal=false
|
||||
|
||||
1
engendro.cpp
Executable file → Normal file
@@ -1,5 +1,6 @@
|
||||
#include "engendro.h"
|
||||
#include "jgame.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Engendro::Engendro( JD8_Surface gfx, Uint16 x, Uint16 y ) : Sprite( gfx ) {
|
||||
|
||||
|
||||
0
engendro.h
Executable file → Normal file
14
info.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "info.h"
|
||||
|
||||
namespace info
|
||||
{
|
||||
int num_piramide;
|
||||
int num_habitacio;
|
||||
int diners;
|
||||
int diamants;
|
||||
int vida;
|
||||
int momies;
|
||||
int engendros;
|
||||
bool nou_personatge;
|
||||
bool pepe_activat;
|
||||
};
|
||||
21
info.h
Executable file → Normal file
@@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
struct Info {
|
||||
int num_piramide;
|
||||
int num_habitacio;
|
||||
int diners;
|
||||
int diamants;
|
||||
int vida;
|
||||
int momies;
|
||||
int engendros;
|
||||
bool nou_personatge;
|
||||
bool pepe_activat;
|
||||
namespace info
|
||||
{
|
||||
extern int num_piramide;
|
||||
extern int num_habitacio;
|
||||
extern int diners;
|
||||
extern int diamants;
|
||||
extern int vida;
|
||||
extern int momies;
|
||||
extern int engendros;
|
||||
extern bool nou_personatge;
|
||||
extern bool pepe_activat;
|
||||
};
|
||||
|
||||
509
jail_audio.cpp
Normal file
@@ -0,0 +1,509 @@
|
||||
#ifndef JA_USESDLMIXER
|
||||
#include "jail_audio.h"
|
||||
#include "stb_vorbis.h"
|
||||
#include <SDL3/SDL.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define JA_MAX_SIMULTANEOUS_CHANNELS 5
|
||||
|
||||
struct JA_Sound_t
|
||||
{
|
||||
SDL_AudioSpec spec { SDL_AUDIO_S16, 2, 48000 };
|
||||
Uint32 length { 0 };
|
||||
Uint8 *buffer { NULL };
|
||||
};
|
||||
|
||||
struct JA_Channel_t
|
||||
{
|
||||
JA_Sound_t *sound { nullptr };
|
||||
int pos { 0 };
|
||||
int times { 0 };
|
||||
SDL_AudioStream *stream { nullptr };
|
||||
JA_Channel_state state { JA_CHANNEL_FREE };
|
||||
};
|
||||
|
||||
struct JA_Music_t
|
||||
{
|
||||
SDL_AudioSpec spec { SDL_AUDIO_S16, 2, 48000 };
|
||||
Uint32 length { 0 };
|
||||
Uint8 *buffer { nullptr };
|
||||
char *filename { nullptr };
|
||||
|
||||
int pos { 0 };
|
||||
int times { 0 };
|
||||
SDL_AudioStream *stream { nullptr };
|
||||
JA_Music_state state { JA_MUSIC_INVALID };
|
||||
};
|
||||
|
||||
JA_Music_t *current_music { nullptr };
|
||||
JA_Channel_t channels[JA_MAX_SIMULTANEOUS_CHANNELS];
|
||||
|
||||
SDL_AudioSpec JA_audioSpec { SDL_AUDIO_S16, 2, 48000 };
|
||||
float JA_musicVolume { 1.0f };
|
||||
float JA_soundVolume { 0.5f };
|
||||
bool JA_musicEnabled { true };
|
||||
bool JA_soundEnabled { true };
|
||||
SDL_AudioDeviceID sdlAudioDevice { 0 };
|
||||
SDL_TimerID JA_timerID { 0 };
|
||||
|
||||
bool fading = false;
|
||||
int fade_start_time;
|
||||
int fade_duration;
|
||||
int fade_initial_volume;
|
||||
|
||||
/*
|
||||
void audioCallback(void * userdata, uint8_t * stream, int len) {
|
||||
SDL_memset(stream, 0, len);
|
||||
if (current_music != NULL && current_music->state == JA_MUSIC_PLAYING) {
|
||||
const int size = SDL_min(len, current_music->samples*2-current_music->pos);
|
||||
SDL_MixAudioFormat(stream, (Uint8*)(current_music->output+current_music->pos), AUDIO_S16, size, JA_musicVolume);
|
||||
current_music->pos += size/2;
|
||||
if (size < len) {
|
||||
if (current_music->times != 0) {
|
||||
SDL_MixAudioFormat(stream+size, (Uint8*)current_music->output, AUDIO_S16, len-size, JA_musicVolume);
|
||||
current_music->pos = (len-size)/2;
|
||||
if (current_music->times > 0) current_music->times--;
|
||||
} else {
|
||||
current_music->pos = 0;
|
||||
current_music->state = JA_MUSIC_STOPPED;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Mixar els channels mi amol
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
|
||||
if (channels[i].state == JA_CHANNEL_PLAYING) {
|
||||
const int size = SDL_min(len, channels[i].sound->length - channels[i].pos);
|
||||
SDL_MixAudioFormat(stream, channels[i].sound->buffer + channels[i].pos, AUDIO_S16, size, JA_soundVolume);
|
||||
channels[i].pos += size;
|
||||
if (size < len) {
|
||||
if (channels[i].times != 0) {
|
||||
SDL_MixAudioFormat(stream + size, channels[i].sound->buffer, AUDIO_S16, len-size, JA_soundVolume);
|
||||
channels[i].pos = len-size;
|
||||
if (channels[i].times > 0) channels[i].times--;
|
||||
} else {
|
||||
JA_StopChannel(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Uint32 JA_UpdateCallback(void *userdata, SDL_TimerID timerID, Uint32 interval)
|
||||
{
|
||||
if (JA_musicEnabled && current_music && current_music->state == JA_MUSIC_PLAYING)
|
||||
{
|
||||
if (fading) {
|
||||
int time = SDL_GetTicks();
|
||||
if (time > (fade_start_time+fade_duration)) {
|
||||
fading = false;
|
||||
JA_StopMusic();
|
||||
return 30;
|
||||
} else {
|
||||
const int time_passed = time - fade_start_time;
|
||||
const float percent = (float)time_passed / (float)fade_duration;
|
||||
SDL_SetAudioStreamGain(current_music->stream, JA_musicVolume*(1.0 - percent));
|
||||
}
|
||||
}
|
||||
|
||||
if (current_music->times != 0)
|
||||
{
|
||||
if (SDL_GetAudioStreamAvailable(current_music->stream) < int(current_music->length/2)) {
|
||||
SDL_PutAudioStreamData(current_music->stream, current_music->buffer, current_music->length);
|
||||
}
|
||||
if (current_music->times>0) current_music->times--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SDL_GetAudioStreamAvailable(current_music->stream) == 0) JA_StopMusic();
|
||||
}
|
||||
}
|
||||
|
||||
if (JA_soundEnabled)
|
||||
{
|
||||
for (int i=0; i < JA_MAX_SIMULTANEOUS_CHANNELS; ++i)
|
||||
if (channels[i].state == JA_CHANNEL_PLAYING)
|
||||
{
|
||||
if (channels[i].times != 0)
|
||||
{
|
||||
if (SDL_GetAudioStreamAvailable(channels[i].stream) < int(channels[i].sound->length/2)) {
|
||||
SDL_PutAudioStreamData(channels[i].stream, channels[i].sound->buffer, channels[i].sound->length);
|
||||
if (channels[i].times>0) channels[i].times--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SDL_GetAudioStreamAvailable(channels[i].stream) == 0) JA_StopChannel(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 30;
|
||||
}
|
||||
|
||||
void JA_Init(const int freq, const SDL_AudioFormat format, const int num_channels)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
|
||||
#endif
|
||||
|
||||
SDL_Log("Iniciant JailAudio...");
|
||||
JA_audioSpec = {format, num_channels, freq };
|
||||
if (!sdlAudioDevice) SDL_CloseAudioDevice(sdlAudioDevice);
|
||||
sdlAudioDevice = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &JA_audioSpec);
|
||||
SDL_Log( (sdlAudioDevice==0) ? "Failed to initialize SDL audio!\n" : "OK!\n");
|
||||
for (int i=0;i<JA_MAX_SIMULTANEOUS_CHANNELS;++i) channels[i].state = JA_CHANNEL_FREE;
|
||||
//SDL_PauseAudioDevice(sdlAudioDevice);
|
||||
JA_timerID = SDL_AddTimer(30, JA_UpdateCallback, nullptr);
|
||||
}
|
||||
|
||||
void JA_Quit()
|
||||
{
|
||||
if (JA_timerID) SDL_RemoveTimer(JA_timerID);
|
||||
|
||||
if (!sdlAudioDevice) SDL_CloseAudioDevice(sdlAudioDevice);
|
||||
sdlAudioDevice = 0;
|
||||
}
|
||||
|
||||
JA_Music_t *JA_LoadMusic(Uint8* buffer, Uint32 length, const char* filename)
|
||||
{
|
||||
JA_Music_t *music = new JA_Music_t();
|
||||
|
||||
int chan, samplerate;
|
||||
short *output;
|
||||
music->length = stb_vorbis_decode_memory(buffer, length, &chan, &samplerate, &output) * chan * 2;
|
||||
|
||||
music->spec.channels = chan;
|
||||
music->spec.freq = samplerate;
|
||||
music->spec.format = SDL_AUDIO_S16;
|
||||
music->buffer = (Uint8*)SDL_malloc(music->length);
|
||||
SDL_memcpy(music->buffer, output, music->length);
|
||||
free(output);
|
||||
music->pos = 0;
|
||||
music->state = JA_MUSIC_STOPPED;
|
||||
if (filename) {
|
||||
music->filename = (char*)malloc(strlen(filename)+1);
|
||||
strcpy(music->filename, filename);
|
||||
}
|
||||
|
||||
return music;
|
||||
}
|
||||
|
||||
JA_Music_t *JA_LoadMusic(const char* filename)
|
||||
{
|
||||
// [RZC 28/08/22] Carreguem primer el arxiu en memòria i després el descomprimim. Es algo més rapid.
|
||||
FILE *f = fopen(filename, "rb");
|
||||
fseek(f, 0, SEEK_END);
|
||||
long fsize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
Uint8 *buffer = (Uint8*)malloc(fsize + 1);
|
||||
if (fread(buffer, fsize, 1, f)!=1) return NULL;
|
||||
fclose(f);
|
||||
|
||||
JA_Music_t *music = JA_LoadMusic(buffer, fsize, filename);
|
||||
|
||||
free(buffer);
|
||||
|
||||
return music;
|
||||
}
|
||||
|
||||
void JA_PlayMusic(JA_Music_t *music, const int loop)
|
||||
{
|
||||
if (!JA_musicEnabled) return;
|
||||
|
||||
JA_StopMusic();
|
||||
|
||||
current_music = music;
|
||||
current_music->pos = 0;
|
||||
current_music->state = JA_MUSIC_PLAYING;
|
||||
current_music->times = loop;
|
||||
|
||||
current_music->stream = SDL_CreateAudioStream(¤t_music->spec, &JA_audioSpec);
|
||||
if (!SDL_PutAudioStreamData(current_music->stream, current_music->buffer, current_music->length)) printf("[ERROR] SDL_PutAudioStreamData failed!\n");
|
||||
SDL_SetAudioStreamGain(current_music->stream, JA_musicVolume);
|
||||
if (!SDL_BindAudioStream(sdlAudioDevice, current_music->stream)) printf("[ERROR] SDL_BindAudioStream failed!\n");
|
||||
//SDL_ResumeAudioStreamDevice(current_music->stream);
|
||||
}
|
||||
|
||||
char *JA_GetMusicFilename(JA_Music_t *music)
|
||||
{
|
||||
if (!music) music = current_music;
|
||||
return music->filename;
|
||||
}
|
||||
|
||||
void JA_PauseMusic()
|
||||
{
|
||||
if (!JA_musicEnabled) return;
|
||||
if (!current_music || current_music->state == JA_MUSIC_INVALID) return;
|
||||
|
||||
current_music->state = JA_MUSIC_PAUSED;
|
||||
//SDL_PauseAudioStreamDevice(current_music->stream);
|
||||
SDL_UnbindAudioStream(current_music->stream);
|
||||
}
|
||||
|
||||
void JA_ResumeMusic()
|
||||
{
|
||||
if (!JA_musicEnabled) return;
|
||||
if (!current_music || current_music->state == JA_MUSIC_INVALID) return;
|
||||
|
||||
current_music->state = JA_MUSIC_PLAYING;
|
||||
//SDL_ResumeAudioStreamDevice(current_music->stream);
|
||||
SDL_BindAudioStream(sdlAudioDevice, current_music->stream);
|
||||
}
|
||||
|
||||
void JA_StopMusic()
|
||||
{
|
||||
if (!JA_musicEnabled) return;
|
||||
if (!current_music || current_music->state == JA_MUSIC_INVALID) return;
|
||||
|
||||
current_music->pos = 0;
|
||||
current_music->state = JA_MUSIC_STOPPED;
|
||||
//SDL_PauseAudioStreamDevice(current_music->stream);
|
||||
SDL_DestroyAudioStream(current_music->stream);
|
||||
current_music->stream = nullptr;
|
||||
free(current_music->filename);
|
||||
current_music->filename = nullptr;
|
||||
}
|
||||
|
||||
void JA_FadeOutMusic(const int milliseconds)
|
||||
{
|
||||
if (!JA_musicEnabled) return;
|
||||
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
|
||||
|
||||
fading = true;
|
||||
fade_start_time = SDL_GetTicks();
|
||||
fade_duration = milliseconds;
|
||||
fade_initial_volume = JA_musicVolume;
|
||||
}
|
||||
|
||||
JA_Music_state JA_GetMusicState()
|
||||
{
|
||||
if (!JA_musicEnabled) return JA_MUSIC_DISABLED;
|
||||
if (!current_music) return JA_MUSIC_INVALID;
|
||||
|
||||
return current_music->state;
|
||||
}
|
||||
|
||||
void JA_DeleteMusic(JA_Music_t *music)
|
||||
{
|
||||
if (current_music == music) current_music = nullptr;
|
||||
SDL_free(music->buffer);
|
||||
if (music->stream) SDL_DestroyAudioStream(music->stream);
|
||||
delete music;
|
||||
}
|
||||
|
||||
float JA_SetMusicVolume(float volume)
|
||||
{
|
||||
JA_musicVolume = SDL_clamp( volume, 0.0f, 1.0f );
|
||||
if (current_music) SDL_SetAudioStreamGain(current_music->stream, JA_musicVolume);
|
||||
return JA_musicVolume;
|
||||
}
|
||||
|
||||
void JA_SetMusicPosition(float value)
|
||||
{
|
||||
if (!current_music) return;
|
||||
current_music->pos = value * current_music->spec.freq;
|
||||
}
|
||||
|
||||
float JA_GetMusicPosition()
|
||||
{
|
||||
if (!current_music) return 0;
|
||||
return float(current_music->pos)/float(current_music->spec.freq);
|
||||
}
|
||||
|
||||
void JA_EnableMusic(const bool value)
|
||||
{
|
||||
if ( !value && current_music && (current_music->state==JA_MUSIC_PLAYING) ) JA_StopMusic();
|
||||
|
||||
JA_musicEnabled = value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length)
|
||||
{
|
||||
JA_Sound_t *sound = new JA_Sound_t();
|
||||
sound->buffer = buffer;
|
||||
sound->length = length;
|
||||
return sound;
|
||||
}
|
||||
|
||||
JA_Sound_t *JA_LoadSound(uint8_t* buffer, uint32_t size)
|
||||
{
|
||||
JA_Sound_t *sound = new JA_Sound_t();
|
||||
SDL_LoadWAV_IO(SDL_IOFromMem(buffer, size),1, &sound->spec, &sound->buffer, &sound->length);
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
JA_Sound_t *JA_LoadSound(const char* filename)
|
||||
{
|
||||
JA_Sound_t *sound = new JA_Sound_t();
|
||||
SDL_LoadWAV(filename, &sound->spec, &sound->buffer, &sound->length);
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
int JA_PlaySound(JA_Sound_t *sound, const int loop)
|
||||
{
|
||||
if (!JA_soundEnabled) return -1;
|
||||
|
||||
int channel = 0;
|
||||
while (channel < JA_MAX_SIMULTANEOUS_CHANNELS && channels[channel].state != JA_CHANNEL_FREE) { channel++; }
|
||||
if (channel == JA_MAX_SIMULTANEOUS_CHANNELS) channel = 0;
|
||||
JA_StopChannel(channel);
|
||||
|
||||
channels[channel].sound = sound;
|
||||
channels[channel].times = loop;
|
||||
channels[channel].pos = 0;
|
||||
channels[channel].state = JA_CHANNEL_PLAYING;
|
||||
channels[channel].stream = SDL_CreateAudioStream(&channels[channel].sound->spec, &JA_audioSpec);
|
||||
SDL_PutAudioStreamData(channels[channel].stream, channels[channel].sound->buffer, channels[channel].sound->length);
|
||||
SDL_SetAudioStreamGain(channels[channel].stream, JA_soundVolume);
|
||||
SDL_BindAudioStream(sdlAudioDevice, channels[channel].stream);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
int JA_PlaySoundOnChannel(JA_Sound_t *sound, const int channel, const int loop)
|
||||
{
|
||||
if (!JA_soundEnabled) return -1;
|
||||
|
||||
if (channel < 0 || channel >= JA_MAX_SIMULTANEOUS_CHANNELS) return -1;
|
||||
JA_StopChannel(channel);
|
||||
|
||||
channels[channel].sound = sound;
|
||||
channels[channel].times = loop;
|
||||
channels[channel].pos = 0;
|
||||
channels[channel].state = JA_CHANNEL_PLAYING;
|
||||
channels[channel].stream = SDL_CreateAudioStream(&channels[channel].sound->spec, &JA_audioSpec);
|
||||
SDL_PutAudioStreamData(channels[channel].stream, channels[channel].sound->buffer, channels[channel].sound->length);
|
||||
SDL_SetAudioStreamGain(channels[channel].stream, JA_soundVolume);
|
||||
SDL_BindAudioStream(sdlAudioDevice, channels[channel].stream);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
void JA_DeleteSound(JA_Sound_t *sound)
|
||||
{
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
|
||||
if (channels[i].sound == sound) JA_StopChannel(i);
|
||||
}
|
||||
SDL_free(sound->buffer);
|
||||
delete sound;
|
||||
}
|
||||
|
||||
void JA_PauseChannel(const int channel)
|
||||
{
|
||||
if (!JA_soundEnabled) return;
|
||||
|
||||
if (channel == -1)
|
||||
{
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
|
||||
if (channels[i].state == JA_CHANNEL_PLAYING)
|
||||
{
|
||||
channels[i].state = JA_CHANNEL_PAUSED;
|
||||
//SDL_PauseAudioStreamDevice(channels[i].stream);
|
||||
SDL_UnbindAudioStream(channels[i].stream);
|
||||
}
|
||||
}
|
||||
else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS)
|
||||
{
|
||||
if (channels[channel].state == JA_CHANNEL_PLAYING)
|
||||
{
|
||||
channels[channel].state = JA_CHANNEL_PAUSED;
|
||||
//SDL_PauseAudioStreamDevice(channels[channel].stream);
|
||||
SDL_UnbindAudioStream(channels[channel].stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JA_ResumeChannel(const int channel)
|
||||
{
|
||||
if (!JA_soundEnabled) return;
|
||||
|
||||
if (channel == -1)
|
||||
{
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
|
||||
if (channels[i].state == JA_CHANNEL_PAUSED)
|
||||
{
|
||||
channels[i].state = JA_CHANNEL_PLAYING;
|
||||
//SDL_ResumeAudioStreamDevice(channels[i].stream);
|
||||
SDL_BindAudioStream(sdlAudioDevice, channels[i].stream);
|
||||
}
|
||||
}
|
||||
else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS)
|
||||
{
|
||||
if (channels[channel].state == JA_CHANNEL_PAUSED)
|
||||
{
|
||||
channels[channel].state = JA_CHANNEL_PLAYING;
|
||||
//SDL_ResumeAudioStreamDevice(channels[channel].stream);
|
||||
SDL_BindAudioStream(sdlAudioDevice, channels[channel].stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JA_StopChannel(const int channel)
|
||||
{
|
||||
if (!JA_soundEnabled) return;
|
||||
|
||||
if (channel == -1)
|
||||
{
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
|
||||
if (channels[i].state != JA_CHANNEL_FREE) SDL_DestroyAudioStream(channels[i].stream);
|
||||
channels[i].stream = nullptr;
|
||||
channels[i].state = JA_CHANNEL_FREE;
|
||||
channels[i].pos = 0;
|
||||
channels[i].sound = NULL;
|
||||
}
|
||||
}
|
||||
else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS)
|
||||
{
|
||||
if (channels[channel].state != JA_CHANNEL_FREE) SDL_DestroyAudioStream(channels[channel].stream);
|
||||
channels[channel].stream = nullptr;
|
||||
channels[channel].state = JA_CHANNEL_FREE;
|
||||
channels[channel].pos = 0;
|
||||
channels[channel].sound = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JA_Channel_state JA_GetChannelState(const int channel)
|
||||
{
|
||||
if (!JA_soundEnabled) return JA_SOUND_DISABLED;
|
||||
|
||||
if (channel < 0 || channel >= JA_MAX_SIMULTANEOUS_CHANNELS) return JA_CHANNEL_INVALID;
|
||||
|
||||
return channels[channel].state;
|
||||
}
|
||||
|
||||
float JA_SetSoundVolume(float volume)
|
||||
{
|
||||
JA_soundVolume = SDL_clamp( volume, 0.0f, 1.0f );
|
||||
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
|
||||
if ( (channels[i].state == JA_CHANNEL_PLAYING) || (channels[i].state == JA_CHANNEL_PAUSED) )
|
||||
SDL_SetAudioStreamGain(channels[i].stream, JA_soundVolume);
|
||||
|
||||
return JA_soundVolume;
|
||||
}
|
||||
|
||||
void JA_EnableSound(const bool value)
|
||||
{
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
|
||||
{
|
||||
if (channels[i].state == JA_CHANNEL_PLAYING) JA_StopChannel(i);
|
||||
}
|
||||
JA_soundEnabled = value;
|
||||
}
|
||||
|
||||
float JA_SetVolume(float volume)
|
||||
{
|
||||
JA_SetSoundVolume(JA_SetMusicVolume(volume) / 2.0f);
|
||||
|
||||
return JA_musicVolume;
|
||||
}
|
||||
|
||||
#endif
|
||||
41
jail_audio.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
enum JA_Channel_state { JA_CHANNEL_INVALID, JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED, JA_SOUND_DISABLED };
|
||||
enum JA_Music_state { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, JA_MUSIC_STOPPED, JA_MUSIC_DISABLED };
|
||||
|
||||
struct JA_Sound_t;
|
||||
struct JA_Music_t;
|
||||
|
||||
void JA_Init(const int freq, const SDL_AudioFormat format, const int num_channels);
|
||||
void JA_Quit();
|
||||
|
||||
JA_Music_t *JA_LoadMusic(const char* filename);
|
||||
JA_Music_t *JA_LoadMusic(Uint8* buffer, Uint32 length, const char* filename=nullptr);
|
||||
void JA_PlayMusic(JA_Music_t *music, const int loop = -1);
|
||||
char *JA_GetMusicFilename(JA_Music_t *music = nullptr);
|
||||
void JA_PauseMusic();
|
||||
void JA_ResumeMusic();
|
||||
void JA_StopMusic();
|
||||
void JA_FadeOutMusic(const int milliseconds);
|
||||
JA_Music_state JA_GetMusicState();
|
||||
void JA_DeleteMusic(JA_Music_t *music);
|
||||
float JA_SetMusicVolume(float volume);
|
||||
void JA_SetMusicPosition(float value);
|
||||
float JA_GetMusicPosition();
|
||||
void JA_EnableMusic(const bool value);
|
||||
|
||||
JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length);
|
||||
JA_Sound_t *JA_LoadSound(Uint8* buffer, Uint32 length);
|
||||
JA_Sound_t *JA_LoadSound(const char* filename);
|
||||
int JA_PlaySound(JA_Sound_t *sound, const int loop = 0);
|
||||
int JA_PlaySoundOnChannel(JA_Sound_t *sound, const int channel, const int loop = 0);
|
||||
void JA_PauseChannel(const int channel);
|
||||
void JA_ResumeChannel(const int channel);
|
||||
void JA_StopChannel(const int channel);
|
||||
JA_Channel_state JA_GetChannelState(const int channel);
|
||||
void JA_DeleteSound(JA_Sound_t *sound);
|
||||
float JA_SetSoundVolume(float volume);
|
||||
void JA_EnableSound(const bool value);
|
||||
|
||||
float JA_SetVolume(float volume);
|
||||
35
jdraw8.cpp
Executable file → Normal file
@@ -2,14 +2,10 @@
|
||||
#include "jfile.h"
|
||||
#include <fstream>
|
||||
#include "gif.h"
|
||||
#include "jshader.h"
|
||||
|
||||
#ifdef GCWZERO
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
#else
|
||||
#define SCREEN_WIDTH 640
|
||||
#define SCREEN_HEIGHT 480
|
||||
#endif
|
||||
#define SCREEN_WIDTH 960
|
||||
#define SCREEN_HEIGHT 720
|
||||
|
||||
JD8_Surface screen = NULL;
|
||||
JD8_Palette main_palette = NULL;
|
||||
@@ -25,17 +21,26 @@ char *fps = (char *)malloc(10);
|
||||
SDL_Window* sdlWindow = NULL;
|
||||
SDL_Renderer* sdlRenderer = NULL;
|
||||
SDL_Texture* sdlTexture = NULL;
|
||||
SDL_Texture* backBuffer = NULL;
|
||||
|
||||
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 );
|
||||
|
||||
sdlWindow = SDL_CreateWindow( title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
sdlWindow = SDL_CreateWindow( title, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL );
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
||||
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, NULL);
|
||||
|
||||
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
||||
backBuffer = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, 320, 200);
|
||||
|
||||
int filesize = 0;
|
||||
char *buffer = file_getfilebuffer("crtpi.glsl", filesize, true);
|
||||
|
||||
shader::init(sdlWindow, backBuffer, buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
void JD8_Quit() {
|
||||
@@ -58,7 +63,7 @@ JD8_Surface JD8_NewSurface() {
|
||||
|
||||
JD8_Surface JD8_LoadSurface(const char *file) {
|
||||
int filesize = 0;
|
||||
char *buffer = JF_GetBufferFromResource(file, filesize);
|
||||
char *buffer = file_getfilebuffer(file, filesize);
|
||||
|
||||
unsigned short w, h;
|
||||
Uint8* pixels = LoadGif((unsigned char*)buffer, &w, &h);
|
||||
@@ -80,7 +85,7 @@ JD8_Surface JD8_LoadSurface(const char *file) {
|
||||
JD8_Palette JD8_LoadPalette(const char *file) {
|
||||
int filesize = 0;
|
||||
char *buffer = NULL;
|
||||
buffer = JF_GetBufferFromResource(file, filesize);
|
||||
buffer = file_getfilebuffer(file, filesize);
|
||||
|
||||
JD8_Palette palette = (JD8_Palette)LoadPalette((unsigned char*)buffer);
|
||||
|
||||
@@ -180,8 +185,10 @@ void JD8_Flip() {
|
||||
}
|
||||
}
|
||||
SDL_UpdateTexture(sdlTexture, NULL, pixel_data, 320 * sizeof(Uint32));
|
||||
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, &rect);
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
SDL_SetRenderTarget(sdlRenderer, backBuffer);
|
||||
SDL_RenderTexture(sdlRenderer, sdlTexture, NULL, NULL);
|
||||
shader::render();
|
||||
//SDL_RenderPresent(sdlRenderer);
|
||||
}
|
||||
|
||||
void JD8_FreeSurface(JD8_Surface surface) {
|
||||
|
||||
2
jdraw8.h
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
struct Color {
|
||||
Uint8 r;
|
||||
|
||||
392
jfile.cpp
Executable file → Normal file
@@ -1,162 +1,230 @@
|
||||
#include "jfile.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <fstream>
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
struct DATA_Header {
|
||||
char magic[4];
|
||||
Uint32 num_files;
|
||||
Uint32 index_offset;
|
||||
};
|
||||
|
||||
struct DATA_Info {
|
||||
Uint32 offset;
|
||||
Uint32 length;
|
||||
char name[13];
|
||||
};
|
||||
|
||||
struct DATA_Index {
|
||||
DATA_Info* file_info;
|
||||
};
|
||||
|
||||
struct DATA_File {
|
||||
DATA_Header header;
|
||||
DATA_Index index;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
const char *resourceFileName = "data.jrf";
|
||||
DATA_File *data_file = NULL;
|
||||
|
||||
void JF_SetResourceFile(const char *p_resourceFileName) {
|
||||
resourceFileName = p_resourceFileName;
|
||||
}
|
||||
|
||||
|
||||
void JF_GetDataFile() {
|
||||
std::ifstream fd( resourceFileName, std::ios::in | std::ios::binary );
|
||||
|
||||
if( fd.fail() ) {
|
||||
perror("No s'ha pogut obrir l'arxiu de recursos");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
data_file = (DATA_File*)malloc( sizeof( DATA_File ) );
|
||||
|
||||
fd.read( (char*)&data_file->header, sizeof( DATA_Header ) );
|
||||
|
||||
fd.seekg( data_file->header.index_offset );
|
||||
|
||||
data_file->index.file_info = (DATA_Info*)malloc( data_file->header.num_files * sizeof( DATA_Info ) );
|
||||
|
||||
fd.read( (char*)data_file->index.file_info, data_file->header.num_files * sizeof( DATA_Info ) );
|
||||
|
||||
fd.close();
|
||||
}
|
||||
|
||||
char *JF_GetBufferFromResource(const char *resourcename, int& filesize) {
|
||||
|
||||
if( data_file == NULL ) {
|
||||
JF_GetDataFile();
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
int count = 0;
|
||||
while( !found && count < data_file->header.num_files ) {
|
||||
found = ( strcmp( resourcename, data_file->index.file_info[count].name ) == 0 );
|
||||
if( !found ) count++;
|
||||
}
|
||||
|
||||
if( !found ) {
|
||||
perror("El recurs no s'ha trobat en l'arxiu de recursos");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
filesize = data_file->index.file_info[count].length;
|
||||
|
||||
std::ifstream fd( resourceFileName, std::ios::in | std::ios::binary );
|
||||
|
||||
if( fd.fail() ) {
|
||||
perror("No s'ha pogut obrir l'arxiu de recursos");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fd.seekg( data_file->index.file_info[count].offset );
|
||||
|
||||
char* buffer = (char*)malloc( filesize );
|
||||
fd.read( buffer, filesize );
|
||||
|
||||
fd.close();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// //Read the first INT, which will tell us how many files are in this resource
|
||||
// int numfiles;
|
||||
// int resultat = read(fd, &numfiles, sizeof(int));
|
||||
//
|
||||
//#ifdef _WIN32
|
||||
// int final = eof(fd);
|
||||
//#endif
|
||||
//
|
||||
// //Get the pointers to the stored files
|
||||
// int *filestart = (int *) malloc(sizeof(int) * numfiles);
|
||||
// resultat = read(fd, filestart, sizeof(int) * numfiles);
|
||||
//
|
||||
// //Loop through the files, looking for the file in question
|
||||
// int filenamesize;
|
||||
// char *buffer;
|
||||
// int i;
|
||||
// for(i=0;i<numfiles;i++)
|
||||
// {
|
||||
// int result = 129;
|
||||
// char *filename;
|
||||
// //Seek to the location
|
||||
// lseek(fd, filestart[i], SEEK_SET);
|
||||
// //Get the filesize value
|
||||
// read(fd, filesize, sizeof(int));
|
||||
// //Get the size of the filename string
|
||||
// read(fd, &filenamesize, sizeof(int));
|
||||
// //Size the buffer and read the filename
|
||||
// filename = (char *) malloc(filenamesize + 1);
|
||||
// result = read(fd, filename, filenamesize);
|
||||
// //Remember to terminate the string properly!
|
||||
// filename[filenamesize] = '\0';
|
||||
// //Compare to the string we're looking for
|
||||
// if (strcmp(filename, resourcename) == 0)
|
||||
// {
|
||||
// //Get the contents of the file
|
||||
// buffer = (char *) malloc(*filesize);
|
||||
// read(fd, buffer, *filesize);
|
||||
// free(filename);
|
||||
// break;
|
||||
// }
|
||||
// //Free the filename buffer
|
||||
// free(filename);
|
||||
// }
|
||||
//
|
||||
// //Release memory
|
||||
// free(filestart);
|
||||
//
|
||||
// //Close the resource file!
|
||||
// close(fd);
|
||||
//
|
||||
// //Did we find the file within the resource that we were looking for?
|
||||
// if (buffer == NULL)
|
||||
// {
|
||||
// printf("Unable to find '%s' in the resource file!\n", resourcename);
|
||||
// exit(1);
|
||||
// }
|
||||
//
|
||||
// //Return the buffer
|
||||
// return buffer;
|
||||
//}
|
||||
|
||||
void JF_Quit() {
|
||||
if( data_file != NULL ) {
|
||||
free( data_file->index.file_info );
|
||||
free( data_file );
|
||||
}
|
||||
}
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "jfile.h"
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_FILENAME "data.jf2"
|
||||
#define DEFAULT_FOLDER "data/"
|
||||
#define CONFIG_FILENAME "config.txt"
|
||||
|
||||
struct file_t
|
||||
{
|
||||
std::string path;
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
std::vector<file_t> toc;
|
||||
|
||||
/* El std::map me fa coses rares, vaig a usar un good old std::vector amb una estructura key,value propia i au, que sempre funciona */
|
||||
struct keyvalue_t {
|
||||
std::string key, value;
|
||||
};
|
||||
|
||||
char *resource_filename = NULL;
|
||||
char *resource_folder = NULL;
|
||||
int file_source = SOURCE_FILE;
|
||||
char scratch[255];
|
||||
static std::string config_folder;
|
||||
std::vector<keyvalue_t> config;
|
||||
|
||||
void file_setresourcefilename(const char *str) {
|
||||
if (resource_filename != NULL) free(resource_filename);
|
||||
resource_filename = (char*)malloc(strlen(str)+1);
|
||||
strcpy(resource_filename, str);
|
||||
}
|
||||
|
||||
void file_setresourcefolder(const char *str) {
|
||||
if (resource_folder != NULL) free(resource_folder);
|
||||
resource_folder = (char*)malloc(strlen(str)+1);
|
||||
strcpy(resource_folder, str);
|
||||
}
|
||||
|
||||
void file_setsource(const int src) {
|
||||
file_source = src%2; // mod 2 so it always is a valid value, 0 (file) or 1 (folder)
|
||||
if (src==SOURCE_FOLDER && resource_folder==NULL) file_setresourcefolder(DEFAULT_FOLDER);
|
||||
}
|
||||
|
||||
bool file_getdictionary() {
|
||||
if (resource_filename == NULL) file_setresourcefilename(DEFAULT_FILENAME);
|
||||
|
||||
std::ifstream fi (resource_filename, std::ios::binary);
|
||||
if (!fi.is_open()) return false;
|
||||
char header[4];
|
||||
fi.read(header, 4);
|
||||
uint32_t num_files, toc_offset;
|
||||
fi.read((char*)&num_files, 4);
|
||||
fi.read((char*)&toc_offset, 4);
|
||||
fi.seekg(toc_offset);
|
||||
|
||||
for (int i=0; i<num_files; ++i)
|
||||
{
|
||||
uint32_t file_offset, file_size;
|
||||
fi.read( (char*)&file_offset, 4 );
|
||||
fi.read( (char*)&file_size, 4 );
|
||||
uint8_t path_size;
|
||||
fi.read( (char*)&path_size, 1 );
|
||||
char file_name[path_size+1];
|
||||
fi.read( file_name, path_size );
|
||||
file_name[path_size] = 0;
|
||||
std::string filename = file_name;
|
||||
toc.push_back({filename, file_size, file_offset});
|
||||
}
|
||||
fi.close();
|
||||
}
|
||||
|
||||
char *file_getfilenamewithfolder(const char* filename) {
|
||||
strcpy(scratch, resource_folder);
|
||||
strcat(scratch, filename);
|
||||
return scratch;
|
||||
}
|
||||
|
||||
FILE *file_getfilepointer(const char *resourcename, int& filesize, const bool binary) {
|
||||
|
||||
if (file_source==SOURCE_FILE and toc.size()==0) {
|
||||
if (not file_getdictionary()) file_setsource(SOURCE_FOLDER);
|
||||
}
|
||||
|
||||
FILE *f;
|
||||
|
||||
if (file_source==SOURCE_FILE) {
|
||||
bool found = false;
|
||||
uint32_t count = 0;
|
||||
while( !found && count < toc.size() ) {
|
||||
found = ( std::string(resourcename) == toc[count].path );
|
||||
if( !found ) count++;
|
||||
}
|
||||
|
||||
if( !found ) {
|
||||
perror("El recurs no s'ha trobat en l'arxiu de recursos");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
filesize = toc[count].size;
|
||||
|
||||
f = fopen(resource_filename, binary?"rb":"r");
|
||||
if (not f) {
|
||||
perror("No s'ha pogut obrir l'arxiu de recursos");
|
||||
exit(1);
|
||||
}
|
||||
fseek(f, toc[count].offset, SEEK_SET);
|
||||
} else {
|
||||
f = fopen(file_getfilenamewithfolder(resourcename), binary?"rb":"r");
|
||||
fseek(f, 0, SEEK_END);
|
||||
filesize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
char *file_getfilebuffer(const char *resourcename, int& filesize, const bool zero_terminate) {
|
||||
FILE *f = file_getfilepointer(resourcename, filesize, true);
|
||||
char* buffer = (char*)malloc(zero_terminate?filesize:filesize+1);
|
||||
fread(buffer, filesize, 1, f);
|
||||
if (zero_terminate) buffer[filesize]=0;
|
||||
fclose(f);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Crea la carpeta del sistema donde guardar datos
|
||||
void file_setconfigfolder(const char *foldername)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
config_folder = std::string(getenv("APPDATA")) + "/" + foldername;
|
||||
#elif __APPLE__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
config_folder = std::string(homedir) + "/Library/Application Support/" + foldername;
|
||||
#elif __linux__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
config_folder = std::string(homedir) + "/." + foldername;
|
||||
#endif
|
||||
|
||||
struct stat st = {0};
|
||||
if (stat(config_folder.c_str(), &st) == -1)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int ret = mkdir(config_folder.c_str());
|
||||
#else
|
||||
int ret = mkdir(config_folder.c_str(), S_IRWXU);
|
||||
#endif
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
printf("ERROR CREATING CONFIG FOLDER.");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *file_getconfigfolder() {
|
||||
std::string folder = config_folder + "/";
|
||||
return folder.c_str();
|
||||
}
|
||||
|
||||
void file_loadconfigvalues() {
|
||||
config.clear();
|
||||
std::string config_file = config_folder + "/config.txt";
|
||||
FILE *f = fopen(config_file.c_str(), "r");
|
||||
if (!f) return;
|
||||
|
||||
char line[1024];
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
char *value = strchr(line, '=');
|
||||
if (value) {
|
||||
*value='\0'; value++;
|
||||
value[strlen(value)-1] = '\0';
|
||||
config.push_back({line, value});
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void file_saveconfigvalues() {
|
||||
std::string config_file = config_folder + "/config.txt";
|
||||
FILE *f = fopen(config_file.c_str(), "w");
|
||||
if (f) {
|
||||
for (auto pair : config) {
|
||||
fprintf(f, "%s=%s\n", pair.key.c_str(), pair.value.c_str());
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
const char* file_getconfigvalue(const char *key) {
|
||||
if (config.empty()) file_loadconfigvalues();
|
||||
for (auto pair : config) {
|
||||
if (pair.key == std::string(key)) {
|
||||
strcpy(scratch, pair.value.c_str());
|
||||
return scratch;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void file_setconfigvalue(const char* key, const char* value) {
|
||||
if (config.empty()) file_loadconfigvalues();
|
||||
for (auto &pair : config) {
|
||||
if (pair.key == std::string(key)) {
|
||||
pair.value = value;
|
||||
file_saveconfigvalues();
|
||||
return;
|
||||
}
|
||||
}
|
||||
config.push_back({key, value});
|
||||
file_saveconfigvalues();
|
||||
return;
|
||||
}
|
||||
|
||||
25
jfile.h
Executable file → Normal file
@@ -1,7 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
void JF_SetResourceFile(const char *p_resourceFileName);
|
||||
|
||||
char *JF_GetBufferFromResource(const char *resourcename, int& filesize);
|
||||
|
||||
void JF_Quit();
|
||||
#pragma once
|
||||
#include <stdio.h>
|
||||
|
||||
#define SOURCE_FILE 0
|
||||
#define SOURCE_FOLDER 1
|
||||
|
||||
void file_setconfigfolder(const char *foldername);
|
||||
const char *file_getconfigfolder();
|
||||
|
||||
void file_setresourcefilename(const char *str);
|
||||
void file_setresourcefolder(const char *str);
|
||||
void file_setsource(const int src);
|
||||
|
||||
FILE *file_getfilepointer(const char *resourcename, int& filesize, const bool binary=false);
|
||||
char *file_getfilebuffer(const char *resourcename, int& filesize, const bool zero_terminate=false);
|
||||
|
||||
const char* file_getconfigvalue(const char *key);
|
||||
void file_setconfigvalue(const char* key, const char* value);
|
||||
|
||||
2
jgame.cpp
Executable file → Normal file
@@ -7,7 +7,7 @@ Uint32 cycle_counter = 0;
|
||||
|
||||
void JG_Init() {
|
||||
|
||||
SDL_Init( SDL_INIT_EVERYTHING );
|
||||
SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO );
|
||||
//SDL_WM_SetCaption( title, NULL );
|
||||
updateTime = SDL_GetTicks();
|
||||
}
|
||||
|
||||
2
jgame.h
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
void JG_Init();
|
||||
|
||||
|
||||
8
jinput.cpp
Executable file → Normal file
@@ -2,7 +2,7 @@
|
||||
#include "jgame.h"
|
||||
#include <string>
|
||||
|
||||
const Uint8 *keystates;// = SDL_GetKeyboardState( NULL );
|
||||
const bool *keystates;// = SDL_GetKeyboardState( NULL );
|
||||
SDL_Event event;
|
||||
Uint8 cheat[5];
|
||||
bool key_pressed = false;
|
||||
@@ -27,10 +27,10 @@ void JI_Update() {
|
||||
if (waitTime > 0) waitTime--;
|
||||
|
||||
while ( SDL_PollEvent( &event ) ) {
|
||||
if ( event.type == SDL_QUIT ) JG_QuitSignal();
|
||||
if( event.type == SDL_KEYUP ) {
|
||||
if ( event.type == SDL_EVENT_QUIT ) JG_QuitSignal();
|
||||
if( event.type == SDL_EVENT_KEY_UP ) {
|
||||
key_pressed = true;
|
||||
JI_moveCheats( event.key.keysym.sym );
|
||||
JI_moveCheats( event.key.scancode );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
jinput.h
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
void JI_DisableKeyboard(Uint32 time);
|
||||
|
||||
|
||||
231
jshader.cpp
Normal file
@@ -0,0 +1,231 @@
|
||||
#include "jshader.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "CoreFoundation/CoreFoundation.h"
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
#if ESSENTIAL_GL_PRACTICES_SUPPORT_GL3
|
||||
#include <OpenGL/gl3.h>
|
||||
#else
|
||||
#include <OpenGL/gl.h>
|
||||
#endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3
|
||||
#else
|
||||
#include <SDL3/SDL_opengl.h>
|
||||
#include <SDL3/SDL_opengl_glext.h>
|
||||
#endif
|
||||
|
||||
namespace shader
|
||||
{
|
||||
SDL_Window *win = nullptr;
|
||||
SDL_Renderer *renderer = nullptr;
|
||||
GLuint programId = 0;
|
||||
SDL_Texture* backBuffer = nullptr;
|
||||
SDL_Point win_size = {640, 480};
|
||||
SDL_FPoint tex_size = {320, 240};
|
||||
bool usingOpenGL;
|
||||
GLuint texture_number;
|
||||
GLuint nose;
|
||||
|
||||
#ifndef __APPLE__
|
||||
|
||||
// I'm avoiding the use of GLEW or some extensions handler, but that
|
||||
// doesn't mean you should...
|
||||
PFNGLCREATESHADERPROC glCreateShader;
|
||||
PFNGLSHADERSOURCEPROC glShaderSource;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader;
|
||||
PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
|
||||
PFNGLDELETESHADERPROC glDeleteShader;
|
||||
PFNGLATTACHSHADERPROC glAttachShader;
|
||||
PFNGLCREATEPROGRAMPROC glCreateProgram;
|
||||
PFNGLLINKPROGRAMPROC glLinkProgram;
|
||||
PFNGLVALIDATEPROGRAMPROC glValidateProgram;
|
||||
PFNGLGETPROGRAMIVPROC glGetProgramiv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
|
||||
PFNGLUSEPROGRAMPROC glUseProgram;
|
||||
|
||||
bool initGLExtensions() {
|
||||
glCreateShader = (PFNGLCREATESHADERPROC)SDL_GL_GetProcAddress("glCreateShader");
|
||||
glShaderSource = (PFNGLSHADERSOURCEPROC)SDL_GL_GetProcAddress("glShaderSource");
|
||||
glCompileShader = (PFNGLCOMPILESHADERPROC)SDL_GL_GetProcAddress("glCompileShader");
|
||||
glGetShaderiv = (PFNGLGETSHADERIVPROC)SDL_GL_GetProcAddress("glGetShaderiv");
|
||||
glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)SDL_GL_GetProcAddress("glGetShaderInfoLog");
|
||||
glDeleteShader = (PFNGLDELETESHADERPROC)SDL_GL_GetProcAddress("glDeleteShader");
|
||||
glAttachShader = (PFNGLATTACHSHADERPROC)SDL_GL_GetProcAddress("glAttachShader");
|
||||
glCreateProgram = (PFNGLCREATEPROGRAMPROC)SDL_GL_GetProcAddress("glCreateProgram");
|
||||
glLinkProgram = (PFNGLLINKPROGRAMPROC)SDL_GL_GetProcAddress("glLinkProgram");
|
||||
glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)SDL_GL_GetProcAddress("glValidateProgram");
|
||||
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)SDL_GL_GetProcAddress("glGetProgramiv");
|
||||
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)SDL_GL_GetProcAddress("glGetProgramInfoLog");
|
||||
glUseProgram = (PFNGLUSEPROGRAMPROC)SDL_GL_GetProcAddress("glUseProgram");
|
||||
|
||||
return glCreateShader && glShaderSource && glCompileShader && glGetShaderiv &&
|
||||
glGetShaderInfoLog && glDeleteShader && glAttachShader && glCreateProgram &&
|
||||
glLinkProgram && glValidateProgram && glGetProgramiv && glGetProgramInfoLog &&
|
||||
glUseProgram;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
GLuint compileShader(const char* source, GLuint shaderType) {
|
||||
// Create ID for shader
|
||||
GLuint result = glCreateShader(shaderType);
|
||||
// Add define depending on shader type
|
||||
const char *sources[2] = { shaderType==GL_VERTEX_SHADER?"#define VERTEX\n":"#define FRAGMENT\n", source };
|
||||
// Define shader text
|
||||
glShaderSource(result, 2, sources, NULL);
|
||||
// Compile shader
|
||||
glCompileShader(result);
|
||||
|
||||
//Check vertex shader for errors
|
||||
GLint shaderCompiled = GL_FALSE;
|
||||
glGetShaderiv( result, GL_COMPILE_STATUS, &shaderCompiled );
|
||||
if (shaderCompiled != GL_TRUE)
|
||||
{
|
||||
std::cout << "Error en la compilación: " << result << "!" << std::endl;
|
||||
GLint logLength;
|
||||
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if (logLength > 0)
|
||||
{
|
||||
GLchar *log = (GLchar*)malloc(logLength);
|
||||
glGetShaderInfoLog(result, logLength, &logLength, log);
|
||||
std::cout << "Shader compile log:" << log << std::endl;
|
||||
free(log);
|
||||
}
|
||||
glDeleteShader(result);
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
GLuint compileProgram(const char* vertexShaderSource, const char* fragmentShaderSource)
|
||||
{
|
||||
GLuint programId = 0;
|
||||
GLuint vtxShaderId, fragShaderId;
|
||||
|
||||
programId = glCreateProgram();
|
||||
|
||||
vtxShaderId = compileShader(vertexShaderSource, GL_VERTEX_SHADER);
|
||||
fragShaderId = compileShader(fragmentShaderSource?fragmentShaderSource:vertexShaderSource, GL_FRAGMENT_SHADER);
|
||||
|
||||
if(vtxShaderId && fragShaderId)
|
||||
{
|
||||
// Associate shader with program
|
||||
glAttachShader(programId, vtxShaderId);
|
||||
glAttachShader(programId, fragShaderId);
|
||||
glLinkProgram(programId);
|
||||
glValidateProgram(programId);
|
||||
|
||||
// Check the status of the compile/link
|
||||
GLint logLen;
|
||||
glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &logLen);
|
||||
if (logLen > 0)
|
||||
{
|
||||
char* log = (char*) malloc(logLen * sizeof(char));
|
||||
// Show any errors as appropriate
|
||||
glGetProgramInfoLog(programId, logLen, &logLen, log);
|
||||
std::cout << "Prog Info Log: " << std::endl << log << std::endl;
|
||||
free(log);
|
||||
}
|
||||
}
|
||||
if (vtxShaderId) glDeleteShader(vtxShaderId);
|
||||
if (fragShaderId) glDeleteShader(fragShaderId);
|
||||
return programId;
|
||||
}
|
||||
|
||||
const bool init(SDL_Window* win, SDL_Texture* backBuffer, const char* vertexShader, const char* fragmentShader)
|
||||
{
|
||||
shader::win = win;
|
||||
shader::renderer = SDL_GetRenderer(win);
|
||||
shader::backBuffer = backBuffer;
|
||||
SDL_GetWindowSize(win, &win_size.x, &win_size.y);
|
||||
SDL_GetTextureSize(backBuffer, &tex_size.x, &tex_size.y);
|
||||
printf("tex size: %fx%f\n", tex_size.x, tex_size.y);
|
||||
SDL_PropertiesID props = SDL_GetTextureProperties(backBuffer);
|
||||
texture_number = SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER, -1);
|
||||
printf("texture number: %i\n", texture_number);
|
||||
int access = SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_ACCESS_NUMBER, -1);
|
||||
nose = SDL_GetNumberProperty(props, SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER, -1);
|
||||
printf("texture target number: %i\n", nose);
|
||||
|
||||
if (access != SDL_TEXTUREACCESS_TARGET)
|
||||
{
|
||||
std::cout << "ERROR FATAL: La textura per al render ha de tindre SDL_TEXTUREACCESS_TARGET definit." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const char * renderer_name = SDL_GetRendererName(renderer);
|
||||
printf("rendererInfo.name: %s\n", renderer_name);
|
||||
|
||||
if(!strncmp(renderer_name, "opengl", 6)) {
|
||||
#ifndef __APPLE__
|
||||
if (!initGLExtensions()) {
|
||||
std::cout << "WARNING: No s'han pogut inicialitzar les extensions d'OpenGL!" << std::endl;
|
||||
usingOpenGL = false;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
// Compilar el shader y dejarlo listo para usar.
|
||||
programId = compileProgram(vertexShader, fragmentShader);
|
||||
} else {
|
||||
std::cout << "WARNING: El driver del renderer no es OpenGL." << std::endl;
|
||||
usingOpenGL = false;
|
||||
return false;
|
||||
}
|
||||
usingOpenGL = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned char pixels[512*240*4];
|
||||
|
||||
void render()
|
||||
{
|
||||
SDL_FlushRenderer(renderer);
|
||||
SDL_SetRenderTarget(renderer, NULL);
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_FlushRenderer(renderer);
|
||||
|
||||
if (usingOpenGL)
|
||||
{
|
||||
GLint oldProgramId;
|
||||
if (programId != 0)
|
||||
{
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, &oldProgramId);
|
||||
glUseProgram(programId);
|
||||
}
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, 1);
|
||||
//glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, pixels);
|
||||
//if (glGetError()) { printf("GLGETERROR!\n"); exit(1);}
|
||||
//GLint param;
|
||||
//glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, ¶m);
|
||||
//printf("tex width: %i\n", param);
|
||||
glViewport(0, 0, win_size.x, win_size.y);
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex2f(0.0f, 0.0f);
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex2f(tex_size.x, 0.0f);
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex2f(0.0f, tex_size.y);
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex2f(tex_size.x, tex_size.y);
|
||||
glEnd();
|
||||
|
||||
SDL_GL_SwapWindow(win);
|
||||
|
||||
if (programId != 0) glUseProgram(oldProgramId);
|
||||
|
||||
} else {
|
||||
SDL_RenderTexture(renderer, backBuffer, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
if (glGetError()) { printf("GLERROR!\n"); exit(1); }
|
||||
}
|
||||
}
|
||||
44
jshader.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
// TIPS:
|
||||
// =======================================================================
|
||||
// Abans de crear el renderer, cridar a la següent funció:
|
||||
//
|
||||
// SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
||||
//
|
||||
// Aixó li diu que volem un renderer que use especificament opengl. A més,
|
||||
// al crear el renderer li tenim que dir que el volem que use acceeració
|
||||
// per hardware, i que soporte render a textura. Per exemple:
|
||||
//
|
||||
// SDL_Renderer *ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED |
|
||||
// SDL_RENDERER_TARGETTEXTURE);
|
||||
//
|
||||
// Per altra part, al crear la textura tenim que definir que puga ser target
|
||||
// de renderitzat (SDL_TEXTUREACCESS_TARGET), per exemple:
|
||||
//
|
||||
// SDL_Texture *tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
|
||||
// SDL_TEXTUREACCESS_TARGET, 320, 240);
|
||||
//
|
||||
// Els shaders li'ls passem com una cadena, som nosaltres els que s'encarreguem
|
||||
// de carregarlos de disc, amb fopen, ifstream, jfile o el que vullgues.
|
||||
// Si els tens en un std::string, passa-li-la com "cadena.c_str()".
|
||||
//
|
||||
// Poden ser els dos el mateix arxiu, com fa libRetro, jo desde dins ja fique
|
||||
// els defines necessaris. Si es el mateix arxiu, pots no ficar el quart paràmetre.
|
||||
//
|
||||
// Els shaders de libRetro no funcionen directament, hi ha que fer algunes modificacions.
|
||||
//
|
||||
// El pintat final de la teua escena l'has de fer com si "backBuffer" fora la pantalla.
|
||||
//
|
||||
// Ah! una cosa mes: al compilar, en Linux afegir "-lGL", en Windows afegir "-lopengl32".
|
||||
// En Mac ni idea
|
||||
|
||||
namespace shader
|
||||
{
|
||||
const bool init(SDL_Window* win, SDL_Texture* backBuffer,
|
||||
const char* vertexShader, const char* fragmentShader=nullptr);
|
||||
|
||||
void render();
|
||||
}
|
||||
79
jsound.cpp
@@ -1,79 +0,0 @@
|
||||
#include "jsound.h"
|
||||
#include "jfile.h"
|
||||
#include <string>
|
||||
|
||||
Mix_Music *music = NULL;
|
||||
char currentMusic[12];
|
||||
|
||||
bool JS_Init() {
|
||||
Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 1024);
|
||||
Mix_AllocateChannels(8);
|
||||
currentMusic[0] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void JS_LoadMusic(const char *musicFilename)
|
||||
{
|
||||
if (music != NULL) {
|
||||
Mix_HaltMusic();
|
||||
Mix_FreeMusic(music);
|
||||
}
|
||||
Mix_VolumeMusic(MIX_MAX_VOLUME);
|
||||
|
||||
int filesize = 0;
|
||||
char *buffer = JF_GetBufferFromResource(musicFilename, filesize);
|
||||
|
||||
SDL_RWops *rw = SDL_RWFromMem(buffer, filesize);
|
||||
music = Mix_LoadMUS_RW(rw, 1);
|
||||
strcpy(currentMusic, musicFilename);
|
||||
}
|
||||
|
||||
void JS_SetMusicVolume(int volume) {
|
||||
Mix_VolumeMusic(volume);
|
||||
}
|
||||
|
||||
void JS_PlayMusic(int loops) {
|
||||
Mix_PlayMusic(music, loops);
|
||||
}
|
||||
|
||||
void JS_PauseMusic() {
|
||||
Mix_PauseMusic();
|
||||
}
|
||||
|
||||
void JS_FadeOutMusic() {
|
||||
Mix_FadeOutMusic(500);
|
||||
}
|
||||
|
||||
bool JS_MusicPlaying() {
|
||||
return (Mix_PlayingMusic() == 1);// && (Mix_FadingMusic() != MIX_FADING_OUT);
|
||||
}
|
||||
|
||||
const char* JS_GetMusicName() {
|
||||
return currentMusic;
|
||||
}
|
||||
|
||||
JS_Sound *JS_LoadSound(char *soundFilename) {
|
||||
int filesize = 0;
|
||||
char *buffer = JF_GetBufferFromResource(soundFilename, filesize);
|
||||
|
||||
SDL_RWops *rw = SDL_RWFromMem(buffer, filesize);
|
||||
return Mix_LoadWAV_RW(rw, false);
|
||||
}
|
||||
|
||||
void JS_SetSoundVolume(JS_Sound *sound, int volume) {
|
||||
Mix_VolumeChunk(sound, volume);
|
||||
}
|
||||
|
||||
void JS_PlaySound(JS_Sound *sound) {
|
||||
Mix_PlayChannel(-1, sound, 0);
|
||||
}
|
||||
|
||||
void JS_FreeSound(JS_Sound *sound) {
|
||||
Mix_FreeChunk(sound);
|
||||
}
|
||||
|
||||
void JS_Finalize() {
|
||||
Mix_FreeMusic(music);
|
||||
Mix_CloseAudio();
|
||||
}
|
||||
|
||||
30
jsound.h
@@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
|
||||
typedef Mix_Chunk JS_Sound;
|
||||
|
||||
bool JS_Init();
|
||||
|
||||
void JS_LoadMusic(const char *musicFilename);
|
||||
|
||||
void JS_SetMusicVolume(int volume);
|
||||
|
||||
void JS_PlayMusic(int loops);
|
||||
|
||||
void JS_PauseMusic();
|
||||
|
||||
void JS_FadeOutMusic();
|
||||
|
||||
bool JS_MusicPlaying();
|
||||
|
||||
const char* JS_GetMusicName();
|
||||
|
||||
JS_Sound *JS_LoadSound(char *soundFilename);
|
||||
|
||||
void JS_SetSoundVolume(JS_Sound *sound, int volume);
|
||||
|
||||
void JS_PlaySound(JS_Sound *sound);
|
||||
|
||||
void JS_FreeSound(JS_Sound *sound);
|
||||
|
||||
void JS_Finalize();
|
||||
5
lagueirtofile
Normal file
@@ -0,0 +1,5 @@
|
||||
libs = -lSDL3 -lGL
|
||||
cppflags = -D DEBUG -D VERBOSE -g -Wall
|
||||
executable = aee
|
||||
sourcepath = .
|
||||
buildpath = build
|
||||
32
main.cpp
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
#include "jgame.h"
|
||||
#include "jdraw8.h"
|
||||
#include "jsound.h"
|
||||
#include "jail_audio.h"
|
||||
#include "jfile.h"
|
||||
#include "info.h"
|
||||
#include "modulegame.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
int main( int argc, char* args[] ) {
|
||||
|
||||
JF_SetResourceFile("data.jrf");
|
||||
//file_setresourcefilename("data.jrf");
|
||||
/*#ifdef WIN32
|
||||
JF_SetResourceFile("data.jrf");
|
||||
#else
|
||||
@@ -35,21 +35,20 @@ int main( int argc, char* args[] ) {
|
||||
|
||||
JG_Init();
|
||||
JD8_Init("Aventures En Egipte");
|
||||
JS_Init();
|
||||
JA_Init(48000, SDL_AUDIO_S16, 2);
|
||||
|
||||
Info info;
|
||||
info.num_habitacio = 1;
|
||||
info.num_piramide = 255;
|
||||
info.diners = 0;
|
||||
info.diamants = 0;
|
||||
info.vida = 5;
|
||||
info.momies = 0;
|
||||
info.nou_personatge = false;
|
||||
info.pepe_activat = false;
|
||||
info::num_habitacio = 1;
|
||||
info::num_piramide = 255;
|
||||
info::diners = 0;
|
||||
info::diamants = 0;
|
||||
info::vida = 5;
|
||||
info::momies = 0;
|
||||
info::nou_personatge = false;
|
||||
info::pepe_activat = false;
|
||||
|
||||
FILE* ini = fopen("trick.ini", "rb");
|
||||
if (ini != NULL) {
|
||||
info.nou_personatge = true;
|
||||
info::nou_personatge = true;
|
||||
fclose(ini);
|
||||
}
|
||||
|
||||
@@ -59,21 +58,20 @@ int main( int argc, char* args[] ) {
|
||||
switch (gameState) {
|
||||
case 0:
|
||||
ModuleGame* moduleGame;
|
||||
moduleGame = new ModuleGame( &info );
|
||||
moduleGame = new ModuleGame();
|
||||
gameState = moduleGame->Go();
|
||||
delete moduleGame;
|
||||
break;
|
||||
case 1:
|
||||
ModuleSequence* moduleSequence;
|
||||
moduleSequence = new ModuleSequence( &info );
|
||||
moduleSequence = new ModuleSequence();
|
||||
gameState = moduleSequence->Go();
|
||||
delete moduleSequence;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
JF_Quit();
|
||||
JS_Finalize();
|
||||
JA_Quit();
|
||||
JD8_Quit();
|
||||
JG_Finalize();
|
||||
|
||||
|
||||
8
makefile
Executable file → Normal file
@@ -1,9 +1,9 @@
|
||||
TARGET=aee
|
||||
all:
|
||||
g++ *.cpp -std=c++11 -lSDL2 -lSDL2_mixer -o $(TARGET)
|
||||
linux:
|
||||
g++ *.cpp -lSDL3 -lGL -o $(TARGET)
|
||||
|
||||
debug:
|
||||
g++ *.cpp -g -std=c++11 -lSDL2 -lSDL2_mixer -o $(TARGET)
|
||||
windows:
|
||||
g++ *.cpp -lmingw32 -lSDL3 -lopengl32 -mwindows -o $(TARGET)
|
||||
|
||||
clean:
|
||||
rm -rf ./$(TARGET)
|
||||
|
||||
116
mapa.cpp
Executable file → Normal file
@@ -4,10 +4,9 @@
|
||||
#include "jinput.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Mapa::Mapa( JD8_Surface gfx, Info* info, Prota* sam ) {
|
||||
Mapa::Mapa( JD8_Surface gfx, Prota* sam ) {
|
||||
|
||||
this->gfx = gfx;
|
||||
this->info = info;
|
||||
this->sam = sam;
|
||||
|
||||
this->preparaFondoEstatic();
|
||||
@@ -31,7 +30,7 @@ Mapa::~Mapa(void) {
|
||||
|
||||
void Mapa::draw() {
|
||||
|
||||
if( this->info->num_piramide != 4 ) {
|
||||
if( info::num_piramide != 4 ) {
|
||||
switch( sam->o ) {
|
||||
case 0: // Down
|
||||
JD8_BlitCKToSurface( sam->x, sam->y, this->gfx, 15, 125 + sam->frame_pejades, 15, 1, this->fondo, 255 );
|
||||
@@ -95,9 +94,9 @@ bool Mapa::novaMomia() {
|
||||
|
||||
void Mapa::preparaFondoEstatic() {
|
||||
|
||||
// Prepara el fondo estàtic de l'habitació
|
||||
// Prepara el fondo est<EFBFBD>tic de l'habitaci<EFBFBD>
|
||||
this->fondo = JD8_NewSurface();
|
||||
if (info->num_piramide == 6) {
|
||||
if (info::num_piramide == 6) {
|
||||
JD8_BlitToSurface(9, 2, this->gfx, 227, 185, 92, 7, this->fondo); // Text "SECRETA"
|
||||
}
|
||||
else {
|
||||
@@ -106,12 +105,12 @@ void Mapa::preparaFondoEstatic() {
|
||||
}
|
||||
JD8_BlitToSurface(130, 2, this->gfx, 225, 192, 19, 8, this->fondo); // Montonet de monedes + signe '='
|
||||
JD8_BlitToSurface(220, 2, this->gfx, 160, 185, 48, 7, this->fondo); // Text "ENERGIA"
|
||||
if (this->info->diners >= 200) JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
|
||||
if (info::diners >= 200) JD8_BlitToSurface(175, 3, this->gfx, 60, 193, 7, 6, this->fondo);
|
||||
|
||||
// Pinta taulells
|
||||
for( int y = 0; y < 11; y++ ) {
|
||||
for( int x = 0; x < 19; x++ ) {
|
||||
switch( info->num_piramide ) {
|
||||
switch( info::num_piramide ) {
|
||||
case 1:
|
||||
JD8_BlitToSurface( 20+(x*15), 30+(y*15), this->gfx, 0, 80, 15, 15, this->fondo );
|
||||
break;
|
||||
@@ -156,7 +155,7 @@ void Mapa::preparaFondoEstatic() {
|
||||
// Pinta la porta
|
||||
JD8_BlitCKToSurface( 150, 18, this->gfx, 0, 143, 15, 12, this->fondo, 255 );
|
||||
|
||||
if( info->num_piramide == 2 ) {
|
||||
if( info::num_piramide == 2 ) {
|
||||
JD8_BlitToSurface( 5, 100, this->gfx, 30, 140, 15, 15, this->fondo );
|
||||
}
|
||||
}
|
||||
@@ -168,9 +167,9 @@ void swap( Uint8& a, Uint8& b ) {
|
||||
}
|
||||
|
||||
void Mapa::preparaTombes() {
|
||||
const Uint8 contingut = this->info->num_piramide == 6 ? CONTE_DIAMANT : CONTE_RES;
|
||||
int cx = this->info->num_piramide == 6 ? 270 : 0;
|
||||
int cy = this->info->num_piramide == 6 ? 50 : 0;
|
||||
const Uint8 contingut = info::num_piramide == 6 ? CONTE_DIAMANT : CONTE_RES;
|
||||
int cx = info::num_piramide == 6 ? 270 : 0;
|
||||
int cy = info::num_piramide == 6 ? 50 : 0;
|
||||
|
||||
for( int i = 0; i < 16; i++ ) {
|
||||
this->tombes[i].contingut = contingut;
|
||||
@@ -182,7 +181,7 @@ void Mapa::preparaTombes() {
|
||||
this->tombes[i].x = cx;
|
||||
this->tombes[i].y = cy;
|
||||
}
|
||||
if (this->info->num_piramide == 6) return;
|
||||
if (info::num_piramide == 6) return;
|
||||
this->tombes[0].contingut = CONTE_FARAO;
|
||||
this->tombes[1].contingut = CONTE_CLAU;
|
||||
this->tombes[2].contingut = CONTE_PERGAMI;
|
||||
@@ -202,7 +201,7 @@ void Mapa::comprovaUltimCami() {
|
||||
Uint8 col_aux = abs( this->vertex.columna - this->ultim_vertex.columna );
|
||||
Uint8 fil_aux = abs( this->vertex.fila - this->ultim_vertex.fila );
|
||||
|
||||
if( col_aux > fil_aux ) { // Camí horitzontal
|
||||
if( col_aux > fil_aux ) { // Cam<EFBFBD> horitzontal
|
||||
Uint8 cami_fila = this->vertex.fila;
|
||||
Uint8 cami_columna = minim( this->vertex.columna, this->ultim_vertex.columna );
|
||||
|
||||
@@ -217,7 +216,7 @@ void Mapa::comprovaUltimCami() {
|
||||
this->tombes[caixa_amunt].costat[2] = true;
|
||||
this->comprovaCaixa( caixa_amunt );
|
||||
}
|
||||
} else { // Camí vertical
|
||||
} else { // Cam<EFBFBD> vertical
|
||||
Uint8 cami_columna = this->vertex.columna;
|
||||
Uint8 cami_fila = minim( this->vertex.fila, this->ultim_vertex.fila );
|
||||
|
||||
@@ -235,57 +234,52 @@ void Mapa::comprovaUltimCami() {
|
||||
}
|
||||
}
|
||||
|
||||
void Mapa::comprovaCaixa( Uint8 num ) {
|
||||
void Mapa::comprovaCaixa( Uint8 num )
|
||||
{
|
||||
// Si la tomba ja està oberta, no hi ha res que mirar
|
||||
if( this->tombes[num].oberta ) return;
|
||||
|
||||
if( !this->tombes[num].oberta ) {
|
||||
this->tombes[num].oberta = true;
|
||||
for( int i = 0; i < 4; i++ ) if( !this->tombes[num].costat[i] ) this->tombes[num].oberta = false;
|
||||
// Si algun costat encara no està passat, no hi ha res que fer
|
||||
for( int i = 0; i < 4; i++ ) if( !this->tombes[num].costat[i] ) return;
|
||||
|
||||
if( this->tombes[num].oberta ) {
|
||||
int x = num % 4;
|
||||
int y = num / 4;
|
||||
switch( this->tombes[num].contingut ) {
|
||||
case CONTE_RES:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 50, 0, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].x = 50;
|
||||
break;
|
||||
case CONTE_TRESOR:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 100, 0, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].x = 100;
|
||||
info->diners++;
|
||||
break;
|
||||
case CONTE_FARAO:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 150, 0, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].x = 150;
|
||||
this->farao = true;
|
||||
break;
|
||||
case CONTE_CLAU:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 200, 0, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].x = 200;
|
||||
this->clau = true;
|
||||
break;
|
||||
case CONTE_MOMIA:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 0, 175, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].y = 175;
|
||||
this->nova_momia = true;
|
||||
break;
|
||||
case CONTE_PERGAMI:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 250, 0, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].x = 250;
|
||||
this->sam->pergami = true;
|
||||
break;
|
||||
case CONTE_DIAMANT:
|
||||
//JD8_BlitCKToSurface( 35+(x*65), 45+(y*35), this->gfx, 270, 70, 50, 20, this->fondo, 255 );
|
||||
this->tombes[num].y = 70;
|
||||
info->diamants++;
|
||||
info->diners += VALOR_DIAMANT;
|
||||
if (info->diamants == 16) this->farao = this->clau = true;
|
||||
break;
|
||||
}
|
||||
// Sinó, pos la acabem d'obrir
|
||||
this->tombes[num].oberta = true;
|
||||
|
||||
this->comprovaPorta();
|
||||
}
|
||||
// Comprobem el premi del kinder sorpresa
|
||||
switch( this->tombes[num].contingut )
|
||||
{
|
||||
case CONTE_RES:
|
||||
this->tombes[num].x = 50;
|
||||
break;
|
||||
case CONTE_TRESOR:
|
||||
this->tombes[num].x = 100;
|
||||
info::diners++;
|
||||
break;
|
||||
case CONTE_FARAO:
|
||||
this->tombes[num].x = 150;
|
||||
this->farao = true;
|
||||
break;
|
||||
case CONTE_CLAU:
|
||||
this->tombes[num].x = 200;
|
||||
this->clau = true;
|
||||
break;
|
||||
case CONTE_MOMIA:
|
||||
this->tombes[num].y = 175;
|
||||
this->nova_momia = true;
|
||||
break;
|
||||
case CONTE_PERGAMI:
|
||||
this->tombes[num].x = 250;
|
||||
this->sam->pergami = true;
|
||||
break;
|
||||
case CONTE_DIAMANT:
|
||||
this->tombes[num].y = 70;
|
||||
info::diamants++;
|
||||
info::diners += VALOR_DIAMANT;
|
||||
if (info::diamants == 16) this->farao = this->clau = true;
|
||||
break;
|
||||
}
|
||||
|
||||
this->comprovaPorta();
|
||||
}
|
||||
|
||||
void Mapa::comprovaPorta() {
|
||||
|
||||
3
mapa.h
Executable file → Normal file
@@ -30,7 +30,7 @@ class Mapa {
|
||||
|
||||
public:
|
||||
|
||||
Mapa( JD8_Surface gfx, Info* info, Prota* sam );
|
||||
Mapa( JD8_Surface gfx, Prota* sam );
|
||||
~Mapa(void);
|
||||
|
||||
void draw();
|
||||
@@ -52,7 +52,6 @@ protected:
|
||||
JD8_Surface fondo;
|
||||
Vertex vertex;
|
||||
Vertex ultim_vertex;
|
||||
Info* info;
|
||||
Uint8 frame_torxes;
|
||||
|
||||
Prota* sam;
|
||||
|
||||
20
marcador.cpp
Executable file → Normal file
@@ -1,11 +1,9 @@
|
||||
#include "marcador.h"
|
||||
|
||||
Marcador::Marcador( JD8_Surface gfx, Info* info, Prota* sam ) {
|
||||
Marcador::Marcador( JD8_Surface gfx, Prota* sam ) {
|
||||
|
||||
this->gfx = gfx;
|
||||
this->info = info;
|
||||
this->sam = sam;
|
||||
|
||||
}
|
||||
|
||||
Marcador::~Marcador(void) {
|
||||
@@ -13,19 +11,19 @@ Marcador::~Marcador(void) {
|
||||
|
||||
void Marcador::draw() {
|
||||
|
||||
if (this->info->num_piramide < 6) {
|
||||
this->pintaNumero(55, 2, this->info->num_piramide);
|
||||
this->pintaNumero(80, 2, this->info->num_habitacio);
|
||||
if (info::num_piramide < 6) {
|
||||
this->pintaNumero(55, 2, info::num_piramide);
|
||||
this->pintaNumero(80, 2, info::num_habitacio);
|
||||
}
|
||||
|
||||
this->pintaNumero( 149, 2, this->info->diners / 100 );
|
||||
this->pintaNumero( 156, 2, ( this->info->diners % 100 ) / 10 );
|
||||
this->pintaNumero( 163, 2, this->info->diners % 10 );
|
||||
this->pintaNumero( 149, 2, info::diners / 100 );
|
||||
this->pintaNumero( 156, 2, ( info::diners % 100 ) / 10 );
|
||||
this->pintaNumero( 163, 2, info::diners % 10 );
|
||||
|
||||
if( this->sam->pergami ) JD8_BlitCK( 190, 1, this->gfx, 209, 185, 15, 14, 255 );
|
||||
|
||||
JD8_BlitCK( 271, 1, this->gfx, 0, 20, 15, this->info->vida*3, 255 );
|
||||
if( this->info->vida < 5 ) JD8_BlitCK( 271, 1+(this->info->vida*3), this->gfx, 75, 20, 15, 15-(this->info->vida*3), 255 );
|
||||
JD8_BlitCK( 271, 1, this->gfx, 0, 20, 15, info::vida*3, 255 );
|
||||
if( info::vida < 5 ) JD8_BlitCK( 271, 1+(info::vida*3), this->gfx, 75, 20, 15, 15-(info::vida*3), 255 );
|
||||
}
|
||||
|
||||
void Marcador::pintaNumero( Uint16 x, Uint16 y, Uint8 num ) {
|
||||
|
||||
3
marcador.h
Executable file → Normal file
@@ -8,7 +8,7 @@ class Marcador {
|
||||
|
||||
public:
|
||||
|
||||
Marcador( JD8_Surface gfx, Info* info, Prota* sam );
|
||||
Marcador( JD8_Surface gfx, Prota* sam );
|
||||
~Marcador(void);
|
||||
|
||||
void draw();
|
||||
@@ -18,7 +18,6 @@ protected:
|
||||
void pintaNumero( Uint16 x, Uint16 y, Uint8 num );
|
||||
|
||||
JD8_Surface gfx;
|
||||
Info* info;
|
||||
Prota* sam;
|
||||
|
||||
};
|
||||
|
||||
70
modulegame.cpp
Executable file → Normal file
@@ -2,22 +2,20 @@
|
||||
|
||||
#include "jgame.h"
|
||||
#include "jdraw8.h"
|
||||
#include "jsound.h"
|
||||
#include "jail_audio.h"
|
||||
#include "jinput.h"
|
||||
#include "jfile.h"
|
||||
|
||||
ModuleGame::ModuleGame( Info* info ) {
|
||||
ModuleGame::ModuleGame() {
|
||||
|
||||
this->info = info;
|
||||
|
||||
this->gfx = JD8_LoadSurface( this->info->pepe_activat ? "frames2.gif" : "frames.gif" );
|
||||
this->gfx = JD8_LoadSurface( info::pepe_activat ? "frames2.gif" : "frames.gif" );
|
||||
JG_SetUpdateTicks(10);
|
||||
|
||||
this->sam = new Prota( this->gfx, this->info );
|
||||
this->mapa = new Mapa( this->gfx, this->info, this->sam );
|
||||
this->marcador = new Marcador( this->gfx, this->info, this->sam );
|
||||
if( this->info->num_piramide == 2 ) {
|
||||
this->bola = new Bola( this->gfx, this->info, this->sam );
|
||||
this->sam = new Prota( this->gfx );
|
||||
this->mapa = new Mapa( this->gfx, this->sam );
|
||||
this->marcador = new Marcador( this->gfx, this->sam );
|
||||
if( info::num_piramide == 2 ) {
|
||||
this->bola = new Bola( this->gfx, this->sam );
|
||||
} else {
|
||||
this->bola = NULL;
|
||||
}
|
||||
@@ -49,13 +47,15 @@ int ModuleGame::Go() {
|
||||
|
||||
this->Draw();
|
||||
|
||||
const char* music = this->info->num_piramide == 3 ? "00000008.xm" : (this->info->num_piramide == 2 ? "00000007.xm" : (this->info->num_piramide == 6 ? "00000002.xm" : "00000006.xm"));
|
||||
if (!JS_MusicPlaying() || !(SDL_strcmp(music, JS_GetMusicName()) == 0)) {
|
||||
JS_LoadMusic(music);
|
||||
JS_PlayMusic(-1);
|
||||
const char* music = info::num_piramide == 3 ? "00000008.ogg" : (info::num_piramide == 2 ? "00000007.ogg" : (info::num_piramide == 6 ? "00000002.ogg" : "00000006.ogg"));
|
||||
const char *current_music = JA_GetMusicFilename();
|
||||
if ( (JA_GetMusicState()!=JA_MUSIC_PLAYING) || !(strcmp(music, current_music) == 0)) {
|
||||
int size;
|
||||
char *buffer = file_getfilebuffer(music, size);
|
||||
JA_PlayMusic(JA_LoadMusic((Uint8*)buffer, size, music));
|
||||
}
|
||||
|
||||
JD8_FadeToPal( JD8_LoadPalette(this->info->pepe_activat ? "frames2.gif" : "frames.gif") );
|
||||
JD8_FadeToPal( JD8_LoadPalette(info::pepe_activat ? "frames2.gif" : "frames.gif") );
|
||||
|
||||
while (this->final == 0 && !JG_Quitting()) {
|
||||
|
||||
@@ -66,20 +66,20 @@ int ModuleGame::Go() {
|
||||
//JS_FadeOutMusic();
|
||||
|
||||
if( this->final == 1 ) {
|
||||
this->info->num_habitacio++;
|
||||
if( this->info->num_habitacio == 6 ) {
|
||||
this->info->num_habitacio = 1;
|
||||
this->info->num_piramide++;
|
||||
info::num_habitacio++;
|
||||
if( info::num_habitacio == 6 ) {
|
||||
info::num_habitacio = 1;
|
||||
info::num_piramide++;
|
||||
}
|
||||
if (this->info->num_piramide == 6 && this->info->num_habitacio == 2) this->info->num_piramide++;
|
||||
if (info::num_piramide == 6 && info::num_habitacio == 2) info::num_piramide++;
|
||||
} else if (this->final == 2) {
|
||||
this->info->num_piramide = 100;
|
||||
info::num_piramide = 100;
|
||||
}
|
||||
|
||||
if( JG_Quitting() ) {
|
||||
return -1;
|
||||
} else {
|
||||
if (this->info->num_habitacio == 1 || this->info->num_piramide == 100 || this->info->num_piramide == 7) {
|
||||
if (info::num_habitacio == 1 || info::num_piramide == 100 || info::num_piramide == 7) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -107,27 +107,27 @@ void ModuleGame::Update() {
|
||||
Momia* seguent = this->momies->next;
|
||||
delete this->momies;
|
||||
this->momies = seguent;
|
||||
this->info->momies--;
|
||||
info::momies--;
|
||||
}
|
||||
if( this->bola != NULL ) this->bola->update();
|
||||
this->mapa->update();
|
||||
if( this->mapa->novaMomia() ) {
|
||||
if( this->momies != NULL ) {
|
||||
this->momies->insertar( new Momia( this->gfx, this->info, true, 0, 0, this->sam ) );
|
||||
this->info->momies++;
|
||||
this->momies->insertar( new Momia( this->gfx, true, 0, 0, this->sam ) );
|
||||
info::momies++;
|
||||
} else {
|
||||
this->momies = new Momia( this->gfx, this->info, true, 0, 0, this->sam );
|
||||
this->info->momies++;
|
||||
this->momies = new Momia( this->gfx, true, 0, 0, this->sam );
|
||||
info::momies++;
|
||||
}
|
||||
}
|
||||
|
||||
if( JI_CheatActivated( "reviu" ) ) this->info->vida = 5;
|
||||
if( JI_CheatActivated( "reviu" ) ) info::vida = 5;
|
||||
if( JI_CheatActivated( "alone" ) ) {
|
||||
if( this->momies != NULL ) {
|
||||
this->momies->clear();
|
||||
delete this->momies;
|
||||
this->momies = NULL;
|
||||
this->info->momies = 0;
|
||||
info::momies = 0;
|
||||
}
|
||||
}
|
||||
if( JI_CheatActivated( "obert" ) ) {
|
||||
@@ -148,17 +148,17 @@ void ModuleGame::Update() {
|
||||
|
||||
void ModuleGame::iniciarMomies() {
|
||||
|
||||
if( this->info->num_habitacio == 1 ) { this->info->momies = 1; } else { this->info->momies++; }
|
||||
if (this->info->num_piramide == 6) this->info->momies = 8;
|
||||
if( info::num_habitacio == 1 ) { info::momies = 1; } else { info::momies++; }
|
||||
if (info::num_piramide == 6) info::momies = 8;
|
||||
|
||||
int x = 20;
|
||||
int y = 170;
|
||||
bool dimonis = this->info->num_piramide == 6;
|
||||
for( int i = 0; i < info->momies; i++ ) {
|
||||
bool dimonis = info::num_piramide == 6;
|
||||
for( int i = 0; i < info::momies; i++ ) {
|
||||
if( this->momies == NULL) {
|
||||
this->momies = new Momia( this->gfx, this->info, dimonis, x, y, this->sam );
|
||||
this->momies = new Momia( this->gfx, dimonis, x, y, this->sam );
|
||||
} else {
|
||||
this->momies->insertar( new Momia( this->gfx, this->info, dimonis, x, y, this->sam ) );
|
||||
this->momies->insertar( new Momia( this->gfx, dimonis, x, y, this->sam ) );
|
||||
}
|
||||
x += 65;
|
||||
if( x == 345 ) { x = 20; y -= 35; }
|
||||
|
||||
3
modulegame.h
Executable file → Normal file
@@ -11,7 +11,7 @@ class ModuleGame {
|
||||
|
||||
public:
|
||||
|
||||
ModuleGame( Info* info );
|
||||
ModuleGame();
|
||||
~ModuleGame(void);
|
||||
|
||||
int Go();
|
||||
@@ -24,7 +24,6 @@ private:
|
||||
void iniciarMomies();
|
||||
|
||||
Uint8 final;
|
||||
Info* info;
|
||||
JD8_Surface gfx;
|
||||
|
||||
Mapa* mapa;
|
||||
|
||||
85
modulesequence.cpp
Executable file → Normal file
@@ -3,12 +3,12 @@
|
||||
#include "jgame.h"
|
||||
#include "jdraw8.h"
|
||||
#include "jinput.h"
|
||||
#include "jsound.h"
|
||||
#include "jfile.h"
|
||||
#include "jail_audio.h"
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
ModuleSequence::ModuleSequence( Info* info ) {
|
||||
this->info = info;
|
||||
ModuleSequence::ModuleSequence() {
|
||||
}
|
||||
|
||||
ModuleSequence::~ModuleSequence(void) {
|
||||
@@ -16,20 +16,20 @@ ModuleSequence::~ModuleSequence(void) {
|
||||
|
||||
int ModuleSequence::Go() {
|
||||
|
||||
if( this->info->num_piramide == 6 && this->info->diners < 200 ) this->info->num_piramide = 7;
|
||||
if( info::num_piramide == 6 && info::diners < 200 ) info::num_piramide = 7;
|
||||
|
||||
switch( this->info->num_piramide ) {
|
||||
switch( info::num_piramide ) {
|
||||
case 255: // Intro
|
||||
doIntro();
|
||||
break;
|
||||
case 0: // Menœ
|
||||
case 0: // Men<EFBFBD>
|
||||
doMenu();
|
||||
break;
|
||||
case 1: // Slides
|
||||
case 7:
|
||||
doSlides();
|
||||
break;
|
||||
case 2: // Pre-piràmide
|
||||
case 2: // Pre-pir<EFBFBD>mide
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
@@ -51,22 +51,22 @@ int ModuleSequence::Go() {
|
||||
if( JG_Quitting() ) {
|
||||
return -1;
|
||||
} else {
|
||||
if( this->info->num_piramide == 255 ) {
|
||||
this->info->num_piramide = 0;
|
||||
if( info::num_piramide == 255 ) {
|
||||
info::num_piramide = 0;
|
||||
return 1;
|
||||
} else if( this->info->num_piramide == 0 ) {
|
||||
this->info->num_piramide = 1;
|
||||
//this->info->num_piramide = 6;
|
||||
//this->info->diners = 200;
|
||||
} else if( info::num_piramide == 0 ) {
|
||||
info::num_piramide = 1;
|
||||
//info::num_piramide = 6;
|
||||
//info::diners = 200;
|
||||
return 1;
|
||||
} else if( this->info->num_piramide == 7 ) {
|
||||
this->info->num_piramide = 8;
|
||||
} else if( info::num_piramide == 7 ) {
|
||||
info::num_piramide = 8;
|
||||
return 1;
|
||||
} else if( this->info->num_piramide == 8 ) {
|
||||
this->info->num_piramide = 255;
|
||||
} else if( info::num_piramide == 8 ) {
|
||||
info::num_piramide = 255;
|
||||
return 1;
|
||||
} else if( this->info->num_piramide == 100 ) {
|
||||
this->info->num_piramide = 0;
|
||||
} else if( info::num_piramide == 100 ) {
|
||||
info::num_piramide = 0;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -80,11 +80,17 @@ const int minim( const int a, const int b ) {
|
||||
if( b < a ) { return b; } else { return a; }
|
||||
}
|
||||
|
||||
void play_music(const char *music, bool loop = -1)
|
||||
{
|
||||
int size;
|
||||
char *buffer = file_getfilebuffer(music, size);
|
||||
JA_PlayMusic(JA_LoadMusic((Uint8*)buffer, size, music), loop);
|
||||
}
|
||||
|
||||
void ModuleSequence::doIntro() {
|
||||
JG_SetUpdateTicks(1000);
|
||||
|
||||
JS_LoadMusic("00000003.xm");
|
||||
JS_PlayMusic(-1);
|
||||
play_music("00000003.ogg");
|
||||
|
||||
JD8_Surface gfx = JD8_LoadSurface( "logo.gif" );
|
||||
JD8_Palette pal = JD8_LoadPalette( "logo.gif" );
|
||||
@@ -613,7 +619,7 @@ void ModuleSequence::doMenu() {
|
||||
JD8_BlitCK( 303, 193, gfx, 305, 143, 15, 5, 255 ); // versio
|
||||
|
||||
if( contador%100 > 30 ) JD8_BlitCK( 98, 130, gfx, 161, 92, 127, 9, 255 ); // pulsa tecla...
|
||||
if ((contador % 100 > 30) && this->info->nou_personatge) JD8_BlitCK(68, 141, gfx, 128, 105, 189, 9, 255); // 'p' per a personatge nou...
|
||||
if ((contador % 100 > 30) && info::nou_personatge) JD8_BlitCK(68, 141, gfx, 128, 105, 189, 9, 255); // 'p' per a personatge nou...
|
||||
|
||||
JD8_Flip();
|
||||
|
||||
@@ -625,7 +631,7 @@ void ModuleSequence::doMenu() {
|
||||
JI_Update();
|
||||
}
|
||||
}
|
||||
this->info->pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
|
||||
info::pepe_activat = JI_KeyPressed(SDL_SCANCODE_P);
|
||||
JI_DisableKeyboard(60);
|
||||
JD8_FreeSurface( fondo );
|
||||
JD8_FreeSurface( gfx );
|
||||
@@ -637,10 +643,9 @@ void ModuleSequence::doSlides() {
|
||||
|
||||
|
||||
const char* arxiu;
|
||||
if( this->info->num_piramide == 7 ) {
|
||||
JS_LoadMusic("00000005.xm");
|
||||
JS_PlayMusic(1);
|
||||
if (this->info->diners < 200) {
|
||||
if( info::num_piramide == 7 ) {
|
||||
play_music("00000005.ogg", 1);
|
||||
if (info::diners < 200) {
|
||||
arxiu = "intro2.gif";
|
||||
} else {
|
||||
arxiu = "intro3.gif";
|
||||
@@ -700,7 +705,7 @@ void ModuleSequence::doSlides() {
|
||||
step++;
|
||||
break;
|
||||
case 8:
|
||||
if (this->info->num_piramide != 7) JS_FadeOutMusic();
|
||||
if (info::num_piramide != 7) JA_FadeOutMusic(250);
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
@@ -712,8 +717,7 @@ void ModuleSequence::doSlides() {
|
||||
}
|
||||
|
||||
void ModuleSequence::doBanner() {
|
||||
JS_LoadMusic("00000004.xm");
|
||||
JS_PlayMusic(-1);
|
||||
play_music("00000004.ogg");
|
||||
|
||||
this->contador = 5000;
|
||||
|
||||
@@ -725,7 +729,7 @@ void ModuleSequence::doBanner() {
|
||||
JD8_Blit( 81, 24, gfx, 81, 155, 168, 21 );
|
||||
JD8_Blit( 39, 150, gfx, 39, 175, 248, 20 );
|
||||
|
||||
switch( this->info->num_piramide ) {
|
||||
switch( info::num_piramide ) {
|
||||
case 2:
|
||||
JD8_Blit( 82, 60, gfx, 0, 0, 160, 75 );
|
||||
break;
|
||||
@@ -754,12 +758,11 @@ void ModuleSequence::doBanner() {
|
||||
if( contador == 0 ) exit = true;
|
||||
}
|
||||
}
|
||||
JS_FadeOutMusic();
|
||||
JA_FadeOutMusic(250);
|
||||
}
|
||||
|
||||
void ModuleSequence::doSecreta() {
|
||||
JS_LoadMusic("00000002.xm");
|
||||
JS_PlayMusic(-1);
|
||||
play_music("00000002.ogg");
|
||||
JG_SetUpdateTicks(20);
|
||||
JD8_FadeOut();
|
||||
JD8_Surface gfx = JD8_LoadSurface("tomba1.gif");
|
||||
@@ -834,7 +837,7 @@ void ModuleSequence::doSecreta() {
|
||||
JD8_FadeOut();
|
||||
memcpy(pal, pal_aux, 768);
|
||||
JD8_ClearScreen(255);
|
||||
JS_FadeOutMusic();
|
||||
JA_FadeOutMusic(250);
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
@@ -881,7 +884,7 @@ void ModuleSequence::doCredits() {
|
||||
JD8_BlitCK(100, 20, vaddr2, 85, 0, 120, 140, 0);
|
||||
}
|
||||
|
||||
if (this->info->diamants == 16) {
|
||||
if (info::diamants == 16) {
|
||||
//scroll_final_joc(vaddr3, vaddr, contador_final);
|
||||
JD8_BlitCKScroll(50, vaddr3, ((contador >> 3) % 320) + 1, 0, 50, 255);
|
||||
JD8_BlitCKScroll(50, vaddr3, ((contador >> 2) % 320) + 1, 50, 50, 255);
|
||||
@@ -905,19 +908,18 @@ void ModuleSequence::doCredits() {
|
||||
FILE* ini = fopen("trick.ini", "wb");
|
||||
fwrite("1", 1, 1, ini);
|
||||
fclose(ini);
|
||||
this->info->nou_personatge = true;
|
||||
info::nou_personatge = true;
|
||||
|
||||
JD8_FreeSurface(vaddr3);
|
||||
JD8_FreeSurface(vaddr2);
|
||||
}
|
||||
|
||||
void ModuleSequence::doMort() {
|
||||
JS_LoadMusic("00000001.xm");
|
||||
JS_PlayMusic(1);
|
||||
play_music("00000001.ogg");
|
||||
|
||||
JI_DisableKeyboard(60);
|
||||
|
||||
this->info->vida = 5;
|
||||
info::vida = 5;
|
||||
this->contador = 1000;
|
||||
|
||||
JD8_Surface gfx = JD8_LoadSurface( "gameover.gif" );
|
||||
@@ -942,7 +944,6 @@ void ModuleSequence::doMort() {
|
||||
if( contador == 0 ) exit = true;
|
||||
}
|
||||
}
|
||||
JS_LoadMusic("00000003.xm");
|
||||
JS_PlayMusic(-1);
|
||||
play_music("00000003.ogg");
|
||||
}
|
||||
|
||||
|
||||
3
modulesequence.h
Executable file → Normal file
@@ -6,7 +6,7 @@ class ModuleSequence {
|
||||
|
||||
public:
|
||||
|
||||
ModuleSequence( Info* info );
|
||||
ModuleSequence();
|
||||
~ModuleSequence(void);
|
||||
|
||||
int Go();
|
||||
@@ -21,6 +21,5 @@ private:
|
||||
void doCredits();
|
||||
void doMort();
|
||||
|
||||
Info* info;
|
||||
int contador;
|
||||
};
|
||||
|
||||
15
momia.cpp
Executable file → Normal file
@@ -2,8 +2,7 @@
|
||||
#include "jgame.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Momia::Momia( JD8_Surface gfx, Info* info, bool dimoni, Uint16 x, Uint16 y, Prota* sam ) : Sprite( gfx ) {
|
||||
this->info = info;
|
||||
Momia::Momia( JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam ) : Sprite( gfx ) {
|
||||
this->dimoni = dimoni;
|
||||
this->sam = sam;
|
||||
|
||||
@@ -16,7 +15,7 @@ Momia::Momia( JD8_Surface gfx, Info* info, bool dimoni, Uint16 x, Uint16 y, Prot
|
||||
for( int x = 0; x < 5; x++ ) {
|
||||
this->entitat->frames[frame].w = 15;
|
||||
this->entitat->frames[frame].h = 15;
|
||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
this->entitat->frames[frame].x = (x*15)+75;
|
||||
if( this->dimoni ) this->entitat->frames[frame].x += 75;
|
||||
this->entitat->frames[frame].y = 20+(y*15);
|
||||
@@ -83,7 +82,7 @@ void Momia::draw() {
|
||||
|
||||
Sprite::draw();
|
||||
|
||||
if( this->info->num_piramide == 4 ) {
|
||||
if( info::num_piramide == 4 ) {
|
||||
if( ( JG_GetCycleCounter() % 40 ) < 20 ) {
|
||||
JD8_BlitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255 );
|
||||
} else {
|
||||
@@ -104,7 +103,7 @@ bool Momia::update() {
|
||||
this->engendro = NULL;
|
||||
}
|
||||
} else {
|
||||
if( this->sam->o < 4 && ( this->dimoni || this->info->num_piramide == 5 || JG_GetCycleCounter()%2 == 0 ) ) {
|
||||
if( this->sam->o < 4 && ( this->dimoni || info::num_piramide == 5 || JG_GetCycleCounter()%2 == 0 ) ) {
|
||||
|
||||
if( ( this->x - 20 ) % 65 == 0 && ( this->y - 30 ) % 35 == 0 ) {
|
||||
if( this->dimoni ) {
|
||||
@@ -149,8 +148,8 @@ bool Momia::update() {
|
||||
if( this->sam->pergami ) {
|
||||
this->sam->pergami = false;
|
||||
} else {
|
||||
this->info->vida--;
|
||||
if( this->info->vida == 0 ) this->sam->o = 5;
|
||||
info::vida--;
|
||||
if( info::vida == 0 ) this->sam->o = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +160,7 @@ bool Momia::update() {
|
||||
Momia* seguent = this->next->next;
|
||||
delete this->next;
|
||||
this->next = seguent;
|
||||
this->info->momies--;
|
||||
info::momies--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
momia.h
Executable file → Normal file
@@ -9,7 +9,7 @@ class Momia : public Sprite {
|
||||
|
||||
public:
|
||||
|
||||
Momia( JD8_Surface gfx, Info* info, bool dimoni, Uint16 x, Uint16 y, Prota* sam );
|
||||
Momia( JD8_Surface gfx, bool dimoni, Uint16 x, Uint16 y, Prota* sam );
|
||||
|
||||
void clear();
|
||||
void draw();
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
protected:
|
||||
|
||||
Prota* sam;
|
||||
Info* info;
|
||||
Engendro* engendro;
|
||||
|
||||
};
|
||||
|
||||
58
prota.cpp
Executable file → Normal file
@@ -1,9 +1,9 @@
|
||||
#include "prota.h"
|
||||
#include "jgame.h"
|
||||
#include "jinput.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
||||
this->info = info;
|
||||
Prota::Prota( JD8_Surface gfx ) : Sprite( gfx ) {
|
||||
|
||||
this->entitat = (Entitat*)malloc( sizeof( Entitat ) );
|
||||
this->entitat->num_frames = 82;
|
||||
@@ -13,7 +13,7 @@ Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
||||
for( int x = 0; x < 5; x++ ) {
|
||||
this->entitat->frames[frame].w = 15;
|
||||
this->entitat->frames[frame].h = 15;
|
||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
this->entitat->frames[frame].x = x*15;
|
||||
this->entitat->frames[frame].y = 20+(y*15);
|
||||
frame++;
|
||||
@@ -25,7 +25,7 @@ Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
||||
if( x != 300 || y != 155 ) {
|
||||
this->entitat->frames[frame].w = 15;
|
||||
this->entitat->frames[frame].h = 30;
|
||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
this->entitat->frames[frame].x = x;
|
||||
this->entitat->frames[frame].y = y;
|
||||
frame++;
|
||||
@@ -36,7 +36,7 @@ Prota::Prota( JD8_Surface gfx, Info* info ) : Sprite( gfx ) {
|
||||
for( int x = 225; x < 315; x+=15 ) {
|
||||
this->entitat->frames[frame].w = 15;
|
||||
this->entitat->frames[frame].h = 15;
|
||||
if( this->info->num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
if( info::num_piramide == 4 ) this->entitat->frames[frame].h -= 5;
|
||||
this->entitat->frames[frame].x = x;
|
||||
this->entitat->frames[frame].y = y;
|
||||
frame++;
|
||||
@@ -79,7 +79,7 @@ void Prota::draw() {
|
||||
|
||||
Sprite::draw();
|
||||
|
||||
if( this->info->num_piramide == 4 && this->o != 4) {
|
||||
if( info::num_piramide == 4 && this->o != 4) {
|
||||
if( ( JG_GetCycleCounter() % 40 ) < 20 ) {
|
||||
JD8_BlitCK(this->x, this->y, this->gfx, 220, 80, 15, 15, 255 );
|
||||
} else {
|
||||
@@ -93,54 +93,40 @@ Uint8 Prota::update() {
|
||||
Uint8 eixir = 0;
|
||||
|
||||
if( this->o < 4 ) {
|
||||
Uint8 dir = 0;
|
||||
Uint8 dir = 4;
|
||||
if ( JI_KeyPressed(SDL_SCANCODE_DOWN) ) {
|
||||
if( (this->x-20)%65 == 0 ) {
|
||||
this->o = 0;
|
||||
dir = 1;
|
||||
} else {
|
||||
dir = this->o + 1;
|
||||
}
|
||||
if( (this->x-20)%65 == 0 ) this->o = 0;
|
||||
dir = this->o;
|
||||
}
|
||||
if ( JI_KeyPressed(SDL_SCANCODE_UP) ) {
|
||||
if( (this->x-20)%65 == 0 ) {
|
||||
this->o = 1;
|
||||
dir = 2;
|
||||
} else {
|
||||
dir = this->o + 1;
|
||||
}
|
||||
if( (this->x-20)%65 == 0 ) this->o = 1;
|
||||
dir = this->o;
|
||||
}
|
||||
if( JI_KeyPressed( SDL_SCANCODE_RIGHT ) ) {
|
||||
if( (this->y-30)%35 == 0 ) {
|
||||
this->o = 2;
|
||||
dir = 3;
|
||||
} else {
|
||||
dir = this->o + 1;
|
||||
}
|
||||
if( (this->y-30)%35 == 0 ) this->o = 2;
|
||||
dir = this->o;
|
||||
}
|
||||
if( JI_KeyPressed( SDL_SCANCODE_LEFT ) ) {
|
||||
if( (this->y-30)%35 == 0 ) {
|
||||
this->o = 3;
|
||||
dir = 4;
|
||||
} else {
|
||||
dir = this->o + 1;
|
||||
}
|
||||
if( (this->y-30)%35 == 0 ) this->o = 3;
|
||||
dir = this->o;
|
||||
}
|
||||
|
||||
switch( dir ) {
|
||||
case 1:
|
||||
case 0:
|
||||
if( this->y < 170 ) this->y++;
|
||||
break;
|
||||
case 2:
|
||||
case 1:
|
||||
if( this->y > 30 ) this->y--;
|
||||
break;
|
||||
case 3:
|
||||
case 2:
|
||||
if( this->x < 280 ) this->x++;
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
if( this->x > 20 ) this->x--;
|
||||
break;
|
||||
}
|
||||
if( dir == 0 ) {
|
||||
|
||||
if( dir == 4 ) {
|
||||
this->cur_frame = 0;
|
||||
} else {
|
||||
this->frame_pejades++;
|
||||
|
||||
3
prota.h
Executable file → Normal file
@@ -7,7 +7,7 @@ class Prota : public Sprite {
|
||||
|
||||
public:
|
||||
|
||||
Prota( JD8_Surface gfx, Info* info );
|
||||
Prota( JD8_Surface gfx );
|
||||
|
||||
void draw();
|
||||
Uint8 update();
|
||||
@@ -17,6 +17,5 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
Info* info;
|
||||
|
||||
};
|
||||
|
||||
1
sprite.cpp
Executable file → Normal file
@@ -1,4 +1,5 @@
|
||||
#include "sprite.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
Sprite::Sprite( JD8_Surface gfx ) {
|
||||
|
||||
|
||||