Commit Graph

200 Commits

Author SHA1 Message Date
terminx 584b748897 Add CON_CLAMP
git-svn-id: https://svn.eduke32.com/eduke32@5728 1a8010ca-5511-0410-912e-c29ae57300e0
2016-05-13 22:15:37 +00:00
terminx eaa2b90251 Implement CON_NEXTSECTORNEIGHBORZ
git-svn-id: https://svn.eduke32.com/eduke32@5616 1a8010ca-5511-0410-912e-c29ae57300e0
2016-02-07 02:38:32 +00:00
terminx 03b0335130 Implement Mapster32's CON_FOR into EDuke32.
git-svn-id: https://svn.eduke32.com/eduke32@5604 1a8010ca-5511-0410-912e-c29ae57300e0
2016-02-02 00:21:24 +00:00
terminx 3e82145e2c CON_MOVESECTOR. Triggers built-in sector movement routines... not really appropriate to use outside of EVENT_MOVEEFFECTORS.
git-svn-id: https://svn.eduke32.com/eduke32@5581 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-21 19:35:34 +00:00
terminx ba80a5f35e First attempt at providing CON control of the internal sector animation system. Read the commit if you want to know how it works!
git-svn-id: https://svn.eduke32.com/eduke32@5569 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-21 19:34:56 +00:00
hendricks266 c1f67576a4 CON: Add userdef[].soundtoggle. Read-only.
git-svn-id: https://svn.eduke32.com/eduke32@5553 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-12 10:31:01 +00:00
terminx 31e89f12b2 Clean up a couple instances of direct usage of a magic number in the CON compiler. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@5534 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-11 05:05:10 +00:00
hendricks266 f403d6234c C-CON: Add ifvarge, ifvarle, and ifvarboth in line with ifvarvarge, ifvarvarle, and ifvarvarboth.
git-svn-id: https://svn.eduke32.com/eduke32@5530 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-08 01:33:39 +00:00
hendricks266 5d9b8a2bb1 C-CON: Clean up pointer handling in the parser so we have less to re-offset in C_SetScriptSize. Also fixes bugs in r5093 and/or r5097.
git-svn-id: https://svn.eduke32.com/eduke32@5521 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-08 01:33:01 +00:00
hendricks266 d3f9244d66 Remove -CONversion command line parameter, because it has been supplanted by r5499's automatic identifier masking.
git-svn-id: https://svn.eduke32.com/eduke32@5519 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-08 01:32:53 +00:00
terminx 748d9ac22f Alter VM_ScriptInfo() to take a ptr to the script to disassemble, and dump disassembly to the log at startup when an internal compiler error occurs.
git-svn-id: https://svn.eduke32.com/eduke32@5513 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-07 03:30:07 +00:00
terminx 14938ea5fd Add "klabs" keyword to CON, to take a gamevar and set it to its absolute value. The internal "inv" function to invert a gamevar's value has also been exposed externally.
git-svn-id: https://svn.eduke32.com/eduke32@5501 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-02 01:56:29 +00:00
terminx 01ebee280e Add commands added in previous commit to g_keywdate[], clean up a few CON compilation warning messages
git-svn-id: https://svn.eduke32.com/eduke32@5500 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-02 01:56:25 +00:00
terminx 7c976018be Adds the following keywords from M32script into CON: shiftvarvarl, shiftvarvarr, ifvarvarle, ifvarvarge, ifvarvarboth, whilevarl, and whilevarvarl.
This also adds the shorthand versions of some commands, like "set" for "setvarvar", "add" for "addvarvar", "ife" for "ifvarvare", etc. There are about 30 of these. Because some of these names may already be used in some projects as variable names, this revision also includes a somewhat large change in variable naming rules: gamevars may now have the same names as CON keywords, with the caveat that the masked keyword is no longer accessible. This results in a warning at compile time but should ensure nobody's project ever stops compiling due to the introduction of new keywords.

git-svn-id: https://svn.eduke32.com/eduke32@5499 1a8010ca-5511-0410-912e-c29ae57300e0
2016-01-02 01:56:20 +00:00
terminx 97c4b40ca2 Add vm_player, vm_sprite and vm_distance to get/setuserdef. This controls the sprite and player referenced by things like "THISACTOR", all of the "ifp" conditionals, per-actor gamevar access, etc. This is intended to be used to un-gimp things like EVENT_WORLD.
git-svn-id: https://svn.eduke32.com/eduke32@5489 1a8010ca-5511-0410-912e-c29ae57300e0
2015-12-23 04:06:20 +00:00
hendricks266 f69f1e73df CON: Add "defstate" token which functions identically as in M32script: synonymous with CON's "state" only at top-level (when defining a state). Useful for syntax highlighting.
git-svn-id: https://svn.eduke32.com/eduke32@5353 1a8010ca-5511-0410-912e-c29ae57300e0
2015-09-24 06:31:44 +00:00
hendricks266 ad94a8399c C-CON: Add userdef members "globalflags" and "globalgameflags", which control the values specified by the def commands of the same name.
git-svn-id: https://svn.eduke32.com/eduke32@5248 1a8010ca-5511-0410-912e-c29ae57300e0
2015-05-27 08:45:30 +00:00
helixhorned 1fc7e10843 savegame: fix g_tile[].proj memory leaks, halve number of projectile_t allocations.
git-svn-id: https://svn.eduke32.com/eduke32@5191 1a8010ca-5511-0410-912e-c29ae57300e0
2015-05-16 11:56:49 +00:00
hendricks266 5979378c4e CON: Add player[].index, which returns the player ID that you put in. Mostly useful to get the magic value of THISACTOR when applied to the player struct.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5165 1a8010ca-5511-0410-912e-c29ae57300e0
2015-04-26 00:07:57 +00:00
helixhorned 5683beec3d Do "typedef projectile_t defaultprojectile_t;" instead of having an indetical-member type.
Move projectile_t to player.h.

git-svn-id: https://svn.eduke32.com/eduke32@5159 1a8010ca-5511-0410-912e-c29ae57300e0
2015-04-18 21:59:21 +00:00
hendricks266 0bc349fde2 C-CON: Add two new structs, tiledata and paldata, accessible only through quick-access.
git-svn-id: https://svn.eduke32.com/eduke32@5115 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-30 05:56:37 +00:00
hendricks266 0adcc4a3f7 C-CON: Add read-only player structure member "hudpal", that returns the result of P_GetHudPal().
git-svn-id: https://svn.eduke32.com/eduke32@5099 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-27 12:29:24 +00:00
hendricks266 0805a0ed45 CON: Add token "appendevent", which functions identically to "onevent" except that the event's code is chained to the end of any previous events, instead of the beginning.
git-svn-id: https://svn.eduke32.com/eduke32@5093 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-25 21:31:11 +00:00
hendricks266 49c85f644d C-CON: Add quick access for the remaining structures without it.
git-svn-id: https://svn.eduke32.com/eduke32@5088 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-25 06:27:57 +00:00
hendricks266 5c8a2e3ea6 C-CON: Enumify quick structure access.
git-svn-id: https://svn.eduke32.com/eduke32@5087 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-25 06:27:42 +00:00
hendricks266 ab58a33ec6 Menus: Add a Cheats menu to options.
It's old-school.

git-svn-id: https://svn.eduke32.com/eduke32@5084 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-24 10:49:03 +00:00
terminx c9ce545ab8 A lot of CON rewrites/optimizations. Converts projectile system to dynamic allocation, saving a bunch of memory (something like sizeof(projectile_t) * MAXTILES * 2). This commit also contains changes that reduce overhead for CON commands that take a lot of parameters, by way of adding a Gv_GetManyVars() to replace long strings of subsequent calls to Gv_GetVarX().
Savegame version has been bumped due to the projectile changes. There is no way this commit doesn't cause at least one bug, so DONT_BUILD. ;)

git-svn-id: https://svn.eduke32.com/eduke32@5080 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-24 00:40:55 +00:00
hendricks266 c86bd80dd7 C-CON: Add read-only userdef members "gametypeflags" and "m_gametypeflags", which return GametypeFlags[ud.coop] and GametypeFlags[ud.m_coop] respectively.
git-svn-id: https://svn.eduke32.com/eduke32@5044 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-08 07:57:28 +00:00
hendricks266 d7409a5a95 C-CON: Add read-only userdef members "usevoxels", "usehightile", and "usemodels".
git-svn-id: https://svn.eduke32.com/eduke32@5043 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-08 07:57:13 +00:00
hendricks266 b61908cbf3 CON: Add "resetplayerflags". Flag 1 means "don't ask the user if they want to load".
git-svn-id: https://svn.eduke32.com/eduke32@5039 1a8010ca-5511-0410-912e-c29ae57300e0
2015-03-04 02:15:15 +00:00
hendricks266 697e7d0936 CON: Add "definevolumeflags", currently equipped to hide an episode from the single player and/or multiplayer screens.
enum
{
    EF_HIDEFROMSP = 1<<0,
    EF_HIDEFROMMP = 1<<1,
};

git-svn-id: https://svn.eduke32.com/eduke32@5033 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-22 22:15:20 +00:00
hendricks266 afccb6d735 CON: Extend undefinevolume so that it also undefines all levels in the specified volume.
git-svn-id: https://svn.eduke32.com/eduke32@5032 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-22 22:14:54 +00:00
hendricks266 31c9d21b06 CON: Rename "cutscene" command to "startcutscene".
git-svn-id: https://svn.eduke32.com/eduke32@5031 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-22 22:14:39 +00:00
terminx 22ac21598b C-CON changes
git-svn-id: https://svn.eduke32.com/eduke32@4988 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-11 05:22:11 +00:00
terminx 50c30ab790 Animation system overhaul part 1. This allows for an unlimited number of .anm/.ivf files to be defined via duke3d.def and played back at any time with the new CON commands. Syntax is currently as follows, but may change:
cutscene "somefile.anm" { delay 10 } // defines somefile.anm with a delay of 10 120Hz tics between frames. a more typical framerate method may come later, but this is how the originals worked.

Once defined, they can be played through CON with the new playback command, also called "cutscene". It works like this:

definequote 12345 somefile.anm
define ANIM_SOMEFILE 12345

...

cutscene ANIM_SOMEFILE // halts game execution and immediately plays cutscene, resuming execution when finished

...

Sounds can be played during animations (and tiles can be overlaid, etc) like this:

onevent EVENT_CUTSCENE
    ifcutscene ANIM_SOMEFILE
    {
        ifvare RETURN 12 // frame 12
            sound FLY_BY
        rotatesprite ...
    }
endevent

The value of the RETURN var at the end of EVENT_CUTSCENE determines the next frame to play. This can be used for looping, etc. Attempting to play animations backwards outright is not advised as animations only seek in one direction (so rewinding requires running it through from frame 0 again). This is will WIP and hasn't been heavily tested at all, so please try it out.

git-svn-id: https://svn.eduke32.com/eduke32@4987 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-11 05:22:07 +00:00
hendricks266 929b04d473 CON: Add undefinevolume, undefineskill, and undefinelevel.
git-svn-id: https://svn.eduke32.com/eduke32@4977 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-09 05:50:33 +00:00
hendricks266 e8f842ac28 CON: Add read-only access to ud.config.MusicToggle through the "musictoggle" member.
git-svn-id: https://svn.eduke32.com/eduke32@4970 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-08 08:04:09 +00:00
hendricks266 b355d75ab3 CON: Add STR_YOURTIME, STR_PARTIME, STR_DESIGNERTIME, and STR_BESTTIME to qgetsysstr.
git-svn-id: https://svn.eduke32.com/eduke32@4969 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-08 08:03:50 +00:00
hendricks266 d7f846d0b6 Factor out generation of strings for time values in the bonus screen. This involves the creation of ud.playerbest.
git-svn-id: https://svn.eduke32.com/eduke32@4968 1a8010ca-5511-0410-912e-c29ae57300e0
2015-02-08 08:03:30 +00:00
hendricks266 93a3ff34e8 Add events EVENT_DISPLAYINACTIVEMENU and EVENT_DISPLAYINACTIVEMENUREST and userdef members m_origin_x and m_origin_y.
This allows for CON screen display code to use menu animations. The following is an example of how to adapt screen features that should animate.

before:

onevent EVENT_DISPLAYMENUREST
    ifvare current_menu 0 // main menu
    {
        setvar x 1
        setvar y 1
        rotatesprite x y zoom ang tilenum shade pal orientation 0 0 xdim ydim
    }
endevent

after:

state DisplayMenuCommon
    ifvare RETURN 0 // main menu
    {
        getuserdef[THISACTOR].m_origin_x x
        getuserdef[THISACTOR].m_origin_y y
        addvar x 65536
        addvar y 65536
        rotatesprite16 x y zoom ang tilenum shade pal orientation 0 0 xdim ydim
    }
ends

onevent EVENT_DISPLAYMENUREST state DisplayMenuCommon endevent
onevent EVENT_DISPLAYINACTIVEMENUREST state DisplayMenuCommon endevent

git-svn-id: https://svn.eduke32.com/eduke32@4945 1a8010ca-5511-0410-912e-c29ae57300e0
2015-01-25 12:16:58 +00:00
hendricks266 011fd40dda CON: Add new commands "getmusicposition" and "setmusicposition" that operate on the playback position of the current music track.
// Example: Switch between tracks like radio stations.
 getmusicposition temp
 starttrackvar next_music_track
 setmusicposition temp

Only implemented for Ogg Vorbis, FLAC, and XA. Consult the devs before using these commands.

git-svn-id: https://svn.eduke32.com/eduke32@4928 1a8010ca-5511-0410-912e-c29ae57300e0
2015-01-17 00:28:49 +00:00
terminx 364cf15c4f Questionable CON changes and optimizations. <3
git-svn-id: https://svn.eduke32.com/eduke32@4902 1a8010ca-5511-0410-912e-c29ae57300e0
2015-01-11 04:56:10 +00:00
hendricks266 9268b9f0b6 Make a bunch of things extern "C". This should fix C++ builds on OS X and with Lunatic. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4766 1a8010ca-5511-0410-912e-c29ae57300e0
2014-11-26 04:39:23 +00:00
terminx 99e21ffa94 Part 1 of attempting to adhere to C standard section 7.1.3. It turns out it's illegal to use identifiers that begin with _ or have __ anywhere in them. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4747 1a8010ca-5511-0410-912e-c29ae57300e0
2014-11-22 12:32:56 +00:00
terminx bf3c0de73a Mainly misc cleanups (and a fix for the C++ build), but there are a few important changes in here.
VM_OnEvent() has become VM_OnEvent(), VM_OnEventWithReturn(), VM_OnEventWithDist(), and VM_OnEventWithBoth() (the latter of which is only ever used once...). Of course, this required every call to VM_OnEvent() be changed.

memberlabel_t and vmstate_t have been changed to use the regular "int" type versus explicitly specifying int32_t as they did previously. The rationale for this change is simply that it looks cleaner, and I think we should move toward just using "int" in most cases where there's no particular reason to specify an explicit data type.

Also changes CON_KILLIT to just "return" instead of "continue". DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4745 1a8010ca-5511-0410-912e-c29ae57300e0
2014-11-22 12:29:25 +00:00
hendricks266 c1c01f0e0b Replace the funkily-formatted GNU.TXT with the FSF's official gpl-2.0.txt. Also, update the FSF's address in all source files that contain it.
DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4541 1a8010ca-5511-0410-912e-c29ae57300e0
2014-07-20 08:55:56 +00:00
helixhorned 7603f432df Rename sector[].filler member to '.fogpal'. From CON, keep the '.alignto' alias.
The overall situation is thus as follows:
 - in C and from Lua, that member is called 'fogpal'
 - In CON (both C-CON and LunaCON), it's 'fogpal' with 'alignto' being an alias;
   'filler' wasn't available before, either.
 - In m32script, it's 'fogpal' or 'alignto' ('filler' is not available any more)

git-svn-id: https://svn.eduke32.com/eduke32@4416 1a8010ca-5511-0410-912e-c29ae57300e0
2014-04-05 11:28:10 +00:00
terminx ba0c64971c Widespread use of ARRAY_SIZE macro.
git-svn-id: https://svn.eduke32.com/eduke32@4385 1a8010ca-5511-0410-912e-c29ae57300e0
2014-03-22 09:25:15 +00:00
helixhorned 8029aceaa4 CON: add sprite pseudo-member 'isvalid', getting 1 if the sprite is valid.
And 0 otherwise. Before accessing a sprite that is not not known to be
definitely valid (e.g. a loop over all sprites from 0 to MAXSPRITES-1),
one should check for validity before accessing it in any other fashion.

git-svn-id: https://svn.eduke32.com/eduke32@4146 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-11 16:48:17 +00:00
helixhorned 4f88aaf4d2 Retire global 'lastvisinc'.
It was only ever used as upper bound to the time that a visibility change
decays, but since it does that in an exponential fashion, there's really
no point.

git-svn-id: https://svn.eduke32.com/eduke32@3961 1a8010ca-5511-0410-912e-c29ae57300e0
2013-07-18 18:08:13 +00:00