Commit Graph

6429 Commits

Author SHA1 Message Date
Christoph Oelckers 15040c955e Merge branch 'master' into portal 2016-02-19 10:40:07 +01:00
Christoph Oelckers 3841a5f626 - implemented FMultiBlockLinesIterator for checking a position across portals. This is not fully tested yet. 2016-02-19 10:39:40 +01:00
Randy Heit a31bd78abe Fix definitions of A_State/A_Int/A_Bool
- These aren't action functions, so PARAM_ACTION_PROLOGUE is
  inappropriate.
2016-02-19 00:29:19 -06:00
Randy Heit cb0fd5967f Oops. Had FxCastStateToBool backwards. 2016-02-18 22:53:18 -06:00
Randy Heit a399f40e5f Support casting states to booleans
- This is so that you can call an A_Jump-type function from inside an if
  statement and do something other than jump if the jump condition was
  met. e.g.

    {
        if (A_Jump(128, "Foo"))
	{
            A_Log("The function would have jumped");
	}
	else
	{
	    A_Log("The function would not have jumped");
	}
    }
2016-02-18 22:40:04 -06:00
Randy Heit aa58c5f519 Declare VMFunction::Proto to the garbage collector 2016-02-18 22:26:37 -06:00
Randy Heit eace79ccad Add some functions for use with DECORATE return
- Since DECORATE's return statement can only return the results of
  function calls (I do not want to spend the time necessary to make it
  return arbitrary expressions), here are three functions to get around
  this limitation:
  * A_State - Returns the state passed to it. You can simulate A_Jump
    functions with this.
  * A_Int - Returns the int passed to it.
  * A_Bool - Returns the bool passed to it.
- e.g. If you want to return the number 3, you use this:

    return A_Int(3);

  If you want to jump to a different state, you use this:

    return A_State("SomeState");
2016-02-18 22:15:03 -06:00
Randy Heit fbbaae781b Merge remote-tracking branch 'origin/master' 2016-02-18 22:05:40 -06:00
Randy Heit b1098ede93 Restore "direct" call optimization for DECORATE 2016-02-18 22:05:16 -06:00
Randy Heit ade780d810 Redo ACustomInventory::CallStateChain to check return types 2016-02-18 22:05:10 -06:00
Randy Heit b8a16600ac Braces around ACTION_RETURN used in an if are no longer optional 2016-02-18 21:39:13 -06:00
Randy Heit b2ccd0bd28 Use action function return value to make state jumps happen
- The A_Jump family of action functions now return the state to jump
  to (NULL if no jump is to be taken) instead of jumping directly.
  It is the caller's responsibility to handle the jump. This will
  make it possible to use their results in if statements and
  do something other than jump.
- DECORATE return statements can now return the result of a function
  (but not any random expression--it must be a function call). To
  make a jump happen from inside a multi-action block, you must
  return the value of an A_Jump function. e.g.:
    { return A_Jump(128, "SomeState"); }
- The VMFunction class now contains its prototype instead of storing
  it at a higher level in PFunction. This is so that
  FState::CallAction can easily tell if a function returns a state.
- Removed the FxTailable class because with explicit return
  statements, it's not useful anymore.
2016-02-18 20:39:40 -06:00
coelckers 02474dd1aa Merge pull request #571 from edward-san/fast-math-nonmsvc
- Apply the fast math flags for non-MSVC, too.
2016-02-19 01:50:28 +01:00
Edoardo Prezioso f338e5f1c4 - Apply the fast math flags for non-MSVC, too.
Move the fast flags string creation in the main cmake file and use it where needed.
2016-02-18 23:13:02 +01:00
coelckers d61ae910b4 Merge pull request #569 from edward-san/pain-hotfix
- Revert unneeded change to the frame letter.
2016-02-18 00:24:18 +01:00
Edoardo Prezioso f650bbfe15 - Revert unneeded change to the frame letter. 2016-02-18 00:17:07 +01:00
coelckers 1382a7af8a Merge pull request #568 from edward-san/decorate-vanilla
- More decorate fixes.
2016-02-17 21:59:45 +01:00
Christoph Oelckers 884a265d4a - refactored P_FindFloorCeiling to be portal aware and cleaned up its interface.
A big problem with this function was that some flags required setting up some variables before calling it and others did not. It will now set everything up itself so all initializations to AActor::floorz and ceilingz that were made before these calls (which were all identical to begin with) could be removed and the internal initialization logic streamlined.
2016-02-17 21:57:52 +01:00
Edoardo Prezioso db6f534df5 - Fixed wrong Pain Elemental missile sequence. 2016-02-17 21:53:23 +01:00
Edoardo Prezioso 4ccbc65f7b - Fixed mismatching Mancubus missile sequence. 2016-02-17 21:44:33 +01:00
coelckers 854f348f8e Merge pull request #567 from Gaerzi/patch-1
fix duration according to vanilla
2016-02-17 17:09:29 +01:00
Gaerzi ec88a30a00 fix duration according to vanilla 2016-02-17 16:08:40 +01:00
Christoph Oelckers bd09664d85 Merge branch 'master' into portal 2016-02-17 12:37:11 +01:00
Christoph Oelckers f2125ea420 - this needs a return value... 2016-02-17 12:36:56 +01:00
Christoph Oelckers 022ab95817 Merge branch 'master' into portal 2016-02-17 11:46:24 +01:00
Christoph Oelckers 5a779cc1f4 Merge branch 'master' of https://github.com/rheit/zdoom 2016-02-17 11:43:03 +01:00
Christoph Oelckers 42c6245a50 - restored A_CountdownArg to what it looked like before the scripting branch.
The new version did not work as expected anymore.
2016-02-17 11:42:45 +01:00
Christoph Oelckers 10a3d75556 - reviewed and adjusted ZatPoint calls in p_map.cpp. 2016-02-17 11:39:14 +01:00
Christoph Oelckers 6e4cf9699a Merge branch 'portal' of https://github.com/rheit/zdoom into portal 2016-02-17 02:21:46 +01:00
Christoph Oelckers 0948448988 - some more checking and refactoring of ZatPoint calls.
- removed Plane/Floor/CeilingAtPoint functions because they are overkill for the problem they were meant to solve. Calling ZatPoint with adjusted coordinates created with AActor::PosRelative is just as easy in the few places where this is needed.
- made P_HitWater and P_CheckSplash portal aware.
2016-02-17 02:21:26 +01:00
Christoph Oelckers 5611df1f3e - fixed the portal aware ceiling and floor functions. 2016-02-17 00:31:29 +01:00
Christoph Oelckers fd7e6ae604 - fixed copy&paste error in LowestFloorAt. 2016-02-16 23:11:20 +01:00
Christoph Oelckers 8d53f6176e - fixed conditions for PortalBlocksView. Created a new function PortalBlocksSight that's relevant for playsim-related sight checks. 2016-02-16 22:57:03 +01:00
Christoph Oelckers 93b3982c62 Merge branch 'zmaster' into portal 2016-02-16 22:05:50 +01:00
Christoph Oelckers 6d8879f302 - missing #includes. 2016-02-16 22:04:32 +01:00
Christoph Oelckers ae02b2fcaf - added NextHighestCeiling/NextLowestFloorAt functions. Not tested yet! 2016-02-16 21:00:34 +01:00
Christoph Oelckers 5fd6ccb970 - fixed incorrect #include. 2016-02-16 20:53:52 +01:00
Randy Heit 0f70d10521 Add 'float' and 'state' as possible return types for action functions 2016-02-16 12:09:00 -06:00
Christoph Oelckers 1b88052bba - started refactoring ZatPoint calls which need to be portal aware.
To summarize, anything that just works with map geometry doesn't need to bother, as does the renderer. (i.e. nearly all r_* files, p_floor.cpp, p_ceiling.cpp et.al)
But all calls that are somehow related to actor positions need to be made aware of potential portal transitions:

 * added FloorAtPoint, CeilingAtPoint and PlaneAtPoint methods to sector_t, which can be used to calculate a plane's height with relation to a given actor, even if that actor is on the other side of a portal.
 * added HighestCeilingAt and LowestFloorAt methods which traverse all ceiling/floor portals until they find an impassable plane.
2016-02-16 16:40:53 +01:00
Christoph Oelckers 45108e9bb8 - added two missing files to CMakeLists.txt. 2016-02-16 12:52:45 +01:00
Christoph Oelckers 22e8678903 - refactored P_CollectConnectedGroups to avoid frequent heap allocations for the common cases
* the temporary checking arrays are now static
 * the array that gets the returned values only starts allocating memory when the third touched sector group is found. The most common cases (no touched portal and one touched portal) can be handled without accessing the heap.

- did some streamlining of AActor::LinkToSector:

 * there's only now version of this function that can handle everything
 * moved the FIXMAPTHINGPOS stuff into a separate function.
 * removed LinkToWorldForMapThing and put all special handling this function did into P_PointInSectorBuggy.
2016-02-16 12:51:10 +01:00
Christoph Oelckers b9037ef3ee - added a check to detect self-referencing sectors in the portal setup code because those are problem cases. 2016-02-15 21:49:46 +01:00
Christoph Oelckers f24bf7e622 - separated FCheckPosition and its FPortalGroupTable substructure into its own header because this was creating too many dependencies on other headers with FCheckPosition in p_local.h and FPortalGroupTable in portals.h. 2016-02-15 13:40:31 +01:00
Christoph Oelckers 5664cee2e5 - fixed: The check for leftover portal sectors was not correct. It only checked the sectors the portal thing was in and those were already processed in the first phase.
- improved: If there's an offset mismatch, do not print group numbers as they are utterly meaningless. Instead look for a sector in each group and report those.
- added a copyright notice and some comments to portals.cpp.
2016-02-15 12:35:40 +01:00
Christoph Oelckers afc631b537 - this wasn't saved for last night's commit. 2016-02-15 09:25:48 +01:00
Christoph Oelckers 6adb069506 - rewrote p_local.h so that it doesn't pull in the entire bunch of headers.
This was to resolve some circular dependencies with the portal code.
The most notable changees:

 * FTextureID was moved from textures.h to doomtype.h because it is frequently needed in files that don't want to do anything with actual textures.
 * split off the parts from p_maputl into a separate header.
 * consolidated all blockmap related data into p_blockmap.h
 * split off the polyobject parts into po_man.h
2016-02-15 02:14:34 +01:00
Christoph Oelckers 405db83393 - added a function which collects all portal group an actor would touch if standing in a given position. 2016-02-15 00:53:59 +01:00
Christoph Oelckers 0dce22ce85 - some portal considerations. 2016-02-14 21:02:18 +01:00
Christoph Oelckers 5af53c0e62 - fixed a few more sector movers which calculated their movement at (0,0) instead of inside the sector. 2016-02-14 18:53:00 +01:00
Christoph Oelckers 126c80d597 - create the portal group table. 2016-02-14 18:16:59 +01:00