Commit Graph

507 Commits

Author SHA1 Message Date
Jonas Kulla b963c67339 SharedState: Don't reallocate global tex on every bind 2014-12-31 18:52:20 +01:00
Jonas Kulla ee17bb2137 Call glReleaseShaderCompiler on GLES 2014-12-31 18:52:20 +01:00
Jonas Kulla 3fb4108306 gl-fun.h: Add some enums missing in gl2.h 2014-12-31 18:52:20 +01:00
Jonas Kulla fcfa079e7b Perform chdir(gameFolder) early in main() 2014-12-31 18:52:20 +01:00
Jonas Kulla 03a6c657c4 main.cpp: Always display errors in a message box 2014-12-31 18:52:20 +01:00
Jonas Kulla 373b90af00 Graphics: Optimize Viewport effect rendering
Using the kitchen sink plane shader for viewport effects, even
if only a small part of them are active, incurs great performance
loss on mobile, so split the rendering into multiple optional
passes which additionally use the blending hardware for faster
mixing (lerping).
Also, don't mirror the PingPong textures if the viewport effect
covers the entire screen area anyway.
2014-12-31 18:52:19 +01:00
Jonas Kulla 3c0a530eba Sprite: Add special case shader for translucent effect
Translucent sprites (opacity < 255) are very common,
so using a custom shader instead of the full blown effect one
helps a lot, especially on mobile.
2014-12-31 18:52:19 +01:00
Jonas Kulla a53163660f Shader: Refine preprocessing on GLES platform
Don't globally set float precision to mediump, only fragment
shaders need that and defining it for vertex shaders causes
tilemap cracks.

Also manually define low precision for variables that hold
color / alpha values.
2014-12-31 18:52:19 +01:00
Jonas Kulla 02f19c03c9 Merge pull request #86 from Daverball/controller-fix
Xbox controllers require JoyHat events to be tracked on windows
2014-12-31 18:50:57 +01:00
David Salvisberg 90e1c09711 Added support for JHat events. 2014-12-31 16:39:28 +01:00
Jonas Kulla 150abff1c0 Merge pull request #85 from Daverball/save-button-config
Button config menu should save config to disk whenever changes are accepted.
2014-12-31 14:13:53 +01:00
David Salvisberg b1e1d28879 Added rudimentary support for font outlines. 2014-12-31 13:49:18 +01:00
David Salvisberg 6829ddc09f Removed store keybindings from main, since it now already gets stored onAccept. 2014-12-28 06:06:28 +01:00
David Salvisberg 7413c3d994 Make button config menu save changes to disk whenever the changes are accepted. 2014-12-27 14:40:08 +01:00
Jonas Kulla 11cfe887c2 Fix several classes not accepting disposed bitmaps
Fixes an error in Alpha Kimori.
2014-12-22 08:22:45 +01:00
Jonas Kulla 98b0b71359 Don't use relative paths when #including xxd output 2014-11-30 17:50:24 +01:00
Jonas Kulla 60f101f2e6 Tilemap(VX): Factor out common code into tilemap-common.h
Renamed flashmap.h to tilemap-common.h as it already contained
shared functions.
2014-11-30 17:46:28 +01:00
Jonas Kulla f00cb60707 debugwriter.h: Use unbuffered cerr instead of clog 2014-11-29 17:55:18 +01:00
Jonas Kulla c1aab96454 Rename src/debuglogger -> src/gl-debug 2014-11-29 17:51:37 +01:00
Jonas Kulla bc31922c33 Allow inserting GL string markers (GREMEDY_string_marker) 2014-11-29 17:33:39 +01:00
Jonas Kulla 5979c5f778 Add placeholder application icon 2014-11-29 17:30:53 +01:00
Jonas Kulla c2f8b6b749 SettingsMenu: Fix help label sometimes not appearing 2014-11-28 06:04:34 +01:00
Jonas Kulla 276160f0d5 gl-fun.h: Fix compilation with outdated SDL headers 2014-11-22 17:03:16 +01:00
Jonas Kulla f236e34e2d Serializable, Table: Some general cleanups 2014-11-20 14:45:54 +01:00
Jonas Kulla 9ac14800da Keybindings: SDL_GetPrefPath result always ends with separator 2014-11-17 07:24:22 +01:00
Jonas Kulla 5c3f4b905a Use fopen with binary mode everywhere (for Windows compat) 2014-11-17 07:18:39 +01:00
Jonas Kulla f7a3e3c5d2 Table: General clean up and code reduction
- Use STL vector instead of doing manual mallocs
- Throw away the resize optimizations; hardly useful
- Marshal.dump data layout is the same as ours (in LE),
  so we can just memcpy everything instead of copying
  one by one

Throwing away part of the very first code I wrote for mkxp
felt very refreshing I must say.
2014-11-02 23:37:35 +01:00
Jonas Kulla a98ad3134b TilemapVX: Implement flash tiles 2014-10-27 15:52:41 +01:00
Jonas Kulla 577f606dac Tilemap: Factor out flash tile code
This will be reused later in TilemapVX.
2014-10-26 20:00:56 +01:00
Jonas Kulla 05b32d76ca Minor cleanup 2014-10-25 23:38:19 +02:00
Jonas Kulla c9d5059238 Pass value object attributes by reference (instead of pointer)
This underlines that no reference inside the setter is taken,
and that these attributes are non-nullable.

Also removes a couple of superfluous attribute macros.
2014-10-25 23:33:41 +02:00
Jonas Kulla 8e1852a281 Remove left-over dead code 2014-10-21 19:51:08 +02:00
Jonas Kulla 4a8b0f30c8 MRI: Add 'System.raw_key_states' to query full keyboard state
Returns a byte array with all key states (0 = released,
1 = pressed) indexed via SDL_SCANCODE_* enums.
2014-10-20 10:27:01 +02:00
Jonas Kulla e44a1e32fa Reorder some lines 2014-10-20 10:20:08 +02:00
Jonas Kulla 6145c59305 fluid-fun: Don't dlclose libfluidsynth, ever
Some versions of the library do nasty things with thread
local storage without cleaning up after themselves.
2014-10-20 10:17:48 +02:00
Jonas Kulla 5094f5c7c1 Add minor assert 2014-10-16 09:10:27 +02:00
Jonas Kulla 2cd70b9edd Window: Don't update anything if width*height == 0
Fixes GL errors.
2014-10-15 06:26:46 +02:00
Jonas Kulla dd73db2e9d Introduce F1 menu to reconfigure key bindings at runtime 2014-10-11 20:48:44 +02:00
Jonas Kulla 520162f36a Use safe way to get at a vector's data pointer
&std::vector<C>[0] is not guaranteed to not throw if the
vector is empty. Better safe than sorry.
2014-10-09 19:02:29 +02:00
Jonas Kulla 1b7ed5ed78 Font: Fix default 'shadow' value for RGSS1 2014-10-09 18:53:24 +02:00
Jonas Kulla 0c08fc2d16 gl-fun.h: Fix function type signature 2014-10-06 21:10:19 +02:00
Jonas Kulla df73045d81 TileAtlasVX: Followup fix
Use rectangle intersection to correctly clip source
rectangles with origin != (0,0).
2014-10-03 06:51:39 +02:00
Jonas Kulla db78e55371 TileAtlasVX: Clamp blit src rect to tileset bitmap size 2014-10-02 16:41:53 +02:00
Jonas Kulla 95cda4035e fluid-fun: Fix fluidsynth soname on OSX 2014-10-01 19:19:25 +02:00
Jonas Kulla fa911b8018 gl-fun: Don't rely on SDL_opengl.h for function type definitions 2014-10-01 04:48:23 +02:00
Jonas Kulla 51a0f3903c Audio: Clean up threading and add AudioStream fadein (RGSS3) 2014-09-30 09:13:12 +02:00
Jonas Kulla 4a015c6397 Bitmap: Add font shadow rendering 2014-09-29 10:30:41 +02:00
Jonas Kulla 9e64dff01c Bitmap: Fix mem leak 2014-09-29 10:30:16 +02:00
Jonas Kulla 9758e660c4 Tilemap/VX: Ensure proxy objects don't outlive their parents
Either of these would previously crash (same for VX):

tm = Tilemap.new
at = tm.autotiles
tm = nil
GC.start
at[0] = Bitmap.new(1, 1)

tm = Tilemap.new
at = tm.autotiles
tm.dispose
at[0] = Bitmap.new(1, 1)

Funnily, this makes RMXP itself crash too, but crashing is
never acceptable except for possibly resource exhaustion.
2014-09-26 18:21:50 +02:00
Jonas Kulla d223d83cbf Implement F12 game reset (MRI only)
Can be disabled with "enableReset=false".

While at it, also replace the flakey volatile bool flags
with proper atomics.
2014-09-26 06:25:47 +02:00
Jonas Kulla 3a2e560139 Input: Fix default keybinds 2014-09-26 06:25:47 +02:00
Jonas Kulla 2550fd8ccc WindowVX: Initialize all dirty flags and connect tmp tone 2014-09-26 06:24:43 +02:00
Jonas Kulla 81ac0780f8 Revert Disposable concept back into core
Pretty much a revert of
e858bbdcf5.

We need this in core to properly implement F12 reset.
2014-09-23 21:12:58 +02:00
Jonas Kulla 3983fe66e9 Config: Print parsing errors instead of ignoring them 2014-09-23 19:23:11 +02:00
Jonas Kulla 17efcbbbbd tl;dr: I fucking suck at coding (fix double free)
MRI: Filesystem: A garbage collected SDL_RWops file handle
will call close on itself even if 'close' was explicitly
called on it on the script side before.
2014-09-23 17:26:30 +02:00
Jonas Kulla 757a1d5e39 Load fluidsynth entrypoints dynamically (and make them optional)
This removes the static dependency on fluidsynth being present
at buildtime (even headers aren't needed anymore).

Even though midi is a default format for the RPG XP/VX series,
it has fallen more and more out of use, with VX Ace completely
abandoning it from the RTP and making ogg vorbis the de facto
standard. Midi support is kept for legacy reasons, but isn't
encouraged. On top of all this, fluidsynth together with glib
is a heavy dependency that often times won't even be used.
Making it optional at build time is an attempt to unify and
keep build config fragmentation low.

In RGSS3, fluidsynth / midi is not initialized at all by
default, but rather on demand when either a midi track is
played back or Audio.setup_midi is called.
2014-09-09 00:08:32 +02:00
Jonas Kulla 673a25f811 Bitmap: Don't use 'pixman_region_clear'
It's not included in older pixman versions.
2014-09-07 19:11:20 +02:00
Jonas Kulla ac9b98157e TilemapVX: Use SimpleShader for unanimated ground layers
Also remove some useless member variables.
2014-09-06 22:02:00 +02:00
Jonas Kulla 6bc3460294 Core, MRI: Don't expose RGSS3 functionality in 2 2014-09-06 02:01:20 +02:00
Jonas Kulla 7f41b9cc45 Config: Correctly setup rgssVer / screen size with customScript 2014-09-05 21:54:16 +02:00
Jonas Kulla f8c26fc515 Core/MRI: Fix handling of Etc/Font properties
The gist of it is that for Etc and Font props, the assignment
operator (eg. 'sprite.color=') does not take a reference of the
right hand parameter and replaces its previous one with it (this
was the old behavior). Rather, it keeps its internal property
object and copies the parameter object into it by value.
The getter is unchanged; it still returns a reference to the
internal property object.

s = Sprite.new
c = Color.new
s.color = c
p s.color == c # => true
p s.color.object_id == c.object_id # => false (true before)
c = s.color
p s.color.object_id == c.object_id # => true
2014-09-05 01:58:41 +02:00
Jonas Kulla f665d8b41c BoostSet: Add 'remove' and rename BoostHash::erase to remove
This is more consistent with Qt's method naming.
2014-09-05 01:06:08 +02:00
Jonas Kulla 10186e8dcc Input: Fix isRepeated off-by-one error and do small optim. 2014-09-03 02:35:57 +02:00
cremno 4b08eee81f add RGSS2/3 Input.repeat? 2014-09-02 19:14:05 +02:00
Jonas Kulla d8bb6aa2fc Replicate RMVX/VXA's broken sprite Z sorting implementation
Fixes Window_NameBox visual appearance in Skyborn.

Also nuke the second SceneElement constructor that has been
obsolete since the Tilemap mapViewport rewrite.
2014-08-31 01:10:32 +02:00
Jonas Kulla 1a98760b31 Config: Properly clamp rgssVersion to allowed range 2014-08-30 12:00:56 +02:00
Jonas Kulla 3da785b293 FileSystem: RGSS2 means ogg vorbis support is always available 2014-08-30 12:00:56 +02:00
Jonas Kulla 6d414c0777 Print RGSS version on startup 2014-08-29 03:16:12 +02:00
Jonas Kulla 55f1542c76 Merge separate RGSS version build configs into one
Setup active RGSS version at runtime. Desired version can be
specified via config, or as default, auto detected from the game
files. This removes the need to build specifically for each
version, which should help packaging a lot.

This also greatly reduces the danger of introducing code that
wouldn't compile on all RGSS version paths (as certain code paths
were completely ifdef'd out).

This can be optimized more, eg. not compiling shaders that aren't
needed in the active version.
2014-08-28 23:22:05 +02:00
Jonas Kulla b1981055e1 Core: Remove ifdefs that don't influence RGSS specific behavior
This is the first step in eliminating the build time RGSS
versioning.
2014-08-28 19:43:13 +02:00
Jonas Kulla 28421a0ce5 Tilemap: Remove RGSS2 viewport setter
This class is not used in RGSS2 at all.
2014-08-28 15:37:04 +02:00
Jonas Kulla c88b4b03d6 Bitmap: Fix blitshader draw_text path not taking squeezing into account 2014-08-28 14:53:28 +02:00
Jonas Kulla 20081cb07e Wrap include in feature macro 2014-08-28 11:27:36 +02:00
Jonas Kulla 7bcc31fb53 Silence "unused param" warning in release mode 2014-08-28 11:26:20 +02:00
Jonas Kulla 18c74e0f24 SoundEmitter: Only detach/attach buffer if necessary 2014-08-25 05:35:46 +02:00
Jonas Kulla b1ebc655f9 SoundEmitter: Make SE source count configurable
Default is still 6.
2014-08-25 05:34:19 +02:00
Jonas Kulla 5ee62ba0fd SoundEmitter: Optimize source allocation strategy a bit
If no source is free, instead of seizing the lowest priority one,
first try to find the lowest priority source with the same buffer
that is about to be played and use it. Otherwise, take lowest priority
one as before.
2014-08-24 09:19:54 +02:00
Jonas Kulla ce72e6d0ee Input: Fix keyboard bindings (RGSS1 and 2 differ), add numpad enter -> C binding 2014-08-24 08:03:12 +02:00
Jonas Kulla 117ddeee5c Config: Add 'preloadScript' entry to run raw scripts before the game scripts
Useful to insert common code, wrappers etc. without touching Scripts.rxdata.
2014-08-24 07:32:44 +02:00
Jonas Kulla 3968ebb538 Graphics: Transition without previous freeze is a noop 2014-08-23 21:26:50 +02:00
Jonas Kulla b380a0ebdd SharedState: Fix asset path priority (rgssad -> "." -> RTPs) 2014-08-22 23:58:14 +02:00
Jonas Kulla b751858b16 Graphics: Fadein/out should interpolate from current brightness 2014-08-22 23:57:12 +02:00
Jonas Kulla 24ad0990da TilemapVX: Deal correctly with Graphics.resize_screen 2014-08-22 23:57:12 +02:00
Jonas Kulla 50e393fe6e Graphics: Fix resize_screen 2014-08-22 23:57:12 +02:00
Jonas Kulla c5c58fa9cd SoundEmitter: Show filename that caused the SDL_Sound error 2014-08-22 23:50:52 +02:00
Jonas Kulla 10bfcb57b7 Config: Convert game title to valid UTF-8 (if it isn't already)
Removes the need to manually convert the Game.ini to UTF-8 every
time with eg. Japanese games. Also, setting the window title on
OSX with invalid UTF-8 crashes.

This functionality and the dependency on libiconv and libguess
are optional and can be enabled with `CONFIG+=INI_ENCODING`.
If turned off and invalid UTF-8 is encountered, the game title
is treated as being empty (ie. the folder name is used instead).
2014-08-20 23:32:18 +02:00
Jonas Kulla 622845a404 TileAtlasVX: Handle table autotiles properly 2014-08-19 19:47:22 +02:00
Jonas Kulla fb2b2b7260 WindowVX: Fix scroll arrows not showing initially 2014-08-19 19:47:22 +02:00
Jonas Kulla 0c72659025 Remove stale code 2014-08-19 19:47:22 +02:00
Mathew f89216368d NFD filename translation on OS X 2014-08-19 10:57:03 -04:00
Jonas Kulla 7452331e04 Bitmap: Normalize rect passed to glState.scissorBox
glScissorBox doesn't like negative values.
2014-08-17 15:43:03 +02:00
Jonas Kulla 724d52f61e Tilemap: Finally get rid of that terrible name 'ScanRow'
Replacement: ZLayer
I'd really have loved to have used something alluding to physical
roof tiles (as that's the closest image I have to them), but without
reusing the word "tiles".. yeah, impossible.
2014-08-17 03:58:01 +02:00
Jonas Kulla 9311aff017 Bitmap: Draw line feed and carriage return as whitespace 2014-08-17 03:07:53 +02:00
Jonas Kulla 52e2f2304a Spacing 2014-08-17 00:27:08 +02:00
Jonas Kulla f0e045d057 Font: Add RGSS2 default values 2014-08-17 00:27:07 +02:00
Jonas Kulla 4daff93e29 Put bundled font into its own translation unit 2014-08-17 00:26:35 +02:00
Jonas Kulla cbdd19e525 WindowVX: Make more compatible with RGSS2 2014-08-16 22:32:06 +02:00
Jonas Kulla 8042289291 WindowVX: Fix window resizing from big to small 2014-08-16 20:11:46 +02:00
Jonas Kulla e7882c0d3e Plane: Fix screen shaking in wrong direction 2014-08-16 16:14:00 +02:00
Jonas Kulla 9c421aed45 Add minor comments 2014-08-16 16:14:00 +02:00