Documentation
¶
Index ¶
- Constants
- Variables
- func CurrentTic() int32
- func EnableQuitting(enable bool)
- func I_GetTimeMS() int32
- func RandomState() (prnd, mrnd int32)
- func ReadMusicPCM(buf []int16) int
- func ResetClock()
- func Run(fg DoomFrontend, args []string)
- func SeedRandom(seed uint8)
- func SetDeterministicTics(enable bool)
- func SetVirtualFileSystem(a fs.FS)
- func Stop()
- type DoomEvent
- type DoomFrontend
- type Evtype_t
Constants ¶
const AM_NUMMARKPOINTS = 10
const ANG1801 = 2147483648
const ANG18011 = 2147483648
const ANG18013 = 2147483648
const ANG18015 = 2147483648
const ANG1803 = 2147483648
const ANG1805 = 2147483648
const ANG1807 = 2147483648
const ANG1809 = 2147483648
const ANG2701 = 3221225472
const ANG2703 = 3221225472
const ANG2705 = 3221225472
const ANG451 = 536870912
const ANG453 = 536870912
const ANG455 = 536870912
const ANG457 = 536870912
const ANG901 = 1073741824
const ANG903 = 1073741824
const ANG905 = 1073741824
const ANG907 = 1073741824
const ANG909 = 1073741824
const ANGLETOFINESHIFT = 19
const ANGLETOSKYSHIFT = 22
const ANIM_ALWAYS = 0
const ANIM_LEVEL = 2
const ANIM_RANDOM = 1
const BACKUPTICS = 128
const BASETHRESHOLD = 100
const BASEYCENTER = 100
const BLACK = 0
const BODYQUESIZE = 32
const BONUSADD = 6
const BOXBOTTOM = 1
const BOXLEFT = 2
const BOXRIGHT = 3
const BOXTOP = 0
const BUTTONTIME = 35
const CF_GODMODE = 2
const CF_NOCLIP = 1
const CF_NOMOMENTUM = 4
const DEFAULT_FLOAT = 3
const DEFAULT_INT_HEX = 1
const DEFAULT_KEY = 4
const DEFAULT_RAM = 16
const DEFAULT_SPECHIT_MAGIC = 29400216
const DEFAULT_STRING = 2
const DEH_DEFAULT_BFG_CELLS_PER_SHOT = 40
const DEH_DEFAULT_BLUE_ARMOR_CLASS = 2
const DEH_DEFAULT_GOD_MODE_HEALTH = 100
const DEH_DEFAULT_GREEN_ARMOR_CLASS = 1
const DEH_DEFAULT_IDFA_ARMOR = 200
const DEH_DEFAULT_IDFA_ARMOR_CLASS = 2
const DEH_DEFAULT_IDKFA_ARMOR = 200
const DEH_DEFAULT_IDKFA_ARMOR_CLASS = 2
const DEH_DEFAULT_INITIAL_BULLETS = 50
const DEH_DEFAULT_INITIAL_HEALTH = 100
const DEH_DEFAULT_MAX_ARMOR = 200
const DEH_DEFAULT_MAX_HEALTH = 200
const DEH_DEFAULT_MAX_SOULSPHERE = 200
const DEH_DEFAULT_MEGASPHERE_HEALTH = 200
const DEH_DEFAULT_SOULSPHERE_HEALTH = 100
const DEH_DEFAULT_SPECIES_INFIGHTING = 0
const DEMOMARKER = 128
const DISTMAP = 2
const DI_EAST = 0
const DI_NODIR = 8
const DI_NORTH = 2
const DI_NORTHEAST = 1
const DI_NORTHWEST = 3
const DI_SOUTH = 6
const DI_SOUTHEAST = 7
const DI_SOUTHWEST = 5
const DI_WEST = 4
const DM_KILLERSX = 10
const DM_KILLERSY = 100
const DM_MATRIXX = 42
const DM_MATRIXY = 68
const DM_SPACINGX = 40
const DM_TOTALSX = 269
const DM_VICTIMSX = 5
const DM_VICTIMSY = 50
const DONUT_FLOORHEIGHT_DEFAULT = 0
const DONUT_FLOORPIC_DEFAULT = 22
const DOOM_191_VERSION = 111
const DOS_MEM_DUMP_SIZE = 10
const EISDIR = 21
const FASTDARK = 15
const FF_FRAMEMASK1 = 32767
const FF_FRAMEMASK3 = 32767
const FF_FULLBRIGHT1 = 32768
const FIELDOFVIEW = 2048
const FINEANGLES = 8192
const FRACBITS = 16
const FRACUNIT = 1 << FRACBITS
const FRICTION = 59392
const FUZZTABLE = 50
const F_PANINC = 4
const F_STAGE_ARTSCREEN = 1
const F_STAGE_CAST = 2
const F_STAGE_TEXT = 0
const GLOWSPEED = 8
const GRAYSRANGE = 16
const GREENRANGE = 16
const HEIGHTBITS = 12
const HU_BROADCAST = 5
const HU_MAXLINELENGTH = 80
const HU_MSGHEIGHT = 1
const HU_MSGX = 0
const HU_MSGY = 0
const HU_TITLEX = 0
const INFRATICS = 4200
const INT_MAX1 = 2147483647
const INT_MAX11 = 2147483647
const INT_MAX13 = 2147483647
const INT_MAX15 = 2147483647
const INT_MAX17 = 2147483647
const INT_MAX19 = 2147483647
const INT_MAX5 = 2147483647
const INT_MAX7 = 2147483647
const INT_MAX9 = 2147483647
const INVERSECOLORMAP = 32
const INVISTICS = 2100
const INVULNTICS = 1050
const IRONTICS = 2100
const ITEMQUESIZE = 128
const KEY_BACKSPACE1 = 127
const KEY_BACKSPACE3 = 127
const KEY_DOWNARROW1 = 175
const KEY_ENTER = 13
const KEY_EQUALS1 = 61
const KEY_ESCAPE = 27
const KEY_FIRE1 = 163
const KEY_LEFTARROW1 = 172
const KEY_MINUS1 = 45
const KEY_PAUSE1 = 255
const KEY_RIGHTARROW1 = 174
const KEY_STRAFE_L1 = 160
const KEY_STRAFE_R1 = 161
const KEY_TAB = 9
const KEY_UPARROW1 = 173
const KEY_USE1 = 162
const LIGHTLEVELS = 16
const LIGHTSCALESHIFT = 12
const LIGHTSEGSHIFT = 4
const LIGHTZSHIFT = 20
const LINEHEIGHT = 16
const MAPBLOCKUNITS = 128
const MAXBOB = 1048576
const MAXBUTTONS = 16
const MAXCEILINGS = 30
const MAXDRAWSEGS = 256
const MAXEVENTS = 64
const MAXHEALTH = 100
const MAXINTERCEPTS_ORIGINAL = 128
const MAXLIGHTSCALE = 48
const MAXLIGHTZ = 128
const MAXLINEANIMS = 64
const MAXPLATS = 30
const MAXPLAYERS = 4
const MAXSPECIALCROSS_ORIGINAL = 8
const MAXSWITCHES = 50
const MAX_ADJOINING_SECTORS = 20
const MAX_CAPTURES = 32
const MAX_JOY_BUTTONS = 20
const MAX_MOUSE_BUTTONS = 8
const MINFRAGMENT = 64
const MIN_RAM = 16
const MOUSE_SPEED_BOX_HEIGHT = 9
const MOUSE_SPEED_BOX_WIDTH = 120
const MTF_AMBUSH = 8
const MusicSampleRate = 44100
MusicSampleRate is the stereo sample rate (Hz) at which the OPL music module renders. The host frontend should pull ReadMusicPCM at this rate.
const NET_MAXPLAYERS = 8
const NF_SUBSECTOR1 = 32768
const NF_SUBSECTOR3 = 32768
const NF_SUBSECTOR5 = 32768
const NG_SPACINGX = 64
const NG_STATSY = 50
const NORM_SEP = 128
const NUMAMMO = 4
const NUMBONUSPALS = 4
const NUMCARDS = 6
const NUMCOLORMAPS = 32
const NUMKEYS = 256
const NUMMAPS = 9
const NUMMOBJTYPES = 137
const NUMMUSIC = 68
const NUMPOWERS = 6
const NUMPSPRITES = 2
const NUMREDPALS = 8
const NUMSFX = 109
const NUMWEAPONS = 9
const NUM_QUITMESSAGES = 8
const NUM_VIRTUAL_BUTTONS = 10
const NoState = -1
const PLATWAIT = 3
const PT_ADDLINES = 1
const PT_ADDTHINGS = 2
const PT_EARLYOUT = 4
const Pst_DEAD = 1
const Pst_LIVE = 0
const Pst_REBORN = 2
const QUEUESIZE = 128
const RADIATIONPAL = 13
const REDRANGE = 16
const SAVEGAMESIZE = 180224
const SAVEGAME_EOF = 29
const SAVESTRINGSIZE = 24
const SBARHEIGHT = 32
const SCREENHEIGHT = 200
const SCREENHEIGHT_4_3 = 240
const SCREENWIDTH = 320
const SCREENWIDTH_4_3 = 256
const SHOWNEXTLOCDELAY = 4
const SHRT_MAX1 = 32767
const SIL_BOTH = 3
const SIL_BOTTOM = 1
const SIL_TOP = 2
const SLOPEBITS = 11
const SLOPERANGE = 2048
const SLOWDARK = 35
const SLOWTURNTICS = 6
const SNDDEVICE_ADLIB = 2
const SNDDEVICE_GENMIDI = 8
const SNDDEVICE_GUS = 5
const SNDDEVICE_SB = 3
const SP_STATSX = 50
const SP_STATSY = 50
const SP_TIMEX = 16
const STARTBONUSPALS = 9
const STARTREDPALS = 1
const STOPSPEED = 4096
const STROBEBRIGHT = 5
const ShowNextLoc = 1
const StatCount = 0
const TEXTSPEED = 3
const TEXTWAIT = 250
const TICRATE = 35
const TURBOTHRESHOLD = 50
const VDOORWAIT = 150
const VERSIONSIZE = 16
const WI_SPACINGY = 33
const WI_TITLEY = 2
const ZONEID = 1919505
Variables ¶
var DG_ScreenBuffer *image.RGBA
var EpiDef menu_t
var EpisodeMenu [4]menuitem_t
var I_VideoBuffer []byte
var LoadDef menu_t
var LoadMenu [6]menuitem_t
var M_QuitResponse = func(key int32) { if key != key_menu_confirm { return } if netgame == 0 { if gamemode == commercial { s_StartSound(nil, quitsounds2[gametic>>2&7]) } else { s_StartSound(nil, quitsounds[gametic>>2&7]) } } i_Quit() }
var MainDef menu_t
var MainMenu [6]menuitem_t
var NUMANIMS = [4]int32{ 0: int32(len(epsd0animinfo)), 1: int32(len(epsd1animinfo)), 2: int32(len(epsd2animinfo)), }
var NUMCMAPS int32
C documentation
// # of commercial levels
var NewDef menu_t
var NewGameMenu [5]menuitem_t
var OptionsDef menu_t
var OptionsMenu [8]menuitem_t
var ReadDef1 menu_t
var ReadDef2 menu_t
var ReadMenu1 [1]menuitem_t
var ReadMenu2 [1]menuitem_t
var S_music [68]musicinfo_t
var S_sfx [NUMSFX]sfxinfo_t
var SaveDef menu_t
var SaveMenu [6]menuitem_t
C documentation
// // SAVE GAME MENU //
var SoundDef menu_t
var SoundMenu [4]menuitem_t
var TRACEANGLE angle_t
Functions ¶
func CurrentTic ¶
func CurrentTic() int32
CurrentTic returns the engine's current tic counter as observed by i_GetTime. Useful for the harvest-reference tool to checkpoint framebuffers at exact tic boundaries: callers poll CurrentTic from the DrawFrame callback and snapshot when CurrentTic matches an expected checkpoint value.
In deterministic mode this is exactly equal to the number of completed tics since ResetClock; in wall-clock mode it is the wall-clock-derived tic count and is therefore non-deterministic.
func EnableQuitting ¶
func EnableQuitting(enable bool)
func I_GetTimeMS ¶
func I_GetTimeMS() int32
func RandomState ¶
func RandomState() (prnd, mrnd int32)
RandomState returns the current (prndindex, rndindex) pair. The harvest-reference tool records this value alongside the framebuffer hash at every checkpoint, so the test runner can detect PRNG drift independently of frame-pixel drift — useful when a frame mismatch could plausibly come from either a PRNG step or a missed input.
func ReadMusicPCM ¶
ReadMusicPCM renders interleaved stereo int16 music PCM into buf (len must be even), advancing the OPL player's clock, and returns the number of stereo FRAMES written. It is safe to call from a host audio-callback goroutine. If no song is playing it zero-fills buf and returns len(buf)/2. This is the seam by which a frontend mixes music alongside SFX, mirroring chocolate-doom's OPL audio callback.
func ResetClock ¶
func ResetClock()
ResetClock zeroes the synthetic tic counter (dg_fake_tics) and the monotonic basetime so that the next i_GetTime returns 0. Combined with SetDeterministicTics(true) this gives the engine a clean "tic 0 at Run entry" starting condition, which is the second precondition for the provable protocol (alongside SeedRandom).
Calling between two Run invocations is supported and recommended: without it the second run inherits the first run's basetime and the tic timeline jumps mid-execution.
func Run ¶
func Run(fg DoomFrontend, args []string)
func SeedRandom ¶
func SeedRandom(seed uint8)
SeedRandom resets DOOM's two PRNG indices (p_random + m_random) to a known starting position. The DOOM PRNG is the canonical 256-entry table indexed by `prndindex` / `rndindex` (see doom.go around the p_Random / m_Random definitions); reset to a known index produces a fully deterministic random sequence for the rest of the engine run, which is exactly the precondition the provable-protocol test runner needs.
Calling with seed == 0 reproduces the historical DOOM startup state (both indices == 0). Any 0..255 value is valid; values outside that range are taken modulo 256.
SAFETY: must be called BEFORE Run, or from within the engine's main thread between tics. Concurrent invocation while the engine is reading the indices is undefined.
func SetDeterministicTics ¶
func SetDeterministicTics(enable bool)
SetDeterministicTics switches the engine's internal clock from wall-clock (time.Since(start_time)) to a frame-driven counter: every call to i_Sleep increments a synthetic tic counter, and every call to i_GetTicks reads that counter. The effect is a tic-locked run where one i_Sleep == one tic, regardless of host scheduling.
This is the existing `dg_run_full_speed` knob that the engine's own TestDoomDemo + TestLoadSave already rely on. Exposing it here lets host-side test runners (and the harvest-reference tool) opt into the same determinism without reaching into unexported state.
SAFETY: same caveats as SeedRandom — set before Run for a clean fully-deterministic execution.
func SetVirtualFileSystem ¶
SetVirtualFileSystem sets the virtual file system
Types ¶
type DoomFrontend ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
backend
|
|
|
tamago
Package tamago provides a [gore.DoomFrontend] implementation that drives DOOM output and input through cloud-boot's bare-metal virtio device tree.
|
Package tamago provides a [gore.DoomFrontend] implementation that drives DOOM output and input through cloud-boot's bare-metal virtio device tree. |
|
cmd
|
|
|
harvest-reference
command
|
|
|
Package embedwad is a scaffold for serving the DOOM WAD to the engine in a TamaGo bare-metal target, where there is no filesystem.
|
Package embedwad is a scaffold for serving the DOOM WAD to the engine in a TamaGo bare-metal target, where there is no filesystem. |
|
example
|
|
|
doomocracy
command
|
|
|
ebitengine
command
|
|
|
sdldoom
command
|
|
|
termdoom
command
|
|
|
webserver
command
|
|
|
music
|
|
|
genmidi
Package genmidi parses the DMX GENMIDI lump, the OPL instrument bank used by DOOM's Adlib/OPL music playback.
|
Package genmidi parses the DMX GENMIDI lump, the OPL instrument bank used by DOOM's Adlib/OPL music playback. |
|
midi
Package midi parses Standard MIDI Files (type 0 and 1) into tracks of timestamped events.
|
Package midi parses Standard MIDI Files (type 0 and 1) into tracks of timestamped events. |
|
mus
Package mus parses the DMX MUS music format used by DOOM's D_* lumps and converts it to a Standard MIDI File, matching chocolate-doom's mus2mid conversion byte-for-byte.
|
Package mus parses the DMX MUS music format used by DOOM's D_* lumps and converts it to a Standard MIDI File, matching chocolate-doom's mus2mid conversion byte-for-byte. |
|
oplplayer
Package oplplayer is a pure-Go port of chocolate-doom's DMX OPL music player (i_oplmusic.c).
|
Package oplplayer is a pure-Go port of chocolate-doom's DMX OPL music player (i_oplmusic.c). |
|
Package netgame implements the classic DOOM netgame (multiplayer) protocol as a self-contained, testable pure-Go package: the doomcom / doomdata / ticcmd lockstep exchange modelled after id Software's d_net.c / i_net.c (the chocolate-doom-faithful behaviour).
|
Package netgame implements the classic DOOM netgame (multiplayer) protocol as a self-contained, testable pure-Go package: the doomcom / doomdata / ticcmd lockstep exchange modelled after id Software's d_net.c / i_net.c (the chocolate-doom-faithful behaviour). |
