Commit graph

2243 commits

Author SHA1 Message Date
Monster Iestyn
1b542c6501 Added userdataType(userdata) function to Lua!
This new function returns a string representing the type of userdata the variable given (e.g. mobj_t, player_t), it even works on "minor" userdata types (player_t.powers, skin_t.soundsid, sector_t.lines, etc)
2017-01-19 18:30:55 +00:00
Monster Iestyn
2ac3f68438 Added in-level checks to a lot of these functions and tables for Lua use
This makes it less likely for the game to crash when stuff is used outside a level when they shouldn't be
2017-01-18 22:02:28 +00:00
Monster Iestyn
90166d7b1f Updated SRB2.cbp to (presumably) handle lua_blockmaplib.c correctly 2017-01-16 15:43:27 +00:00
Monster Iestyn
47e053c8f6 Merge branch 'lua-additions' into 'master'
Lua additions

Thought I'd may as well make a merge request so I can remind people of all the various Lua-related changes here (and because it's about time some of them got in):

* Added `P_PointOnLineSide(x, y, line)`. Allows you to quickly determine which side of a line faces the point. *line* can be a real line_t or a custom defined line (just like with P_ClosestPointOnLine).
* Added seg_t and node_t support to Lua (note: these are disabled for now, due to complications with OpenGL that we all know something of by now. Bit of a shame really :( ) - of note is node.children and node.bbox:
 * node.children[] is an array that takes 0 or 1 as indexes (or "right" and "left", alternatively)
 * node.bbox(child,bboxcoord) is a two-arg function: child can be 0 or 1 (or "right" and "left", alternatively), bbox coord can be 0,1,2 or 3 (or "top", "bottom", "left" and "right", alternatively)
 * aside from the above, segs[] and nodes[] store the segs/nodes of the current map; segs.iterate and nodes.iterate iterates through segs/nodes
 * NF_SUBSECTOR is also available for usage with node.children
* You can now get the palette indexes (i.e. colormap[n]) of colormap userdata from `v.getColormap`, where n is a palette index number between 0 and 255. Useful for finding out which palette colors turned into what, if they changed at all
* ffloor_t userdata can now save to and be read from $$$.sav in netgames properly; this means custom mobj/player variables and NetVars can both send/recieve them directly if you wanted
* **IMPORTANT** Blockmap search library! (with a new file: lua_blockmaplib.c)
 * Format of iteration function: `searchBlockmap(searchtype, function, mobj, [x1, x2, y1, y2])`. Returns true if search was uninteruppted, false if the iteration function returned true at any point
 * *searchtype* can be either "objects" or "lines", for looking for mobj_t and line_t stuff in the blockmap respectively
 * *function* is a function of your choice to iterate with: (sorry I can't get the next two bullets to be one indent further to the side)
   - format of function needed: `funcname(mobj, foundmobj)` or `funcname(mobj, foundline)` (for searching for objects and lines, respectively)
   - return value of *function* affects searching somewhat: nil doesn't change searching, false ends searching in a block (but doesn't stop searching, it just moves onto the next), and true ends the full search. Both returning true or false ultimately makes `searchBlockmap` return false.
 * *mobj* is the reference mobj that you're checking around (if you don't supply x/y ranges to search in, it defaults to checking within the mobj's radius in both axes). If *mobj* was removed mid-search the search stops and `searchBlockmap` returns false
 * (optional) *x1, x2, y1, y2* are coordinates on the map to search the blockmap between, if given

See merge request !54
2017-01-13 17:15:35 -05:00
Alam Ed Arias
94025ae947 Merge branch 'master' into lua-additions 2017-01-13 16:47:57 -05:00
Monster Iestyn
3d07915be2 Merge branch 'vada_flickies' into 'master'
Hardcoded VAda Flickies

Many thanks to MI for his help, even if he has sinful opinions on what the collection of creatures should be called. ;P

* Flickies are now handled via A_FlickySpawn instead of hardcoded in P_KillMobj, so there can be mobjtypes with MF_ENEMY which don't create flickies, or other mechanisms which can much easier.
* Added map header "FlickyList" (aka "AnimalList") parameter, which can either be set to:
    * A species (eg: "Rabbit" or "Bluebird", amongst 17 currently supported types in dehacked.c table FLICKYTYPES - including the seed from Sonic CD, which isn't limited to 'soniccd on' in the console now)
    * Any valid mobjtype that isn't MT_NULL (eg: "MT_FLICKY_GHOST")
    * A comma-seperated list of either of the above, up to 64 entries long (eg: "Cow,MT_FLICKY_SPIDER,Chicken")
    * "All" - sets behind-the-scenes stuff to use every 'normal' type of flicky in FLICKYTYPES (a distinction which can be utilised to hide secret level flickies where they wouldn't be appropriate for the main game)
    * "Demo" - sets behind-the-scenes stuff to use the five flickies closest to the species used in the game's long history.
    * "None" - prevents any flickies from spawning.

"Demo" is functionally the default value if you don't include a FlickyList parameter in the header at all.

Of note, a bunch of functions are now created:
* A_FlickySpawn - spawns flicky.
* A_FlickyAim - aims for area near target, but not directly on them - turns around when hitting wall
* A_FlickyFly -  flies/swims around target (calls A_FlickyAim)
* A_FlickySoar - hacky alternate fly (calls A_FlickyAim)
* A_FlickyCoast - slowing down before going off again
* A_FlickyHop - fracunit-scale precision for A_BunnyHop
* A_FlickyFlounder - A_FlickyHop with randomisation
* A_FlickyCheck - State-setter for falling, or being on-ground
* A_FlickyHeightCheck - State-setter for falling, or being below a certain height relative to target
* A_FlickyFlutter - A_FlickyCheck, but with a slow fall/movement (calls A_FlickyCheck and A_FlickyAim)

I don't need to enumerate the object types and states that have been added, do I?

Oh yeah, I also made it so get_mobjtype's failure value was MT_NULL and prohibited SOC from editing the properties of it to compensate.

IN ADDITION: Killed "soniccd" console command, since it made things more complicated and honestly being able to specify Sonic CD seeds in the level header is a better option.

See merge request !60
2017-01-08 17:36:25 -05:00
Monster Iestyn
166c6746cd Merge branch 'public_next' 2017-01-08 16:05:32 +00:00
Monster Iestyn
c737cff758 Merge branch 'next' into public_next 2017-01-08 16:04:55 +00:00
Monster Iestyn
87dc33a78d Merge branch 'master' into next 2017-01-08 15:59:34 +00:00
Inuyasha
cdc9bf3a60 Merge branch 'cb_update' into 'master'
Update Code::Block project

See merge request !145
2017-01-08 10:32:22 -05:00
Monster Iestyn
22020dda03 Merge branch 'savegame-hotfixes' into 'next'
Savegame hotfixes

Yes, this another netgame related fix! Named this "savegame hotfixes" rather than "ERCZ hotfix" or the like in advance of the fact we probably need a general branch for other $$$.sav fixes?

Anyway, fixes included in by this branch:
* ERCZ's lava falls now act as expected rather than being stuck in place for the map's duration, fixing all other known desynchronisation issues known in the map for the time being (yay)
* Changing sector tags in a map no longer causes joiners to netgames to have their SRB2 application stop responding etc
* Player names should no longer turn red in the console in gametypes outside of CTF/Team Match if a resynch occurs (not $$$.sav related, but it's related to netplay so I lumped it in anyway)

See merge request !150
2017-01-07 18:32:07 -05:00
Monster Iestyn
c93101aa74 Merge branch 'eggshield-laser-fix' into 'next'
Eggshield laser fix

Fix for http://mb.srb2.org/showthread.php?t=42250

See merge request !152
2017-01-07 14:33:27 -05:00
Monster Iestyn
ad30c41179 Fix egg guard shields being endlessly killed by lasers. Simply make sure they have health first before killing them! 2017-01-07 18:02:55 +00:00
Monster Iestyn
45fdfd9f37 Merge branch 'eggscalibur_fixes' into 'next'
One Eggscalibur fix

Use mobj->watertop instead of mobj->spawnpoint->z. CEZ3 is far from fixed in multiplayer, but this is still one less thing to worry about.

See merge request !148
2017-01-07 10:47:02 -05:00
Monster Iestyn
12ae6bb22a Merge branch 'public_next'
# Conflicts:
#	src/d_clisrv.c
#	src/r_things.c
2017-01-07 15:03:59 +00:00
Monster Iestyn
7c227ea0c5 Merge branch 'next' into public_next 2017-01-07 14:57:00 +00:00
Monster Iestyn
cd0ec0881d Merge branch 'plane-fixes' into 'next'
Software plane rendering fixes/cleanup

This is mostly cleanup, with the exception that polyobject planes should now behave somewhat better than they do in 2.1 currently (translucent polyobj planes should now always be actually translucent regardless of where you view them from, for instance). I can't claim I've fixed their rendering once and for all though, there may still be bugs for all I know...

See merge request !136
2017-01-06 21:19:09 -05:00
Monster Iestyn
c601a409e1 Merge branch 'texture-fixes' into 'next'
Some texture-related fixes

Bugs fixed in this branch:
* upper/lower/middle textures with non-existent texture ids being capable of crashing the game. For instance, RVZ1 has colormap codes on non-colormap linedefs, which causes them to wind up with invalid texture ids because of how the game tries to interpret lower/upper textures with "#" followed by characters on normal linedefs. Fortunately these "textures" are normally not visible anyway (since they're all in control sectors) unless they are swapped with in-level textures by some crazy Lua script of some sort...
* animated single-patch textures with holes displaying garbage on first viewing (see this thread: https://mb.srb2.org/showthread.php?t=42195)
* the heights of the lighting (shadows or colormapping) from water/translucent/shadowcasting/etc FOFs become messed up when displayed on repeated midtextures.

See merge request !144
2017-01-06 21:15:22 -05:00
Monster Iestyn
5e12f3497a Merge branch 'flat-changing-hotfix' into 'next'
Flat changing hotfix

This should fix how Lua scripts that change flats in levels, particularly to flats that don't already exist in the level, cause SRB2 to crash for anyone who joins a netgame afterwards. (I'm not sure if it's a consistent thing or not though)

Probably needs a good test to verify the issue is completely fixed before being merged in. Maybe there are other minor things I didn't account for in this fix? I don't know!

See merge request !141
2017-01-05 19:46:44 -05:00
Monster Iestyn
f2a58a74ef Stupid me 2017-01-03 22:48:06 +00:00
Monster Iestyn
4d8ca41e65 Fix player colors mysteriously turning red if a resynch occurs outside of CTF/Team Match. Not technically a $$$.sav fix, but still netplay related of course
At least, I assume this is how it's happening for some, I haven't been able to get the full info since WHERE IS EVERYBODY?
2017-01-03 22:43:46 +00:00
Monster Iestyn
b768c4b961 Sync sector tags and tag list variables properly
Dunno who thought it was a good idea to lump tag, nexttag and firsttag together in $$$.sav, but that meant changing sector tags caused SRB2 to stop responding since it lead to the tag lists being broken
2017-01-03 20:48:39 +00:00
Monster Iestyn
a0d095e707 Fix sector floordata/ceilingdata/lightingdata pointers not being NULL when they should be
This fixes ERCZ's lava falls not moving after joining a netgame at that stage. Possibly explains other various floor/ceiling related netgame quirks that haven't been noticed until now, maybe even in multiplayer levels.
2017-01-03 18:47:46 +00:00
Monster Iestyn
be21588761 Merge branch 'master' into next 2017-01-03 16:06:50 +00:00
Monster Iestyn
5400707aa7 Merge branch 'remove-secplanes' into 'master'
Remove secplanes

This is just removing SSNTails's old port of ZDoom's secplane code and math, from back when he attempted slopes himself. The slopes we've had since 2.1.15 however do not need these, so we can pretty much toss the code for them out now (nothing uses them anyway).

See merge request !149
2017-01-03 11:05:13 -05:00
Logan-A
40c8328eae Merge pull request #151 from LJSonik/netcode-shit
Netcode shit
2017-01-02 15:54:33 -05:00
Logan-A
eb8f608fd7 Merge branch 'master' into netcode-shit 2017-01-02 15:18:28 -05:00
Monster Iestyn
d5803160dd Remove all traces of SSN's old port of ZDoom's secplanes for slopes, since our slopes do not need them 2017-01-02 19:12:09 +00:00
toasterbabe
a4fe3580e2 Forgot to commit this compiling fix. 2017-01-02 19:07:20 +00:00
toasterbabe
eb22f347f3 Made Eggscalibur use mobj->watertop instead of mobj->spawnpoint->z because that's not netgame-safe.
CEZ3 STILL has some ridiculous inconsistencies, but this is one less to worry about.
2017-01-02 19:04:33 +00:00
Louis-Antoine
04747ff79e Fixed a memory leak on client side 2017-01-02 20:02:49 +01:00
Monster Iestyn
c1392cee25 Merge branch 'master' into next 2017-01-02 18:09:23 +00:00
Monster Iestyn
6d07c6baab Merge branch 'fixedrounding-hotfix' into 'next'
FixedRounding hotfix

Fix the FixedFloor, FixedTrunc, FixedCeil, and FixedRound functions.

See merge request !142
2017-01-02 13:05:30 -05:00
toasterbabe
0d49d4ba3f Fixed seed spawning not properly accounting for reverse gravity. 2017-01-02 14:00:03 +00:00
Monster Iestyn
853f1f5a1f Merge branch 'savegame-hotfix' into 'next'
Savegame hotfix

This fixes the first mobj thinker added/read from $$$.sav not being relinked to other objects as their target/tracer/etc properly. In particular, this fixes Brak's electric shield disappearing for anyone joining a netgame playing ERCZ (as Brak happens to be the first object added/read in this case, and Brak is the shield's target).

See merge request !146
2017-01-02 00:03:51 -05:00
Louis-Antoine
478da43660 Cooked another cookie 2017-01-01 23:52:27 +01:00
Louis-Antoine
4373afcdb2 Cooked a cookie 2017-01-01 23:27:06 +01:00
Louis-Antoine
b347b818e7 -Fixed broken net commands, thus fixing (or at least greatly improving) chat/commands/joins/leaves and possibly other annoying bugs
-Updated packet name list so the debug file no longer shows garbage packet names
-Replaced byte values with actual net command names in the debug file. Only the first net command in a packet will be shown though
-Added a MOBJCONSISTANCY define that makes the game takes all revelant mobjs to be counted in the synch seed
-Added a PACKETDROP define that adds two console commands "drop" and "droprate" to simulate bad internet by dropping packets
-Added/changed comments here in there in the netcode
-Fixed a minor error that would ignore one of the urgent ack slots
-Added a space between the map name and "zone" for the messages shown in a joiner's console
2017-01-01 23:07:34 +01:00
toasterbabe
3f92a2305a * Modified MT_SEED to have aesthetically nicer behaviour.
* Removed Soniccd command, as flicky selection involves a P_RandomKey call - this messes with replays and demos.
2017-01-01 21:54:30 +00:00
toasterbabe
df88d888e6 Prevented Mario mode from bailing out P_InternalFlickySpawn. What's the point? Goombas don't call A_FlickySpawn... 2017-01-01 18:16:21 +00:00
Monster Iestyn
0e6e52eabe Start mobjnums at 1 instead of 0, so that the first found mobj can be relinked as a target etc to other mobjs properly
This fixes Brak's electric barrier disappearing for joiners to ERZC. There seems to be some issues with the lava falls there too I've found, but the electric barrier actually stays around now at least
2017-01-01 17:03:13 +00:00
toasterbabe
6ed8d99b48 * Added "Flickylist = DEMO" option, creating the five species of flicky similar enough in appearance to the Freed Animals from the days of yore.
* Set the default flicky group to be equivalent to Flickylist = Demo.
* Refactored a little. (This also removed a crash-causing typo in a Z_Free in P_ClearSingleMapHeaderInfo.)
2017-01-01 16:57:07 +00:00
toasterbabe
21b316e9a4 Made the flicky turning-around-when-hitting-walls work better and not take up another struct variable which a user of A_FlickyCheck might not want taken. 2017-01-01 16:42:39 +00:00
toasterbabe
f8d37e5df7 fix commenting and indentation that was rushed for new years 2017-01-01 00:39:33 +00:00
toasterbabe
be140d8143 Added "Flickylist = All" option.
Couldn't get it to default to anything - it was causing crashes, and new years is in ten minutes, so let's do that tomorrow.
2016-12-31 23:47:47 +00:00
Monster Iestyn
6ca806a8c0 Fix FOF lighting being stupid with repeating midtextures. 2016-12-31 20:44:16 +00:00
Louis-Antoine
d4f153d3ca Random changes in the netcode lol 2016-12-31 19:26:33 +01:00
toasterbabe
311886e582 * Ported in all of the Flickies from flickiesreduced8.wad except for the Flicker and seed.
* Fixed a crash bug in the Flicky fly function I introduced sleepily last night.
2016-12-31 16:55:06 +00:00
toasterbabe
d3a70eb1db * All Flicky A_ functions ported.
* Corrected MT_EGGSHIELD spawning a flicky.
* New compared to the Lua implementation: Flickies turn around when they hit walls!
2016-12-30 19:16:20 +00:00
toasterbabe
bf8bff82ba * MT_EGGTRAP (egg capsule center mobj) converted over to flickylist system.
* MT_EXPLODE's anims partially FF_ANIMATE'd.
* A_FlickySpawn turned into a wrapper for internal function that does what A_FlickySpawn did but returns a pointer to the spawned flicky.
2016-12-30 14:04:04 +00:00