Commit Graph

90 Commits

Author SHA1 Message Date
Christoph Oelckers 6599e2c425 - moved the VM types into their own file and only include it where really needed. 2017-04-13 01:12:04 +02:00
Christoph Oelckers e4d2380775 - moved all remaining fields from PClassActor to FActorInfo.
- added a few access functions for FActorInfo variables.

With PClassActor now empty the class descriptors can finally be converted back to static data outside the class hierarchy, like they were before the scripting merge, and untangle the game data from VM internals.
2017-04-12 00:07:41 +02:00
Christoph Oelckers 1423d5f42a - scriptified the SBARINFO wrapper.
This serves no purpose in itself but it removes a native side class from the status bar class hierarchy which allows for better editing options later.
2017-03-22 17:29:13 +01:00
Christoph Oelckers 9bffe4ee50 - scriptified the main statusbar interface and the Strife status bar.
Note that the Strife status bar does not draw the health bars yet. I tried to replace the hacky custom texture with a single fill operation but had to find out that all the coordinate mangling for the status bar is being done deep in the video code. This needs to be fixed before this can be made to work.

Currently this is not usable in mods because they cannot initialize custom status bars yet.
2017-03-22 00:32:52 +01:00
Christoph Oelckers a2f2be17ef - status screen fully scriptified but not active yet. 2017-03-18 19:35:26 +01:00
Christoph Oelckers c008ddaf66 - replaced homegrown SWORD, SBYTE and uint32_t types. 2017-03-09 19:31:45 +01:00
Christoph Oelckers 8ab562ef13 - the fourth. 2017-03-08 18:55:54 +01:00
Christoph Oelckers 498da825a5 - made the Skins array scripting friendly and exported it. 2017-02-17 21:51:23 +01:00
Christoph Oelckers 68e9918ed5 - moved player color sets and pain flashes into global variables.
There's simply never enough of them and they are used far too infrequently to justify the hassle of tagging along two TMaps per class.
For what they provide, single global lists that handle all player classes at once are fully sufficient.
2017-02-08 19:10:11 +01:00
Christoph Oelckers e4924c3d47 - added some missing End... calls in player deserialization code.
- fixed reading of music name.

In its current state the code is now capable of reading an E1M1 savegame and continuing play.
2016-09-23 20:05:12 +02:00
Christoph Oelckers 86e9282193 - removed the sequential processing of JSON objects because the benefit is too small.
After testing with a savegame on ZDCMP2 which is probably the largest map in existence, timing both methods resulted in a speed difference of less than 40 ms (70 vs 110 ms for reading all sectory, linedefs, sidedefs and objects).
This compares to an overall restoration time, including reloading the level, precaching all textures and setting everything up, of approx. 1.2 s, meaning an increase of 3% of the entire reloading time.
That's simply not worth all the negative side effects that may happen with a method that highly depends on proper code construction.
On the other hand, using random access means that a savegame version change is only needed now when the semantics of a field change, but not if some get added or deleted.

- do not I_Error out in the serializer unless caused by a programming error.

It is better to let the serializer finish, collect all the errors and I_Error out when the game is known to be in a stable enough state to allow unwinding.
2016-09-23 14:04:05 +02:00
Christoph Oelckers f0e8e860f1 Merge branch 'master' into json 2016-09-22 09:09:48 +02:00
raa-eruanna 780d672b25 Adds user-definable weapon bob speed 2016-09-22 08:42:59 +02:00
Christoph Oelckers da83d9e2bd - converted player serializer and everything it needs.
This means that everything belonging to the level snapshot will be generated in the JSON output.
2016-09-21 01:18:29 +02:00
Randy Heit e96ed6bf8d Add FBaseCVar::GetHumanString()
- For most cvars, this is equivalent to calling GetGenericRep() to get a
  string.
- For float cvars, it uses %g instead of %H, because %H is generally more
  information than is needed.
2016-04-23 22:30:08 -05:00
Christoph Oelckers db86385cf6 - removed STACK_ARGS.
The only reason this even existed was that ZDoom's original VC projects used __fastcall. The CMake generated project do not, they stick to __cdecl.
Since no performance gain can be seen by using __fastcall the best course of action is to just remove all traces of it from the source and forget that it ever existed.
2016-04-11 10:46:30 +02:00
Christoph Oelckers ced30e7bbb - fixed a few oversights.
- switched p_buildmap to use the floating point variants of the linedef/sector init methods.
2016-03-30 11:25:02 +02:00
Christoph Oelckers 558e04cb99 - safety commit. 2016-03-26 01:03:02 +01:00
Randy Heit 55142078d8 Normalize line endings 2016-03-01 09:47:10 -06:00
Christoph Oelckers 6d0ef7a9da - added conversion macros to convert floating point angles to angle_t, using xs_Float.h, and replaced all occurences in the code with them (let's hope I found everything.)
Converting a floating point value that is out of range for a signed integer will result in 0x80000000 with SSE math, which is used exclusively for this purpose on modern Visual C++ compilers, so this cannot be used anywhere.
On ARM there's problems with float to unsigned int conversions.

xs_Float does not depend on these
2016-02-08 12:10:53 +01:00
Christoph Oelckers 8da6483223 - fixed some places where FStrings were incorrectly used.
- replace all implicit conversions from FString to const char * in the header files (so that it can be test compiled with the implicit type conversion turned off without throwing thousands of identical errors.)
2016-02-05 10:40:45 +01:00
Randy Heit b3b0886b64 Merge branch 'scripting'
Conflicts:
	src/actor.h
	src/g_doom/a_doomweaps.cpp
	src/g_hexen/a_blastradius.cpp
	src/p_enemy.cpp
	src/p_enemy.h
	src/thingdef/thingdef.h
	src/thingdef/thingdef_codeptr.cpp
	wadsrc/static/actors/constants.txt
2016-02-04 15:17:22 -06:00
Christoph Oelckers afcd755c7a - changed autoaim menu option to a slider which allows a more precise control of the property.
- having a value of 5000 as the default for autoaim makes no sense, since this is an angle value that will always be clamped to [0..35]. So now 35 is both the default and the maximum.
2016-01-30 13:43:39 +01:00
Christoph Oelckers 7b6b473ec4 - some GCC fixed by Edward-san. 2015-04-29 11:28:04 +02:00
Randy Heit b5e4153c78 Merge branch 'master' into gonesolong
Conflicts:
	src/CMakeLists.txt
	src/b_think.cpp
	src/g_doom/a_doomweaps.cpp
	src/g_hexen/a_clericstaff.cpp
	src/g_hexen/a_fighterplayer.cpp
	src/namedef.h
	src/p_enemy.cpp
	src/p_local.h
	src/p_mobj.cpp
	src/p_teleport.cpp
	src/sc_man_tokens.h
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_function.cpp
	src/thingdef/thingdef_parse.cpp
	wadsrc/static/actors/actor.txt
	wadsrc/static/actors/constants.txt
	wadsrc/static/actors/shared/inventory.txt

- Added register reuse to VMFunctionBuilder for FxPick's code emitter.
- Note to self: Need to reimplement IsPointerEqual and CheckClass, which
  were added to thingdef_function.cpp over the past year, as this file no
  longer exists in this branch.
2014-12-21 21:15:11 -06:00
Randy Heit 2d87eb0ba2 Merge branch 'master' into gonesolong
Conflicts:
	src/CMakeLists.txt
	src/actor.h
	src/g_heretic/a_hereticmisc.cpp
	src/g_heretic/a_hereticweaps.cpp
	src/g_heretic/a_ironlich.cpp
	src/info.h
	src/namedef.h
	src/p_buildmap.cpp
	src/p_enemy.cpp
	src/p_map.cpp
	src/p_mobj.cpp
	src/thingdef/thingdef_codeptr.cpp
	zdoom.vcproj
2014-12-20 19:13:14 -06:00
ChillyDoom 5de6b535ae - Removed unnecessary 'id' variable from AActor.
- Removed unused 'backpack' variable from player_t.
- Removed duplicate code from b_move.cpp.
- General cleanup.
2014-10-13 08:45:36 +01:00
Randy Heit e7f427aa60 Merge branch 'maint' 2014-02-24 19:26:50 -06:00
Randy Heit db4763b14a Delay skin setting on save load until player class is known.
- Fixed: Loading players from savegames set the skin before their current
  class was retrieved, so they could not validate their skins with the
  correct class.
2014-02-24 16:27:57 -06:00
Randy Heit 7052d4e14e Fixed: userinfo_t::SkinChanged() was unaware of player classes 2014-02-24 16:18:10 -06:00
Braden Obrzut efa9e0c3ee Merge branch 'maint' 2014-01-18 18:10:48 -05:00
Braden Obrzut 7af8b78b9f - Applied Chilly's patch to fix excessive name change notifications. 2014-01-18 15:18:35 -05:00
Christoph Oelckers 698495efc5 - fixed: missing return in playerinfo CCMD added. 2013-12-01 01:21:43 +01:00
Randy Heit 0cf68af7d2 Overload operator = for player_t
- This fixes crashes when quitting multiplayer games because the default
  byte-for-byte copy caused PredictionPlayerBackup and the console player
  to point to the exact same userinfo data and to both try and free it
  when they are deleted.
2013-09-18 21:14:44 -05:00
Randy Heit 9c86f1c220 Merge branch 'master' into scripting for plugged userinfo memory leak
Conflicts:
	src/d_player.h
	src/p_interaction.cpp
	src/thingdef/thingdef_codeptr.cpp
2013-07-23 21:01:13 -05:00
Christoph Oelckers 2d2498d1e2 - fixed: userinfo_t needs a destructor to delete its CVARs when it is destroyed. 2013-07-14 10:58:53 +02:00
Randy Heit e9425b356b - Fixed: Verbose user info strings were written with an extra backslash
character between the key and value.
2013-07-01 21:40:09 -05:00
Randy Heit 459ad5abff - Updated scripting branch to latest version in trunk.
SVN r4337 (scripting)
2013-06-07 03:31:30 +00:00
Randy Heit 167ee9e7fb - Added three new ACS functions:
* int GetUserCVar(int playernum, "cvarname")
  * bool SetCVar("cvarname", newvalue)
  * bool SetUserCVar(int playernum, "cvarname", newvalue)
  GetUserCVar is analogous to GetCVar, except it returns the value of a user cvar for a
  specific player. (All user cvars can be examined using the playerinfo console command.)
  SetCVar sets a cvar to a new value. If the cvar is floating point, then newvalue is treated
  as a fixed point number, otherwise it's treated as an integer. SetUserCVar is the same, but
  for a specific player's user cvar.

  SetCVar and SetUserCVar can only change cvars created via CVARINFO. They cannot alter built-in cvars.

  If you use GetCVar or SetCVar with a user cvar, they will act on the copy of the user cvar
  for the player who activated the script. e.g.
    GetCVar("gender")
  is the same as
    GetUserCVar(PlayerNumber(), "gender")

  If you get the value of a floating point cvar, it will be returned as a fixed point number.
  Otherwise, it will be returned as an integer.

SVN r4283 (trunk)
2013-05-25 19:08:05 +00:00
Randy Heit 4fa198244c - Renamed CVAR_NOSEND to CVAR_IGNORE to better reflect its intent.
- Separated CVAR_MODARCHIVE into CVAR_MOD|CVAR_ARCHIVE so that mod-defined cvars can still be
  identified when they aren't meant to be archived.

SVN r4281 (trunk)
2013-05-25 17:08:59 +00:00
Randy Heit 787b84ef91 - Added CVARINFO lump support. This is a lump for defining mod-specific cvars and takes entries
of the form:
    <scope> [noarchive] <type> <name> [= <defaultvalue>];
  Where <scope> is one of:
  * server: This cvar is shared by all players, and in network games, only select players can
    change it.
  * user: Each player has their own copy of this cvar, which they can change independently.
  To prevent the cvar from being written to the config file, add noarchive to its definition.
  <Type> is one of:
  * int: An integral value. Defaults to 0.
  * float: A value that can include a fraction. Defaults to 0.0.
  * color: A color value. Default to black ("00 00 00").
  * bool: A boolean value that can hold either true or false. Defaults to false.
  * string: A string value. It's not too useful for mods but is included for completeness. Defaults to "".
  <Name> is the cvar's name and must begin with a letter and may only include alphanumeric
  characters and the underscore character.
  If you wish a non-standard default add an = character after the cvar's name followed by the
  default value you want to use. Example:
    server int mymod_coolness = 10;
- Fixed: FStringCVar::SetGenericRepDefault() did not make a copy of the input string.

SVN r4280 (trunk)
2013-05-25 16:34:23 +00:00
Randy Heit 8af465189a - Fix broken loading of pre-r4253 savegames.
SVN r4272 (trunk)
2013-05-18 15:38:10 +00:00
Randy Heit 2668988870 - Switched to a genericly extensible representation for userinfo.
- Fixed: The playerinfo CCMD did not range check the player number.

SVN r4253 (trunk)
2013-05-12 18:27:03 +00:00
Randy Heit ce39368796 - Fixed: Players using colorsets instead of custom colors overrode their team colors.
SVN r4169 (trunk)
2013-02-27 03:27:33 +00:00
Randy Heit efbaab3440 - Never set the player actor's scale to the skin's directly. Only do it indirectly through
P_CheckPlayerSprite().

SVN r4005 (trunk)
2013-01-02 02:26:22 +00:00
Randy Heit 562cf04db2 - Update scripting branch to trunk.
SVN r3758 (scripting)
2012-07-14 03:04:41 +00:00
Randy Heit c0bc7532ac - Fixed: If a player has the NOSKIN flag set, do not change their appearance to that of the
skin when spawning or changing the skin.

SVN r3560 (trunk)
2012-04-14 03:07:28 +00:00
Christoph Oelckers 6f824e5ec7 - fixed bot color issue, thanks to Gez's patch.
SVN r3495 (trunk)
2012-03-31 11:13:34 +00:00
Randy Heit fc6d3738bb - Fixed: D_WriteUserInfoStrings() mixed the colorset with the color for the verbose form.
SVN r3452 (trunk)
2012-03-18 01:45:57 +00:00
Christoph Oelckers 163301dcd5 - took all includes of farchive.h out of headers. This file will have to be included explicitly in each source file that needs it.
SVN r3259 (trunk)
2011-07-06 14:20:54 +00:00