1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-03 00:15:46 +00:00
Commit graph

44 commits

Author SHA1 Message Date
Valentin Ochs
f9357e7fca Merge branch 'gccwarn' into controllerfixup 2017-01-17 11:15:47 +01:00
Valentin Ochs
fe0ab0418b Get rid of a lot of gcc warnings
Mostly signed/unsigned comparisons. Also some bugs, but I don't remember
where :D
2017-01-14 18:10:20 +01:00
fgenesis
8472718fb7 Major include refactor; changes to pretty much everything
This untangles some of the gigantic kitchen sink headers
in an attempt to split things into smaller files.
Also don't include gl.h, glext.h, windows.h,
and other such nonsense *everywhere*.

Lots of cleanups on the way too. More dead/unused code removal.

Remove incrFlag(), decrFlag() Lua functions.
2016-07-09 04:18:40 +02:00
fgenesis
9414be864a Huge Game.cpp refactor and various other things
Started working on a tiny input/ActionMapper refactor,
then everything fell apart and i ended up doing this.
I'm sorry.

Pretty much untested because input mapping is broken right now,
will fix that next.
2016-06-30 02:58:55 +02:00
Nicolas Braud-Santoni
eb128e65a4 Remove commented-out code 2016-05-05 19:57:50 +02:00
fgenesis
ce7239056b Minimap icon overhaul:
- Allow specifying custom minimap icons for nodes and entities
- Allow overriding minimap textures
- This removes various hacks in MiniMapRender and related
- Allow access to the MiniMapRender object via Lua
  (don't delete it or the game will crash)

Little extra: Added destructors for some entity classes
2016-03-21 03:40:56 +01:00
fgenesis
f55a70b459 Give script-spawned entities a negative ID.
This should prevent most ID conflicts and problems related to that,
e.g. spurious changes to entity positions while working on a map.
2015-11-29 21:43:21 +01:00
fgenesis
209964034d Make maxSpeed float, little cleanup, minor Lua API stuff
Plus additional functions that don't use speed types:
+ entity_followPathSpeed()
+ entity_moveToNodeSpeed()
+ entity_swimToNodeSpeed()
+ entity_swimToPositionSpeed()

The following old functions (plus all of the above) return float now
(how long moving will take):

* entity_followPath()
* entity_moveToNode()
* entity_swimToNode)
* entity_swimToPosition()
2015-06-12 02:59:01 +02:00
fgenesis
35c8086802 Some changed to pathfinding. This hopefully gets rid of spikes in very short paths. Some untested changes. 2014-07-21 22:20:08 +02:00
James Le Cuirot
43d41feeb8 Migrate from TinyXML v1 to v2. Not bundled (yet). 2014-06-08 21:11:23 +01:00
fgenesis
209ad526c6 Add canShotHit() interface function
Let entity decide if it wants to collide with shot or not.
2014-04-01 18:16:33 +02:00
fgenesis
429f612065 Get rid of some unnecessary float<->int casts + some new Lua functions:
- filterNearestEntitiesAdd()
- getEntityToActivate()
- setEntityToActivate()
- hasThingToActivate()
2014-02-23 18:27:42 +01:00
fgenesis
b0c098bbcd Compile fix for prev. commit 2013-10-21 02:34:30 +02:00
fgenesis
36c409e1d4 Little things:
- Make ACTION_LOOK and ACTION_ROLL available to handle via nodes
- Add entity_getPushVec()
- Fix typo in beam_setFirer()
- Add pull param to addInfluence()
- Add entity_getPushDamage()
- Add getMouseWheelChange()
2013-09-28 17:21:11 +02:00
fgenesis
a91a22f463 Cleaning out some dead code.
This adds a small compile error, to be fixed in next commit.
2013-09-04 16:07:46 +02:00
fgenesis
fefb30a7b3 Allow entities and nodes to update while the game is paused.
Added Lua functions:
- node_setPauseFreeze()
- entity_setPauseFreeze()
- getFPS()

Also fixed possible crash in entity_setStateTime().
2013-08-26 20:56:34 +02:00
fgenesis
e6680da428 Implemenet proper positional audio, one issue still.
With this patch, entities can serve as a sound source whose position
updates relative to the listener. This implements the last missing
feature of my previous positional audio patch, which is moving sound sources.
Previously, all sounds were relative to the listener with the listener
centered at (0, 0, 0), and once a sound started playing, the position could
not be changed. Volume was set as an estimation of the distance to the listener.

These restrictions are now gone; OpenAL will handle the volume & panning
based on the distance.

The remaining problem is that stereo sounds are not attenuated, at all.

Lua additions:
- playSfx() takes an additional parameter now.
- entity_setStopSoundsOnDeath()
2013-07-22 03:29:57 +02:00
fgenesis
7fb9204e97 Minor changes & simplifications to Lua interface. 5 new functions.
This changes all typical vector interpolation functions that get
value, time, loopType, pingPong, ease as args from the Lua state;
use unified functions for all value type occurances.
This fixes the slightly annoying problem that it was not possible to
pass a boolean true to pingPong or ease, because lua_tonumber() would
always return 0 in that case.

Also changed:
- obj_getWorldPosition() now takes optional x,y-vector

New:
- obj_getWorldPositionAndRotation() is a more efficient shortcut,
	as often both position and rotation are retrieved together,
	and the underlying matrix chain operation is rather expensive.
- entity_getEmitter()
- entity_getNumEmitters()
- setSceneColor2()
- getSceneColor2()
2013-07-20 17:44:27 +02:00
fgenesis
c62d9f2370 Re-introduce AfterEffect shader functonality, part 1.
This repairs pixel/vertex shader code that was seemingly
experimented with during testing, but it was never used and no
shaders ever made it to the data files.
2013-05-10 22:22:35 +02:00
fgenesis
e8a7889f82 Decouple form specific effects from the actual form.
Most hardcoded form == FORM_* checks all over the place have been replaced.
Now, forms change certain avatar properties, which are in turn checked
in the places that previously had these explicit form checks.
This allows specifying functionality via scripting, for additional forms
with new effects or a new combination of existing effects.

OT_HURT now deals damage of type DT_WALLHURT,
and by setting avatar->setDamageTarget(DT_WALLHURT, false) collision
with walls can be made harmless (exactly as nature form used to be).

Add related Lua functions:
+ setWorldType() - Change WT without actually switching to spirit form
+ setCanActivate()
+ avatar_setCanBurst()
+ avatar_canBurst()
+ avatar_setCanLockToWall()
+ avatar_canLockToWall()
+ avatar_setCanSwimAgainstCurrents()
+ avatar_canSwimAgainstCurrents()
+ getSceneColor()
+ DT_WALLHURT
2013-04-26 00:34:06 +02:00
fgenesis
3ed40e73d3 Minor refactor & add Lua funcs:
+ avatar_setShieldActive()
+ entity_isFillGrid()
* entity_setBoneLock() code made easier to read and not warn on no lock entity
+ entity_getMaxSpeedLerp()
+ entity_isEntityInside()
2013-04-24 04:51:26 +02:00
fgenesis
0490afe7a2 Script interface additions:
+ entity_isDeathScene()
+ getNearestEntity()
+ entity_getDistanceToPoint()
Add color transition time parameter to fade(), fade2(), fade3()
2013-04-22 23:38:10 +02:00
fgenesis
ab6e92f256 Add EV_NOAVOID and bone_lookAtPosition() 2013-02-06 21:01:22 +01:00
fgenesis
4433237f3a Add more script functions + little fix in entity poisoning
shot_getEffectTime()
shot_isIgnoreShield()
shot_getFirer()
shot_setTarget()
shot_getTarget()
getLastCollideTileType()
collideCircleWithGrid()
entity_getMaxHealth()
entity_setPoison()
entity_getPoison()
OT_* constants
2013-02-04 15:16:57 +01:00
fgenesis
76c31f8147 minor fixups (Entity::revive() and some skeletal stuff) 2013-02-03 16:13:07 +01:00
fgenesis
32aca3b768 Move hair functions to Entity; add quad_setSegs() & obj_setRealRenderPass() 2013-01-03 00:36:24 +01:00
fgenesis
9eb5b9828a clean out some dead code and some old commented out code 2012-12-19 06:23:51 +01:00
fgenesis
ad4bc9bd21 Revert "Changed a bunch of enums in Entity.h"
This reverts commit 8b67ece907.
2012-12-15 22:46:39 +01:00
fgenesis
0f13f08357 Remove unused stuff
- entity group IDs
- entity node groups (?!)
- WaterFont.[cpp|h]
2012-12-13 19:57:30 +01:00
fgenesis
8b67ece907 Changed a bunch of enums in Entity.h
This simplifies a few things. First, the values of DamageType are now continous,
with the benefit that they can now be stored in a std::bitset.
Second, this repairs entity_getNearestEntity(..., ET_AVATAR) or DT_ENEMY as param,
because these were 0, but the game expected -1 as universal value.
This way, any entity was returned when querying for ET_AVATAR or DT_ENEMY.
Now, 0 is the universal/NONE value, which should avoid mistakes like this.
2012-12-13 19:48:47 +01:00
fgenesis
b242d80c75 Some fixes (...)
- Get colliding hair segment
- drop AnimatedSprite & Interpolator classes
- repair entity_setAutoSkeletalUpdate()
- remove some old code
2012-12-13 18:45:07 +01:00
fgenesis
1fdae0c128 Replace #pragma once with #ifndef/#define pairs (to avoid warnings on gcc 2.95) 2012-09-23 04:51:13 +02:00
fgenesis
e94de627eb Really fix variadic calls (including self). Also fix avatar_setPullTarget() failing because entities are userdata now.
This does now allow constructs like this, in an entity script:

  function msg(me, a)
      if a > 1 then
          a = a * entity_msg(me, a - 1)
      end
      return a
  end

So that entity_msg(thing, 5) == 120 is true.
2012-03-14 20:11:14 +01:00
fgenesis
273b608214 Misc fixes and cleanups; fixed variadic Lua calls to self.
Script interface:
- entity_msg() will no longer corrupt the Lua stack if sending messages to itself.
- added more info to non-critical Lua errors ("attempt to call a nil value", etc)
- replaced many lua_tostring() with getString(), which does never return NULL.
  This prevents possible crashes when a non-string parameter is passed to functions
  expecting a string.

Misc:
- Removed classes BoxElement, DFSprite, Datafile, and related references.
  They were essentially unused.
- Removed unused Element class member variables.
- Show more lines in the in-game console.
2012-03-14 00:58:59 +01:00
fgenesis
9b63b400d5 Misc code cleanups, little SkeletalSprite loading improvement.
- Removed some unused member variables.

- The BBGE_BUILD_WIDESCREEN define is now gone.

- Added an TiXMLDocument cache to prevent parsing the same file
once for each entity on the map with the same skeletal.

- Removed Lua func entity_warpToPathStart, which was essentially a no-op
because Entity::followingPath was always NULL. Removed related code.

- Set texture wrap only when required.

(Some changes taken from https://bitbucket.org/mattbierner/ios-aquaria,
special thanks for changeset 72d6460d9e60)
2012-02-19 04:57:04 +01:00
fgenesis
7ff0caaed8 Script interface improvements & extensions.
- Pointer typechecks are now enabled by default.

- enabled all script warnings for non-FULL or DEMO builds by default

- Added generic obj_* functions that operate on any type of RenderObject.
  These give quite low-level control about the renderer, and are quite
  dangerous too.
  Subsequently, many functions sharing the same code (*_setPosition, for example)
  could be removed, and simply call the generic functions after a type check.

- Added interface function deathNotify(). The original logic of death
  notifiers was never used, so i thought i'd make use of it.
  This is useful in scripts to safely drop dangling pointers.

- removed sendEntityMessage, entity_setCollideWithAvatar, entity_setTouchDamage,
  which were essentially no-ops.

- Replaced all unnecessary luaReturnNum(0) and luaReturnInt(0),
  now it does only push a return value on the stack if the function
  is actually supposed to have a retun value.

- Allow variadic calling of entity_msg(). Now any parameters can be passed
  to the function, and the target entity will receive all of them.
  Any values returned from the entity's msg() callback will be returned
  by entity_msg() to the original caller. This allows nice RPC-like
  entity communication.

- fixed possible crash in debugLog, bone_update, entity_debugText

- added an override function for loadfile() that is case-insensitive like dofile()

- entity_createEntity returns the created entity now

- spawnParticleEffect returns the associated RenderObject

- Added some text rendering functions

- Added beam_setFirer()

- removed the underflow check in avatar_decrLeaches() I added earlier

- added a panic function for Lua.

- added the Lua debug library

- fixed a stupid typo in ScriptObject::isType() that made the type checks a lot less accurate

- misc stuff I forgot
2012-02-05 20:22:54 +01:00
fgenesis
4320b8296b Add a safe pointer model to ScriptInterface, additional bug/crash fixes.
This commit introduces pointer checks to various functions;
so that entity_* will no longer crash or produce weird results
if passed a Node pointer, etc.
The checks are disabled by default, but can be enabled in
ScriptInterface.cpp.

Fixed possible crashes in a few more functions due to missing NULL-checks.

There was a "feature" in the single Lua state that it would keep globals
intact until the game was quit. That made any globals from mods "leak"
into the game or other mods. Now it resets the Lua state when a mod
is loaded or closed.
2012-01-03 04:38:28 +01:00
fgenesis
ac2091fb69 Fixed positional audio & pitch shift.
Apparently this was half implemented but not fully finished.
Mono samples work fine, for stereo, L/R panning does not work (due to OpenAL's limitation)
Also fixed: entity sounds should not play if a cutscene is currently skipped.
2011-11-26 21:00:24 +01:00
fgenesis
e64fb75f84 sync with icculus repo 2011-11-20 15:44:17 +01:00
fgenesis
c78d4d7a11 Fixed some script interface functions, error handling & code cleanups
== Script interface changes: ==

Removed entity_setClampOnSwitchDir(), which was a no-op.

Added entity_getFlag() function, for fairness, as nodes already have one.

Added node_getLabel() function, which does not return the _full_ node string, but only the first part before parameters.

dofile() supports relative paths now, and it is no longer necessary to use appendUserDataPath() + full path from a mod.

entity_color() does now support all interpolation functions that similar vector-manipulation functions support (loop, ping-pong, ease).

added entity_getVel() function (an entity_setVel() can be emulated with entity_clearVel(), followed by entity_addVel()).

*_getNearestNode() and *_getNearestEntity() allow an optional ignore parameter.
node_getNearestNode() allowed to specify a node to exclude from the search,
the others not -- now the interface is more consistent.

Deprecated entity_[incr/decr]TargetLeaches(entity) - the attached leach amount was never handled
by any entity other than Naija. Replaced them with avatar_[incr/decr]Leaches(), but kept the old
ames for now, too. Should be removed in a while.


== Script interface & related fixes: ==

Added bool loudScriptErrors to control displaying script syntax error and global variable usage warnings.
So far, syntax errors always went do debugLog(), but it is less time consuming when writing scripts
to have them displayed right away.

*_getNearestNode now scan by label, and not full name.
This allows searching for nodes but ignoring its parameters. The original game scripts never search
for nodes that have parameters, so this does not break anything,
but allows modding without an exploding amount of specialized node scripts.

entity_setBoneLock() failed for certain entites with throwLuaErrors=true,
allowing to burst through them (gears, grouper, big mithalas jelly, probably more).

Removed unnecessary int-casts in entity_setHealth(), entity_changeHealth(), and a few others,
which truncated float fractional parts.

Fixed possible crashes in many functions due to missing NULL-pointer checks,
if wrong data were passed to Lua.

Optimized entity_getNearestEntity() a little - do nocasecmp() after checking all other params

UPPERCASE global variables as used in mod include files are now tolerated, even with all warnings on.
This makes sense because it was impossible to include a custom flags definition file
(which _must_ have globals, otherwise the including scripts won't see them) in a mod without beeing buried in spam.
They won't change, or clobber any states, and UPPERCASE sort of implies a constant/#define, imho.

Added better control over warnings about not-existing files. map_*.lua and premap_*.lua files are optional,
and no warning should be given if they do not exist. Missing Entity scripts and mod-init.lua must be
warned about, however.

Fixed a crash in global variable access warning (NULL pushed into std::ostringstream)

Fixed 2 random warnings i found in scrips


== Misc stuff: ==

Related to the changes above, cleaned out unused variables from the Entity class,
and removed the code that had to do with them somehow. Some parts of the removed code
were still in use, although totally unnecessary.
Saves a few bytes of memory per entity, and less code that can cause headache.
2011-09-18 23:12:02 +02:00
fgenesis
d4282221fc Revert "Revert "move around some files to keep the size of the next commit down""
This reverts commit b2abcff02d.
2011-09-15 20:17:23 +02:00
fgenesis
b2abcff02d Revert "move around some files to keep the size of the next commit down"
This reverts commit 0951283b31.
2011-09-15 19:19:14 +02:00
fgenesis
0951283b31 move around some files to keep the size of the next commit down 2011-08-13 14:50:47 +02:00
fgenesis
3096eaf5e2 initial commit. This is icculus version 5542b94cae02a6333845854bbbd1abe0a259f1a4 2011-08-03 22:05:33 +02:00