Repository: Erick194/PSXDOOM-RE
Branch: master
Commit: 923e5feb02dc
Files: 111
Total size: 1.2 MB
Directory structure:
gitextract_ch5iijr1/
├── CONTRIBUTORS.md
├── ERRORDETECTION.md
├── LICENSE
├── PSXDOOM/
│ ├── GAME/
│ │ ├── CD/
│ │ │ └── PSXDOOM/
│ │ │ ├── ABIN/
│ │ │ │ └── MOVIE.STR
│ │ │ ├── CDAUDIO/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR0/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR1/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR2/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR3/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR4/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR5/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR6/
│ │ │ │ └── tmp.txt
│ │ │ ├── MAPDIR7/
│ │ │ │ └── tmp.txt
│ │ │ ├── MUSIC/
│ │ │ │ └── tmp.txt
│ │ │ ├── SNDMAPS1/
│ │ │ │ └── tmp.txt
│ │ │ ├── SNDMAPS2/
│ │ │ │ └── tmp.txt
│ │ │ └── SNDMAPS3/
│ │ │ └── tmp.txt
│ │ ├── MAKE_CD.bat
│ │ └── PSXDOOMCD.xml
│ ├── LCDLOAD.C
│ ├── LCDLOAD.H
│ ├── MAIN.LNK
│ ├── MAKEFILE.bat
│ ├── PSXCD.C
│ ├── PSXCD.H
│ ├── PSXCDABS.C
│ ├── PSXCDABS.H
│ ├── PSXCMD.C
│ ├── PSXDOOM.cbp
│ ├── PSXDOOM.layout
│ ├── PSXSPU.C
│ ├── PSXSPU.H
│ ├── PSX_FILE.C
│ ├── SEQLOAD.C
│ ├── SEQLOAD.H
│ ├── SEQLOADR.C
│ ├── WESSAPI.C
│ ├── WESSAPI.H
│ ├── WESSAPIM.C
│ ├── WESSAPIP.C
│ ├── WESSAPIT.C
│ ├── WESSARC.C
│ ├── WESSARC.H
│ ├── WESSBASE.C
│ ├── WESSSEQ.C
│ ├── WESSSEQ.H
│ ├── am_main.c
│ ├── asm/
│ │ └── tmp.txt
│ ├── c_main.c
│ ├── cf_main.c
│ ├── d_main.c
│ ├── doomdata.h
│ ├── doomdef.h
│ ├── f_main.c
│ ├── g_game.c
│ ├── in_main.c
│ ├── info.c
│ ├── info.h
│ ├── l_main.c
│ ├── m_fixed.c
│ ├── m_fixed.s
│ ├── m_main.c
│ ├── m_password.c
│ ├── o_main.c
│ ├── obj/
│ │ └── tmp.txt
│ ├── p_base.c
│ ├── p_ceilng.c
│ ├── p_change.c
│ ├── p_doors.c
│ ├── p_enemy.c
│ ├── p_floor.c
│ ├── p_inter.c
│ ├── p_lights.c
│ ├── p_local.h
│ ├── p_map.c
│ ├── p_maputl.c
│ ├── p_mobj.c
│ ├── p_move.c
│ ├── p_plats.c
│ ├── p_pspr.c
│ ├── p_setup.c
│ ├── p_shoot.c
│ ├── p_sight.c
│ ├── p_slide.c
│ ├── p_spec.c
│ ├── p_spec.h
│ ├── p_switch.c
│ ├── p_telept.c
│ ├── p_tick.c
│ ├── p_user.c
│ ├── psxmain.c
│ ├── pw_main.c
│ ├── r_data.c
│ ├── r_local.h
│ ├── r_main.c
│ ├── r_phase1.c
│ ├── r_phase2.c
│ ├── s_sound.c
│ ├── snmain.s
│ ├── sounds.h
│ ├── soundst.h
│ ├── sprinfo.c
│ ├── st_main.c
│ ├── st_main.h
│ ├── t_main.c
│ ├── tables.c
│ ├── vsprintf.c
│ ├── w_wad.c
│ └── z_zone.c
├── PSYQ/
│ └── README.txt
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: CONTRIBUTORS.md
================================================
= PSXDOOM RE contributors (sorted alphabetically)
=
* **[Darragh Coy (intacowetrust)](https://github.com/BodbDearg)**
* Various information and code for PSX DOOM based on his own extensive reverse engineering efforts, including:
* Suggestions for changing names in variables:
cheatfullbright -> viewlighting
solidseg -> solidsubsectors
newend-> endsubsector
numsegs-> numdrawsubsectors
xtoviewangle -> yslope
vissprites_tmp ->visspritehead
lastsprite_p -> next
* Identification of differences in the DrawImage and I_DrawSprite code:
https://github.com/BodbDearg/PsyDoom/commit/9360bd322bc939a29903f21b19f216931b67f196#r37085143
* Bug identification, on line 259 in p_tick.c:
https://github.com/BodbDearg/PsyDoom/commit/50862aab3a3511dbc33269ee1249429314a71c18#commitcomment-37125911
* Identification of non-existent lines in the original code:
https://github.com/BodbDearg/PsyDoom/commit/8b7afc9d06f76c9f7fd00fc2e840107dd79a01de#r37163087
https://github.com/BodbDearg/PsyDoom/commit/775e02de38cd3bf50e3dfa7173529c6ff783d641#r37185771
* Update Identification from Psx Doom Greatest Hits:
https://github.com/BodbDearg/PsyDoom/commit/775e02de38cd3bf50e3dfa7173529c6ff783d641#r37185747
* Fire sky width repair in title:
https://github.com/BodbDearg/PsyDoom/commit/9bd75ff52b517bec0737d946b12db5254a1d0e95
* Identification of error in the CD_TRACK array:
https://github.com/BodbDearg/PsyDoom/commit/7f75f07502bcac6557c7d026f0188f07704899a6#r37223485
* Identification of non-existent lines, in the first version of Psx Doom, but which were subsequently added in the Greatest Hits version:
https://github.com/BodbDearg/PsyDoom/commit/0457990ceebdf6e0e5cd9279e63a25b97f96a28c#r37246141
* Line identification that is present in the 'Greatest Hits' version
https://github.com/BodbDearg/PsyDoom/commit/f258d1713611a4e3ea3766f4e02266f3a0772638#r37268303
* Identification of a small correction on line 265 in am_main.cpp
https://github.com/BodbDearg/PsyDoom/commit/40816754f7978d4c2b3c34bf0cdb31c8e50abd0b#r37315450
* Error identification in state blocks (else / if), in the files (f_main.c and st_main.c)
https://github.com/BodbDearg/PsyDoom/commit/f4d6fb8b428ff0262cde02f7c77fdd71dc45d0bc#r37348133
https://github.com/BodbDearg/PsyDoom/commit/201f293f0473e288c77b2f6e3c1a4c8b622c2968#commitcomment-37368964
* Non-existent lines are blocked in Psx Doom
https://github.com/BodbDearg/PsyDoom/commit/d60da8761208e3cb137e5b5fb85c6dd3a9ff514c#r37805111
* Wess_malloc : fix function signature
https://github.com/BodbDearg/PsyDoom/commit/a89ae26943fe08dc213d77bcabc50090c74316f0
* Return fix in wess_seq_loader_init function
https://github.com/BodbDearg/PsyDoom/commit/81f2bdc65724d2d7bce01e89900845803edeb957#r38278381
* Error identification on the line (168) in wess_seq_load_sub function
https://github.com/BodbDearg/PsyDoom/commit/89b38b23f6e0067d7ac123960c0cdc6064a8ef51#r38286066
* Changes in data types in variable ptk_stat->psp
https://github.com/BodbDearg/PsyDoom/commit/3eea78ba5a31da31f1007061f95bd6e32d275754#commitcomment-38312476
https://github.com/BodbDearg/PsyDoom/commit/b952d4be8126ae1fa16f3dfdb87b190c5db6aabb
* Changes in (Write_Vlq and Len_Vlq) functions
https://github.com/BodbDearg/PsyDoom/commit/f5e0d69afeb1dee45b699002ee26fe513ae2271d
* Non-existent return statement identification
https://github.com/BodbDearg/PsyDoom/commit/1a01906c71ea7aadd5a1393cb0cf3365ed68138e#r38841312
* Identification Missing sum in damagecount
https://github.com/BodbDearg/PsyDoom/commit/69dd2e3ad910eb1dcf5bd159651aafea7e21e3fa
* Automap: fix a PSX DOOM bug where lines flagged with ML_DONTDRAW
https://github.com/BodbDearg/PsyDoom/commit/5a9b4059ac7a18b724edc380c26fa3fc6e548f5a
* Range checks, added from Psy Doom to avoid alterations in P_RadiusAttack
https://github.com/BodbDearg/PsyDoom/commit/107f7d3d91824e06f3b9e5106e3498e98a590ebe
* P_FindNextHighestFloor: rewritten to avoid possible undefined behavior, from PsyDoom
https://github.com/BodbDearg/PsyDoom/commit/91a3cc54e050d1ebba3572fb935a2625717ee21f
* P_CheckKeyLock and P_SpawnSpecials: added skull key detection code from Greatest Hits version, also fatal BUFFER OVERFLOW is corrected in the D_memset assignment in activeceilings and activeplats
https://github.com/BodbDearg/PsyDoom/commit/227fbaddf5237088d236865169cb2cae995043a5
https://github.com/BodbDearg/PsyDoom/commit/f9e7295f63a2757f68bca66eb83661de71b184e5
* P_SpawnStrobeFlashFast: Fixed `minlight` and` maxlight` assignments, as they were reversed.
https://github.com/BodbDearg/PsyDoom/commit/8dec4ccbbd73d278b7b1d0d8e1090b0e39ad539d
* T_CountdownTimer: Correction of regressive count, the code towards which an extra tick will be delayed to carry out the action
https://github.com/BodbDearg/PsyDoom/commit/890d7dd90474b837d552b45cd38d737f11f7477f
* P_UseLines: Another blockmap check ranges is added
https://github.com/BodbDearg/PsyDoom/commit/ea5f99886ae054ac89c88dc961402b681a5b1562
* A_CheckReload: Eliminate the return status and change a "void" like in Doom PC, since it's return is unnecessary.
https://github.com/BodbDearg/PsyDoom/commit/7c6d6d851cd6f7f9ac6c3ddd04ce37c8ca53632b
* A_Punch and A_Saw: (angle_t) identification is added before (P_Random () - P_Random ()), in order to avoid demo desynchronization
https://github.com/BodbDearg/PsyDoom/commit/7b3d77fdb689f98808faf7a0d3a77f80556dd079
https://github.com/BodbDearg/PsyDoom/commit/dc56fa6d91ee6d8f54aa11e9053fafd85ddad7f3
* Suggestion to create a code to increase the map limit to 255
https://github.com/BodbDearg/PsyDoom/commit/78436a90bfb8e2318141c13bce2e9c8f313af814
* Floor rendering fix, from PsyDoom
https://github.com/BodbDearg/PsyDoom/commit/2a0250ca6b43d920706849d0d9018cc4656cb1f1
* **[Fabien Sanglard](https://github.com/fabiensanglard)**
* Article **[The Polygons of Doom: PSX](http://fabiensanglard.net/doom_psx/index.html)**
* Fix cryptic magic number "mode" for Plane rendition
* **[James Haley (Quasar)](https://github.com/haleyjd)**
* Wrong name identification in the PA_PointOnDivlineSide function, which must be called PA_DivlineSide
* **[Samuel Villarreal (svkaiser)](https://github.com/svkaiser)**
* Console DOOM reverse engineering, specs & tools:
https://www.doomworld.com/forum/topic/38608-the-console-doom-hacking-project-console-specs
* Doom64-EX source code (DOOM 64 was based on PSX DOOM, thus can serve as a reference point for it):
https://github.com/svkaiser/Doom64EX
================================================
FILE: ERRORDETECTION.md
================================================
PSXDOOM RE Error detection before source code release (sorted alphabetically)
============================================
* **[Gerardo Vsquez Garca (Gerardo194)]**
* The player does not keep weapons and ammunition if he advances in level.
* The lines of action were not activated when a special enemy died, for example the barons of hell on map 8.
* In the game menu when you pause and press select.
* The barrels and the rocket did not generate the radio damage, to the enemies only to the player.
* Error in the position of the fps code, this generated problems when generating the graphics in the ot.
* The repeatable action buttons, the game was frozen as it did not reproduce the sound of the button when it returns to the initial graph.
* I didn't play the music of Club Doom.
* Spider Demon attack sound error.
* Texture identification error in sidedefs.
* Error loading MAP60.LCD before executing Cast Monsters.
* **[Samuel Villarreal (svkaiser)]**
* Errors in the view bobbing.
* Scrolling wall textures did not work.
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/CDAUDIO/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR0/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR1/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR2/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR3/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR4/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR5/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR6/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MAPDIR7/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/MUSIC/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/SNDMAPS1/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/SNDMAPS2/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/CD/PSXDOOM/SNDMAPS3/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/GAME/MAKE_CD.bat
================================================
mkpsxiso.exe -y -makeabs -lba2 doom.txt -lba doom_.txt PSXDOOMCD.xml
copy PSXCDABS.C ..\
copy PSXCDABS.H ..\
pause
================================================
FILE: PSXDOOM/GAME/PSXDOOMCD.xml
================================================
================================================
FILE: PSXDOOM/LCDLOAD.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update 20/10/2019 [GEC]
#include
#include "psxcd.h"
#include "psxspu.h"
#include "wessapi.h"
#include "lcdload.h"
#include "doomdata.h"
extern int lcd_open; //L800758F4
extern char *lcd_ppat_data_patches;//L800758F8
extern char *lcd_ppat_data_patchmaps;//L800758FC
extern char *lcd_ppat_data_patchinfo;//L80075900
extern char *lcd_ppat_data_track;//L80075904
extern patch_group_data *lcd_ppat_info;//L80075908;
extern unsigned long lcd_sample_pos;//L8007590C
extern unsigned int lcd_sectorbuf_pos;//L80075910
extern unsigned int lcd_totaltogo;//L80075914
extern short lcd_sectorbuf_code ; //L80075918
extern char *lcd_sectorbuf;//L8007591C
extern int lcd_cd_status; //L80075920
extern int lcd_sync_intr;//L80075924
extern char lcd_sync_result[8];//0x80075928
extern Wess_Data_IO_Struct lcd_data_fileref;//0x8007f104
#define CHUNKSIZE 2048
extern char chunk[CHUNKSIZE];//80096394
extern char chunk2[CHUNKSIZE];//80096BA4
int wess_dig_lcd_loader_init(void *input_pm_stat)//80048C54
{
pmasterstat *pm_stat;
patch_group_data *pat_info;
char *ppat_data;
int k;
pm_stat = input_pm_stat;
lcd_open = 0;
if (!pm_stat)
return 0;
for (k = 0; k < pm_stat->pmod_info->mod_hdr.patch_types_infile; k++)
{
pat_info = (pm_stat->ppat_info + k);
if (pat_info->pat_grp_hdr.patch_id == SNDHW_TAG_DRIVER_ID)
break;
}
lcd_ppat_info = pat_info;
if (lcd_ppat_info != 0)
{
ppat_data = lcd_ppat_info->ppat_data;
lcd_open = 1;
lcd_ppat_data_patches = ppat_data;
//printf("patches %d\n",lcd_ppat_info->pat_grp_hdr.patches);
ppat_data += (lcd_ppat_info->pat_grp_hdr.patches * sizeof(patches_header));
lcd_ppat_data_patchmaps = ppat_data;
//printf("patchmaps %d\n",lcd_ppat_info->pat_grp_hdr.patchmaps);
ppat_data += (lcd_ppat_info->pat_grp_hdr.patchmaps * sizeof(patchmaps_header));
lcd_ppat_data_patchinfo = ppat_data;
//printf("patchinfo %d\n",lcd_ppat_info->pat_grp_hdr.patchinfo);
ppat_data += (lcd_ppat_info->pat_grp_hdr.patchinfo * sizeof(patchinfo_header));
lcd_ppat_data_track = ppat_data;
return 1;
}
return 0;
}
void wess_dig_set_sample_position(int samplenum, char *samplepos)//80048D3C
{
patchinfo_header *patchinfo;
if (lcd_ppat_data_patchinfo)
{
patchinfo = (patchinfo_header *) (lcd_ppat_data_patchinfo + (samplenum * sizeof(patchinfo_header)));
patchinfo->sample_pos = (unsigned long)samplepos;
}
}
Wess_Data_IO_Struct *wess_dig_lcd_data_open(char *filename)//80048D68
{
Wess_File_IO_Struct *fp;
fp = psxcd_open(filename);
lcd_data_fileref = *fp;
return(&lcd_data_fileref);
}
int wess_dig_lcd_data_read(unsigned char *buffer,void *destptr, SampleBlock *sampblk, int override)//80048DDC
{
patchinfo_header *patchinfo;
unsigned int samplenum, totaltogo, readbytes, totaltogo_tmp;
unsigned long spuptr;
spuptr = 0;
readbytes = 0;
totaltogo = CHUNKSIZE;
while(totaltogo != 0)
{
//InitNextSampleBlock
if (lcd_totaltogo == 0)
{
if (lcd_sectorbuf_pos > 0)
{
samplenum = (short) *(lcd_sectorbuf + (lcd_sectorbuf_pos << 1));
patchinfo = (patchinfo_header *)(lcd_ppat_data_patchinfo + (samplenum * sizeof(patchinfo_header)));
if (!(patchinfo->sample_pos) || (override != 0))
{
patchinfo->sample_pos = lcd_sample_pos;
if (sampblk != 0)
{
sampblk->sampindx[sampblk->numsamps] = samplenum;
sampblk->samppos[sampblk->numsamps] = patchinfo->sample_pos >> 3;
sampblk->numsamps += 1;
//printf("save to sample [%d] [%d]\n", patchinfo->sample_pos, patchinfo->sample_pos >> 3);
}
}
}
if (lcd_sectorbuf_code <= lcd_sectorbuf_pos)
{
return readbytes;
}
lcd_sectorbuf_pos++;
samplenum = (short) *(lcd_sectorbuf + (lcd_sectorbuf_pos << 1));
patchinfo = (patchinfo_header *)(lcd_ppat_data_patchinfo + (samplenum * sizeof(patchinfo_header)));
lcd_totaltogo = patchinfo->sample_size;
lcd_sample_pos = ((unsigned long)destptr + spuptr);
if (((end_of_sram - (unsigned long)destptr) + spuptr) < patchinfo->sample_size)
{
lcd_totaltogo = 0;
return readbytes;
}
if (totaltogo == 0) {
return readbytes;
}
}
totaltogo_tmp = totaltogo;
//Read Data
if (lcd_totaltogo < totaltogo)
{
samplenum = (short) *(lcd_sectorbuf + (lcd_sectorbuf_pos << 1));
patchinfo = (patchinfo_header *)(lcd_ppat_data_patchinfo + (samplenum * sizeof(patchinfo_header)));
if (!(patchinfo->sample_pos) || (override != 0))
{
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
SpuSetTransferStartAddr(((unsigned long)destptr + spuptr));
SpuWrite((buffer + spuptr), lcd_totaltogo);
readbytes += lcd_totaltogo;
}
totaltogo = totaltogo_tmp - lcd_totaltogo;
spuptr += lcd_totaltogo;
lcd_totaltogo = 0;
}
else
{
samplenum = (short) *(lcd_sectorbuf + (lcd_sectorbuf_pos << 1));
patchinfo = (patchinfo_header *)(lcd_ppat_data_patchinfo + (samplenum * sizeof(patchinfo_header)));
if (!(patchinfo->sample_pos) || (override != 0))
{
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
SpuSetTransferStartAddr(((unsigned long)destptr + spuptr));
SpuWrite(buffer+spuptr, totaltogo_tmp);
readbytes += totaltogo_tmp;
}
spuptr += totaltogo_tmp;
lcd_totaltogo -= totaltogo_tmp;
totaltogo = 0;
}
}
return (readbytes);
}
int wess_dig_lcd_psxcd_sync(void)//8004911C
{
unsigned long block;
block = millicount;
block += 8000;
while (millicount < block)
{
lcd_sync_intr = CdSync(1, (u_char *)&lcd_sync_result);
if (lcd_sync_intr == CdlDiskError)
{
CdFlush();
return 1;
}
if (lcd_sync_intr == CdlComplete) return 0;
}
return 1;
}
int wess_dig_lcd_load(char *lcdfilename, void *memptr, SampleBlock *sampblk, int override)//800491C4
{
Wess_File_IO_Struct *fileptr;
char *destptr;
int countbytes, bytestocopy, readbytes;
boolean read1, read2;
psxcd_disable_callbacks();
ReadAgain:
do
{
do
{
do
{
lcd_sectorbuf_pos = 0;
lcd_totaltogo = 0;
readbytes = 0;
psxcd_init_pos();
psxcd_set_data_mode();
fileptr = wess_dig_lcd_data_open(lcdfilename);
if (*(int *)&fileptr->file.pos == 0)
return 0;
bytestocopy = fileptr->file.size;
CdIntToPos(CdPosToInt(&fileptr->file.pos), &fileptr->new_io_loc);
CdControl(CdlSetloc, (u_char *)&fileptr->new_io_loc, 0);
CdControl(CdlReadN, (u_char *)&fileptr->new_io_loc, 0);
do
{
lcd_cd_status = CdReady(1, 0);
if (lcd_cd_status == CdlDataReady) goto DataReady1;
} while (lcd_cd_status != CdlDiskError);
CdFlush();
DataReady1:
} while (lcd_cd_status == CdlDiskError);
CdGetSector((u_long *)§orbuf, CHUNKSIZE / 4);
lcd_sectorbuf_code = (short)*sectorbuf; // read lcd count indx
lcd_sectorbuf = (char *)§orbuf;
} while (100 < lcd_sectorbuf_code);
if (bytestocopy < CHUNKSIZE)
bytestocopy = 0;
else
bytestocopy += -CHUNKSIZE;
read1 = true;
read2 = true;
destptr = memptr;
lcd_sectorbuf_code = (short)*sectorbuf; // read lcd count indx
while (bytestocopy != 0)
{
if (read1)
{
do
{
lcd_cd_status = CdReady(1, 0);
if (lcd_cd_status == CdlDataReady) goto DataReady2;
} while (lcd_cd_status != CdlDiskError);
CdFlush();
DataReady2:
if (lcd_cd_status == CdlDiskError) goto ReadAgain;
CdGetSector((u_long *)&chunk, CHUNKSIZE / 4);
if (bytestocopy < CHUNKSIZE)
bytestocopy = 0;
else
bytestocopy += -CHUNKSIZE;
countbytes = wess_dig_lcd_data_read(chunk, destptr, sampblk, override);
readbytes += countbytes;
destptr += countbytes;
read2 = true;
read1 = false;
}
else
{
if (read2)
{
do
{
lcd_cd_status = CdReady(1, 0);
if (lcd_cd_status == CdlDataReady) goto DataReady3;
} while (lcd_cd_status != CdlDiskError);
CdFlush();
DataReady3:
if (lcd_cd_status == CdlDiskError) goto ReadAgain;
CdGetSector((u_long *)&chunk2, CHUNKSIZE / 4);
if (bytestocopy < CHUNKSIZE)
bytestocopy = 0;
else
bytestocopy += -CHUNKSIZE;
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
countbytes = wess_dig_lcd_data_read(chunk2, destptr, sampblk, override);
readbytes += countbytes;
destptr += countbytes;
read2 = false;
}
else
{
do
{
lcd_cd_status = CdReady(1, 0);
if (lcd_cd_status == CdlDataReady) goto DataReady4;
} while (lcd_cd_status != CdlDiskError);
CdFlush();
DataReady4:
if (lcd_cd_status == CdlDiskError) goto ReadAgain;
CdGetSector((u_long *)&chunk, CHUNKSIZE / 4);
if (bytestocopy < CHUNKSIZE)
bytestocopy = 0;
else
bytestocopy += -CHUNKSIZE;
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
countbytes = wess_dig_lcd_data_read(chunk, destptr, sampblk, override);
readbytes += countbytes;
destptr += countbytes;
read2 = true;
}
}
}
if (lcd_cd_status != CdlDiskError)
{
CdControl(CdlPause, 0, 0);
if (wess_dig_lcd_psxcd_sync() == 0)
{
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
psxcd_enable_callbacks();
return (readbytes);
}
}
} while (true);
}
================================================
FILE: PSXDOOM/LCDLOAD.H
================================================
/*------------------------------------------------------------------*/
/*
Williams Entertainment Sound System
by Scott Patterson
Application Programming Interface Routines:
- digital (in linear .LCD file) load functions
*/
/*------------------------------------------------------------------*/
#define SAMPLE_RECORD_SIZE 100
typedef struct SampleBlock {
unsigned short numsamps;//r*
unsigned short sampindx[SAMPLE_RECORD_SIZE];//r*2
unsigned short samppos[SAMPLE_RECORD_SIZE];//r*4
}SampleBlock;
extern int wess_dig_lcd_loader_init(void *input_pm_stat);
extern void wess_dig_set_sample_position(int samplenum, char *samplepos);
extern int wess_dig_lcd_load(char *lcdfilename,void *memptr,SampleBlock *sampblk, int override);
================================================
FILE: PSXDOOM/MAIN.LNK
================================================
org $80010000
text group ; main text group
bss group bss ; main data group
section .rdata,text ; main sections
section .text,text
section .data,text
section .sdata,text
section .sbss,bss ; The bss sections
section .bss,bss
;
; Object files
;
include "obj\d_main.obj"
include "obj\info.obj"
include "obj\sprinfo.obj"
include "obj\g_game.obj"
include "obj\p_base.obj"
include "obj\p_ceilng.obj"
include "obj\p_change.obj"
include "obj\p_doors.obj"
include "obj\p_enemy.obj"
include "obj\p_floor.obj"
include "obj\p_inter.obj"
include "obj\p_lights.obj"
include "obj\p_map.obj"
include "obj\p_maputl.obj"
include "obj\p_mobj.obj"
include "obj\p_move.obj"
include "obj\p_plats.obj"
include "obj\p_pspr.obj"
include "obj\p_setup.obj"
include "obj\p_shoot.obj"
include "obj\p_sight.obj"
include "obj\p_slide.obj"
include "obj\p_spec.obj"
include "obj\p_switch.obj"
include "obj\p_telept.obj"
include "obj\p_tick.obj"
include "obj\p_user.obj"
include "obj\r_phase1.obj"
include "obj\r_phase2.obj"
include "obj\r_data.obj"
include "obj\r_main.obj"
include "obj\vsprintf.obj"
include "obj\w_wad.obj"
include "obj\psx_file.obj"
include "obj\z_zone.obj"
include "obj\psxmain.obj"
;include "obj\psxmain_mip.obj" ;//-----MIPS
include "obj\l_main.obj"
include "obj\t_main.obj"
include "obj\m_main.obj"
include "obj\c_main.obj"
include "obj\pw_main.obj"
include "obj\cf_main.obj"
include "obj\m_password.obj"
include "obj\st_main.obj"
include "obj\am_main.obj"
include "obj\in_main.obj"
include "obj\f_main.obj"
include "obj\o_main.obj"
include "obj\m_fixed.obj"
include "obj\tables.obj"
include "obj\psxcd.obj"
include "obj\s_sound.obj"
include "obj\psxspu.obj"
include "obj\psxcmd.obj"
include "obj\wessapip.obj"
include "obj\wessapi.obj"
include "obj\wessarc.obj"
include "obj\wessapit.obj"
include "obj\wessseq.obj"
include "obj\seqload.obj"
include "obj\lcdload.obj"
include "obj\wessapim.obj"
include "obj\seqloadr.obj"
include "obj\wessbase.obj"
include "obj\snmain.obj"
;
; Library files
;
inclib "C:\psyq\lib\libsn.lib"
inclib "C:\psyq\lib\libapi.lib"
inclib "C:\psyq\lib\libetc.lib"
inclib "C:\psyq\lib\libgpu.lib"
inclib "C:\psyq\lib\libgte.lib"
inclib "C:\psyq\lib\libspu.lib"
inclib "C:\psyq\lib\libc.lib"
inclib "C:\psyq\lib\libcd.lib"
inclib "C:\psyq\lib\libc2.lib"
inclib "C:\psyq\lib\libcomb.lib"
; The following line initializes the program counter register so
; that the downloader sets the entry point before the program
; is executed. SN_ENTRY_POINT is defined in a module in
; ligsn.lib and clears the bss, sets up the heap, etc., before
; calling main().
regs pc=__SN_ENTRY_POINT ; entry point
================================================
FILE: PSXDOOM/MAKEFILE.bat
================================================
@echo off
set PATH=C:\psyq\bin
set PSYQ_PATH=C:\psyq\bin
::remove_all:
del obj\*.obj
del asm\*.s
@echo on
::all:
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/d_main.obj d_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/info.obj info.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/sprinfo.obj sprinfo.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/g_game.obj g_game.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_base.obj p_base.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_ceilng.obj p_ceilng.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_change.obj p_change.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_doors.obj p_doors.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_enemy.obj p_enemy.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_floor.obj p_floor.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_inter.obj p_inter.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_lights.obj p_lights.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_map.obj p_map.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_maputl.obj p_maputl.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_mobj.obj p_mobj.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_move.obj p_move.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_plats.obj p_plats.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_pspr.obj p_pspr.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_setup.obj p_setup.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_shoot.obj p_shoot.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_sight.obj p_sight.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_slide.obj p_slide.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_spec.obj p_spec.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_switch.obj p_switch.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_telept.obj p_telept.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_tick.obj p_tick.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/p_user.obj p_user.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/r_phase1.obj r_phase1.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/r_phase2.obj r_phase2.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/r_data.obj r_data.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/r_main.obj r_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/vsprintf.obj vsprintf.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/w_wad.obj w_wad.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/psx_file.obj psx_file.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/z_zone.obj z_zone.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/psxmain.obj psxmain.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/l_main.obj l_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/t_main.obj t_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/m_main.obj m_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/c_main.obj c_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/pw_main.obj pw_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/cf_main.obj cf_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/m_password.obj m_password.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/st_main.obj st_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/am_main.obj am_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/in_main.obj in_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/f_main.obj f_main.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/o_main.obj o_main.c
::ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/m_fixed.obj m_fixed.c
asmpsx /l m_fixed.s,obj\m_fixed.obj
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/tables.obj tables.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/psxcd.obj psxcd.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/s_sound.obj s_sound.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/psxspu.obj psxspu.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/psxcmd.obj psxcmd.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessapip.obj wessapip.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessapi.obj wessapi.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessarc.obj wessarc.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessapit.obj wessapit.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessseq.obj wessseq.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/seqload.obj seqload.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/lcdload.obj lcdload.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessapim.obj wessapim.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/seqloadr.obj seqloadr.c
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj/wessbase.obj wessbase.c
asmpsx /l snmain.s,obj\snmain.obj
::child:
ccpsx -comments-c++ -Wreturn-type -c -O2 -g -o obj\psxmain.obj psxmain.c
psylink /m /g /c /q /o$80010000 @main.lnk,main.cpe,main.sym,main.map
::cpe2x main.cpe
cpe2x_gec main.cpe
@echo off
::asm:
ccpsx -O2 -S -Xo$80010000 -o asm\d_main.s d_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\info.s info.c
ccpsx -O2 -S -Xo$80010000 -o asm\sprinfo.s sprinfo.c
ccpsx -O2 -S -Xo$80010000 -o asm\g_game.s g_game.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_base.s p_base.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_ceilng.s p_ceilng.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_change.s p_change.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_doors.s p_doors.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_enemy.s p_enemy.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_floor.s p_floor.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_inter.s p_inter.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_lights.s p_lights.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_map.s p_map.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_maputl.s p_maputl.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_mobj.s p_mobj.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_move.s p_move.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_plats.s p_plats.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_pspr.s p_pspr.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_setup.s p_setup.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_shoot.s p_shoot.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_sight.s p_sight.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_slide.s p_slide.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_spec.s p_spec.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_switch.s p_switch.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_telept.s p_telept.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_tick.s p_tick.c
ccpsx -O2 -S -Xo$80010000 -o asm\p_user.s p_user.c
ccpsx -O2 -S -Xo$80010000 -o asm\r_phase1.s r_phase1.c
ccpsx -O2 -S -Xo$80010000 -o asm\r_phase2.s r_phase2.c
ccpsx -O2 -S -Xo$80010000 -o asm\r_data.s r_data.c
ccpsx -O2 -S -Xo$80010000 -o asm\r_main.s r_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\vsprintf.s vsprintf.c
ccpsx -O2 -S -Xo$80010000 -o asm\w_wad.s w_wad.c
ccpsx -O2 -S -Xo$80010000 -o asm\psx_file.s psx_file.c
ccpsx -O2 -S -Xo$80010000 -o asm\z_zone.s z_zone.c
ccpsx -O2 -S -Xo$80010000 -o asm\psxmain.s psxmain.c
ccpsx -O2 -S -Xo$80010000 -o asm\l_main.s l_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\t_main.s t_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\m_main.s m_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\c_main.s c_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\pw_main.s pw_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\cf_main.s cf_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\m_password.s m_password.c
ccpsx -O2 -S -Xo$80010000 -o asm\st_main.s st_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\am_main.s am_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\in_main.s in_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\f_main.s f_main.c
ccpsx -O2 -S -Xo$80010000 -o asm\o_main.s o_main.c
::ccpsx -O2 -S -Xo$80010000 -o asm\m_fixed.s m_fixed.c
ccpsx -O2 -S -Xo$80010000 -o asm\tables.s tables.c
ccpsx -O2 -S -Xo$80010000 -o asm\psxcd.s psxcd.c
ccpsx -O2 -S -Xo$80010000 -o asm\s_sound.s s_sound.c
ccpsx -O2 -S -Xo$80010000 -o asm\psxspu.s psxspu.c
ccpsx -O2 -S -Xo$80010000 -o asm\psxcmd.s psxcmd.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessapip.s wessapip.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessapi.s wessapi.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessarc.s wessarc.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessapit.s wessapit.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessseq.s wessseq.c
ccpsx -O2 -S -Xo$80010000 -o asm\seqload.s seqload.c
ccpsx -O2 -S -Xo$80010000 -o asm\lcdload.s lcdload.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessapim.s wessapim.c
ccpsx -O2 -S -Xo$80010000 -o asm\seqloadr.s seqloadr.c
ccpsx -O2 -S -Xo$80010000 -o asm\wessbase.s wessbase.c
@echo on
@echo off
copy main.exe GAME
@echo on
pause
================================================
FILE: PSXDOOM/PSXCD.C
================================================
// Reconstruido Y Verificado por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 32/01/2020 [GEC]
/*------------------------------------------------------------------*/
/*
Sony CD Architecture Specific Routines
by Scott Patterson
development and testing period on this code:
4/18/95 - 9/28/95
*/
/*------------------------------------------------------------------*/
#include
#include "wessapi.h"
#include "psxcd.h"
#include "psxspu.h"
// undeclared SONY prototypes
//extern void CdInit(void);
#if _CD_VERSION_ == 1
// CD Stuff
// CD Stuff
// CD Stuff
// CD Stuff
#if _CD_ABS_OPEN_ == 1
//lets just put this table in this file
#include "psxcdabs.c"
#endif
// private variables
static volatile int seeking_for_play = 0;
static volatile int waiting_for_pause = 0;
static volatile int async_on = 0;
static CdlLOC sectorbuf_contents = {0,0,0,0};
static void psxcd_memcpy(void *pdest, void *psrc, unsigned long bytestocopy);
//static void (*cd_pause_callback)(void) = 0;
static u_long cbsyncsave;
static u_long cbreadysave;
static void cbcomplete(int intr, u_char *result);
static void cbready(int intr, u_char *result);
static int psxcd_mode = -1; //initially an undefined mode
static int IsCdInit = 0;
static int init_pos = 0;
static PsxCd_File cdfile;
static CdlLOC cur_io_loc = {0,0,0,0};
int cb_enable_flag = 0;
int critical_error = 0;
int cdl_intr = 0;
int cdl_errintr = 0;
int cdl_errcount = 0;
unsigned char cdl_stat = 0;
unsigned char cdl_errstat = 0;
unsigned char cdl_com = CdlPause;
unsigned char cdl_errcom = 0;
int readcount = 0;
int playcount = 0;
char sectorbuf[CD_ROM_SECTOR_SIZE];
static char cd_param[8] = {0,0,0,0,0,0,0,0};
// CD ASYNC CHECKING
static int sync_intr = 0;//iGp000007c4 80077BD4
static char sync_result[8] = {0,0,0,0,0,0,0,0};//80077bd8
static int check_intr = 0;
static char check_result[8] = {0,0,0,0,0,0,0,0};
// CD ASYNC STUFF
#define PSXCD_COMMAND_END 0
#define PSXCD_COMMAND_COPY 1
#define PSXCD_COMMAND_SEEK 2
#define PSXCD_COMMAND_READ 3
#define PSXCD_COMMAND_READCOPY 4
typedef struct PsxCd_Command {
int command;
int amount; //sectors or bytes
char *pdest; //buffer or direct
char *psrc; //buffer pos
CdlLOC io_loc;
}PsxCd_Command;
static int cur_cmd = 0;
static PsxCd_Command psxcd_cmd[5];
static void *lastdestptr = 0;
static int lastreadbytes = 0;
static PsxCd_File newfilestruct;
static PsxCd_File lastfilestruct;
// CD-DA play stuff
static int playflag = 0;
static int playvol = 0;
static int playfadeuptime = 0;
static int looptrack = 0;
static int loopflag = 0;
static int loopvol = 0;
static int loopsectoroffset = 0;
static int loopfadeuptime = 0;
static CdlLOC cdloc = {0,0,0,0};
static CdlATV cdatv = {0,0,0,0};
static CdlLOC loc[100];
static CdlLOC newloc = {0,0,0,0};
static CdlLOC lastloc = {0,0,0,0};
static CdlLOC beginloc = {0,0,0,0};
static void psxcd_memcpy(void *pdest, void *psrc, unsigned long bytestocopy)//L8003EF70()
{
while(bytestocopy--)
{
*(char *)pdest++ = *(char *)psrc++;
}
}
extern volatile unsigned long millicount;
static void psxcd_sync(void)//8003EFA4
{
unsigned long block;
block = millicount;
block += 8000;
while(millicountfile.pos==0)
{
return(0);
}
do
{
sectors = 0;
read_setup_failure = 0;
psxcd_set_data_mode();
lastdestptr = destptr;
lastreadbytes = readbytes;
lastfilestruct = *fileptr;
// pause check is later in this function
cur_cmd = 0;
pdest = (char *)destptr;
bytestoread = readbytes;
byteoffset = fileptr->io_block_offset;
// if read begins inside block:
if(byteoffset && bytestoread)
{
if(!init_pos||(*(long *)&cur_io_loc!=*(long *)&fileptr->new_io_loc))
{
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_SEEK;
psxcd_cmd[cur_cmd].io_loc = fileptr->new_io_loc;
cur_cmd++;
cur_io_loc = fileptr->new_io_loc;
init_pos = 1;
}
bytestocopy = CD_ROM_SECTOR_SIZE-byteoffset;
if(bytestocopy>bytestoread)
{
bytestocopy = bytestoread;
}
if(cur_cmd||(*(long *)§orbuf_contents!=*(long *)&cur_io_loc))
{
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_READCOPY;
psxcd_cmd[cur_cmd].amount = bytestocopy;
psxcd_cmd[cur_cmd].pdest = pdest;
psxcd_cmd[cur_cmd].psrc = sectorbuf + byteoffset;
psxcd_cmd[cur_cmd].io_loc = cur_io_loc;
cur_cmd++;
sectorbuf_contents = cur_io_loc;
} else {
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_COPY;
psxcd_cmd[cur_cmd].amount = bytestocopy;
psxcd_cmd[cur_cmd].pdest = pdest;
psxcd_cmd[cur_cmd].psrc = sectorbuf + byteoffset;
cur_cmd++;
}
bytestoread -= bytestocopy;
pdest += bytestocopy;
fileptr->io_block_offset = byteoffset + bytestocopy;
if(fileptr->io_block_offset==CD_ROM_SECTOR_SIZE)
{
CdIntToPos(CdPosToInt(&cur_io_loc) + 1,&cur_io_loc);
fileptr->new_io_loc = cur_io_loc;
fileptr->io_block_offset = 0;
}
}
// for block aligned reading:
if(bytestoread>=CD_ROM_SECTOR_SIZE)
{
sectors = bytestoread/CD_ROM_SECTOR_SIZE;
bytesofblocks = sectors*CD_ROM_SECTOR_SIZE;
if(!init_pos||(*(long *)&cur_io_loc!=*(long *)&fileptr->new_io_loc))
{
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_SEEK;
psxcd_cmd[cur_cmd].io_loc = fileptr->new_io_loc;
cur_cmd++;
cur_io_loc = fileptr->new_io_loc;
init_pos = 1;
}
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_READ;
psxcd_cmd[cur_cmd].amount = sectors;
psxcd_cmd[cur_cmd].pdest = pdest;
if((unsigned long)pdest&3)
{
CdIntToPos(CdPosToInt(&cur_io_loc) + sectors - 1,§orbuf_contents);
}
psxcd_cmd[cur_cmd].io_loc = cur_io_loc;
cur_cmd++;
pdest += bytesofblocks;
bytestoread -= bytesofblocks;
CdIntToPos(CdPosToInt(&cur_io_loc) + sectors,&cur_io_loc);
fileptr->io_block_offset = 0;
fileptr->new_io_loc = cur_io_loc;
}
// if read ends inside block:
if(bytestoread)
{
if(!init_pos||(*(long *)&cur_io_loc!=*(long *)&fileptr->new_io_loc))
{
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_SEEK;
psxcd_cmd[cur_cmd].io_loc = fileptr->new_io_loc;
cur_cmd++;
cur_io_loc = fileptr->new_io_loc;
init_pos = 1;
}
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_READCOPY;
psxcd_cmd[cur_cmd].amount = bytestoread;
psxcd_cmd[cur_cmd].pdest = pdest;
psxcd_cmd[cur_cmd].psrc = sectorbuf;
psxcd_cmd[cur_cmd].io_loc = cur_io_loc;
cur_cmd++;
sectorbuf_contents = cur_io_loc;
fileptr->io_block_offset = bytestoread;
}
psxcd_cmd[cur_cmd].command = PSXCD_COMMAND_END;
cur_cmd = 0;
// if we are just a copy , then skip all the async stuff
if(psxcd_cmd[cur_cmd].command == PSXCD_COMMAND_COPY)
{
// do copy
psxcd_memcpy(psxcd_cmd[cur_cmd].pdest,
psxcd_cmd[cur_cmd].psrc,
psxcd_cmd[cur_cmd].amount);
// increment cur_cmd
cur_cmd++;
// set to end
if(psxcd_cmd[cur_cmd].command == PSXCD_COMMAND_END)
{
return(readbytes);
}
}
// if we seek, start now...
if(psxcd_cmd[cur_cmd].command == PSXCD_COMMAND_SEEK)
{
// do seek
psxcd_sync();
CdControl(cdl_com=CdlSetloc,
(u_char *)&psxcd_cmd[cur_cmd].io_loc, 0);
// increment cur_cmd
cur_cmd++;
if(psxcd_cmd[cur_cmd].command == PSXCD_COMMAND_END)
{
return(readbytes);
}
}
switch(psxcd_cmd[cur_cmd].command)
{
case PSXCD_COMMAND_READ:
case PSXCD_COMMAND_READCOPY:
//do read
if(!psxcd_critical_sync())
{
read_setup_failure = 1;
break;
}
CdControl(cdl_com=CdlReadN,
(u_char *)&psxcd_cmd[cur_cmd].io_loc, 0);
if(!psxcd_critical_sync())
{
read_setup_failure = 1;
break;
}
async_on = 1;
break;
case PSXCD_COMMAND_END:
return(readbytes);
break;
default:
return(0);
break;
}
if(read_setup_failure)
{
*fileptr = lastfilestruct;
}
}while(read_setup_failure);
return(readbytes);
#else
return(0);
#endif
}
int psxcd_seek(PsxCd_File *fileptr,int seekpos,int seekmode)//80040444
{
#if _CD_VERSION_ == 1
int sector_index;
if(*(int *)&fileptr->file.pos==0)
{
return(0);
}
if(seekmode==PSXCD_SEEK_SET)
{
sector_index = (seekpos / CD_ROM_SECTOR_SIZE) + CdPosToInt(&fileptr->file.pos);
CdIntToPos(sector_index,&fileptr->new_io_loc);
fileptr->io_block_offset = seekpos % CD_ROM_SECTOR_SIZE;
} else if(seekmode==PSXCD_SEEK_CUR) {
sector_index = ((seekpos+fileptr->io_block_offset) / CD_ROM_SECTOR_SIZE) + CdPosToInt(&cur_io_loc);
CdIntToPos(sector_index,&fileptr->new_io_loc);
fileptr->io_block_offset = (seekpos+fileptr->io_block_offset) % CD_ROM_SECTOR_SIZE;
} else { //PSXCD_SEEK_END
sector_index = ((fileptr->file.size-seekpos) / CD_ROM_SECTOR_SIZE) + CdPosToInt(&fileptr->file.pos);
CdIntToPos(sector_index,&fileptr->new_io_loc);
fileptr->io_block_offset = (fileptr->file.size-seekpos) % CD_ROM_SECTOR_SIZE;
}
return(0);
#else
return(0);
#endif
}
unsigned long psxcd_tell(PsxCd_File *fileptr)//80040538
{
#if _CD_VERSION_ == 1
int sector_index;
if(*(int *)&fileptr->file.pos==0)
{
return(0);
}
sector_index = CdPosToInt(&fileptr->new_io_loc) - CdPosToInt(&fileptr->file.pos);
return((sector_index*CD_ROM_SECTOR_SIZE) + fileptr->io_block_offset);
#else
return(0);
#endif
}
void psxcd_close(PsxCd_File *fileptr)//800405A0
{
#if _CD_VERSION_ == 1
#endif
}
void psxcd_set_audio_mode(void)//800405A8
{
#if _CD_VERSION_ == 1
if(psxcd_mode!=0)
{
if(async_on)
{
psxcd_async_read_cancel();
}
init_pos = 0; //since we have lost the data position of the CD
cd_param[0] = CdlModeRept|CdlModeAP|CdlModeDA;
CdControl(cdl_com=CdlSetmode, cd_param, 0);
psxcd_mode = 0;
psxcd_sync();
CdControl(cdl_com=CdlPause, 0, 0);
psxcd_sync(); // to ensure no pending pauses...
CdFlush();
} else {
psxcd_sync();
}
#endif
}
void psxcd_set_loop_volume(int volforloop)//8004064C
{
#if _CD_VERSION_ == 1
loopvol = volforloop;
#endif
}
void psxcd_play_at_andloop(int track,
int vol,
int sectoroffset,
int fadeuptime,
int tracktoloop,
int volforloop,
int loopstartsectoroffset,
int loopstartfadeuptime)//80040658
{
#if _CD_VERSION_ == 1
if(*(int *)&loc[track]==0)
{
return;
}
psxcd_set_audio_mode();
playvol = vol;
CdIntToPos((CdPosToInt(&loc[track]) + sectoroffset),&cdloc);
playcount = 0;
playflag = 1;
loopflag = 1;
looptrack = tracktoloop;
loopvol = volforloop;
loopsectoroffset = loopstartsectoroffset;
loopfadeuptime = loopstartfadeuptime;
seeking_for_play = 1;
playfadeuptime = fadeuptime;
CdControlF(cdl_com=CdlSeekP, (u_char *)&cdloc);
lastloc = loc[track];
beginloc = lastloc;
newloc = lastloc;
#endif
}
void psxcd_play_at(int track, int vol, int sectoroffset)//800407B8
{
#if _CD_VERSION_ == 1
if(*(int *)&loc[track]==0)
{
return;
}
playflag = 0;
loopflag = 0;
seeking_for_play = 0;
psxcd_set_audio_mode();
playvol = vol;
CdIntToPos((CdPosToInt(&loc[track]) + sectoroffset),&cdloc);
playcount = 0;
playflag = 1;
loopflag = 0;
seeking_for_play = 1;
playfadeuptime = 0;
CdControlF(cdl_com=CdlSeekP, (u_char *)&cdloc);
lastloc = loc[track];
beginloc = lastloc;
newloc = lastloc;
#endif
}
void psxcd_play(int track, int vol)//800408DC
{
psxcd_play_at(track,vol,0);
}
void psxcd_seek_for_play_at(int track, int sectoroffset)//800408FC
{
#if _CD_VERSION_ == 1
if(*(int *)&loc[track]==0)
{
return;
}
playflag = 0;
loopflag = 0;
seeking_for_play = 0;
psxcd_set_audio_mode();
CdIntToPos((CdPosToInt(&loc[track]) + sectoroffset),&cdloc);
playcount = 0;
playflag = 0;
loopflag = 0;
seeking_for_play = 1;
CdControlF(cdl_com=CdlSeekP, (u_char *)&cdloc);
lastloc = loc[track];
beginloc = lastloc;
newloc = lastloc;
#endif
}
void psxcd_seek_for_play(int track)//80040A10
{
psxcd_seek_for_play_at(track, 0);
}
int psxcd_play_status(void)//80040A30
{
#if _CD_VERSION_ == 1
if((cdl_com==CdlPlay)||(cdl_com==CdlSeekP))
{
check_intr = CdSync(1,(u_char *)check_result);
if((check_intr==CdlDiskError) ||
//(check_result[0] & !(CdlStatSeek|CdlStatPlay|CdlStatStandby)) || // This line of code are blocked in Psx Doom
!(check_result[0] & CdlStatStandby))
{
CdFlush();
cdl_errintr = check_intr + 90; //to give us unique error numbers
cdl_errcom = cdl_com;
cdl_errstat = check_result[0];
cdl_errcount++;
//report not playing
return(0);
}
return(1);
} else {
return(0);
}
#else
return(0);
#endif
}
void psxcd_stop(void)//80040AC8
{
#if _CD_VERSION_ == 1
playflag = 0; // ensure no SeekP callback activity
loopflag = 0;
seeking_for_play = 0;
*(int *)&lastloc = 0;
#if _CD_SPU_LINK_ == 1
if(psxspu_get_cd_vol())
{
psxspu_start_cd_fade(FADE_TIME,0);
while(psxspu_get_cd_fade_status());
}
#endif
psxcd_sync();
// pause seems to be better than stop here because
// play is more stable after a pause
waiting_for_pause = 1;
CdControlF(cdl_com=CdlPause, 0);
#endif
}
void psxcd_pause(void)//80040B40
{
#if _CD_VERSION_ == 1
playflag = 0; // ensure no SeekP callback activity
seeking_for_play = 0;
// this check is
if(*(int *)&lastloc==0)
{
return;
}
lastloc = newloc;
#if _CD_SPU_LINK_ == 1
if(psxspu_get_cd_vol())
{
psxspu_start_cd_fade(FADE_TIME,0);
while(psxspu_get_cd_fade_status());
}
#endif
psxcd_sync();
waiting_for_pause = 1;
CdControlF(cdl_com=CdlPause, 0);
#endif
}
void psxcd_restart(int vol)//80040BE4
{
#if _CD_VERSION_ == 1
if(*(int *)&lastloc==0)
{
return;
}
psxcd_set_audio_mode();
playvol = vol;
cdloc = lastloc;
playcount = 0;
playflag = 1;
seeking_for_play = 1;
CdControlF(cdl_com=CdlSeekP, (u_char *)&cdloc);
#endif
}
int psxcd_elapsed_sectors(void)//80040C6C
{
#if _CD_VERSION_ == 1
if(*(int *)&beginloc==0)
{
return(0);
}
return(CdPosToInt(&newloc)-CdPosToInt(&beginloc));
#else
return(0);
#endif
}
void psxcd_set_stereo(int stereo_true)//80040CC0
{
#if _CD_VERSION_ == 1
if(stereo_true)
{
cdatv.val0 = 127;
cdatv.val1 = 0;
cdatv.val2 = 127;
cdatv.val3 = 0;
} else {
cdatv.val0 = 63;
cdatv.val1 = 63;
cdatv.val2 = 63;
cdatv.val3 = 63;
}
CdMix(&cdatv);
#endif
}
================================================
FILE: PSXDOOM/PSXCD.H
================================================
/*------------------------------------------------------------------*/
/*
Sony CD Architecture Specific Routines
by Scott Patterson
development and testing period on this code:
4/18/95 - 9/28/95
*/
/*------------------------------------------------------------------*/
#ifndef _PSXCD_H
#define _PSXCD_H
/*
The following functions will pause for a short CD volume fade if
the CD volume is not zero (and _CD_SPU_LINK_ == 1):
psxcd_async_read()
psxcd_read()
psxcd_stop()
psxcd_pause()
To asyncronously fade the CD volume beforehand so these functions
will not have any delays see comments in "psxspu.h"
*/
#include
#include
#define _CD_VERSION_ 1
#define _CD_SPU_LINK_ 1//para cd tracks
#define _CD_ABS_OPEN_ 1
#define PSXCD_SEEK_SET 0
#define PSXCD_SEEK_CUR 1
#define PSXCD_SEEK_END 2
#if _CD_VERSION_ == 0
#include
#endif
typedef struct PsxCd_File {
CdlFILE file;
CdlLOC new_io_loc;
unsigned long io_block_offset;
unsigned char io_result[8];
}PsxCd_File;
#if _CD_ABS_OPEN_ == 1
typedef struct PsxCd_MapTbl {
int abs;
u_long size;
}PsxCd_MapTbl;
extern PsxCd_MapTbl cdmaptbl[];
#endif
// CD-data read stuff
#define CD_ROM_SECTOR_SIZE 2048
#define SECTORS_PER_SECOND 75
#define SECONDS_PER_MINUTE 60
/*
Asyncronous read function: psxcd_async_on()
this function returns non-zero during asyncronous reading
to code an asyncronous read:
psxcd_async_read(destptr,readbytes,fileptr);
// do your other shit here
// (don't mess with the RAM you are reading to!)
// to check for completion
if(!psxcd_async_on())
{
// psxcd_async_read is complete
}
// to wait for completion:
while(psxcd_async_on()); // wait for completion of psxcd_async_read
*/
extern int psxcd_async_on(void);
/*
CD-DA play seek variable: seeking_for_play
after psxcd_seek_for_play(track) call is made
this function returns non-zero until seeking is done
*/
extern int psxcd_seeking_for_play(void);
/*
CD-DA play stop/pause variable: waiting_for_pause
after psxcd_stop/psxcd_pause call is made
this function returns non-zero until pause operation is done
*/
extern int psxcd_waiting_for_pause(void);
extern int cdl_insetmode;
extern int cdl_intr;
extern unsigned char cdl_stat;
extern unsigned char cdl_com;
extern int cdl_errcount;
extern int cdl_errintr;
extern unsigned char cdl_errstat;
extern unsigned char cdl_errcom;
extern int readcount;
extern int playcount;
// PSX CD-MODE1 DATA commands
extern void psxcd_init(void);
extern void psxcd_exit(void);
extern void psxcd_disable_callbacks(void);
extern void psxcd_enable_callbacks(void);
extern void psxcd_set_data_mode(void);
extern PsxCd_File *psxcd_open(char *filename);
extern void psxcd_async_read_cancel(void);
extern int psxcd_async_read(void *destptr,int readbytes,PsxCd_File *fileptr);
extern int psxcd_read(void *destptr,int readbytes,PsxCd_File *fileptr);
extern int psxcd_seek(PsxCd_File *fileptr,int seekpos,int seekmode);
extern unsigned long psxcd_tell(PsxCd_File *fileptr);
extern void psxcd_close(PsxCd_File *fileptr);
// PSX CD-AUDIO commands
extern void psxcd_set_stereo(int stereo_true);
extern void psxcd_set_audio_mode(void);
extern void psxcd_seek_for_play(int track);
extern void psxcd_seek_for_play_at(int track,
int sectoroffset);
extern void psxcd_play(int track, int vol);
extern void psxcd_play_at(int track,
int vol,
int sectoroffset);
extern void psxcd_set_loop_volume(int volforloop);
extern void psxcd_play_at_andloop(int track,
int vol,
int sectoroffset,
int fadeuptime,
int tracktoloop,
int volforloop,
int loopstartsectoroffset,
int loopstartfadeuptime);
extern void psxcd_stop(void);
extern void psxcd_pause(void);
extern void psxcd_restart(int vol);
int psxcd_play_status(void);
int psxcd_elapsed_sectors(void);
// PSX low level CD extras
extern char sectorbuf[CD_ROM_SECTOR_SIZE];
extern void psxcd_init_pos(void);
#endif
================================================
FILE: PSXDOOM/PSXCDABS.C
================================================
PsxCd_MapTbl cdmaptbl[] =
{
{23, 68},
{24, 907264},
{469, 32768},
{485, 32768},
{501, 657392},
{822, 3387200},
{2272, 374784},
{2455, 4806088},
{4803, 28196},
{4817, 58304},
{4846, 54552},
{4873, 46124},
{4896, 44844},
{4918, 61588},
{4949, 55100},
{4976, 24416},
{4988, 590344},
{5277, 538668},
{5541, 539124},
{5805, 599804},
{6098, 542608},
{6363, 540092},
{6627, 610152},
{6925, 569128},
{7203, 90744},
{7248, 98652},
{7297, 87032},
{7340, 89728},
{7384, 96636},
{7432, 102092},
{7482, 94632},
{7529, 89024},
{7574, 23512},
{7586, 47200},
{7610, 37120},
{7629, 58980},
{7658, 41452},
{7679, 41744},
{7700, 40452},
{7720, 13212},
{7727, 681400},
{8060, 538364},
{8323, 839084},
{8733, 712692},
{9081, 815644},
{9480, 849720},
{9895, 851488},
{10311, 560564},
{10585, 115168},
{10642, 64668},
{10674, 117700},
{10732, 96036},
{10779, 114880},
{10836, 100588},
{10886, 118028},
{10944, 75608},
{10982, 26192},
{10995, 34844},
{11013, 37460},
{11032, 67584},
{11065, 44536},
{11087, 54204},
{11114, 16240},
{11122, 25256},
{11135, 655924},
{11456, 754608},
{11825, 711920},
{12173, 609232},
{12471, 947256},
{12934, 698412},
{13276, 783292},
{13659, 503360},
{13905, 94700},
{13952, 99824},
{14001, 90168},
{14046, 113084},
{14102, 119052},
{14161, 101824},
{14211, 93508},
{14257, 122260},
{14318, 36092},
{14336, 55228},
{14363, 38620},
{14382, 71392},
{14417, 79124},
{14456, 70688},
{14491, 23548},
{14503, 30096},
{14518, 658696},
{14840, 811608},
{15237, 617220},
{15539, 713644},
{15888, 690772},
{16226, 658504},
{16548, 303772},
{16697, 453732},
{16919, 120520},
{16978, 95616},
{17025, 134144},
{17091, 138792},
{17159, 115788},
{17216, 107636},
{17269, 111304},
{17324, 99928},
{17374, 34424},
{17391, 31812},
{17407, 54264},
{17434, 61796},
{17465, 12760},
{17472, 40412},
{17492, 46432},
{17515, 64972},
{17547, 536376},
{17809, 540772},
{18074, 786920},
{18459, 781336},
{18841, 563728},
{19117, 891472},
{19553, 925360},
{20005, 726232},
{20360, 92832},
{20406, 79672},
{20445, 95636},
{20492, 101916},
{20542, 67744},
{20576, 135548},
{20643, 109668},
{20697, 108968},
{20752, 56652},
{20780, 53028},
{20806, 89220},
{20850, 54560},
{20877, 77656},
{20915, 54032},
{20942, 93852},
{20988, 28216},
{21002, 748724},
{21368, 808468},
{21763, 581464},
{22047, 842888},
{22459, 677172},
{22790, 809260},
{23186, 617784},
{23488, 881152},
{23919, 131496},
{23984, 135640},
{24051, 113068},
{24107, 128592},
{24170, 135508},
{24237, 137308},
{24305, 127780},
{24368, 148004},
{24442, 35168},
{24460, 32840},
{24477, 53120},
{24503, 59788},
{24533, 64036},
{24565, 22640},
{24577, 9828},
{24582, 40960},
{24602, 536716},
{24865, 861136},
{25286, 813132},
{25684, 738880},
{26045, 763852},
{26418, 898916},
{26857, 418288},
{27062, 601328},
{27356, 131980},
{27421, 145340},
{27492, 161620},
{27571, 128848},
{27634, 155948},
{27711, 106412},
{27763, 50408},
{27788, 86568},
{27832, 30796},
{27848, 91964},
{27893, 37592},
{27912, 32768},
{27928, 32768},
{27944, 32768},
{27960, 32768},
{27976, 32768},
{27992, 688812},
{28329, 661156},
{28652, 417300},
{28856, 32768},
{28872, 32768},
{28888, 32768},
{28904, 32768},
{28920, 32768},
{28936, 117464},
{28994, 131544},
{29059, 124532},
{29120, 32768},
{29136, 32768},
{29152, 32768},
{29168, 32768},
{29184, 32768},
{29201, 177104},
{29288, 55502},
{29316, 61232},
{29346, 77280},
{29384, 103120},
{29435, 111968},
{29490, 73968},
{29527, 104656},
{29579, 85488},
{29621, 71008},
{29656, 83584},
{29697, 93136},
{29743, 92528},
{29789, 67280},
{29822, 120992},
{29882, 136496},
{29949, 103328},
{30000, 116512},
{30057, 101168},
{30107, 104528},
{30159, 116944},
{30217, 121216},
{30278, 143632},
{30349, 143312},
{30419, 143312},
{30489, 168112},
{30572, 143312},
{30642, 143312},
{30712, 184160},
{30802, 131872},
{30867, 199920},
{30965, 158576},
{31043, 229632},
{31156, 202112},
{31255, 226912},
{31366, 242960},
{31485, 236304},
{31601, 134800},
{31667, 202384},
{31766, 219632},
{31874, 202112},
{31973, 155664},
{32051, 247024},
{32172, 170960},
{32256, 137200},
{32323, 160832},
{32402, 199920},
{32500, 219632},
{32608, 181248},
{32697, 199920},
{32795, 181248},
{32884, 206496},
{32985, 111456},
{33040, 143312},
{33110, 143312},
{33180, 143312},
{33250, 199920},
{33348, 222544},
{33457, 122240},
{33517, 158352},
{33595, 240768},
{33713, 209920},
{33817, 189056},
{33910, 236480},
{34026, 164176},
{34107, 219792},
{34215, 161536},
{34294, 219904},
{34402, 182400},
{34492, 226480},
{34603, 160832},
{34682, 250064},
{34805, 209216},
{34908, 199920},
{35006, 222544},
{35115, 89712},
{35159, 80992},
{35199, 168112},
{35282, 120416},
{35341, 206496},
{35442, 69888},
{35477, 425904},
{0, 0}
};
================================================
FILE: PSXDOOM/PSXCDABS.H
================================================
#define _SYSTEM_CNF 0
#define _SLUS_000_77 1
#define _DEMO1_LMP 2
#define _DEMO2_LMP 3
#define _MAPSPR60_IMG 4
#define _MOVIE_STR 5
#define _PSXDOOM_EXE 6
#define _PSXDOOM_WAD 7
#define _MAP01_WAD 8
#define _MAP02_WAD 9
#define _MAP03_WAD 10
#define _MAP04_WAD 11
#define _MAP05_WAD 12
#define _MAP06_WAD 13
#define _MAP07_WAD 14
#define _MAP08_WAD 15
#define _MAPSPR01_IMG 16
#define _MAPSPR02_IMG 17
#define _MAPSPR03_IMG 18
#define _MAPSPR04_IMG 19
#define _MAPSPR05_IMG 20
#define _MAPSPR06_IMG 21
#define _MAPSPR07_IMG 22
#define _MAPSPR08_IMG 23
#define _MAPTEX01_IMG 24
#define _MAPTEX02_IMG 25
#define _MAPTEX03_IMG 26
#define _MAPTEX04_IMG 27
#define _MAPTEX05_IMG 28
#define _MAPTEX06_IMG 29
#define _MAPTEX07_IMG 30
#define _MAPTEX08_IMG 31
#define _MAP09_WAD 32
#define _MAP10_WAD 33
#define _MAP11_WAD 34
#define _MAP12_WAD 35
#define _MAP13_WAD 36
#define _MAP14_WAD 37
#define _MAP15_WAD 38
#define _MAP16_WAD 39
#define _MAPSPR09_IMG 40
#define _MAPSPR10_IMG 41
#define _MAPSPR11_IMG 42
#define _MAPSPR12_IMG 43
#define _MAPSPR13_IMG 44
#define _MAPSPR14_IMG 45
#define _MAPSPR15_IMG 46
#define _MAPSPR16_IMG 47
#define _MAPTEX09_IMG 48
#define _MAPTEX10_IMG 49
#define _MAPTEX11_IMG 50
#define _MAPTEX12_IMG 51
#define _MAPTEX13_IMG 52
#define _MAPTEX14_IMG 53
#define _MAPTEX15_IMG 54
#define _MAPTEX16_IMG 55
#define _MAP17_WAD 56
#define _MAP18_WAD 57
#define _MAP19_WAD 58
#define _MAP20_WAD 59
#define _MAP21_WAD 60
#define _MAP22_WAD 61
#define _MAP23_WAD 62
#define _MAP24_WAD 63
#define _MAPSPR17_IMG 64
#define _MAPSPR18_IMG 65
#define _MAPSPR19_IMG 66
#define _MAPSPR20_IMG 67
#define _MAPSPR21_IMG 68
#define _MAPSPR22_IMG 69
#define _MAPSPR23_IMG 70
#define _MAPSPR24_IMG 71
#define _MAPTEX17_IMG 72
#define _MAPTEX18_IMG 73
#define _MAPTEX19_IMG 74
#define _MAPTEX20_IMG 75
#define _MAPTEX21_IMG 76
#define _MAPTEX22_IMG 77
#define _MAPTEX23_IMG 78
#define _MAPTEX24_IMG 79
#define _MAP25_WAD 80
#define _MAP26_WAD 81
#define _MAP27_WAD 82
#define _MAP28_WAD 83
#define _MAP29_WAD 84
#define _MAP30_WAD 85
#define _MAP31_WAD 86
#define _MAP32_WAD 87
#define _MAPSPR25_IMG 88
#define _MAPSPR26_IMG 89
#define _MAPSPR27_IMG 90
#define _MAPSPR28_IMG 91
#define _MAPSPR29_IMG 92
#define _MAPSPR30_IMG 93
#define _MAPSPR31_IMG 94
#define _MAPSPR32_IMG 95
#define _MAPTEX25_IMG 96
#define _MAPTEX26_IMG 97
#define _MAPTEX27_IMG 98
#define _MAPTEX28_IMG 99
#define _MAPTEX29_IMG 100
#define _MAPTEX30_IMG 101
#define _MAPTEX31_IMG 102
#define _MAPTEX32_IMG 103
#define _MAP33_WAD 104
#define _MAP34_WAD 105
#define _MAP35_WAD 106
#define _MAP36_WAD 107
#define _MAP37_WAD 108
#define _MAP38_WAD 109
#define _MAP39_WAD 110
#define _MAP40_WAD 111
#define _MAPSPR33_IMG 112
#define _MAPSPR34_IMG 113
#define _MAPSPR35_IMG 114
#define _MAPSPR36_IMG 115
#define _MAPSPR37_IMG 116
#define _MAPSPR38_IMG 117
#define _MAPSPR39_IMG 118
#define _MAPSPR40_IMG 119
#define _MAPTEX33_IMG 120
#define _MAPTEX34_IMG 121
#define _MAPTEX35_IMG 122
#define _MAPTEX36_IMG 123
#define _MAPTEX37_IMG 124
#define _MAPTEX38_IMG 125
#define _MAPTEX39_IMG 126
#define _MAPTEX40_IMG 127
#define _MAP41_WAD 128
#define _MAP42_WAD 129
#define _MAP43_WAD 130
#define _MAP44_WAD 131
#define _MAP45_WAD 132
#define _MAP46_WAD 133
#define _MAP47_WAD 134
#define _MAP48_WAD 135
#define _MAPSPR41_IMG 136
#define _MAPSPR42_IMG 137
#define _MAPSPR43_IMG 138
#define _MAPSPR44_IMG 139
#define _MAPSPR45_IMG 140
#define _MAPSPR46_IMG 141
#define _MAPSPR47_IMG 142
#define _MAPSPR48_IMG 143
#define _MAPTEX41_IMG 144
#define _MAPTEX42_IMG 145
#define _MAPTEX43_IMG 146
#define _MAPTEX44_IMG 147
#define _MAPTEX45_IMG 148
#define _MAPTEX46_IMG 149
#define _MAPTEX47_IMG 150
#define _MAPTEX48_IMG 151
#define _MAP49_WAD 152
#define _MAP50_WAD 153
#define _MAP51_WAD 154
#define _MAP52_WAD 155
#define _MAP53_WAD 156
#define _MAP54_WAD 157
#define _MAP55_WAD 158
#define _MAP56_WAD 159
#define _MAPSPR49_IMG 160
#define _MAPSPR50_IMG 161
#define _MAPSPR51_IMG 162
#define _MAPSPR52_IMG 163
#define _MAPSPR53_IMG 164
#define _MAPSPR54_IMG 165
#define _MAPSPR55_IMG 166
#define _MAPSPR56_IMG 167
#define _MAPTEX49_IMG 168
#define _MAPTEX50_IMG 169
#define _MAPTEX51_IMG 170
#define _MAPTEX52_IMG 171
#define _MAPTEX53_IMG 172
#define _MAPTEX54_IMG 173
#define _MAPTEX55_IMG 174
#define _MAPTEX56_IMG 175
#define _MAP57_WAD 176
#define _MAP58_WAD 177
#define _MAP59_WAD 178
#define _MAP60_PAD 179
#define _MAP61_PAD 180
#define _MAP62_PAD 181
#define _MAP63_PAD 182
#define _MAP64_PAD 183
#define _MAPSPR57_IMG 184
#define _MAPSPR58_IMG 185
#define _MAPSPR59_IMG 186
#define _MAPSPR60_PAD 187
#define _MAPSPR61_PAD 188
#define _MAPSPR62_PAD 189
#define _MAPSPR63_PAD 190
#define _MAPSPR64_PAD 191
#define _MAPTEX57_IMG 192
#define _MAPTEX58_IMG 193
#define _MAPTEX59_IMG 194
#define _MAPTEX60_PAD 195
#define _MAPTEX61_PAD 196
#define _MAPTEX62_PAD 197
#define _MAPTEX63_PAD 198
#define _MAPTEX64_PAD 199
#define _DOOMSFX_LCD 200
#define _DOOMSND_WMD 201
#define _MUSLEV1_LCD 202
#define _MUSLEV10_LCD 203
#define _MUSLEV11_LCD 204
#define _MUSLEV12_LCD 205
#define _MUSLEV13_LCD 206
#define _MUSLEV14_LCD 207
#define _MUSLEV15_LCD 208
#define _MUSLEV16_LCD 209
#define _MUSLEV17_LCD 210
#define _MUSLEV18_LCD 211
#define _MUSLEV19_LCD 212
#define _MUSLEV2_LCD 213
#define _MUSLEV20_LCD 214
#define _MUSLEV3_LCD 215
#define _MUSLEV4_LCD 216
#define _MUSLEV5_LCD 217
#define _MUSLEV6_LCD 218
#define _MUSLEV7_LCD 219
#define _MUSLEV8_LCD 220
#define _MUSLEV9_LCD 221
#define _MAP01_LCD 222
#define _MAP02_LCD 223
#define _MAP03_LCD 224
#define _MAP04_LCD 225
#define _MAP05_LCD 226
#define _MAP06_LCD 227
#define _MAP07_LCD 228
#define _MAP08_LCD 229
#define _MAP09_LCD 230
#define _MAP10_LCD 231
#define _MAP11_LCD 232
#define _MAP12_LCD 233
#define _MAP13_LCD 234
#define _MAP14_LCD 235
#define _MAP15_LCD 236
#define _MAP16_LCD 237
#define _MAP17_LCD 238
#define _MAP18_LCD 239
#define _MAP19_LCD 240
#define _MAP20_LCD 241
#define _MAP21_LCD 242
#define _MAP22_LCD 243
#define _MAP23_LCD 244
#define _MAP24_LCD 245
#define _MAP25_LCD 246
#define _MAP26_LCD 247
#define _MAP27_LCD 248
#define _MAP28_LCD 249
#define _MAP29_LCD 250
#define _MAP30_LCD 251
#define _MAP31_LCD 252
#define _MAP32_LCD 253
#define _MAP33_LCD 254
#define _MAP34_LCD 255
#define _MAP35_LCD 256
#define _MAP36_LCD 257
#define _MAP37_LCD 258
#define _MAP38_LCD 259
#define _MAP39_LCD 260
#define _MAP40_LCD 261
#define _MAP41_LCD 262
#define _MAP42_LCD 263
#define _MAP43_LCD 264
#define _MAP44_LCD 265
#define _MAP45_LCD 266
#define _MAP46_LCD 267
#define _MAP47_LCD 268
#define _MAP48_LCD 269
#define _MAP49_LCD 270
#define _MAP50_LCD 271
#define _MAP51_LCD 272
#define _MAP52_LCD 273
#define _MAP53_LCD 274
#define _MAP54_LCD 275
#define _MAP55_LCD 276
#define _MAP56_LCD 277
#define _MAP57_LCD 278
#define _MAP58_LCD 279
#define _MAP59_LCD 280
#define _MAP60_LCD 281
#define MAX_ABS_FILES 282
================================================
FILE: PSXDOOM/PSXCMD.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 32/01/2020 [GEC]
#include "wessseq.h"
void start_record_music_mute(NoteState *notestate);
void end_record_music_mute(void);
void add_music_mute_note(unsigned short seq_num, unsigned char track,
unsigned char keynum, unsigned char velnum,
patchmaps_header *patchmap, patchinfo_header *patchinfo);
void wess_set_mute_release(int newrate);
void TriggerPSXVoice(voice_status *voice_stat, unsigned char keynum, unsigned char velnum);
void PSX_DriverInit(master_status_structure *pm_stat);
void PSX_DriverExit (track_status *ptk_stat);
void PSX_DriverEntry1 (track_status *ptk_stat);
void PSX_DriverEntry2(track_status *ptk_stat);
void PSX_DriverEntry3(track_status *ptk_stat);
void PSX_TrkOff(track_status *ptk_stat);
void PSX_TrkMute(track_status *ptk_stat);
void PSX_PatchChg(track_status *ptk_stat);
void PSX_PatchMod(track_status *ptk_stat);
void PSX_PitchMod(track_status *ptk_stat);
void PSX_ZeroMod(track_status *ptk_stat);
void PSX_ModuMod(track_status *ptk_stat);
void PSX_VolumeMod(track_status *ptk_stat);
void PSX_PanMod(track_status *ptk_stat);
void PSX_PedalMod(track_status *ptk_stat);
void PSX_ReverbMod(track_status *ptk_stat);
void PSX_ChorusMod(track_status *ptk_stat);
void PSX_voiceon(voice_status *voice_stat, track_status *ptk_stat,
patchmaps_header *patchmaps, patchinfo_header *patchinfo,
unsigned char keynum, unsigned char velnum);
void PSX_voiceparmoff(voice_status *voice_stat);
void PSX_voicerelease(voice_status *voice_stat);
void PSX_voicenote(track_status *ptk_stat,
patchmaps_header *patchmap, patchinfo_header *patchinfo,
unsigned char keynum, unsigned char velnum);
void PSX_NoteOn(track_status *ptk_stat);
void PSX_NoteOff(track_status *ptk_stat);
void(*drv_cmds[19])() =
{
PSX_DriverInit, //0x0
PSX_DriverExit, //0x1
PSX_DriverEntry1, //0x2
PSX_DriverEntry2, //0x3
PSX_DriverEntry3, //0x4
PSX_TrkOff, //0x5
PSX_TrkMute, //0x6
PSX_PatchChg, //0x7
PSX_PatchMod, //0x8
PSX_PitchMod, //0x9
PSX_ZeroMod, //0xA
PSX_ModuMod, //0xB
PSX_VolumeMod, //0xC
PSX_PanMod, //0xD
PSX_PedalMod, //0xE
PSX_ReverbMod, //0xF
PSX_ChorusMod, //0x10
PSX_NoteOn, //0x11
PSX_NoteOff //0x12
};
extern unsigned char skip_table[72]; //80075930
extern unsigned char master_sfx_volume; //80075834
extern unsigned char master_mus_volume; //80075835
extern unsigned char pan_status; //80075836
extern unsigned char release_rate; //80075837
extern unsigned long voice_flags1; //80075838
extern unsigned long voice_flags2; //8007583C
extern NoteState *ptr_notestate; //80075840
extern voice_status *ptr_pvoicestattbl; //80075844
extern unsigned long priority; //80075848
extern unsigned long max_pabstime; //8007584C
extern master_status_structure *drv_pmsbase; //8007EF88
extern sequence_status *drv_pssbase; //8007EF8C
extern track_status *drv_ptsbase; //8007EF90
extern unsigned long drv_hwvl; //8007EF98
extern patch_group_data *drv_ppgd; //8007EF9C
extern unsigned long *drv_pcurabstime; //8007EFA0
extern patches_header *drv_patchesbase; //8007EFA4
extern patchmaps_header *drv_patchmapsbase; //8007EFA8
extern patchinfo_header *drv_samplesbase; //8007EFAC
extern char *drv_drummapsbase; //8007EFB0
extern SpuVoiceAttr drv_outattr; //8007EFB4
extern unsigned char drv_nvst; //8007EED0
extern unsigned char drv_npti; //8007EED4
extern unsigned long drv_cnt; //8007EED8
extern voice_status *drv_pvsbase; //8007EEDC
extern voice_status *drv_pcurvs; //8007EF94
extern unsigned char drv_channels[24]; //8007f00C
extern void (**CmdFuncArr[10])(track_status *);
extern void(*DrvFunctions[36])();
//-----------------------------------------------------------
// Sound System
//-----------------------------------------------------------
void start_record_music_mute(NoteState *notestate)//L80045750()
{
ptr_notestate = notestate;
if (notestate != 0)
{
notestate->numnotes = 0;
}
}
void end_record_music_mute(void)//L8004576C()
{
ptr_notestate = 0;
}
void add_music_mute_note(unsigned short seq_num, unsigned char track,
unsigned char keynum, unsigned char velnum,
patchmaps_header *patchmap, patchinfo_header *patchinfo)//L8004577C()
{
if (ptr_notestate != 0)
{
ptr_notestate->nd[ptr_notestate->numnotes].seq_num = seq_num;
ptr_notestate->nd[ptr_notestate->numnotes].track = track;
ptr_notestate->nd[ptr_notestate->numnotes].keynum = keynum;
ptr_notestate->nd[ptr_notestate->numnotes].velnum = velnum;
ptr_notestate->nd[ptr_notestate->numnotes].patchmap = patchmap;
ptr_notestate->nd[ptr_notestate->numnotes].patchinfo = patchinfo;
ptr_notestate->numnotes++;
}
}
void wess_set_mute_release(int newrate)//L80045848()
{
int maxrate;
maxrate = 0x10000000;
release_rate = 0x1f;
while ((newrate < maxrate && (release_rate != 0)))
{
maxrate >>= 1;
release_rate -= 1;
}
return;
}
extern unsigned long drv_pitch1; //L8007EEB8
extern unsigned long drv_pitch2; //L8007EEBC
extern unsigned long drv_pitch3; //L8007EEC0
extern unsigned long drv_volume_1; //L8007EEC4
extern track_status *drv_ptrk_stat; //L8007EEC8
extern short drv_pan_1; //L8007EECC
void TriggerPSXVoice(voice_status *voice_stat, unsigned char keynum, unsigned char velnum)//L8004587C()
{
unsigned long volume;
unsigned long pitch;
drv_outattr.voice = 1 << (voice_stat->refindx & 31);
drv_outattr.mask = (SPU_VOICE_VOLL | SPU_VOICE_VOLR | SPU_VOICE_NOTE | SPU_VOICE_SAMPLE_NOTE | SPU_VOICE_WDSA | SPU_VOICE_ADSR_ADSR1 | SPU_VOICE_ADSR_ADSR2);
//printf("Voice pos %d\n",drv_outattr.voice);
drv_ptrk_stat = (drv_ptsbase+voice_stat->track);
if (drv_ptrk_stat->reverb != 0)
{
if (drv_channels[voice_stat->refindx] == 0)
{
SpuSetReverbVoice(SPU_ON, drv_outattr.voice);
drv_channels[voice_stat->refindx] = 0x7f;
}
}
else
{
if (drv_channels[voice_stat->refindx] != 0)
{
SpuSetReverbVoice(SPU_OFF, drv_outattr.voice);
drv_channels[voice_stat->refindx] = 0;
}
}
if (pan_status != 0)
{
drv_pan_1 = drv_ptrk_stat->pan_cntrl + voice_stat->patchmaps->pan - 0x40;
if (drv_pan_1 < 0) drv_pan_1 = 0;
if (drv_pan_1 > 0x7F) drv_pan_1 = 0x7F;
}
else
{
drv_pan_1 = 0x40;
}
//Volume
if (drv_ptrk_stat->sndclass == SNDFX_CLASS)
{
volume = velnum * voice_stat->patchmaps->volume * drv_ptrk_stat->volume_cntrl * master_sfx_volume;
}
else
{
volume = velnum * voice_stat->patchmaps->volume * drv_ptrk_stat->volume_cntrl * master_mus_volume;
}
drv_volume_1 = volume >> 21;
//Pan
if (pan_status != 0)
{
if (pan_status != 1)//2
{
drv_outattr.volume.right = ((drv_volume_1 << 7) * (0x80 - drv_pan_1)) >> 7;
drv_outattr.volume.left = ((drv_volume_1 << 7) * (drv_pan_1 + 1)) >> 7;
}
else//1
{
drv_outattr.volume.left = ((drv_volume_1 << 7) * (0x80 - drv_pan_1)) >> 7;
drv_outattr.volume.right = ((drv_volume_1 << 7) * (drv_pan_1 + 1)) >> 7;
}
}
else//0
{
drv_outattr.volume.left = drv_outattr.volume.right = drv_volume_1 << 6;
}
//Pitch
if (drv_ptrk_stat->pitch_cntrl == 0)
{
drv_outattr.note = (voice_stat->keynum << 8);
}
else
{
if (drv_ptrk_stat->pitch_cntrl < 1)
{
pitch = drv_ptrk_stat->pitch_cntrl * voice_stat->patchmaps->pitchstep_min;
drv_pitch1 = (32 - pitch);
drv_pitch2 = (drv_pitch1 >> 13) + 1;
drv_pitch3 = 0x80 - ((drv_pitch1 & 8191) >> 6);
drv_outattr.note = (voice_stat->keynum - (drv_pitch2)) << 8 | drv_pitch3 & 0x7F;
}
else
{
pitch = drv_ptrk_stat->pitch_cntrl * voice_stat->patchmaps->pitchstep_max;
drv_pitch1 = (32 + pitch);
drv_pitch2 = (drv_pitch1 >> 13);
drv_pitch3 = (drv_pitch1 & 8191) >> 6;
drv_outattr.note = (voice_stat->keynum + (drv_pitch2)) << 8 | drv_pitch3 & 0x7F;
}
}
drv_outattr.sample_note = (voice_stat->patchmaps->root_key << 8) | voice_stat->patchmaps->fine_adj;
drv_outattr.addr = voice_stat->patchinfo->sample_pos;
drv_outattr.adsr1 = voice_stat->patchmaps->adsr1;
drv_outattr.adsr2 = voice_stat->patchmaps->adsr2;
SpuSetKeyOnWithAttr(&drv_outattr);
}
//-----------------------------------------------------------
// Driver System
//-----------------------------------------------------------
void PSX_DriverInit(master_status_structure *pm_stat)//L80045CFC()
{
char *pmem;
//printf("PSX_DriverInit\n");
drv_pmsbase = pm_stat;
drv_pcurabstime = pm_stat->pabstime;
drv_pssbase = pm_stat->pseqstattbl;
drv_ptsbase = pm_stat->ptrkstattbl;
drv_pvsbase = pm_stat->pvoicestattbl;
drv_nvst = pm_stat->voices_total;
drv_cnt = 0;
if (drv_nvst != 0)
{
while (drv_cnt < drv_nvst)
{
if ((pm_stat->pvoicestattbl + drv_cnt)->patchtype == 1)
{
drv_pcurvs = (pm_stat->pvoicestattbl + drv_cnt);
break;
}
drv_cnt++;
}
}
drv_npti = drv_pmsbase->pmod_info->mod_hdr.patch_types_infile;
drv_cnt = 0;
if (drv_npti != 0)
{
while (drv_cnt < drv_npti)
{
if ((pm_stat->ppat_info + drv_cnt)->pat_grp_hdr.patch_id == 1)
{
drv_ppgd = (pm_stat->ppat_info + drv_cnt);
break;
}
drv_cnt++;
}
}
drv_hwvl = drv_ppgd->pat_grp_hdr.hw_voice_limit;
pmem = drv_ppgd->ppat_data; /* pointer math temp */
drv_patchesbase = (patches_header *)pmem;
pmem += (drv_ppgd->pat_grp_hdr.patches * sizeof(patches_header));
drv_patchmapsbase = (patchmaps_header *)pmem;
pmem += (drv_ppgd->pat_grp_hdr.patchmaps * sizeof(patchmaps_header));
drv_samplesbase = (patchinfo_header *)pmem;
pmem += (drv_ppgd->pat_grp_hdr.patchinfo * sizeof(patchinfo_header));
drv_drummapsbase = (char *)pmem;
psxspu_init();
drv_cnt = 0;
do
{
drv_channels[drv_cnt] = 0x7F;
drv_cnt++;
} while (drv_cnt < 24);
}
void PSX_DriverExit (track_status *ptk_stat)//L80045F24()
{
//printf("PSX_DriverExit\n");
SpuQuit();
}
extern unsigned long drv_vn; //8007EEE0
extern unsigned long drv_vi; //8007EEE4
extern unsigned long drv_keychannels; //8007EEE8
extern unsigned long drv_keycnt; //8007EEEC
extern voice_status *drv_pvs; //8007EEF0
extern unsigned long drv_voiceflag; //8007EEF4
extern char drv_keysstatus[24]; //8007EFF4
void PSX_DriverEntry1 (track_status *ptk_stat)//L80045F44()
{
//printf("PSX_DriverEntry1\n");
drv_vn = drv_pmsbase->voices_active;
if (drv_vn != 0)
{
drv_pvs = drv_pcurvs;
drv_vi = drv_hwvl;
while (drv_vi--)
{
if ((drv_pvs->flags & (VOICE_ACTIVE | VOICE_RELEASE)) == 3)
{
if (drv_pvs->pabstime < *drv_pcurabstime)
{
PSX_voiceparmoff(drv_pvs);
if (!--drv_vn) break;
}
}
drv_pvs++;
}
}
drv_voiceflag = 0;
if (voice_flags1 != 0)
{
drv_voiceflag = voice_flags1;
voice_flags1 = 0;
}
if (voice_flags2 != 0)
{
drv_outattr.voice = voice_flags2;
drv_outattr.mask = (SPU_VOICE_ADSR_RMODE | SPU_VOICE_ADSR_RR);
drv_outattr.r_mode = SPU_VOICE_EXPDec;
drv_outattr.rr = release_rate;
SpuSetVoiceAttr(&drv_outattr);
drv_voiceflag |= voice_flags2;
voice_flags2 = 0;
}
if (drv_voiceflag != 0)
{
SpuSetKey(SPU_OFF, drv_voiceflag);
drv_voiceflag = 0;
}
SpuGetAllKeysStatus(drv_keysstatus);
drv_keychannels = 24;
drv_keycnt = 0;
drv_pvs = drv_pcurvs;
while (drv_keychannels--)
{
if ((drv_pvs->flags & VOICE_ACTIVE) != 0)
{
if (drv_keysstatus[drv_keycnt] == 0)
{
PSX_voiceparmoff(drv_pvs);
}
}
drv_pvs++;
drv_keycnt++;
}
}
void PSX_DriverEntry2(track_status *ptk_stat)//L800461F4()
{
//printf("PSX_DriverEntry2\n");
}
void PSX_DriverEntry3(track_status *ptk_stat)//L800461FC()
{
//printf("PSX_DriverEntry3\n");
}
extern sequence_status *drv_pss; //L8007EEF8
void PSX_TrkOff(track_status *ptk_stat)//L80046204()
{
//printf("PSX_TrkOff\n");
drv_pss = drv_pssbase + ptk_stat->seq_owner;
PSX_TrkMute(ptk_stat);
if (ptk_stat->voices_active != 0)
{
ptk_stat->flags |= (TRK_OFF | TRK_STOPPED);
if (!drv_pss->tracks_playing--)
drv_pss->playmode = SEQ_STATE_STOPPED;
}
else
{
Eng_TrkOff(ptk_stat);
}
}
extern unsigned long drv_vn_2; //L8007EEFC
extern unsigned long drv_vi_2; //L8007EF00
extern voice_status *drv_pvs_2; //L8007EF04
extern sequence_status *drv_pss_2; //L8007EF08
void PSX_TrkMute(track_status *ptk_stat)//L800462B0()
{
//printf("PSX_TrkMute\n");
drv_vn_2 = ptk_stat->voices_active;
if (drv_vn_2 != 0)
{
drv_pvs_2 = drv_pcurvs;
drv_vi_2 = drv_hwvl;
while (drv_vi_2--)
{
if (((drv_pvs_2->flags & VOICE_ACTIVE) != 0) && (drv_pvs_2->track == ptk_stat->refindx))
{
if (ptr_notestate != 0 && (!(drv_pvs_2->flags & VOICE_RELEASE) && (ptk_stat->sndclass == MUSIC_CLASS)))
{
drv_pss_2 = (drv_pssbase + ptk_stat->seq_owner);
add_music_mute_note(drv_pss_2->seq_num,
drv_pvs_2->track,
drv_pvs_2->keynum,
drv_pvs_2->velnum,
drv_pvs_2->patchmaps,
drv_pvs_2->patchinfo);
}
drv_pvs_2->adsr2 = 0x10000000 >> (0x1f - (unsigned int)release_rate & 0x1f);
PSX_voicerelease(drv_pvs_2);
//printf("voice_stat->refindx %d\n",drv_pvs_2->refindx);
voice_flags2 = 1 << (drv_pvs_2->refindx & 31) | voice_flags2;
if (!--drv_vn_2) break;
}
drv_pvs_2++;
}
}
}
extern unsigned short drv_thepatch; //L8007EF0C
void PSX_PatchChg(track_status *ptk_stat)//L8004646C()
{
//printf("PSX_PatchChg\n");
drv_thepatch = (*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
ptk_stat->patchnum = drv_thepatch;
}
void PSX_PatchMod(track_status *ptk_stat)//L80046494()
{
//printf("PSX_PatchMod\n");
}
extern unsigned long drv_voices_active_3; //L8007EF10
extern unsigned long drv_hwvl_3; //L8007EF14
extern unsigned long drv_pitch_1; //L8007EF18
extern unsigned long drv_pitch_2; //L8007EF1C
extern unsigned long drv_pitch_3; //L8007EF20
extern voice_status *drv_voice_stat_3; //L8007EF24
extern short drv_pitch_cntrl; //L8007EF28
void PSX_PitchMod(track_status *ptk_stat)//L8004649C()
{
unsigned long pitch;
//printf("PSX_PitchMod\n");
drv_pitch_cntrl = (*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
if (ptk_stat->pitch_cntrl != drv_pitch_cntrl)
{
ptk_stat->pitch_cntrl = drv_pitch_cntrl;
drv_voices_active_3 = ptk_stat->voices_active;
if (drv_voices_active_3 != 0)
{
drv_voice_stat_3 = drv_pcurvs;
drv_hwvl_3 = drv_hwvl;
while (drv_hwvl_3--)
{
if ((drv_voice_stat_3->flags & VOICE_ACTIVE) && (drv_voice_stat_3->track == ptk_stat->refindx))
{
drv_outattr.voice = 1 << (drv_voice_stat_3->refindx & 31);
drv_outattr.mask = (SPU_VOICE_NOTE);
if (ptk_stat->pitch_cntrl != 0)
{
if (ptk_stat->pitch_cntrl <= 0)
{
pitch = ptk_stat->pitch_cntrl * drv_voice_stat_3->patchmaps->pitchstep_min;
drv_pitch_1 = (32 - pitch);
drv_pitch_2 = (drv_pitch_1 >> 13) + 1;
drv_pitch_3 = 0x80 - ((drv_pitch_1 & 8191) >> 6);
drv_outattr.note = (drv_voice_stat_3->keynum - (drv_pitch_2)) << 8 | drv_pitch_3 & 0x7F;
}
else
{
pitch = ptk_stat->pitch_cntrl * drv_voice_stat_3->patchmaps->pitchstep_max;
drv_pitch_1 = (32 + pitch);
drv_pitch_2 = (drv_pitch_1 >> 13);
drv_pitch_3 = (drv_pitch_1 & 8191) >> 6;
drv_outattr.note = (drv_voice_stat_3->keynum + (drv_pitch_2)) << 8 | drv_pitch_3 & 0x7F;
}
}
else
{
drv_outattr.note = (drv_voice_stat_3->keynum << 8);
}
SpuSetVoiceAttr(&drv_outattr);
if (!--drv_voices_active_3) break;
}
drv_voice_stat_3++;
}
}
}
}
void PSX_ZeroMod(track_status *ptk_stat)//L800466EC()
{
//printf("PSX_ZeroMod\n");
}
void PSX_ModuMod(track_status *ptk_stat)//L800466f4()
{
//printf("PSX_ModuMod\n");
}
extern unsigned long drv_voices_active_4; //L8007EF2C
extern unsigned long drv_hwvl_4; //L8007EF30
extern unsigned long drv_volume_2; //L8007EF34
extern voice_status *drv_voice_stat_4; //L8007EF38
extern short drv_pan_2; //L8007EF3C
void PSX_VolumeMod(track_status *ptk_stat)//L800466FC()
{
unsigned long volume;
//printf("PSX_VolumeMod\n");
ptk_stat->volume_cntrl = *(ptk_stat->ppos + 1);
drv_voices_active_4 = ptk_stat->voices_active;
if (drv_voices_active_4 != 0)
{
drv_voice_stat_4 = drv_pcurvs;
drv_hwvl_4 = drv_hwvl;
while (drv_hwvl_4--)
{
if ((drv_voice_stat_4->flags & VOICE_ACTIVE) && (drv_voice_stat_4->track == ptk_stat->refindx))
{
if (pan_status == 0)
{
drv_pan_2 = 0x40;
}
else
{
drv_pan_2 = ptk_stat->pan_cntrl + drv_voice_stat_4->patchmaps->pan - 0x40;
if (drv_pan_2 < 0) drv_pan_2 = 0;
if (drv_pan_2 > 0x7F) drv_pan_2 = 0x7F;
}
if (ptk_stat->sndclass == SNDFX_CLASS)
{
volume = drv_voice_stat_4->velnum * drv_voice_stat_4->patchmaps->volume * ptk_stat->volume_cntrl * master_sfx_volume;
}
else
{
volume = drv_voice_stat_4->velnum * drv_voice_stat_4->patchmaps->volume * ptk_stat->volume_cntrl * master_mus_volume;
}
drv_volume_2 = volume >> 21;
drv_outattr.voice = 1 << (drv_voice_stat_4->refindx & 31);
drv_outattr.mask = (SPU_VOICE_VOLL | SPU_VOICE_VOLR);
if (pan_status != 0)
{
if (pan_status != 1)//2
{
drv_outattr.volume.right = ((drv_volume_2 << 7) * (0x80 - drv_pan_2)) >> 7;
drv_outattr.volume.left = ((drv_volume_2 << 7) * (drv_pan_2 + 1)) >> 7;
}
else//1
{
drv_outattr.volume.left = ((drv_volume_2 << 7) * (0x80 - drv_pan_2)) >> 7;
drv_outattr.volume.right = ((drv_volume_2 << 7) * (drv_pan_2 + 1)) >> 7;
}
}
else//0
{
drv_outattr.volume.left = drv_outattr.volume.right = drv_volume_2 << 6;
}
SpuSetVoiceAttr(&drv_outattr);
if (!--drv_voices_active_4) break;
}
drv_voice_stat_4++;
}
}
}
extern unsigned long drv_voices_active_5; //L8007EF40
extern unsigned long drv_hwvl_5; //L8007EF44
extern unsigned long drv_volume_3; //L8007EF48
extern voice_status *drv_voice_stat_5; //L8007EF4C
extern short drv_pan_3; //L8007EF50
void PSX_PanMod(track_status *ptk_stat)//L80046A14()
{
unsigned long volume;
//printf("PSX_PanMod\n");
ptk_stat->pan_cntrl = *(ptk_stat->ppos + 1);
if (pan_status != 0)
{
drv_voices_active_5 = ptk_stat->voices_active;
if (drv_voices_active_5 != 0)
{
drv_voice_stat_5 = drv_pcurvs;
drv_hwvl_5 = drv_hwvl;
while (drv_hwvl_5--)
{
if ((drv_voice_stat_5->flags & VOICE_ACTIVE) && (drv_voice_stat_5->track == ptk_stat->refindx))
{
drv_pan_3 = ptk_stat->pan_cntrl + drv_voice_stat_5->patchmaps->pan - 0x40;
if (drv_pan_3 < 0) drv_pan_3 = 0;
if (drv_pan_3 > 0x7F) drv_pan_3 = 0x7F;
if (ptk_stat->sndclass == SNDFX_CLASS)
{
volume = drv_voice_stat_5->velnum * drv_voice_stat_5->patchmaps->volume * ptk_stat->volume_cntrl * master_sfx_volume;
}
else
{
volume = drv_voice_stat_5->velnum * drv_voice_stat_5->patchmaps->volume * ptk_stat->volume_cntrl * master_mus_volume;
}
drv_volume_3 = volume >> 21;
drv_outattr.voice = 1 << (drv_voice_stat_5->refindx & 31);
drv_outattr.mask = (SPU_VOICE_VOLL | SPU_VOICE_VOLR);
if (pan_status != 1)//2
{
drv_outattr.volume.right = ((drv_volume_3 << 7) * (0x80 - drv_pan_3)) >> 7;
drv_outattr.volume.left = ((drv_volume_3 << 7) * (drv_pan_3 + 1)) >> 7;
}
else//1
{
drv_outattr.volume.left = ((drv_volume_3 << 7) * (0x80 - drv_pan_3)) >> 7;
drv_outattr.volume.right = ((drv_volume_3 << 7) * (drv_pan_3 + 1)) >> 7;
}
SpuSetVoiceAttr(&drv_outattr);
if (!--drv_voices_active_5) break;
}
drv_voice_stat_5++;
}
}
}
}
//PSX_PedalMod
void PSX_PedalMod(track_status *ptk_stat)//L80046CF0()
{
//printf("PSX_PedalMod\n");
}
//PSX_ReverbMod
void PSX_ReverbMod(track_status *ptk_stat)//L80046CF8()
{
//printf("PSX_ReverbMod\n");
}
//PSX_ChorusMod
void PSX_ChorusMod(track_status *ptk_stat)//L80046D00()
{
//printf("PSX_ChorusMod\n");
}
void PSX_voiceon(voice_status *voice_stat, track_status *ptk_stat,
patchmaps_header *patchmaps, patchinfo_header *patchinfo,
unsigned char keynum, unsigned char velnum)//L80046D08()
{
int adsr2;
//printf("PSX_voiceon\n");
voice_stat->flags = (voice_stat->flags | VOICE_ACTIVE) & ~VOICE_RELEASE;
voice_stat->track = ptk_stat->refindx;
voice_stat->keynum = keynum;
voice_stat->velnum = velnum;
voice_stat->sndtype = 0;//no used??
voice_stat->priority = ptk_stat->priority;
voice_stat->patchmaps = patchmaps;
voice_stat->patchinfo = patchinfo;
voice_stat->pabstime = *drv_pcurabstime;
if (!(patchmaps->adsr2 & 0x20))
{
adsr2 = 0x5dc0000;
}
else
{
adsr2 = 0x10000000;
}
voice_stat->adsr2 = adsr2 >> (0x1f - ((unsigned int)patchmaps->adsr2 & 0x1f) & 0x1f);
ptk_stat->voices_active++;
drv_pmsbase->voices_active++;
TriggerPSXVoice(voice_stat, keynum, velnum);//TriggerPSXVoice
}
extern track_status *drv_ptrk_stat_1; //L8007EF54
void PSX_voiceparmoff(voice_status *voice_stat)//L80046DDC()
{
//printf("PSX_voiceparmoff\n");
drv_ptrk_stat_1 = (drv_ptsbase + voice_stat->track);
drv_pmsbase->voices_active--;
drv_ptrk_stat_1->voices_active--;
if ((drv_ptrk_stat_1->voices_active == 0) && (drv_ptrk_stat_1->flags & TRK_OFF))
{
Eng_TrkOff(drv_ptrk_stat_1);
}
voice_stat->flags &= ~(VOICE_ACTIVE|VOICE_RELEASE);
}
void PSX_voicerelease(voice_status *voice_stat)//L80046EA4()
{
//printf("PSX_voicerelease\n");
voice_flags1 = 1 << (voice_stat->refindx & 31) | voice_flags1;
voice_stat->flags |= VOICE_RELEASE;
voice_stat->pabstime = *drv_pcurabstime + voice_stat->adsr2;
}
extern unsigned long drv_hwvl_6; //L8007EF58
extern unsigned long drv_note_stat; //L8007EF5C
extern voice_status *drv_voice_stat_6; //L8007EF60
void PSX_voicenote(track_status *ptk_stat,
patchmaps_header *patchmap, patchinfo_header *patchinfo,
unsigned char keynum, unsigned char velnum)//L80046EF0()
{
//printf("PSX_voicenote\n");
drv_note_stat = 0;
drv_hwvl_6 = drv_hwvl;
drv_voice_stat_6 = drv_pcurvs;
while (drv_hwvl_6--)
{
if ((drv_voice_stat_6->flags & VOICE_ACTIVE) == 0)
{
PSX_voiceon(drv_voice_stat_6, ptk_stat, patchmap, patchinfo, keynum, velnum);
drv_note_stat = 0;
break;
}
if (drv_voice_stat_6->priority <= ptk_stat->priority)
{
if (priority <= drv_voice_stat_6->priority)
{
if ((drv_voice_stat_6->flags & VOICE_RELEASE) == 0)
{
if ((ptr_pvoicestattbl->flags & VOICE_RELEASE) != 0) goto next_voice;
}
else
{
if ((ptr_pvoicestattbl->flags & VOICE_RELEASE) == 0) goto set_note_stat;
}
if (max_pabstime <= drv_voice_stat_6->pabstime) goto next_voice;
}
set_note_stat:
drv_note_stat = 1;
priority = drv_voice_stat_6->priority;
max_pabstime = drv_voice_stat_6->pabstime;
ptr_pvoicestattbl = drv_voice_stat_6;
}
next_voice:
drv_voice_stat_6++;
}
if (drv_note_stat != 0)
{
PSX_voiceparmoff(ptr_pvoicestattbl);
PSX_voiceon(ptr_pvoicestattbl,ptk_stat,patchmap,patchinfo,keynum,velnum);
}
}
extern unsigned long drv_patch_cnt; //L8007EF64
extern unsigned char drv_byte01; //L8007EF68
extern unsigned char drv_byte02; //L8007EF6C
extern unsigned char drv_patchmap_cnt; //L8007EF70
extern patches_header *drv_patch_1; //L8007EF74
extern patchmaps_header *drv_patchmap_1; //L8007EF78
extern patchinfo_header *drv_samplesbase_1; //L8007EF7C
void PSX_NoteOn(track_status *ptk_stat)//L80047104()
{
char *drummaps;
//printf("PSX_NoteOn\n");
drv_byte01 = *(ptk_stat->ppos + 1);
drv_byte02 = *(ptk_stat->ppos + 2);
if (ptk_stat->sndclass == DRUMS_CLASS)
{
drummaps = (drv_drummapsbase + (drv_byte01 * sizeof(long)));
drv_patch_1 = drv_patchesbase + *(unsigned short*)(drummaps);
drv_byte01 = *(drummaps + sizeof(short));
}
else
{
drv_patch_1 = drv_patchesbase+ptk_stat->patchnum;
}
drv_patch_cnt = 0;
drv_patchmap_cnt = (char) drv_patch_1->patchmap_cnt;
while (drv_patchmap_cnt--)
{
drv_patchmap_1 = drv_patchmapsbase + (drv_patch_1->patchmap_idx + drv_patch_cnt);
drv_samplesbase_1 = drv_samplesbase + drv_patchmap_1->sample_id;
if (drv_samplesbase_1->sample_pos != 0)
{
if (drv_patchmap_1->note_min <= drv_byte01)
{
if (drv_byte01 <= drv_patchmap_1->note_max)
{
PSX_voicenote(ptk_stat,drv_patchmap_1,
drv_samplesbase_1,drv_byte01,drv_byte02);
}
}
}
drv_patch_cnt++;
}
}
extern unsigned long drv_hwvl_7; //L8007EF80
extern voice_status *drv_voice_stat_7; //L8007EF84
void PSX_NoteOff(track_status *ptk_stat)//L800472E8()
{
//printf("PSX_NoteOff\n");
drv_voice_stat_7 =
drv_pcurvs;
drv_hwvl_7 = drv_hwvl;
while (drv_hwvl_7--)
{
if (((drv_voice_stat_7->flags & (VOICE_ACTIVE|VOICE_RELEASE)) == VOICE_ACTIVE) &&
(drv_voice_stat_7->keynum == *(ptk_stat->ppos + 1)) &&
(drv_voice_stat_7->track == ptk_stat->refindx))
{
PSX_voicerelease(drv_voice_stat_7);
}
drv_voice_stat_7++;
}
}
================================================
FILE: PSXDOOM/PSXDOOM.cbp
================================================
================================================
FILE: PSXDOOM/PSXDOOM.layout
================================================
================================================
FILE: PSXDOOM/PSXSPU.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
#include
#include "psxspu.h"
#include "wessapi.h"
extern void SpuSetCommonAttr (SpuCommonAttr *attr);
#define MALLOC_MAX 1
extern char spu_malloc_rec[SPU_MALLOC_RECSIZ * (MALLOC_MAX + 1)];
extern unsigned int psxspu_initialized;
extern unsigned int psxspu_status;
extern unsigned long end_of_sram;
extern int psxspu_master_vol;
extern int psxspu_master_fadecount;
extern int psxspu_master_vol_fixed;
extern int psxspu_master_destvol;
extern int psxspu_master_changeval;
extern int psxspu_cd_vol;
extern int psxspu_cd_fadecount;
extern int psxspu_cd_vol_fixed;
extern int psxspu_cd_destvol;
extern int psxspu_cd_changeval;
extern SpuReverbAttr rev_attr;//8007EEA4
unsigned long SpuGetReverbOffsetAddr[10] = // equivale a la función SpuGetReverbOffsetAddr()
{
520192, 514368, 516288, 505792, 495648,
479776, 461120, 425920, 425920, 508928
};
#define END_O_SRAM 520192
void psxspu_init_reverb(long rev_mode, short depthleft, short depthright, long delay, long feedback)//80045098
{
psxspu_status = 0;
rev_attr.mask = (SPU_REV_MODE|SPU_REV_DEPTHL|SPU_REV_DEPTHR|SPU_REV_DELAYTIME|SPU_REV_FEEDBACK);
rev_attr.mode = rev_mode | SPU_REV_MODE_CLEAR_WA;
rev_attr.depth.left = depthleft;
rev_attr.depth.right = depthright;
rev_attr.delay = delay;
rev_attr.feedback = feedback;
SpuSetReverbModeParam (&rev_attr);
SpuSetReverbDepth (&rev_attr);
if(rev_mode == PSXSPU_REV_MODE_OFF)
{
SpuSetReverb(SPU_OFF);
end_of_sram = END_O_SRAM;
}
else
{
SpuSetReverb(SPU_ON);
end_of_sram = SpuGetReverbOffsetAddr[rev_mode];//SpuGetReverbOffsetAddr();
}
SpuSetReverbVoice((rev_mode != PSXSPU_REV_MODE_OFF), SPU_ALLCH);
psxspu_status = 1;
//printf("End_Of_Sram %d\n", end_of_sram);
}
void psxspu_set_reverb_depth(short depthleft,short depthright)//80045178
{
psxspu_status = 0;
rev_attr.depth.left = depthleft;
rev_attr.depth.right = depthright;
SpuSetReverbDepth(&rev_attr);
psxspu_status = 1;
}
void psxspu_init(void)//800451c0
{
SpuCommonAttr com_attr;
if (psxspu_initialized == 0)
{
//printf("psxspu_init\n");
psxspu_status = 0;
psxspu_initialized = 1;
SpuInit();
SpuInitMalloc(MALLOC_MAX, spu_malloc_rec);
SpuSetTransMode(SpuTransferByDMA);
psxspu_init_reverb(0, 0, 0, 0, 0);
com_attr.mask = (SPU_COMMON_MVOLL | SPU_COMMON_MVOLR | SPU_COMMON_CDVOLL | SPU_COMMON_CDVOLR | SPU_COMMON_CDVOLR| SPU_COMMON_CDREV | SPU_COMMON_CDMIX);
com_attr.mvol.left = MAX_MASTER_VOL;
com_attr.mvol.right = MAX_MASTER_VOL;
com_attr.cd.volume.left = MAX_CD_VOL;
com_attr.cd.volume.right = MAX_CD_VOL;
com_attr.cd.reverb = 0;
com_attr.cd.mix = 1;
SpuSetCommonAttr(&com_attr);
psxspu_status = 1;
}
}
void psxspu_set_master_volume(int vol)//8004526C
{
SpuCommonAttr com_attr;
psxspu_status = 0;
com_attr.mvol.left = vol;
com_attr.mvol.right = vol;
com_attr.mask = (SPU_COMMON_MVOLL | SPU_COMMON_MVOLR);
SpuSetCommonAttr(&com_attr);
psxspu_status = 1;
}
void psxspu_set_cd_volume(int vol)//800452B0
{
SpuCommonAttr com_attr;
psxspu_status = 0;
com_attr.cd.volume.left = vol;
com_attr.cd.volume.right = vol;
com_attr.mask = (SPU_COMMON_CDVOLL | SPU_COMMON_CDVOLR);
SpuSetCommonAttr(&com_attr);
psxspu_status = 1;
}
void psxspu_setcdmixon(void)//800452F4
{
SpuCommonAttr com_attr;
psxspu_status = 0;
com_attr.mask = (SPU_COMMON_CDMIX);
com_attr.cd.mix = 1;
SpuSetCommonAttr(&com_attr);
psxspu_status = 1;
}
void psxspu_setcdmixoff(void)//8004533C
{
SpuCommonAttr com_attr;
psxspu_status = 0;
com_attr.mask = (SPU_COMMON_CDMIX);
com_attr.cd.mix = 0;
SpuSetCommonAttr(&com_attr);
psxspu_status = 1;
}
void psxspu_fadeengine(void)//8004537C
{
if (psxspu_status != 0)
{
if (psxspu_cd_fadecount > 0)
{
psxspu_cd_fadecount -= 1;
psxspu_cd_vol_fixed += psxspu_cd_changeval;
if (psxspu_cd_fadecount == 0)
psxspu_cd_vol_fixed = psxspu_cd_destvol;
psxspu_cd_vol = psxspu_cd_vol_fixed >> 16;
psxspu_set_cd_volume(psxspu_cd_vol);
}
if (psxspu_master_fadecount > 0)
{
psxspu_master_fadecount -= 1;
psxspu_master_vol_fixed += psxspu_master_changeval;
if (psxspu_master_fadecount == 0)
psxspu_master_vol_fixed = psxspu_master_destvol;
psxspu_master_vol = psxspu_master_vol_fixed >> 16;
psxspu_set_master_volume(psxspu_master_vol);
}
}
}
void psxspu_set_cd_vol(int vol)//80045490
{
psxspu_status = 0;
psxspu_cd_vol = vol;
psxspu_cd_vol_fixed = psxspu_cd_vol << 16;
psxspu_cd_fadecount = 0;
psxspu_set_cd_volume(psxspu_cd_vol);
psxspu_status = 1;
}
int psxspu_get_cd_vol(void)//800454EC
{
return psxspu_cd_vol;
}
void psxspu_start_cd_fade(int msec, int destvol)//800454FC
{
psxspu_status = 0;
if (WessTimerActive == 0)
{
psxspu_cd_fadecount = 0;
}
else
{
psxspu_cd_destvol = destvol * 0x10000;
psxspu_cd_fadecount = (msec * 0x78) / 1000 + 1;
psxspu_cd_changeval = (psxspu_cd_destvol - psxspu_cd_vol_fixed) / psxspu_cd_fadecount;
}
psxspu_status = 1;
}
void psxspu_stop_cd_fade(void)//800455B4
{
psxspu_status = 0;
psxspu_cd_fadecount = 0;
psxspu_status = 1;
}
int psxspu_get_cd_fade_status(void)//800455D8
{
return (psxspu_cd_fadecount < 2) ^ 1;
}
void psxspu_set_master_vol(int vol)//800455F0
{
psxspu_status = 0;
psxspu_master_vol = vol;
psxspu_master_vol_fixed = psxspu_master_vol << 16;
psxspu_master_fadecount = 0;
psxspu_set_master_volume(psxspu_master_vol);
psxspu_status = 1;
}
int psxspu_get_master_vol(void)//8004564C
{
return psxspu_master_vol;
}
void psxspu_start_master_fade(int msec, int destvol)//8004565C
{
psxspu_status = 0;
if (WessTimerActive == 0)
{
psxspu_master_fadecount = 0;
}
else
{
psxspu_master_destvol = destvol * 0x10000;
psxspu_master_fadecount = (msec * 0x78) / 1000 + 1;
psxspu_master_changeval = (psxspu_master_destvol - psxspu_master_vol_fixed) / psxspu_master_fadecount;
}
psxspu_status = 1;
}
void psxspu_stop_master_fade(void)//80045714
{
psxspu_status = 0;
psxspu_master_fadecount = 0;
psxspu_status = 1;
}
int psxspu_get_master_fade_status(void)//80045738
{
return (psxspu_master_fadecount < 2) ^ 1;
}
================================================
FILE: PSXDOOM/PSXSPU.H
================================================
/*------------------------------------------------------------------*/
/*
Williams Entertainment Sound System
by Scott Patterson
PSX SPU Volume and Reverb controls.
*/
/*------------------------------------------------------------------*/
#ifndef _PSXSPU_H
#define _PSXSPU_H
#define FADE_TIME 250
/*
Notes on fade calls:
To do a syncronous fade to zero volume:
psxspu_start_cd_fade(FADE_TIME,0);
while(psxspu_get_cd_fade_status());
To do an asyncronous fade to zero volume:
psxspu_start_cd_fade(FADE_TIME,0);
.
.
.
if(!psxspu_get_cd_fade_status())
{
//fade is now done
}
*/
#define MAX_MASTER_VOL 0x3fff
#define MAX_CD_VOL 0x3cff
#define MED_CD_VOL 0x2fff
#define MIN_CD_VOL 0x1fff
#define SRAM_ADDRESS_LIMIT 520192
#define SRAM_RESERVED_SIZE 4112
#define SRAM_TO_ALLOC_SPU (SRAM_ADDRESS_LIMIT-SRAM_RESERVED_SIZE)
#define PSXSPU_REV_MODE_OFF 0
#define PSXSPU_REV_MODE_ROOM 1
#define PSXSPU_REV_MODE_STUDIO_A 2
#define PSXSPU_REV_MODE_STUDIO_B 3
#define PSXSPU_REV_MODE_STUDIO_C 4
#define PSXSPU_REV_MODE_HALL 5
#define PSXSPU_REV_MODE_SPACE 6
#define PSXSPU_REV_MODE_ECHO 7
#define PSXSPU_REV_MODE_DELAY 8
#define PSXSPU_REV_MODE_PIPE 9
extern unsigned long end_of_sram;
extern void psxspu_init(void);
extern void psxspu_init_reverb(long rev_mode,
short depthleft,
short depthright,
long delay,
long feedback);
extern void psxspu_set_reverb_depth(short depthleft,
short depthright);
extern void psxspu_fadeengine(void);
extern void psxspu_set_master_vol(int vol);
extern int psxspu_get_master_vol(void);
extern void psxspu_start_master_fade(int msec,int destvol);
extern void psxspu_stop_master_fade(void);
//returns zero when fade is done
extern int psxspu_get_master_fade_status(void);
extern void psxspu_set_cd_vol(int vol);
extern int psxspu_get_cd_vol(void);
extern void psxspu_start_cd_fade(int msec,int destvol);
extern void psxspu_stop_cd_fade(void);
//returns zero when fade is done
extern int psxspu_get_cd_fade_status(void);
extern void psxspu_setcdmixon(void);
extern void psxspu_setcdmixoff(void);
#endif
================================================
FILE: PSXDOOM/PSX_FILE.C
================================================
/* PSX_FILE.c */
#include "doomdef.h"
#include "r_local.h"
/*
============================================================================
READ/OPEN/CLOSE/SEEK/CLEAR PSX FILE BASED ROUTINES
============================================================================
*/
PsxCd_File files[4]; //800A9B74 psxdoom
/*
== == == == == == == == == ==
=
= ClearFiles
=
= Exclusive Psx Doom
== == == == == == == == == ==
*/
void ClearFiles(void)//L80031D84()
{
int i;
for (i = 0; i < 4; i++)
{
files[i].file.size = 0;
}
}
/*
== == == == == == == == == ==
=
= OpenFile
=
= Exclusive Psx Doom
== == == == == == == == == ==
*/
int OpenFile(char *filename)//L80031DAC()
{
PsxCd_File *fp;
int i, j;
fp = psxcd_open(filename);
if (!fp)
I_Error("Cannot open %s", filename);
//get free file
for (i = 0; i < 4; i++)
{
if (files[i].file.size == 0)
break;
}
if (!(i < 4))
I_Error("OpenFile: Too many open files!");
//copy file pointer
files[i] = *fp;
return i;
}
/*
== == == == == == == == == ==
=
= CloseFile
=
= Exclusive Psx Doom
== == == == == == == == == ==
*/
void CloseFile(int file_num)//L80031EA8()
{
files[file_num].file.size = 0;
psxcd_close(&files[file_num]);
}
/*
== == == == == == == == == ==
=
= SeekFile
=
= Exclusive Psx Doom
== == == == == == == == == ==
*/
int SeekFile(int file_num, int seekpos, int seekmode)//L80031EF4()
{
PsxCd_File *fileptr;
int tell;
//printf("seekpos %d\n",seekpos);
fileptr = &files[file_num];
psxcd_seek(fileptr, seekpos, seekmode);
tell = psxcd_tell(fileptr);
//printf("tell %d\n",tell);
return tell;
}
/*
== == == == == == == == == ==
=
= ReadFile
=
= Exclusive Psx Doom
== == == == == == == == == ==
*/
void ReadFile(int file_num, void *destptr, unsigned int readbytes)//L800322F8()
{
unsigned long tell;
unsigned int rbytes;
PsxCd_File *fileptr;
fileptr = &files[file_num];
//printf("0x%X, [%d]", (unsigned long)fileptr, file_num);
tell = psxcd_tell(fileptr);
rbytes = readbytes;
if (0x2000 < readbytes)
rbytes = 0x2000; //max 32 kb
psxcd_seek(fileptr, 0, PSXCD_SEEK_SET);
psxcd_read(destptr, rbytes, fileptr);
psxcd_seek(fileptr, tell, PSXCD_SEEK_SET);
rbytes = psxcd_read(destptr, readbytes, fileptr);
if (rbytes != readbytes)
I_Error("ReadFile: error reading %d of %d bytes\n", rbytes, readbytes);
}
================================================
FILE: PSXDOOM/SEQLOAD.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update 20/10/2019 [GEC]
#include "seqload.h"
#define _ALIGN4_ 1
#include
extern pmasterstat *pm_stat;
extern int seq_loader_enable; //80075790
extern char *loaderfile; //80075794
extern pmasterstat *ref_pm_stat; //80075798
extern int ref_max_seq_num; //8007579C
extern char Driver_Init; //800757A0
extern char Reset_Gates; //800757A1
extern int opencount; //800757A4
extern int(*Seq_Error_func)(int, int); //800757A8
extern int Seq_Error_module; //800757AC
extern Wess_File_IO_Struct *fp_seq_file; //800757B0
extern track_header scratch_trk_hdr; //8007EDE8
extern track_header seq_track_header; //8007EE74
extern track_header base_track_header; //8007EE8C
static void wess_seq_err(int code)//800444B0
{
if (Seq_Error_func) {
Seq_Error_func(Seq_Error_module, code);
}
}
void wess_seq_loader_install_error_handler(int (*error_func)(int, int), int module)//800444E8
{
Seq_Error_func = error_func;
Seq_Error_module = module;
}
int Is_Seq_Seq_Num_Valid(int seqnum)//80044500
{
if (seqnum >= 0)
{
if(ref_max_seq_num <= seqnum)
return 0;
return 1;
}
return 0;
}
int open_sequence_data(void)//8004452C
{
if (opencount == 0)
{
fp_seq_file = (Wess_File_IO_Struct *)module_open(loaderfile);
if(fp_seq_file == 0)
{
wess_seq_err(SEQLOAD_FOPEN);
return 0;
}
}
opencount += 1;
return 1;
}
void close_sequence_data(void)//80044598
{
if (opencount == 1)
{
module_close(fp_seq_file);
}
if (opencount > 0)
{
opencount -= 1;
}
}
int wess_seq_load_sub(int seqnum, void *memptr)//800445EC
{
sequence_data *psq_info;
track_data *ptrk_info;
int seqload;
int seqread;
int seqseek;
int numtracks, k, loadit, tracknum, readbytes;
char *pmem;
//printf("wess_seq_load_sub\n");
pmem = memptr;
if (seq_loader_enable)
{
if (!Is_Seq_Seq_Num_Valid(seqnum))
return 0;
if (!open_sequence_data())
{
wess_seq_err(SEQLOAD_FOPEN);
return 0;
}
psq_info = (ref_pm_stat->pmod_info->pseq_info + seqnum); /* pointer math */
psq_info->ptrk_info = (track_data *)pmem;
if (psq_info->trkstoload == 0)
pmem += sizeof(track_data);
else
pmem += (psq_info->trkstoload * sizeof(track_data));
seqseek = module_seek(fp_seq_file, psq_info->fileposition, PSXCD_SEEK_SET);
if (seqseek)
{
wess_seq_err(SEQLOAD_FSEEK);
return 0;
}
readbytes = sizeof(seq_header);
seqread = module_read(&(ref_pm_stat->pmod_info->pseq_info + seqnum)->seq_hdr, readbytes, fp_seq_file);
if (seqread != readbytes)
{
wess_seq_err(SEQLOAD_FREAD);
return 0;
}
numtracks = (ref_pm_stat->pmod_info->pseq_info + seqnum)->seq_hdr.tracks;
tracknum = 0;
while (numtracks--)
{
readbytes = sizeof(track_header);
seqread = module_read(&seq_track_header, readbytes, fp_seq_file);
if (seqread != readbytes)
{
wess_seq_err(SEQLOAD_FREAD);
return 0;
}
loadit = 0;
if ((seq_track_header.voices_type == NoSound_ID) ||
(seq_track_header.voices_type == GENERIC_ID))
{
loadit = 1;
}
else
{
k = ref_pm_stat->patch_types_loaded;
while (k--)
{
if (((seq_track_header.voices_type == (ref_pm_stat->ppat_info + k)->hw_tl_list.hardware_ID) &&
(((seq_track_header.voices_class == SNDFX_CLASS) && ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_SOUND_EFFECTS)) ||
((seq_track_header.voices_class == SFXDRUMS_CLASS) && ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_SOUND_EFFECTS)) ||
((seq_track_header.voices_class == MUSIC_CLASS) && ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_MUSIC)) ||
((seq_track_header.voices_class == DRUMS_CLASS) && ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_DRUMS)))))
{
loadit = 1;
break;
}
}
}
if (loadit == 0)
{
seqseek = module_seek(fp_seq_file, (seq_track_header.labellist_count * sizeof(long)) + seq_track_header.data_size, PSXCD_SEEK_CUR);
if (seqseek != 0)
{
wess_seq_err(SEQLOAD_FSEEK);
return 0;
}
}
else
{
ptrk_info = ((ref_pm_stat->pmod_info->pseq_info + seqnum)->ptrk_info + tracknum);
memcpy(&ptrk_info->trk_hdr, &seq_track_header, sizeof(seq_track_header));
if (seq_track_header.voices_type == GENERIC_ID)
{
ptrk_info->trk_hdr.voices_type = NoSound_ID;
if (seq_track_header.voices_class == SNDFX_CLASS || seq_track_header.voices_class == SFXDRUMS_CLASS)
{
for (k = 0; k < ref_pm_stat->patch_types_loaded; k++)
{
if ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_SOUND_EFFECTS)
{
ptrk_info->trk_hdr.voices_type = (unsigned char)(pm_stat->ppat_info + k)->hw_tl_list.hardware_ID;
break;
}
}
}
else if (scratch_trk_hdr.voices_class == MUSIC_CLASS)
{
for (k = 0; k < ref_pm_stat->patch_types_loaded; k++)
{
if ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_MUSIC)
{
ptrk_info->trk_hdr.voices_type = (unsigned char)(pm_stat->ppat_info + k)->hw_tl_list.hardware_ID;
break;
}
}
}
else if (scratch_trk_hdr.voices_class == DRUMS_CLASS)
{
for (k = 0; k < ref_pm_stat->patch_types_loaded; k++)
{
if ((ref_pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_DRUMS)
{
ptrk_info->trk_hdr.voices_type = (unsigned char)(pm_stat->ppat_info + k)->hw_tl_list.hardware_ID;
break;
}
}
}
}
ptrk_info->plabellist = (unsigned long *)pmem;
pmem += (ptrk_info->trk_hdr.labellist_count * sizeof(long));
readbytes = (ptrk_info->trk_hdr.labellist_count * sizeof(long));
seqread = module_read(ptrk_info->plabellist, readbytes, fp_seq_file);
if (seqread != readbytes)
{
wess_seq_err(SEQLOAD_FREAD);
return 0;
}
ptrk_info->ptrk_data = (char *)pmem;
pmem += (ptrk_info->trk_hdr.data_size);
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
readbytes = (ptrk_info->trk_hdr.data_size);
seqread = module_read(ptrk_info->ptrk_data, readbytes, fp_seq_file);
if (seqread != readbytes)
{
wess_seq_err(SEQLOAD_FREAD);
return 0;
}
}
tracknum++;
}
if (psq_info->trkstoload == 0)
{
ptrk_info = (ref_pm_stat->pmod_info->pseq_info + seqnum)->ptrk_info;
memcpy(&ptrk_info->trk_hdr, &base_track_header, sizeof(base_track_header));
ptrk_info->plabellist = (unsigned long *)pmem;
ptrk_info->ptrk_data = (char *)pmem;
*ptrk_info->ptrk_data = Driver_Init;
*(ptrk_info->ptrk_data + 1) = Reset_Gates;
pmem += (ptrk_info->trk_hdr.data_size);
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
(ref_pm_stat->pmod_info->pseq_info+seqnum)->seq_hdr.tracks = 1;
}
else
{
(ref_pm_stat->pmod_info->pseq_info+seqnum)->seq_hdr.tracks = psq_info->trkstoload;
}
close_sequence_data();
}
k = (unsigned int)((unsigned)pmem - (unsigned)memptr);
return k;
}
int wess_seq_loader_init(void *input_pm_stat, char *seqfile, enum OpenSeqHandleFlag flag)//80044D98
{
//printf("wess_seq_loader_init\n");
seq_loader_enable = 0;
loaderfile = seqfile;
ref_pm_stat = (pmasterstat *)input_pm_stat;
if (ref_pm_stat)
{
seq_loader_enable = 1;
ref_max_seq_num = ref_pm_stat->pmod_info->mod_hdr.sequences;
base_track_header.priority = 0x80;
base_track_header.initvolume_cntrl = 0x7f;
base_track_header.initpan_cntrl = 0x40;
base_track_header.initppq = 120;
base_track_header.initqpm = 120;
base_track_header.voices_type = 0;
base_track_header.voices_max = 0;
base_track_header.reverb = 0;
base_track_header.voices_class = 0;
base_track_header.initpatchnum = 0;
base_track_header.initpitch_cntrl = 0;
base_track_header.substack_count = 0;
base_track_header.mutebits = 0;
base_track_header.labellist_count = 0;
base_track_header.data_size = 2;
if (flag == YesOpenSeqHandle)
{
if (!open_sequence_data())
{
wess_seq_err(SEQLOAD_FOPEN);
return 0;
}
}
}
return 1;
}
void wess_seq_loader_exit(void)//80044EAC
{
close_sequence_data();
seq_loader_enable = 0;
}
int wess_seq_sizeof(int seqnum)//80044ED4
{
sequence_data *psq_info;
if (seq_loader_enable)
{
if (!Is_Seq_Seq_Num_Valid(seqnum))
return 0;
psq_info = ref_pm_stat->pmod_info->pseq_info+seqnum; /* pointer math */
if (psq_info->ptrk_info)
return 0;
return (psq_info->trkinfolength);
}
return 0;
}
int wess_seq_load(int seqnum, void *memptr)//80044F64
{
if (seq_loader_enable)
{
if (!Is_Seq_Seq_Num_Valid(seqnum))
return 0;
if ((ref_pm_stat->pmod_info->pseq_info+seqnum)->ptrk_info)
return 0;
//printf("wess_seq_load %d\n", seqnum);
return wess_seq_load_sub(seqnum, memptr);
}
return 0;
}
int wess_seq_free(int seqnum)//80045008
{
sequence_data *psq_info;
if (seq_loader_enable)
{
if (!Is_Seq_Seq_Num_Valid(seqnum))
return 0;
psq_info = ref_pm_stat->pmod_info->pseq_info+seqnum; /* pointer math */
if (psq_info->ptrk_info)
{
psq_info->ptrk_info = 0;
return 1;
}
}
return 0;
}
================================================
FILE: PSXDOOM/SEQLOAD.H
================================================
/*------------------------------------------------------------------*/
/*
The Williams Entertainment Sound System
by Scott Patterson
*/
/*------------------------------------------------------------------*/
#ifndef _SEQLOAD_H
#define _SEQLOAD_H
#include
#include "wessapi.h"
#include "wessarc.h"
enum Seq_Load_Error {
SEQLOAD_NO_ERROR,
SEQLOAD_FOPEN,
SEQLOAD_FREAD,
SEQLOAD_FSEEK
};
enum OpenSeqHandleFlag {NoOpenSeqHandle,YesOpenSeqHandle};
/*
routine: wess_seq_loader_init()
- this routine must be called before and seq_loader_routines
- input_pm_stat is returned by wess_get_master_status()
- seqfile is the .wmd filename
- flag specifies if the file handle will be opened during init or
each time file is accessed
*/
extern int wess_seq_loader_init(void *input_pm_stat,
char *seqfile,
enum OpenSeqHandleFlag flag);
/*
routine: wess_seq_loader_exit()
- closes file handle if not already closed
- disables sequence loading calls
*/
extern void wess_seq_loader_exit(void);
/*
routine: wess_seq_loader_install_error_handler()
- for installing an error callback to notify file access errors
- module is your own ID returned as err_module parameter
- err_enum is the returned Seq_Load_Error enum parameter
*/
extern void wess_seq_loader_install_error_handler(int (*error_func)(int, int),
int module);
/*
general loading guidelines:
- sizeof functions return the amount of bytes needed for data
not already loaded, therefore, when sizeof returns 0, this
means the data referred to is already loaded
- load functions only load data that is not already loaded
and return the amount of bytes loaded, memory is not allocated
internally, you must use the sizeof functions and allocate
memory yourself
- free functions mark data as not loaded, memory is not freed
internally, you must free memory yourself
*/
/*
individual sequence loading
*/
extern int wess_seq_sizeof(int seqnum);
extern int wess_seq_load(int seqnum,void *memptr);
extern int wess_seq_free(int seqnum);
/*
sequence list loading
- pass in a list of sequnce numbers to be loaded
- end this list with the END_SEQ_LIST define
*/
#define END_SEQ_LIST -1
extern int wess_seq_list_sizeof(short *seqlist);
extern int wess_seq_list_load(short *seqlist,void *memptr);
extern int wess_seq_list_free(short *seqlist);
/*
sequence range loading
- specify a number of consecutive sequences to be loaded
*/
extern int wess_seq_range_sizeof(int seqfirst,int numseqs);
extern int wess_seq_range_load(int seqfirst,int numseqs,void *memptr);
extern int wess_seq_range_free(int seqfirst,int numseqs);
#endif
================================================
FILE: PSXDOOM/SEQLOADR.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update 20/10/2019 [GEC]
#include "seqload.h"
#define _ALIGN4_ 1
#include
extern pmasterstat *pm_stat;
extern int seq_loader_enable; //80075790
extern char *seqfilename; //80075794
extern pmasterstat *seq_pm_stat; //80075798
extern int seq_maxsequences; //8007579C
extern char Driver_Init; //800757A0
extern char Reset_Gates; //800757A1
extern int seqopen; //800757A4
extern int(*Seq_Error_func)(int, int); //800757A8
extern int Seq_Error_module; //800757AC
extern Wess_File_IO_Struct *seqfileptr; //800757B0
extern track_header scratch_trk_hdr; //8007EDE8
extern track_header seq_track_header; //8007EE74
extern track_header base_track_header; //8007EE8C
int wess_seq_range_sizeof(int seqfirst, int numseqs)//800497C0
{
int count;
count = 0;
if (seq_loader_enable)
{
if (numseqs == 0)
return 0;
while (numseqs--)
{
count += wess_seq_sizeof(seqfirst);
seqfirst += 1;
}
}
return (count);
}
int wess_seq_range_load(int seqfirst, int numseqs, void *memptr)//8004984C
{
int count;
char *pmem;
pmem = (char *)memptr;
count = 0;
if (seq_loader_enable)
{
if (!open_sequence_data() || !numseqs)
return 0;
while (numseqs--)
{
//printf("----------------------\n");
count += wess_seq_load(seqfirst, pmem+count);
seqfirst += 1;
}
close_sequence_data();
}
return count;
}
int wess_seq_range_free(int seqfirst, int numseqs)//80049900
{
if (seq_loader_enable)
{
if (numseqs == 0)
return 0;
while (numseqs--)
{
wess_seq_free(seqfirst);
seqfirst += 1;
}
return 1;
}
return 0;
}
================================================
FILE: PSXDOOM/WESSAPI.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
/*-----------------------------------------------------------------*/
/*
The Williams Entertainment Sound System
Application Programming Interface Routines
by Scott Patterson
*/
/*----------------------------------------------------------------*/
//#include "win_port.h"
//#ifndef BLOCK_SOUND_WESS
#include "kernel.h"
#include "wessarc.h"
#include "wessapi.h"
#include "wessseq.h"
//#include "wessapix.h"
#define MINIMUM_TRACK_INDXS_FOR_A_SEQUENCE 4//10
#define _ALIGN4_ 1
static int conditional_read(int readflag,
char **ptrtomem,
int readsize);
static void filltrackstat(track_status *ptk_stat,
track_data *ptk_info,
TriggerPlayAttr *attr);
static void assigntrackstat(track_status *ptk_stat,
track_data *ptk_info);
extern int num_sd; //80075714
extern char *wmd_file_ptr; //80075718
extern char *wmd_file_ptr2; //8007571C
extern Wess_File_IO_Struct *fp_wmd_file; //80075720
extern int sysinit; //80075724
extern int module_loaded; //80075728
extern int early_exit; //8007572C
extern int max_seq_num; //80075730
extern int mem_limit; //80075734
extern patch_group_header scratch_pat_grp_hdr; //8007EDE8
extern track_header scratch_trk_hdr; //8007EE04
extern int wmd_mem_is_mine; //80075738
extern char *wmd_mem; //8007573C
extern char *wmd_end; //80075740
extern int wmd_size; //80075744
extern int (*Error_func)(int, int); //80075748
extern int Error_module; //8007574C
extern pmasterstat *pm_stat; //800A8538
#if 0 /* NO USED */
static void err(int code) {
if(Error_func) {
Error_func(Error_module, code);
}
}
#endif
static void zeroset(char *pdest, unsigned long size)//80041BE8
{
while(size--) *pdest++ = 0;
}
void wess_install_error_handler(int (*error_func)(int, int), int module)//80041C14
{
#ifndef BLOCK_SOUND_WESS
Error_func=error_func;
Error_module=module;
#endif
}
void * wess_get_master_status (void)//80041C2C
{
#ifndef BLOCK_SOUND_WESS
return pm_stat;
#endif
}
int Is_System_Active(void)//80041C3C
{
#ifndef BLOCK_SOUND_WESS
if(!sysinit)
{
return 0;
}
return 1;
#endif
}
int Is_Module_Loaded(void)//80041C4C
{
#ifndef BLOCK_SOUND_WESS
if(!module_loaded)
{
return 0;
}
return 1;
#endif
}
int Is_Seq_Num_Valid(int seq_num)//80041C5C
{
#ifndef BLOCK_SOUND_WESS
if((seq_num<0) || (seq_num>=max_seq_num))
{
return 0;
} else if((pm_stat->pmod_info->pseq_info+seq_num)->ptrk_info==NULL) {
return 0;
}
return 1;
#endif
}
void Register_Early_Exit(void)//80041CB8
{
#ifndef BLOCK_SOUND_WESS
if(!early_exit)
{
early_exit = 1;
}
#endif
}
void wess_install_handler (void)//80041CDC
{
#ifndef BLOCK_SOUND_WESS
init_WessTimer();
#endif
}
void wess_restore_handler (void)//80041CFC
{
#ifndef BLOCK_SOUND_WESS
exit_WessTimer();
#endif
}
int wess_init (void)//80041D1C
{
#ifndef BLOCK_SOUND_WESS
int initok;
initok = 0;
if(!sysinit)
{
SeqOn = 0; /* make sure the SeqEngine is disabled */
if(!WessTimerActive)
{
wess_install_handler();
}
wess_low_level_init();
sysinit = 1;
initok = 1;
}
return (initok);
#endif
}
void wess_exit (enum RestoreFlag rflag)//80041D80
{
#ifndef BLOCK_SOUND_WESS
if(!Is_System_Active())
{
return;
}
if(sysinit)
{
if(module_loaded)
{
wess_unload_module();
}
wess_low_level_exit();
sysinit = 0;
if(rflag|WessTimerActive)
{
wess_restore_handler();
}
}
#endif
}
char *wess_get_wmd_start(void)//80041E0C
{
#ifndef BLOCK_SOUND_WESS
return(wmd_mem);
#endif
}
char *wess_get_wmd_end(void)//80041E1C
{
#ifndef BLOCK_SOUND_WESS
return(wmd_end);
#endif
}
static void free_mem_if_mine(void)//80041E2C
{
#ifndef BLOCK_SOUND_WESS
if(wmd_mem_is_mine)
{
if(wmd_mem!=NULL)
{
wess_free(wmd_mem);
wmd_mem=NULL;
}
wmd_mem_is_mine = 0;
}
#endif
}
void wess_unload_module (void)//80041E7C
{
#ifndef BLOCK_SOUND_WESS
int ptif,mi;
if(module_loaded)
{
wess_seq_stopall();
SeqOn = 0;
/* shutdown the loaded drivers and SeqEngine */
CmdFuncArr[NoSound_ID][DriverExit]((track_status *)pm_stat);
ptif = pm_stat->patch_types_loaded;
for(mi=0;mippat_info + mi)->hw_tl_list.flags_load & (TAG_SOUND_EFFECTS| TAG_MUSIC| TAG_DRUMS)) != 0)
{
CmdFuncArr[(pm_stat->ppat_info+mi)->hw_tl_list.hardware_ID][DriverExit]((track_status *)pm_stat);
}
}
free_mem_if_mine();
module_loaded = 0;
}
#endif
}
static void module_memcpy(void *pdest, void *psrc, unsigned long bytestocopy)//80041F88
{
while(bytestocopy--)
{
*(char *)pdest++ = *(char *)psrc++;
}
}
int conditional_read(int readflag, char **ptrtomem, int readsize)//80041FBC
{
#ifndef BLOCK_SOUND_WESS
if (readflag)
{
//printf("conditional_read %d\n", readsize);
module_memcpy(*ptrtomem, wmd_file_ptr, readsize);
wmd_file_ptr += readsize;
*ptrtomem += readsize;
#if _ALIGN4_ == 1
//force align to word boundary because previous
//pmem adjust may wind up with odd address
*ptrtomem += (unsigned int)*ptrtomem & 1;
*ptrtomem += (unsigned int)*ptrtomem & 2;
#endif
}
else
{
wmd_file_ptr += readsize;
}
return (1);
#endif
}
int wess_load_module (void *wmd_ptr,
char *memory_pointer,
int memory_allowance,
int **settings_tag_lists)
{
#ifndef BLOCK_SOUND_WESS
int i, j, k, n, z, types, num, indx, loadit;
int tracks_toload;
int readrequest, readresult;
char max_tracks_inseq, max_voices_intrk, max_substack_intrk;
char *pdest;
char *pmem;
unsigned long patfpos, trkinfosize;
char *tempwmd;
int setting, flag, flag2;
mem_limit = memory_allowance;
tempwmd = wmd_ptr;
if (module_loaded)
{
wess_unload_module();
}
num_sd = get_num_Wess_Sound_Drivers(settings_tag_lists);
//printf("num_sd %d\n", num_sd);
if (memory_pointer == NULL)
{
wmd_mem_is_mine = 1;
wmd_mem = (char *)wess_malloc(memory_allowance);
if(wmd_mem == NULL)
{
return(module_loaded);
}
}
else {
wmd_mem_is_mine = 0;
wmd_mem = memory_pointer;
}
wmd_size = memory_allowance;
zeroset(wmd_mem, wmd_size);
max_seq_num = 0;
if (!Is_System_Active())
{
free_mem_if_mine();
return (module_loaded);
}
if (tempwmd == NULL)
{
free_mem_if_mine();
return (module_loaded);
}
/*if (!(fp_wmd_file = module_open(wmd_filename)))
{
err(wess_FOPEN);
free_mem_if_mine();
return (module_loaded);
}*/
max_tracks_inseq = MINIMUM_TRACK_INDXS_FOR_A_SEQUENCE;
//printf("max_tracks_inseq %d\n", max_tracks_inseq);
max_voices_intrk = 0;
max_substack_intrk = 0;
/* loads a related group of patches and sequences */
/* a module has the information necessary to set up sequencer work
areas and data areas */
/*
The module loading sequence works as follows :
*/
pmem = wmd_mem;
/*
- allocate space for a master_status_structure
- update the pmasterstat pointer
*/
pm_stat = (master_status_structure *)pmem;
pmem += sizeof(*pm_stat);
pm_stat->fp_module = (int)fp_wmd_file;//falta verificar
pm_stat->pabstime = (unsigned long*)&millicount;
/*
- allocate for the module_data structure
- update the pmod_info pointer
*/
pm_stat->pmod_info = (module_data *)pmem;
pmem += sizeof(*pm_stat->pmod_info);
/*
- read in sizeof(pm_stat->pmod_info->mod_hdr)
bytes from the .lmd file into the pm_stat->pmod_info->mod_hdr
structure.
*/
wmd_file_ptr2 = tempwmd;
wmd_file_ptr = wmd_file_ptr2;
readrequest = sizeof(pm_stat->pmod_info->mod_hdr);
//module_read(&pm_stat->pmod_info->mod_hdr, tempwmd, readrequest);
module_memcpy(&pm_stat->pmod_info->mod_hdr, tempwmd, readrequest);
wmd_file_ptr += readrequest;
//readresult = module_read(&pm_stat->pmod_info->mod_hdr, readrequest, fp_wmd_file);
/*if (readrequest != readresult)
{
//err(wess_FREAD);
free_mem_if_mine();
return(0);
}*/
if ((pm_stat->pmod_info->mod_hdr.module_id_text != WESS_SSSP_TEXT) ||
(pm_stat->pmod_info->mod_hdr.module_version != WESS_CORE_VERSION))
{
free_mem_if_mine();
return(0);
}
//printf("WESS_SSSP_TEXT %x\n", pm_stat->pmod_info->mod_hdr.module_id_text);
//printf("WESS_CORE_VERSION %x\n", pm_stat->pmod_info->mod_hdr.module_version);
/*
--init work structures --------------------------------------------
- allocate and initialize space for
pmod_info->mod_hdr.seq_work_areas sequence_status structures
and update the pmseqstattbl pointer and zero seqs_active.
*/
pm_stat->pseqstattbl = (sequence_status *)pmem;
pmem += sizeof(*pm_stat->pseqstattbl) *
pm_stat->pmod_info->mod_hdr.seq_work_areas;
/*
- allocate and initialize space for
pmod_info->mod_hdr.trk_work_areas track_status structures
and update the pmtrkstattbl pointer and zero trks_active.
*/
pm_stat->ptrkstattbl = (track_status *)pmem;
pmem += sizeof(*pm_stat->ptrkstattbl) *
pm_stat->pmod_info->mod_hdr.trk_work_areas;
/*
--load data structures --------------------------------------------
- update pm_stat->patch_types with the sb_num global and
allocate and copy in pm_stat->patch_types bytes
of the patch_id_list and update the pm_stat->ppat_id_list pointer.
*/
pm_stat->patch_types_loaded = num_sd;
/*
- allocate and initialize space for master_volumes of each
patch type loaded.
*/
pm_stat->pmaster_volume = (char *)pmem;
pmem += sizeof(char) * pm_stat->patch_types_loaded;
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
pdest = pm_stat->pmaster_volume;
n = pm_stat->patch_types_loaded;
while (n--)
{
*pdest++ = 0x80;
}
/*
- allocate and initialize space for
pm_stat->patch_types patch_group_data structures
and update the pm_stat->ppat_info pointer.
*/
pm_stat->ppat_info = (patch_group_data *)pmem;
pmem += sizeof(*pm_stat->ppat_info) * pm_stat->patch_types_loaded;
//printf("here\n");
if (settings_tag_lists)
{
k = pm_stat->patch_types_loaded;
//printf("k %d\n", k);
while (k--)
{
/* get the settings tags for this patch type */
/*
copy settings_tag_lists to the patch's sndhw_tags array
*/
z = 0;
while (settings_tag_lists[k][z] != SNDHW_TAG_END)
{
(pm_stat->ppat_info + k)->sndhw_tags[z] = settings_tag_lists[k][z];
(pm_stat->ppat_info + k)->sndhw_tags[z + 1] = settings_tag_lists[k][z + 1];
if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_DRIVER_ID)
{
(pm_stat->ppat_info + k)->hw_tl_list.hardware_ID = (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
}
else if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_SOUND_EFFECTS)
{
setting = (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
flag = (pm_stat->ppat_info + k)->hw_tl_list.flags_load;
flag2 = flag & ~TAG_SOUND_EFFECTS;
flag = (flag & 1 | setting) & 1;
(pm_stat->ppat_info + k)->hw_tl_list.flags_load = (flag2 | flag);
}
else if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_MUSIC)
{
setting = (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
flag = (pm_stat->ppat_info + k)->hw_tl_list.flags_load;
flag2 = flag & ~TAG_MUSIC;
flag = ((flag >> 1 & 1 | setting) & 1) << 1;
(pm_stat->ppat_info + k)->hw_tl_list.flags_load = (flag2 | flag);
}
else if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_DRUMS)
{
setting = (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
flag = (pm_stat->ppat_info + k)->hw_tl_list.flags_load;
flag2 = flag & ~TAG_DRUMS;
flag = ((flag >> 2 & 1 | setting) & 1) << 2;
(pm_stat->ppat_info + k)->hw_tl_list.flags_load = (flag2 | flag);
}
/*if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_DRIVER_ID)
(pm_stat->ppat_info + k)->hw_tl_list.hardware_ID = (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
else if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_SOUND_EFFECTS)
(pm_stat->ppat_info + k)->hw_tl_list.sfxload |= (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
else if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_MUSIC)
(pm_stat->ppat_info + k)->hw_tl_list.musload |= (pm_stat->ppat_info + k)->sndhw_tags[z + 1];
else if ((pm_stat->ppat_info + k)->sndhw_tags[z] == SNDHW_TAG_DRUMS)
(pm_stat->ppat_info + k)->hw_tl_list.drmload |= (pm_stat->ppat_info + k)->sndhw_tags[z + 1];*/
z += 2;
}
}
}
//printf("z %d\n", z);
/*
- for pm_stat->patch_types scan through the
pm_stat->pmod_info->pmod_hdr.patch_types_infile
and load each patch_area with a matching patch_id
*/
pm_stat->voices_total = 0;
j = pm_stat->pmod_info->mod_hdr.patch_types_infile;
while (j--)
{
readrequest = sizeof(scratch_pat_grp_hdr);
//printf("readrequest %d\n", readrequest);
//module_read(&scratch_pat_grp_hdr, wmd_file_ptr, readrequest);
module_memcpy(&scratch_pat_grp_hdr, wmd_file_ptr, readrequest);
wmd_file_ptr += readrequest;
//printf("load_flags %d\n", (unsigned int)scratch_pat_grp_hdr.load_flags);
/*readresult = module_read(&scratch_pat_grp_hdr, readrequest, fp_wmd_file);
if (readrequest != readresult)
{
err(wess_FREAD);
free_mem_if_mine();
return(0);
}*/
k = pm_stat->patch_types_loaded;
while (k--)
{
if (scratch_pat_grp_hdr.patch_id == (pm_stat->ppat_info + k)->hw_tl_list.hardware_ID)
{
memcpy(&(pm_stat->ppat_info + k)->pat_grp_hdr,
&scratch_pat_grp_hdr,
sizeof(scratch_pat_grp_hdr));
/*(pm_stat->ppat_info + k)->pat_grp_hdr.load_flags = scratch_pat_grp_hdr.load_flags;
(pm_stat->ppat_info + k)->pat_grp_hdr.patch_id = scratch_pat_grp_hdr.patch_id;
//(pm_stat->ppat_info + k)->pat_grp_hdr.hw_voice_limit = scratch_pat_grp_hdr.hw_voice_limit;//
//(pm_stat->ppat_info + k)->pat_grp_hdr.pad1 = scratch_pat_grp_hdr.pad1;//
(pm_stat->ppat_info + k)->pat_grp_hdr.patches = scratch_pat_grp_hdr.patches;
//(pm_stat->ppat_info + k)->pat_grp_hdr.patch_size = scratch_pat_grp_hdr.patch_size;//
(pm_stat->ppat_info + k)->pat_grp_hdr.patchmaps = scratch_pat_grp_hdr.patchmaps;
//(pm_stat->ppat_info + k)->pat_grp_hdr.patchmap_size = scratch_pat_grp_hdr.patchmap_size;//
(pm_stat->ppat_info + k)->pat_grp_hdr.patchinfo = scratch_pat_grp_hdr.patchinfo;
//(pm_stat->ppat_info + k)->pat_grp_hdr.patchinfo_size = scratch_pat_grp_hdr.patchinfo_size;//
(pm_stat->ppat_info + k)->pat_grp_hdr.drummaps = scratch_pat_grp_hdr.drummaps;
//(pm_stat->ppat_info + k)->pat_grp_hdr.drummap_size = scratch_pat_grp_hdr.drummap_size;//
(pm_stat->ppat_info + k)->pat_grp_hdr.extra_data_size = scratch_pat_grp_hdr.extra_data_size;*/
pm_stat->voices_total += scratch_pat_grp_hdr.hw_voice_limit;
(pm_stat->ppat_info + k)->ppat_data = pmem;
//patfpos = module_tell(fp_wmd_file);
//?? Checkear
patfpos = (unsigned long)((unsigned long)wmd_file_ptr - (unsigned long)wmd_file_ptr2);
//printf("patfpos %d\n", patfpos);
(pm_stat->ppat_info + k)->data_fileposition = patfpos;
if (!conditional_read(scratch_pat_grp_hdr.load_flags & LOAD_PATCHES,
&pmem,
(int)scratch_pat_grp_hdr.patches *
(int)scratch_pat_grp_hdr.patch_size))
{
return(0);
}
if (!conditional_read(scratch_pat_grp_hdr.load_flags & LOAD_PATCHMAPS,
&pmem,
(int)scratch_pat_grp_hdr.patchmaps *
(int)scratch_pat_grp_hdr.patchmap_size))
{
return(0);
}
if (!conditional_read(scratch_pat_grp_hdr.load_flags & LOAD_PATCHINFO,
&pmem,
(int)scratch_pat_grp_hdr.patchinfo *
(int)scratch_pat_grp_hdr.patchinfo_size))
{
return(0);
}
if (!conditional_read(scratch_pat_grp_hdr.load_flags & LOAD_DRUMMAPS,
&pmem,
(int)scratch_pat_grp_hdr.drummaps *
(int)scratch_pat_grp_hdr.drummap_size))
{
return(0);
}
if (!conditional_read(scratch_pat_grp_hdr.load_flags & LOAD_EXTRADATA,
&pmem,
(int)scratch_pat_grp_hdr.extra_data_size))
{
return(0);
}
break;
}
}
}
/*
- allocate and initialize space for
voice_total voice_status structures
and update the pmvoicestattbl pointer and zero voices_active.
*/
pm_stat->pvoicestattbl = (voice_status *)pmem;
pmem += sizeof(*pm_stat->pvoicestattbl) * pm_stat->voices_total;
/*
- initialize patch_type parameter for each voice work area.
only the amount of hardware voices possible for each
patch_type loaded will have voice work areas!!!
you will run out of voice work areas for a given patch type
at the same time you have run out of hardware polyphony!!!
eh,eh,this is cool!,eh,eh
*/
if (pm_stat->patch_types_loaded)
{
types = pm_stat->patch_types_loaded;
n = 0;
num = (pm_stat->ppat_info + n)->pat_grp_hdr.hw_voice_limit;
indx = 0;
for (i = 0; ivoices_total; i++)
{
if (types)
{
if (num--)
{
(pm_stat->pvoicestattbl + i)->patchtype =
(pm_stat->ppat_info + n)->pat_grp_hdr.patch_id;
(pm_stat->pvoicestattbl + i)->refindx = indx++;//ó 0
}
else {
n++;
if (--types)
{
num = (pm_stat->ppat_info + n)->pat_grp_hdr.hw_voice_limit;
indx = 0;
if (num--)
{
(pm_stat->pvoicestattbl + i)->patchtype =
(pm_stat->ppat_info + n)->pat_grp_hdr.patch_id;
(pm_stat->pvoicestattbl + i)->refindx = indx++;
}
}
}
}
}
}
/*
- allocate and initialize space for
pmod_info->mod_hdr.sequences sequence_data structures
and update the pmod_info->pseq_info pointer.
*/
pm_stat->pmod_info->pseq_info = (sequence_data *)pmem;
pmem += sizeof(*pm_stat->pmod_info->pseq_info) *
pm_stat->pmod_info->mod_hdr.sequences;
/*
- for mod_hdr.sequences fill the sequence_data structures :
read in pseq_info->seq_hdr,
save fp_wmd_file pointer and
scan throuch pseq_info->seq_hdr.tracks of track_headers
seeking over the data to get to each header and
increment track_toload for each voice_type matching any
members of the pm_stat->ppat_id_list
update pseq_info->ptrk_info pointer and
allocate the resultant track_toload track_data structures
seek to the saved fp_wmd_file pointer and read in each
track_hdr with a voice_type matching the pm_stat->ppat_id_list
and allocate and read in the corresponding data section :
point pseq_info->ptrk_info->ptrk_data at this area,
read in pseq_info->ptrk_info->data_size to this pointer.
seek over non matching tracks.
assign pseq_info->tracks = tracks_toload,
for pseq_info->tracks fill the track_data structures that are
of correct voices_type :
read in sizeof(pseq_info->ptrk_info->trk_hdr),
if it is in the tracks_toload the
allocate pseq_info->ptrk_info->trk_hdr.voices_max chars,
point pseq_info->ptrk_info->pvoices_indx at this area,
allocate pseq_info->ptrk_info->trk_hdr.substack_size pointers,
point pseq_info->ptrk_info->psubstack at this area,
allocate pseq_info->ptrk_info->trk_hdr.labellist_size pointers,
point pseq_info->ptrk_info->plabellist at this area,
allocate pseq_info->ptrk_info->trk_hdr.data_size chars,
update pm_stat->pmod_info->pseq_info->seq_hdr.tracks for
each sequence with the number of tracks actually loaded.
*/
for (i = 0; ipmod_info->mod_hdr.sequences; i++)
{
patfpos = (unsigned long)((unsigned long)wmd_file_ptr - (unsigned long)wmd_file_ptr2);
//printf("--------\n");
//printf("num %d\n",i);
//printf("patfpos %d\n", patfpos);
readrequest = sizeof(pm_stat->pmod_info->pseq_info->seq_hdr);
//printf("readrequest %d\n", readrequest);
//module_read(&(pm_stat->pmod_info->pseq_info + i)->seq_hdr, wmd_file_ptr, readrequest);
module_memcpy(&(pm_stat->pmod_info->pseq_info + i)->seq_hdr, wmd_file_ptr, readrequest);
wmd_file_ptr += readrequest;
/*patfpos = module_tell(fp_wmd_file);
readrequest = sizeof(pm_stat->pmod_info->pseq_info->seq_hdr);
readresult = module_read(&(pm_stat->pmod_info->pseq_info + i)->seq_hdr, readrequest, fp_wmd_file);
if (readrequest != readresult)
{
err(wess_FREAD);
free_mem_if_mine();
return(0);
}*/
tracks_toload = 0;
trkinfosize = 0;
j = (pm_stat->pmod_info->pseq_info + i)->seq_hdr.tracks;
//printf("tracks %d\n", j);
while (j--)
{
readrequest = sizeof(scratch_trk_hdr);
//printf("readrequest %d\n", readrequest);
//module_read(&scratch_trk_hdr, wmd_file_ptr, readrequest);
module_memcpy(&scratch_trk_hdr, wmd_file_ptr, readrequest);
/*printf("voices_type %d\n",scratch_trk_hdr.voices_type);
printf("voices_max %d\n",scratch_trk_hdr.voices_max);
printf("priority %d\n",scratch_trk_hdr.priority);
printf("lockchannel %d\n",scratch_trk_hdr.lockchannel);
printf("voices_class %d\n",scratch_trk_hdr.voices_class);
printf("reverb %d\n",scratch_trk_hdr.reverb);
printf("initpatchnum %d\n",scratch_trk_hdr.initpatchnum);
printf("initpitch_cntrl %d\n",scratch_trk_hdr.initpitch_cntrl);
printf("initvolume_cntrl %d\n",scratch_trk_hdr.initvolume_cntrl);
printf("initpan_cntrl %d\n",scratch_trk_hdr.initpan_cntrl);
printf("substack_count %d\n",scratch_trk_hdr.substack_count);
printf("mutebits %d\n",scratch_trk_hdr.mutebits);
printf("initppq %d\n",scratch_trk_hdr.initppq);
printf("initqpm %d\n",scratch_trk_hdr.initqpm);
printf("labellist_count %d\n",scratch_trk_hdr.labellist_count);
printf("data_size %d\n",scratch_trk_hdr.data_size);*/
wmd_file_ptr += readrequest;
/*readresult = module_read(&scratch_trk_hdr, readrequest, fp_wmd_file);
if (readrequest != readresult)
{
err(wess_FREAD);
free_mem_if_mine();
return(0);
}*/
loadit = 0;
if ((scratch_trk_hdr.voices_type == NoSound_ID) ||
(scratch_trk_hdr.voices_type == GENERIC_ID))
{
loadit = 1;
}
else {
k = pm_stat->patch_types_loaded;
while (k--)
{
/*if (((scratch_trk_hdr.voices_type == (pm_stat->ppat_info + k)->hw_tl_list.hardware_ID) &&
(((scratch_trk_hdr.voices_class == SNDFX_CLASS) && (pm_stat->ppat_info + k)->hw_tl_list.sfxload) ||
((scratch_trk_hdr.voices_class == SFXDRUMS_CLASS) && (pm_stat->ppat_info + k)->hw_tl_list.sfxload) ||
((scratch_trk_hdr.voices_class == MUSIC_CLASS) && (pm_stat->ppat_info + k)->hw_tl_list.musload) ||
((scratch_trk_hdr.voices_class == DRUMS_CLASS) && (pm_stat->ppat_info + k)->hw_tl_list.drmload))))*/
if (((scratch_trk_hdr.voices_type == (pm_stat->ppat_info + k)->hw_tl_list.hardware_ID) &&
(((scratch_trk_hdr.voices_class == SNDFX_CLASS) && ((pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_SOUND_EFFECTS)) ||
((scratch_trk_hdr.voices_class == SFXDRUMS_CLASS) && ((pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_SOUND_EFFECTS)) ||
((scratch_trk_hdr.voices_class == MUSIC_CLASS) && ((pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_MUSIC)) ||
((scratch_trk_hdr.voices_class == DRUMS_CLASS) && ((pm_stat->ppat_info + k)->hw_tl_list.flags_load & TAG_DRUMS)))))
{
loadit = 1;
break;
}
}
}
//printf("loadit %d\n", loadit);
if (loadit)
{
trkinfosize += sizeof(*pm_stat->pmod_info->pseq_info->ptrk_info) +
(scratch_trk_hdr.labellist_count * sizeof(long)) +
scratch_trk_hdr.data_size;
//printf("trkinfosize %d\n", trkinfosize);
#if _ALIGN4_ == 1
//force align to word boundary because previous size adjust
//may wind up with odd address
trkinfosize += trkinfosize & 1;
trkinfosize += trkinfosize & 2;
#endif
if (scratch_trk_hdr.voices_max > max_voices_intrk)
{
max_voices_intrk = scratch_trk_hdr.voices_max;
}
if (scratch_trk_hdr.substack_count > max_substack_intrk)
{
max_substack_intrk = scratch_trk_hdr.substack_count;
}
tracks_toload++;
}
wmd_file_ptr += (scratch_trk_hdr.labellist_count * sizeof(long)) +
scratch_trk_hdr.data_size;
/*if (module_seek(fp_wmd_file,
(scratch_trk_hdr.labellist_count * sizeof(long)) +
scratch_trk_hdr.data_size,
SEEK_CUR))
{
err(wess_FSEEK);
free_mem_if_mine();
return(0);
}*/
}
if (tracks_toload>max_tracks_inseq)
{
max_tracks_inseq = tracks_toload;
}
if (tracks_toload == 0)
{
/* since there are no tracks to load we create area for the
track info + 2 (0 delta and TrkEnd) */
trkinfosize = sizeof(*pm_stat->pmod_info->pseq_info->ptrk_info) + 2;
#if _ALIGN4_ == 1
//force align to word boundary because previous size adjust
//may wind up with odd address
trkinfosize += trkinfosize & 1;
trkinfosize += trkinfosize & 2;
#endif
}
(pm_stat->pmod_info->pseq_info + i)->trkstoload = tracks_toload;
(pm_stat->pmod_info->pseq_info + i)->trkinfolength = trkinfosize;
(pm_stat->pmod_info->pseq_info + i)->fileposition = patfpos;
}
/* now we dont load the track data anymore */
/* now we dont load the track data anymore */
/* now we dont load the track data anymore */
/*
- allocate pm_stat->max_tracks_inseq chars for the ptrk_indxs
pointers in each sequence_status structure.
update each pointer to each area.
initialize indexes to 0xFF.
*/
pm_stat->pcalltable = (callback_status *)pmem;
pmem += sizeof(*pm_stat->pcalltable) *
pm_stat->pmod_info->mod_hdr.callback_areas;
pm_stat->max_trks_perseq = max_tracks_inseq;
for (i = 0; ipmod_info->mod_hdr.seq_work_areas; i++)
{
(pm_stat->pseqstattbl + i)->pgates = (char *)pmem;
pmem += sizeof(char) *
pm_stat->pmod_info->mod_hdr.gates_per_seq;
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
(pm_stat->pseqstattbl + i)->piters = (char *)pmem;
pmem += sizeof(char) *
pm_stat->pmod_info->mod_hdr.iters_per_seq;
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
j = max_tracks_inseq;//
pdest = (pm_stat->pseqstattbl + i)->ptrk_indxs = (char *)pmem;
pmem += sizeof(char) * j;
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
while (j--)
{
*pdest++ = 0xFF;
}
}
/*
- allocate pm_stat->max_voices_intrk chars for the pvoice_indxs
pointers in each track_status structure.
update each pointer to each area.
initialize indexes to 0xFF.
*/
pm_stat->max_voices_pertrk = max_voices_intrk;
pm_stat->max_substack_pertrk = max_substack_intrk;
for (i = 0; ipmod_info->mod_hdr.trk_work_areas; i++)
{
(pm_stat->ptrkstattbl + i)->refindx = i;
(pm_stat->ptrkstattbl + i)->psubstack = (unsigned char**)pmem;
/* (pm_stat->ptrkstattbl+i)->psp is set when sequence is triggered */
pmem += sizeof(long) * pm_stat->max_substack_pertrk;
(pm_stat->ptrkstattbl + i)->pstackend = (unsigned char**)pmem;
}
/* load the drivers here */
/* load the drivers here */
/* load the drivers for each patch type and update the CmdFuncArr */
/* load the drivers here */
/* load the drivers here */
/* initialize the loaded drivers and SeqEngine */
CmdFuncArr[NoSound_ID][DriverInit]((track_status *)pm_stat);
for (i = 0; ipatch_types_loaded; i++)
{
/*if ((pm_stat->ppat_info + i)->hw_tl_list.sfxload ||
(pm_stat->ppat_info + i)->hw_tl_list.musload ||
(pm_stat->ppat_info + i)->hw_tl_list.drmload)*/
if (((pm_stat->ppat_info + i)->hw_tl_list.flags_load & (TAG_SOUND_EFFECTS| TAG_MUSIC| TAG_DRUMS)) != 0)
{
CmdFuncArr[(pm_stat->ppat_info + i)->hw_tl_list.hardware_ID][DriverInit]((track_status *)pm_stat);
}
}
//module_close(fp_wmd_file);
max_seq_num = pm_stat->pmod_info->mod_hdr.sequences;
#if _ALIGN4_ == 1
//force align to word boundary because previous pmem adjust
//may wind up with odd address
pmem += (unsigned int)pmem & 1;
pmem += (unsigned int)pmem & 2;
#endif
wmd_end = pmem;
module_loaded = 1;
SeqOn = 1;
return (1);
#endif
}
void filltrackstat(track_status *ptk_stat, track_data *ptk_info, TriggerPlayAttr *attr)//80042E34
{
#ifndef BLOCK_SOUND_WESS
int tempmask;
//printf("---------------------------------------\n");
ptk_stat->flags = (ptk_stat->flags | TRK_ACTIVE) & ~(TRK_TIMED | TRK_LOOPED | TRK_SKIP | TRK_OFF);
ptk_stat->patchtype = ptk_info->trk_hdr.voices_type;
ptk_stat->priority = ptk_info->trk_hdr.priority;
ptk_stat->voices_active = 0;
ptk_stat->sndclass = ptk_info->trk_hdr.voices_class;
ptk_stat->voices_max = ptk_info->trk_hdr.voices_max;
ptk_stat->starppi = 0;
ptk_stat->accppi = 0;
ptk_stat->totppi = 0;
ptk_stat->psp = ptk_stat->psubstack;
ptk_stat->ppq = ptk_info->trk_hdr.initppq;
ptk_stat->labellist_count = ptk_info->trk_hdr.labellist_count;
ptk_stat->data_size = ptk_info->trk_hdr.data_size;
ptk_stat->mutemask = ptk_info->trk_hdr.mutebits;
if ((attr == NULL) || (!attr->mask))
{
tempmask = 0;
}
else {
tempmask = attr->mask;
}
if(tempmask & TRIGGER_VOLUME) //0x01
{
ptk_stat->volume_cntrl = attr->volume;
//printf("T_volume_cntrl %d\n", ptk_stat->volume_cntrl);
} else {
ptk_stat->volume_cntrl = ptk_info->trk_hdr.initvolume_cntrl;
//printf("volume_cntrl %d\n", ptk_stat->volume_cntrl);
}
if (tempmask & TRIGGER_PAN) //0x02
{
ptk_stat->pan_cntrl = attr->pan;
//printf("T_pan_cntrl %d\n", ptk_stat->pan_cntrl);
}
else {
ptk_stat->pan_cntrl = ptk_info->trk_hdr.initpan_cntrl;
//printf("pan_cntrl %d\n", ptk_stat->pan_cntrl);
}
if (tempmask & TRIGGER_PATCH) //0x04
{
ptk_stat->patchnum = attr->patch;
//printf("T_patchnum %d\n", ptk_stat->patchnum);
}
else {
ptk_stat->patchnum = ptk_info->trk_hdr.initpatchnum;
//printf("patchnum %d\n", ptk_stat->patchnum);
}
if (tempmask & TRIGGER_PITCH) //0x08
{
ptk_stat->pitch_cntrl = attr->pitch;
//printf("T_pitch_cntrl %d\n", ptk_stat->pitch_cntrl);
}
else {
ptk_stat->pitch_cntrl = ptk_info->trk_hdr.initpitch_cntrl;
//printf("pitch_cntrl %d\n", ptk_stat->pitch_cntrl);
}
if (tempmask & TRIGGER_MUTEMODE) //0x10
{
if (ptk_stat->mutemask & (1 << attr->mutemode))
{
//ptk_stat->mute = 1;
ptk_stat->flags |= TRK_MUTE;
//printf("T_mute %d\n", ptk_stat->flags);
}
else {
//ptk_stat->mute = 0;
ptk_stat->flags &= ~TRK_MUTE;
//printf("T_mute %d\n", ptk_stat->flags);
}
}
else {
//ptk_stat->mute = 0;
ptk_stat->flags &= ~TRK_MUTE;
//printf("mute %d\n", ptk_stat->flags);
}
if (tempmask & TRIGGER_TEMPO) //0x20
{
ptk_stat->qpm = attr->tempo;
//printf("T_qpm %d\n", ptk_stat->qpm);
}
else {
ptk_stat->qpm = ptk_info->trk_hdr.initqpm;
//printf("qpm %d\n", ptk_stat->qpm);
}
ptk_stat->ppi = CalcPartsPerInt(GetIntsPerSec(),
ptk_stat->ppq,
ptk_stat->qpm);
//printf("ppi %d\n", ptk_stat->ppi);
if (tempmask & TRIGGER_TIMED) //0x40
{
ptk_stat->endppi = ptk_stat->totppi + attr->timeppq;
//ptk_stat->timed = 1;
ptk_stat->flags |= TRK_TIMED;
//printf("T_endppi %d\n", ptk_stat->endppi);
//printf("timed %d\n", ptk_stat->flags);
}
else {
//ptk_stat->timed = 0;
ptk_stat->flags &= ~TRK_TIMED;
//printf("timed %d\n", ptk_stat->flags);
}
if (tempmask&TRIGGER_LOOPED) //0x80
{
//ptk_stat->looped = 1;
ptk_stat->flags |= TRK_LOOPED;
//printf("T_looped %d\n", ptk_stat->flags);
}
else {
//ptk_stat->looped = 0;
ptk_stat->flags &= ~TRK_LOOPED;
//printf("looped %d\n", ptk_stat->flags);
}
if (tempmask & TRIGGER_REVERB) //0x100
{
ptk_stat->reverb = attr->reverb;
//printf("T_reverb %d\n", ptk_stat->reverb);
}
else {
ptk_stat->reverb = ptk_info->trk_hdr.reverb;
//printf("reverb %d\n", ptk_stat->reverb);
}
#endif
}
void assigntrackstat(track_status *ptk_stat, track_data *ptk_info)//800430C0
{
#ifndef BLOCK_SOUND_WESS
ptk_stat->data_space = ptk_info->trk_hdr.data_size;
ptk_stat->labellist_max = ptk_info->trk_hdr.labellist_count;
ptk_stat->pstart = ptk_info->ptrk_data;
ptk_stat->ppos = Read_Vlq(ptk_stat->pstart,&ptk_stat->deltatime);
ptk_stat->plabellist = ptk_info->plabellist;
//printf("data_space %d\n", ptk_stat->data_space);
//printf("labellist_max %d\n", ptk_stat->labellist_max);
//printf("ppos %d\n", *ptk_stat->ppos);
//printf("plabellist %d\n", *ptk_stat->plabellist);
#endif
}
/*------------------------------------------------------------------*/
/*
Sequencer calls.
*/
/*------------------------------------------------------------------*/
int wess_seq_structrig (sequence_data *psq_info,
int seq_num,
int seq_type,
enum HandleFlag gethandle,
TriggerPlayAttr *attr)//80043124
{
#ifndef BLOCK_SOUND_WESS
char i, j, limit;
short n;
char tracksfilled;
char *pdest;
sequence_status *psq_stat;
track_data *ptk_info;
track_status *ptk_stat;
if (!Is_Seq_Num_Valid(seq_num))
{
return (0);
}
/* runs trigger function and update status structures for api */
/*
- save the sequencer information block pointer,
if a sequence status structure is free:
mark sequence as active,
flag to start what tracks can be started,
for each track started update psq_info->ptrk_indxs
*/
// _disable();
SeqOn = 0;
/* find an open sequence structure */
limit = pm_stat->pmod_info->mod_hdr.seq_work_areas;
for (i = 0; ipseqstattbl + i)->flags & SEQ_ACTIVE))
{
break;
}
}
if (i == limit)
{
SeqOn = 1;
return (0); /* no sequence work area available */
}
else
{
tracksfilled = 0; /* used to check if any tracks are started */
/*
we found a sequence structure so fill it.
*/
psq_stat = pm_stat->pseqstattbl + i; /* pointer math */
/*
for n tracks in the sequence find and open track structure
and initialize it.
*/
n = psq_info->seq_hdr.tracks;
limit = pm_stat->pmod_info->mod_hdr.trk_work_areas;
pdest = psq_stat->ptrk_indxs;
for (j = 0; jptrkstattbl + j)->flags & TRK_ACTIVE))
{
ptk_stat = pm_stat->ptrkstattbl + j; /* pointer math */
ptk_info = psq_info->ptrk_info + tracksfilled;
/* refindx was filled at init time */
ptk_stat->seq_owner = i;
filltrackstat(ptk_stat, ptk_info, attr);
assigntrackstat(ptk_stat, ptk_info);
if (gethandle)
{
ptk_stat->flags |= (TRK_HANDLED | TRK_STOPPED);
}
else {
ptk_stat->flags &= ~(TRK_HANDLED | TRK_STOPPED);
psq_stat->tracks_playing++;
}
//ptk_stat->flags |= TRK_ACTIVE;
psq_stat->tracks_active++;
pm_stat->trks_active++;
*pdest++ = j; /* update ptrk_indxs for the sequence */
tracksfilled++;
if (!--n) break;
}
}
/* if tracks were started, activate the sequence */
if (tracksfilled)
{
psq_stat->seq_num = seq_num;
psq_stat->seq_type = seq_type;
if (gethandle)
{
psq_stat->flags = SEQ_HANDLE;
psq_stat->playmode = SEQ_STATE_STOPPED;
}
else {
psq_stat->flags &= ~SEQ_HANDLE;
psq_stat->playmode = SEQ_STATE_PLAYING;
}
psq_stat->volume = 128;
psq_stat->pan = 64;
psq_stat->flags |= SEQ_ACTIVE;
pm_stat->seqs_active++;
}
SeqOn = 1;
if (tracksfilled)
{
return (i + 1);
}
else {
return (0);
}
}
#endif
}
void wess_seq_trigger (int seq_num)//8004341C
{
#ifndef BLOCK_SOUND_WESS
wess_seq_trigger_type (seq_num, 0);
#endif
}
void wess_seq_trigger_special (int seq_num,
TriggerPlayAttr *attr)//8004343C
{
#ifndef BLOCK_SOUND_WESS
wess_seq_trigger_type_special (seq_num, 0, attr);
#endif
}
int wess_seq_status (int sequence_number)//8004348C
{
#ifndef BLOCK_SOUND_WESS
/* immediate stop of sequence */
char nt;
sequence_status *psq_stat;
int status;
if (!Is_Seq_Num_Valid(sequence_number))
{
return(SEQUENCE_INVALID);
}
status = SEQUENCE_INACTIVE;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
psq_stat = pm_stat->pseqstattbl;
while (nt--)
{
//if (psq_stat->active)
if (psq_stat->flags & SEQ_ACTIVE)
{
if (psq_stat->seq_num == sequence_number)
{
if (psq_stat->playmode == SEQ_STATE_STOPPED)
{
status = SEQUENCE_STOPPED;
}
else if (psq_stat->playmode == SEQ_STATE_PLAYING) {
status = SEQUENCE_PLAYING;
}
break; /* stop looking if we found one */
}
}
psq_stat++;
}
return(status);
#endif
}
void wess_seq_stop (int sequence_number)//80043560
{
#ifndef BLOCK_SOUND_WESS
/* immediate stop of sequence */
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj;
if (!Is_Seq_Num_Valid(sequence_number))
{
return;
}
SeqOn = 0;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
//if (psq_stat->active)
if (psq_stat->flags & SEQ_ACTIVE)
{
if (psq_stat->seq_num == sequence_number)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
CmdFuncArr[ptmp->patchtype][TrkOff](ptmp);
if (!--li) break;
}
lpdest++;
}
}
if (!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
void wess_seq_stopall (void)//800436EC
{
#ifndef BLOCK_SOUND_WESS
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj;
if (!Is_Module_Loaded())
{
return;
}
/* immediate stop of all sequences */
SeqOn = 0;
/* search for all sequences and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
CmdFuncArr[ptmp->patchtype][TrkOff](ptmp);
if (!--li) break;
}
lpdest++;
}
if (!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
================================================
FILE: PSXDOOM/WESSAPI.H
================================================
/*------------------------------------------------------------------*/
/*
The Williams Entertainment Sound System
Application Programming Interface Routines
by Scott Patterson
*/
/*------------------------------------------------------------------*/
#ifndef _WESSAPI_H
#define _WESSAPI_H
#include "wessarc.h"
/*------------------------------------------------------------------*/
/*
Enumerated types.
*/
/*------------------------------------------------------------------*/
enum Wess_Error {
wess_NO_ERROR,
wess_FOPEN,
wess_FREAD,
wess_FSEEK
};
/* used by wess_exit */
enum RestoreFlag {NoRestore,YesRestore};
/* used by wess pause functions */
enum MuteFlag {NoMute,YesMute};
typedef struct NoteData {
short seq_num; //*4
short track; //*6
char keynum; //*8
char velnum; //*9
short pad1; //*10
patchmaps_header *patchmap; //*12
patchinfo_header *patchinfo; //*16
}NoteData;
typedef struct NoteState {
int numnotes;
NoteData nd[24];
}NoteState;
/* used by wess_sequence_status function */
enum SequenceStatus {SEQUENCE_INVALID,SEQUENCE_INACTIVE,SEQUENCE_STOPPED,SEQUENCE_PLAYING};
/* used by wess trigger functions */
enum LoopedFlag {NoLooped,YesLooped};
/* used by wess trigger functions */
enum HandleFlag {NoHandle,YesHandle};
extern pmasterstat *pm_stat;
/*------------------------------------------------------------------*/
/*
Externs.
*/
/*------------------------------------------------------------------*/
/*
extern: millicount
- a millisecond counter used by the sound system and available
to programmers for timing measurements
*/
extern volatile unsigned long millicount;
extern volatile int T1counter;
extern volatile int SeqOn;
/*------------------------------------------------------------------*/
/*
System Setup and Shutdown Functions.
*/
/*------------------------------------------------------------------*/
/*
routine: wess_install_error_handler()
- for installing an error callback to notify file access errors
- module is your own ID returned as err_module parameter
- err_enum is the returned Wess_Error enum parameter
*/
extern void wess_install_error_handler (int (*error_func)(int err_module, int err_enum),
int module);
/*
routine: wess_install_handler()
- the sound system timing handler can be installed independent
of the sound system for convenience.
- this can be useful for having the millicount running before
sound system initialization by wess_init()
- does not install if already installed.
*/
extern void wess_install_handler (void);
/*
routine: wess_restore_handler()
- restores timing handler to original system control
- only useful when wess_exit(NoRestore) has been called
- does not restore if already restored.
*/
extern void wess_restore_handler (void);
/*
routine: wess_init()
- initialize the Williams Entertainment Sound System.
- wess_install_handler() will be called if it hasn't been
called previously.
*/
extern int wess_init (void);
/*
routine: wess_exit()
- shuts down the Williams Entertainment Sound System.
- if a module is loaded, calls wess_unload_module().
- if wess_exit(YesRestore) is called, wess_restore_handler()
will be called after the sequencer engine is shutdown
- to have millicount running after sound system shutdown then
call wess_exit(NoRestore)
*/
extern void wess_exit (enum RestoreFlag rflag);
/*
routine: wess_load_module()
- loads master table of sounds and sequences
- returns 0 for failure, 1 for success
- NULL for memory_pointer results in internal memory allocation
of memory_allowance bytes
- if memory_pointer!=NULL then it is assumed to be a pointer
to memory_allocation bytes of memory for use by the sound system
- enables sequencer engine
*/
extern int wess_load_module (void *wmd_ptr,
char *memory_pointer,
int memory_allowance,
int **settings_tag_lists);
/*
routine: wess_unload_module()
- disables sequencer engine
- frees any allocated memory
*/
extern void wess_unload_module (void);
/*
routine: wess_get_wmd_start()
- after call to wess_load_module is successful, this
gets the pointer to beginning of module block
*/
extern char *wess_get_wmd_start (void);
/*
routine: wess_get_wmd_end()
- after call to wess_load_module is successful, this
gets the pointer past end of module block
*/
extern char *wess_get_wmd_end (void);
/*------------------------------------------------------------------*/
/*
Sequencer calls.
*/
/*------------------------------------------------------------------*/
/*
routine: wess_seq_trigger()
- a sequence is everything from a single sound to a music sequence.
- multiple sequences can be called simultaneously
- dynamic sequence, track, and voice allocation is managed
by the sequencer
- tracks have priorty assignments and voices triggered by a
track inheirit its priority
- you can trigger multiple instances of a sequence with multiple
trigger calls
*/
#define TRIGGER_VOLUME (0x1L<< 0)
#define TRIGGER_PAN (0x1L<< 1)
#define TRIGGER_PATCH (0x1L<< 2)
#define TRIGGER_PITCH (0x1L<< 3)
#define TRIGGER_MUTEMODE (0x1L<< 4)
#define TRIGGER_TEMPO (0x1L<< 5)
#define TRIGGER_TIMED (0x1L<< 6)
#define TRIGGER_LOOPED (0x1L<< 7)
#define TRIGGER_REVERB (0x1L<< 8)
typedef struct {
unsigned long mask;
unsigned char volume; /* 0-127 */
unsigned char pan; /* 0-127, 64 center */
short patch; /* 0-32767 */
short pitch; /* -8192 to 8191 */
unsigned char mutemode; /* 0-7 */
unsigned char reverb;
unsigned short tempo;
unsigned long timeppq;
} TriggerPlayAttr;
/* the basic sequence trigger call */
extern void wess_seq_trigger (int seq_num);
/* override masked sequence parameters */
extern void wess_seq_trigger_special (int seq_num,
TriggerPlayAttr *attr);
/* set your own type number to the sequence */
extern void wess_seq_trigger_type (int seq_num,
unsigned long seq_type);
/* set your own type number to the sequence and
override masked sequence parameters */
extern void wess_seq_trigger_type_special (int seq_num,
unsigned long seq_type,
TriggerPlayAttr *attr);
extern void wess_seq_update_type_special (unsigned long seq_type,
TriggerPlayAttr *attr);
/*
routine: wess_seq_status()
- find out if any instances of sequences_number are running
- returns 0 SEQUENCE_INVALID for no such sequence
1 SEQUENCE_INACTIVE for is not being processed
2 SEQUENCE_STOPPED for sequence is stopped
3 SEQUENCE_PLAYING for sequence is playing
*/
extern int wess_seq_status (int sequence_number);
/*
routine: wess_seq_stop()
- stops all instances of a specified sequence
*/
extern void wess_seq_stop (int sequence_number);
/*
routine: wess_seq_stoploop()
- turns off track loops of all instances of a specified sequence
which were started with wess_seq_trigger_looped
*/
extern void wess_seq_stoploop (int sequence_number);//no used
/*
routine: wess_seq_stoptype()
- immediate stop of all sequences that were registered as a certain
type by wess_seq_trigger_type
*/
extern void wess_seq_stoptype (unsigned long sequence_type);
/*
routine: wess_seq_stopall()
- immediate stop of all sequences
*/
extern void wess_seq_stopall (void);
/*
routine: wess_seq_pause()
- immediately pause a sequence
- if MuteFlag is YesMute, all playing voices are muted
- if MuteFlag is NoMute, all playing voices do note decay
*/
extern void wess_seq_pause (int sequence_number,
enum MuteFlag mflag);
/*
routine: wess_seq_restart()
- restarts a paused sequence
*/
extern void wess_seq_restart (int sequence_number);
/*
routine: wess_seq_stopall()
- immediate pause of all sequences
- if mflag is YesMute, all playing voices are muted
- if mflag is NoMute, all playing voices remain on
- if pns is not NULL, any music muting is recorded
*/
extern void wess_seq_pauseall (enum MuteFlag mflag, NoteState *pns);
/* functions used internally for mute status */
extern void start_record_music_mute(NoteState *pns);
extern void end_record_music_mute(void);
/*
routine: wess_seq_stopall()
- restart all paused sequences
- if pns is not NULL, music unmuting is played
*/
extern void wess_seq_restartall (NoteState *pns);
/*
routine: wess_register_callback()
- callbacks are useful for video and program flow synchronization
with audio.
- callbacks are called when any track of a playing sequence
encounters a StatusMark with a registered marker_ID
- the first parameter of the callback is the marker_ID encountered
- the second parameter is the StatusMark's data field
*/
extern void wess_register_callback (char marker_ID,
void (*function_pointer)(char,short));
/*
routine: wess_delete_callback()
- stop any callbacks from a particular marker_ID
*/
extern void wess_delete_callback (char marker_ID);
/*------------------------------------------------------------------*/
/*
Master functions get and set global sound parameters.
*/
/*------------------------------------------------------------------*/
/*
routine: wess_master_sfx_volume_get()
routine: wess_master_mus_volume_get()
- gets the master volume
*/
extern char wess_master_sfx_volume_get (void);
extern char wess_master_mus_volume_get (void);
/*
routine: wess_master_sfx_vol_set()
routine: wess_master_mus_vol_set()
- sets the master volume
*/
extern void wess_master_sfx_vol_set (char volume);
extern void wess_master_mus_vol_set (char volume);
/*
routine: wess_pan_mode_get()
- gets the pan mode where 0=off, 1=normal, 2=switchLR
*/
extern char wess_pan_mode_get (void);
/*
routine: wess_pan_mode_set()
- sets the pan mode where 0=off, 1=normal, 2=switchLR
*/
extern void wess_pan_mode_set (char mode);
/*
routine: psx_set_mute_release(millisec)
- sets the stop/mute release time given milliseconds
*/
extern void psx_set_mute_release(int millisec);
/*
routine: wess_master_status()
- system status includes drivers loaded, patches loaded, sequences
loaded, and memory locations.
*/
extern void * wess_get_master_status (void);
extern void wess_low_level_init(void);
#endif
================================================
FILE: PSXDOOM/WESSAPIM.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
#include "kernel.h"
#include "wessarc.h"
#include "wessapi.h"
#include "wessseq.h"
extern unsigned char master_sfx_volume; //*L80075834
extern unsigned char master_mus_volume; //*L80075835
extern unsigned char pan_status; //*L80075836
extern unsigned char release_rate; //*L80075837
extern pmasterstat *pm_stat; //800A8538
extern int SeqOn; //80075778
char wess_master_sfx_volume_get (void)//80049548
{
#ifndef BLOCK_SOUND_WESS
if (!Is_Module_Loaded())
{
return 0;
}
return (master_sfx_volume);
#endif
}
char wess_master_mus_volume_get (void)//80049578
{
#ifndef BLOCK_SOUND_WESS
if (!Is_Module_Loaded())
{
return 0;
}
return (master_mus_volume);
#endif
}
void wess_master_sfx_vol_set (char volume)//800495A8
{
#ifndef BLOCK_SOUND_WESS
if (!Is_Module_Loaded())
{
return;
}
master_sfx_volume = volume;
#endif
}
void wess_master_mus_vol_set (char volume)//800495E0
{
#ifndef BLOCK_SOUND_WESS
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
char *temp;
int li, lj;
char action[8];
if (!Is_Module_Loaded())
{
return;
}
/* immediate pause of all sequences */
SeqOn = 0;
master_mus_volume = volume;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
if (ptmp->sndclass == MUSIC_CLASS)
{
temp = ptmp->ppos; //copy
ptmp->ppos = action;//action
action[0] = 12;
ptmp->ppos[1] = ptmp->volume_cntrl;
CmdFuncArr[ptmp->patchtype][12](ptmp);
ptmp->ppos = temp; //restore
}
if (!--li) break;
}
lpdest++;
}
if (!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
char wess_pan_mode_get (void)//800497A0
{
#ifndef BLOCK_SOUND_WESS
return pan_status;
#endif
}
void wess_pan_mode_set (char mode)//800497B0
{
#ifndef BLOCK_SOUND_WESS
pan_status = mode;
#endif
}
================================================
FILE: PSXDOOM/WESSAPIP.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
#include "kernel.h"
#include "wessarc.h"
#include "wessapi.h"
#include "wessseq.h"
extern int num_sd; //80075714
extern char *wmd_file_ptr; //80075718
extern char *wmd_file_ptr2; //8007571C
extern Wess_File_IO_Struct *fp_wmd_file; //80075720
extern int sysinit; //80075724
extern int module_loaded; //80075728
extern int early_exit; //8007572C
extern int max_seq_num; //80075730
extern int mem_limit; //80075734
extern patch_group_header scratch_pat_grp_hdr; //8007EDE8
extern track_header scratch_trk_hdr; //8007EE04
extern int wmd_mem_is_mine; //80075738
extern char *wmd_mem; //8007573C
extern char *wmd_end; //80075740
extern int wmd_size; //80075744
extern int (*Error_func)(int, int); //80075748
extern int Error_module; //8007574C
extern pmasterstat *pm_stat; //800A8538
void trackstart(track_status *ptmp, sequence_status *psq_stat)//800414A4
{
#ifndef BLOCK_SOUND_WESS
if (ptmp->flags & TRK_STOPPED)
{
ptmp->flags &= ~TRK_STOPPED;
if (++psq_stat->tracks_playing)
{
psq_stat->playmode = SEQ_STATE_PLAYING;
}
}
#endif
}
void trackstop(track_status *ptmp, sequence_status *psq_stat)//800414E8
{
#ifndef BLOCK_SOUND_WESS
if (!(ptmp->flags & TRK_STOPPED))
{
ptmp->flags |= TRK_STOPPED;
if (!--psq_stat->tracks_playing)
{
psq_stat->playmode = SEQ_STATE_STOPPED;
}
}
#endif
}
void wess_seq_pause(int sequence_number, enum MuteFlag mflag)//80041528
{
#ifndef BLOCK_SOUND_WESS
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj;
if (!Is_Seq_Num_Valid(sequence_number))
{
return;
}
/* immediate pause of sequence */
SeqOn = 0;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
if (psq_stat->seq_num == sequence_number)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
trackstop(ptmp, psq_stat);
if (mflag == YesMute)
{
CmdFuncArr[ptmp->patchtype][TrkMute](ptmp);
}
if (!--li) break;
}
lpdest++;
}
}
if (!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
void wess_seq_restart(int sequence_number)//800416D0
{
#ifndef BLOCK_SOUND_WESS
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj;
if (!Is_Seq_Num_Valid(sequence_number))
{
return;
}
/* immediate restart of sequence */
SeqOn = 0;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
if (psq_stat->seq_num == sequence_number)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
trackstart(ptmp, psq_stat);
if (!--li) break;
}
lpdest++;
}
}
if (!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
void wess_seq_pauseall(enum MuteFlag mflag, NoteState *pns)//8004183C
{
#ifndef BLOCK_SOUND_WESS
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj;
if (!Is_Module_Loaded())
{
return;
}
/* immediate pause of all sequences */
SeqOn = 0;
//Doom PSX New
if (mflag == YesMute)
{
start_record_music_mute(pns);
}
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
if (mflag == YesMute)
{
CmdFuncArr[ptmp->patchtype][TrkMute](ptmp);
}
trackstop(ptmp, psq_stat);
if (!--li) break;
}
lpdest++;
}
if (!--na) break;
}
psq_stat++;
}
}
//Doom PSX New
if (mflag == YesMute)
{
end_record_music_mute();
}
SeqOn = 1;
#endif
}
void wess_seq_restartall(NoteState *pns)//800419f8
{
#ifndef BLOCK_SOUND_WESS
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj, nc;
if (!Is_Module_Loaded())
{
return;
}
/* immediate restart of all sequences */
SeqOn = 0;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
trackstart(ptmp, psq_stat);
if (pns != 0)
{
for (nc = 0; nc < pns->numnotes; nc++)
{
if (*lpdest == pns->nd[nc].track)
{
if (psq_stat->seq_num == pns->nd[nc].seq_num)
{
PSX_voicenote(ptmp,
pns->nd[nc].patchmap,
pns->nd[nc].patchinfo,
pns->nd[nc].keynum,
pns->nd[nc].velnum);
}
}
}
}
if (!--li) break;
}
lpdest++;
}
if (!--na) break;
}
psq_stat++;
}
}
if (pns != 0)
{
pns->numnotes = 0;
}
SeqOn = 1;
#endif
}
================================================
FILE: PSXDOOM/WESSAPIT.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
#include "kernel.h"
#include "wessarc.h"
#include "wessapi.h"
#include "wessseq.h"
extern int num_sd; //80075714
extern char *wmd_file_ptr; //80075718
extern char *wmd_file_ptr2; //8007571C
extern Wess_File_IO_Struct *fp_wmd_file; //80075720
extern int sysinit; //80075724
extern int module_loaded; //80075728
extern int early_exit; //8007572C
extern int max_seq_num; //80075730
extern int mem_limit; //80075734
extern patch_group_header scratch_pat_grp_hdr; //8007EDE8
extern track_header scratch_trk_hdr; //8007EE04
extern int wmd_mem_is_mine; //80075738
extern char *wmd_mem; //8007573C
extern char *wmd_end; //80075740
extern int wmd_size; //80075744
extern int (*Error_func)(int, int); //80075748
extern int Error_module; //8007574C
extern pmasterstat *pm_stat; //800A8538
void updatetrackstat(track_status *ptk_stat, TriggerPlayAttr *attr)//L80043E08
{
//CODE----------------------------------------------------
int tempmask;
char *temp;
char action[8];
if ((attr == NULL) || (!attr->mask))
return;
tempmask = attr->mask;
if (tempmask & TRIGGER_VOLUME) //0x01
{
ptk_stat->volume_cntrl = attr->volume;
}
if (tempmask & TRIGGER_PAN) //0x02
{
ptk_stat->pan_cntrl = attr->pan;
}
if (tempmask & (TRIGGER_VOLUME | TRIGGER_PAN)) //0x03
{
ptk_stat->volume_cntrl = attr->volume;
ptk_stat->pan_cntrl = attr->pan;
temp = ptk_stat->ppos; //copy
ptk_stat->ppos = action; //action
action[0] = 12;
ptk_stat->ppos[1] = ptk_stat->volume_cntrl;
CmdFuncArr[ptk_stat->patchtype][12](ptk_stat);
ptk_stat->ppos = temp; //restore
}
else
{
if (tempmask & TRIGGER_VOLUME) //0x01
{
ptk_stat->volume_cntrl = attr->volume;
temp = ptk_stat->ppos; //copy
ptk_stat->ppos = action; //action
action[0] = 12;
ptk_stat->ppos[1] = ptk_stat->volume_cntrl;
CmdFuncArr[ptk_stat->patchtype][12](ptk_stat);
ptk_stat->ppos = temp; //restore
}
else if (tempmask & TRIGGER_PAN)
{
ptk_stat->pan_cntrl = attr->pan;
temp = ptk_stat->ppos; //copy
ptk_stat->ppos = action; //action
action[0] = 13;
ptk_stat->ppos[1] = ptk_stat->pan_cntrl;
CmdFuncArr[ptk_stat->patchtype][13](ptk_stat);
ptk_stat->ppos = temp; //restore
}
}
if (tempmask & TRIGGER_PATCH) //0x04
{
ptk_stat->patchnum = attr->patch;
}
if (tempmask & TRIGGER_PITCH) //0x08
{
ptk_stat->pitch_cntrl = attr->pitch;
temp = ptk_stat->ppos; //copy
ptk_stat->ppos = action; //action
action[0] = 9;
ptk_stat->ppos[1] = (char)(ptk_stat->pitch_cntrl & 0xff);
ptk_stat->ppos[2] = (char)(ptk_stat->pitch_cntrl >> 8);
CmdFuncArr[ptk_stat->patchtype][9](ptk_stat);
ptk_stat->ppos = temp; //restore
}
if (tempmask & TRIGGER_MUTEMODE) //0x10
{
if (ptk_stat->mutemask & (1 << attr->mutemode))
{
ptk_stat->flags |= TRK_MUTE;
}
else {
ptk_stat->flags &= ~TRK_MUTE;
}
}
if (tempmask & TRIGGER_TEMPO) //0x20
{
ptk_stat->qpm = attr->tempo;
ptk_stat->ppi = CalcPartsPerInt(GetIntsPerSec(),
ptk_stat->ppq,
ptk_stat->qpm);
}
if (tempmask & TRIGGER_TIMED) //0x40
{
ptk_stat->endppi = ptk_stat->totppi + attr->timeppq;
ptk_stat->flags |= TRK_TIMED;
}
if (tempmask&TRIGGER_LOOPED) //0x80
{
ptk_stat->flags |= TRK_LOOPED;
}
}
void wess_seq_trigger_type (int seq_num, unsigned long seq_type)//800440FC
{
#ifndef BLOCK_SOUND_WESS
sequence_data *psq_info;
psq_info = pm_stat->pmod_info->pseq_info+seq_num; /* pointer math */
wess_seq_structrig (psq_info, seq_num, seq_type, NoHandle, NULL);
#endif
}
void wess_seq_trigger_type_special (int seq_num,
unsigned long seq_type,
TriggerPlayAttr *attr)//8004414C
{
#ifndef BLOCK_SOUND_WESS
sequence_data *psq_info;
psq_info = pm_stat->pmod_info->pseq_info+seq_num; /* pointer math */
wess_seq_structrig (psq_info, seq_num, seq_type, NoHandle, attr);
#endif
}
void wess_seq_update_type_special(unsigned long seq_type, TriggerPlayAttr *attr)//800441A0
{
#ifndef BLOCK_SOUND_WESS
/* immediate stop of sequence */
char nt, na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li, lj;
if (!Is_Module_Loaded())
{
return;
}
SeqOn = 0;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if (na)
{
while (nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
if (psq_stat->seq_type == seq_type)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while (lj--)
{
if (*lpdest != 0xFF)
{
ptmp = (pm_stat->ptrkstattbl + (*lpdest));
if (attr != 0)
{
updatetrackstat(ptmp, attr);
}
if (!--li) break;
}
lpdest++;
}
}
if (!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
void wess_seq_stoptype (unsigned long type_number)//8004431C
{
#ifndef BLOCK_SOUND_WESS
/* immediate stop of sequence */
char nt,na;
sequence_status *psq_stat;
track_status *ptmp;
char *lpdest;
int li,lj;
if(!Is_Module_Loaded())
{
return;
}
SeqOn = 0;
/* search for all sequences with this number and turn them off */
nt = pm_stat->pmod_info->mod_hdr.seq_work_areas;
na = pm_stat->seqs_active;
psq_stat = pm_stat->pseqstattbl;
if(na)
{
while(nt--)
{
if (psq_stat->flags & SEQ_ACTIVE)
{
if(psq_stat->seq_type==type_number)
{
li = psq_stat->tracks_active;
lj = pm_stat->max_trks_perseq;
/* *lpdest refers to an active track if not 0xFF */
lpdest = psq_stat->ptrk_indxs;
while(lj--)
{
if(*lpdest!=0xFF)
{
ptmp = (pm_stat->ptrkstattbl+(*lpdest));
CmdFuncArr[ptmp->patchtype][TrkOff](ptmp);
if(!--li) break;
}
lpdest++;
}
}
if(!--na) break;
}
psq_stat++;
}
}
SeqOn = 1;
#endif
}
================================================
FILE: PSXDOOM/WESSARC.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
/*------------------------------------------------------------------*/
/*
The Williams Entertainment Sound System
Sony Architecture Specific Routines
by Scott Patterson
*/
/*------------------------------------------------------------------*/
//#include "win_port.h"
//#define BLOCK_SOUND_WESS
//#ifndef BLOCK_SOUND_WESS
#include "kernel.h"
#include
#include "wessarc.h"
#include "wessapi.h"
#include "wessseq.h"
/*extern long EnableEvent(unsigned long event);
extern long DisableEvent(unsigned long event);
extern long OpenEvent(unsigned long desc,long spec,long mode,long (*func)(void));
extern long CloseEvent(unsigned long event);
extern long SetRCnt(unsigned long spec,unsigned long target,long mode);
extern long StartRCnt(unsigned long spec);*/
//#include "psxspu.h"
#include "psxcd.h"
void (**CmdFuncArr[10])(track_status *) = {
DrvFunctions,
drv_cmds,
DrvFunctions,
DrvFunctions,
DrvFunctions,
DrvFunctions,
DrvFunctions,
DrvFunctions,
DrvFunctions,
DrvFunctions
};
short GetIntsPerSec(void);
unsigned long CalcPartsPerInt(short ips,short ppq,short qpm);
static long WessInterruptHandler(void);
extern void SeqEngine(void);
/* Movido a WESSBASE.C
int SeqOn = 0;
unsigned long millicount = 0;
unsigned long millisum = 0;
int WessTimerActive = 0;
int T2counter = 0;
*/
extern volatile int SeqOn;
extern volatile long millisum;
extern volatile int WessTimerActive;
extern volatile int T2counter;
static unsigned long EV2 = 0; /* interrupt event var */
// module loader stuff
static Wess_File_IO_Struct module_fileref;//8007EE20
// data loader stuff
//static unsigned long addr;
//static unsigned long size;
//#define MALLOC_MAX 1
//char spu_malloc_rec [SPU_MALLOC_RECSIZ * (MALLOC_MAX + 1)];
static Wess_Data_IO_Struct data_fileref;//8007EE48
// sram transfer stuff
#define CHUNKSIZE 2048
extern char chunk[CHUNKSIZE];//80096394
extern char chunk2[CHUNKSIZE];//80096BA4
#define SRAM_TO_ALLOC 520192
// while I thought end of sram should be 524288, it seems to be 520192
//#define END_O_SRAM 520192
extern unsigned long end_of_sram;
void wess_low_level_init(void)//80043868
{
psxspu_init();
}
void wess_low_level_exit(void)//80043888
{
return;
}
void *wess_malloc(int size)//80043890
{
return 0;
}
void wess_free(char *mem)//80043898
{
return;
}
short GetIntsPerSec(void)//800438A0
{
return(120);
}
unsigned long CalcPartsPerInt(short ips,short ppq,short qpm)//800438A8
{
unsigned long ppi;
ppi = ((((unsigned long)qpm*0x10000)+((unsigned long)ips*30)+30)/((unsigned long)ips*60))*(unsigned long)ppq;
return(ppi);
}
static long WessInterruptHandler(void)//800438F8
{
unsigned int millitemp;
//printf("millicount %d\n",millicount);
//printf("SeqOn %d\n",SeqOn);
//printf("WessTimerActive %d\n",WessTimerActive);
millitemp = millisum + 0x85555;
T2counter += 1;
millisum = millitemp & 0xffff;
millicount += (millitemp >> 0x10);
psxspu_fadeengine();
if (SeqOn)
{
//printf("SeqOn %d\n",SeqOn);
SeqEngine();
}
return (0);
}
void init_WessTimer(void)//8004398C
{
//printf("init_WessTimer\n");
SeqOn = 0;
EnterCriticalSection();
EV2 = OpenEvent(RCntCNT2, EvSpINT, EvMdINTR, WessInterruptHandler);
EnableEvent(EV2);
SetRCnt(RCntCNT2, 34722, RCntMdINTR); // 33038 is ~120 Hz
StartRCnt(RCntCNT2);
WessTimerActive = 1;
ExitCriticalSection();
}
void exit_WessTimer(void)//80043A18
{
psxspu_set_master_vol(psxspu_get_master_vol());
psxspu_set_cd_vol(psxspu_get_cd_vol());
EnterCriticalSection();
WessTimerActive = 0;
DisableEvent(EV2);
CloseEvent(EV2);
ExitCriticalSection();
}
//static SpuReverbAttr rev_attr;
int Wess_init_for_LoadFileData(char *filename)//80043A88
{
/*SpuInitMalloc (MALLOC_MAX, spu_malloc_rec);
rev_attr.mask = SPU_REV_MODE;
rev_attr.mode = SPU_REV_MODE_OFF;
SpuSetReverbModeParam (&rev_attr);
SpuSetReverbVoice (SpuOff, SPU_ALLCH);
SpuReserveReverbWorkArea(SpuOff);
SpuSetReverb (SpuOff);
SpuMalloc (520192);
SpuSetTransMode (SpuTransferByDMA);*/
return(1);
}
Wess_File_IO_Struct *module_open(char *filename)//80043A90
{
Wess_File_IO_Struct *fp;
fp = psxcd_open(filename);
module_fileref = *fp;
return(&module_fileref);
}
int module_read(void *destptr,int readbytes,Wess_File_IO_Struct *fileptr)//80043B04
{
return(psxcd_read(destptr,readbytes,fileptr));
}
int module_seek(Wess_File_IO_Struct *fileptr,int seekpos,int seekmode)//80043B24
{
return(psxcd_seek(fileptr,seekpos,seekmode));
}
unsigned long module_tell(Wess_File_IO_Struct *fileptr)//80043B44
{
return(psxcd_tell(fileptr));
}
void module_close(Wess_File_IO_Struct *fileptr)//80043B64
{
psxcd_close(fileptr);
}
int get_num_Wess_Sound_Drivers(int **settings_tag_lists)//80043B84
{
return(1);
}
Wess_Data_IO_Struct *data_open(char *filename)
{
Wess_File_IO_Struct *fp;
fp = psxcd_open(filename);
data_fileref = *fp;
return(&data_fileref);
}
extern int ReadChunk1;//*L8007EE70
extern int ReadChunk2;//*L8007EE1C
void data_read_chunk(Wess_Data_IO_Struct *fileptr, int totaltogo, unsigned long spuptr)//80043C00
{
if (ReadChunk1)//Read to chunk
{
psxcd_read(chunk, totaltogo, fileptr);
SpuSetTransferStartAddr(spuptr);
SpuWrite(chunk, totaltogo);
ReadChunk2 = 1;
ReadChunk1 = 0;
}
else
{
if (ReadChunk2)//Read to chunk2
{
psxcd_read(chunk2, totaltogo, fileptr);
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
SpuSetTransferStartAddr(spuptr);
SpuWrite(chunk2, totaltogo);
ReadChunk2 = 0;
}
else//Read to chunk
{
psxcd_read(chunk, totaltogo, fileptr);
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
SpuSetTransferStartAddr(spuptr);
SpuWrite(chunk, totaltogo);
ReadChunk2 = 1;
}
}
}
int data_read(Wess_Data_IO_Struct *fileptr,void *destptr,int readbytes,int filepos)//80043D1C
{
int totaltogo;
unsigned long spuptr;
totaltogo = readbytes;
spuptr = (unsigned long)destptr;
if ((end_of_sram - spuptr) < readbytes)
{
return(0);
}
psxcd_seek(fileptr, filepos, PSXCD_SEEK_SET);
ReadChunk1 = 1;
while (CHUNKSIZE <= totaltogo)
{
data_read_chunk(fileptr, CHUNKSIZE, spuptr);
totaltogo -= CHUNKSIZE;
spuptr += CHUNKSIZE;
}
if (totaltogo)
{
data_read_chunk(fileptr, totaltogo, spuptr);
}
SpuIsTransferCompleted(SPU_TRANSFER_WAIT);
return(readbytes);
}
void data_close(Wess_Data_IO_Struct *fileptr)//80043DE8
{
psxcd_close(fileptr);
}
================================================
FILE: PSXDOOM/WESSARC.H
================================================
#ifndef _WESSARC_H
#define _WESSARC_H
//#include "psxspu.h"
#include "psxcd.h"
enum DriverIds {NoSound_ID,PSX_ID,GENERIC_ID=50};
enum SoundHardwareTags {
SNDHW_TAG_END,//0
SNDHW_TAG_DRIVER_ID,//1
SNDHW_TAG_SOUND_EFFECTS,//2
SNDHW_TAG_MUSIC,//3
SNDHW_TAG_DRUMS,//4
SNDHW_TAG_MAX//5
};
// Driver/sequencer command ids
enum DriverCmd {
DriverInit = 0,
DriverExit = 1,
DriverEntry1 = 2,
DriverEntry2 = 3,
DriverEntry3 = 4,
TrkOff = 5,
TrkMute = 6,
PatchChg = 7,
PatchMod = 8,
PitchMod = 9,
ZeroMod = 10,
ModuMod = 11,
VolumeMod = 12,
PanMod = 13,
PedalMod = 14,
ReverbMod = 15,
ChorusMod = 16,
NoteOn = 17,
NoteOff = 18,
StatusMark = 19,
GateJump = 20,
IterJump = 21,
ResetGates = 22,
ResetIters = 23,
WriteIterBox = 24,
SeqTempo = 25,
SeqGosub = 26,
SeqJump = 27,
SeqRet = 28,
SeqEnd = 29,
TrkTempo = 30,
TrkGosub = 31,
TrkJump = 32,
TrkRet = 33,
TrkEnd = 34,
NullEvent = 35
};
//LCD FILE Structs
typedef struct
{
unsigned short patchmap_cnt; //r*
unsigned short patchmap_idx; //r*2
}patches_header;
//int i = sizeof(patches_header);
typedef struct
{
unsigned char priority; //*
unsigned char reverb; //*1
unsigned char volume; //*2
unsigned char pan; //*3
unsigned char root_key; //*4
unsigned char fine_adj; //*5
unsigned char note_min; //*6
unsigned char note_max; //*7
unsigned char pitchstep_min; //*8
unsigned char pitchstep_max; //*9
unsigned short sample_id; //*10
unsigned short adsr1; //*12
unsigned short adsr2; //*14
}patchmaps_header;
//int i = sizeof(patchmaps_header);
typedef struct
{
unsigned int sample_offset; //r*
unsigned int sample_size; //r*4
unsigned long sample_pos; //r*8
}patchinfo_header;
//int i = sizeof(patchinfo_header);
//*******************************
typedef struct
{
int module_id_text; //*
unsigned int module_version; //*4
unsigned short sequences; //*8
unsigned char patch_types_infile; //*10
unsigned char seq_work_areas; //*11
unsigned char trk_work_areas; //*12
unsigned char gates_per_seq; //*13
unsigned char iters_per_seq; //*14
unsigned char callback_areas; //*15
}module_header;
typedef struct
{
unsigned char voices_type; //*
unsigned char voices_max; //*1
unsigned char priority; //*2
unsigned char lockchannel; //*3
unsigned char voices_class; //*4
unsigned char reverb; //*5
unsigned short initpatchnum; //*6
unsigned short initpitch_cntrl; //*8
unsigned char initvolume_cntrl; //*10
unsigned char initpan_cntrl; //*11
unsigned char substack_count; //*12
unsigned char mutebits; //*13
unsigned short initppq; //*14
unsigned short initqpm; //*16
unsigned short labellist_count; //*18
unsigned int data_size; //*20
}track_header;//size 24 bytes
typedef struct
{
track_header trk_hdr;
unsigned long *plabellist;//*24
char *ptrk_data;//*28 ??
}track_data;//32
typedef struct
{
unsigned short tracks; //*
unsigned short unk1; //*2
}seq_header;
typedef struct
{
seq_header seq_hdr; //*
track_data *ptrk_info; //*4
unsigned int fileposition; //*8
unsigned int trkinfolength; //*12
unsigned int trkstoload; //*16
}sequence_data;//debe medir 20?
typedef struct
{
module_header mod_hdr; //*
sequence_data *pseq_info; //*16
}module_data;
typedef void (*callfunc_t)();
typedef struct
{
unsigned char active; //*
unsigned char type; //*1
unsigned short curval; //*2
callfunc_t callfunc; //*4
}callback_status;
typedef struct
{
unsigned int load_flags; //*
unsigned char patch_id; //*4
unsigned char hw_voice_limit; //*5
unsigned short pad1; //*6
unsigned short patches; //*8
unsigned short patch_size; //*10
unsigned short patchmaps; //*12
unsigned short patchmap_size; //*14
unsigned short patchinfo; //*16
unsigned short patchinfo_size; //*18
unsigned short drummaps; //*20
unsigned short drummap_size; //*22
unsigned int extra_data_size; //*24
}patch_group_header;
typedef struct
{
int hardware_ID;//76
int flags_load;//80
}hardware_table_list;
typedef struct
{
patch_group_header pat_grp_hdr; //*
char *ppat_data; //*28
int data_fileposition; //*32
int sndhw_tags[10]; //*36
hardware_table_list hw_tl_list; //*76
}patch_group_data;//size 84 bytes
#define SEQ_STATE_STOPPED 0
#define SEQ_STATE_PLAYING 1
//track
#define TRK_ACTIVE 1
#define TRK_MUTE 2
#define TRK_HANDLED 4
#define TRK_STOPPED 8
#define TRK_TIMED 16
#define TRK_LOOPED 32
#define TRK_SKIP 64
#define TRK_OFF 128
//seq
#define SEQ_ACTIVE 1
#define SEQ_HANDLE 2
//voice
#define VOICE_ACTIVE 1
#define VOICE_RELEASE 2
typedef struct
{
unsigned char flags; //*
unsigned char playmode; //*1
unsigned short seq_num; //*2
unsigned char tracks_active; //*4
unsigned char tracks_playing; //*5
unsigned char volume; //*6
unsigned char pan; //*7
unsigned int seq_type; //*8
char *ptrk_indxs; //*12
char *pgates; //*16
char *piters; //*20
}sequence_status;
typedef struct
{
unsigned char flags; //* //0
unsigned char refindx; //*1
unsigned char seq_owner; //*2
unsigned char patchtype; //*3
unsigned int deltatime; //*4 //1
unsigned char priority; //*8 //2
unsigned char reverb; //*9
unsigned short patchnum; //*10
unsigned char volume_cntrl; //*12 //3
unsigned char pan_cntrl; //*13
short pitch_cntrl; //*14
unsigned char voices_active; //*16 //4
unsigned char voices_max; //*17
unsigned char mutemask; //*18
unsigned char sndclass; //*19
unsigned short ppq; //*20 //5
unsigned short qpm; //*22
unsigned short labellist_count;//*24 //6
unsigned short labellist_max; //*26
unsigned long ppi; //*28 //7
unsigned long starppi; //*32 //8
unsigned int accppi; //*36 //9
unsigned int totppi; //*40 //10
unsigned int endppi; //*44 //11
unsigned char *pstart; //*48 //12
unsigned char *ppos; //*52 //13
unsigned long *plabellist; //*56 //14
unsigned char **psubstack; //*60 //15
unsigned char **psp; //*64 //16
unsigned char **pstackend; //*68 //17
unsigned int data_size; //*72 //18
unsigned int data_space; //*76 //19
}track_status;
typedef struct
{
unsigned char flags; //* //0
unsigned char patchtype; //*1
unsigned char refindx; //*2
unsigned char track; //*3
unsigned char priority; //*4 //1
unsigned char keynum; //*5
unsigned char velnum; //*6
unsigned char sndtype; //*7
patchmaps_header *patchmaps; //*8 //2
patchinfo_header *patchinfo; //*12 //3
unsigned long pabstime; //*16 //4
unsigned long adsr2; //*20 //5
}voice_status;//size 24 bytes
typedef struct
{
unsigned long *pabstime; //*
unsigned char seqs_active; //*4
unsigned char trks_active; //*5
unsigned char voices_active; //*6
unsigned char voices_total; //*7
unsigned char patch_types_loaded; //*8
unsigned char unk1; //*9
unsigned char callbacks_active; //*10
unsigned char unk3; //*11
module_data *pmod_info; //*12
callback_status *pcalltable; //*16
char *pmaster_volume; //*20
patch_group_data *ppat_info; //*24
unsigned long max_trks_perseq; //*28
sequence_status *pseqstattbl; //*32
unsigned long max_substack_pertrk; //*36
track_status *ptrkstattbl; //*40
unsigned long max_voices_pertrk; //*44
voice_status *pvoicestattbl; //*48
//char *ptr_module; //*52
unsigned long fp_module; //*52
}master_status_structure;
typedef master_status_structure pmasterstat;
#define WESS_SSSP_TEXT 0x58535053//'SPSX'//0x58535053 //SPSX
#define WESS_CORE_VERSION 0x01
#define SNDFX_CLASS 0
#define MUSIC_CLASS 1
#define DRUMS_CLASS 2
#define SFXDRUMS_CLASS 3
#define TAG_SOUND_EFFECTS 1
#define TAG_MUSIC 2
#define TAG_DRUMS 4
#define LOAD_PATCHES 1
#define LOAD_PATCHMAPS 2
#define LOAD_PATCHINFO 4
#define LOAD_DRUMMAPS 8
#define LOAD_EXTRADATA 16
///----------------------------------
extern void (**CmdFuncArr[10])(track_status *);
extern volatile int SeqOn;
extern volatile unsigned long millicount;
extern volatile int WessTimerActive;
typedef PsxCd_File Wess_File_IO_Struct;
typedef PsxCd_File Wess_Data_IO_Struct;
extern short GetIntsPerSec(void);
extern unsigned long CalcPartsPerInt(short ips,short ppq,short qpm);
extern void init_WessTimer(void);
extern void exit_WessTimer(void);
extern void wess_low_level_exit(void);
extern void *wess_malloc(int size);
extern void wess_free(char *mem);
#endif // _WESSARC_H
================================================
FILE: PSXDOOM/WESSBASE.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
#include
#include "psxspu.h"
#include "wessapi.h"
#include "wessarc.h"
#include "lcdload.h"
// Variables Aquí para que funcionen correctamante con WessInterruptHandler
int psxsettings[SNDHW_TAG_MAX*2] = //800756EC
{
SNDHW_TAG_DRIVER_ID, PSX_ID,
SNDHW_TAG_SOUND_EFFECTS, 1,
SNDHW_TAG_MUSIC, 1,
SNDHW_TAG_DRUMS, 1,
SNDHW_TAG_END, 0
};
int *settings_list[2] =
{
psxsettings,
0
};
SampleBlock doomsfxblk;//8007eac0
SampleBlock mapsfxblk;//8007ec54
NoteState tmp_notestate;//0x8007e93c
//WESSAPI.C-------------------------------------------
int num_sd = 0; //80075714
char *wmd_file_ptr = 0; //80075718
char *wmd_file_ptr2 = 0; //8007571C
Wess_File_IO_Struct *fp_wmd_file = 0; //80075720
int sysinit = 0; //80075724
int module_loaded = 0; //80075728
int early_exit = 0; //8007572C
int max_seq_num = 0; //80075730
int mem_limit = 0; //80075734
patch_group_header scratch_pat_grp_hdr; //8007EDE8
track_header scratch_trk_hdr; //8007EE04
int wmd_mem_is_mine = 0; //80075738
char *wmd_mem = 0; //8007573C
char *wmd_end = 0; //80075740
int wmd_size = 0; //80075744
int (*Error_func)(int, int) = 0; //80075748
int Error_module = 0; //8007574C
pmasterstat *pm_stat; //800A8538
//WESSARC.C-------------------------------------------
int SeqOn = 0;
unsigned long millicount = 0;
unsigned long millisum = 0;
int WessTimerActive = 0;
int T2counter = 0;
#define CHUNKSIZE 2048
char chunk[CHUNKSIZE];//80096394
char chunk2[CHUNKSIZE];//80096BA4
int ReadChunk1 = 0;//*L8007EE70
int ReadChunk2 = 0;//*L8007EE1C
//LCDLOAD.C-------------------------------------------
int lcd_open = 0; //L800758F4
char *lcd_ppat_data_patches = 0; //L800758F8
char *lcd_ppat_data_patchmaps = 0; //L800758FC
char *lcd_ppat_data_patchinfo = 0; //L80075900
char *lcd_ppat_data_track = 0; //L80075904
patch_group_data *lcd_ppat_info = 0;//L80075908;
unsigned long lcd_sample_pos = 0; //L8007590C
unsigned int lcd_sectorbuf_pos = 0; //L80075910
unsigned int lcd_totaltogo = 0; //L80075914
short lcd_sectorbuf_code = 0; //L80075918
char *lcd_sectorbuf; //L8007591C
int lcd_cd_status = 0; //L80075920
int lcd_sync_intr = 0; //L80075924
char lcd_sync_result[8] = { 0,0,0,0,0,0,0,0 };//0x80075928
Wess_Data_IO_Struct lcd_data_fileref;//0x8007f104
//SEQLOAD.C-------------------------------------------
int seq_loader_enable = 0; //80075790
char *loaderfile = 0; //80075794
pmasterstat *ref_pm_stat = 0; //80075798
int ref_max_seq_num = 0; //8007579C
char Driver_Init = DriverInit; //800757A0
char Reset_Gates = ResetGates; //800757A1
int opencount = 0; //800757A4
int(*Seq_Error_func)(int, int) = 0; //800757A8
int Seq_Error_module = 0; //800757AC
Wess_File_IO_Struct *fp_seq_file = 0;//800757B0
track_header seq_track_header; //8007EE74
track_header base_track_header; //8007EE8C
//PSXSPU.C-------------------------------------------
#define MALLOC_MAX 1
char spu_malloc_rec[SPU_MALLOC_RECSIZ * (MALLOC_MAX + 1)];
unsigned int psxspu_initialized = 0;
unsigned int psxspu_status = 0;
unsigned long end_of_sram = 0x7F000;
int psxspu_master_vol = 0x3FFF;
int psxspu_master_fadecount = 0;
int psxspu_master_vol_fixed = 0x3FFF0000;
int psxspu_master_destvol = 0;
int psxspu_master_changeval = 0;
int psxspu_cd_vol = 0x3CFF;
int psxspu_cd_fadecount = 0;
int psxspu_cd_vol_fixed = 0x3FFF0000;
int psxspu_cd_destvol = 0;
int psxspu_cd_changeval = 0;
SpuReverbAttr rev_attr;//8007EEA4
//WESSSEQ.C-------------------------------------------
unsigned char skip_table[72] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x03, 0x02, 0x04, 0x05, 0x05, 0x02, 0x02,
0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03,
0x03, 0x01, 0x01, 0x01, 0x00, 0x01, 0x02, 0x03,
0x04, 0x07, 0x06, 0x16, 0x17, 0x18, 0x15, 0x1A,
0x1E, 0x19, 0x1B, 0x1D, 0x1C, 0x1F, 0x05, 0x0F,
0x08, 0x09, 0x12, 0x11, 0x10, 0x14, 0x0D, 0x0B,
0x22, 0x23, 0x13, 0x0C, 0x0A, 0x20, 0x21, 0x0E
};
unsigned char master_sfx_volume = 0x7f; //*L80075834
unsigned char master_mus_volume = 0x7f; //*L80075835
unsigned char pan_status = 0x1; //*L80075836
unsigned char release_rate = 0xD; //*L80075837
unsigned long voice_flags1 = 0; //*L80075838
unsigned long voice_flags2 = 0; //*L8007583C
NoteState *ptr_notestate = 0; //*L80075840
voice_status *ptr_pvoicestattbl = 0; //*L80075844
unsigned long priority = 0x100; //*L80075848
unsigned long max_pabstime = 0xFFFFFFFF; //*L8007584C
//-----------------------------------------------------------
// Driver System
//-----------------------------------------------------------
master_status_structure *drv_pmsbase; //L8007EF88
sequence_status *drv_pssbase; //L8007EF8C
track_status *drv_ptsbase; //L8007EF90
unsigned long drv_hwvl; //L8007EF98
patch_group_data *drv_ppgd; //L8007EF9C
unsigned long *drv_pcurabstime; //L8007EFA0
patches_header *drv_patchesbase; //L8007EFA4
patchmaps_header *drv_patchmapsbase; //L8007EFA8
patchinfo_header *drv_samplesbase; //L8007EFAC
char *drv_drummapsbase; //L8007EFB0
SpuVoiceAttr drv_outattr; //L8007EFB4
unsigned char drv_nvst; //L8007EED0
unsigned char drv_npti; //L8007EED4
unsigned long drv_cnt; //L8007EED8
voice_status *drv_pvsbase; //L8007EEDC
voice_status *drv_pcurvs; //L8007EF94
unsigned char drv_channels[24]; //8007f00c
unsigned long drv_pitch1; //L8007EEB8
unsigned long drv_pitch2; //L8007EEBC
unsigned long drv_pitch3; //L8007EEC0
unsigned long drv_volume_1; //L8007EEC4
track_status *drv_ptrk_stat; //L8007EEC8
short drv_pan_1; //L8007EECC
unsigned long drv_vn; //8007EEE0
unsigned long drv_vi; //8007EEE4
unsigned long drv_keychannels; //8007EEE8
unsigned long drv_keycnt; //8007EEEC
voice_status *drv_pvs; //8007EEF0
unsigned long drv_voiceflag; //8007EEF4
char drv_keysstatus[24]; //8007EFF4
sequence_status *drv_pss; //L8007EEF8
unsigned long drv_vn_2; //L8007EEFC
unsigned long drv_vi_2; //L8007EF00
voice_status *drv_pvs_2; //L8007EF04
sequence_status *drv_pss_2; //L8007EF08
unsigned short drv_thepatch; //L8007EF0C
unsigned long drv_voices_active_3; //L8007EF10
unsigned long drv_hwvl_3; //L8007EF14
unsigned long drv_pitch_1; //L8007EF18
unsigned long drv_pitch_2; //L8007EF1C
unsigned long drv_pitch_3; //L8007EF20
voice_status *drv_voice_stat_3; //L8007EF24
short drv_pitch_cntrl; //L8007EF28
unsigned long drv_voices_active_4; //L8007EF2C
unsigned long drv_hwvl_4; //L8007EF30
unsigned long drv_volume_2; //L8007EF34
voice_status *drv_voice_stat_4; //L8007EF38
short drv_pan_2; //L8007EF3C
unsigned long drv_voices_active_5; //L8007EF40
unsigned long drv_hwvl_5; //L8007EF44
unsigned long drv_volume_3; //L8007EF48
voice_status *drv_voice_stat_5; //L8007EF4C
short drv_pan_3; //L8007EF50
track_status *drv_ptrk_stat_1; //L8007EF54
unsigned long drv_hwvl_6; //L8007EF58
unsigned long drv_note_stat; //L8007EF5C
voice_status *drv_voice_stat_6; //L8007EF60
unsigned long drv_patch_cnt; //L8007EF64
unsigned char drv_byte01; //L8007EF68
unsigned char drv_byte02; //L8007EF6C
unsigned char drv_patchmap_cnt; //L8007EF70
patches_header *drv_patch_1; //L8007EF74
patchmaps_header *drv_patchmap_1; //L8007EF78
patchinfo_header *drv_samplesbase_1; //L8007EF7C
unsigned long drv_hwvl_7; //L8007EF80
voice_status *drv_voice_stat_7; //L8007EF84
unsigned int data01; //L8007F024
unsigned char data02; //L8007F028
//-----------------------------------------------------------
// Engine System
//-----------------------------------------------------------
unsigned char eng_ntwa; //L800758E4
track_status *eng_ptsbase; //L800758E8
sequence_status *eng_pssbase; //L800758EC
master_status_structure *eng_pmsbase; //L800758F0
sequence_status *eng_seq_stat_1; //L8007F02C
char *eng_ptrk_indxs1; //L8007F030
unsigned long eng_max_trks_perseq1; //L8007F034
unsigned char eng_patchnum; //L8007F038
short eng_pitch_cntrl; //L8007F03C
unsigned char eng_volume_cntrl; //L8007F040
unsigned char eng_pan_cntrl; //L8007F044
unsigned char eng_callback_areas; //L8007F048
unsigned char eng_callbacks_active; //L8007F04C
callback_status *eng_pcalltable; //L8007F050
short eng_labelnum; //L8007F054
char *eng_plabellist; //L8007F058
char *eng_pgates; //L8007F05C
char *eng_piters; //L8007F068
short eng_labelnum2; //L8007F060
char *eng_plabellist2; //L8007F064
unsigned char eng_gates_per_seq; //L8007F06C
char *eng_pgates2; //L8007F070
unsigned char eng_iters_per_seq; //L8007F074
char *eng_piters2; //L8007F078
char *eng_piters3; //L8007F07C
unsigned short eng_tracks; //L8007F080
unsigned char eng_tracks_active2; //L8007F084
unsigned char *eng_ptrk_indxs2; //L8007F088
track_status *eng_ptrk_stat_1; //L8007F08C
sequence_status *eng_seq_stat_2; //L8007F090
short eng_labelnum3; //L8007F094
unsigned short eng_tracks2; //L8007F098
char *eng_plabellist3; //L8007F09C
unsigned char eng_tracks_active3; //L8007F0A0
unsigned char *eng_ptrk_indxs3; //L8007F0A4
track_status *eng_ptrk_stat_2; //L8007F0A8
sequence_status *eng_seq_stat_3; //L8007F0AC
short eng_labelnum4; //L8007F0B0
unsigned short eng_tracks3; //L8007F0B4
char *eng_plabellist4; //L8007F0B8
unsigned char eng_tracks_active4; //L8007F0BC
unsigned char *eng_ptrk_indxs4; //L8007F0C0
track_status *eng_ptrk_stat_3; //L8007F0C4
sequence_status *eng_seq_stat_4; //L8007F0C8
unsigned short eng_tracks4; //L8007F0CC
unsigned char eng_tracks_active5; //L8007F0D0
unsigned char *eng_ptrk_indxs5; //L8007F0D4
track_status *eng_ptrk_stat_4; //L8007F0D8
sequence_status *eng_seq_stat_5; //L8007F0DC
sequence_status *eng_seq_stat_6; //L8007F0E0
track_status *eng_ptrk_stat_5; //L8007F0E4
unsigned char *eng_ptrk_indxs6; //L8007F0E8
unsigned char eng_tracks_active6; //L8007F0EC
unsigned long eng_max_trks_perseq; //L8007F0F0
track_status *eng_tmp_ptrkstattbl; //L8007F0F4
unsigned int eng_tmp_trks_active; //L8007F0F8
unsigned int eng_tmp_trk_work_areas; //L8007F0FC
char *eng_tmp_ppos; //L8007F100
================================================
FILE: PSXDOOM/WESSSEQ.C
================================================
// Reconstruido por Erick Vasquez Garcia 16/05/2019 [GEC]
// Update_1 20/10/2019 [GEC]
// Update_2 31/01/2020 [GEC]
#include "wessseq.h"
extern void (**CmdFuncArr[10])(track_status *);
extern void(*DrvFunctions[36])();
char *Read_Vlq(char *pstart, void *deltatime);
char *Write_Vlq(char *dest, unsigned int deltatime);
int Len_Vlq(unsigned int deltatime);
void Eng_DriverInit (master_status_structure *pm_stat);
void Eng_DriverExit (track_status *ptk_stat);
void Eng_DriverEntry1 (track_status *ptk_stat);
void Eng_DriverEntry2 (track_status *ptk_stat);
void Eng_DriverEntry3 (track_status *ptk_stat);
void Eng_TrkOff (track_status *ptk_stat);
void Eng_TrkMute (track_status *ptk_stat);
void Eng_PatchChg (track_status *ptk_stat);
void Eng_PatchMod (track_status *ptk_stat);
void Eng_PitchMod (track_status *ptk_stat);
void Eng_ZeroMod (track_status *ptk_stat);
void Eng_ModuMod (track_status *ptk_stat);
void Eng_VolumeMod (track_status *ptk_stat);
void Eng_PanMod (track_status *ptk_stat);
void Eng_PedalMod (track_status *ptk_stat);
void Eng_ReverbMod (track_status *ptk_stat);
void Eng_ChorusMod (track_status *ptk_stat);
void Eng_NoteOn (track_status *ptk_stat);
void Eng_NoteOff (track_status *ptk_stat);
void Eng_StatusMark (track_status *ptk_stat);
void Eng_GateJump (track_status *ptk_stat);
void Eng_IterJump (track_status *ptk_stat);
void Eng_ResetGates (track_status *ptk_stat);
void Eng_ResetIters (track_status *ptk_stat);
void Eng_WriteIterBox (track_status *ptk_stat);
void Eng_SeqTempo (track_status *ptk_stat);
void Eng_SeqGosub (track_status *ptk_stat);
void Eng_SeqJump (track_status *ptk_stat);
void Eng_SeqRet (track_status *ptk_stat);
void Eng_SeqEnd (track_status *ptk_stat);
void Eng_TrkTempo (track_status *ptk_stat);
void Eng_TrkGosub (track_status *ptk_stat);
void Eng_TrkJump (track_status *ptk_stat);
void Eng_TrkRet (track_status *ptk_stat);
void Eng_TrkEnd (track_status *ptk_stat);
void Eng_NullEvent (track_status *ptk_stat);
void(*DrvFunctions[36])() =
{
Eng_DriverInit,
Eng_DriverExit,
Eng_DriverEntry1,
Eng_DriverEntry2,
Eng_DriverEntry3,
Eng_TrkOff,
Eng_TrkMute,
Eng_PatchChg,
Eng_PatchMod,
Eng_PitchMod,
Eng_ZeroMod,
Eng_ModuMod,
Eng_VolumeMod,
Eng_PanMod,
Eng_PedalMod,
Eng_ReverbMod,
Eng_ChorusMod,
Eng_NoteOn,
Eng_NoteOff,
Eng_StatusMark, //0x13
Eng_GateJump, //0x14
Eng_IterJump, //0x15
Eng_ResetGates, //0x16
Eng_ResetIters, //0x17
Eng_WriteIterBox, //0x18
Eng_SeqTempo, //0x19
Eng_SeqGosub, //0x1A
Eng_SeqJump, //0x1B
Eng_SeqRet, //0x1C
//SeqFunctions ??
Eng_SeqEnd, //0x1D
Eng_TrkTempo, //0x1E
Eng_TrkGosub, //0x1F
Eng_TrkJump, //0x20
Eng_TrkRet, //0x21
Eng_TrkEnd, //0x22
Eng_NullEvent //0x23
};
extern unsigned char skip_table[72]; //80075930
extern unsigned char master_sfx_volume; //80075834
extern unsigned char master_mus_volume; //80075835
extern unsigned char pan_status; //80075836
extern unsigned char release_rate; //80075837
extern unsigned long voice_flags1; //80075838
extern unsigned long voice_flags2; //8007583C
extern NoteState *ptr_notestate; //80075840
extern voice_status *ptr_pvoicestattbl; //80075844
extern unsigned long priority; //80075848
extern unsigned long max_pabstime; //8007584C
extern master_status_structure *drv_pmsbase; //8007EF88
extern sequence_status *drv_pssbase; //8007EF8C
extern track_status *drv_ptsbase; //8007EF90
extern unsigned long drv_hwvl; //8007EF98
extern patch_group_data *drv_ppgd; //8007EF9C
extern unsigned long *drv_pcurabstime; //8007EFA0
extern patches_header *drv_patchesbase; //8007EFA4
extern patchmaps_header *drv_patchmapsbase; //8007EFA8
extern patchinfo_header *drv_samplesbase; //8007EFAC
extern char *drv_drummapsbase; //8007EFB0
extern SpuVoiceAttr drv_outattr; //8007EFB4
extern unsigned char drv_nvst; //8007EED0
extern unsigned char drv_npti; //8007EED4
extern unsigned long drv_cnt; //8007EED8
extern voice_status *drv_pvsbase; //8007EEDC
extern voice_status *drv_pcurvs; //8007EF94
extern unsigned char drv_channels[24]; //8007f00c
//-----------------------------------------------------------
// Vlq System
//-----------------------------------------------------------
extern unsigned int data01; //L8007F024
extern unsigned char data02; //L8007F028
char *Read_Vlq(char *pstart, void *deltatime)//L80035F80()
{
unsigned int value;
char data2;
value = *pstart++;
if (value & 0x80)
{
value &= 0x7f;
do
{
data2 = *pstart++;
value = (data2 & 0x7f) + (value << 7);
data02 = data2;
data01 = value;
} while (data2 & 0x80);
}
*(int*)deltatime = value;
return pstart;
}
char *Write_Vlq(char *dest, unsigned int deltatime)//L8004744C()
{
char data[8];
char *ptr;
data[0] = (deltatime & 0x7f);
ptr = (char*)&data+1;
deltatime >>= 7;
if (deltatime)
{
do
{
*ptr++ = ((deltatime & 0x7f) | 0x80);
deltatime >>= 7;
} while (deltatime);
}
do
{
ptr--;
*dest++ = *ptr;
} while (*ptr & 0x80);
return dest;
}
int Len_Vlq(unsigned int deltatime)//L800474AC()
{
char start[8];
char* end = Write_Vlq(start, deltatime);
return (int)(end - start);
}
//-----------------------------------------------------------
// Engine System
//-----------------------------------------------------------
extern unsigned char eng_ntwa; //L800758E4
extern track_status *eng_ptsbase; //L800758E8
extern sequence_status *eng_pssbase; //L800758EC
extern master_status_structure *eng_pmsbase; //L800758F0
void Eng_DriverInit (master_status_structure *pm_stat)//L80047518
{
//printf("Eng_DriverInit\n");
eng_pmsbase = pm_stat;
eng_ptsbase = pm_stat->ptrkstattbl;
eng_pssbase = pm_stat->pseqstattbl;
eng_ntwa = pm_stat->pmod_info->mod_hdr.trk_work_areas;
}
void Eng_DriverExit (track_status *ptk_stat)//L80047554()
{
//printf("Eng_DriverExit\n");
}
void Eng_DriverEntry1 (track_status *ptk_stat)//L8004755C()
{
//printf("Eng_DriverEntry1\n");
}
void Eng_DriverEntry2 (track_status *ptk_stat)//L80047564()
{
//printf("Eng_DriverEntry2\n");
}
void Eng_DriverEntry3 (track_status *ptk_stat)//L8004756C()
{
//printf("Eng_DriverEntry3\n");
}
extern sequence_status *eng_seq_stat_1; //L8007F02C
extern char *eng_ptrk_indxs1; //L8007F030
extern unsigned long eng_max_trks_perseq1; //L8007F034
void Eng_TrkOff (track_status *ptk_stat)//L80047574()
{
sequence_status *seq_stat;
//printf("Eng_TrkOff\n");
seq_stat = (eng_pmsbase->pseqstattbl + ptk_stat->seq_owner);
eng_seq_stat_1 = seq_stat;
if ((ptk_stat->flags & TRK_STOPPED) == 0)
{
ptk_stat->flags |= TRK_STOPPED;
seq_stat->tracks_playing--;
if (seq_stat->tracks_playing == 0)
{
eng_seq_stat_1->playmode = 0;
}
}
if ((ptk_stat->flags & TRK_HANDLED) == 0)
{
eng_max_trks_perseq1 = eng_pmsbase->max_trks_perseq;
eng_ptrk_indxs1 = eng_seq_stat_1->ptrk_indxs;
while (eng_max_trks_perseq1--)
{
if (*eng_ptrk_indxs1 == ptk_stat->refindx)
{
*eng_ptrk_indxs1 = 0xFF;
break;
}
eng_ptrk_indxs1++;
}
ptk_stat->flags &= ~TRK_ACTIVE;
eng_pmsbase->trks_active--;
eng_seq_stat_1->tracks_active--;
if (eng_seq_stat_1->tracks_active == 0)
{
eng_seq_stat_1->flags &= ~SEQ_ACTIVE;
eng_pmsbase->seqs_active--;
}
}
ptk_stat->flags &= ~TRK_TIMED;
}
void Eng_TrkMute (track_status *ptk_stat)//L80047720()
{
//printf("Eng_TrkMute\n");
}
extern unsigned char eng_patchnum; //L8007F038
void Eng_PatchChg (track_status *ptk_stat)//L80047728()
{
//printf("Eng_PatchChg\n");
eng_patchnum = *(ptk_stat->ppos + 1);
ptk_stat->patchnum = eng_patchnum;
}
void Eng_PatchMod (track_status *ptk_stat)//L80047750()
{
//printf("Eng_PatchMod\n");
}
extern short eng_pitch_cntrl; //L8007F03C
void Eng_PitchMod (track_status *ptk_stat)//L80047758()
{
//printf("Eng_PitchMod\n");
eng_pitch_cntrl = (*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
ptk_stat->pitch_cntrl = eng_pitch_cntrl;
}
void Eng_ZeroMod (track_status *ptk_stat)//L80047780()
{
//printf("Eng_ZeroMod\n");
}
void Eng_ModuMod (track_status *ptk_stat)//L80047788()
{
//printf("Eng_ModuMod\n");
}
extern unsigned char eng_volume_cntrl; //L8007F040
void Eng_VolumeMod (track_status *ptk_stat)//L80047790()
{
//printf("Eng_VolumeMod\n");
eng_volume_cntrl = *(ptk_stat->ppos + 1);
ptk_stat->volume_cntrl = eng_volume_cntrl;
}
extern unsigned char eng_pan_cntrl; //L8007F044
void Eng_PanMod (track_status *ptk_stat)//L800477B0()
{
//printf("Eng_PanMod\n");
eng_pan_cntrl = *(ptk_stat->ppos + 1);
ptk_stat->pan_cntrl = eng_pan_cntrl;
}
void Eng_PedalMod (track_status *ptk_stat)//L800477D0()
{
//printf("Eng_PedalMod\n");
}
void Eng_ReverbMod (track_status *ptk_stat)//L800477D8()
{
//printf("Eng_ReverbMod\n");
}
void Eng_ChorusMod (track_status *ptk_stat)//L800477E0()
{
//printf("Eng_ChorusMod\n");
}
void Eng_NoteOn (track_status *ptk_stat)//L800477E8()
{
//printf("Eng_NoteOn\n");
}
void Eng_NoteOff (track_status *ptk_stat)//L800477F0()
{
//printf("Eng_NoteOff\n");
}
extern unsigned char eng_callback_areas; //L8007F048
extern unsigned char eng_callbacks_active;//L8007F04C
extern callback_status *eng_pcalltable; //L8007F050
void Eng_StatusMark (track_status *ptk_stat)//L800477F8()
{
callback_status *cbs;
//printf("Eng_StatusMark\n");
eng_callbacks_active = eng_pmsbase->callbacks_active;
if (eng_callbacks_active)
{
eng_pcalltable = eng_pmsbase->pcalltable;
eng_callback_areas = eng_pmsbase->pmod_info->mod_hdr.callback_areas;
while (eng_callback_areas--)
{
cbs = eng_pcalltable;
if (cbs->active)
{
if (cbs->type == *(ptk_stat->ppos + 1))
{
cbs->curval = (unsigned short)(*(ptk_stat->ppos + 2) | (*(ptk_stat->ppos + 3) << 8));
cbs->callfunc(cbs->type, cbs->curval);
break;
}
if(!--eng_callbacks_active) break;
}
eng_pcalltable++;
}
}
}
extern short eng_labelnum; //L8007F054
extern char *eng_plabellist;//L8007F058
extern char *eng_pgates; //L8007F05C
void Eng_GateJump (track_status *ptk_stat)//L80047914()
{
//printf("Eng_GateJump\n");
eng_pgates = (eng_pssbase + ptk_stat->seq_owner)->pgates + *(ptk_stat->ppos + 1);
if (*eng_pgates != 0)
{
if (*eng_pgates == 0xFF)
{
*eng_pgates = *(ptk_stat->ppos + 2);
}
eng_labelnum = (*(ptk_stat->ppos + 3) | (*(ptk_stat->ppos + 4) << 8));
if ((eng_labelnum >= 0) && (eng_labelnum < ptk_stat->labellist_count))
{
eng_plabellist = ptk_stat->pstart + *(ptk_stat->plabellist + eng_labelnum);
ptk_stat->ppos = eng_plabellist;
}
}
ptk_stat->flags |= TRK_SKIP;
}
extern char *eng_piters; //L8007F068
extern short eng_labelnum2; //L8007F060
extern char *eng_plabellist2;//L8007F064
void Eng_IterJump (track_status *ptk_stat)//L80047A00()
{
//printf("Eng_IterJump\n");
eng_piters = (eng_pssbase + ptk_stat->seq_owner)->piters + *(ptk_stat->ppos + 1);
if (*eng_piters != 0)
{
if (*eng_piters == 0xFF)
{
*eng_piters = *(ptk_stat->ppos + 2);
}
else
{
*eng_piters = *eng_piters + 0xFF;
}
eng_labelnum2 = (*(ptk_stat->ppos + 3) | (*(ptk_stat->ppos + 4) << 8));
if (eng_labelnum2 >= 0)
{
if (eng_labelnum2 < ptk_stat->labellist_count)
{
eng_plabellist2 = ptk_stat->pstart + *(ptk_stat->plabellist + eng_labelnum2);
ptk_stat->ppos = eng_plabellist2;
}
}
}
ptk_stat->flags |= TRK_SKIP;
}
extern unsigned char eng_gates_per_seq; //L8007F06C
extern char *eng_pgates2; //L8007F070
void Eng_ResetGates (track_status *ptk_stat)//L80047AFC()
{
//printf("Eng_ResetGates\n");
if (*(ptk_stat->ppos + 1) == 0xFF)
{
eng_gates_per_seq = eng_pmsbase->pmod_info->mod_hdr.gates_per_seq;
eng_pgates2 = (eng_pssbase + ptk_stat->seq_owner)->pgates;
while (eng_gates_per_seq--)
{
*eng_pgates2++ = 0xFF;
}
}
else
{
eng_pgates2 = (eng_pssbase + ptk_stat->seq_owner)->pgates + *(ptk_stat->ppos + 1);
*eng_pgates2 = 0xFF;
}
}
extern unsigned char eng_iters_per_seq; //L8007F074
extern char *eng_piters2; //L8007F078
void Eng_ResetIters (track_status *ptk_stat)//L80047C00()
{
//printf("Eng_ResetIters\n");
if (*(ptk_stat->ppos + 1) == 0xff)
{
eng_iters_per_seq = eng_pmsbase->pmod_info->mod_hdr.iters_per_seq;
eng_piters2 = (eng_pssbase + ptk_stat->seq_owner)->piters;
while (eng_iters_per_seq--)
{
*eng_piters2++ = 0xff;
}
}
else
{
eng_piters2 = (eng_pssbase + ptk_stat->seq_owner)->piters + *(ptk_stat->ppos + 1);
*eng_piters2 = 0xff;
}
}
extern char *eng_piters3; //L8007F07C
void Eng_WriteIterBox (track_status *ptk_stat)//L80047D04()
{
//printf("Eng_WriteIterBox\n");
eng_piters3 = (eng_pssbase + ptk_stat->seq_owner)->piters + *(ptk_stat->ppos + 1);
*eng_piters3 = *(ptk_stat->ppos + 2);
}
extern unsigned short eng_tracks; //L8007F080
extern unsigned char eng_tracks_active2; //L8007F084
extern unsigned char *eng_ptrk_indxs2; //L8007F088
extern track_status *eng_ptrk_stat_1; //L8007F08C
extern sequence_status *eng_seq_stat_2; //L8007F090
void Eng_SeqTempo (track_status *ptk_stat)//L80047D48()
{
//printf("Eng_SeqTempo\n");
eng_seq_stat_2 = (eng_pssbase + ptk_stat->seq_owner);
eng_ptrk_indxs2 = eng_seq_stat_2->ptrk_indxs;
eng_tracks_active2 = eng_seq_stat_2->tracks_active;
eng_tracks = (eng_pmsbase->pmod_info->pseq_info+eng_seq_stat_2->seq_num)->seq_hdr.tracks;
while (eng_tracks--)
{
if (*eng_ptrk_indxs2 != 0xFF)
{
eng_ptrk_stat_1 = (eng_ptsbase+(*eng_ptrk_indxs2));
eng_ptrk_stat_1->qpm = (unsigned short)(*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
eng_ptrk_stat_1->ppi = CalcPartsPerInt(GetIntsPerSec(), eng_ptrk_stat_1->ppq, eng_ptrk_stat_1->qpm);
if (!--eng_tracks_active2) break;
}
eng_ptrk_indxs2++;
}
}
extern short eng_labelnum3; //L8007F094
extern unsigned short eng_tracks2; //L8007F098
extern char *eng_plabellist3; //L8007F09C
extern unsigned char eng_tracks_active3; //L8007F0A0
extern unsigned char *eng_ptrk_indxs3; //L8007F0A4
extern track_status *eng_ptrk_stat_2; //L8007F0A8
extern sequence_status *eng_seq_stat_3; //L8007F0AC
void Eng_SeqGosub (track_status *ptk_stat)//L80047EC8()
{
//printf("Eng_SeqGosub\n");
eng_labelnum3 = (*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
if ((eng_labelnum3 >= 0) && (eng_labelnum3 < ptk_stat->labellist_count))
{
eng_seq_stat_3 = (eng_pssbase + ptk_stat->seq_owner);
eng_ptrk_indxs3 = eng_seq_stat_3->ptrk_indxs;
eng_tracks_active3 = eng_seq_stat_3->tracks_active;
eng_tracks2 = (eng_pmsbase->pmod_info->pseq_info + eng_seq_stat_3->seq_num)->seq_hdr.tracks;
while (eng_tracks2--)
{
if (*eng_ptrk_indxs3 != 0xFF)
{
eng_ptrk_stat_2 = (eng_ptsbase + (*eng_ptrk_indxs3));
*eng_ptrk_stat_2->psp = (eng_ptrk_stat_2->ppos + skip_table[26]);
eng_ptrk_stat_2->psp++;
eng_plabellist3 = eng_ptrk_stat_2->pstart + *(eng_ptrk_stat_2->plabellist + eng_labelnum3);
eng_ptrk_stat_2->ppos = eng_plabellist3;
if (!--eng_tracks_active3) break;
}
eng_ptrk_indxs3++;
}
}
ptk_stat->flags |= TRK_SKIP;
}
extern short eng_labelnum4; //L8007F0B0
extern unsigned short eng_tracks3; //L8007F0B4
extern char *eng_plabellist4; //L8007F0B8
extern unsigned char eng_tracks_active4; //L8007F0BC
extern unsigned char *eng_ptrk_indxs4; //L8007F0C0
extern track_status *eng_ptrk_stat_3; //L8007F0C4
extern sequence_status *eng_seq_stat_4; //L8007F0C8
void Eng_SeqJump (track_status *ptk_stat)//L800480A4()
{
//printf("Eng_SeqJump\n");
eng_labelnum4 = (*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
if ((eng_labelnum4 >= 0) && (eng_labelnum4 < ptk_stat->labellist_count))
{
eng_seq_stat_4 = (eng_pssbase + ptk_stat->seq_owner);
eng_ptrk_indxs4 = eng_seq_stat_4->ptrk_indxs;
eng_tracks_active4 = eng_seq_stat_4->tracks_active;
eng_tracks3 = (eng_pmsbase->pmod_info->pseq_info + eng_seq_stat_4->seq_num)->seq_hdr.tracks;
while (eng_tracks3--)
{
if (*eng_ptrk_indxs4 != 0xFF)
{
eng_ptrk_stat_3 = (eng_ptsbase + (*eng_ptrk_indxs4));
eng_plabellist4 = eng_ptrk_stat_3->pstart + *(eng_ptrk_stat_3->plabellist + eng_labelnum4);
eng_ptrk_stat_3->ppos = eng_plabellist4;
if (!--eng_tracks_active4) break;
}
eng_ptrk_indxs4++;
}
}
ptk_stat->flags |= TRK_SKIP;
}
extern unsigned short eng_tracks4; //L8007F0CC
extern unsigned char eng_tracks_active5; //L8007F0D0
extern unsigned char *eng_ptrk_indxs5; //L8007F0D4
extern track_status *eng_ptrk_stat_4; //L8007F0D8
extern sequence_status *eng_seq_stat_5; //L8007F0DC
void Eng_SeqRet (track_status *ptk_stat)//L8004824C()
{
//printf("Eng_SeqRet\n");
eng_seq_stat_5 = (eng_pssbase + ptk_stat->seq_owner);
eng_ptrk_indxs5 = eng_seq_stat_5->ptrk_indxs;
eng_tracks_active5 = eng_seq_stat_5->tracks_active;
eng_tracks4 = (eng_pmsbase->pmod_info->pseq_info + eng_seq_stat_5->seq_num)->seq_hdr.tracks;
while (eng_tracks4--)
{
if (*eng_ptrk_indxs5 != 0xFF)
{
eng_ptrk_stat_4 = (eng_ptsbase + (*eng_ptrk_indxs5));
eng_ptrk_stat_4->psp--;
eng_ptrk_stat_4->ppos = *eng_ptrk_stat_4->psp;
if (!--eng_tracks_active5) break;
}
eng_ptrk_indxs5++;
}
ptk_stat->flags |= TRK_SKIP;
}
extern sequence_status *eng_seq_stat_6; //L8007F0E0
extern track_status *eng_ptrk_stat_5; //L8007F0E4
extern unsigned char *eng_ptrk_indxs6; //L8007F0E8
extern unsigned char eng_tracks_active6; //L8007F0EC
extern unsigned long eng_max_trks_perseq; //L8007F0F0
void Eng_SeqEnd (track_status *ptk_stat)//L8004839C()
{
//printf("Eng_SeqEnd\n");
if (!(ptk_stat->flags & TRK_HANDLED))
{
eng_seq_stat_6 = (eng_pmsbase->pseqstattbl + ptk_stat->seq_owner);
eng_ptrk_indxs6 = eng_seq_stat_6->ptrk_indxs;
eng_tracks_active6 = eng_seq_stat_6->tracks_active;
eng_max_trks_perseq = *(char *)&eng_pmsbase->max_trks_perseq;//char??
while (eng_max_trks_perseq--)
{
if (*eng_ptrk_indxs6 != 0xFF)
{
eng_ptrk_stat_5 = (eng_ptsbase + *eng_ptrk_indxs6);
CmdFuncArr[eng_ptrk_stat_5->patchtype][TrkOff]((track_status *)eng_ptrk_stat_5);
if (!--eng_tracks_active6) break;
}
eng_ptrk_indxs6++;
}
}
else
{
eng_seq_stat_6 = (eng_pmsbase->pseqstattbl + ptk_stat->seq_owner);
eng_ptrk_indxs6 = eng_seq_stat_6->ptrk_indxs;
eng_tracks_active6 = eng_seq_stat_6->tracks_active;
eng_max_trks_perseq = *(char *)&eng_pmsbase->max_trks_perseq;//char??
while (eng_max_trks_perseq--)
{
if (*eng_ptrk_indxs6 != 0xFF)
{
eng_ptrk_stat_5 = (eng_ptsbase + (*eng_ptrk_indxs6));
CmdFuncArr[eng_ptrk_stat_5->patchtype][TrkOff]((track_status *)eng_ptrk_stat_5);
if (!--eng_tracks_active6) break;
}
eng_ptrk_indxs6++;
}
ptk_stat->flags |= TRK_SKIP;
}
}
void Eng_TrkTempo (track_status *ptk_stat)//L80048644()
{
//printf("Eng_TrkTempo\n");
ptk_stat->qpm = *(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8);
ptk_stat->ppi = CalcPartsPerInt(GetIntsPerSec(), ptk_stat->ppq, ptk_stat->qpm);
}
void Eng_TrkGosub (track_status *ptk_stat)//L800486A0()
{
unsigned int position;
//printf("Eng_TrkGosub\n");
position = (unsigned int)(*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
if ((position >= 0) && (position < ptk_stat->labellist_count))
{
*ptk_stat->psp = (ptk_stat->ppos + skip_table[26]);
ptk_stat->psp++;
ptk_stat->ppos = ptk_stat->pstart + *(ptk_stat->plabellist + position);
ptk_stat->flags |= TRK_SKIP;
}
}
void Eng_TrkJump (track_status *ptk_stat)//L80048734()
{
unsigned int position;
//printf("Eng_Jump\n");
position = (unsigned int)(*(ptk_stat->ppos + 1) | (*(ptk_stat->ppos + 2) << 8));
if ((position >= 0) && (position < ptk_stat->labellist_count))
{
ptk_stat->ppos = ptk_stat->pstart + *(ptk_stat->plabellist + position);
ptk_stat->deltatime = 0;
ptk_stat->flags |= TRK_SKIP;
}
}
void Eng_TrkRet (track_status *ptk_stat)//L800487A4()
{
//printf("Eng_TrkRet\n");
ptk_stat->psp--;
ptk_stat->ppos = *ptk_stat->psp;
ptk_stat->ppos = Read_Vlq(ptk_stat->ppos, &ptk_stat->deltatime);
ptk_stat->flags |= TRK_SKIP;
}
void Eng_TrkEnd (track_status *ptk_stat)//L800487F8()
{
//printf("Eng_TrkEnd\n");
if (!(ptk_stat->flags & TRK_HANDLED))
{
if (!(ptk_stat->flags & TRK_LOOPED) || (ptk_stat->totppi < 16))
{
CmdFuncArr[ptk_stat->patchtype][TrkOff](ptk_stat);
return;
}
}
else
{
if (!(ptk_stat->flags & TRK_LOOPED) || (ptk_stat->totppi < 16))
{
CmdFuncArr[ptk_stat->patchtype][TrkOff](ptk_stat);
ptk_stat->flags |= TRK_SKIP;
return;
}
}
ptk_stat->flags |= TRK_SKIP;
ptk_stat->ppos = ptk_stat->pstart;
ptk_stat->ppos = Read_Vlq(ptk_stat->pstart, &ptk_stat->deltatime);
}
void Eng_NullEvent (track_status *ptk_stat)//L800488FC()
{
//printf("Eng_NullEvent\n");
}
extern track_status *eng_tmp_ptrkstattbl; //L8007F0F4
extern unsigned int eng_tmp_trks_active; //L8007F0F8
extern unsigned int eng_tmp_trk_work_areas; //L8007F0FC
extern char *eng_tmp_ppos; //L8007F100
void SeqEngine(void)//L80048904()
{
track_status *ptrkstattbl;
eng_tmp_trks_active = eng_pmsbase->trks_active;
if(eng_tmp_trks_active)
{
//printf("eng_tmp_trks_active %d\n",eng_tmp_trks_active);
eng_tmp_ptrkstattbl = eng_ptsbase;
eng_tmp_trk_work_areas = eng_ntwa;
while(eng_tmp_trk_work_areas--)
{
ptrkstattbl = eng_tmp_ptrkstattbl;
if((ptrkstattbl->flags & TRK_ACTIVE))
{
if(!(ptrkstattbl->flags & TRK_STOPPED))
{
ptrkstattbl->starppi += (ptrkstattbl->ppi);
ptrkstattbl->totppi += (ptrkstattbl->starppi >> 0x10);
ptrkstattbl->accppi += (ptrkstattbl->starppi >> 0x10);
ptrkstattbl->starppi &= 65535;
//printf("ptrkstattbl->starppi %d\n",ptrkstattbl->starppi);
//printf("ptrkstattbl->totppi %d\n",ptrkstattbl->totppi);
//printf("ptrkstattbl->accppi %d\n",ptrkstattbl->accppi);
if(!(ptrkstattbl->flags & TRK_TIMED) || (ptrkstattbl->totppi < ptrkstattbl->endppi))
{
while(eng_tmp_ptrkstattbl->deltatime <= eng_tmp_ptrkstattbl->accppi &&
((eng_tmp_ptrkstattbl->flags & (TRK_STOPPED|TRK_ACTIVE)) == TRK_ACTIVE))
{
ptrkstattbl->accppi -= ptrkstattbl->deltatime;
eng_tmp_ppos = (ptrkstattbl->ppos);
if (!(*eng_tmp_ppos < 7) && (*eng_tmp_ppos < 19))
{
CmdFuncArr[ptrkstattbl->patchtype][*eng_tmp_ppos]((track_status *)ptrkstattbl);
ptrkstattbl->ppos += skip_table[*eng_tmp_ppos];
ptrkstattbl->ppos = Read_Vlq(ptrkstattbl->ppos, &ptrkstattbl->deltatime);
}
else if(!(*eng_tmp_ppos < 19) && (*eng_tmp_ppos < 36))
{
DrvFunctions[*eng_tmp_ppos]((track_status *)ptrkstattbl);
if ((ptrkstattbl->flags & (TRK_ACTIVE|TRK_SKIP)) == TRK_ACTIVE)
{
ptrkstattbl->ppos += skip_table[*eng_tmp_ppos];
ptrkstattbl->ppos = Read_Vlq(ptrkstattbl->ppos, &ptrkstattbl->deltatime);
}
else
{
ptrkstattbl->flags &= ~TRK_SKIP;
}
}
else
{
Eng_SeqEnd((track_status *)ptrkstattbl);
}
}
}
else
{
CmdFuncArr[ptrkstattbl->patchtype][5]((track_status *)ptrkstattbl);
}
}
if(!--eng_tmp_trks_active) break;
}
eng_tmp_ptrkstattbl++;
}
}
CmdFuncArr[eng_ptsbase->patchtype][2]((track_status *)eng_ptsbase);
}
================================================
FILE: PSXDOOM/WESSSEQ.H
================================================
#ifndef _WESSSEQ_H
#define _WESSSEQ_H
#include
#include "wessapi.h"
#include "wessarc.h"
extern unsigned char master_sfx_volume;
extern unsigned char master_mus_volume;
extern unsigned char pan_status;
extern unsigned char release_rate;
extern char *Read_Vlq(char *pstart, void *deltatime);
extern char *Write_Vlq(char *dest, unsigned int deltatime);
extern int Len_Vlq(unsigned int deltatime);
extern volatile int SeqOn;
extern void(*drv_cmds[19])();
extern void add_music_mute_note(unsigned short seq_num, unsigned char track, unsigned char keynum, unsigned char velnum, patchmaps_header *patchmap, patchinfo_header *patchinfo);
extern void Dvr_NoteSetHandle(voice_status *pvoices_stat);
extern void Dvr_NoteOn(track_status *ptk_stat,
patchmaps_header *patchmap, patchinfo_header *patchinfo,
unsigned char keynum, unsigned char velnum);
extern void Eng_TrkOff();
extern void(*DrvFunctions[36])();
extern void SeqEngine(void);
#endif // _WESSSEQ_H
================================================
FILE: PSXDOOM/am_main.c
================================================
/* am_main.c -- automap */
#include "doomdef.h"
#include "p_local.h"
#define STEPVALUE 0x800000
#define COLOR_RED 0xA40000
#define COLOR_GREEN 0x00C000
#define COLOR_BROWN 0x8A5C30
#define COLOR_YELLOW 0xCCCC00
#define COLOR_GREY 0x808080
#define COLOR_AQUA 0x0080FF
#define MAXSCALE 64
#define MINSCALE 8
//automap bounding box of level
fixed_t am_maxleft; //iGp00000c94
fixed_t am_maxright; //iGp00000ca4
fixed_t am_maxtop; //iGp00000cac
fixed_t am_maxbottom; //iGp00000ca0
void AM_DrawLine(int color, int x1, int y1, int x2, int y2);
/*================================================================= */
/* */
/* Start up Automap */
/* */
/*================================================================= */
void AM_Start(void)//L8003B83C()
{
am_maxleft = bmaporgx;
am_maxbottom = bmaporgy;
am_maxright = (bmapwidth << 23) + bmaporgx;
am_maxtop = (bmapheight << 23) + bmaporgy;
}
/*
==================
=
= AM_Control
=
= Called by P_PlayerThink before any other player processing
=
= Button bits can be eaten by clearing them in ticbuttons[playernum]
==================
*/
void AM_Control (player_t *player)//L8003B884()
{
int buttons, oldbuttons, step;
if (gamepaused)
return;
buttons = ticbuttons[playernum];
oldbuttons = oldticbuttons[playernum];
if ((buttons & PAD_SELECT) && !(oldbuttons & PAD_SELECT))
{
player->automapflags ^= AF_ACTIVE;
player->automapx = player->mo->x;
player->automapy = player->mo->y;
}
if(!(player->automapflags & AF_ACTIVE))
return;
if (player->playerstate != PST_LIVE)
return;
if (!(buttons & PAD_CROSS))
{
player->automapflags &= ~AF_FOLLOW;
return;
}
if (!(player->automapflags & AF_FOLLOW))
{
player->automapflags |= AF_FOLLOW;
player->automapx = player->mo->x;
player->automapy = player->mo->y;
}
step = STEPVALUE;
if (buttons & PAD_SQUARE)
step *= 2;
if (!(player->automapflags & AF_FOLLOW))
return;
//
// check bounding box collision
//
if (buttons & PAD_RIGHT)
{
player->automapx += step;
if (am_maxright < player->automapx)
player->automapx = am_maxright;
}
else if (buttons & PAD_LEFT)
{
player->automapx -= step;
if (player->automapx < am_maxleft)
player->automapx = am_maxleft;
}
if (buttons & PAD_UP)
{
player->automapy += step;
if (am_maxtop < player->automapy)
player->automapy = am_maxtop;
}
else if (buttons & PAD_DOWN)
{
player->automapy -= step;
if (player->automapy < am_maxbottom)
player->automapy = am_maxbottom;
}
if (buttons & PAD_R1)
{
player->automapscale -= 2;
if (player->automapscale < MINSCALE)
player->automapscale = MINSCALE;
}
else if (buttons & PAD_L1)
{
player->automapscale += 2;
if (MAXSCALE < player->automapscale)
player->automapscale = MAXSCALE;
}
ticbuttons[playernum] &= ~(PAD_UP | PAD_DOWN | PAD_LEFT | PAD_RIGHT | PAD_R1 | PAD_L1);
}
/*
==================
=
= AM_Drawer
=
= Draws the current frame to workingscreen
==================
*/
void AM_Drawer (void)//L8003BAB0()
{
int i;
player_t *p;
line_t *line;
mobj_t *mo;
mobj_t *next;
fixed_t x1, y1;
fixed_t x2, y2;
fixed_t ox, oy;
fixed_t c;
fixed_t s;
fixed_t nx1, ny1;
fixed_t nx2, ny2;
fixed_t nx3, ny3;
angle_t angle;
int color;
int scale;
DrawRender();
p = &players[consoleplayer];
scale = p->automapscale;
if (p->automapflags & AF_FOLLOW)
{
ox = p->automapx;
oy = p->automapy;
}
else
{
ox = p->mo->x;
oy = p->mo->y;
}
line = lines;
for (i = 0; i < numlines; i++, line++)
{
if ((!(line->flags & ML_MAPPED) || // IF NOT MAPPED OR DON'T DRAW
line->flags & ML_DONTDRAW) &&
(!(p->powers[pw_allmap] + (p->cheats & CF_ALLLINES))))
continue;
#if FIX_ML_DONTDRAW == 1
if (p->powers[pw_allmap] && !(p->cheats & CF_ALLLINES) && (line->flags & ML_DONTDRAW))
continue;
#endif // FIX_ML_DONTDRAW
x1 = (scale * (line->v1->x - ox >> 8)) >> 16;
y1 = (scale * (line->v1->y - oy >> 8)) >> 16;
x2 = (scale * (line->v2->x - ox >> 8)) >> 16;
y2 = (scale * (line->v2->y - oy >> 8)) >> 16;
//
// Figure out color
//
color = COLOR_BROWN;
if ((p->powers[pw_allmap] + (p->cheats & CF_ALLLINES)) && // IF COMPMAP && !MAPPED YET
!(line->flags & ML_MAPPED))
color = COLOR_GREY;
else if (line->flags & ML_SECRET)
color = COLOR_RED;
else if (line->special)
color = COLOR_YELLOW;
else if (!(line->flags & ML_TWOSIDED)) // ONE-SIDED LINE
color = COLOR_RED;
AM_DrawLine(color, x1, y1, x2, y2);
}
// SHOW ALL MAP THINGS (CHEAT)
if (p->cheats & CF_ALLTHINGS)
{
for (mo = mobjhead.next; mo != &mobjhead; mo = next)
{
next = mo->next;
if (mo == p->mo)//Ignore player
continue;
angle = mo->angle;
x1 = mo->x - ox;
y1 = mo->y - oy;
c = finecosine[angle >> ANGLETOFINESHIFT];
s = finesine[angle >> ANGLETOFINESHIFT];
nx1 = scale * ((x1 + (c * 24)) >> 8) >> 16;
ny1 = scale * ((y1 + (s * 24)) >> 8) >> 16;
c = finecosine[((angle - ANG90) - ANG45) >> ANGLETOFINESHIFT];
s = finesine[((angle - ANG90) - ANG45) >> ANGLETOFINESHIFT];
nx2 = scale * ((x1 + (c * 24)) >> 8) >> 16;
ny2 = scale * ((y1 + (s * 24)) >> 8) >> 16;
c = finecosine[((angle + ANG90) + ANG45) >> ANGLETOFINESHIFT];
s = finesine[((angle + ANG90) + ANG45) >> ANGLETOFINESHIFT];
nx3 = scale * ((x1 + (c * 24)) >> 8) >> 16;
ny3 = scale * ((y1 + (s * 24)) >> 8) >> 16;
AM_DrawLine(COLOR_AQUA, nx1, ny1, nx2, ny2);
AM_DrawLine(COLOR_AQUA, nx2, ny2, nx3, ny3);
AM_DrawLine(COLOR_AQUA, nx1, ny1, nx3, ny3);
}
}
// SHOW PLAYERS
for (i = 0; i < MAXPLAYERS; i++)
{
if ((i != consoleplayer) && (netgame != gt_coop))
continue;
p = &players[i];
if (p->playerstate == PST_LIVE && (gametic & 2))
continue;
color = COLOR_GREEN;
if ((i == consoleplayer) && (netgame == gt_coop))
color = COLOR_YELLOW;
angle = p->mo->angle;
x1 = p->mo->x - ox;
y1 = p->mo->y - oy;
c = finecosine[angle >> ANGLETOFINESHIFT];
s = finesine[angle >> ANGLETOFINESHIFT];
nx1 = scale * ((x1 + (c * 24)) >> 8) >> 16;
ny1 = scale * ((y1 + (s * 24)) >> 8) >> 16;
c = finecosine[((angle - ANG90) - ANG45) >> ANGLETOFINESHIFT];
s = finesine[((angle - ANG90) - ANG45) >> ANGLETOFINESHIFT];
nx2 = scale * ((x1 + (c * 24)) >> 8) >> 16;
ny2 = scale * ((y1 + (s * 24)) >> 8) >> 16;
c = finecosine[((angle + ANG90) + ANG45) >> ANGLETOFINESHIFT];
s = finesine[((angle + ANG90) + ANG45) >> ANGLETOFINESHIFT];
nx3 = scale * ((x1 + (c * 24)) >> 8) >> 16;
ny3 = scale * ((y1 + (s * 24)) >> 8) >> 16;
AM_DrawLine(color, nx1, ny1, nx2, ny2);
AM_DrawLine(color, nx2, ny2, nx3, ny3);
AM_DrawLine(color, nx1, ny1, nx3, ny3);
}
}
/*
==================
=
= AM_DrawLine
=
==================
*/
//From StationDoom By BodbDearg
typedef enum
{
INSIDE = 0,
LEFT = 1,
RIGHT = 2,
BOTTOM = 4,
TOP = 8
} outflags_t;
//Update OutCode Flags From StationDoom By BodbDearg
void AM_DrawLine(int color, int x1, int y1, int x2, int y2)//L8003C16C()
{
int outcode1, outcode2;
LINE_F2 *line = (LINE_F2*) getScratchAddr(128);//1F800200
outcode1 = (x1 < -128) ? LEFT : INSIDE;
if (128 < x1 ) {outcode1 |= RIGHT;}
if (y1 < -100) {outcode1 |= BOTTOM;}
if (100 < y1 ) {outcode1 |= TOP;}
outcode2 = (x2 < -128) ? LEFT : INSIDE;
if (128 < x2 ) {outcode2 |= RIGHT;}
if (y2 < -100) {outcode2 |= BOTTOM;}
if (100 < y2 ) {outcode2 |= TOP;}
if (outcode1 & outcode2)
return;
setLineF2(line);
setRGB0(line, (color >> 16), (color >> 8), color);
setXY2(line, (x1 + 128), (100 - y1), (x2 + 128) , (100 - y2));
W_AddPrim(line);
}
================================================
FILE: PSXDOOM/asm/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/c_main.c
================================================
/* c_main.c -- credits intro */
#include "doomdef.h"
#include "r_local.h"
psxobj_t idcredpic[2]; //80097910, 80097930
psxobj_t wmscredpic[2]; //80097950, 80097970
int c_vframe1 = 0; //80077AFC iGp000006ec
int c_yscroll; //80078080 uGp00000c70
int c_next; //80077FCC uGp00000bbc
/*
=======================
=
= C_Start
=
=======================
*/
void C_Start(void)//L800369D8()
{
ImageToVram(&idcredpic[0], "IDCRED1", 0);
ImageToVram(&idcredpic[1], "IDCRED2", 0);
ImageToVram(&wmscredpic[0], "WMSCRED1", 0);
ImageToVram(&wmscredpic[1], "WMSCRED2", 0);
c_yscroll = 240;//80078080
c_next = 0;//80077FCC
psxcd_play_at_andloop(CD_TRACK[cdmusic_credits_demo],CDVolume,0,0,CD_TRACK[cdmusic_credits_demo],CDVolume,0,0);
do {} while (psxcd_elapsed_sectors() == 0);
}
/*
=======================
=
= C_Stop
=
=======================
*/
void C_Stop(int exit)//L80036AA0()
{
psxcd_stop();
}
/*
=======================
=
= C_Ticker
=
=======================
*/
int C_Ticker(void)//L80036AC0()
{
int exit;
exit = ga_nothing;
if (ticbuttons[0])
{
exit = ga_exit;
}
else
{
c_vframe1 -= vblsinframe[0];
if (c_vframe1 <= 0)
{
c_vframe1 = 2;
c_yscroll--;
if (c_next == 0)
{
if (c_yscroll < -182)
{
c_vframe1 = 2;
c_next = 1;
c_yscroll = 240;
}
}
else
{
if (c_next != 1)
c_vframe1 = 2;
if (c_yscroll < -228)
{
c_vframe1 = 2;
exit = ga_exitdemo;
}
}
}
}
return exit;
}
/*
=======================
=
= C_Draw
=
=======================
*/
void C_Draw(void) //L80036B58()
{
int xpos;
psxobj_t *pic;
NextTextureCacheIdx();
if (c_next == 0)
{
pic = &idcredpic[1];
DrawStaticImage(&idcredpic[0],0,0,(int)palette[18]);
xpos = 9;
}
else if (c_next == 1)
{
pic = &wmscredpic[1];
DrawStaticImage(&wmscredpic[0],0,0,(int)palette[19]);
xpos = 7;
}
DrawStaticImage(pic, xpos, c_yscroll, palette[16]);
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/cf_main.c
================================================
/* cf_main.c -- configuration menu */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
#include "r_local.h"
char fuctionsnames[][16] =//80073B9C
{
"Attack",
"Use",
"Strafe On",
"Speed",
"Strafe Left",
"Strafe Right",
"Weapon Backward",
"Weapon Forward"
};
/*
=================
=
= CF_Start
=
=================
*/
void CF_Start(void)//L8003773C()
{
S_StartSound(NULL, sfx_pistol);
cursorframe = 0;
cursorpos[0] = 0;
ImageToVram(&buttonspic, "BUTTONS", 0);
}
/*
=================
=
= CF_Stop
=
=================
*/
void CF_Stop(int exit)//L80037780()
{
S_StartSound(NULL, sfx_pistol);
cursorpos[0] = options;
}
/*
=================
=
= CF_Ticker
=
=================
*/
int CF_Ticker(void)//L800377AC()
{
unsigned int *tmpcfg;
int cnt, buttons;
if ((gamevbls < (int)gametic) && ((gametic & 3) == 0))
cursorframe ^= 1;
buttons = ticbuttons[0];
if (buttons & PAD_ARROWS)
{
m_vframe1[0] -= vblsinframe[0];
if (m_vframe1[0] <= 0)
{
m_vframe1[0] = TICRATE;
if (buttons & PAD_DOWN)
{
cursorpos[0]++;
if (cursorpos[0] > 8)
cursorpos[0] = 0;
S_StartSound(NULL, sfx_pstop);
}
else if (buttons & PAD_UP)
{
cursorpos[0]--;
if (cursorpos[0] < 0)
cursorpos[0] = 8;
S_StartSound(NULL, sfx_pstop);
}
}
}
else
{
m_vframe1[0] = 0;
}
if (buttons & (PAD_START | PAD_SELECT))
return ga_exit;
if (buttons != oldticbuttons[0])
{
if (cursorpos[0] < 8)
{
tmpcfg = TempConfiguration;
for (cnt = 0; cnt < 8; cnt++, tmpcfg++)
{
if (buttons & *tmpcfg)
{
ActualConfiguration[cursorpos[0]] = *tmpcfg;
S_StartSound(NULL, sfx_swtchx);
break;
}
}
}
else if (buttons & PAD_ACTION) // Set Default Configuration
{
D_memcpy(&ActualConfiguration, &DefaultConfiguration, sizeof(int) * 8);
S_StartSound(NULL, sfx_swtchx);
}
}
return ga_nothing;
}
/*
=================
=
= CF_Drawer
=
=================
*/
void CF_Drawer(void)//L80037984()
{
int picid, cnt, cnt2, xpos, ypos;
unsigned int *tmpcfg;
unsigned int *actcfg;
NextTextureCacheIdx();
//Draw Backround MARB01 Pic
for (ypos = 0; ypos < 4; ypos++)
{
for (xpos = 0; xpos < 4; xpos++)
{
DrawStaticImage(&marb01pic, xpos << 6, ypos << 6, palette[0]);
}
}
ST_DrawText(-1, 20, "Configuration");//Draw Text
//Draw Skull Selector
DrawImage(statuspic.vtpage, palette[16], 10, (cursorpos[0] * 20) + 43, (cursorframe * M_SKULL_W) + M_SKULL_VX, M_SKULL_VY, M_SKULL_W, M_SKULL_H);
//Draw Psx Buttons Graphics
ypos = 45;
actcfg = ActualConfiguration;
for (cnt = 0; cnt < 8; cnt++, actcfg++)
{
picid = 0;
tmpcfg = TempConfiguration;
for (cnt2 = 0; cnt2 < 8; cnt2++, tmpcfg++)
{
if(*actcfg == *tmpcfg)
break;
picid++;
}
//Draw Buttons PSX
if (cursorpos[0] != cnt || !(ticon & 8))
DrawImage(buttonspic.vtpage, palette[0], 32, ypos, buttonspic.vramx + (picid * 16), buttonspic.vramy, 16, 16);
ypos += 20;
}
//Draw Options names
ypos = 45;
for (cnt = 0; cnt < 8; cnt++)
{
ST_DrawText(70, ypos, fuctionsnames[cnt]);
ypos += 20;
}
//Draw Default Text
if (cursorpos[0] != cnt || !(ticon & 8))
ST_DrawText(70, (cnt * 20) + 45, "Default");
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/d_main.c
================================================
/* D_main.c */
//------------------------------
#include "doomdef.h"
#include "p_spec.h"
#include "r_local.h"
//global gp para checkear funciones
int _gp = 'D' | ('M' << 8) | ('G' << 16) | ('P' << 24);
int *demo_p = NULL; //80077418
int *demobuffer = NULL; //8007741C
int SfxVolume = 100; //80077420
int MusVolume = 100; //80077424
int CDVolume = 0x3CFF; //80077428
int gamevbls; //80077DD0 /* may not really be vbls in multiplayer */
int gametic; //80077E78
int ticsinframe; //800780C0 /* how many tics since last drawer */
int ticon; //80077F74
//int frameon;
int ticbuttons[MAXPLAYERS]; //80077D70, 80077D74
int oldticbuttons[MAXPLAYERS]; //8007803C, 80078040
int vblsinframe[MAXPLAYERS]; //80077de8 /* range from 4 to 8 */
int v_sync; //80077CC8
#define SetVolPsx(vol) ((int)((vol*0x7f)/100))
skill_t startskill = sk_medium; //8007742C
int startmap = 1; //80077430
gametype_t starttype = gt_single; //80077434
byte tempbuffer[0x10000]; //80098528 Psx Doom
mobj_t emptymobj; //0x800a9c14
//Por ahora
int switchlist[MAXSWITCHES * 2];
button_t buttonlist[MAXBUTTONS];//800975B0
anim_t anims[MAXANIMS];
thinker_t thinkercap; /* both the head and tail of the thinker list */ //80096378
mobj_t mobjhead; /* head and tail of mobj list */ //800A8C74,
buttons_t *BT_DATA[MAXPLAYERS];//80077DF4, 80077DF8
line_t *linespeciallist[MAXLINEANIMS];//0x800973a4
void D_DoomMain (void) //L80012274()
{
byte *data;
data = (byte *)tempbuffer;
//printf("MASTER EDITION BY GEC\n");
PSX_INIT();
/* WMS Sound System Init */
PsxSoundInit(SetVolPsx(SfxVolume), SetVolPsx(MusVolume), data);
Z_Init();
Init_Vram_Cache();
W_Init();
R_Init();
ST_Init();
gamevbls = 0;
gametic = 0;
ticsinframe = 0;
ticon = 0;
ticbuttons[0] = ticbuttons[1] = 0;
oldticbuttons[0] = oldticbuttons[1] = 0;
while (1)
{
if (RunTitle() != ga_exit)
{
if (RunDemo((char *)_DEMO1_LMP) != ga_exit)
{
if (RunCredits() != ga_exit)
{
if (RunDemo((char *)_DEMO2_LMP) != ga_exit)
{
continue;
}
}
}
}
do{} while (RunMenu() != ga_timeout);
}
}
int RunLegal(void)//L800123A4()
{
int exit;
exit = MiniLoop(L_Start, L_Stop, L_Ticker, L_Draw);
return exit;
}
int RunTitle(void)//L800123E4()
{
int exit;
exit = MiniLoop(T_Start, T_Stop, T_Ticker, T_Draw);
return exit;
}
int RunDemo(char *demoname)//L80012424()
{
int pfile;
int exit;
demo_p = Z_Alloc(0x4000, PU_STATIC, 0);
pfile = OpenFile(demoname);
ReadFile(pfile, demo_p, 0x4000);
CloseFile(pfile);
exit = G_PlayDemoPtr();
Z_Free(demo_p);
return exit;
}
int RunCredits(void)//L800124A8()
{
int exit;
exit = MiniLoop(C_Start, C_Stop, C_Ticker, C_Draw);
return exit;
}
#include //va_list|va_start|va_end
int debugX, debugY;//80077E5C|uGp00000a4c, 80077E68|uGp00000a58
extern psxobj_t statuspic; //800A92CC
void D_DebugSetPrintPos(int x, int y)//L800124E8()
{
debugX = x;
debugY = y;
}
void D_DebugPrint(const char *text, ...)//L800124F8()
{
char buffer[256];
va_list args;
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *debugsprite = (SPRT*) getScratchAddr(128);//1F800200
SetDrawMode(drawmode, 0, 0, statuspic.vtpage, NULL);
W_AddPrim(drawmode);// add to order table
SetSprt(debugsprite);
SetSemiTrans(debugsprite, 0);
SetShadeTex(debugsprite, 0);
setRGB0(debugsprite, 128, 128, 128);
debugsprite->clut = palette[0];
va_start(args, text);
D_vsprintf(buffer, text, args);
va_end(args);
ST_DrawMessage(debugX, debugY, buffer);
debugY += 8;
}
#define WORDMASK 3
/*int abs(int x)
{
if (x<0)
return -x;
return x;
}*/
#define abs(x) ((x) < 0 ? -(x) : (x))
/*
====================
=
= D_memset
=
====================
*/
void D_memset(void *dest, int val, int count)//L80012850()
{
byte *p;
int *lp;
/* round up to nearest word */
p = dest;
while ((int)p & WORDMASK)
{
if (--count < 0)
return;
*p++ = val;
}
/* write 32 bytes at a time */
lp = (int *)p;
val = (val << 24) | (val << 16) | (val << 8) | val;
while (count >= 32)
{
lp[0] = lp[1] = lp[2] = lp[3] = lp[4] = lp[5] = lp[6] = lp[7] = val;
lp += 8;
count -= 32;
}
/* finish up */
p = (byte *)lp;
while (count--)
*p++ = val;
}
void D_memcpy(void *dest, void *src, int count)//L8001290C()
{
byte *d, *s;
d = (byte *)dest;
s = (byte *)src;
while (count--)
*d++ = *s++;
}
void D_strncpy(char *dest, char *src, int maxcount)//L80012940()
{
byte *p1, *p2;
p1 = (byte *)dest;
p2 = (byte *)src;
while (maxcount--)
if (!(*p1++ = *p2++))
return;
}
int D_strncasecmp(char *s1, char *s2, int len)//L8001297C()
{
while (*s1 && *s2)
{
if (*s1 != *s2)
return 1;
s1++;
s2++;
if (!--len)
return 0;
}
if (*s1 != *s2)
return 1;
return 0;
}
void D_strupr(char *s)//L800129D4()
{
char c;
while ((c = *s) != 0)
{
if (c >= 'a' && c <= 'z')
c -= 'a' - 'A';
*s++ = c;
}
}
/*
===============
=
= M_Random
=
= Returns a 0-255 number
=
===============
*/
unsigned char rndtable[256] = { //0x80058888
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 ,
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 ,
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
120, 163, 236, 249
};
int rndindex = 0;//80077438|uGp0000002c
int prndindex = 0;//8007743C||uGp00000028
int P_Random(void)//L80012A18()
{
prndindex = (prndindex + 1) & 0xff;
return rndtable[prndindex];
}
int M_Random(void)//L80012A44()
{
rndindex = (rndindex + 1) & 0xff;
return rndtable[rndindex];
}
void M_ClearRandom(void) // L80012A70()
{
rndindex = prndindex = 0;
}
void M_ClearBox(fixed_t *box)//L80012A80()
{
box[BOXTOP] = box[BOXRIGHT] = MININT;
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
}
void M_AddToBox(fixed_t *box, fixed_t x, fixed_t y)//L80012AA0()
{
if (xbox[BOXRIGHT])
box[BOXRIGHT] = x;
if (ybox[BOXTOP])
box[BOXTOP] = y;
}
void M_AddToBox2(fixed_t *box, fixed_t x, fixed_t y)//L80012B10()
{
if (xbox[BOXRIGHT])
box[BOXRIGHT] = x;
if (ybox[BOXTOP])
box[BOXTOP] = y;
}
/*
===============
=
= MiniLoop
=
===============
*/
int MiniLoop(void(*start)(void), void(*stop)(int), int(*ticker)(void), void(*drawer)(void))//80012B78
{
int exit;
int buttons;
if (netgame != gt_single)
Sync_Data_Transmission();
gameaction = ga_nothing;
gamevbls = 0;
gametic = 0;
ticon = 0;
ticsinframe = 0;
/* */
/* setup (cache graphics, etc) */
/* */
start();
drawsync1 = 0;
drawsync2 = VSync(-1);
//printf("RUN Mini Loop\n");
while (1)
{
vblsinframe[consoleplayer] = drawsync1;
// get buttons for next tic
oldticbuttons[0] = ticbuttons[0];
oldticbuttons[1] = ticbuttons[1];
buttons = PadRead(0);
ticbuttons[consoleplayer] = buttons;
if (netgame != gt_single)
{
if (Update_Conection() != 0)
{
gameaction = ga_warped;
exit = ga_warped; // hack for NeXT level reloading and net error
break;
}
}
//Read|Write demos
else if (demorecording || demoplayback)
{
if (demoplayback)
{
if (buttons & PAD_ALL)
{
exit = ga_exit;
break;
}
buttons = BIGLONG(*demobuffer++);
ticbuttons[consoleplayer] = buttons;
}
if (demorecording)
{
*demobuffer++ = BIGLONG(buttons);
}
if ((buttons & PAD_START) || ((demobuffer - demo_p) >= 0x4000))
{
exit = ga_exitdemo;
break;
}
}
ticon += vblsinframe[0];
if (ticsinframe < (ticon >> 2))
{
gametic+=1;
ticsinframe = (ticon >> 2);
}
exit = ticker();
if (exit != ga_nothing)
break;
drawer();
if (gamevbls < gametic)
{
S_UpdateSounds();
}
gamevbls = gametic;
}
stop(exit);
oldticbuttons[1] = ticbuttons[1];
oldticbuttons[0] = ticbuttons[0];
return exit;
}
================================================
FILE: PSXDOOM/doomdata.h
================================================
/* DoomData.h */
/* all external data is defined here */
/* most of the data is loaded into different structures at run time */
#ifndef __DOOMDATA__
#define __DOOMDATA__
#ifndef __BYTEBOOL__
#define __BYTEBOOL__
typedef enum {false, true} boolean;
typedef unsigned char byte;
#endif
/*
===============================================================================
map level types
===============================================================================
*/
/* lump order in a map wad */
enum {ML_LABEL, ML_THINGS, ML_LINEDEFS, ML_SIDEDEFS, ML_VERTEXES, ML_SEGS,
ML_SSECTORS, ML_NODES, ML_SECTORS , ML_REJECT, ML_BLOCKMAP, ML_LEAFS, ENDOFWAD
};
typedef struct
{
int x, y; //Psx Doom
} mapvertex_t;
typedef struct
{
short textureoffset;
short rowoffset;
char toptexture[8], bottomtexture[8], midtexture[8];
short sector; /* on viewer's side */
} mapsidedef_t;
typedef struct
{
short v1, v2;
short flags;
short special, tag;
short sidenum[2]; /* sidenum[1] will be -1 if one sided */
} maplinedef_t;
#define ML_BLOCKING 1
#define ML_BLOCKMONSTERS 2
#define ML_TWOSIDED 4 /* backside will not be present at all */
/* if not two sided ???:obsolete */
/* if a texture is pegged, the texture will have the end exposed to air held */
/* constant at the top or bottom of the texture (stairs or pulled down things) */
/* and will move with a height change of one of the neighbor sectors */
/* Unpegged textures allways have the first row of the texture at the top */
/* pixel of the line for both top and bottom textures (windows) */
#define ML_DONTPEGTOP 8
#define ML_DONTPEGBOTTOM 16
#define ML_SECRET 32 /* don't map as two sided: IT'S A SECRET! */
#define ML_SOUNDBLOCK 64 /* don't let sound cross two of these */
#define ML_DONTDRAW 128 /* don't draw on the automap */
#define ML_MAPPED 256 /* set if allready drawn in automap */
// Psx Doom New Flags
#define ML_MIDMASKED 0x200
#define ML_MIDTRANSLUCENT 0x400
#define ML_BLOCKPRJECTILE 0x800
typedef struct
{
short floorheight, ceilingheight; //*, *2
char floorpic[8], ceilingpic[8]; //*4 ,*12
char lightlevel; //*20
char colorid; //*21
short special, tag; //*22, *24
short flags; //Psx Doom *26
} mapsector_t;
typedef struct
{
short numsegs;
short firstseg; /* segs are stored sequentially */
} mapsubsector_t;
typedef struct
{
short v1, v2;
short angle; /* ???: make this a sidedef? */
short linedef, side;
short offset;
} mapseg_t;
enum {BOXTOP,BOXBOTTOM,BOXLEFT,BOXRIGHT}; /* bbox coordinates */
#define NF_SUBSECTOR 0x8000
typedef struct
{
short x,y,dx,dy; /* partition line */
short bbox[2][4]; /* bounding box for each child */
unsigned short children[2]; /* if NF_SUBSECTOR its a subsector */
} mapnode_t;
typedef struct
{
short x,y;
short angle;
short type;
short options;
} mapthing_t;
#define MTF_EASY 1
#define MTF_NORMAL 2
#define MTF_HARD 4
#define MTF_AMBUSH 8
//Psx Doom
#define MTF_BLENDMASK1 0x20
#define MTF_BLENDMASK2 0x40
#define MTF_BLENDMASK3 0x80
/*
===============================================================================
texture definition
===============================================================================
*/
typedef struct
{
short originx;
short originy;
short patch;
short stepdir;
short colormap;
} mappatch_t;
typedef struct
{
//char name[8];
//boolean masked;
short leftoffset;
short topoffset;
short width;
short height;
//void **columndirectory; /* OBSOLETE */
//short patchcount;
//mappatch_t patches[1];
} maptexture_t;
/*
===============================================================================
graphics
===============================================================================
*/
/* shorts are stored BIG ENDIAN */
/* column_t are runs of non masked source pixels */
typedef struct
{
byte topdelta; /* 0xff is the last post in a column */
byte length;
unsigned short dataofs; /* from data start in patch_t */
} column_t;
/* a patch holds one or more columns */
/* patches are used for sprites and all masked pictures */
typedef struct
{
short width; /* bounding box size */
short height;
short leftoffset; /* pixels to the left of origin */
short topoffset; /* pixels below the origin */
unsigned short columnofs[8]; /* only [width] used */
/* the [0] is &columnofs[width] */
} patch_t;
/*
===============================================================================
status
===============================================================================
*/
#endif /* __DOOMDATA__ */
================================================
FILE: PSXDOOM/doomdef.h
================================================
/* DoomDef.h */
/* Fixes and Version Update Here*/
// NEWS (PsyDoom) and ([GEC] Master Edition)
#define SHOWFPS 1
#define ENABLE_NIGHTMARE 1 // Originally Activated in the project [GEC] Master Edition.
#define ENABLE_MOREMAPS 1 // Enable the increase of map limits, important note you need to change the #define LASTLEVEL to the desired value the limit is up to 255.
#define P_FNHF_UPDATE 1 // PsyDoom P_FindNextHighestFloor new code logic.
//FIXES
#define FIX_LINEDEFS_DELETION 1 // Fixes for the 'linedef deletion' bug. From PsyDoom.
#define RANGE_CHECKS 1 // Only if necessary to avoid alterations in the game.
#define FIX_ML_DONTDRAW 1 // Automap: fix a PSX DOOM bug where lines flagged with ML_DONTDRAW would draw when the computer map powerup is obtained. From PsyDoom.
#define FIX_PE_SKULL_LIMIT 1 // Fixes code error when limiting lost souls, converting Doom 2 pc function to PsxDoom (based on Jaguar Doom), code is incompatible, fixes based on repair done for Psx Final Doom.
#define FIX_FLATSPANS 1 // Precision fix for large open maps, to prevent cracks at the right of the screen. From PsyDoom.
//UPDATES
#define GH_UPDATES 1 // Psx Doom Greatest Hits Updates.
#define VINT int
/* SONY LIBRARIES */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include /* O_RDONLY|O_WRONLY|O_NOWAIT */
/* PSX CD INCLUDES */
#include "psxcd.h"
#include "psxcdabs.h"
/* WESS API INCLUDES */
#include "wessapi.h"
#include "wessarc.h"
#include "psxcd.h"
#include "psxspu.h"
#include "wessapi.h"
#include "seqload.h"
#include "lcdload.h"
/* NEW GEC */
#define setClutNum(p,num) \
((p)->clut = num)
/*============================================================================= */
/* all external data is defined here */
#include "doomdata.h"
/* header generated by multigen utility */
#include "info.h"
#define MAXCHAR ((char)0x7f)
#define MAXSHORT ((short)0x7fff)
#define MAXINT ((int)0x7fffffff) /* max pos 32-bit int */
#define MAXLONG ((long)0x7fffffff)
#define MINCHAR ((char)0x80)
#define MINSHORT ((short)0x8000)
#define MININT ((int)0x80000000) /* max negative 32-bit integer */
#define MINLONG ((long)0x80000000)
#ifndef NULL
#define NULL 0
#endif
// PSX Doom
#define LASTLEVEL 60 // 60 is defined as it is the last level map entry, it does not contain a specific map, it is used to limit passwords, load sounds for credits.
/*
// Stores information about a texture, including it's dimensions, lump info and texture cache info
struct texture_t {
0 0 2 int16_t offsetX;
2 2 int16_t offsetY;
1 4 2 int16_t width; // TODO: is this signed or unsigned?
6 2 int16_t height; // TODO: is this signed or unsigned?
2 8 1 uint8_t texPageCoordX; // TODO: COMMENT
9 1 uint8_t texPageCoordY; // TODO: COMMENT
10 2 uint16_t texPageId; // TODO: COMMENT
3 12 2 uint16_t widthIn16Blocks; // Width in 16 pixel increments (rounded up)
14 2 uint16_t heightIn16Blocks; // Height in 16 pixel increments (rounded up)
4 16 2 uint16_t lumpNum;
18 2 uint16_t __padding; // TODO: is this actually used?
5 20 4 VmPtr> ppTexCacheEntry; // The texture cache entry for this texture
6 24 4 uint32_t unknown1; // TODO: what is this?
7 28 4 uint32_t uploadFrameNum; // What frame the texture was added to the texture cache, used to detect texture cache overflows
};
*/
//
// Object Data Psx Doom
//
typedef struct psxobj_s
{
short x; // pixels to the left of origin
short y; // pixels below the origin
short w; // width image
short h; // height image
unsigned char vramx; // vram position x
unsigned char vramy; // vram position y
unsigned short vtpage; // base tpage info
unsigned short vbasex; // base x pos in vram
unsigned short vbasey; // base y pos in vram
unsigned short lump; // lump number
unsigned short pad1; // lump number
unsigned long *vptr; // ptr to an arry for the tpage??
unsigned int pad2;
unsigned int index;
} psxobj_t;
typedef struct
{
short leftoffset;
short topoffset;
short width;
short height;
} patchpsx_t;
#define FIRESKY_WIDTH 64
#define FIRESKY_HEIGHT 128
#define FIREPOS1 ((FIRESKY_WIDTH * FIRESKY_HEIGHT) - FIRESKY_WIDTH)
#define FIREPOS2 ((FIRESKY_WIDTH * FIRESKY_HEIGHT) - 1)
extern byte tempbuffer[0x10000]; //80098528 Psx Doom
int D_vsprintf(char *string, const char *format, int *argptr);
void D_printf (char *str, ...);
/*
===============================================================================
GLOBAL TYPES
===============================================================================
*/
#define MAXPLAYERS 2
#define TICRATE 15 /* number of tics / second */
#define FRACBITS 16
#define FRACUNIT (1<type] */
VINT tics; /* state tic counter */
state_t *state;
int flags;
VINT health;
VINT movedir; /* 0-7 */
VINT movecount; /* when 0, select a new dir */
struct mobj_s *target; /* thing being chased/attacked (or NULL) */
/* also the originator for missiles */
VINT reactiontime; /* if non 0, don't attack yet */
/* used by player to freeze a bit after */
/* teleporting */
VINT threshold; /* if >0, the target will be chased */
/* no matter what (even if shot) */
struct player_s *player; /* only valid if type == MT_PLAYER */
struct mobj_s *extramobj; /* for latecall functions */
short spawnx, spawny, spawntype,spawnangle; /* for deathmatch respawning */
struct mobj_s* tracer; /* Thing being chased/attacked for tracers. */
} mobj_t;
/* each sector has a degenmobj_t in it's center for sound origin purposes */
struct subsector_s;
typedef struct
{
fixed_t x,y,z;
struct subsector_s *subsec; // Psx Doom New
} degenmobj_t;
/* */
/* frame flags */
/* */
#define FF_FULLBRIGHT 0x8000 /* flag in thing->frame */
#define FF_FRAMEMASK 0x7fff
/* */
/* mobj flags */
/* */
#define MF_SPECIAL 1 /* call P_SpecialThing when touched */
#define MF_SOLID 2
#define MF_SHOOTABLE 4
#define MF_NOSECTOR 8 /* don't use the sector links */
/* (invisible but touchable) */
#define MF_NOBLOCKMAP 16 /* don't use the blocklinks */
/* (inert but displayable) */
#define MF_AMBUSH 32
#define MF_JUSTHIT 64 /* try to attack right back */
#define MF_JUSTATTACKED 128 /* take at least one step before attacking */
#define MF_SPAWNCEILING 256 /* hang from ceiling instead of floor */
#define MF_NOGRAVITY 512 /* don't apply gravity every tic */
/* movement flags */
#define MF_DROPOFF 0x400 /* allow jumps from high places */
#define MF_PICKUP 0x800 /* for players to pick up items */
#define MF_NOCLIP 0x1000 /* player cheat */
#define MF_SLIDE 0x2000 /* keep info about sliding along walls */
#define MF_FLOAT 0x4000 /* allow moves to any height, no gravity */
#define MF_TELEPORT 0x8000 /* don't cross lines or look at heights */
#define MF_MISSILE 0x10000 /* don't hit same species, explode on block */
#define MF_DROPPED 0x20000 /* dropped by a demon, not level spawned */
#define MF_SHADOW 0x40000 /* use fuzzy draw (shadow demons / invis) */
#define MF_NOBLOOD 0x80000 /* don't bleed when shot (use puff) */
#define MF_CORPSE 0x100000 /* don't stop moving halfway off a step */
#define MF_INFLOAT 0x200000 /* floating to a height for a move, don't */
/* auto float to target's height */
#define MF_COUNTKILL 0x400000 /* count towards intermission kill total */
#define MF_COUNTITEM 0x800000 /* count towards intermission item total */
#define MF_SKULLFLY 0x1000000 /* skull in flight */
#define MF_NOTDMATCH 0x2000000 /* don't spawn in death match (key cards) */
#define MF_SEETARGET 0x4000000 /* is target visible? */
/* Exclusive Psx Doom Flags */
#define MF_BLENDMASK1 0x10000000
#define MF_BLENDMASK2 0x20000000
#define MF_BLENDMASK3 0x40000000
#define MF_ALL_BLEND_MASKS (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3)
/*============================================================================= */
typedef enum
{
PST_LIVE, /* playing */
PST_DEAD, /* dead on the ground */
PST_REBORN /* ready to restart */
} playerstate_t;
/* psprites are scaled shapes directly on the view screen */
/* coordinates are given for a 320*200 view screen */
typedef enum
{
ps_weapon,
ps_flash,
NUMPSPRITES
} psprnum_t;
typedef struct
{
state_t *state; /* a NULL state means not active */
int tics;
fixed_t sx, sy;
} pspdef_t;
typedef enum
{
it_redcard,
it_bluecard,
it_yellowcard,
it_redskull,
it_blueskull,
it_yellowskull,
NUMCARDS
} card_t;
typedef enum
{
wp_fist,
wp_pistol,
wp_shotgun,
wp_supershotgun,//psx
wp_chaingun,
wp_missile,
wp_plasma,
wp_bfg,
wp_chainsaw,
NUMWEAPONS,
wp_nochange
} weapontype_t;
typedef enum
{
am_clip, /* pistol / chaingun */
am_shell, /* shotgun */
am_cell, /* BFG */
am_misl, /* missile launcher */
NUMAMMO,
am_noammo /* chainsaw / fist */
} ammotype_t;
typedef struct
{
ammotype_t ammo;
int upstate;
int downstate;
int readystate;
int atkstate;
int flashstate;
} weaponinfo_t;
extern weaponinfo_t weaponinfo[NUMWEAPONS];//80066f24
typedef enum
{
pw_invulnerability,
pw_strength,
pw_invisibility,
pw_ironfeet,
pw_allmap,
pw_infrared,
NUMPOWERS
} powertype_t;
#define INVULNTICS (30*15)
#define INVISTICS (60*15)
#define INFRATICS (120*15)
#define IRONTICS (60*15)
/*
================
=
= player_t
=
================
*/
typedef struct player_s
{
mobj_t *mo;
playerstate_t playerstate;
fixed_t forwardmove, sidemove; /* built from ticbuttons */
angle_t angleturn; /* built from ticbuttons */
fixed_t viewz; /* focal origin above r.z */
fixed_t viewheight; /* base height above floor for viewz */
fixed_t deltaviewheight; /* squat speed */
fixed_t bob; /* bounded/scaled total momentum */
int health; /* only used between levels, mo->health */
/* is used during levels */
int armorpoints, armortype; /* armor type is 0-2 */
int powers[NUMPOWERS]; /* invinc and invis are tic counters */
boolean cards[NUMCARDS];
boolean backpack;
int frags; /* kills of other player */
int fragpad; /* don't mess up offsets for asm code... */
weapontype_t readyweapon;
weapontype_t pendingweapon; /* wp_nochange if not changing */
boolean weaponowned[NUMWEAPONS];
int ammo[NUMAMMO];
int maxammo[NUMAMMO];
int attackdown, usedown; /* true if button down last tic */
int cheats; /* bit flags */
int refire; /* refired shots are less accurate */
int killcount, itemcount, secretcount; /* for intermission */
char *message; /* hint messages */
int damagecount, bonuscount;/* for screen flashing */
mobj_t *attacker; /* who did damage (NULL for floors) */
int extralight; /* so gun flashes light up areas */
int fixedcolormap; /* can be set to REDCOLORMAP, etc */
int colormap; /* 0-3 for which color to draw player */
pspdef_t psprites[NUMPSPRITES]; /* view sprites (gun, etc) */
boolean didsecret; /* true if secret level has been done */
void *lastsoundsector; /* don't flood noise every time */
int automapx, automapy, automapscale, automapflags;
int turnheld; /* for accelerative turning */
} player_t;
#define CF_NOCLIP 1 // no use
#define CF_GODMODE 2
#define CF_ALLLINES 4
#define CF_ALLTHINGS 8
#define CF_VRAMVIEWER 16
#define CF_WARPLEVEL 32
#define CF_NONE 64
#define CF_X_RAY 128
#define CF_PAUSE 256
#define AF_ACTIVE 1 /* automap active */
#define AF_FOLLOW 2
#define AF_ALLLINES 4
#define AF_ALLMOBJ 8
#define AF_OPTIONSACTIVE 128 /* options screen running */
/*
===============================================================================
GLOBAL VARIABLES
===============================================================================
*/
/*================================== */
extern int ticsinframe; /* how many tics since last drawer */
extern int ticon;
extern int frameon;
extern int ticbuttons[MAXPLAYERS];
extern int oldticbuttons[MAXPLAYERS];
int MiniLoop ( void (*start)(void), void (*stop)(int)
, int (*ticker)(void), void (*drawer)(void) );
int G_Ticker (void);
void G_Drawer (void);
void G_RunGame (void);
/*================================== */
extern gameaction_t gameaction;
#define SBARHEIGHT 32 /* status bar height at bottom of screen */
typedef enum
{
gt_single,
gt_coop,
gt_deathmatch
} gametype_t;
extern gametype_t netgame;
extern boolean playeringame[MAXPLAYERS];
extern int consoleplayer; /* player taking events and displaying */
extern int displayplayer;
extern player_t players[MAXPLAYERS];
extern boolean rendersky;//8007801C
extern skill_t gameskill;
extern int gamemap;
extern int nextmap;
extern int totalkills, totalitems, totalsecret; /* for intermission *///80077d4c,80077d58,80077E18
extern int gametic;
extern mapthing_t deathmatchstarts[10], *deathmatch_p; //80097e4c,80077e8c
extern mapthing_t playerstarts[MAXPLAYERS];//800a8c60
/*
===============================================================================
GLOBAL FUNCTIONS
===============================================================================
*/
fixed_t FixedMul (fixed_t a, fixed_t b);
fixed_t FixedDiv (fixed_t a, fixed_t b);
#ifndef __BIG_ENDIAN__
#define __BIG_ENDIAN__
#endif
#ifdef __BIG_ENDIAN__
#define BIGSHORT(x) (x)
#define BIGLONG(x) (x)
/*define LITTLESHORT(x) ShortSwap(x) */
//#define LITTLESHORT(x) (short)((((x)&255)<<8)+(((x)>>8)&255))
//#define LITTLELONG(x) LongSwap(x)
#define LITTLESHORT(x) (x)
#define LITTLELONG(x) (x)
#else
short ShortSwap(short dat)
{
return (((unsigned short)dat<<8) + ((unsigned short)dat>>8))&0xffff;
}
long LongSwap(long dat)
{
unsigned a,b,c,d;
a = (dat>>24)&0xff;
b = (dat>>16)&0xff;
c = (dat>>8)&0xff;
d = dat&0xff;
return (d<<24)+(c<<16)+(b<<8)+a;
}
#define BIGSHORT(x) ShortSwap(x)
#define BIGLONG(x) LongSwap(x)
#define LITTLESHORT(x) (x)
#define LITTLELONG(x) (x)
#endif
/*----------- */
/*MEMORY ZONE */
/*----------- */
/* tags < 16 are not overwritten until freed */
#define PU_STATIC 1 /* static entire execution time */
#define PU_LEVEL 2 /* static until level exited */
#define PU_LEVSPEC 4 /* a special thinker in a level */
#define PU_ANIMATION 8 /* psx doom */
/* tags >= 16 are purgable whenever needed */
#define PU_PURGELEVEL 16
#define PU_CACHE 32
#define ZONEID 0x1d4a
typedef struct memblock_s
{
int size; /* including the header and possibly tiny fragments */
void **user; /* NULL if a free block */
short tag; /* purgelevel */
short id; /* should be ZONEID */
int lockframe; /* don't purge on the same frame */
struct memblock_s *next;
struct memblock_s *prev;
} memblock_t;
typedef struct
{
int size; /* total bytes malloced, including header */
memblock_t *rover;
memblock_t blocklist; /* start / end cap for linked list */
} memzone_t;
//extern int framecount;
extern memzone_t *mainzone;
//extern memzone_t *refzone;
void Z_Init (void);
memzone_t *Z_InitZone (byte *base, int size);
void *Z_Malloc2 (memzone_t *mainzone, int size, int tag, void *ptr);
void *Z_Alloc2(memzone_t *mainzone, int size, int tag, void *user);//psxdoom
inline void Z_Free2 (memzone_t *mainzone,void *ptr);
#define Z_Malloc(x,y,z) Z_Malloc2(mainzone,x,y,z)
#define Z_Alloc(x,y,z) Z_Alloc2(mainzone,x,y,z)
#define Z_Free(x) Z_Free2(mainzone,x)
void Z_FreeTags(memzone_t *mainzone, int tag);
void Z_CheckHeap (memzone_t *mainzone);
void Z_ChangeTag (void *ptr, int tag);
int Z_FreeMemory (memzone_t *mainzone);
void Z_DumpHeap(memzone_t *mainzone);
/*------- */
/*WADFILE */
/*------- */
typedef struct
{
int filepos; /* also texture_t * for comp lumps */
int size;
char name[8];
} lumpinfo_t;
typedef struct {
void *cache;
} lumpcache_t;
extern int wadfilenum;
extern lumpinfo_t *lumpinfo; /* points directly to rom image */
extern int numlumps;
extern lumpcache_t *lumpcache;
extern byte *lumpencode; // psxdoom
extern boolean disableload; // psxdoom
extern byte *mapfileptr; // psxdoom
extern int mapnumlumps; // psxdoom
extern lumpinfo_t *maplump; // psxdoom
void W_Init (void);
int W_CheckNumForName (char *name);
int W_GetNumForName (char *name);
int W_LumpLength (int lump);
void W_ReadLump (int lump, void *dest, boolean decodelump);//psxdoom
void *W_CacheLumpNum (int lump, int tag, boolean decodelump);//psxdoom
void *W_CacheLumpName (char *name, int tag, boolean decodelump);//psxdoom
byte *W_OpenMapWad(char *mapname);//psxdoom
int W_MapLumpLength(int lump);//psxdoom
int W_MapGetNumForName(char *name);//psxdoom
void W_ReadMapLump(int lump, void *dest, int decodelump);//psxdoom
void decode(unsigned char *input, unsigned char *output);//psxdoom
int decodedsize(unsigned char *input);//psxdoom
/*------- */
/*PSX FILE */
/*------- */
void ClearFiles(void);//psxdoom
int OpenFile(char *filename);//psxdoom
void CloseFile(int file_num);//psxdoom
int SeekFile(int file_num, int seekpos, int seekmode);//psxdoom
void ReadFile(int file_num, void *destptr, unsigned int readbytes);//psxdoom
#define W_POINTLUMPNUM(x) (void*)(wadfileptr+BIGLONG(lumpinfo[x].filepos));
/*---------- */
/*BASE LEVEL */
/*---------- */
void D_DoomMain (void);
void D_DoomLoop (void);
extern boolean demoplayback, demorecording;
extern int *demo_p, *demobuffer;
extern skill_t startskill;
extern int startmap;
extern gametype_t starttype;
/*--------- */
/*SYSTEM IO */
/*--------- */
#define SCREENWIDTH 256
#define SCREENHEIGHT 240
/*---- */
/*GAME */
/*---- */
void G_DeathMatchSpawnPlayer (int playernum);
void G_InitNew (skill_t skill, int map, gametype_t gametype);
void G_CompleteLevel (void);
void G_RecordDemo (void);
int G_PlayDemoPtr (void);//(int *demo);
/*----- */
/*PLAY */
/*----- */
void P_SetupLevel (int map, skill_t skill);
void P_Init (void);
void P_Start (void);
void P_Stop (int exit);
int P_Ticker (void);
void P_Drawer (void);
void IN_Start (void);
void IN_Stop (int exit);
int IN_Ticker (void);
void IN_Drawer (void);
//m_main.c
typedef enum
{
gamemode,
level,
difficulty,
options,
NUMMENUITEMS
} menu_t;
//Skull Graphic On StatusPic
#define M_SKULL_W 16
#define M_SKULL_H 18
#define M_SKULL_VX 132
#define M_SKULL_VY 192
extern int cursorframe;//80078000 00000bf0
extern int cursorpos[MAXPLAYERS];//80077E2C uGp00000a1c,
extern int m_vframe1[MAXPLAYERS]; //80077D24 uGp00000914
extern psxobj_t backpic;//0x800977f0
extern psxobj_t doompic;//0x80097830
extern psxobj_t connectpic;//0x800978F0
int RunMenu(void);
void M_Start (void);
void M_Stop (int exit);
int M_Ticker (void);
void M_Drawer (void);
void M_CrossFadeWipe(void);
//f_main.c
void END1_Start (void);
void END1_Stop(int exit);
int END1_Ticker(void);
void END1_Drawer(void);
void Cast_Start(void);
void Cast_Stop(int exit);
int Cast_Ticker(void);
void Cast_Drawer(void);
/*void F_Start (void);
void F_Stop (void);
int F_Ticker (void);
void F_Drawer (void);*/
void AM_Control (player_t *player);
void AM_Drawer (void);
void AM_Start (void);
/*----- */
/*OPTIONS */
/*----- */
void O_Start (void);
void O_Stop (int exit);
int O_Ticker (void);
void O_Drawer (void);
/*----- */
/*PASSWORD */
/*----- */
void PW_Start(void);
void PW_Stop(int exit);
int PW_Ticker(void);
void PW_Drawer(void);
void Encode_Password(byte *buff);
int Decode_Password(byte *inbuff, int *levelnum, int *skill, player_t *player);
/*----- */
/*CONFIGURATION */
/*----- */
void CF_Start (void);
void CF_Stop (int exit);
int CF_Ticker (void);
void CF_Drawer (void);
/*----- */
/*STATUS */
/*----- */
extern psxobj_t statuspic;
void ST_Init (void);
void ST_Ticker (void);
void ST_Drawer (void);
void ST_InitEveryLevel(void);
/*------- */
/*REFRESH */
/*------- */
void R_RenderPlayerView (void);
void R_Init (void);
int R_FlatNumForName (char *name);
int R_TextureNumForName (char *name);
int R_CheckTextureNumForName (char *name);
angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
struct subsector_s *R_PointInSubsector (fixed_t x, fixed_t y);
/*---- */
/*MISC */
/*---- */
extern unsigned char rndtable[256];
int M_Random (void);
int P_Random (void);
void M_ClearRandom (void);
void M_ClearBox (fixed_t *box);
void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
/* header generated by Dave's sound utility */
#include "sounds.h"
extern boolean gamepaused;
extern int maxlevel; /* highest level selectable in menu (1-25) */
extern int gamevbls; /* may not really be vbls in multiplayer */
extern int vblsinframe[MAXPLAYERS]; /* range from 4 to 8 */
/*----- */
/*PSX Doom */
/*----- */
/* CONTROL PAD */
#define PAD_UP (1<<12)//4096
#define PAD_DOWN (1<<14)//16384
#define PAD_LEFT (1<<15)//32768
#define PAD_RIGHT (1<<13)//8192
#define PAD_TRIANGLE (1<< 4)//16
#define PAD_CROSS (1<< 6)//64
#define PAD_SQUARE (1<< 7)//128
#define PAD_CIRCLE (1<< 5)//32
#define PAD_L1 (1<< 2)//4
#define PAD_L2 (1<< 0)//1
#define PAD_R1 (1<< 3)//8
#define PAD_R2 (1<< 1)//2
#define PAD_START (1<<11)//2048
#define PAD_SELECT (1<< 8)//256
#define PAD_LR (PAD_L1 | PAD_L2 | PAD_R1 | PAD_R2)//15
#define PAD_ARROWS (PAD_UP | PAD_RIGHT | PAD_DOWN | PAD_LEFT)//61440
#define PAD_ACTION (PAD_TRIANGLE | PAD_CIRCLE | PAD_CROSS | PAD_SQUARE)//240
#define PAD_ALL (PAD_ARROWS | PAD_START | PAD_SELECT | PAD_ACTION | PAD_LR)//63999
//MOUSE PAD
#define MOUSE_LEFT (1<<3)//8
#define MOUSE_RIGHT (1<<2)//4
typedef struct
{
unsigned int BT_ATTACK; //*
unsigned int BT_USE; //*4
unsigned int BT_STRAFE; //*8
unsigned int BT_SPEED; //*12
unsigned int BT_STRAFELEFT; //*16
unsigned int BT_STRAFERIGHT; //*20
unsigned int BT_WEAPONBACKWARD; //*24
unsigned int BT_WEAPONFORWARD; //*28
} buttons_t;
extern buttons_t *BT_DATA[MAXPLAYERS];//80077DF4, 80077DF8
/* psxmain.c */
#define MAX_VRAMMEM 256 // # of entries in manager cache
#define MAX_DYNAMIC_TPAGE 11 // max # of tpages supported for dynamic memory
#define MIN_VRAM_ALLOC_SIZE 16 // each tpage is divided into this many number of squares
#define MIN_VRAM_ALLOC_SHIFT 4 // shift to simulate the divide of (MIN_VRAM_ALLOC_SIZE)
#define VRAMSIZE (sizeof(int) * MAX_DYNAMIC_TPAGE * MAX_VRAMMEM)
extern int PageCount;
extern int TextureCacheIdx;
extern int xycount;
extern int xcount;
extern int ycount;
extern int V_PagFlags;
extern DRAWENV draw[2]; /* draw environment */ //800A8E90, 800A8EEC
extern DISPENV disp[2]; /* display environment*/ //800a8f48, 800A8F5C
extern long drawside;
extern int drawsync1;//80077FE4
extern int drawsync2;//80077F3C
void I_Error(char *error, ...);
void ImageToVram(psxobj_t *pic, char *name, int lump);
void DrawStaticImage(psxobj_t *psxobj, int xpos, int ypos, int pal);
void DrawImage(int vtpage, int pal, int xpos, int ypos, char vramx, char vramy, int width, int height);
void P_LoadingPlaque(psxobj_t *psxobj, int xpos, int ypos, int pal);
void NextTextureCacheIdx(void);
void DrawRender(void);
void Add_vsync(void);
void Init_Vram_Cache(void);
void TextureCache (psxobj_t *psxobj);
void V_ClearBlock(psxobj_t *psxobj);
void Valloc_Init(void);
void Vram_Viewer(int page);
extern boolean cancel_link;
extern unsigned int TempConfiguration[8];
extern unsigned int ActualConfiguration[8];
extern unsigned int DefaultConfiguration[8];
extern unsigned int NewConfiguration[8];
void Link_Conection(void);
boolean Update_Conection(void);
void Sync_Data_Transmission(void);
void Sync_Read_Write (void);
void UpdateDrawOTag(void);
unsigned int Get_CfgCode(unsigned int *cfgdata);
unsigned int *Get_CfgByCode(unsigned int cfgcode);
/* extras */
//void W_AddPrim (void* prim, unsigned long* addr0, unsigned long* addr1);//OLD VERSION
void W_AddPrim (void* prim);
void TestRender(void);
int RunLegal(void);
int RunTitle(void);
int RunDemo(char *demoname);
int RunCredits(void);
/* l_main.c */
extern int y_scroll;//80077FB8 uGp00000ba8
extern int last_ticon;//80077D38 iGp00000928
extern psxobj_t legalspic;
void L_Start(void);
void L_Stop(int exit);
int L_Ticker(void);
void L_Draw(void);
/* c_main.c */
void C_Start(void);
void C_Stop(int exit);
int C_Ticker(void);
void C_Draw(void);
/* t_main.c */
extern psxobj_t loadingpic;//0x80097870
extern psxobj_t marb01pic;//0x80097890
extern psxobj_t buttonspic;//0x800978B0
extern psxobj_t neterrpic; //0x800978d0
extern psxobj_t pausepic;//0x80097850
extern psxobj_t titlepic;//0x80097810
void T_Start(void);
void T_Stop(int exit);
int T_Ticker(void);
void T_Draw(void);
/* Enum for a CD music piece and also an index into the 'CD_Track' array to get an actual track number */
enum cdmusic_t {
cdmusic_title_screen,
cdmusic_main_menu,
cdmusic_credits_demo,
cdmusic_intermission,
cdmusic_club_doom,
cdmusic_finale_doom1,
cdmusic_finale_doom2,
NUM_CD_MUSIC_TRACKS
};
extern int CD_TRACK[NUM_CD_MUSIC_TRACKS];//80073C7C
void S_SetSoundVolume (int volume);
void S_SetMusicVolume(int volume);
void S_StopMusic(void);
void S_StartMusic(void);
void S_InitBlock(SampleBlock *sampblk);
void S_DoBlockClear(SampleBlock *sampblk);
void S_Lcd_Load(int map_indx);
void S_Pause(void);
void S_Resume(void);
void S_StopSound(unsigned long sequence_type);
void S_StopAll(void);
void S_AdjustSoundParams(mobj_t *origin, int sound_id, TriggerPlayAttr *attr);
void S_StartSound(mobj_t *origin, int sound_id);
void S_UpdateSounds(void);
void PsxSoundInit(int sfx_volume, int mus_volume, void *data);
void PsxSoundExit(void);
extern int SfxVolume; /* range from 0 to 100 */ //80077420
extern int MusVolume; /* range from 0 to 100 */ //80077424
extern int CDVolume; /* range from 0 to 0x3CFF */ //80077428
================================================
FILE: PSXDOOM/f_main.c
================================================
/* f_main.c -- finale */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
#include "r_local.h"
char endcluster1[][25] = //8007466c
{
"you have won!",
"your victory enabled",
"humankind to evacuate",
"earth and escape the",
"nightmare.",
"but then earth control",
"pinpoints the source",
"of the alien invasion.",
"you are their only hope.",
"you painfully get up",
"and return to the fray."
};
char endcluster2[][25] =
{
"you did it!",
"by turning the evil of",
"the horrors of hell in",
"upon itself you have",
"destroyed the power of",
"the demons.",
"their dreadful invasion",
"has been stopped cold!",
"now you can retire to",
"a lifetime of frivolity.",
"congratulations!"
};
//
// Character cast strings F_FINALE.C
//
#define CC_ZOMBIE "Zombieman"
#define CC_SHOTGUN "Shotgun Guy"
#define CC_HEAVY "Heavy Weapon Dude"
#define CC_IMP "Imp"
#define CC_DEMON "Demon"
#define CC_LOST "Lost Soul"
#define CC_CACO "Cacodemon"
#define CC_HELL "Hell Knight"
#define CC_BARON "Baron Of Hell"
#define CC_ARACH "Arachnotron"
#define CC_PAIN "Pain Elemental"
#define CC_REVEN "Revenant"
#define CC_MANCU "Mancubus"
//#define CC_ARCH "Arch-Vile"
#define CC_SPIDER "The Spider Mastermind"
#define CC_CYBER "The Cyberdemon"
#define CC_HERO "Our Hero"
//
// Final DOOM 2 animation
// Casting by id Software.
// in order of appearance
//
typedef struct
{
char *name;
mobjtype_t type;
} castinfo_t;
static castinfo_t castorder[] = //80074898
{
{ CC_ZOMBIE, MT_POSSESSED },
{ CC_SHOTGUN, MT_SHOTGUY },
{ CC_HEAVY, MT_CHAINGUY },
{ CC_IMP, MT_TROOP },
{ CC_DEMON, MT_SERGEANT },
{ CC_LOST, MT_SKULL },
{ CC_CACO, MT_HEAD },
{ CC_HELL, MT_KNIGHT },
{ CC_BARON, MT_BRUISER },
{ CC_ARACH, MT_BABY },
{ CC_PAIN, MT_PAIN },
{ CC_REVEN, MT_UNDEAD },
{ CC_MANCU, MT_FATSO },
//{ CC_ARCH, MT_VILE },
{ CC_SPIDER, MT_SPIDER },
{ CC_CYBER, MT_CYBORG },
{ CC_HERO, MT_PLAYER },
{ NULL,0 }
};
typedef enum
{
F_STAGE_TEXT,
F_STAGE_SCROLLTEXT,
F_STAGE_CAST,
} finalestage_t;
static int textline; //80077F38 uGp00000b28
static int textcount; //80077D84 uGp00000974
static byte text_array[28]; //L800A8E2C
/*
=================
=
= END1_Start
=
=================
*/
void END1_Start(void)//L8003D440()
{
P_LoadingPlaque(&loadingpic, 95, 109, palette[16]);
Valloc_Init();
TextureCache(&backpic);
textline = 0;
textcount = 0;
text_array[0] = '\0';
psxcd_play_at_andloop(CD_TRACK[cdmusic_finale_doom1],CDVolume,0,0,CD_TRACK[cdmusic_credits_demo],CDVolume,0,0);
do { } while (psxcd_elapsed_sectors() == 0);
}
/*
=================
=
= END1_Stop
=
=================
*/
void END1_Stop(int exit)//L8003D4E4()
{
gamepaused = false;
psxcd_stop();
}
/*
=================
=
= END1_Ticker
=
=================
*/
int END1_Ticker(void)//L8003D50C()
{
int buttons, oldbuttons, exit;
gameaction = ga_nothing;
buttons = ticbuttons[consoleplayer];
oldbuttons = oldticbuttons[consoleplayer];
P_CheckCheats();
exit = gameaction;
if (gamepaused == false)
{
exit = ga_nothing;
if (textline < 11)
{
if ((gamevbls < (int)gametic) && !(gametic & 1))
{
if (endcluster1[textline][textcount] == '\0')
{
textcount = 0;
textline++;
}
else
{
D_strncpy(text_array, endcluster1[textline], textcount);
}
text_array[textcount] = '\0';
textcount++;
}
}
else if ((buttons != oldbuttons) && (buttons & PAD_ACTION))
{
exit = ga_exit;
}
}
return exit;
}
/*
=================
=
= END1_Drawer
=
=================
*/
void END1_Drawer(void)//L8003D660()
{
int i, ypos;
NextTextureCacheIdx();
DrawStaticImage(&backpic, 0, 0, palette[0]);
ypos = 45;
for (i = 0; i < textline; i++)
{
ST_DrawText(-1, ypos, endcluster1[i]);
ypos += 14;
}
ST_DrawText(-1, ypos, text_array);
if (gamepaused)
ST_CheatDraw();
UpdateDrawOTag();
DrawRender();
}
static psxobj_t demonpic;//0x80097990
//int castrotation = 0;//test
static int castnum; //800780AC uGp00000c9c
static int casttics; //80077CFC uGp000008ec
static state_t *caststate; //80077DD4 puGp000009c4
static boolean castdeath; //80077DA4 uGp00000994
static int castframes; //80077EB4 uGp00000aa4
static int castonmelee; //80077F90 uGp00000b80
static int textypos; //80077D3C uGp0000092c
static finalestage_t finalestage; //80077F94 uGp00000b84
/*
=================
=
= Cast_Start
=
=================
*/
void Cast_Start(void)//L8003D734
{
P_LoadingPlaque(&loadingpic, 95, 109, palette[16]);
Valloc_Init();
ImageToVram(&demonpic, "DEMON", 0);
P_LoadBlocks((char *)_MAPSPR60_IMG);
text_array[0] = '\0';
finalestage = F_STAGE_TEXT;
textline = 0;
textcount = 0;
castnum = 0;
castdeath = false;
castframes = 0;
castonmelee = 0;
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
casttics = states[mobjinfo[castorder[castnum].type].seestate].tics;
textypos = 45;
S_Lcd_Load(LASTLEVEL);
psxcd_play_at_andloop(CD_TRACK[cdmusic_finale_doom2],CDVolume,0,0,CD_TRACK[cdmusic_credits_demo],CDVolume,0,0);
do {} while (psxcd_elapsed_sectors() == 0);
}
/*
=================
=
= Cast_Stop
=
=================
*/
void Cast_Stop(int exit)//L8003D860()
{
gamepaused = false;
psxcd_stop();
}
/*
=================
=
= Cast_Ticker
=
=================
*/
int Cast_Ticker(void)//L8003D888()
{
int buttons, oldbuttons;
int st, sfx;
gameaction = ga_nothing;
buttons = ticbuttons[consoleplayer];
oldbuttons = oldticbuttons[consoleplayer];
P_CheckCheats();
if (gamepaused != 0)
{
return gameaction;
}
else
{
if (finalestage == F_STAGE_TEXT)
{
if ((gamevbls < (int)gametic) && !(gametic & 1))
{
if (endcluster2[textline][textcount] == '\0')
{
textcount = 0;
textline++;
if (textline >= 11)//wait all text
finalestage = F_STAGE_SCROLLTEXT;
}
else
{
D_strncpy(text_array, endcluster2[textline], textcount);
}
text_array[textcount] = '\0';
textcount++;
}
}
else if(finalestage == F_STAGE_SCROLLTEXT)
{
textypos--;
if (textypos < -200)
finalestage = F_STAGE_CAST;
}
else if (finalestage == F_STAGE_CAST)
{
if (castdeath == false)
{
if ((buttons != oldbuttons) && (buttons & PAD_ACTION))
{
S_StartSound(NULL, sfx_shotgn);
// go into death frame
if (mobjinfo[castorder[castnum].type].deathsound)
S_StartSound(NULL, mobjinfo[castorder[castnum].type].deathsound);
castdeath = true;
castframes = 0;
caststate = &states[mobjinfo[castorder[castnum].type].deathstate];
casttics = caststate->tics;
}
//test
/*if ((buttons != oldbuttons))
{
if(buttons & PAD_LEFT)
castrotation = castrotation+1 & 7;
else if(buttons & PAD_RIGHT)
castrotation = castrotation-1 & 7;
}*/
}
if (gametic > gamevbls)
{
if (castdeath && caststate->nextstate == S_NULL)
{
/* switch from deathstate to next monster */
castnum++;
castdeath = false;
if (castorder[castnum].name == NULL)
castnum = 0;
if (mobjinfo[castorder[castnum].type].seesound)
S_StartSound(NULL, mobjinfo[castorder[castnum].type].seesound);
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
castframes = 0;
}
else
{
/* advance state*/
if (--casttics > 0)
return ga_nothing; /* not time to change state yet */
/* sound hacks.... */
switch (caststate->nextstate)
{
case S_PLAY_ATK2: sfx = sfx_dshtgn; break;
case S_POSS_ATK2: sfx = sfx_pistol; break;
case S_SPOS_ATK2: sfx = sfx_shotgn; break;
//case S_VILE_ATK2: sfx = sfx_vilatk; break;
case S_SKEL_FIST2: sfx = sfx_skeswg; break;
case S_SKEL_FIST4: sfx = sfx_skepch; break;
case S_SKEL_MISS2: sfx = sfx_skeatk; break;
case S_FATT_ATK8:
case S_FATT_ATK5:
case S_FATT_ATK2: sfx = sfx_firsht; break;
case S_CPOS_ATK2:
case S_CPOS_ATK3:
case S_CPOS_ATK4: sfx = sfx_pistol; break;
case S_TROO_ATK3: sfx = sfx_claw; break;
case S_SARG_ATK2: sfx = sfx_sgtatk; break;
case S_BOSS_ATK2:
case S_BOS2_ATK2:
case S_HEAD_ATK2: sfx = sfx_firsht; break;
case S_SKULL_ATK2: sfx = sfx_sklatk; break;
case S_SPID_ATK2:
case S_SPID_ATK3: sfx = sfx_pistol; break;
case S_BSPI_ATK2: sfx = sfx_plasma; break;
case S_CYBER_ATK2:
case S_CYBER_ATK4:
case S_CYBER_ATK6: sfx = sfx_rlaunc; break;
case S_PAIN_ATK3: sfx = sfx_sklatk; break;
default: sfx = 0; break;
}
if (sfx)
S_StartSound(NULL, sfx);
}
st = caststate->nextstate;
caststate = &states[st];
castframes++;
if (castframes == 12)
{ /* go into attack frame */
if (castonmelee)
caststate = &states[mobjinfo[castorder[castnum].type].meleestate];
else
caststate = &states[mobjinfo[castorder[castnum].type].missilestate];
castonmelee ^= 1;
if (caststate == &states[S_NULL])
{
if (castonmelee)
caststate = &states[mobjinfo[castorder[castnum].type].meleestate];
else
caststate = &states[mobjinfo[castorder[castnum].type].missilestate];
}
}
if (castframes == 24 || caststate == &states[S_PLAY])
{
caststate = &states[mobjinfo[castorder[castnum].type].seestate];
castframes = 0;
}
casttics = caststate->tics;
if (casttics == -1)
casttics = TICRATE;
}
}
}
return ga_nothing;
}
/*
=================
=
= Cast_Drawer
=
=================
*/
void Cast_Drawer(void)//L8003E098()
{
spritedef_t* sprdef;
spriteframe_t* sprframe;
int lump;
boolean flip;
int i, xpos, ypos;
psxobj_t *sprite;
POLY_FT4 *spritepoly = (POLY_FT4*) getScratchAddr(128);//1F800200
NextTextureCacheIdx();
DrawStaticImage(&demonpic, 0, 0, palette[0]);
if (finalestage <= (F_STAGE_TEXT + F_STAGE_SCROLLTEXT))
{
ypos = textypos;
for (i = 0; i < textline; i++)
{
ST_DrawText(-1, ypos, endcluster2[i]);
ypos += 14;
}
ST_DrawText(-1, ypos, text_array);
}
else if (finalestage == F_STAGE_CAST)
{
// draw the current frame in the middle of the screen
sprdef = &sprites[caststate->sprite];
sprframe = &sprdef->spriteframes[caststate->frame & FF_FRAMEMASK];
lump = sprframe->lump[0];
flip = (boolean)sprframe->flip[0];
//lump = sprframe->lump[castrotation];
//flip = (boolean)sprframe->flip[castrotation];
sprite = &texsprites[lump - firstsprite];
TextureCache(sprite);
setPolyFT4(spritepoly);
setShadeTex(spritepoly, 1);
spritepoly->clut = palette[0];
spritepoly->tpage = sprite->vtpage;
ypos = 180 - sprite->y;
if (!flip)
{
//setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3)
setUV4(spritepoly,
sprite->vramx, sprite->vramy,
sprite->vramx + sprite->w + -1, sprite->vramy,
sprite->vramx, sprite->vramy + sprite->h + -1,
sprite->vramx + sprite->w + -1, sprite->vramy + sprite->h + -1);
xpos = 128 - sprite->x;
}
else
{
//setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3)
setUV4(spritepoly,
sprite->vramx + sprite->w + -1, sprite->vramy,
sprite->vramx, sprite->vramy,
sprite->vramx + sprite->w + -1, sprite->vramy + sprite->h + -1,
sprite->vramx, sprite->vramy + sprite->h + -1);
xpos = sprite->x - (sprite->w - 128);
}
//setXY4(p,_x0,_y0,_x1,_y1,_x2,_y2,_x3,_y3)
setXY4(spritepoly,
xpos, ypos,
xpos + sprite->w, ypos,
xpos, ypos + sprite->h,
xpos + sprite->w, ypos + sprite->h);
W_AddPrim(spritepoly);// add to order table
ST_DrawText(-1, 20, "Cast Of Characters");
ST_DrawText(-1, 208, castorder[castnum].name);
}
if (gamepaused)
ST_CheatDraw();
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/g_game.c
================================================
/* G_game.c */
#include "doomdef.h"
#include "p_local.h"
void G_PlayerReborn (int player);
void G_DoReborn (int playernum);
void G_DoLoadLevel (void);
gameaction_t gameaction; //80077CE0 iGp000008d0
skill_t gameskill; //8007807C uGp00000c6c
int gamemap; //80077E74 uGp00000a64
int nextmap; //80077EC4 iGp00000ab4/* the map to go to after the stats */
gametype_t netgame; //80077E88 iGp00000a78
boolean playeringame[MAXPLAYERS]; //80077ED4 -> uGp00000ac4, 80077ED8 -> uGp00000ac8
player_t players[MAXPLAYERS]; //800A85CC,800A86F8
int consoleplayer; /* player taking events and displaying */
int displayplayer; /* view being displayed */
int gametic;
int totalkills, totalitems, totalsecret; /* for intermission */
//char demoname[32];
boolean demorecording; //80077FD4, uGp00000bc4
boolean demoplayback; //80077EAC, uGp00000a9c
//Hmm por que funciona aqui??
mapthing_t deathmatchstarts[10], *deathmatch_p;//80097e4c, 80077E8C
mapthing_t playerstarts[MAXPLAYERS];//800a8c60
/*
==============
=
= G_DoLoadLevel
=
==============
*/
void G_DoLoadLevel (void) //L80012E04()
{
int i;
P_LoadingPlaque(&loadingpic, 95, 109, palette[16]);
S_Lcd_Load(gamemap);
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
{
if ((gameaction == ga_restart) || (gameaction == ga_warped))
players[i].playerstate = PST_REBORN;
else if (players[i].playerstate == PST_DEAD)
players[i].playerstate = PST_REBORN;
}
}
P_SetupLevel(gamemap, gameskill);
Z_CheckHeap(mainzone);
gameaction = ga_nothing;
//printf("G_DoLoadLevel");
}
/*
==============================================================================
PLAYER STRUCTURE FUNCTIONS
also see P_SpawnPlayer in P_Mobj
==============================================================================
*/
/*
====================
=
= G_PlayerFinishLevel
=
= Can when a player completes a level
====================
*/
void G_PlayerFinishLevel (int player)//L80012ED4()
{
player_t *p;
p = &players[player];
D_memset (p->powers, 0, sizeof (p->powers));
D_memset (p->cards, 0, sizeof (p->cards));
p->mo->flags &= ~(MF_BLENDMASK1|MF_BLENDMASK2|MF_BLENDMASK3); /* cancel invisibility */ //PC DOOM ~MF_SHADOW
p->extralight = 0; /* cancel gun flashes */
p->fixedcolormap = 0; /* cancel ir gogles */
p->damagecount = 0; /* no palette changes */
p->bonuscount = 0;
}
/*
====================
=
= G_PlayerReborn
=
= Called after a player dies
= almost everything is cleared and initialized
====================
*/
void G_PlayerReborn (int player) //L80012F5C()
{
player_t *p;
int i;
int frags, kills, items, secrets;
p = &players[player];
frags = p->frags;
kills = p->killcount;
items = p->itemcount;
secrets = p->secretcount;
D_memset(p, 0, sizeof(*p));
p->health = MAXHEALTH;
p->usedown = p->attackdown = true; // don't do anything immediately
p->playerstate = PST_LIVE;
p->readyweapon = p->pendingweapon = wp_pistol;
p->weaponowned[wp_fist] = true;
p->weaponowned[wp_pistol] = true;
p->ammo[am_clip] = 50;
p->frags = frags;
p->killcount = kills;
p->itemcount = items;
p->secretcount = secrets;
for (i = 0; i < NUMAMMO; i++)
p->maxammo[i] = maxammo[i];
}
/*
====================
=
= G_CheckSpot
=
= Returns false if the player cannot be respawned at the given mapthing_t spot
= because something is occupying it
====================
*/
void P_SpawnPlayer (mapthing_t *mthing);
#if 0
boolean G_CheckSpot (int playernum, mapthing_t *mthing)
{
fixed_t x,y;
subsector_t *ss;
int an;
mobj_t *mo;
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
if (!P_CheckPosition (players[playernum].mo, x, y) )
return false;
ss = R_PointInSubsector (x,y);
an = ( ANG45 * (mthing->angle/45) ) >> ANGLETOFINESHIFT;
/* spawn a teleport fog */
mo = P_SpawnMobj (x+20*finecosine[an], y+20*finesine[an], ss->sector->floorheight
, MT_TFOG);
S_StartSound (mo, sfx_telept);
return true;
}
#endif
/*
====================
=
= G_DeathMatchSpawnPlayer
=
= Spawns a player at one of the random death match spots
= called at level load and each death
====================
*/
#if 0
void G_DeathMatchSpawnPlayer (int playernum)
{
int i,j;
int selections;
selections = deathmatch_p - deathmatchstarts;
if (selections < 4)
I_Error ("Only %i deathmatch spots, 4 required", selections);
for (j=0 ; j<20 ; j++)
{
i = P_Random()%selections;
if (G_CheckSpot (playernum, &deathmatchstarts[i]) )
{
deathmatchstarts[i].type = playernum+1;
P_SpawnPlayer (&deathmatchstarts[i]);
return;
}
}
/* no good spot, so the player will probably get stuck */
P_SpawnPlayer (&playerstarts[playernum]);
}
#endif
/*
====================
=
= G_DoReborn
=
====================
*/
void G_DoReborn (int playernum)//80013044
{
int i, j;
int selections;
fixed_t x, y;
subsector_t *ss;
unsigned int an;
mobj_t *mo;
mapthing_t *mthing;
if (!netgame)
{
gameaction = ga_died; /* reload the level from scratch */
return;
}
/* */
/* respawn this player while the other players keep going */
/* */
if (players[playernum].mo->player != 0)
players[playernum].mo->player = NULL; /* dissasociate the corpse */
/* */
/* default player spawn point */
/* */
mthing = &playerstarts[playernum];
/* */
/* spawn at random spot if in death match */
/* */
if (netgame == gt_deathmatch)
{
selections = (int)(deathmatch_p - deathmatchstarts);
for (j = 0; j < 16; j++)
{
i = P_Random() % selections;
x = deathmatchstarts[i].x << FRACBITS;
y = deathmatchstarts[i].y << FRACBITS;
if (P_CheckPosition(players[playernum].mo, x, y))
{
mthing = &deathmatchstarts[i];
mthing->type = playernum + 1;
break;
}
}
}
else
{
x = playerstarts[playernum].x << FRACBITS;
y = playerstarts[playernum].y << FRACBITS;
/* */
/* try to spawn at one of the other players spots */
/* */
if (!P_CheckPosition(players[playernum].mo, x, y))
{
for (i = 0; i < MAXPLAYERS; i++)
{
x = playerstarts[i].x << FRACBITS;
y = playerstarts[i].y << FRACBITS;
if (P_CheckPosition(players[playernum].mo, x, y))
{
mthing = &playerstarts[i];
mthing->type = playernum + 1;
break;
}
}
}
}
/* */
/* he's going to be inside something. Too bad. */
/* */
P_SpawnPlayer(mthing);
/* */
/* Restore all cooperative starts back to having their previous type, if we modified them. */
/* The co-op spawn logic assumes the type is correct for the corresponding player index. */
/* */
for (i=0 ; ix << FRACBITS;
y = mthing->y << FRACBITS;
/* */
/* This mask wraps the fine angle for the map thing and restricts it to the 8 diagonal directions */
/* */
#define FINE_ANGLE_MASK (FINEANGLES - (FINEANGLES / 8))
ss = R_PointInSubsector(x, y);
an = ((ANG45 * (mthing->angle / 45)) >> ANGLETOFINESHIFT) & FINE_ANGLE_MASK;
/* */
/* spawn a teleport fog */
/* */
mo = P_SpawnMobj(x + 20 * finecosine[an], y + 20 * finesine[an], ss->sector->floorheight, MT_TFOG);
S_StartSound(mo, sfx_telept);
}
/*
====================
=
= G_CompleteLevel
=
====================
*/
void G_CompleteLevel (void)//80013358
{
gameaction = ga_completed;
}
/*============================================================================ */
/*
====================
=
= G_InitNew
=
====================
*/
extern mobj_t emptymobj;//0x800a9c14
boolean restarlevel; //80077E20, uGp00000a10
void G_InitNew (skill_t skill, int map, gametype_t gametype) //L80013368()
{
int i;
//printf ("G_InitNew, skill %d, map %d\n", skill, map);
restarlevel = false;
V_PagFlags &= 1;
Valloc_Init();
Z_FreeTags(mainzone, (PU_LEVEL | PU_LEVSPEC | PU_ANIMATION | PU_CACHE));
M_ClearRandom ();
/* force players to be initialized upon first level load */
//for (i=0 ; i= 0 ; i--)
{
players[i].playerstate = PST_REBORN;
}
/* these may be reset by I_NetSetup */
gamemap = map;
netgame = gametype;
gameskill = skill;
D_memset(&emptymobj, 0, sizeof(emptymobj));
players[0].mo = players[1].mo = &emptymobj; /* for net consistancy checks */
playeringame[0] = true;
if (netgame == gt_single)
{
playeringame[1] = false;
BT_DATA[0] = (buttons_t *)ActualConfiguration;
}
else if (netgame <= gt_deathmatch)
{
playeringame[1] = true;
}
demorecording = false;
demoplayback = false;
if (skill == sk_nightmare)
{
states[S_SARG_ATK1].tics = 2;
states[S_SARG_ATK2].tics = 2;
states[S_SARG_ATK3].tics = 2;
mobjinfo[MT_SERGEANT].speed = 15;
mobjinfo[MT_BRUISERSHOT].speed = 40*FRACUNIT;
mobjinfo[MT_HEADSHOT].speed = 40*FRACUNIT;
mobjinfo[MT_TROOPSHOT].speed = 40*FRACUNIT;
}
else
{
states[S_SARG_ATK1].tics = 4;
states[S_SARG_ATK2].tics = 4;
states[S_SARG_ATK3].tics = 4;
mobjinfo[MT_SERGEANT].speed = 10;
mobjinfo[MT_BRUISERSHOT].speed = 30*FRACUNIT;
mobjinfo[MT_HEADSHOT].speed = 20*FRACUNIT;
mobjinfo[MT_TROOPSHOT].speed = 20*FRACUNIT;
}
}
/*============================================================================ */
/*
=================
=
= G_RunGame
=
= The game should allready have been initialized or laoded
=================
*/
void G_RunGame (void)//L800134FC()
{
int i;
while (1)
{
/* load a level */
G_DoLoadLevel ();
//printf("RUN P_Start\n");
/* run a level until death or completion */
MiniLoop (P_Start, P_Stop, P_Ticker, P_Drawer);
restarlevel = false;
if (gameaction == ga_recorddemo)
{
G_RecordDemo();
}
if(gameaction == ga_warped)
continue; // skip intermission
if ((gameaction == ga_died) || (gameaction == ga_restart))
{
restarlevel = true;
continue; /* died, so restart the level */
}
/* free all animation states graphics*/
V_PagFlags &= 1;
Z_FreeTags(mainzone, PU_ANIMATION);
if (gameaction == ga_exitdemo)
return;
/* run a stats intermission */
MiniLoop(IN_Start,IN_Stop,IN_Ticker,IN_Drawer);
if ((!netgame && (gamemap == 30)) && (nextmap == 31))
{
/* run the finale if needed */
MiniLoop(END1_Start,END1_Stop,END1_Ticker,END1_Drawer);
if(gameaction == ga_warped)
continue; // skip intermission
if(gameaction == ga_restart)
continue;
else
{
if (gameaction != ga_exitdemo)
startmap = 2;
return;
}
}
else
{
if (nextmap > LASTLEVEL)
{
/* run the finale if needed */
MiniLoop(Cast_Start, Cast_Stop, Cast_Ticker, Cast_Drawer);
if(gameaction == ga_warped)
continue; // skip intermission
if(gameaction == ga_restart)
continue;
else
return;
}
gamemap = nextmap;
}
}
}
int G_PlayDemoPtr (void)//(int *demo) L800136E8()
{
int exit;
int skill, map;
int config[8];
skill = BIGLONG(demo_p[0]);
map = BIGLONG(demo_p[1]);
demobuffer = demo_p + 2;
//copy key configuration
D_memcpy(config, ActualConfiguration, sizeof(config));
//set new key configuration
D_memcpy(ActualConfiguration, demobuffer, sizeof(config));
demobuffer += 8;
G_InitNew (skill, map, gt_single);
G_DoLoadLevel ();
demoplayback = true;
exit = MiniLoop (P_Start, P_Stop, P_Ticker, P_Drawer);
demoplayback = false;
//restore key configuration
D_memcpy(ActualConfiguration, config, sizeof(config));
V_PagFlags &= 1;
Z_FreeTags(mainzone, (PU_LEVEL | PU_LEVSPEC | PU_ANIMATION | PU_CACHE));
return exit;
}
/*
=================
=
= G_RecordDemo
=
=================
*/
void G_RecordDemo (void)//8001380C
{
#if 0
demo_p = demobuffer = Z_Malloc (0x8000, PU_STATIC, NULL);
*demo_p++ = startskill;
*demo_p++ = startmap;
G_InitNew (startskill, startmap, gt_single);
G_DoLoadLevel ();
demorecording = true;
MiniLoop (P_Start, P_Stop, P_Ticker, P_Drawer);
demorecording = false;
D_printf ("w %x,%x",demobuffer,demo_p);
while (1)
{
G_PlayDemoPtr (demobuffer);
D_printf ("w %x,%x",demobuffer,demo_p);
}
#endif
}
================================================
FILE: PSXDOOM/in_main.c
================================================
/* in_main.c -- intermission */
#include "doomdef.h"
#include "st_main.h"
#include "r_local.h"
#define KVALX 172
#define KVALY 80
#define IVALX 172
#define IVALY 110
#define SVALX 172
#define SVALY 140
#define FVALX 230
#define FVALY 74
#define PLAYERONEFACEX 137
#define PLAYERONEFACEY 30
#define PLAYERTWOFACEX 217
#define PLAYERTWOFACEY 30
extern int nextmap;
typedef struct pstats_s
{
int killpercent;
int itempercent;
int secretpercent;
int fragcount;
} pstats_t;
//psx
char mapnames[][32] =
{
//Ultimate Doom
"Hangar",
"Plant",
"Toxin Refinery",
"Command Control",
"Phobos Lab",
"Central Processing",
"Computer Station",
"Phobos Anomaly",
"Deimos Anomaly",
"Containment Area",
"Refinery",
"Deimos Lab",
"Command Center",
"Halls of the Damned",
"Spawning Vats",
"Hell Gate",
"Hell Keep",
"Pandemonium",
"House of Pain",
"Unholy Cathedral",
"Mt. Erebus",
"Limbo",
"Tower Of Babel",
"Hell Beneath",
"Perfect Hatred",
"Sever The Wicked",
"Unruly Evil",
"Unto The Cruel",
"Twilight Descends",
"Threshold of Pain",
//Doom II
"Entryway",
"Underhalls",
"The Gantlet",
"The Focus",
"The Waste Tunnels",
"The Crusher",
"Dead Simple",
"Tricks And Traps",
"The Pit",
"Refueling Base",
"O of Destruction!",
"The Factory",
"The Inmost Dens",
"Suburbs",
"Tenements",
"The Courtyard",
"The Citadel",
"Nirvana",
"The Catacombs",
"Barrels of Fun",
"Bloodfalls",
"The Abandoned Mines",
"Monster Condo",
"Redemption Denied",
//Secret Levels
"Fortress of Mystery",
"The Military Base",
"The Marshes",
"The Mansion",
"Club Doom"
};
pstats_t pstats[MAXPLAYERS];//0x80097a04
int killvalue[2], itemvalue[2], secretvalue[2], fragvalue[2];//800780C4,800780D0,80077E08,8007808C
// used to accelerate or skip a stage
int acceleratestage;//80078100|uGp00000cf0
extern char *passwordChar;//80073B7C
extern byte Passwordbuff[12];//0x80096388
extern boolean doPassword;//80077A6C
#if GH_UPDATES == 1
extern int CurPasswordSlot;//80077A70 iGp00000660
#endif // GH_UPDATES
void IN_Start(void)//L8003C4D4()
{
int i, l;
Valloc_Init();
ImageToVram(&backpic, "BACK", 0);
for (i = 0; i < MAXPLAYERS; i++)
{
killvalue[i] = itemvalue[i] = secretvalue[i] = fragvalue[i] = 0;
if (totalkills)
pstats[i].killpercent = (players[i].killcount * 100) / totalkills;
else
pstats[i].killpercent = 100;
if (totalitems)
pstats[i].itempercent = (players[i].itemcount * 100) / totalitems;
else
pstats[i].itempercent = 100;
if (totalsecret)
pstats[i].secretpercent = (players[i].secretcount * 100) / totalsecret;
else
pstats[i].secretpercent = 100;
if (netgame == gt_deathmatch)
pstats[i].fragcount = players[i].frags;
}
acceleratestage = 0;
last_ticon = ticon;
if (nextmap < LASTLEVEL)
{
Encode_Password(Passwordbuff);
#if GH_UPDATES == 1
/* This causes passwords to be kept in the password selection menu and not deleted at the next level. */
CurPasswordSlot = 10;
#endif // GH_UPDATES
}
psxcd_play_at_andloop(CD_TRACK[cdmusic_intermission],CDVolume,0,0,CD_TRACK[cdmusic_intermission],CDVolume,0,0);
do {} while (psxcd_elapsed_sectors() == 0);
}
void IN_Stop(int exit)//L8003C7D4()
{
IN_Drawer();
psxcd_stop();
}
int IN_Ticker(void)//L8003C7FC()
{
int i, j, playsound;
int buttons, oldbuttons;
if ((ticon - last_ticon) > 60)
{
for (i = 0; i < MAXPLAYERS; i++)
{
buttons = ticbuttons[i];
oldbuttons = oldticbuttons[i];
if ((buttons != oldbuttons) && (buttons & PAD_ACTION))
{
acceleratestage++;
if (acceleratestage == 1)
{
for (j = 0; j < MAXPLAYERS; j++)
{
killvalue[j] = pstats[j].killpercent;
itemvalue[j] = pstats[j].itempercent;
secretvalue[j] = pstats[j].secretpercent;
fragvalue[j] = pstats[j].fragcount;
}
S_StartSound(NULL, sfx_barexp);
}
if (acceleratestage > 1)
{
S_StartSound(NULL, sfx_barexp);
return ga_died;
}
}
if (netgame == gt_single)
break;
}
playsound = false;
if (gamevbls >= gametic)
return ga_nothing;
for (i = 0; i < MAXPLAYERS; i++)
{
if (netgame != gt_deathmatch)
{
if (killvalue[i] < pstats[i].killpercent)
{
killvalue[i] += 2;
playsound = true;
if (killvalue[i] > pstats[i].killpercent)
killvalue[i] = pstats[i].killpercent;
}
if (itemvalue[i] < pstats[i].itempercent)
{
itemvalue[i] += 2;
playsound = true;
if (itemvalue[i] > pstats[i].itempercent)
itemvalue[i] = pstats[i].itempercent;
}
if (secretvalue[i] < pstats[i].secretpercent)
{
secretvalue[i] += 2;
playsound = true;
if (secretvalue[i] > pstats[i].secretpercent)
secretvalue[i] = pstats[i].secretpercent;
}
}
else
{
if (pstats[i].fragcount < 0)
{
if (pstats[i].fragcount < fragvalue[i])
{
fragvalue[i] -= 2;
playsound = true;
if (pstats[i].fragcount > fragvalue[i])
fragvalue[i] = pstats[i].fragcount;
}
}
else
{
if (fragvalue[i] < pstats[i].fragcount)
{
fragvalue[i] += 2;
playsound = true;
if (fragvalue[i] > pstats[i].fragcount)
fragvalue[i] = pstats[i].fragcount;
}
}
}
}
// Play Sound sfx_barexp
if (!playsound && (acceleratestage == 0))
{
acceleratestage = 1;
S_StartSound(NULL, sfx_barexp);
}
// Play Sound sfx_pistol
if (!(gametic & 1) && playsound)
{
S_StartSound(NULL, sfx_pistol);
}
}
return ga_nothing;
}
void IN_SingleDrawer(void);
void IN_CooperativeDrawer(void);
void IN_DeathMachtDrawer(void);
void IN_Drawer(void)//L8003CBE0()
{
NextTextureCacheIdx();
if (netgame == gt_coop)
IN_CooperativeDrawer();
else if (netgame == gt_deathmatch)
IN_DeathMachtDrawer();
else
IN_SingleDrawer();
UpdateDrawOTag();
DrawRender();
}
/* */
/* Single intermision */
/* */
void IN_SingleDrawer(void)//L8003CC54()
{
int i;
char password[16];
DrawStaticImage(&backpic, 0, 0, palette[0]);
ST_DrawText(-1, 20, mapnames[gamemap-1]);
ST_DrawText(-1, 36, "Finished");
ST_DrawText(57, 65, "Kills");
ST_DrawText(182, 65, "%");
ST_DrawValue(170, 65, killvalue[0]);
ST_DrawText(53, 91, "Items");
ST_DrawText(182, 91, "%");
ST_DrawValue(170, 91, itemvalue[0]);
ST_DrawText(26, 117, "Secrets");
ST_DrawText(182, 117, "%");
ST_DrawValue(170, 117, secretvalue[0]);
if (nextmap < LASTLEVEL)
{
ST_DrawText(-1, 145, "Entering");
ST_DrawText(-1, 161, mapnames[nextmap-1]);
ST_DrawText(-1, 187, "Password");
for (i = 0; i < 10; i++)
{
password[i] = passwordChar[Passwordbuff[i]];
}
password[i] = 0;
ST_DrawText(-1, 203, password);
}
}
/* */
/* Network Cooperative intermission */
/* */
void IN_CooperativeDrawer(void)//L8003CE24()
{
int i;
char password[16];
DrawStaticImage(&backpic, 0, 0, palette[0]);
DrawImage(statuspic.vtpage, palette[16], 139, 20, facedata[0].x, facedata[0].y, facedata[0].w, facedata[0].h);
ST_DrawText(130, 52, "you");
DrawImage(statuspic.vtpage, palette[16], 213, 20, facedata[0].x, facedata[0].y, facedata[0].w, facedata[0].h);
ST_DrawText(208, 52, "him");
ST_DrawText(57, 79, "Kills");
ST_DrawText(155, 79, "%");
ST_DrawText(228, 79, "%");
ST_DrawValue(143, 79, killvalue[consoleplayer]);
ST_DrawValue(216, 79, killvalue[(consoleplayer == 0) ? 1 : 0]);
ST_DrawText(53, 101, "Items");
ST_DrawText(155, 101, "%");
ST_DrawText(228, 101, "%");
ST_DrawValue(143, 101, itemvalue[consoleplayer]);
ST_DrawValue(216, 101, itemvalue[(consoleplayer == 0) ? 1 : 0]);
ST_DrawText(26, 123, "Secrets");
ST_DrawText(155, 123, "%");
ST_DrawText(228, 123, "%");
ST_DrawValue(143, 123, secretvalue[consoleplayer]);
ST_DrawValue(216, 123, secretvalue[(consoleplayer == 0) ? 1 : 0]);
if (nextmap < LASTLEVEL)
{
ST_DrawText(-1, 149, "Entering");
ST_DrawText(-1, 165, mapnames[nextmap-1]);
if (players[consoleplayer].health > 0)
{
ST_DrawText(-1, 191, "Password");
for (i = 0; i < 10; i++)
{
password[i] = passwordChar[Passwordbuff[i]];
}
password[i] = 0;
ST_DrawText(-1, 207, password);
}
}
}
/* */
/* Network Death Macht intermission */
/* */
void IN_DeathMachtDrawer(void)//L8003D1B8()
{
int i;
facedata_t *player1, *player2;
DrawStaticImage(&backpic, 0, 0, palette[0]);
ST_DrawText(-1, 20, mapnames[gamemap-1]);
ST_DrawText(-1, 36, "Finished");
if (fragvalue[1] < fragvalue[0])
{
if (consoleplayer == 0)
{
player1 = &facedata[EVILFACE];
player2 = &facedata[DEADFACE];
}
else
{
player1 = &facedata[DEADFACE];
player2 = &facedata[EVILFACE];
}
}
else if (fragvalue[0] < fragvalue[1])
{
if (consoleplayer == 0)
{
player1 = &facedata[DEADFACE];
player2 = &facedata[EVILFACE];
}
else
{
player1 = &facedata[EVILFACE];
player2 = &facedata[DEADFACE];
}
}
else if(fragvalue[1] == fragvalue[0])
{
player1 = &facedata[0];
player2 = &facedata[0];
}
DrawImage(statuspic.vtpage, palette[16], 127, 70, player1->x, player1->y, player1->w, player1->h);
ST_DrawText(118, 102, "you");
DrawImage(statuspic.vtpage, palette[16], 200, 70, player2->x, player2->y, player2->w, player2->h);
ST_DrawText(195, 102, "him");
ST_DrawText(35, 139, "Frags");
ST_DrawValue(133, 138, fragvalue[consoleplayer]);
ST_DrawValue(206, 138, fragvalue[(consoleplayer == 0) ? 1 : 0]);
if (nextmap < LASTLEVEL)
{
ST_DrawText(-1, 190, "Entering");
ST_DrawText(-1, 206, mapnames[nextmap-1]);
}
}
================================================
FILE: PSXDOOM/info.c
================================================
#include "doomdef.h"
/* generated by multigen */
char *sprnames[NUMSPRITES] = {//800778B4
"TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",
"MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2",
"BAL7","PLSS","PLSE","MISL","BFS1","BFE1","BFE2","TFOG","IFOG","PLAY",
"POSS","SPOS","FATB","FBXP","SKEL","MANF","FATT","CPOS","SARG","HEAD",
"BOSS","BOS2","SKUL","SPID","BSPI","APLS","APBX","CYBR","PAIN","ARM1",
"ARM2","BAR1","BEXP","FCAN","BON1","BON2","BKEY","RKEY","YKEY","BSKU",
"RSKU","YSKU","STIM","MEDI","SOUL","PINV","PSTR","PINS","MEGA","SUIT",
"PMAP","PVIS","CLIP","AMMO","ROCK","BROK","CELL","CELP","SHEL","SBOX",
"BPAK","BFUG","MGUN","CSAW","LAUN","PLAS","SHOT","SGN2","COLU","SMT2",
"POL2","POL5","POL4","POL1","GOR2","GOR3","GOR4","GOR5","SMIT","COL1",
"COL2","COL3","COL4","COL6","CAND","CBRA","TRE1","ELEC","FSKU","SMBT",
"SMGT","SMRT","HANC","BLCH","HANL","DED1","DED2","DED3","DED4","DED5",
"DED6","TLMP","TLP2","COL5","CEYE","TBLU","TGRN","TRED","GOR1","POL3",
"POL6","TRE2","HDB1","HDB2","HDB3","HDB4","HDB5","HDB6","POB1","POB2",
"BRS1"
};
void A_WeaponReady();
void A_ReFire();
void A_CheckReload();
void A_Lower();
void A_Raise();
void A_GunFlash();
void A_Punch();
void A_Saw();
void A_FireMissile();
void A_FireBFG();
void A_FirePlasma();
void A_FirePistol();
void A_FireShotgun();
void A_FireShotgun2();
void A_FireCGun();
void A_Light0();
void A_Light1();
void A_Light2();
void A_BFGSpray();
void A_BFGsound();
void A_OpenShotgun2();
void A_LoadShotgun2();
void A_CloseShotgun2();
void A_Look();
void A_Chase();
void A_FaceTarget();
void A_PosAttack();
void A_SPosAttack();
void A_CPosAttack();
void A_CPosRefire();
void A_SpidAttack();
void A_SpidRefire();
void A_BspiAttack();
void A_TroopAttack();
void A_SargAttack();
void A_HeadAttack();
void A_CyberAttack();
void A_BruisAttack();
void A_SkelMissile();
void A_Tracer();
void A_SkelWhoosh();
void A_SkelFist();
void A_FatRaise();
void A_FatAttack1();
void A_FatAttack2();
void A_FatAttack3();
void A_SkullAttack();
void A_PainShootSkull();
void A_PainAttack();
void A_PainDie();
void A_Scream();
void A_XScream();
void A_Pain();
void A_Fall();
void A_Explode();
void A_BossDeath();
void A_Hoof();
void A_Metal();
void A_BabyMetal();
state_t states[NUMSTATES] = //80058BBC
{
{ SPR_TROO,0,-1,NULL,S_NULL,0,0 }, /* S_NULL */
{ SPR_SHTG,4,0,A_Light0,S_NULL,0,0 }, /* S_LIGHTDONE */
{ SPR_PUNG,0,1,A_WeaponReady,S_PUNCH,0,0 }, /* S_PUNCH */
{ SPR_PUNG,0,1,A_Lower,S_PUNCHDOWN,0,0 }, /* S_PUNCHDOWN */
{ SPR_PUNG,0,1,A_Raise,S_PUNCHUP,0,0 }, /* S_PUNCHUP */
{ SPR_PUNG,1,2,NULL,S_PUNCH2,0,0 }, /* S_PUNCH1 */
{ SPR_PUNG,2,2,A_Punch,S_PUNCH3,0,0 }, /* S_PUNCH2 */
{ SPR_PUNG,3,2,NULL,S_PUNCH4,0,0 }, /* S_PUNCH3 */
{ SPR_PUNG,2,2,NULL,S_PUNCH5,0,0 }, /* S_PUNCH4 */
{ SPR_PUNG,1,2,A_ReFire,S_PUNCH,0,0 }, /* S_PUNCH5 */
{ SPR_PISG,0,1,A_WeaponReady,S_PISTOL,0,0 }, /* S_PISTOL */
{ SPR_PISG,0,1,A_Lower,S_PISTOLDOWN,0,0 }, /* S_PISTOLDOWN */
{ SPR_PISG,0,1,A_Raise,S_PISTOLUP,0,0 }, /* S_PISTOLUP */
{ SPR_PISG,0,2,NULL,S_PISTOL2,0,0 }, /* S_PISTOL1 */
{ SPR_PISG,1,3,A_FirePistol,S_PISTOL3,0,0 }, /* S_PISTOL2 */
{ SPR_PISG,2,3,NULL,S_PISTOL4,0,0 }, /* S_PISTOL3 */
{ SPR_PISG,1,2,A_ReFire,S_PISTOL,0,0 }, /* S_PISTOL4 */
{ SPR_PISF,32768,3,A_Light1,S_LIGHTDONE,0,0 }, /* S_PISTOLFLASH */
{ SPR_SHTG,0,1,A_WeaponReady,S_SGUN,0,0 }, /* S_SGUN */
{ SPR_SHTG,0,1,A_Lower,S_SGUNDOWN,0,0 }, /* S_SGUNDOWN */
{ SPR_SHTG,0,1,A_Raise,S_SGUNUP,0,0 }, /* S_SGUNUP */
{ SPR_SHTG,0,2,NULL,S_SGUN2,0,0 }, /* S_SGUN1 */
{ SPR_SHTG,0,2,A_FireShotgun,S_SGUN3,0,0 }, /* S_SGUN2 */
{ SPR_SHTG,1,3,NULL,S_SGUN4,0,0 }, /* S_SGUN3 */
{ SPR_SHTG,2,2,NULL,S_SGUN5,0,0 }, /* S_SGUN4 */
{ SPR_SHTG,3,2,NULL,S_SGUN6,0,0 }, /* S_SGUN5 */
{ SPR_SHTG,2,2,NULL,S_SGUN7,0,0 }, /* S_SGUN6 */
{ SPR_SHTG,1,2,NULL,S_SGUN8,0,0 }, /* S_SGUN7 */
{ SPR_SHTG,0,2,NULL,S_SGUN9,0,0 }, /* S_SGUN8 */
{ SPR_SHTG,0,3,A_ReFire,S_SGUN,0,0 }, /* S_SGUN9 */
{ SPR_SHTF,32768,2,A_Light1,S_SGUNFLASH2,0,0 }, /* S_SGUNFLASH1 */
{ SPR_SHTF,32769,1,A_Light2,S_LIGHTDONE,0,0 }, /* S_SGUNFLASH2 */
{ SPR_SHT2,0,1,A_WeaponReady,S_DSGUN,0,0 }, /* S_DSGUN */
{ SPR_SHT2,0,1,A_Lower,S_DSGUNDOWN,0,0 }, /* S_DSGUNDOWN */
{ SPR_SHT2,0,1,A_Raise,S_DSGUNUP,0,0 }, /* S_DSGUNUP */
{ SPR_SHT2,0,2,NULL,S_DSGUN2,0,0 }, /* S_DSGUN1 */
{ SPR_SHT2,0,3,A_FireShotgun2,S_DSGUN3,0,0 }, /* S_DSGUN2 */
{ SPR_SHT2,1,3,NULL,S_DSGUN4,0,0 }, /* S_DSGUN3 */
{ SPR_SHT2,2,3,A_CheckReload,S_DSGUN5,0,0 }, /* S_DSGUN4 */
{ SPR_SHT2,3,3,A_OpenShotgun2,S_DSGUN6,0,0 }, /* S_DSGUN5 */
{ SPR_SHT2,4,3,NULL,S_DSGUN7,0,0 }, /* S_DSGUN6 */
{ SPR_SHT2,5,3,A_LoadShotgun2,S_DSGUN8,0,0 }, /* S_DSGUN7 */
{ SPR_SHT2,6,2,NULL,S_DSGUN9,0,0 }, /* S_DSGUN8 */
{ SPR_SHT2,7,2,A_CloseShotgun2,S_DSGUN10,0,0 }, /* S_DSGUN9 */
{ SPR_SHT2,0,2,A_ReFire,S_DSGUN,0,0 }, /* S_DSGUN10 */
{ SPR_SHT2,1,3,NULL,S_DSNR2,0,0 }, /* S_DSNR1 */
{ SPR_SHT2,0,1,NULL,S_DSGUNDOWN,0,0 }, /* S_DSNR2 */
{ SPR_SHT2,32776,2,A_Light1,S_DSGUNFLASH2,0,0 }, /* S_DSGUNFLASH1 */
{ SPR_SHT2,32777,2,A_Light2,S_LIGHTDONE,0,0 }, /* S_DSGUNFLASH2 */
{ SPR_CHGG,0,1,A_WeaponReady,S_CHAIN,0,0 }, /* S_CHAIN */
{ SPR_CHGG,0,1,A_Lower,S_CHAINDOWN,0,0 }, /* S_CHAINDOWN */
{ SPR_CHGG,0,1,A_Raise,S_CHAINUP,0,0 }, /* S_CHAINUP */
{ SPR_CHGG,0,2,A_FireCGun,S_CHAIN2,0,0 }, /* S_CHAIN1 */
{ SPR_CHGG,1,2,A_FireCGun,S_CHAIN3,0,0 }, /* S_CHAIN2 */
{ SPR_CHGG,1,0,A_ReFire,S_CHAIN,0,0 }, /* S_CHAIN3 */
{ SPR_CHGF,32768,3,A_Light1,S_LIGHTDONE,0,0 }, /* S_CHAINFLASH1 */
{ SPR_CHGF,32769,2,A_Light2,S_LIGHTDONE,0,0 }, /* S_CHAINFLASH2 */
{ SPR_MISG,0,1,A_WeaponReady,S_MISSILE,0,0 }, /* S_MISSILE */
{ SPR_MISG,0,1,A_Lower,S_MISSILEDOWN,0,0 }, /* S_MISSILEDOWN */
{ SPR_MISG,0,1,A_Raise,S_MISSILEUP,0,0 }, /* S_MISSILEUP */
{ SPR_MISG,1,4,A_GunFlash,S_MISSILE2,0,0 }, /* S_MISSILE1 */
{ SPR_MISG,1,6,A_FireMissile,S_MISSILE3,0,0 }, /* S_MISSILE2 */
{ SPR_MISG,1,0,A_ReFire,S_MISSILE,0,0 }, /* S_MISSILE3 */
{ SPR_MISF,32768,2,A_Light1,S_MISSILEFLASH2,0,0 }, /* S_MISSILEFLASH1 */
{ SPR_MISF,32769,2,NULL,S_MISSILEFLASH3,0,0 }, /* S_MISSILEFLASH2 */
{ SPR_MISF,32770,2,A_Light2,S_MISSILEFLASH4,0,0 }, /* S_MISSILEFLASH3 */
{ SPR_MISF,32771,2,A_Light2,S_LIGHTDONE,0,0 }, /* S_MISSILEFLASH4 */
{ SPR_SAWG,2,2,A_WeaponReady,S_SAWB,0,0 }, /* S_SAW */
{ SPR_SAWG,3,2,A_WeaponReady,S_SAW,0,0 }, /* S_SAWB */
{ SPR_SAWG,2,1,A_Lower,S_SAWDOWN,0,0 }, /* S_SAWDOWN */
{ SPR_SAWG,2,1,A_Raise,S_SAWUP,0,0 }, /* S_SAWUP */
{ SPR_SAWG,0,2,A_Saw,S_SAW2,0,0 }, /* S_SAW1 */
{ SPR_SAWG,1,2,A_Saw,S_SAW3,0,0 }, /* S_SAW2 */
{ SPR_SAWG,1,0,A_ReFire,S_SAW,0,0 }, /* S_SAW3 */
{ SPR_PLSG,0,1,A_WeaponReady,S_PLASMA,0,0 }, /* S_PLASMA */
{ SPR_PLSG,0,1,A_Lower,S_PLASMADOWN,0,0 }, /* S_PLASMADOWN */
{ SPR_PLSG,0,1,A_Raise,S_PLASMAUP,0,0 }, /* S_PLASMAUP */
{ SPR_PLSG,0,2,A_FirePlasma,S_PLASMA2,0,0 }, /* S_PLASMA1 */
{ SPR_PLSG,1,10,A_ReFire,S_PLASMA,0,0 }, /* S_PLASMA2 */
{ SPR_PLSF,32768,2,A_Light1,S_LIGHTDONE,0,0 }, /* S_PLASMAFLASH1 */
{ SPR_PLSF,32769,2,A_Light1,S_LIGHTDONE,0,0 }, /* S_PLASMAFLASH2 */
{ SPR_BFGG,0,1,A_WeaponReady,S_BFG,0,0 }, /* S_BFG */
{ SPR_BFGG,0,1,A_Lower,S_BFGDOWN,0,0 }, /* S_BFGDOWN */
{ SPR_BFGG,0,1,A_Raise,S_BFGUP,0,0 }, /* S_BFGUP */
{ SPR_BFGG,0,10,A_BFGsound,S_BFG2,0,0 }, /* S_BFG1 */
{ SPR_BFGG,1,5,A_GunFlash,S_BFG3,0,0 }, /* S_BFG2 */
{ SPR_BFGG,1,5,A_FireBFG,S_BFG4,0,0 }, /* S_BFG3 */
{ SPR_BFGG,1,10,A_ReFire,S_BFG,0,0 }, /* S_BFG4 */
{ SPR_BFGF,32768,5,A_Light1,S_BFGFLASH2,0,0 }, /* S_BFGFLASH1 */
{ SPR_BFGF,32769,3,A_Light2,S_LIGHTDONE,0,0 }, /* S_BFGFLASH2 */
{ SPR_BLUD,2,4,NULL,S_BLOOD2,0,0 }, /* S_BLOOD1 */
{ SPR_BLUD,1,4,NULL,S_BLOOD3,0,0 }, /* S_BLOOD2 */
{ SPR_BLUD,0,4,NULL,S_NULL,0,0 }, /* S_BLOOD3 */
{ SPR_PUFF,32768,2,NULL,S_PUFF2,0,0 }, /* S_PUFF1 */
{ SPR_PUFF,1,2,NULL,S_PUFF3,0,0 }, /* S_PUFF2 */
{ SPR_PUFF,2,2,NULL,S_PUFF4,0,0 }, /* S_PUFF3 */
{ SPR_PUFF,3,2,NULL,S_NULL,0,0 }, /* S_PUFF4 */
{ SPR_BAL1,32768,2,NULL,S_TBALL2,0,0 }, /* S_TBALL1 */
{ SPR_BAL1,32769,2,NULL,S_TBALL1,0,0 }, /* S_TBALL2 */
{ SPR_BAL1,32770,3,NULL,S_TBALLX2,0,0 }, /* S_TBALLX1 */
{ SPR_BAL1,32771,3,NULL,S_TBALLX3,0,0 }, /* S_TBALLX2 */
{ SPR_BAL1,32772,3,NULL,S_NULL,0,0 }, /* S_TBALLX3 */
{ SPR_BAL2,32768,2,NULL,S_RBALL2,0,0 }, /* S_RBALL1 */
{ SPR_BAL2,32769,2,NULL,S_RBALL1,0,0 }, /* S_RBALL2 */
{ SPR_BAL2,32770,3,NULL,S_RBALLX2,0,0 }, /* S_RBALLX1 */
{ SPR_BAL2,32771,3,NULL,S_RBALLX3,0,0 }, /* S_RBALLX2 */
{ SPR_BAL2,32772,3,NULL,S_NULL,0,0 }, /* S_RBALLX3 */
{ SPR_BAL7,32768,2,NULL,S_BRBALL2,0,0 }, /* S_BRBALL1 */
{ SPR_BAL7,32769,2,NULL,S_BRBALL1,0,0 }, /* S_BRBALL2 */
{ SPR_BAL7,32770,3,NULL,S_BRBALLX2,0,0 }, /* S_BRBALLX1 */
{ SPR_BAL7,32771,3,NULL,S_BRBALLX3,0,0 }, /* S_BRBALLX2 */
{ SPR_BAL7,32772,3,NULL,S_NULL,0,0 }, /* S_BRBALLX3 */
{ SPR_PLSS,32768,3,NULL,S_PLASBALL2,0,0 }, /* S_PLASBALL */
{ SPR_PLSS,32769,3,NULL,S_PLASBALL,0,0 }, /* S_PLASBALL2 */
{ SPR_PLSE,32768,2,NULL,S_PLASEXP2,0,0 }, /* S_PLASEXP */
{ SPR_PLSE,32769,2,NULL,S_PLASEXP3,0,0 }, /* S_PLASEXP2 */
{ SPR_PLSE,32770,2,NULL,S_PLASEXP4,0,0 }, /* S_PLASEXP3 */
{ SPR_PLSE,32771,2,NULL,S_PLASEXP5,0,0 }, /* S_PLASEXP4 */
{ SPR_PLSE,32772,2,NULL,S_NULL,0,0 }, /* S_PLASEXP5 */
{ SPR_MISL,32768,1,NULL,S_ROCKET,0,0 }, /* S_ROCKET */
{ SPR_BFS1,32768,2,NULL,S_BFGSHOT2,0,0 }, /* S_BFGSHOT */
{ SPR_BFS1,32769,2,NULL,S_BFGSHOT,0,0 }, /* S_BFGSHOT2 */
{ SPR_BFE1,32768,4,NULL,S_BFGLAND2,0,0 }, /* S_BFGLAND */
{ SPR_BFE1,32769,4,NULL,S_BFGLAND3,0,0 }, /* S_BFGLAND2 */
{ SPR_BFE1,32770,4,A_BFGSpray,S_BFGLAND4,0,0 }, /* S_BFGLAND3 */
{ SPR_BFE1,32771,4,NULL,S_BFGLAND5,0,0 }, /* S_BFGLAND4 */
{ SPR_BFE1,32772,4,NULL,S_BFGLAND6,0,0 }, /* S_BFGLAND5 */
{ SPR_BFE1,32773,4,NULL,S_NULL,0,0 }, /* S_BFGLAND6 */
{ SPR_BFE2,32768,4,NULL,S_BFGEXP2,0,0 }, /* S_BFGEXP */
{ SPR_BFE2,32769,4,NULL,S_BFGEXP3,0,0 }, /* S_BFGEXP2 */
{ SPR_BFE2,32770,4,NULL,S_BFGEXP4,0,0 }, /* S_BFGEXP3 */
{ SPR_BFE2,32771,4,NULL,S_NULL,0,0 }, /* S_BFGEXP4 */
{ SPR_MISL,32769,4,A_Explode,S_EXPLODE2,0,0 }, /* S_EXPLODE1 */
{ SPR_MISL,32770,3,NULL,S_EXPLODE3,0,0 }, /* S_EXPLODE2 */
{ SPR_MISL,32771,2,NULL,S_NULL,0,0 }, /* S_EXPLODE3 */
{ SPR_TFOG,32768,3,NULL,S_TFOG01,0,0 }, /* S_TFOG */
{ SPR_TFOG,32769,3,NULL,S_TFOG02,0,0 }, /* S_TFOG01 */
{ SPR_TFOG,32768,3,NULL,S_TFOG2,0,0 }, /* S_TFOG02 */
{ SPR_TFOG,32769,3,NULL,S_TFOG3,0,0 }, /* S_TFOG2 */
{ SPR_TFOG,32770,3,NULL,S_TFOG4,0,0 }, /* S_TFOG3 */
{ SPR_TFOG,32771,3,NULL,S_TFOG5,0,0 }, /* S_TFOG4 */
{ SPR_TFOG,32772,3,NULL,S_TFOG6,0,0 }, /* S_TFOG5 */
{ SPR_TFOG,32773,3,NULL,S_TFOG7,0,0 }, /* S_TFOG6 */
{ SPR_TFOG,32774,3,NULL,S_TFOG8,0,0 }, /* S_TFOG7 */
{ SPR_TFOG,32775,3,NULL,S_TFOG9,0,0 }, /* S_TFOG8 */
{ SPR_TFOG,32776,3,NULL,S_TFOG10,0,0 }, /* S_TFOG9 */
{ SPR_TFOG,32777,3,NULL,S_NULL,0,0 }, /* S_TFOG10 */
{ SPR_IFOG,32768,3,NULL,S_IFOG01,0,0 }, /* S_IFOG */
{ SPR_IFOG,32769,3,NULL,S_IFOG02,0,0 }, /* S_IFOG01 */
{ SPR_IFOG,32768,3,NULL,S_IFOG2,0,0 }, /* S_IFOG02 */
{ SPR_IFOG,32769,3,NULL,S_IFOG3,0,0 }, /* S_IFOG2 */
{ SPR_IFOG,32770,3,NULL,S_IFOG4,0,0 }, /* S_IFOG3 */
{ SPR_IFOG,32771,3,NULL,S_IFOG5,0,0 }, /* S_IFOG4 */
{ SPR_IFOG,32772,3,NULL,S_NULL,0,0 }, /* S_IFOG5 */
{ SPR_PLAY,0,-1,NULL,S_NULL,0,0 }, /* S_PLAY */
{ SPR_PLAY,0,2,NULL,S_PLAY_RUN2,0,0 }, /* S_PLAY_RUN1 */
{ SPR_PLAY,1,2,NULL,S_PLAY_RUN3,0,0 }, /* S_PLAY_RUN2 */
{ SPR_PLAY,2,2,NULL,S_PLAY_RUN4,0,0 }, /* S_PLAY_RUN3 */
{ SPR_PLAY,3,2,NULL,S_PLAY_RUN1,0,0 }, /* S_PLAY_RUN4 */
{ SPR_PLAY,4,2,NULL,S_PLAY_ATK2,0,0 }, /* S_PLAY_ATK1 */
{ SPR_PLAY,32773,4,NULL,S_PLAY,0,0 }, /* S_PLAY_ATK2 */
{ SPR_PLAY,6,2,NULL,S_PLAY_PAIN2,0,0 }, /* S_PLAY_PAIN */
{ SPR_PLAY,6,2,A_Pain,S_PLAY,0,0 }, /* S_PLAY_PAIN2 */
{ SPR_PLAY,7,5,NULL,S_PLAY_DIE2,0,0 }, /* S_PLAY_DIE1 */
{ SPR_PLAY,8,5,A_Scream,S_PLAY_DIE3,0,0 }, /* S_PLAY_DIE2 */
{ SPR_PLAY,9,5,A_Fall,S_PLAY_DIE4,0,0 }, /* S_PLAY_DIE3 */
{ SPR_PLAY,10,5,NULL,S_PLAY_DIE5,0,0 }, /* S_PLAY_DIE4 */
{ SPR_PLAY,11,5,NULL,S_PLAY_DIE6,0,0 }, /* S_PLAY_DIE5 */
{ SPR_PLAY,12,5,NULL,S_PLAY_DIE7,0,0 }, /* S_PLAY_DIE6 */
{ SPR_PLAY,13,-1,NULL,S_NULL,0,0 }, /* S_PLAY_DIE7 */
{ SPR_PLAY,14,2,NULL,S_PLAY_XDIE2,0,0 }, /* S_PLAY_XDIE1 */
{ SPR_PLAY,15,2,A_XScream,S_PLAY_XDIE3,0,0 }, /* S_PLAY_XDIE2 */
{ SPR_PLAY,16,2,A_Fall,S_PLAY_XDIE4,0,0 }, /* S_PLAY_XDIE3 */
{ SPR_PLAY,17,2,NULL,S_PLAY_XDIE5,0,0 }, /* S_PLAY_XDIE4 */
{ SPR_PLAY,18,2,NULL,S_PLAY_XDIE6,0,0 }, /* S_PLAY_XDIE5 */
{ SPR_PLAY,19,2,NULL,S_PLAY_XDIE7,0,0 }, /* S_PLAY_XDIE6 */
{ SPR_PLAY,20,2,NULL,S_PLAY_XDIE8,0,0 }, /* S_PLAY_XDIE7 */
{ SPR_PLAY,21,2,NULL,S_PLAY_XDIE9,0,0 }, /* S_PLAY_XDIE8 */
{ SPR_PLAY,22,-1,NULL,S_NULL,0,0 }, /* S_PLAY_XDIE9 */
{ SPR_POSS,0,5,A_Look,S_POSS_STND2,0,0 }, /* S_POSS_STND */
{ SPR_POSS,1,5,A_Look,S_POSS_STND,0,0 }, /* S_POSS_STND2 */
{ SPR_POSS,0,2,A_Chase,S_POSS_RUN2,0,0 }, /* S_POSS_RUN1 */
{ SPR_POSS,0,2,A_Chase,S_POSS_RUN3,0,0 }, /* S_POSS_RUN2 */
{ SPR_POSS,1,2,A_Chase,S_POSS_RUN4,0,0 }, /* S_POSS_RUN3 */
{ SPR_POSS,1,2,A_Chase,S_POSS_RUN5,0,0 }, /* S_POSS_RUN4 */
{ SPR_POSS,2,2,A_Chase,S_POSS_RUN6,0,0 }, /* S_POSS_RUN5 */
{ SPR_POSS,2,2,A_Chase,S_POSS_RUN7,0,0 }, /* S_POSS_RUN6 */
{ SPR_POSS,3,2,A_Chase,S_POSS_RUN8,0,0 }, /* S_POSS_RUN7 */
{ SPR_POSS,3,2,A_Chase,S_POSS_RUN1,0,0 }, /* S_POSS_RUN8 */
{ SPR_POSS,4,5,A_FaceTarget,S_POSS_ATK2,0,0 }, /* S_POSS_ATK1 */
{ SPR_POSS,5,4,A_PosAttack,S_POSS_ATK3,0,0 }, /* S_POSS_ATK2 */
{ SPR_POSS,4,4,NULL,S_POSS_RUN1,0,0 }, /* S_POSS_ATK3 */
{ SPR_POSS,6,1,NULL,S_POSS_PAIN2,0,0 }, /* S_POSS_PAIN */
{ SPR_POSS,6,2,A_Pain,S_POSS_RUN1,0,0 }, /* S_POSS_PAIN2 */
{ SPR_POSS,7,2,NULL,S_POSS_DIE2,0,0 }, /* S_POSS_DIE1 */
{ SPR_POSS,8,3,A_Scream,S_POSS_DIE3,0,0 }, /* S_POSS_DIE2 */
{ SPR_POSS,9,2,A_Fall,S_POSS_DIE4,0,0 }, /* S_POSS_DIE3 */
{ SPR_POSS,10,3,NULL,S_POSS_DIE5,0,0 }, /* S_POSS_DIE4 */
{ SPR_POSS,11,-1,NULL,S_NULL,0,0 }, /* S_POSS_DIE5 */
{ SPR_POSS,12,2,NULL,S_POSS_XDIE2,0,0 }, /* S_POSS_XDIE1 */
{ SPR_POSS,13,3,A_XScream,S_POSS_XDIE3,0,0 }, /* S_POSS_XDIE2 */
{ SPR_POSS,14,2,A_Fall,S_POSS_XDIE4,0,0 }, /* S_POSS_XDIE3 */
{ SPR_POSS,15,3,NULL,S_POSS_XDIE5,0,0 }, /* S_POSS_XDIE4 */
{ SPR_POSS,16,2,NULL,S_POSS_XDIE6,0,0 }, /* S_POSS_XDIE5 */
{ SPR_POSS,17,3,NULL,S_POSS_XDIE7,0,0 }, /* S_POSS_XDIE6 */
{ SPR_POSS,18,2,NULL,S_POSS_XDIE8,0,0 }, /* S_POSS_XDIE7 */
{ SPR_POSS,19,3,NULL,S_POSS_XDIE9,0,0 }, /* S_POSS_XDIE8 */
{ SPR_POSS,20,-1,NULL,S_NULL,0,0 }, /* S_POSS_XDIE9 */
{ SPR_SPOS,0,5,A_Look,S_SPOS_STND2,0,0 }, /* S_SPOS_STND */
{ SPR_SPOS,1,5,A_Look,S_SPOS_STND,0,0 }, /* S_SPOS_STND2 */
{ SPR_SPOS,0,1,A_Chase,S_SPOS_RUN2,0,0 }, /* S_SPOS_RUN1 */
{ SPR_SPOS,0,2,A_Chase,S_SPOS_RUN3,0,0 }, /* S_SPOS_RUN2 */
{ SPR_SPOS,1,1,A_Chase,S_SPOS_RUN4,0,0 }, /* S_SPOS_RUN3 */
{ SPR_SPOS,1,2,A_Chase,S_SPOS_RUN5,0,0 }, /* S_SPOS_RUN4 */
{ SPR_SPOS,2,1,A_Chase,S_SPOS_RUN6,0,0 }, /* S_SPOS_RUN5 */
{ SPR_SPOS,2,2,A_Chase,S_SPOS_RUN7,0,0 }, /* S_SPOS_RUN6 */
{ SPR_SPOS,3,1,A_Chase,S_SPOS_RUN8,0,0 }, /* S_SPOS_RUN7 */
{ SPR_SPOS,3,2,A_Chase,S_SPOS_RUN1,0,0 }, /* S_SPOS_RUN8 */
{ SPR_SPOS,4,5,A_FaceTarget,S_SPOS_ATK2,0,0 }, /* S_SPOS_ATK1 */
{ SPR_SPOS,32773,5,A_SPosAttack,S_SPOS_ATK3,0,0 }, /* S_SPOS_ATK2 */
{ SPR_SPOS,4,5,NULL,S_SPOS_RUN1,0,0 }, /* S_SPOS_ATK3 */
{ SPR_SPOS,6,1,NULL,S_SPOS_PAIN2,0,0 }, /* S_SPOS_PAIN */
{ SPR_SPOS,6,2,A_Pain,S_SPOS_RUN1,0,0 }, /* S_SPOS_PAIN2 */
{ SPR_SPOS,7,2,NULL,S_SPOS_DIE2,0,0 }, /* S_SPOS_DIE1 */
{ SPR_SPOS,8,3,A_Scream,S_SPOS_DIE3,0,0 }, /* S_SPOS_DIE2 */
{ SPR_SPOS,9,2,A_Fall,S_SPOS_DIE4,0,0 }, /* S_SPOS_DIE3 */
{ SPR_SPOS,10,3,NULL,S_SPOS_DIE5,0,0 }, /* S_SPOS_DIE4 */
{ SPR_SPOS,11,-1,NULL,S_NULL,0,0 }, /* S_SPOS_DIE5 */
{ SPR_SPOS,12,2,NULL,S_SPOS_XDIE2,0,0 }, /* S_SPOS_XDIE1 */
{ SPR_SPOS,13,3,A_XScream,S_SPOS_XDIE3,0,0 }, /* S_SPOS_XDIE2 */
{ SPR_SPOS,14,2,A_Fall,S_SPOS_XDIE4,0,0 }, /* S_SPOS_XDIE3 */
{ SPR_SPOS,15,3,NULL,S_SPOS_XDIE5,0,0 }, /* S_SPOS_XDIE4 */
{ SPR_SPOS,16,2,NULL,S_SPOS_XDIE6,0,0 }, /* S_SPOS_XDIE5 */
{ SPR_SPOS,17,3,NULL,S_SPOS_XDIE7,0,0 }, /* S_SPOS_XDIE6 */
{ SPR_SPOS,18,2,NULL,S_SPOS_XDIE8,0,0 }, /* S_SPOS_XDIE7 */
{ SPR_SPOS,19,3,NULL,S_SPOS_XDIE9,0,0 }, /* S_SPOS_XDIE8 */
{ SPR_SPOS,20,-1,NULL,S_NULL,0,0 }, /* S_SPOS_XDIE9 */
{ SPR_PUFF,1,2,NULL,S_SMOKE2,0,0 }, /* S_SMOKE1 */
{ SPR_PUFF,2,2,NULL,S_SMOKE3,0,0 }, /* S_SMOKE2 */
{ SPR_PUFF,1,2,NULL,S_SMOKE4,0,0 }, /* S_SMOKE3 */
{ SPR_PUFF,2,2,NULL,S_SMOKE5,0,0 }, /* S_SMOKE4 */
{ SPR_PUFF,3,2,NULL,S_NULL,0,0 }, /* S_SMOKE5 */
{ SPR_FATB,32768,1,A_Tracer,S_TRACER2,0,0 }, /* S_TRACER */
{ SPR_FATB,32769,1,A_Tracer,S_TRACER,0,0 }, /* S_TRACER2 */
{ SPR_FBXP,32768,4,NULL,S_TRACEEXP2,0,0 }, /* S_TRACEEXP1 */
{ SPR_FBXP,32769,3,NULL,S_TRACEEXP3,0,0 }, /* S_TRACEEXP2 */
{ SPR_FBXP,32770,2,NULL,S_NULL,0,0 }, /* S_TRACEEXP3 */
{ SPR_SKEL,0,5,A_Look,S_SKEL_STND2,0,0 }, /* S_SKEL_STND */
{ SPR_SKEL,1,5,A_Look,S_SKEL_STND,0,0 }, /* S_SKEL_STND2 */
{ SPR_SKEL,0,2,A_Chase,S_SKEL_RUN2,0,0 }, /* S_SKEL_RUN1 */
{ SPR_SKEL,0,2,A_Chase,S_SKEL_RUN3,0,0 }, /* S_SKEL_RUN2 */
{ SPR_SKEL,1,2,A_Chase,S_SKEL_RUN4,0,0 }, /* S_SKEL_RUN3 */
{ SPR_SKEL,1,2,A_Chase,S_SKEL_RUN5,0,0 }, /* S_SKEL_RUN4 */
{ SPR_SKEL,2,2,A_Chase,S_SKEL_RUN6,0,0 }, /* S_SKEL_RUN5 */
{ SPR_SKEL,2,2,A_Chase,S_SKEL_RUN7,0,0 }, /* S_SKEL_RUN6 */
{ SPR_SKEL,3,2,A_Chase,S_SKEL_RUN8,0,0 }, /* S_SKEL_RUN7 */
{ SPR_SKEL,3,2,A_Chase,S_SKEL_RUN9,0,0 }, /* S_SKEL_RUN8 */
{ SPR_SKEL,4,2,A_Chase,S_SKEL_RUN10,0,0 }, /* S_SKEL_RUN9 */
{ SPR_SKEL,4,2,A_Chase,S_SKEL_RUN11,0,0 }, /* S_SKEL_RUN10 */
{ SPR_SKEL,5,2,A_Chase,S_SKEL_RUN12,0,0 }, /* S_SKEL_RUN11 */
{ SPR_SKEL,5,2,A_Chase,S_SKEL_RUN1,0,0 }, /* S_SKEL_RUN12 */
{ SPR_SKEL,6,0,A_FaceTarget,S_SKEL_FIST2,0,0 }, /* S_SKEL_FIST1 */
{ SPR_SKEL,6,3,A_SkelWhoosh,S_SKEL_FIST3,0,0 }, /* S_SKEL_FIST2 */
{ SPR_SKEL,7,3,A_FaceTarget,S_SKEL_FIST4,0,0 }, /* S_SKEL_FIST3 */
{ SPR_SKEL,8,3,A_SkelFist,S_SKEL_RUN1,0,0 }, /* S_SKEL_FIST4 */
{ SPR_SKEL,32777,0,A_FaceTarget,S_SKEL_MISS2,0,0 }, /* S_SKEL_MISS1 */
{ SPR_SKEL,32777,5,A_FaceTarget,S_SKEL_MISS3,0,0 }, /* S_SKEL_MISS2 */
{ SPR_SKEL,10,5,A_SkelMissile,S_SKEL_MISS4,0,0 }, /* S_SKEL_MISS3 */
{ SPR_SKEL,10,5,A_FaceTarget,S_SKEL_RUN1,0,0 }, /* S_SKEL_MISS4 */
{ SPR_SKEL,11,2,NULL,S_SKEL_PAIN2,0,0 }, /* S_SKEL_PAIN */
{ SPR_SKEL,11,2,A_Pain,S_SKEL_RUN1,0,0 }, /* S_SKEL_PAIN2 */
{ SPR_SKEL,11,3,NULL,S_SKEL_DIE2,0,0 }, /* S_SKEL_DIE1 */
{ SPR_SKEL,12,3,NULL,S_SKEL_DIE3,0,0 }, /* S_SKEL_DIE2 */
{ SPR_SKEL,13,3,A_Scream,S_SKEL_DIE4,0,0 }, /* S_SKEL_DIE3 */
{ SPR_SKEL,14,3,A_Fall,S_SKEL_DIE5,0,0 }, /* S_SKEL_DIE4 */
{ SPR_SKEL,15,3,NULL,S_SKEL_DIE6,0,0 }, /* S_SKEL_DIE5 */
{ SPR_SKEL,16,-1,NULL,S_NULL,0,0 }, /* S_SKEL_DIE6 */
{ SPR_MANF,32768,2,NULL,S_FATSHOT2,0,0 }, /* S_FATSHOT1 */
{ SPR_MANF,32769,2,NULL,S_FATSHOT1,0,0 }, /* S_FATSHOT2 */
{ SPR_MISL,32769,4,NULL,S_FATSHOTX2,0,0 }, /* S_FATSHOTX1 */
{ SPR_MISL,32770,3,NULL,S_FATSHOTX3,0,0 }, /* _FATSHOTX2 */
{ SPR_MISL,32771,2,NULL,S_NULL,0,0 }, /* S_FATSHOTX3 */
{ SPR_FATT,0,7,A_Look,S_FATT_STND2,0,0 }, /* S_FATT_STND */
{ SPR_FATT,1,7,A_Look,S_FATT_STND,0,0 }, /* S_FATT_STND2 */
{ SPR_FATT,0,2,A_Chase,S_FATT_RUN2,0,0 }, /* S_FATT_RUN1 */
{ SPR_FATT,0,2,A_Chase,S_FATT_RUN3,0,0 }, /* S_FATT_RUN2 */
{ SPR_FATT,1,2,A_Chase,S_FATT_RUN4,0,0 }, /* S_FATT_RUN3 */
{ SPR_FATT,1,2,A_Chase,S_FATT_RUN5,0,0 }, /* S_FATT_RUN4 */
{ SPR_FATT,2,2,A_Chase,S_FATT_RUN6,0,0 }, /* S_FATT_RUN5 */
{ SPR_FATT,2,2,A_Chase,S_FATT_RUN7,0,0 }, /* S_FATT_RUN6 */
{ SPR_FATT,3,2,A_Chase,S_FATT_RUN8,0,0 }, /* S_FATT_RUN7 */
{ SPR_FATT,3,2,A_Chase,S_FATT_RUN9,0,0 }, /* S_FATT_RUN8 */
{ SPR_FATT,4,2,A_Chase,S_FATT_RUN10,0,0 }, /* S_FATT_RUN9 */
{ SPR_FATT,4,2,A_Chase,S_FATT_RUN11,0,0 }, /* S_FATT_RUN10 */
{ SPR_FATT,5,2,A_Chase,S_FATT_RUN12,0,0 }, /* S_FATT_RUN11 */
{ SPR_FATT,5,2,A_Chase,S_FATT_RUN1,0,0 }, /* S_FATT_RUN12 */
{ SPR_FATT,6,10,A_FatRaise,S_FATT_ATK2,0,0 }, /* S_FATT_ATK1 */
{ SPR_FATT,32775,5,A_FatAttack1,S_FATT_ATK3,0,0 }, /* S_FATT_ATK2 */
{ SPR_FATT,8,2,A_FaceTarget,S_FATT_ATK4,0,0 }, /* S_FATT_ATK3 */
{ SPR_FATT,6,2,A_FaceTarget,S_FATT_ATK5,0,0 }, /* S_FATT_ATK4 */
{ SPR_FATT,32775,5,A_FatAttack2,S_FATT_ATK6,0,0 }, /* S_FATT_ATK5 */
{ SPR_FATT,8,2,A_FaceTarget,S_FATT_ATK7,0,0 }, /* S_FATT_ATK6 */
{ SPR_FATT,6,2,A_FaceTarget,S_FATT_ATK8,0,0 }, /* S_FATT_ATK7 */
{ SPR_FATT,32775,5,A_FatAttack3,S_FATT_ATK9,0,0 }, /* S_FATT_ATK8 */
{ SPR_FATT,8,2,A_FaceTarget,S_FATT_ATK10,0,0 }, /* S_FATT_ATK9 */
{ SPR_FATT,6,2,A_FaceTarget,S_FATT_RUN1,0,0 }, /* S_FATT_ATK10 */
{ SPR_FATT,9,1,NULL,S_FATT_PAIN2,0,0 }, /* S_FATT_PAIN */
{ SPR_FATT,9,1,A_Pain,S_FATT_RUN1,0,0 }, /* S_FATT_PAIN2 */
{ SPR_FATT,10,2,NULL,S_FATT_DIE2,0,0 }, /* S_FATT_DIE1 */
{ SPR_FATT,11,2,A_Scream,S_FATT_DIE3,0,0 }, /* S_FATT_DIE2 */
{ SPR_FATT,12,2,A_Fall,S_FATT_DIE4,0,0 }, /* S_FATT_DIE3 */
{ SPR_FATT,13,2,NULL,S_FATT_DIE5,0,0 }, /* S_FATT_DIE4 */
{ SPR_FATT,14,2,NULL,S_FATT_DIE6,0,0 }, /* S_FATT_DIE5 */
{ SPR_FATT,15,2,NULL,S_FATT_DIE7,0,0 }, /* S_FATT_DIE6 */
{ SPR_FATT,16,2,NULL,S_FATT_DIE8,0,0 }, /* S_FATT_DIE7 */
{ SPR_FATT,17,2,NULL,S_FATT_DIE9,0,0 }, /* S_FATT_DIE7 */
{ SPR_FATT,18,2,NULL,S_FATT_DIE10,0,0 }, /* S_FATT_DIE9 */
{ SPR_FATT,19,-1,A_BossDeath,S_NULL,0,0 }, /* S_FATT_DIE10 */
{ SPR_CPOS,0,5,A_Look,S_CPOS_STND2,0,0 }, /* S_CPOS_STND */
{ SPR_CPOS,1,5,A_Look,S_CPOS_STND,0,0 }, /* S_CPOS_STND2 */
{ SPR_CPOS,0,2,A_Chase,S_CPOS_RUN2,0,0 }, /* S_CPOS_RUN1 */
{ SPR_CPOS,0,2,A_Chase,S_CPOS_RUN3,0,0 }, /* S_CPOS_RUN2 */
{ SPR_CPOS,1,2,A_Chase,S_CPOS_RUN4,0,0 }, /* S_CPOS_RUN3 */
{ SPR_CPOS,1,2,A_Chase,S_CPOS_RUN5,0,0 }, /* S_CPOS_RUN4 */
{ SPR_CPOS,2,2,A_Chase,S_CPOS_RUN6,0,0 }, /* S_CPOS_RUN5 */
{ SPR_CPOS,2,2,A_Chase,S_CPOS_RUN7,0,0 }, /* S_CPOS_RUN6 */
{ SPR_CPOS,3,2,A_Chase,S_CPOS_RUN8,0,0 }, /* S_CPOS_RUN7 */
{ SPR_CPOS,3,2,A_Chase,S_CPOS_RUN1,0,0 }, /* S_CPOS_RUN8 */
{ SPR_CPOS,4,5,A_FaceTarget,S_CPOS_ATK2,0,0 }, /* S_CPOS_ATK1 */
{ SPR_CPOS,32773,2,A_CPosAttack,S_CPOS_ATK3,0,0 }, /* S_CPOS_ATK2 */
{ SPR_CPOS,32772,2,A_CPosAttack,S_CPOS_ATK4,0,0 }, /* S_CPOS_ATK3 */
{ SPR_CPOS,5,0,A_CPosRefire,S_CPOS_ATK2,0,0 }, /* S_CPOS_ATK4 */
{ SPR_CPOS,6,1,NULL,S_CPOS_PAIN2,0,0 }, /* S_CPOS_PAIN */
{ SPR_CPOS,6,1,A_Pain,S_CPOS_RUN1,0,0 }, /* S_CPOS_PAIN2 */
{ SPR_CPOS,7,2,NULL,S_CPOS_DIE2,0,0 }, /* S_CPOS_DIE1 */
{ SPR_CPOS,8,2,A_Scream,S_CPOS_DIE3,0,0 }, /* S_CPOS_DIE2 */
{ SPR_CPOS,9,2,A_Fall,S_CPOS_DIE4,0,0 }, /* S_CPOS_DIE3 */
{ SPR_CPOS,10,2,NULL,S_CPOS_DIE5,0,0 }, /* S_CPOS_DIE4 */
{ SPR_CPOS,11,2,NULL,S_CPOS_DIE6,0,0 }, /* S_CPOS_DIE5 */
{ SPR_CPOS,12,2,NULL,S_CPOS_DIE7,0,0 }, /* S_CPOS_DIE6 */
{ SPR_CPOS,13,-1,NULL,S_NULL,0,0 }, /* S_CPOS_DIE7 */
{ SPR_CPOS,14,2,NULL,S_CPOS_XDIE2,0,0 }, /* S_CPOS_XDIE1 */
{ SPR_CPOS,15,2,A_XScream,S_CPOS_XDIE3,0,0 }, /* S_CPOS_XDIE2 */
{ SPR_CPOS,16,2,A_Fall,S_CPOS_XDIE4,0,0 }, /* S_CPOS_XDIE3 */
{ SPR_CPOS,17,2,NULL,S_CPOS_XDIE5,0,0 }, /* S_CPOS_XDIE4 */
{ SPR_CPOS,18,2,NULL,S_CPOS_XDIE6,0,0 }, /* S_CPOS_XDIE5 */
{ SPR_CPOS,19,-1,NULL,S_NULL,0,0 }, /* S_CPOS_XDIE6 */
{ SPR_TROO,0,5,A_Look,S_TROO_STND2,0,0 }, /* S_TROO_STND */
{ SPR_TROO,1,5,A_Look,S_TROO_STND,0,0 }, /* S_TROO_STND2 */
{ SPR_TROO,0,1,A_Chase,S_TROO_RUN2,0,0 }, /* S_TROO_RUN1 */
{ SPR_TROO,0,2,A_Chase,S_TROO_RUN3,0,0 }, /* S_TROO_RUN2 */
{ SPR_TROO,1,1,A_Chase,S_TROO_RUN4,0,0 }, /* S_TROO_RUN3 */
{ SPR_TROO,1,2,A_Chase,S_TROO_RUN5,0,0 }, /* S_TROO_RUN4 */
{ SPR_TROO,2,1,A_Chase,S_TROO_RUN6,0,0 }, /* S_TROO_RUN5 */
{ SPR_TROO,2,2,A_Chase,S_TROO_RUN7,0,0 }, /* S_TROO_RUN6 */
{ SPR_TROO,3,1,A_Chase,S_TROO_RUN8,0,0 }, /* S_TROO_RUN7 */
{ SPR_TROO,3,2,A_Chase,S_TROO_RUN1,0,0 }, /* S_TROO_RUN8 */
{ SPR_TROO,4,4,A_FaceTarget,S_TROO_ATK2,0,0 }, /* S_TROO_ATK1 */
{ SPR_TROO,5,4,A_FaceTarget,S_TROO_ATK3,0,0 }, /* S_TROO_ATK2 */
{ SPR_TROO,6,3,A_TroopAttack,S_TROO_RUN1,0,0 }, /* S_TROO_ATK3 */
{ SPR_TROO,7,1,NULL,S_TROO_PAIN2,0,0 }, /* S_TROO_PAIN */
{ SPR_TROO,7,1,A_Pain,S_TROO_RUN1,0,0 }, /* S_TROO_PAIN2 */
{ SPR_TROO,8,4,NULL,S_TROO_DIE2,0,0 }, /* S_TROO_DIE1 */
{ SPR_TROO,9,4,A_Scream,S_TROO_DIE3,0,0 }, /* S_TROO_DIE2 */
{ SPR_TROO,10,3,NULL,S_TROO_DIE4,0,0 }, /* S_TROO_DIE3 */
{ SPR_TROO,11,3,A_Fall,S_TROO_DIE5,0,0 }, /* S_TROO_DIE4 */
{ SPR_TROO,12,-1,NULL,S_NULL,0,0 }, /* S_TROO_DIE5 */
{ SPR_TROO,13,2,NULL,S_TROO_XDIE2,0,0 }, /* S_TROO_XDIE1 */
{ SPR_TROO,14,3,A_XScream,S_TROO_XDIE3,0,0 }, /* S_TROO_XDIE2 */
{ SPR_TROO,15,2,NULL,S_TROO_XDIE4,0,0 }, /* S_TROO_XDIE3 */
{ SPR_TROO,16,3,A_Fall,S_TROO_XDIE5,0,0 }, /* S_TROO_XDIE4 */
{ SPR_TROO,17,2,NULL,S_TROO_XDIE6,0,0 }, /* S_TROO_XDIE5 */
{ SPR_TROO,18,3,NULL,S_TROO_XDIE7,0,0 }, /* S_TROO_XDIE6 */
{ SPR_TROO,19,2,NULL,S_TROO_XDIE8,0,0 }, /* S_TROO_XDIE7 */
{ SPR_TROO,20,-1,NULL,S_NULL,0,0 }, /* S_TROO_XDIE8 */
{ SPR_SARG,0,5,A_Look,S_SARG_STND2,0,0 }, /* S_SARG_STND */
{ SPR_SARG,1,5,A_Look,S_SARG_STND,0,0 }, /* S_SARG_STND2 */
{ SPR_SARG,0,1,A_Chase,S_SARG_RUN2,0,0 }, /* S_SARG_RUN1 */
{ SPR_SARG,0,1,A_Chase,S_SARG_RUN3,0,0 }, /* S_SARG_RUN2 */
{ SPR_SARG,1,1,A_Chase,S_SARG_RUN4,0,0 }, /* S_SARG_RUN3 */
{ SPR_SARG,1,1,A_Chase,S_SARG_RUN5,0,0 }, /* S_SARG_RUN4 */
{ SPR_SARG,2,1,A_Chase,S_SARG_RUN6,0,0 }, /* S_SARG_RUN5 */
{ SPR_SARG,2,1,A_Chase,S_SARG_RUN7,0,0 }, /* S_SARG_RUN6 */
{ SPR_SARG,3,1,A_Chase,S_SARG_RUN8,0,0 }, /* S_SARG_RUN7 */
{ SPR_SARG,3,1,A_Chase,S_SARG_RUN1,0,0 }, /* S_SARG_RUN8 */
{ SPR_SARG,4,4,A_FaceTarget,S_SARG_ATK2,0,0 }, /* S_SARG_ATK1 */
{ SPR_SARG,5,4,A_FaceTarget,S_SARG_ATK3,0,0 }, /* S_SARG_ATK2 */
{ SPR_SARG,6,4,A_SargAttack,S_SARG_RUN1,0,0 }, /* S_SARG_ATK3 */
{ SPR_SARG,7,1,NULL,S_SARG_PAIN2,0,0 }, /* S_SARG_PAIN */
{ SPR_SARG,7,1,A_Pain,S_SARG_RUN1,0,0 }, /* S_SARG_PAIN2 */
{ SPR_SARG,8,4,NULL,S_SARG_DIE2,0,0 }, /* S_SARG_DIE1 */
{ SPR_SARG,9,4,A_Scream,S_SARG_DIE3,0,0 }, /* S_SARG_DIE2 */
{ SPR_SARG,10,2,NULL,S_SARG_DIE4,0,0 }, /* S_SARG_DIE3 */
{ SPR_SARG,11,2,A_Fall,S_SARG_DIE5,0,0 }, /* S_SARG_DIE4 */
{ SPR_SARG,12,2,NULL,S_SARG_DIE6,0,0 }, /* S_SARG_DIE5 */
{ SPR_SARG,13,-1,NULL,S_NULL,0,0 }, /* S_SARG_DIE6 */
{ SPR_HEAD,0,5,A_Look,S_HEAD_STND,0,0 }, /* S_HEAD_STND */
{ SPR_HEAD,0,2,A_Chase,S_HEAD_RUN1,0,0 }, /* S_HEAD_RUN1 */
{ SPR_HEAD,1,3,A_FaceTarget,S_HEAD_ATK2,0,0 }, /* S_HEAD_ATK1 */
{ SPR_HEAD,2,3,A_FaceTarget,S_HEAD_ATK3,0,0 }, /* S_HEAD_ATK2 */
{ SPR_HEAD,32771,3,A_HeadAttack,S_HEAD_RUN1,0,0 }, /* S_HEAD_ATK3 */
{ SPR_HEAD,4,1,NULL,S_HEAD_PAIN2,0,0 }, /* S_HEAD_PAIN */
{ SPR_HEAD,4,2,A_Pain,S_HEAD_PAIN3,0,0 }, /* S_HEAD_PAIN2 */
{ SPR_HEAD,5,3,NULL,S_HEAD_RUN1,0,0 }, /* S_HEAD_PAIN3 */
{ SPR_HEAD,6,4,NULL,S_HEAD_DIE2,0,0 }, /* S_HEAD_DIE1 */
{ SPR_HEAD,7,4,A_Scream,S_HEAD_DIE3,0,0 }, /* S_HEAD_DIE2 */
{ SPR_HEAD,8,4,NULL,S_HEAD_DIE4,0,0 }, /* S_HEAD_DIE3 */
{ SPR_HEAD,9,4,NULL,S_HEAD_DIE5,0,0 }, /* S_HEAD_DIE4 */
{ SPR_HEAD,10,4,A_Fall,S_HEAD_DIE6,0,0 }, /* S_HEAD_DIE5 */
{ SPR_HEAD,11,-1,NULL,S_NULL,0,0 }, /* S_HEAD_DIE6 */
{ SPR_BOSS,0,5,A_Look,S_BOSS_STND2,0,0 }, /* S_BOSS_STND */
{ SPR_BOSS,1,5,A_Look,S_BOSS_STND,0,0 }, /* S_BOSS_STND2 */
{ SPR_BOSS,0,1,A_Chase,S_BOSS_RUN2,0,0 }, /* S_BOSS_RUN1 */
{ SPR_BOSS,0,2,A_Chase,S_BOSS_RUN3,0,0 }, /* S_BOSS_RUN2 */
{ SPR_BOSS,1,1,A_Chase,S_BOSS_RUN4,0,0 }, /* S_BOSS_RUN3 */
{ SPR_BOSS,1,2,A_Chase,S_BOSS_RUN5,0,0 }, /* S_BOSS_RUN4 */
{ SPR_BOSS,2,1,A_Chase,S_BOSS_RUN6,0,0 }, /* S_BOSS_RUN5 */
{ SPR_BOSS,2,2,A_Chase,S_BOSS_RUN7,0,0 }, /* S_BOSS_RUN6 */
{ SPR_BOSS,3,1,A_Chase,S_BOSS_RUN8,0,0 }, /* S_BOSS_RUN7 */
{ SPR_BOSS,3,2,A_Chase,S_BOSS_RUN1,0,0 }, /* S_BOSS_RUN8 */
{ SPR_BOSS,4,4,A_FaceTarget,S_BOSS_ATK2,0,0 }, /* S_BOSS_ATK1 */
{ SPR_BOSS,5,4,A_FaceTarget,S_BOSS_ATK3,0,0 }, /* S_BOSS_ATK2 */
{ SPR_BOSS,6,4,A_BruisAttack,S_BOSS_RUN1,0,0 }, /* S_BOSS_ATK3 */
{ SPR_BOSS,7,1,NULL,S_BOSS_PAIN2,0,0 }, /* S_BOSS_PAIN */
{ SPR_BOSS,7,1,A_Pain,S_BOSS_RUN1,0,0 }, /* S_BOSS_PAIN2 */
{ SPR_BOSS,8,4,NULL,S_BOSS_DIE2,0,0 }, /* S_BOSS_DIE1 */
{ SPR_BOSS,9,4,A_Scream,S_BOSS_DIE3,0,0 }, /* S_BOSS_DIE2 */
{ SPR_BOSS,10,4,NULL,S_BOSS_DIE4,0,0 }, /* S_BOSS_DIE3 */
{ SPR_BOSS,11,4,A_Fall,S_BOSS_DIE5,0,0 }, /* S_BOSS_DIE4 */
{ SPR_BOSS,12,4,NULL,S_BOSS_DIE6,0,0 }, /* S_BOSS_DIE5 */
{ SPR_BOSS,13,4,NULL,S_BOSS_DIE7,0,0 }, /* S_BOSS_DIE6 */
{ SPR_BOSS,14,-1,A_BossDeath,S_NULL,0,0 }, /* S_BOSS_DIE7 */
{ SPR_BOS2,0,5,A_Look,S_BOS2_STND2,0,0 }, /* S_BOS2_STND */
{ SPR_BOS2,1,5,A_Look,S_BOS2_STND,0,0 }, /* S_BOS2_STND2 */
{ SPR_BOS2,0,2,A_Chase,S_BOS2_RUN2,0,0 }, /* S_BOS2_RUN1 */
{ SPR_BOS2,0,2,A_Chase,S_BOS2_RUN3,0,0 }, /* S_BOS2_RUN2 */
{ SPR_BOS2,1,2,A_Chase,S_BOS2_RUN4,0,0 }, /* S_BOS2_RUN3 */
{ SPR_BOS2,1,2,A_Chase,S_BOS2_RUN5,0,0 }, /* S_BOS2_RUN4 */
{ SPR_BOS2,2,2,A_Chase,S_BOS2_RUN6,0,0 }, /* S_BOS2_RUN5 */
{ SPR_BOS2,2,2,A_Chase,S_BOS2_RUN7,0,0 }, /* S_BOS2_RUN6 */
{ SPR_BOS2,3,2,A_Chase,S_BOS2_RUN8,0,0 }, /* S_BOS2_RUN7 */
{ SPR_BOS2,3,2,A_Chase,S_BOS2_RUN1,0,0 }, /* S_BOS2_RUN8 */
{ SPR_BOS2,4,4,A_FaceTarget,S_BOS2_ATK2,0,0 }, /* S_BOS2_ATK1 */
{ SPR_BOS2,5,4,A_FaceTarget,S_BOS2_ATK3,0,0 }, /* S_BOS2_ATK2 */
{ SPR_BOS2,6,4,A_BruisAttack,S_BOS2_RUN1,0,0 }, /* S_BOS2_ATK3 */
{ SPR_BOS2,7,1,NULL,S_BOS2_PAIN2,0,0 }, /* S_BOS2_PAIN */
{ SPR_BOS2,7,1,A_Pain,S_BOS2_RUN1,0,0 }, /* S_BOS2_PAIN2 */
{ SPR_BOS2,8,4,NULL,S_BOS2_DIE2,0,0 }, /* S_BOS2_DIE1 */
{ SPR_BOS2,9,4,A_Scream,S_BOS2_DIE3,0,0 }, /* S_BOS2_DIE2 */
{ SPR_BOS2,10,4,NULL,S_BOS2_DIE4,0,0 }, /* S_BOS2_DIE3 */
{ SPR_BOS2,11,4,A_Fall,S_BOS2_DIE5,0,0 }, /* S_BOS2_DIE4 */
{ SPR_BOS2,12,4,NULL,S_BOS2_DIE6,0,0 }, /* S_BOS2_DIE5 */
{ SPR_BOS2,13,4,NULL,S_BOS2_DIE7,0,0 }, /* S_BOS2_DIE6 */
{ SPR_BOS2,14,-1,A_BossDeath,S_NULL,0,0 }, /* S_BOS2_DIE7 */
{ SPR_SKUL,32768,5,A_Look,S_SKULL_STND2,0,0 }, /* S_SKULL_STND */
{ SPR_SKUL,32769,5,A_Look,S_SKULL_STND,0,0 }, /* S_SKULL_STND2 */
{ SPR_SKUL,32768,3,A_Chase,S_SKULL_RUN2,0,0 }, /* S_SKULL_RUN1 */
{ SPR_SKUL,32769,3,A_Chase,S_SKULL_RUN1,0,0 }, /* S_SKULL_RUN2 */
{ SPR_SKUL,32770,5,A_FaceTarget,S_SKULL_ATK2,0,0 }, /* S_SKULL_ATK1 */
{ SPR_SKUL,32771,2,A_SkullAttack,S_SKULL_ATK3,0,0 },/* S_SKULL_ATK2 */
{ SPR_SKUL,32770,2,NULL,S_SKULL_ATK4,0,0 }, /* S_SKULL_ATK3 */
{ SPR_SKUL,32771,2,NULL,S_SKULL_ATK3,0,0 }, /* S_SKULL_ATK4 */
{ SPR_SKUL,32772,1,NULL,S_SKULL_PAIN2,0,0 }, /* S_SKULL_PAIN */
{ SPR_SKUL,32772,2,A_Pain,S_SKULL_RUN1,0,0 }, /* S_SKULL_PAIN2 */
{ SPR_SKUL,32773,3,NULL,S_SKULL_DIE2,0,0 }, /* S_SKULL_DIE1 */
{ SPR_SKUL,32774,3,A_Scream,S_SKULL_DIE3,0,0 }, /* S_SKULL_DIE2 */
{ SPR_SKUL,32775,3,NULL,S_SKULL_DIE4,0,0 }, /* S_SKULL_DIE3 */
{ SPR_SKUL,32776,3,A_Fall,S_SKULL_DIE5,0,0 }, /* S_SKULL_DIE4 */
{ SPR_SKUL,9,3,NULL,S_SKULL_DIE6,0,0 }, /* S_SKULL_DIE5 */
{ SPR_SKUL,10,3,NULL,S_NULL,0,0 }, /* S_SKULL_DIE6 */
{ SPR_SPID,0,5,A_Look,S_SPID_STND2,0,0 }, /* S_SPID_STND */
{ SPR_SPID,1,5,A_Look,S_SPID_STND,0,0 }, /* S_SPID_STND2 */
{ SPR_SPID,0,2,A_Metal,S_SPID_RUN2,0,0 }, /* S_SPID_RUN1 */
{ SPR_SPID,0,2,A_Chase,S_SPID_RUN3,0,0 }, /* S_SPID_RUN2 */
{ SPR_SPID,1,2,A_Chase,S_SPID_RUN4,0,0 }, /* S_SPID_RUN3 */
{ SPR_SPID,1,2,A_Chase,S_SPID_RUN5,0,0 }, /* S_SPID_RUN4 */
{ SPR_SPID,2,2,A_Metal,S_SPID_RUN6,0,0 }, /* S_SPID_RUN5 */
{ SPR_SPID,2,2,A_Chase,S_SPID_RUN7,0,0 }, /* S_SPID_RUN6 */
{ SPR_SPID,3,2,A_Chase,S_SPID_RUN8,0,0 }, /* S_SPID_RUN7 */
{ SPR_SPID,3,2,A_Chase,S_SPID_RUN9,0,0 }, /* S_SPID_RUN8 */
{ SPR_SPID,4,2,A_Metal,S_SPID_RUN10,0,0 }, /* S_SPID_RUN9 */
{ SPR_SPID,4,2,A_Chase,S_SPID_RUN11,0,0 }, /* S_SPID_RUN10 */
{ SPR_SPID,5,2,A_Chase,S_SPID_RUN12,0,0 }, /* S_SPID_RUN11 */
{ SPR_SPID,5,2,A_Chase,S_SPID_RUN1,0,0 }, /* S_SPID_RUN12 */
{ SPR_SPID,32768,10,A_FaceTarget,S_SPID_ATK2,0,0 }, /* S_SPID_ATK1 */
{ SPR_SPID,32774,2,A_SpidAttack,S_SPID_ATK3,0,0 }, /* S_SPID_ATK2 */
{ SPR_SPID,32775,2,A_SpidAttack,S_SPID_ATK4,0,0 }, /* S_SPID_ATK3 */
{ SPR_SPID,32775,1,A_SpidRefire,S_SPID_ATK2,0,0 }, /* S_SPID_ATK4 */
{ SPR_SPID,8,2,NULL,S_SPID_PAIN2,0,0 }, /* S_SPID_PAIN */
{ SPR_SPID,8,2,A_Pain,S_SPID_RUN1,0,0 }, /* S_SPID_PAIN2 */
{ SPR_SPID,9,8,A_Scream,S_SPID_DIE2,0,0 }, /* S_SPID_DIE1 */
{ SPR_SPID,10,3,A_Fall,S_SPID_DIE3,0,0 }, /* S_SPID_DIE2 */
{ SPR_SPID,11,3,NULL,S_SPID_DIE4,0,0 }, /* S_SPID_DIE3 */
{ SPR_SPID,12,3,NULL,S_SPID_DIE5,0,0 }, /* S_SPID_DIE4 */
{ SPR_SPID,13,3,NULL,S_SPID_DIE6,0,0 }, /* S_SPID_DIE5 */
{ SPR_SPID,14,3,NULL,S_SPID_DIE7,0,0 }, /* S_SPID_DIE6 */
{ SPR_SPID,15,3,NULL,S_SPID_DIE8,0,0 }, /* S_SPID_DIE7 */
{ SPR_SPID,16,3,NULL,S_SPID_DIE9,0,0 }, /* S_SPID_DIE8 */
{ SPR_SPID,17,3,NULL,S_SPID_DIE10,0,0 }, /* S_SPID_DIE9 */
{ SPR_SPID,18,10,NULL,S_SPID_DIE11,0,0 }, /* S_SPID_DIE10 */
{ SPR_SPID,18,-1,A_BossDeath,S_NULL,0,0 }, /* S_SPID_DIE11 */
{ SPR_BSPI,0,5,A_Look,S_BSPI_STND2,0,0 }, /* S_BSPI_STND */
{ SPR_BSPI,1,5,A_Look,S_BSPI_STND,0,0 }, /* S_BSPI_STND2 */
{ SPR_BSPI,0,10,NULL,S_BSPI_RUN1,0,0 }, /* S_BSPI_SIGHT */
{ SPR_BSPI,0,2,A_BabyMetal,S_BSPI_RUN2,0,0 }, /* S_BSPI_RUN1 */
{ SPR_BSPI,0,2,A_Chase,S_BSPI_RUN3,0,0 }, /* S_BSPI_RUN2 */
{ SPR_BSPI,1,2,A_Chase,S_BSPI_RUN4,0,0 }, /* S_BSPI_RUN3 */
{ SPR_BSPI,1,2,A_Chase,S_BSPI_RUN5,0,0 }, /* S_BSPI_RUN4 */
{ SPR_BSPI,2,2,A_Chase,S_BSPI_RUN6,0,0 }, /* S_BSPI_RUN5 */
{ SPR_BSPI,2,2,A_Chase,S_BSPI_RUN7,0,0 }, /* S_BSPI_RUN6 */
{ SPR_BSPI,3,2,A_BabyMetal,S_BSPI_RUN8,0,0 }, /* S_BSPI_RUN7 */
{ SPR_BSPI,3,2,A_Chase,S_BSPI_RUN9,0,0 }, /* S_BSPI_RUN8 */
{ SPR_BSPI,4,2,A_Chase,S_BSPI_RUN10,0,0 }, /* S_BSPI_RUN9 */
{ SPR_BSPI,4,2,A_Chase,S_BSPI_RUN11,0,0 }, /* S_BSPI_RUN10 */
{ SPR_BSPI,5,2,A_Chase,S_BSPI_RUN12,0,0 }, /* S_BSPI_RUN11 */
{ SPR_BSPI,5,2,A_Chase,S_BSPI_RUN1,0,0 }, /* S_BSPI_RUN12 */
{ SPR_BSPI,32768,10,A_FaceTarget,S_BSPI_ATK2,0,0 }, /* S_BSPI_ATK1 */
{ SPR_BSPI,32774,2,A_BspiAttack,S_BSPI_ATK3,0,0 }, /* S_BSPI_ATK2 */
{ SPR_BSPI,32775,2,NULL,S_BSPI_ATK4,0,0 }, /* S_BSPI_ATK3 */
{ SPR_BSPI,32775,1,A_SpidRefire,S_BSPI_ATK2,0,0 }, /* S_BSPI_ATK4 */
{ SPR_BSPI,8,2,NULL,S_BSPI_PAIN2,0,0 }, /* S_BSPI_PAIN */
{ SPR_BSPI,8,2,A_Pain,S_BSPI_RUN1,0,0 }, /* S_BSPI_PAIN2 */
{ SPR_BSPI,9,10,A_Scream,S_BSPI_DIE2,0,0 }, /* S_BSPI_DIE1 */
{ SPR_BSPI,10,3,A_Fall,S_BSPI_DIE3,0,0 }, /* S_BSPI_DIE2 */
{ SPR_BSPI,11,3,NULL,S_BSPI_DIE4,0,0 }, /* S_BSPI_DIE3 */
{ SPR_BSPI,12,3,NULL,S_BSPI_DIE5,0,0 }, /* S_BSPI_DIE4 */
{ SPR_BSPI,13,3,NULL,S_BSPI_DIE6,0,0 }, /* S_BSPI_DIE5 */
{ SPR_BSPI,14,3,NULL,S_BSPI_DIE7,0,0 }, /* S_BSPI_DIE6 */
{ SPR_BSPI,15,-1,A_BossDeath,S_NULL,0,0 }, /* S_BSPI_DIE7 */
{ SPR_APLS,32768,2,NULL,S_ARACH_PLAZ2,0,0 }, /* S_ARACH_PLAZ */
{ SPR_APLS,32769,2,NULL,S_ARACH_PLAZ,0,0 }, /* S_ARACH_PLAZ2 */
{ SPR_APBX,32768,2,NULL,S_ARACH_PLEX2,0,0 }, /* S_ARACH_PLEX */
{ SPR_APBX,32769,2,NULL,S_ARACH_PLEX3,0,0 }, /* S_ARACH_PLEX2 */
{ SPR_APBX,32770,2,NULL,S_ARACH_PLEX4,0,0 }, /* S_ARACH_PLEX3 */
{ SPR_APBX,32771,2,NULL,S_ARACH_PLEX5,0,0 }, /* S_ARACH_PLEX4 */
{ SPR_APBX,32772,2,NULL,S_NULL,0,0 }, /* S_ARACH_PLEX5 */
{ SPR_CYBR,0,5,A_Look,S_CYBER_STND2,0,0 }, /* S_CYBER_STND */
{ SPR_CYBR,1,5,A_Look,S_CYBER_STND,0,0 }, /* S_CYBER_STND2 */
{ SPR_CYBR,0,2,A_Hoof,S_CYBER_RUN2,0,0 }, /* S_CYBER_RUN1 */
{ SPR_CYBR,0,2,A_Chase,S_CYBER_RUN3,0,0 }, /* S_CYBER_RUN2 */
{ SPR_CYBR,1,2,A_Chase,S_CYBER_RUN4,0,0 }, /* S_CYBER_RUN3 */
{ SPR_CYBR,1,2,A_Chase,S_CYBER_RUN5,0,0 }, /* S_CYBER_RUN4 */
{ SPR_CYBR,2,2,A_Chase,S_CYBER_RUN6,0,0 }, /* S_CYBER_RUN5 */
{ SPR_CYBR,2,2,A_Chase,S_CYBER_RUN7,0,0 }, /* S_CYBER_RUN6 */
{ SPR_CYBR,3,2,A_Metal,S_CYBER_RUN8,0,0 }, /* S_CYBER_RUN7 */
{ SPR_CYBR,3,2,A_Chase,S_CYBER_RUN1,0,0 }, /* S_CYBER_RUN8 */
{ SPR_CYBR,4,3,A_FaceTarget,S_CYBER_ATK2,0,0 }, /* S_CYBER_ATK1 */
{ SPR_CYBR,5,6,A_CyberAttack,S_CYBER_ATK3,0,0 }, /* S_CYBER_ATK2 */
{ SPR_CYBR,4,6,A_FaceTarget,S_CYBER_ATK4,0,0 }, /* S_CYBER_ATK3 */
{ SPR_CYBR,5,6,A_CyberAttack,S_CYBER_ATK5,0 }, /* S_CYBER_ATK4 */
{ SPR_CYBR,4,6,A_FaceTarget,S_CYBER_ATK6,0,0 }, /* S_CYBER_ATK5 */
{ SPR_CYBR,5,6,A_CyberAttack,S_CYBER_RUN1,0,0 }, /* S_CYBER_ATK6 */
{ SPR_CYBR,6,5,A_Pain,S_CYBER_RUN1,0,0 }, /* S_CYBER_PAIN */
{ SPR_CYBR,7,5,NULL,S_CYBER_DIE2,0,0 }, /* S_CYBER_DIE1 */
{ SPR_CYBR,8,5,A_Scream,S_CYBER_DIE3,0,0 }, /* S_CYBER_DIE2 */
{ SPR_CYBR,9,5,NULL,S_CYBER_DIE4,0,0 }, /* S_CYBER_DIE3 */
{ SPR_CYBR,10,5,NULL,S_CYBER_DIE5,0,0 }, /* S_CYBER_DIE4 */
{ SPR_CYBR,11,5,NULL,S_CYBER_DIE6,0,0 }, /* S_CYBER_DIE5 */
{ SPR_CYBR,12,5,A_Fall,S_CYBER_DIE7,0,0 }, /* S_CYBER_DIE6 */
{ SPR_CYBR,13,5,NULL,S_CYBER_DIE8,0,0 }, /* S_CYBER_DIE7 */
{ SPR_CYBR,14,5,NULL,S_CYBER_DIE9,0,0 }, /* S_CYBER_DIE8 */
{ SPR_CYBR,15,15,NULL,S_CYBER_DIE10,0,0 }, /* S_CYBER_DIE9 */
{ SPR_CYBR,15,-1,A_BossDeath,S_NULL,0,0 }, /* S_CYBER_DIE10 */
{ SPR_PAIN,0,5,A_Look,S_PAIN_STND,0,0 }, /* S_PAIN_STND */
{ SPR_PAIN,0,2,A_Chase,S_PAIN_RUN2,0,0 }, /* S_PAIN_RUN1 */
{ SPR_PAIN,0,2,A_Chase,S_PAIN_RUN3,0,0 }, /* S_PAIN_RUN2 */
{ SPR_PAIN,1,2,A_Chase,S_PAIN_RUN4,0,0 }, /* S_PAIN_RUN3 */
{ SPR_PAIN,1,2,A_Chase,S_PAIN_RUN5,0,0 }, /* S_PAIN_RUN4 */
{ SPR_PAIN,2,2,A_Chase,S_PAIN_RUN6,0,0 }, /* S_PAIN_RUN5 */
{ SPR_PAIN,2,2,A_Chase,S_PAIN_RUN1,0,0 }, /* S_PAIN_RUN6 */
{ SPR_PAIN,3,3,A_FaceTarget,S_PAIN_ATK2,0,0 }, /* S_PAIN_ATK1 */
{ SPR_PAIN,4,3,A_FaceTarget,S_PAIN_ATK3,0,0 }, /* S_PAIN_ATK2 */
{ SPR_PAIN,32773,3,A_FaceTarget,S_PAIN_ATK4,0,0 }, /* S_PAIN_ATK3 */
{ SPR_PAIN,32773,0,A_PainAttack,S_PAIN_RUN1,0,0 }, /* S_PAIN_ATK4 */
{ SPR_PAIN,6,3,NULL,S_PAIN_PAIN2,0,0 }, /* S_PAIN_PAIN */
{ SPR_PAIN,6,3,A_Pain,S_PAIN_RUN1,0,0 }, /* S_PAIN_PAIN2 */
{ SPR_PAIN,32775,4,NULL,S_PAIN_DIE2,0,0 }, /* S_PAIN_DIE1 */
{ SPR_PAIN,32776,4,A_Scream,S_PAIN_DIE3,0,0 }, /* S_PAIN_DIE2 */
{ SPR_PAIN,32777,4,NULL,S_PAIN_DIE4,0,0 }, /* S_PAIN_DIE3 */
{ SPR_PAIN,32778,4,NULL,S_PAIN_DIE5,0,0 }, /* S_PAIN_DIE4 */
{ SPR_PAIN,32779,4,A_PainDie,S_PAIN_DIE6,0,0 }, /* S_PAIN_DIE5 */
{ SPR_PAIN,32780,4,NULL,S_NULL,0,0 }, /* S_PAIN_DIE6 */
{ SPR_ARM1,0,3,NULL,S_ARM1A,0,0 }, /* S_ARM1 */
{ SPR_ARM1,32769,3,NULL,S_ARM1,0,0 }, /* S_ARM1A */
{ SPR_ARM2,0,3,NULL,S_ARM2A,0,0 }, /* S_ARM2 */
{ SPR_ARM2,32769,3,NULL,S_ARM2,0,0 }, /* S_ARM2A */
{ SPR_BAR1,0,3,NULL,S_BAR2,0,0 }, /* S_BAR1 */
{ SPR_BAR1,1,3,NULL,S_BAR1,0,0 }, /* S_BAR2 */
{ SPR_BEXP,32768,2,NULL,S_BEXP2,0,0 }, /* S_BAR2 */
{ SPR_BEXP,32769,3,A_Scream,S_BEXP3,0,0 }, /* S_BEXP2 */
{ SPR_BEXP,32770,3,NULL,S_BEXP4,0,0 }, /* S_BEXP3 */
{ SPR_BEXP,32771,5,A_Explode,S_BEXP5,0,0 }, /* S_BEXP4 */
{ SPR_BEXP,32772,5,NULL,S_NULL,0,0 }, /* S_BEXP5 */
{ SPR_FCAN,32768,2,NULL,S_BBAR2,0,0 }, /* S_BBAR1 */
{ SPR_FCAN,32769,2,NULL,S_BBAR3,0,0 }, /* S_BBAR2 */
{ SPR_FCAN,32770,2,NULL,S_BBAR1,0,0 }, /* S_BBAR3 */
{ SPR_BON1,0,3,NULL,S_BON1A,0,0 }, /* S_BON1 */
{ SPR_BON1,1,3,NULL,S_BON1B,0,0 }, /* S_BON1A */
{ SPR_BON1,2,3,NULL,S_BON1C,0,0 }, /* S_BON1B */
{ SPR_BON1,3,3,NULL,S_BON1D,0,0 }, /* S_BON1C */
{ SPR_BON1,2,3,NULL,S_BON1E,0,0 }, /* S_BON1D */
{ SPR_BON1,1,3,NULL,S_BON1,0,0 }, /* S_BON1E */
{ SPR_BON2,0,3,NULL,S_BON2A,0,0 }, /* S_BON2 */
{ SPR_BON2,1,3,NULL,S_BON2B,0,0 }, /* S_BON2A */
{ SPR_BON2,2,3,NULL,S_BON2C,0,0 }, /* S_BON2B */
{ SPR_BON2,3,3,NULL,S_BON2D,0,0 }, /* S_BON2C */
{ SPR_BON2,2,3,NULL,S_BON2E,0,0 }, /* S_BON2D */
{ SPR_BON2,1,3,NULL,S_BON2,0,0 }, /* S_BON2E */
{ SPR_BKEY,0,5,NULL,S_BKEY2,0,0 }, /* S_BKEY */
{ SPR_BKEY,32769,5,NULL,S_BKEY,0,0 }, /* S_BKEY2 */
{ SPR_RKEY,0,5,NULL,S_RKEY2,0,0 }, /* S_RKEY */
{ SPR_RKEY,32769,5,NULL,S_RKEY,0,0 }, /* S_RKEY2 */
{ SPR_YKEY,0,5,NULL,S_YKEY2,0,0 }, /* S_YKEY */
{ SPR_YKEY,32769,5,NULL,S_YKEY,0,0 }, /* S_YKEY2 */
{ SPR_BSKU,0,5,NULL,S_BSKULL2,0,0 }, /* S_BSKULL */
{ SPR_BSKU,32769,5,NULL,S_BSKULL,0,0 }, /* S_BSKULL2 */
{ SPR_RSKU,0,5,NULL,S_RSKULL2,0,0 }, /* S_RSKULL */
{ SPR_RSKU,32769,5,NULL,S_RSKULL,0,0 }, /* S_RSKULL2 */
{ SPR_YSKU,0,5,NULL,S_YSKULL2,0,0 }, /* S_YSKULL */
{ SPR_YSKU,32769,5,NULL,S_YSKULL,0,0 }, /* S_YSKULL2 */
{ SPR_STIM,0,-1,NULL,S_NULL,0,0 }, /* S_STIM */
{ SPR_MEDI,0,-1,NULL,S_NULL,0,0 }, /* S_MEDI */
{ SPR_SOUL,32768,3,NULL,S_SOUL2,0,0 }, /* S_SOUL */
{ SPR_SOUL,32769,3,NULL,S_SOUL3,0,0 }, /* S_SOUL2 */
{ SPR_SOUL,32770,3,NULL,S_SOUL4,0,0 }, /* S_SOUL3 */
{ SPR_SOUL,32771,3,NULL,S_SOUL5,0,0 }, /* S_SOUL4 */
{ SPR_SOUL,32770,3,NULL,S_SOUL6,0,0 }, /* S_SOUL5 */
{ SPR_SOUL,32769,3,NULL,S_SOUL,0,0 }, /* S_SOUL6 */
{ SPR_PINV,32768,3,NULL,S_PINV2,0,0 }, /* S_PINV */
{ SPR_PINV,32769,3,NULL,S_PINV3,0,0 }, /* S_PINV2 */
{ SPR_PINV,32770,3,NULL,S_PINV4,0,0 }, /* S_PINV3 */
{ SPR_PINV,32771,3,NULL,S_PINV,0,0 }, /* S_PINV4 */
{ SPR_PSTR,32768,-1,NULL,S_NULL,0,0 }, /* S_PSTR */
{ SPR_PINS,32768,3,NULL,S_PINS2,0,0 }, /* S_PINS */
{ SPR_PINS,32769,3,NULL,S_PINS3,0,0 }, /* S_PINS2 */
{ SPR_PINS,32770,3,NULL,S_PINS4,0,0 }, /* S_PINS3 */
{ SPR_PINS,32771,3,NULL,S_PINS,0,0 }, /* S_PINS4 */
{ SPR_MEGA,32768,6,NULL,S_MEGA2,0,0 }, /* S_MEGA */
{ SPR_MEGA,32769,6,NULL,S_MEGA3,0,0 }, /* S_MEGA2 */
{ SPR_MEGA,32770,6,NULL,S_MEGA4,0,0 }, /* S_MEGA3 */
{ SPR_MEGA,32771,6,NULL,S_MEGA,0,0 }, /* S_MEGA4 */
{ SPR_SUIT,32768,-1,NULL,S_NULL,0,0 }, /* S_SUIT */
{ SPR_PMAP,32768,3,NULL,S_PMAP2,0,0 }, /* S_PMAP */
{ SPR_PMAP,32769,3,NULL,S_PMAP3,0,0 }, /* S_PMAP2 */
{ SPR_PMAP,32770,3,NULL,S_PMAP4,0,0 }, /* S_PMAP3 */
{ SPR_PMAP,32771,3,NULL,S_PMAP5,0,0 }, /* S_PMAP4 */
{ SPR_PMAP,32770,3,NULL,S_PMAP6,0,0 }, /* S_PMAP5 */
{ SPR_PMAP,32769,3,NULL,S_PMAP,0,0 }, /* S_PMAP6 */
{ SPR_PVIS,32768,3,NULL,S_PVIS2,0,0 }, /* S_PVIS */
{ SPR_PVIS,1,3,NULL,S_PVIS,0,0 }, /* S_PVIS2 */
{ SPR_CLIP,0,-1,NULL,S_NULL,0,0 }, /* S_CLIP */
{ SPR_AMMO,0,-1,NULL,S_NULL,0,0 }, /* S_AMMO */
{ SPR_ROCK,0,-1,NULL,S_NULL,0,0 }, /* S_ROCK */
{ SPR_BROK,0,-1,NULL,S_NULL,0,0 }, /* S_BROK */
{ SPR_CELL,0,-1,NULL,S_NULL,0,0 }, /* S_CELL */
{ SPR_CELP,0,-1,NULL,S_NULL,0,0 }, /* S_CELP */
{ SPR_SHEL,0,-1,NULL,S_NULL,0,0 }, /* S_SHEL */
{ SPR_SBOX,0,-1,NULL,S_NULL,0,0 }, /* S_SBOX */
{ SPR_BPAK,0,-1,NULL,S_NULL,0,0 }, /* S_BPAK */
{ SPR_BFUG,0,-1,NULL,S_NULL,0,0 }, /* S_BFUG */
{ SPR_MGUN,0,-1,NULL,S_NULL,0,0 }, /* S_MGUN */
{ SPR_CSAW,0,-1,NULL,S_NULL,0,0 }, /* S_CSAW */
{ SPR_LAUN,0,-1,NULL,S_NULL,0,0 }, /* S_LAUN */
{ SPR_PLAS,0,-1,NULL,S_NULL,0,0 }, /* S_PLAS */
{ SPR_SHOT,0,-1,NULL,S_NULL,0,0 }, /* S_SHOT */
{ SPR_SGN2,0,-1,NULL,S_NULL,0,0 }, /* S_SHOT2 */
{ SPR_COLU,32768,-1,NULL,S_NULL,0,0 }, /* S_COLU */
{ SPR_SMT2,0,-1,NULL,S_NULL,0,0 }, /* S_STALAG */
{ SPR_PLAY,13,-1,NULL,S_NULL,0,0 }, /* S_DEADTORSO */
{ SPR_PLAY,18,-1,NULL,S_NULL,0,0 }, /* S_DEADBOTTOM */
{ SPR_POL2,0,-1,NULL,S_NULL,0,0 }, /* S_HEADSONSTICK */
{ SPR_POL5,0,-1,NULL,S_NULL,0,0 }, /* S_GIBS */
{ SPR_POL4,0,-1,NULL,S_NULL,0,0 }, /* S_HEADONASTICK */
{ SPR_POL1,0,-1,NULL,S_NULL,0,0 }, /* S_DEADSTICK */
{ SPR_GOR2,0,-1,NULL,S_NULL,0,0 }, /* S_MEAT2 */
{ SPR_GOR3,0,-1,NULL,S_NULL,0,0 }, /* S_MEAT3 */
{ SPR_GOR4,0,-1,NULL,S_NULL,0,0 }, /* S_MEAT4 */
{ SPR_GOR5,0,-1,NULL,S_NULL,0,0 }, /* S_MEAT5 */
{ SPR_SMIT,0,-1,NULL,S_NULL,0,0 }, /* S_STALAGTITE */
{ SPR_COL1,0,-1,NULL,S_NULL,0,0 }, /* S_TALLGRNCOL */
{ SPR_COL2,0,-1,NULL,S_NULL,0,0 }, /* S_SHRTGRNCOL */
{ SPR_COL3,0,-1,NULL,S_NULL,0,0 }, /* S_TALLREDCOL */
{ SPR_COL4,0,-1,NULL,S_NULL,0,0 }, /* S_SHRTREDCOL */
{ SPR_COL6,0,-1,NULL,S_NULL,0,0 }, /* S_SKULLCOL */
{ SPR_CAND,32768,-1,NULL,S_NULL,0,0 }, /* S_CANDLESTIK */
{ SPR_CBRA,32768,-1,NULL,S_NULL,0,0 }, /* S_CANDELABRA */
{ SPR_TRE1,0,-1,NULL,S_NULL,0,0 }, /* S_TORCHTREE */
{ SPR_ELEC,0,-1,NULL,S_NULL,0,0 }, /* S_TECHPILLAR */
{ SPR_FSKU,32768,3,NULL,S_FLOATSKULL2,0,0 }, /* S_FLOATSKULL */
{ SPR_FSKU,32769,3,NULL,S_FLOATSKULL3,0,0 }, /* S_FLOATSKULL2 */
{ SPR_FSKU,32770,3,NULL,S_FLOATSKULL,0,0 }, /* S_FLOATSKULL3 */
{ SPR_SMBT,32768,2,NULL,S_BTORCHSHRT2,0,0 }, /* S_BTORCHSHRT */
{ SPR_SMBT,32769,2,NULL,S_BTORCHSHRT3,0,0 }, /* S_BTORCHSHRT2 */
{ SPR_SMBT,32770,2,NULL,S_BTORCHSHRT4,0,0 }, /* S_BTORCHSHRT3 */
{ SPR_SMBT,32771,2,NULL,S_BTORCHSHRT,0,0 }, /* S_BTORCHSHRT4 */
{ SPR_SMGT,32768,2,NULL,S_GTORCHSHRT2,0,0 }, /* S_GTORCHSHRT */
{ SPR_SMGT,32769,2,NULL,S_GTORCHSHRT3,0,0 }, /* S_GTORCHSHRT2 */
{ SPR_SMGT,32770,2,NULL,S_GTORCHSHRT4,0,0 }, /* S_GTORCHSHRT3 */
{ SPR_SMGT,32771,2,NULL,S_GTORCHSHRT,0,0 }, /* S_GTORCHSHRT4 */
{ SPR_SMRT,32768,2,NULL,S_RTORCHSHRT2,0,0 }, /* S_RTORCHSHRT */
{ SPR_SMRT,32769,2,NULL,S_RTORCHSHRT3,0,0 }, /* S_RTORCHSHRT2 */
{ SPR_SMRT,32770,2,NULL,S_RTORCHSHRT4,0,0 }, /* S_RTORCHSHRT3 */
{ SPR_SMRT,32771,2,NULL,S_RTORCHSHRT,0,0 }, /* S_RTORCHSHRT4 */
{ SPR_HANC,0,-1,NULL,S_NULL,0,0 }, /* S_HANGCHAIN */
{ SPR_BLCH,0,-1,NULL,S_NULL,0,0 }, /* S_HANGCBLOOD */
{ SPR_HANL,0,-1,NULL,S_NULL,0,0 }, /* S_HANGLAMP */
{ SPR_DED1,0,-1,NULL,S_NULL,0,0 }, /* S_DEADPLAY */
{ SPR_DED2,0,-1,NULL,S_NULL,0,0 }, /* S_DEADPOSS */
{ SPR_DED3,0,-1,NULL,S_NULL,0,0 }, /* S_DEADSPOS */
{ SPR_DED4,0,-1,NULL,S_NULL,0,0 }, /* S_DEADTROO */
{ SPR_DED5,0,-1,NULL,S_NULL,0,0 }, /* S_DEADSARG */
{ SPR_DED6,0,-1,NULL,S_NULL,0,0 }, /* S_DEADHEAD */
{ SPR_TLMP,32768,2,NULL,S_TECHLAMP2,0,0 }, /* S_TECHLAMP */
{ SPR_TLMP,32769,2,NULL,S_TECHLAMP3,0,0 }, /* S_TECHLAMP2 */
{ SPR_TLMP,32770,2,NULL,S_TECHLAMP4,0,0 }, /* S_TECHLAMP3 */
{ SPR_TLMP,32771,2,NULL,S_TECHLAMP,0,0 }, /* S_TECHLAMP4 */
{ SPR_TLP2,32768,2,NULL,S_TECH2LAMP2,0,0 }, /* S_TECH2LAMP */
{ SPR_TLP2,32769,2,NULL,S_TECH2LAMP3,0,0 }, /* S_TECH2LAMP2 */
{ SPR_TLP2,32770,2,NULL,S_TECH2LAMP4,0,0 }, /* S_TECH2LAMP3 */
{ SPR_TLP2,32771,2,NULL,S_TECH2LAMP,0,0 }, /* S_TECH2LAMP4 */
{ SPR_COL5,0,7,NULL,S_HEARTCOL2,0,0 }, /* S_HEARTCOL */
{ SPR_COL5,1,7,NULL,S_HEARTCOL,0,0 }, /* S_HEARTCOL2 */
{ SPR_CEYE,32768,3,NULL,S_EVILEYE2,0,0 }, /* S_EVILEYE */
{ SPR_CEYE,32769,3,NULL,S_EVILEYE3,0,0 }, /* S_EVILEYE2 */
{ SPR_CEYE,32770,3,NULL,S_EVILEYE4,0,0 }, /* S_EVILEYE3 */
{ SPR_CEYE,32769,3,NULL,S_EVILEYE,0,0 }, /* S_EVILEYE4 */
{ SPR_TBLU,32768,2,NULL,S_BLUETORCH2,0,0 }, /* S_BLUETORCH */
{ SPR_TBLU,32769,2,NULL,S_BLUETORCH3,0,0 }, /* S_BLUETORCH2 */
{ SPR_TBLU,32770,2,NULL,S_BLUETORCH4,0,0 }, /* S_BLUETORCH3 */
{ SPR_TBLU,32771,2,NULL,S_BLUETORCH,0,0 }, /* S_BLUETORCH4 */
{ SPR_TGRN,32768,2,NULL,S_GREENTORCH2,0,0 }, /* S_GREENTORCH */
{ SPR_TGRN,32769,2,NULL,S_GREENTORCH3,0,0 }, /* S_GREENTORCH2 */
{ SPR_TGRN,32770,2,NULL,S_GREENTORCH4,0,0 }, /* S_GREENTORCH3 */
{ SPR_TGRN,32771,2,NULL,S_GREENTORCH,0,0 }, /* S_GREENTORCH4 */
{ SPR_TRED,32768,2,NULL,S_REDTORCH2,0,0 }, /* S_REDTORCH */
{ SPR_TRED,32769,2,NULL,S_REDTORCH3,0,0 }, /* S_REDTORCH2 */
{ SPR_TRED,32770,2,NULL,S_REDTORCH4,0,0 }, /* S_REDTORCH3 */
{ SPR_TRED,32771,2,NULL,S_REDTORCH,0,0 }, /* S_REDTORCH4 */
{ SPR_GOR1,0,5,NULL,S_BLOODYTWITCH2,0,0 }, /* S_BLOODYTWITCH */
{ SPR_GOR1,1,7,NULL,S_BLOODYTWITCH3,0,0 }, /* S_BLOODYTWITCH2 */
{ SPR_GOR1,2,4,NULL,S_BLOODYTWITCH4,0,0 }, /* S_BLOODYTWITCH3 */
{ SPR_GOR1,1,3,NULL,S_BLOODYTWITCH,0,0 }, /* S_BLOODYTWITCH4 */
{ SPR_POL3,32768,3,NULL,S_HEADCANDLES2,0,0 }, /* S_HEADCANDLES */
{ SPR_POL3,32769,3,NULL,S_HEADCANDLES,0,0 }, /* S_HEADCANDLES2 */
{ SPR_POL6,0,3,NULL,S_LIVESTICK2,0,0 }, /* S_LIVESTICK */
{ SPR_POL6,1,4,NULL,S_LIVESTICK,0,0 }, /* S_LIVESTICK2 */
{ SPR_TRE2,0,-1,NULL,S_NULL,0,0 }, /* S_BIGTREE */
{ SPR_HDB1,0,-1,NULL,S_NULL,0,0 }, /* S_HANGNOGUTS */
{ SPR_HDB2,0,-1,NULL,S_NULL,0,0 }, /* S_HANGBNOBRAIN */
{ SPR_HDB3,0,-1,NULL,S_NULL,0,0 }, /* S_HANGTLOOKDN */
{ SPR_HDB4,0,-1,NULL,S_NULL,0,0 }, /* S_HANGTSKULL */
{ SPR_HDB5,0,-1,NULL,S_NULL,0,0 }, /* S_HANGTLOOKUP */
{ SPR_HDB6,0,-1,NULL,S_NULL,0,0 }, /* S_HANGTNOBRAIN */
{ SPR_POB1,0,-1,NULL,S_NULL,0,0 }, /* S_COLONGIBS */
{ SPR_POB2,0,-1,NULL,S_NULL,0,0 }, /* S_SMALLPOOL */
{ SPR_BRS1,0,-1,NULL,S_NULL,0,0 } /* S_BRAINSTEM */
};
mobjinfo_t mobjinfo[NUMMOBJTYPES] = //8005DE6C
{
{ /* MT_PLAYER */
-1, /* doomednum */
S_PLAY, /* spawnstate */
100, /* spawnhealth */
S_PLAY_RUN1, /* seestate */
sfx_None, /* seesound */
0, /* reactiontime */
sfx_None, /* attacksound */
S_PLAY_PAIN, /* painstate */
255, /* painchance */
sfx_plpain, /* painsound */
S_NULL, /* meleestate */
S_PLAY_ATK1, /* missilestate */
S_PLAY_DIE1, /* deathstate */
S_PLAY_XDIE1, /* xdeathstate */
sfx_pldeth, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_DROPOFF | MF_PICKUP | MF_NOTDMATCH /* flags */
},
{ /* MT_POSSESSED */
3004, /* doomednum */
S_POSS_STND, /* spawnstate */
20, /* spawnhealth */
S_POSS_RUN1, /* seestate */
sfx_posit1, /* seesound */
8, /* reactiontime */
sfx_pistol, /* attacksound */
S_POSS_PAIN, /* painstate */
200, /* painchance */
sfx_popain, /* painsound */
S_NULL, /* meleestate */
S_POSS_ATK1, /* missilestate */
S_POSS_DIE1, /* deathstate */
S_POSS_XDIE1, /* xdeathstate */
sfx_podth1, /* deathsound */
8, /* speed */
20 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_posact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_SHOTGUY */
9, /* doomednum */
S_SPOS_STND, /* spawnstate */
30, /* spawnhealth */
S_SPOS_RUN1, /* seestate */
sfx_posit2, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_SPOS_PAIN, /* painstate */
170, /* painchance */
sfx_popain, /* painsound */
S_NULL, /* meleestate */
S_SPOS_ATK1, /* missilestate */
S_SPOS_DIE1, /* deathstate */
S_SPOS_XDIE1, /* xdeathstate */
sfx_podth2, /* deathsound */
8, /* speed */
20 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_posact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_UNDEAD */
66, /* doomednum */
S_SKEL_STND, /* spawnstate */
300, /* spawnhealth */
S_SKEL_RUN1, /* seestate */
sfx_skesit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_SKEL_PAIN, /* painstate */
100, /* painchance */
sfx_popain, /* painsound */
S_SKEL_FIST1, /* meleestate */
S_SKEL_MISS1, /* missilestate */
S_SKEL_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_skedth, /* deathsound */
10, /* speed */
20 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
500, /* mass */
0, /* damage */
sfx_skeact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_TRACER */
-1, /* doomednum */
S_TRACER, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_skeatk, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_TRACEEXP1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_barexp, /* deathsound */
10 * FRACUNIT, /* speed */
11 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
10, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_SMOKE */
-1, /* doomednum */
S_SMOKE1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY /* flags */
},
{ /* MT_FATSO */
67, /* doomednum */
S_FATT_STND, /* spawnstate */
600, /* spawnhealth */
S_FATT_RUN1, /* seestate */
sfx_mansit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_FATT_PAIN, /* painstate */
80, /* painchance */
sfx_mnpain, /* painsound */
S_NULL, /* meleestate */
S_FATT_ATK1, /* missilestate */
S_FATT_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_mandth, /* deathsound */
8, /* speed */
48 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
1000, /* mass */
0, /* damage */
sfx_posact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_FATSHOT */
-1, /* doomednum */
S_FATSHOT1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_firsht, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_FATSHOTX1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
30 * FRACUNIT, /* speed */
6 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
8, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_CHAINGUY */
65, /* doomednum */
S_CPOS_STND, /* spawnstate */
70, /* spawnhealth */
S_CPOS_RUN1, /* seestate */
sfx_posit2, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_CPOS_PAIN, /* painstate */
170, /* painchance */
sfx_popain, /* painsound */
S_NULL, /* meleestate */
S_CPOS_ATK1, /* missilestate */
S_CPOS_DIE1, /* deathstate */
S_CPOS_XDIE1, /* xdeathstate */
sfx_podth2, /* deathsound */
8, /* speed */
20 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_posact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_TROOP */
3001, /* doomednum */
S_TROO_STND, /* spawnstate */
60, /* spawnhealth */
S_TROO_RUN1, /* seestate */
sfx_bgsit1, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_TROO_PAIN, /* painstate */
200, /* painchance */
sfx_popain, /* painsound */
S_TROO_ATK1, /* meleestate */
S_TROO_ATK1, /* missilestate */
S_TROO_DIE1, /* deathstate */
S_TROO_XDIE1, /* xdeathstate */
sfx_bgdth1, /* deathsound */
8, /* speed */
20 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_bgact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_SERGEANT */
3002, /* doomednum */
S_SARG_STND, /* spawnstate */
150, /* spawnhealth */
S_SARG_RUN1, /* seestate */
sfx_sgtsit, /* seesound */
8, /* reactiontime */
sfx_sgtatk, /* attacksound */
S_SARG_PAIN, /* painstate */
180, /* painchance */
sfx_dmpain, /* painsound */
S_SARG_ATK1, /* meleestate */
S_NULL, /* missilestate */
S_SARG_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_sgtdth, /* deathsound */
10, /* speed */
30 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
400, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_HEAD */
3005, /* doomednum */
S_HEAD_STND, /* spawnstate */
400, /* spawnhealth */
S_HEAD_RUN1, /* seestate */
sfx_cacsit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_HEAD_PAIN, /* painstate */
128, /* painchance */
sfx_dmpain, /* painsound */
S_NULL, /* meleestate */
S_HEAD_ATK1, /* missilestate */
S_HEAD_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_cacdth, /* deathsound */
8, /* speed */
31 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
400, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_NOGRAVITY | MF_FLOAT | MF_COUNTKILL /* flags */
},
{ /* MT_BRUISER */
3003, /* doomednum */
S_BOSS_STND, /* spawnstate */
1000, /* spawnhealth */
S_BOSS_RUN1, /* seestate */
sfx_brssit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_BOSS_PAIN, /* painstate */
50, /* painchance */
sfx_dmpain, /* painsound */
S_BOSS_ATK1, /* meleestate */
S_BOSS_ATK1, /* missilestate */
S_BOSS_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_brsdth, /* deathsound */
8, /* speed */
24 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
1000, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_KNIGHT */
69, /* doomednum */
S_BOS2_STND, /* spawnstate */
500, /* spawnhealth */
S_BOS2_RUN1, /* seestate */
sfx_kntsit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_BOS2_PAIN, /* painstate */
50, /* painchance */
sfx_dmpain, /* painsound */
S_BOS2_ATK1, /* meleestate */
S_BOS2_ATK1, /* missilestate */
S_BOS2_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_kntdth, /* deathsound */
8, /* speed */
24 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
1000, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_SKULL */
3006, /* doomednum */
S_SKULL_STND, /* spawnstate */
60, /* spawnhealth */
S_SKULL_RUN1, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_sklatk, /* attacksound */
S_SKULL_PAIN, /* painstate */
256, /* painchance */
sfx_dmpain, /* painsound */
S_NULL, /* meleestate */
S_SKULL_ATK1, /* missilestate */
S_SKULL_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
8, /* speed */
16 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
50, /* mass */
3, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_NOGRAVITY | MF_FLOAT | MF_COUNTKILL /* flags */
},
{ /* MT_SPIDER */
7, /* doomednum */
S_SPID_STND, /* spawnstate */
3000, /* spawnhealth */
S_SPID_RUN1, /* seestate */
sfx_spisit, /* seesound */
8, /* reactiontime */
sfx_pistol, /* attacksound */
S_SPID_PAIN, /* painstate */
40, /* painchance */
sfx_dmpain, /* painsound */
S_NULL, /* meleestate */
S_SPID_ATK1, /* missilestate */
S_SPID_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_spidth, /* deathsound */
12, /* speed */
128 * FRACUNIT, /* radius */
100 * FRACUNIT, /* height */
1000, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_BABY */
68, /* doomednum */
S_BSPI_STND, /* spawnstate */
500, /* spawnhealth */
S_BSPI_SIGHT, /* seestate */
sfx_bspsit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_BSPI_PAIN, /* painstate */
128, /* painchance */
sfx_dmpain, /* painsound */
S_NULL, /* meleestate */
S_BSPI_ATK1, /* missilestate */
S_BSPI_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_bspdth, /* deathsound */
12, /* speed */
64 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
600, /* mass */
0, /* damage */
sfx_bspact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_CYBORG */
16, /* doomednum */
S_CYBER_STND, /* spawnstate */
4000, /* spawnhealth */
S_CYBER_RUN1, /* seestate */
sfx_cybsit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_CYBER_PAIN, /* painstate */
20, /* painchance */
sfx_dmpain, /* painsound */
S_NULL, /* meleestate */
S_CYBER_ATK1, /* missilestate */
S_CYBER_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_cybdth, /* deathsound */
16, /* speed */
40 * FRACUNIT, /* radius */
110 * FRACUNIT, /* height */
1000, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL /* flags */
},
{ /* MT_PAIN */
71, /* doomednum */
S_PAIN_STND, /* spawnstate */
400, /* spawnhealth */
S_PAIN_RUN1, /* seestate */
sfx_pesit, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_PAIN_PAIN, /* painstate */
128, /* painchance */
sfx_pepain, /* painsound */
S_NULL, /* meleestate */
S_PAIN_ATK1, /* missilestate */
S_PAIN_DIE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_pedth, /* deathsound */
8, /* speed */
31 * FRACUNIT, /* radius */
56 * FRACUNIT, /* height */
400, /* mass */
0, /* damage */
sfx_dmact, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_NOGRAVITY | MF_FLOAT | MF_COUNTKILL /* flags */
},
{ /* MT_BARREL */
2035, /* doomednum */
S_BAR1, /* spawnstate */
20, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_BEXP, /* deathstate */
S_NULL, /* xdeathstate */
sfx_barexp, /* deathsound */
0, /* speed */
10 * FRACUNIT, /* radius */
42 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD /* flags */
},
{ /* MT_TROOPSHOT */
-1, /* doomednum */
S_TBALL1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_firsht, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_TBALLX1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
20 * FRACUNIT, /* speed */
6 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
3, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_HEADSHOT */
-1, /* doomednum */
S_RBALL1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_firsht, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_RBALLX1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
20 * FRACUNIT, /* speed */
6 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
5, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_BRUISERSHOT */
-1, /* doomednum */
S_BRBALL1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_firsht, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_BRBALLX1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
30 * FRACUNIT, /* speed */
6 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
8, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_ROCKET */
-1, /* doomednum */
S_ROCKET, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_rlaunc, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_EXPLODE1, /* deathstate */
S_NULL, /* xdeathstate */
sfx_barexp, /* deathsound */
40 * FRACUNIT, /* speed */
11 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
20, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_PLASMA */
-1, /* doomednum */
S_PLASBALL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_plasma, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_PLASEXP, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
50 * FRACUNIT, /* speed */
13 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
5, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_BFG */
-1, /* doomednum */
S_BFGSHOT, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_BFGLAND, /* deathstate */
S_NULL, /* xdeathstate */
sfx_rxplod, /* deathsound */
40 * FRACUNIT, /* speed */
13 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
100, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_ARACHPLAZ */
-1, /* doomednum */
S_ARACH_PLAZ, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_plasma, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_ARACH_PLEX, /* deathstate */
S_NULL, /* xdeathstate */
sfx_firxpl, /* deathsound */
25 * FRACUNIT, /* speed */
13 * FRACUNIT, /* radius */
8 * FRACUNIT, /* height */
100, /* mass */
5, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_DROPOFF | MF_MISSILE /* flags */
},
{ /* MT_PUFF */
-1, /* doomednum */
S_PUFF1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_BLENDMASK1 | MF_BLENDMASK2/* flags */
},
{ /* MT_BLOOD */
-1, /* doomednum */
S_BLOOD1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP /* flags */
},
{ /* MT_TFOG */
-1, /* doomednum */
S_TFOG, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_BLENDMASK1 | MF_BLENDMASK2 /* flags */
},
{ /* MT_IFOG */
-1, /* doomednum */
S_IFOG, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY | MF_BLENDMASK1 | MF_BLENDMASK2 /* flags */
},
{ /* MT_TELEPORTMAN */
14, /* doomednum */
S_NULL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOSECTOR | MF_NOBLOCKMAP /* flags */
},
{ /* MT_EXTRABFG */
-1, /* doomednum */
S_BFGEXP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC0 */
2018, /* doomednum */
S_ARM1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC1 */
2019, /* doomednum */
S_ARM2, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC2 */
2014, /* doomednum */
S_BON1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_MISC3 */
2015, /* doomednum */
S_BON2, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_MISC4 */
5, /* doomednum */
S_BKEY, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_NOTDMATCH /* flags */
},
{ /* MT_MISC5 */
13, /* doomednum */
S_RKEY, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_NOTDMATCH /* flags */
},
{ /* MT_MISC6 */
6, /* doomednum */
S_YKEY, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_NOTDMATCH /* flags */
},
{ /* MT_MISC7 */
39, /* doomednum */
S_YSKULL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_NOTDMATCH /* flags */
},
{ /* MT_MISC8 */
38, /* doomednum */
S_RSKULL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_NOTDMATCH /* flags */
},
{ /* MT_MISC9 */
40, /* doomednum */
S_BSKULL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_NOTDMATCH /* flags */
},
{ /* MT_MISC10 */
2011, /* doomednum */
S_STIM, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC11 */
2012, /* doomednum */
S_MEDI, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC12 */
2013, /* doomednum */
S_SOUL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_INV */
2022, /* doomednum */
S_PINV, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_MISC13 */
2023, /* doomednum */
S_PSTR, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_INS */
2024, /* doomednum */
S_PINS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_MISC14 */
2025, /* doomednum */
S_SUIT, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC15 */
2026, /* doomednum */
S_PMAP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_MISC16 */
2045, /* doomednum */
S_PVIS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_MEGA */
83, /* doomednum */
S_MEGA, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL | MF_COUNTITEM /* flags */
},
{ /* MT_CLIP */
2007, /* doomednum */
S_CLIP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC17 */
2048, /* doomednum */
S_AMMO, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC18 */
2010, /* doomednum */
S_ROCK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC19 */
2046, /* doomednum */
S_BROK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC20 */
2047, /* doomednum */
S_CELL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC21 */
17, /* doomednum */
S_CELP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC22 */
2008, /* doomednum */
S_SHEL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC23 */
2049, /* doomednum */
S_SBOX, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC24 */
8, /* doomednum */
S_BPAK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC25 */
2006, /* doomednum */
S_BFUG, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_CHAINGUN */
2002, /* doomednum */
S_MGUN, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC26 */
2005, /* doomednum */
S_CSAW, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC27 */
2003, /* doomednum */
S_LAUN, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC28 */
2004, /* doomednum */
S_PLAS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_SHOTGUN */
2001, /* doomednum */
S_SHOT, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_SUPERSHOTGUN */
82, /* doomednum */
S_SHOT2, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPECIAL /* flags */
},
{ /* MT_MISC29 */
85, /* doomednum */
S_TECHLAMP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC30 */
86, /* doomednum */
S_TECH2LAMP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC31 */
2028, /* doomednum */
S_COLU, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC32 */
30, /* doomednum */
S_TALLGRNCOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC33 */
31, /* doomednum */
S_SHRTGRNCOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC34 */
32, /* doomednum */
S_TALLREDCOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC35 */
33, /* doomednum */
S_SHRTREDCOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC36 */
37, /* doomednum */
S_SKULLCOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC37 */
36, /* doomednum */
S_HEARTCOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC38 */
41, /* doomednum */
S_EVILEYE, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC39 */
42, /* doomednum */
S_FLOATSKULL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | 0 /* flags */
},
{ /* MT_MISC40 */
43, /* doomednum */
S_TORCHTREE, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC41 */
44, /* doomednum */
S_BLUETORCH, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC42 */
45, /* doomednum */
S_GREENTORCH, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC43 */
46, /* doomednum */
S_REDTORCH, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC44 */
55, /* doomednum */
S_BTORCHSHRT, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC45 */
56, /* doomednum */
S_GTORCHSHRT, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC46 */
57, /* doomednum */
S_RTORCHSHRT, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC47 */
47, /* doomednum */
S_STALAGTITE, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC48 */
48, /* doomednum */
S_TECHPILLAR, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC49 */
34, /* doomednum */
S_CANDLESTIK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC50 */
35, /* doomednum */
S_CANDELABRA, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC51 */
49, /* doomednum */
S_BLOODYTWITCH, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
68 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC52 */
50, /* doomednum */
S_MEAT2, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
84 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC53 */
51, /* doomednum */
S_MEAT3, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
84 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC54 */
52, /* doomednum */
S_MEAT4, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
68 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC55 */
59, /* doomednum */
S_MEAT2, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
84 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY | 0 /* flags */
},
{ /* MT_MISC56 */
60, /* doomednum */
S_MEAT4, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
68 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC57 */
61, /* doomednum */
S_MEAT3, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
52 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC58 */
53, /* doomednum */
S_MEAT5, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
52 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC59 */
62, /* doomednum */
S_MEAT5, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
52 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC60 */
63, /* doomednum */
S_HANGCHAIN, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
13 * FRACUNIT, /* radius */
108 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC61 */
64, /* doomednum */
S_HANGCBLOOD, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
13 * FRACUNIT, /* radius */
108 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC62 */
90, /* doomednum */ /* [GEC] FIXME 65 */
S_HANGLAMP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
32 * FRACUNIT, /* radius */
71 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC63 */
22, /* doomednum */
S_DEADHEAD, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC64 */
18, /* doomednum */
S_DEADPOSS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC65 */
21, /* doomednum */
S_DEADSARG, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC66 */
20, /* doomednum */
S_DEADTROO, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC67 */
19, /* doomednum */
S_DEADSPOS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC68 */
10, /* doomednum */
S_DEADPLAY, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC69 */
12, /* doomednum */
S_DEADPLAY, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC70 */
28, /* doomednum */
S_HEADSONSTICK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC71 */
29, /* doomednum */
S_HEADCANDLES, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC72 */
24, /* doomednum */
S_GIBS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
0 /* flags */
},
{ /* MT_MISC73 */
27, /* doomednum */
S_HEADONASTICK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC74 */
25, /* doomednum */
S_DEADSTICK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC75 */
26, /* doomednum */
S_LIVESTICK, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC76 */
54, /* doomednum */
S_BIGTREE, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
32 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC77 */
70, /* doomednum */
S_BBAR1, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID /* flags */
},
{ /* MT_MISC78 */
73, /* doomednum */
S_HANGNOGUTS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
88 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC79 */
74, /* doomednum */
S_HANGBNOBRAIN, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
88 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC80 */
75, /* doomednum */
S_HANGTLOOKDN, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC81 */
76, /* doomednum */
S_HANGTSKULL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC82 */
77, /* doomednum */
S_HANGTLOOKUP, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC83 */
78, /* doomednum */
S_HANGTNOBRAIN, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
16 * FRACUNIT, /* radius */
64 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_SOLID | MF_SPAWNCEILING | MF_NOGRAVITY /* flags */
},
{ /* MT_MISC84 */
79, /* doomednum */
S_COLONGIBS, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP /* flags */
},
{ /* MT_MISC85 */
80, /* doomednum */
S_SMALLPOOL, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP /* flags */
},
{ /* MT_MISC86 */
81, /* doomednum */
S_BRAINSTEM, /* spawnstate */
1000, /* spawnhealth */
S_NULL, /* seestate */
sfx_None, /* seesound */
8, /* reactiontime */
sfx_None, /* attacksound */
S_NULL, /* painstate */
0, /* painchance */
sfx_None, /* painsound */
S_NULL, /* meleestate */
S_NULL, /* missilestate */
S_NULL, /* deathstate */
S_NULL, /* xdeathstate */
sfx_None, /* deathsound */
0, /* speed */
20 * FRACUNIT, /* radius */
16 * FRACUNIT, /* height */
100, /* mass */
0, /* damage */
sfx_None, /* activesound */
MF_NOBLOCKMAP /* flags */
}
};
================================================
FILE: PSXDOOM/info.h
================================================
/* generated by multigen */
typedef enum {
SPR_TROO,
SPR_SHTG,
SPR_PUNG,
SPR_PISG,
SPR_PISF,
SPR_SHTF,
SPR_SHT2,
SPR_CHGG,
SPR_CHGF,
SPR_MISG,
SPR_MISF,
SPR_SAWG,
SPR_PLSG,
SPR_PLSF,
SPR_BFGG,
SPR_BFGF,
SPR_BLUD,
SPR_PUFF,
SPR_BAL1,
SPR_BAL2,
SPR_BAL7,
SPR_PLSS,
SPR_PLSE,
SPR_MISL,
SPR_BFS1,
SPR_BFE1,
SPR_BFE2,
SPR_TFOG,
SPR_IFOG,
SPR_PLAY,
SPR_POSS,
SPR_SPOS,
SPR_FATB,
SPR_FBXP,
SPR_SKEL,
SPR_MANF,
SPR_FATT,
SPR_CPOS,
SPR_SARG,
SPR_HEAD,
SPR_BOSS,
SPR_BOS2,
SPR_SKUL,
SPR_SPID,
SPR_BSPI,
SPR_APLS,
SPR_APBX,
SPR_CYBR,
SPR_PAIN,
SPR_ARM1,
SPR_ARM2,
SPR_BAR1,
SPR_BEXP,
SPR_FCAN,
SPR_BON1,
SPR_BON2,
SPR_BKEY,
SPR_RKEY,
SPR_YKEY,
SPR_BSKU,
SPR_RSKU,
SPR_YSKU,
SPR_STIM,
SPR_MEDI,
SPR_SOUL,
SPR_PINV,
SPR_PSTR,
SPR_PINS,
SPR_MEGA,
SPR_SUIT,
SPR_PMAP,
SPR_PVIS,
SPR_CLIP,
SPR_AMMO,
SPR_ROCK,
SPR_BROK,
SPR_CELL,
SPR_CELP,
SPR_SHEL,
SPR_SBOX,
SPR_BPAK,
SPR_BFUG,
SPR_MGUN,
SPR_CSAW,
SPR_LAUN,
SPR_PLAS,
SPR_SHOT,
SPR_SGN2,
SPR_COLU,
SPR_SMT2,
SPR_POL2,
SPR_POL5,
SPR_POL4,
SPR_POL1,
SPR_GOR2,
SPR_GOR3,
SPR_GOR4,
SPR_GOR5,
SPR_SMIT,
SPR_COL1,
SPR_COL2,
SPR_COL3,
SPR_COL4,
SPR_COL6,
SPR_CAND,
SPR_CBRA,
SPR_TRE1,
SPR_ELEC,
SPR_FSKU,
SPR_SMBT,
SPR_SMGT,
SPR_SMRT,
SPR_HANC,
SPR_BLCH,
SPR_HANL,
SPR_DED1,
SPR_DED2,
SPR_DED3,
SPR_DED4,
SPR_DED5,
SPR_DED6,
SPR_TLMP,
SPR_TLP2,
SPR_COL5,
SPR_CEYE,
SPR_TBLU,
SPR_TGRN,
SPR_TRED,
SPR_GOR1,
SPR_POL3,
SPR_POL6,
SPR_TRE2,
SPR_HDB1,
SPR_HDB2,
SPR_HDB3,
SPR_HDB4,
SPR_HDB5,
SPR_HDB6,
SPR_POB1,
SPR_POB2,
SPR_BRS1,
NUMSPRITES
} spritenum_t;
typedef enum
{
S_NULL, //0
S_LIGHTDONE, //1
S_PUNCH, //2
S_PUNCHDOWN, //3
S_PUNCHUP, //4
S_PUNCH1, //5
S_PUNCH2, //6
S_PUNCH3, //7
S_PUNCH4, //8
S_PUNCH5, //9
S_PISTOL, //10
S_PISTOLDOWN, //11
S_PISTOLUP, //12
S_PISTOL1, //13
S_PISTOL2, //14
S_PISTOL3, //15
S_PISTOL4, //16
S_PISTOLFLASH, //17
S_SGUN, //18
S_SGUNDOWN, //19
S_SGUNUP, //20
S_SGUN1, //21
S_SGUN2, //22
S_SGUN3, //23
S_SGUN4, //24
S_SGUN5, //25
S_SGUN6, //26
S_SGUN7, //27
S_SGUN8, //28
S_SGUN9, //29
S_SGUNFLASH1, //30
S_SGUNFLASH2, //31
S_DSGUN, //32
S_DSGUNDOWN, //33
S_DSGUNUP, //34
S_DSGUN1, //35
S_DSGUN2, //36
S_DSGUN3, //37
S_DSGUN4, //38
S_DSGUN5, //39
S_DSGUN6, //40
S_DSGUN7, //41
S_DSGUN8, //42
S_DSGUN9, //43
S_DSGUN10, //44
S_DSNR1, //45
S_DSNR2, //46
S_DSGUNFLASH1, //47
S_DSGUNFLASH2, //48
S_CHAIN, //49
S_CHAINDOWN, //50
S_CHAINUP, //51
S_CHAIN1, //52
S_CHAIN2, //53
S_CHAIN3, //54
S_CHAINFLASH1, //55
S_CHAINFLASH2, //56
S_MISSILE, //57
S_MISSILEDOWN, //58
S_MISSILEUP, //59
S_MISSILE1, //60
S_MISSILE2, //61
S_MISSILE3, //62
S_MISSILEFLASH1,//63
S_MISSILEFLASH2,//64
S_MISSILEFLASH3,//65
S_MISSILEFLASH4,//66
S_SAW, //67
S_SAWB, //68
S_SAWDOWN, //69
S_SAWUP, //70
S_SAW1, //71
S_SAW2, //72
S_SAW3, //73
S_PLASMA, //74
S_PLASMADOWN, //75
S_PLASMAUP, //76
S_PLASMA1, //77
S_PLASMA2, //78
S_PLASMAFLASH1, //79
S_PLASMAFLASH2, //80
S_BFG, //81
S_BFGDOWN, //82
S_BFGUP, //83
S_BFG1, //84
S_BFG2, //85
S_BFG3, //86
S_BFG4, //87
S_BFGFLASH1, //88
S_BFGFLASH2, //89
S_BLOOD1, //90
S_BLOOD2, //91
S_BLOOD3, //92
S_PUFF1, //93
S_PUFF2, //94
S_PUFF3, //95
S_PUFF4, //96
S_TBALL1, //97
S_TBALL2, //98
S_TBALLX1, //99
S_TBALLX2, //100
S_TBALLX3, //101
S_RBALL1, //102
S_RBALL2, //103
S_RBALLX1, //104
S_RBALLX2, //105
S_RBALLX3, //106
S_BRBALL1, //107
S_BRBALL2, //108
S_BRBALLX1, //109
S_BRBALLX2, //110
S_BRBALLX3, //111
S_PLASBALL, //112
S_PLASBALL2, //113
S_PLASEXP, //114
S_PLASEXP2, //115
S_PLASEXP3, //116
S_PLASEXP4, //117
S_PLASEXP5, //118
S_ROCKET, //119
S_BFGSHOT, //120
S_BFGSHOT2, //121
S_BFGLAND, //122
S_BFGLAND2, //123
S_BFGLAND3, //124
S_BFGLAND4, //125
S_BFGLAND5, //126
S_BFGLAND6, //127
S_BFGEXP, //128
S_BFGEXP2, //129
S_BFGEXP3, //130
S_BFGEXP4, //131
S_EXPLODE1, //132
S_EXPLODE2, //133
S_EXPLODE3, //134
S_TFOG, //135
S_TFOG01, //136
S_TFOG02, //137
S_TFOG2, //138
S_TFOG3, //139
S_TFOG4, //140
S_TFOG5, //141
S_TFOG6, //142
S_TFOG7, //143
S_TFOG8, //144
S_TFOG9, //145
S_TFOG10, //146
S_IFOG, //147
S_IFOG01, //148
S_IFOG02, //149
S_IFOG2, //150
S_IFOG3, //151
S_IFOG4, //152
S_IFOG5, //153
S_PLAY, //154
S_PLAY_RUN1, //155
S_PLAY_RUN2, //156
S_PLAY_RUN3, //157
S_PLAY_RUN4, //158
S_PLAY_ATK1, //159
S_PLAY_ATK2, //160
S_PLAY_PAIN, //161
S_PLAY_PAIN2, //162
S_PLAY_DIE1, //163
S_PLAY_DIE2, //164
S_PLAY_DIE3, //165
S_PLAY_DIE4, //166
S_PLAY_DIE5, //167
S_PLAY_DIE6, //168
S_PLAY_DIE7, //169
S_PLAY_XDIE1, //170
S_PLAY_XDIE2, //171
S_PLAY_XDIE3, //172
S_PLAY_XDIE4, //173
S_PLAY_XDIE5, //174
S_PLAY_XDIE6, //175
S_PLAY_XDIE7, //176
S_PLAY_XDIE8, //177
S_PLAY_XDIE9, //178
S_POSS_STND, //179
S_POSS_STND2, //180
S_POSS_RUN1, //181
S_POSS_RUN2, //182
S_POSS_RUN3, //183
S_POSS_RUN4, //184
S_POSS_RUN5, //185
S_POSS_RUN6, //186
S_POSS_RUN7, //187
S_POSS_RUN8, //188
S_POSS_ATK1, //189
S_POSS_ATK2, //190
S_POSS_ATK3, //191
S_POSS_PAIN, //192
S_POSS_PAIN2, //193
S_POSS_DIE1, //194
S_POSS_DIE2, //195
S_POSS_DIE3, //196
S_POSS_DIE4, //197
S_POSS_DIE5, //198
S_POSS_XDIE1, //199
S_POSS_XDIE2, //200
S_POSS_XDIE3, //201
S_POSS_XDIE4, //202
S_POSS_XDIE5, //203
S_POSS_XDIE6, //204
S_POSS_XDIE7, //205
S_POSS_XDIE8, //206
S_POSS_XDIE9, //207
S_SPOS_STND, //208
S_SPOS_STND2, //209
S_SPOS_RUN1, //210
S_SPOS_RUN2, //211
S_SPOS_RUN3, //212
S_SPOS_RUN4, //213
S_SPOS_RUN5, //214
S_SPOS_RUN6, //215
S_SPOS_RUN7, //216
S_SPOS_RUN8, //217
S_SPOS_ATK1, //218
S_SPOS_ATK2, //219
S_SPOS_ATK3, //220
S_SPOS_PAIN, //221
S_SPOS_PAIN2, //222
S_SPOS_DIE1, //223
S_SPOS_DIE2, //224
S_SPOS_DIE3, //225
S_SPOS_DIE4, //226
S_SPOS_DIE5, //227
S_SPOS_XDIE1, //228
S_SPOS_XDIE2, //229
S_SPOS_XDIE3, //230
S_SPOS_XDIE4, //231
S_SPOS_XDIE5, //232
S_SPOS_XDIE6, //233
S_SPOS_XDIE7, //234
S_SPOS_XDIE8, //225
S_SPOS_XDIE9, //236
S_SMOKE1, //237
S_SMOKE2, //238
S_SMOKE3, //239
S_SMOKE4, //240
S_SMOKE5, //241
S_TRACER, //242
S_TRACER2, //243
S_TRACEEXP1, //244
S_TRACEEXP2, //245
S_TRACEEXP3, //246
S_SKEL_STND, //247
S_SKEL_STND2, //248
S_SKEL_RUN1, //249
S_SKEL_RUN2, //250
S_SKEL_RUN3, //251
S_SKEL_RUN4, //252
S_SKEL_RUN5, //253
S_SKEL_RUN6, //254
S_SKEL_RUN7, //255
S_SKEL_RUN8, //256
S_SKEL_RUN9, //257
S_SKEL_RUN10, //258
S_SKEL_RUN11, //259
S_SKEL_RUN12, //260
S_SKEL_FIST1, //261
S_SKEL_FIST2, //262
S_SKEL_FIST3, //263
S_SKEL_FIST4, //264
S_SKEL_MISS1, //265
S_SKEL_MISS2, //266
S_SKEL_MISS3, //267
S_SKEL_MISS4, //268
S_SKEL_PAIN, //269
S_SKEL_PAIN2, //270
S_SKEL_DIE1, //271
S_SKEL_DIE2, //272
S_SKEL_DIE3, //273
S_SKEL_DIE4, //274
S_SKEL_DIE5, //275
S_SKEL_DIE6, //276
S_FATSHOT1, //277
S_FATSHOT2, //278
S_FATSHOTX1, //279
S_FATSHOTX2, //280
S_FATSHOTX3, //281
S_FATT_STND, //282
S_FATT_STND2, //283
S_FATT_RUN1, //284
S_FATT_RUN2, //285
S_FATT_RUN3, //286
S_FATT_RUN4, //287
S_FATT_RUN5, //288
S_FATT_RUN6, //289
S_FATT_RUN7, //290
S_FATT_RUN8, //291
S_FATT_RUN9, //292
S_FATT_RUN10, //293
S_FATT_RUN11, //294
S_FATT_RUN12, //295
S_FATT_ATK1, //296
S_FATT_ATK2, //297
S_FATT_ATK3, //298
S_FATT_ATK4, //299
S_FATT_ATK5, //300
S_FATT_ATK6, //301
S_FATT_ATK7, //302
S_FATT_ATK8, //303
S_FATT_ATK9, //304
S_FATT_ATK10, //305
S_FATT_PAIN, //306
S_FATT_PAIN2, //307
S_FATT_DIE1, //308
S_FATT_DIE2, //309
S_FATT_DIE3, //310
S_FATT_DIE4, //311
S_FATT_DIE5, //312
S_FATT_DIE6, //313
S_FATT_DIE7, //314
S_FATT_DIE8, //315
S_FATT_DIE9, //316
S_FATT_DIE10, //317
S_CPOS_STND, //318
S_CPOS_STND2, //319
S_CPOS_RUN1, //320
S_CPOS_RUN2, //321
S_CPOS_RUN3, //322
S_CPOS_RUN4, //323
S_CPOS_RUN5, //324
S_CPOS_RUN6, //325
S_CPOS_RUN7, //326
S_CPOS_RUN8, //327
S_CPOS_ATK1, //328
S_CPOS_ATK2, //329
S_CPOS_ATK3, //330
S_CPOS_ATK4, //331
S_CPOS_PAIN, //332
S_CPOS_PAIN2, //333
S_CPOS_DIE1, //334
S_CPOS_DIE2, //335
S_CPOS_DIE3, //336
S_CPOS_DIE4, //337
S_CPOS_DIE5, //338
S_CPOS_DIE6, //339
S_CPOS_DIE7, //340
S_CPOS_XDIE1, //341
S_CPOS_XDIE2, //342
S_CPOS_XDIE3, //343
S_CPOS_XDIE4, //344
S_CPOS_XDIE5, //345
S_CPOS_XDIE6, //346
S_TROO_STND, //347
S_TROO_STND2, //348
S_TROO_RUN1, //349
S_TROO_RUN2, //350
S_TROO_RUN3, //351
S_TROO_RUN4, //352
S_TROO_RUN5, //353
S_TROO_RUN6, //354
S_TROO_RUN7, //355
S_TROO_RUN8, //356
S_TROO_ATK1, //357
S_TROO_ATK2, //358
S_TROO_ATK3, //359
S_TROO_PAIN, //360
S_TROO_PAIN2, //361
S_TROO_DIE1, //362
S_TROO_DIE2, //363
S_TROO_DIE3, //364
S_TROO_DIE4, //365
S_TROO_DIE5, //366
S_TROO_XDIE1, //367
S_TROO_XDIE2, //368
S_TROO_XDIE3, //369
S_TROO_XDIE4, //370
S_TROO_XDIE5, //371
S_TROO_XDIE6, //372
S_TROO_XDIE7, //373
S_TROO_XDIE8, //374
S_SARG_STND, //375
S_SARG_STND2, //376
S_SARG_RUN1, //377
S_SARG_RUN2, //378
S_SARG_RUN3, //379
S_SARG_RUN4, //380
S_SARG_RUN5, //381
S_SARG_RUN6, //382
S_SARG_RUN7, //383
S_SARG_RUN8, //384
S_SARG_ATK1, //385
S_SARG_ATK2, //386
S_SARG_ATK3, //387
S_SARG_PAIN, //388
S_SARG_PAIN2, //389
S_SARG_DIE1, //390
S_SARG_DIE2, //391
S_SARG_DIE3, //392
S_SARG_DIE4, //393
S_SARG_DIE5, //394
S_SARG_DIE6, //395
S_HEAD_STND, //396
S_HEAD_RUN1, //397
S_HEAD_ATK1, //398
S_HEAD_ATK2, //399
S_HEAD_ATK3, //400
S_HEAD_PAIN, //401
S_HEAD_PAIN2, //402
S_HEAD_PAIN3, //403
S_HEAD_DIE1, //404
S_HEAD_DIE2, //405
S_HEAD_DIE3, //406
S_HEAD_DIE4, //407
S_HEAD_DIE5, //408
S_HEAD_DIE6, //409
S_BOSS_STND, //410
S_BOSS_STND2, //411
S_BOSS_RUN1, //412
S_BOSS_RUN2, //413
S_BOSS_RUN3, //414
S_BOSS_RUN4, //415
S_BOSS_RUN5, //416
S_BOSS_RUN6, //417
S_BOSS_RUN7, //418
S_BOSS_RUN8, //419
S_BOSS_ATK1, //420
S_BOSS_ATK2, //421
S_BOSS_ATK3, //422
S_BOSS_PAIN, //423
S_BOSS_PAIN2, //424
S_BOSS_DIE1, //425
S_BOSS_DIE2, //426
S_BOSS_DIE3, //427
S_BOSS_DIE4, //428
S_BOSS_DIE5, //429
S_BOSS_DIE6, //430
S_BOSS_DIE7, //431
S_BOS2_STND, //432
S_BOS2_STND2, //433
S_BOS2_RUN1, //434
S_BOS2_RUN2, //435
S_BOS2_RUN3, //436
S_BOS2_RUN4, //437
S_BOS2_RUN5, //438
S_BOS2_RUN6, //439
S_BOS2_RUN7, //440
S_BOS2_RUN8, //441
S_BOS2_ATK1, //442
S_BOS2_ATK2, //443
S_BOS2_ATK3, //444
S_BOS2_PAIN, //445
S_BOS2_PAIN2, //446
S_BOS2_DIE1, //447
S_BOS2_DIE2, //448
S_BOS2_DIE3, //449
S_BOS2_DIE4, //450
S_BOS2_DIE5, //451
S_BOS2_DIE6, //452
S_BOS2_DIE7, //453
S_SKULL_STND, //454
S_SKULL_STND2, //455
S_SKULL_RUN1, //456
S_SKULL_RUN2, //457
S_SKULL_ATK1, //458
S_SKULL_ATK2, //459
S_SKULL_ATK3, //460
S_SKULL_ATK4, //461
S_SKULL_PAIN, //462
S_SKULL_PAIN2, //463
S_SKULL_DIE1, //464
S_SKULL_DIE2, //465
S_SKULL_DIE3, //466
S_SKULL_DIE4, //467
S_SKULL_DIE5, //468
S_SKULL_DIE6, //469
S_SPID_STND, //470
S_SPID_STND2, //471
S_SPID_RUN1, //472
S_SPID_RUN2, //473
S_SPID_RUN3, //474
S_SPID_RUN4, //475
S_SPID_RUN5, //476
S_SPID_RUN6, //477
S_SPID_RUN7, //478
S_SPID_RUN8, //479
S_SPID_RUN9, //480
S_SPID_RUN10, //481
S_SPID_RUN11, //482
S_SPID_RUN12, //483
S_SPID_ATK1, //484
S_SPID_ATK2, //485
S_SPID_ATK3, //486
S_SPID_ATK4, //487
S_SPID_PAIN, //488
S_SPID_PAIN2, //489
S_SPID_DIE1, //490
S_SPID_DIE2, //491
S_SPID_DIE3, //492
S_SPID_DIE4, //493
S_SPID_DIE5, //494
S_SPID_DIE6, //495
S_SPID_DIE7, //496
S_SPID_DIE8, //497
S_SPID_DIE9, //498
S_SPID_DIE10, //499
S_SPID_DIE11, //500
S_BSPI_STND, //501
S_BSPI_STND2, //502
S_BSPI_SIGHT, //503
S_BSPI_RUN1, //504
S_BSPI_RUN2, //505
S_BSPI_RUN3, //506
S_BSPI_RUN4, //507
S_BSPI_RUN5, //508
S_BSPI_RUN6, //509
S_BSPI_RUN7, //510
S_BSPI_RUN8, //511
S_BSPI_RUN9, //512
S_BSPI_RUN10, //513
S_BSPI_RUN11, //514
S_BSPI_RUN12, //515
S_BSPI_ATK1, //516
S_BSPI_ATK2, //517
S_BSPI_ATK3, //518
S_BSPI_ATK4, //519
S_BSPI_PAIN, //520
S_BSPI_PAIN2, //521
S_BSPI_DIE1, //522
S_BSPI_DIE2, //523
S_BSPI_DIE3, //524
S_BSPI_DIE4, //525
S_BSPI_DIE5, //526
S_BSPI_DIE6, //527
S_BSPI_DIE7, //528
S_ARACH_PLAZ, //529
S_ARACH_PLAZ2, //530
S_ARACH_PLEX, //531
S_ARACH_PLEX2, //532
S_ARACH_PLEX3, //533
S_ARACH_PLEX4, //534
S_ARACH_PLEX5, //535
S_CYBER_STND, //536
S_CYBER_STND2, //537
S_CYBER_RUN1, //538
S_CYBER_RUN2, //539
S_CYBER_RUN3, //540
S_CYBER_RUN4, //541
S_CYBER_RUN5, //542
S_CYBER_RUN6, //543
S_CYBER_RUN7, //544
S_CYBER_RUN8, //545
S_CYBER_ATK1, //546
S_CYBER_ATK2, //547
S_CYBER_ATK3, //548
S_CYBER_ATK4, //549
S_CYBER_ATK5, //550
S_CYBER_ATK6, //551
S_CYBER_PAIN, //552
S_CYBER_DIE1, //553
S_CYBER_DIE2, //554
S_CYBER_DIE3, //555
S_CYBER_DIE4, //556
S_CYBER_DIE5, //557
S_CYBER_DIE6, //558
S_CYBER_DIE7, //559
S_CYBER_DIE8, //560
S_CYBER_DIE9, //561
S_CYBER_DIE10, //562
S_PAIN_STND, //563
S_PAIN_RUN1, //564
S_PAIN_RUN2, //565
S_PAIN_RUN3, //566
S_PAIN_RUN4, //567
S_PAIN_RUN5, //568
S_PAIN_RUN6, //569
S_PAIN_ATK1, //570
S_PAIN_ATK2, //571
S_PAIN_ATK3, //572
S_PAIN_ATK4, //573
S_PAIN_PAIN, //574
S_PAIN_PAIN2, //575
S_PAIN_DIE1, //576
S_PAIN_DIE2, //577
S_PAIN_DIE3, //578
S_PAIN_DIE4, //579
S_PAIN_DIE5, //580
S_PAIN_DIE6, //581
S_ARM1, //582
S_ARM1A, //583
S_ARM2, //584
S_ARM2A, //585
S_BAR1, //586
S_BAR2, //587
S_BEXP, //588
S_BEXP2, //589
S_BEXP3, //590
S_BEXP4, //591
S_BEXP5, //592
S_BBAR1, //593
S_BBAR2, //594
S_BBAR3, //595
S_BON1, //596
S_BON1A, //597
S_BON1B, //598
S_BON1C, //599
S_BON1D, //600
S_BON1E, //601
S_BON2, //602
S_BON2A, //603
S_BON2B, //604
S_BON2C, //605
S_BON2D, //606
S_BON2E, //607
S_BKEY, //608
S_BKEY2, //609
S_RKEY, //610
S_RKEY2, //611
S_YKEY, //612
S_YKEY2, //613
S_BSKULL, //614
S_BSKULL2, //615
S_RSKULL, //616
S_RSKULL2, //617
S_YSKULL, //618
S_YSKULL2, //619
S_STIM, //620
S_MEDI, //621
S_SOUL, //622
S_SOUL2, //623
S_SOUL3, //624
S_SOUL4, //625
S_SOUL5, //626
S_SOUL6, //627
S_PINV, //628
S_PINV2, //629
S_PINV3, //630
S_PINV4, //631
S_PSTR, //632
S_PINS, //633
S_PINS2, //634
S_PINS3, //635
S_PINS4, //636
S_MEGA, //637
S_MEGA2, //638
S_MEGA3, //639
S_MEGA4, //640
S_SUIT, //641
S_PMAP, //642
S_PMAP2, //643
S_PMAP3, //644
S_PMAP4, //645
S_PMAP5, //646
S_PMAP6, //647
S_PVIS, //648
S_PVIS2, //649
S_CLIP, //650
S_AMMO, //651
S_ROCK, //652
S_BROK, //653
S_CELL, //654
S_CELP, //655
S_SHEL, //656
S_SBOX, //657
S_BPAK, //658
S_BFUG, //659
S_MGUN, //660
S_CSAW, //661
S_LAUN, //662
S_PLAS, //663
S_SHOT, //664
S_SHOT2, //665
S_COLU, //666
S_STALAG, //667
S_DEADTORSO, //668
S_DEADBOTTOM, //669
S_HEADSONSTICK, //670
S_GIBS, //671
S_HEADONASTICK, //672
S_DEADSTICK, //673
S_MEAT2, //674
S_MEAT3, //675
S_MEAT4, //676
S_MEAT5, //677
S_STALAGTITE, //678
S_TALLGRNCOL, //679
S_SHRTGRNCOL, //680
S_TALLREDCOL, //681
S_SHRTREDCOL, //682
S_SKULLCOL, //683
S_CANDLESTIK, //684
S_CANDELABRA, //685
S_TORCHTREE, //686
S_TECHPILLAR, //687
S_FLOATSKULL, //688
S_FLOATSKULL2, //689
S_FLOATSKULL3, //690
S_BTORCHSHRT, //691
S_BTORCHSHRT2, //692
S_BTORCHSHRT3, //693
S_BTORCHSHRT4, //694
S_GTORCHSHRT, //695
S_GTORCHSHRT2, //696
S_GTORCHSHRT3, //697
S_GTORCHSHRT4, //698
S_RTORCHSHRT, //699
S_RTORCHSHRT2, //700
S_RTORCHSHRT3, //701
S_RTORCHSHRT4, //702
S_HANGCHAIN, //703
S_HANGCBLOOD, //704
S_HANGLAMP, //705
S_DEADPLAY, //706
S_DEADPOSS, //707
S_DEADSPOS, //708
S_DEADTROO, //709
S_DEADSARG, //710
S_DEADHEAD, //711
S_TECHLAMP, //712
S_TECHLAMP2, //713
S_TECHLAMP3, //714
S_TECHLAMP4, //715
S_TECH2LAMP, //716
S_TECH2LAMP2, //717
S_TECH2LAMP3, //718
S_TECH2LAMP4, //719
S_HEARTCOL, //720
S_HEARTCOL2, //721
S_EVILEYE, //722
S_EVILEYE2, //723
S_EVILEYE3, //724
S_EVILEYE4, //725
S_BLUETORCH, //726
S_BLUETORCH2, //727
S_BLUETORCH3, //728
S_BLUETORCH4, //729
S_GREENTORCH, //730
S_GREENTORCH2, //731
S_GREENTORCH3, //732
S_GREENTORCH4, //733
S_REDTORCH, //734
S_REDTORCH2, //735
S_REDTORCH3, //736
S_REDTORCH4, //737
S_BLOODYTWITCH, //738
S_BLOODYTWITCH2,//739
S_BLOODYTWITCH3,//740
S_BLOODYTWITCH4,//741
S_HEADCANDLES, //742
S_HEADCANDLES2, //743
S_LIVESTICK, //744
S_LIVESTICK2, //745
S_BIGTREE, //746
S_HANGNOGUTS, //747
S_HANGBNOBRAIN, //748
S_HANGTLOOKDN, //749
S_HANGTSKULL, //750
S_HANGTLOOKUP, //751
S_HANGTNOBRAIN, //752
S_COLONGIBS, //753
S_SMALLPOOL, //754
S_BRAINSTEM, //755
NUMSTATES
} statenum_t;
typedef struct
{
spritenum_t sprite;
long frame;
long tics;
void (*action) ();
statenum_t nextstate;
long misc1, misc2;
} state_t;
extern state_t states[NUMSTATES];
extern char *sprnames[NUMSPRITES];
typedef enum
{
MT_PLAYER, //Player
MT_POSSESSED, //ZombieMan
MT_SHOTGUY, //ShotgunGuy
MT_UNDEAD, //Revenant
MT_TRACER, //Revenant Tracer
MT_SMOKE, //Revenant Tracer Smoke
MT_FATSO, //Mancubus
MT_FATSHOT, //Mancubus Fireball
MT_CHAINGUY, //ChaingunGuy
MT_TROOP, //Imp
MT_SERGEANT, //Pink Demon
MT_HEAD, //Cacodemon
MT_BRUISER, //Baron of Hell
MT_KNIGHT, //Hell Knight
MT_SKULL, //Lost Soul
MT_SPIDER, //SpiderMastermind
MT_BABY, //Arachnotron
MT_CYBORG, //Cyberdemon
MT_PAIN, //Pain Elemental
MT_BARREL, //Barrel
MT_TROOPSHOT, //Imp Fireball
MT_HEADSHOT, //Cacodemon Plasma Ball
MT_BRUISERSHOT, //Baron Slime Ball
MT_ROCKET, //Rocket
MT_PLASMA, //PlasmaBall
MT_BFG, //BFGBall
MT_ARACHPLAZ, //Arachnotron plasma
MT_PUFF, //Bullet puff
MT_BLOOD, //Blood
MT_TFOG, //TeleportFog
MT_IFOG, //ItemFog
MT_TELEPORTMAN, //TeleportDest
MT_EXTRABFG, //BFGExtra
MT_MISC0, //Green armor
MT_MISC1, //Blue armor
MT_MISC2, //Health bonus
MT_MISC3, //ArmorBonus
MT_MISC4, //Blue key card
MT_MISC5, //Red key card
MT_MISC6, //Yellow key card
MT_MISC7, //Yellow skull key
MT_MISC8, //Red skull key
MT_MISC9, //Blue skull key
MT_MISC10, //Stimpack
MT_MISC11, //Medikit
MT_MISC12, //Soulsphere
MT_INV, //Invulnerability Sphere
MT_MISC13, //Berserk
MT_INS, //Invisibility
MT_MISC14, //Radiation suit
MT_MISC15, //Allmap
MT_MISC16, //Infrared
MT_MEGA, //Mega sphere
MT_CLIP, //Clip
MT_MISC17, //Clip box
MT_MISC18, //Rocket
MT_MISC19, //Rocket box
MT_MISC20, //Cell
MT_MISC21, //Cell pack
MT_MISC22, //Shells
MT_MISC23, //Shell box
MT_MISC24, //Backpack
MT_MISC25, //BFG 9000
MT_CHAINGUN, //Chaingun
MT_MISC26, //Chainsaw
MT_MISC27, //Rocket launcher
MT_MISC28, //Plasma rifle
MT_SHOTGUN, //Shotgun
MT_SUPERSHOTGUN,//SuperShotgun
MT_MISC29, //Tech lamp
MT_MISC30, //Tech lamp 2
MT_MISC31, //Column
MT_MISC32, //Tall green column
MT_MISC33, //Short green column
MT_MISC34, //Tall red column
MT_MISC35, //Short red column
MT_MISC36, //Skull column
MT_MISC37, //Heart column
MT_MISC38, //Evil eye
MT_MISC39, //Floating skull
MT_MISC40, //Torch tree
MT_MISC41, //Blue torch
MT_MISC42, //Green torch
MT_MISC43, //Red torch
MT_MISC44, //Short blue torch
MT_MISC45, //Short green torch
MT_MISC46, //Short red torch
MT_MISC47, //Stalagtite
MT_MISC48, //Tech pillar
MT_MISC49, //Candle stick
MT_MISC50, //Candelabra
MT_MISC51, //Bloody twitch
MT_MISC52, //Meat 2
MT_MISC53, //Meat 3
MT_MISC54, //Meat 4
MT_MISC55, //NonsolidMeat2
MT_MISC56, //NonsolidMeat4
MT_MISC57, //NonsolidMeat3
MT_MISC58, //Meat 5
MT_MISC59, //NonsolidMeat5
MT_MISC60, //Gancho
MT_MISC61, //Gancho con sangre
MT_MISC62, //Lampara
MT_MISC63, //Dead cacodemon
MT_MISC64, //Dead zombie man
MT_MISC65, //Dead demon
MT_MISC66, //Dead imp
MT_MISC67, //Dead shotgun guy
MT_MISC68, //Dead marine
MT_MISC69, //Dead marine 2
MT_MISC70, //Heads
MT_MISC71, //Head candles
MT_MISC72, //Gibs
MT_MISC73, //HeadOnAStick
MT_MISC74, //Dead on a stick
MT_MISC75, //Still alive on a stick
MT_MISC76, //Big tree
MT_MISC77, //Burning barrel
MT_MISC78, //Hanging with no guts
MT_MISC79, //Hanging from bottom with no brain
MT_MISC80, //Hanging from top, looking down
MT_MISC81, //Hanging from top, skully
MT_MISC82, //Hanging from top, looking up
MT_MISC83, //Hanging from top without a brain
MT_MISC84, //Colon gibs
MT_MISC85, //Small pool o' blood
MT_MISC86, //brain stem lying on the ground
NUMMOBJTYPES
} mobjtype_t;
typedef struct {
int doomednum;
int spawnstate;
int spawnhealth;
int seestate;
int seesound;
int reactiontime;
int attacksound;
int painstate;
int painchance;
int painsound;
int meleestate;
int missilestate;
int deathstate;
int xdeathstate;
int deathsound;
int speed;
int radius;
int height;
int mass;
int damage;
int activesound;
int flags;
} mobjinfo_t;
extern mobjinfo_t mobjinfo[NUMMOBJTYPES];
================================================
FILE: PSXDOOM/l_main.c
================================================
/* l_main.c -- legal intro */
#include "doomdef.h"
#include "r_local.h"
int y_scroll;//80077FB8 uGp00000ba8
int last_ticon;//80077D38 iGp00000928
psxobj_t legalspic;//0x800979b0
/*
=======================
=
= L_Start
=
=======================
*/
void L_Start(void)//L80034D5C()
{
Valloc_Init();
ImageToVram(&legalspic, "LEGALS", 0);
S_StartSound(NULL, sfx_sgcock);
y_scroll = 240;
}
/*
=======================
=
= L_Stop
=
=======================
*/
void L_Stop(int exit)//L80034DA8()
{
S_StartSound(NULL, sfx_barexp);
M_CrossFadeWipe();
}
/*
=======================
=
= L_Ticker
=
=======================
*/
int L_Ticker(void)//L80034DD4()
{
int exit;
exit = ga_nothing;
if (y_scroll > 0)
{
y_scroll--;
if (y_scroll == 0)
last_ticon = ticon;
}
else if ((ticon - last_ticon) > 120)
{
exit = ga_timeout;
if ((ticon - last_ticon) < 180)
exit = -(unsigned int)(ticbuttons[0] != 0) & ga_exit;
}
return exit;
}
/*
=======================
=
= L_Draw
=
=======================
*/
void L_Draw(void)//L80034E54()
{
NextTextureCacheIdx();
DrawStaticImage(&legalspic, 0, y_scroll, palette[16]);
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/m_fixed.c
================================================
/* Fixed_t.c */
#include "doomdef.h"
fixed_t FixedMul(register fixed_t a, register fixed_t b)//L8003EEA4()
{
register int sign;
register unsigned c;
sign = a^b;
if (a <= 0)
a = -a;
if (b <= 0)
b = -b;
//ASM CODE
__asm__("multu %0, %1;" \
"mfhi %2;" \
"mflo %3;" \
: "=r"(a), \
"=r"(b) \
: "r" (a), \
"r" (b));
c = (a << 16) + (b >> 16);
if (sign < 0)
c = -c;
return c;
}
fixed_t FixedDiv(register fixed_t a, register fixed_t b)//L8003EEF0()
{
register unsigned c;
register unsigned bit;
register int sign;
sign = a^b;
if (a <= 0)
a = -a;
if (b <= 0)
b = -b;
bit = 0x10000;
do
{
b <<= 1;
bit <<= 1;
} while (b < a);
c = 0;
do
{
if (a >= b)
{
a -= b;
c |= bit;
}
a <<= 1;
bit >>= 1;
} while (bit && a);
if (sign < 0)
c = -c;
return c;
}
================================================
FILE: PSXDOOM/m_fixed.s
================================================
opt at-,w-,c+,m-
section asm
xdef FixedMul,FixedDiv
FixedMul:
xor t0, a0, a1
bgtz a0, loc_8003EEB4
move v0, a0
neg v0, a0
loc_8003EEB4:
bgtz a1, loc_8003EEC0
move v1, a1
neg v1, a1
loc_8003EEC0:
multu v0, v1
mfhi a0
mflo a1
sll v0, a0, 16
srl v1, a1, 16
nop
addu a0, v0, v1
bgez t0, locret_8003EEE8
move v0, a0
neg v0, a0
locret_8003EEE8:
jr ra
nop
FixedDiv:
xor t0, a0, a1
bgtz a0, loc_8003EF00
move v0, a0
neg v0, a0
loc_8003EF00:
bgtz a1, loc_8003EF0C
move v1, a1
neg v1, a1
loc_8003EF0C:
lui a2, 1
sltu at, v1, v0
beqz at, loc_8003EF30
and t2, zero, a2
loc_8003EF1C:
sll v1, 1
sll a2, 1
sltu at, v1, v0
bnez at, loc_8003EF1C
and t2, zero, a2
loc_8003EF30:
slt at, v0, v1
bnez at, loc_8003EF44
nop
sub v0, v1
or t2, a2
loc_8003EF44:
sll v0, 1
srl a2, 1
beqz a2, loc_8003EF5C
nop
bnez v0, loc_8003EF30
nop
loc_8003EF5C:
bgez t0, locret_8003EF68
move v0, t2
neg v0, t2
locret_8003EF68:
jr ra
nop
end
================================================
FILE: PSXDOOM/m_main.c
================================================
/* m_main.c -- main menu */
#include "doomdef.h"
#include "r_local.h"
#include "st_main.h"
unsigned short STARTY[4] = {91, 133, 158, 200};//80077A64 sGp00000654
#define CURSORX 50
#define CURSORY(y) (STARTY[y])
char gametypenames[][16] = //80073B0C
{
"Single Player",
"Cooperative",
"Deathmatch"
};
char skillnames[][16] = //80073B3C
{
"I am a Wimp",
"Not Too Rough",
"Hurt Me Plenty",
"Ultra Violence",
#if ENABLE_NIGHTMARE == 1
"Nightmare" //[GEC] Master Edition
#endif // ENABLE_NIGHTMARE
};
typedef enum
{
single,
coop,
dmatch,
NUMMODES
} playmode_t;
psxobj_t backpic;//0x800977f0
psxobj_t doompic;//0x80097830
psxobj_t connectpic;//0x800978F0
/*
=================
=
= RunMenu
=
=================
*/
int RunMenu(void)//L8003592C()
{
do
{
if (MiniLoop(M_Start, M_Stop, M_Ticker, M_Drawer) == ga_timeout)
return ga_timeout;
NextTextureCacheIdx();
DrawStaticImage(&backpic, 0, 0, palette[0]);
DrawStaticImage(&doompic, 75, 20, palette[17]);
UpdateDrawOTag();
DrawRender();
if(starttype == gt_single) break;
P_LoadingPlaque(&connectpic, 54, 103, palette[0]);
Link_Conection();
NextTextureCacheIdx();
DrawStaticImage(&backpic, 0, 0, palette[0]);
DrawStaticImage(&doompic, 75, 20, palette[17]);
UpdateDrawOTag();
DrawRender();
S_StartSound(NULL, sfx_pistol);// SNDPSTOL.mid
} while (cancel_link != 0);
G_InitNew(startskill, startmap, starttype);
G_RunGame();
return 0;
}
/*
=================
=
= M_Start
=
=================
*/
int cursorframe/*, cursorcount*/;//80078000 00000bf0
int movecount; //80077FA4 00000b94
//int playermap;
int cursorpos[MAXPLAYERS];//80077E2C uGp00000a1c,
int m_vframe1[MAXPLAYERS]; //80077D24 uGp00000914
void M_Start(void)//L80035A9C()
{
netgame = 0;
consoleplayer = 0;
playeringame[0] = true;
playeringame[1] = false;
Valloc_Init();
ImageToVram(&loadingpic, "LOADING", 0);
P_LoadingPlaque(&loadingpic, 95, 109, palette[16]);
S_Lcd_Load(0);
ImageToVram(&backpic, "BACK", 0);
ImageToVram(&doompic, "DOOM", 0);
ImageToVram(&connectpic, "CONNECT", 0);
cursorframe = 0;
cursorpos[0] = 0;
m_vframe1[0] = 0;
if (starttype == gt_single)
movecount = 2; // Episode '1' = Ultimate DOOM, '2' = Doom II
else
movecount = 54; // For multiplayer any of the normal (non secret) maps can be selected
if (movecount < startmap)
{
// Wrap back around if we have to...
startmap = 1;
}
#if GH_UPDATES == 1
else if (startmap < 0)
{
// Start map or episode will be set to '< 0' when the Doom I is finished.
// This implies we want to point the user to Doom II:
startmap = 2;
}
#endif // GH_UPDATES
psxcd_play_at_andloop(CD_TRACK[cdmusic_main_menu],CDVolume,0,0,CD_TRACK[cdmusic_main_menu],CDVolume,0,0);
do {} while (psxcd_elapsed_sectors() == 0);
//Desactiva la vision en la pantalla
draw[0].isbg = 0;
draw[1].isbg = 0;
drawside ^= 1;
//Draw fake menu
M_Drawer();
M_CrossFadeWipe();
//Activa la vision en la pantalla
draw[0].isbg = 1;
draw[1].isbg = 1;
last_ticon = ticon;
}
/*
=================
=
= M_Stop
=
=================
*/
void M_Stop(int exit)//L80035C40()
{
S_StartSound(0, sfx_pistol);
psxcd_stop();
if (((exit == ga_exit) && (starttype == gt_single)) && (startmap != 1))
{
startmap = 31;
}
}
/*
=================
=
= M_Ticker
=
=================
*/
int M_Ticker(void)//L80035CC4()
{
int buttons;
buttons = ticbuttons[0];
/* exit menu if button press */
if (ticbuttons[0] != 0)
last_ticon = ticon;
/* exit menu if time out */
if ((ticon - last_ticon) > 1800)
return ga_timeout;
/* animate skull */
if ((gamevbls < (int)gametic) && ((gametic & 3) == 0))
cursorframe ^= 1;
if (ticbuttons[0] != oldticbuttons[0])
{
if ((ticbuttons[0] & PAD_START) != 0)
{
return ga_exit;
}
if ((ticbuttons[0] & PAD_ACTION) && (cursorpos[0] >= gamemode))
{
if (cursorpos[0] < options)
{
return ga_exit;
}
if ((cursorpos[0] == options) && MiniLoop(O_Start,O_Stop,O_Ticker,O_Drawer) == ga_warped)
{
return ga_warped;
}
}
}
/* check for movement */
if (!(buttons & PAD_ARROWS))
m_vframe1[0] = 0;
else
{
m_vframe1[0] -= vblsinframe[0];
if (m_vframe1[0] <= 0)
{
m_vframe1[0] = TICRATE;
if (buttons & PAD_DOWN)
{
cursorpos[0] += 1;
if (cursorpos[0] == NUMMENUITEMS)
cursorpos[0] = 0;
S_StartSound(NULL, sfx_pstop);
}
else if (buttons & PAD_UP)
{
cursorpos[0] += -1;
if (cursorpos[0] == -1)
cursorpos[0] = NUMMENUITEMS-1;
S_StartSound(NULL, sfx_pstop);
}
switch (cursorpos[0])
{
case level:
if (buttons & PAD_RIGHT)
{
startmap++;
if (movecount < startmap)
startmap = movecount;
else
S_StartSound(NULL, sfx_swtchx);
}
else if (buttons & PAD_LEFT)
{
startmap--;
if (startmap < 1)
startmap = 1;
else
S_StartSound(NULL, sfx_swtchx);
}
break;
case difficulty:
if (buttons & PAD_RIGHT)
{
#if ENABLE_NIGHTMARE == 1
if (startskill < sk_nightmare)
#else
if (startskill < sk_hard)
#endif // ENABLE_NIGHTMARE
{
startskill++;
S_StartSound(NULL, sfx_swtchx);
}
}
else if (buttons & PAD_LEFT)
{
if (startskill != 0)
{
startskill--;
S_StartSound(NULL, sfx_swtchx);
}
}
break;
case gamemode:
if (buttons & PAD_RIGHT)
{
if (starttype < gt_deathmatch)
{
starttype++;
if(starttype == gt_coop)
startmap = 1;
S_StartSound(NULL, sfx_swtchx);
}
}
else if (buttons & PAD_LEFT)
{
if (starttype != gt_single)
{
starttype--;
if (starttype == gt_single)
startmap = 1;
S_StartSound(NULL, sfx_swtchx);
}
}
if (starttype != gt_single)
movecount = 54;
else
movecount = 2;
if (startmap > movecount)
startmap = 1;
break;
default:
break;
}
}
}
return ga_nothing;
}
/*
=================
=
= M_Drawer
=
=================
*/
void M_Drawer(void)//L80036058()
{
NextTextureCacheIdx();
DrawStaticImage(&backpic, 0, 0, palette[0]);
DrawStaticImage(&doompic, 75, 20, palette[17]);
DrawImage(statuspic.vtpage, palette[16], CURSORX, CURSORY(cursorpos[0]) - 2, M_SKULL_VX + (cursorframe * M_SKULL_W), M_SKULL_VY, M_SKULL_W, M_SKULL_H);
ST_DrawText(74, STARTY[0], "Game Mode");
ST_DrawText(90, STARTY[0]+20, gametypenames[starttype]);
if (starttype == 0)
{
if (startmap == 1)
ST_DrawText(74, STARTY[1], "Ultimate Doom");
else
ST_DrawText(74, STARTY[1], "Doom II");
}
else
{
ST_DrawText(74, STARTY[1], "Level");
if (startmap >= 10)
ST_DrawValue(148, STARTY[1], startmap);
else
ST_DrawValue(136, STARTY[1], startmap);
}
ST_DrawText(74, STARTY[2], "Difficulty");
ST_DrawText(90, STARTY[2] + 20, skillnames[startskill]);
ST_DrawText(74, STARTY[3], "Options");
UpdateDrawOTag();
DrawRender();
}
/*
=================
=
= M_CrossFadeWipe
=
=================
*/
void M_CrossFadeWipe(void)//L80036248()
{
DRAWENV tmp_draw[2]; /* draw environment */
DISPENV tmp_disp[2]; /* display environment*/
POLY_FT4 poly[2];
int intensity;
long d_side;
Valloc_Init();
SetDefDrawEnv(&tmp_draw[0], 512, 256, 256, 240);
tmp_draw[0].isbg = 1;
tmp_draw[0].dtd = 0;
tmp_draw[0].dfe = 1;
SetDefDrawEnv(&tmp_draw[1], 768, 256, 256, 256);
tmp_draw[1].isbg = 1;
tmp_draw[1].dtd = 0;
tmp_draw[1].dfe = 1;
SetDefDispEnv(&tmp_disp[0], 768, 256, 256, 240);
SetDefDispEnv(&tmp_disp[1], 512, 256, 256, 240);
MoveImage(&disp[drawside].disp, 768, 256);
DrawSync(0);
VSync(0);
PutDrawEnv(&tmp_draw[0]);
PutDispEnv(&tmp_disp[0]);
//Set Layer1
setPolyFT4(&poly[0]);
setUV4(&poly[0], 0, 0, 255, 0, 0, 239, 255, 239);
setXY4(&poly[0], 0, 0, 255, 0, 0, 239, 255, 239);
if (drawside == 0)
poly[0].tpage = getTPage(2, 0, 256, 0);
else
poly[0].tpage = getTPage(2, 0, 0, 0);
poly[0].clut = 0;
//Set Layer2
setPolyFT4(&poly[1]);
setSemiTrans(&poly[1], 1);
setUV4(&poly[1], 0, 0, 255, 0, 0, 239, 255, 239);
setXY4(&poly[1], 0, 0, 255, 0, 0, 239, 255, 239);
if (drawside != 0)
poly[1].tpage = getTPage(2, 0, 256, 0);
else
poly[1].tpage = getTPage(2, 0, 0, 0);
poly[1].clut = 0;
d_side = 0;
intensity = 255;
do
{
setRGB0(&poly[0], intensity, intensity, intensity);
W_AddPrim(&poly[0]);// add to order table*/
setRGB0(&poly[1], ~intensity, ~intensity, ~intensity);
W_AddPrim(&poly[1]);// add to order table*/
UpdateDrawOTag();
//DrawRender
DrawSync(0);
VSync(0);
d_side ^= 1;
PutDrawEnv(&tmp_draw[d_side]);
PutDispEnv(&tmp_disp[d_side]);
intensity -= 5;
} while (intensity >= 0);
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/m_password.c
================================================
/* m_password.c -- password encode/decode */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
#include "r_local.h"
// [GEC] MASTER EDITION NEW FLAGS
#define MAPUP1 0x20
#define MAPUP2 0x40
#define NIGHTMARE 0x80
void Encode_Password(byte *buff)//L80037BBC()
{
int i, j, shift, code, pos;
char tmpbuff[8];
player_t *player;
int maxclip, maxshell, maxcell, maxmisl;
int val, newval;
#if ENABLE_NIGHTMARE == 1
int skillnightmare;
#endif // ENABLE_NIGHTMARE
player = &players[consoleplayer];
D_memset(tmpbuff, 0, 8);
#if ENABLE_NIGHTMARE == 1
//Check the nightmare difficulty
skillnightmare = 0;
if(gameskill == sk_nightmare)
{
skillnightmare = sk_nightmare;
}
#endif // ENABLE_NIGHTMARE
tmpbuff[0] = ((byte)nextmap & 63) << 2;//map
tmpbuff[0] |= (byte)gameskill & 3;//skill
// Weapons
for (i = 0; i < 7; i++)
{
if (player->weaponowned[wp_shotgun + i])
{
tmpbuff[1] |= (1 << i);
}
}
//Get Maximun Ammo
maxclip = maxammo[am_clip];
maxshell = maxammo[am_shell];
maxcell = maxammo[am_cell];
maxmisl = maxammo[am_misl];
// Backpack
if (player->backpack)
{
maxclip <<= 1;
maxshell <<= 1;
maxcell <<= 1;
maxmisl <<= 1;
tmpbuff[1] |= 0x80;
}
// Clip
val = (player->ammo[am_clip] << 3) / maxclip;
if ((player->ammo[am_clip] << 3) % maxclip) { val += 1; }
tmpbuff[2] = val << 4;
// Shell
val = (player->ammo[am_shell] << 3) / maxshell;
if ((player->ammo[am_shell] << 3) % maxshell) { val += 1; }
tmpbuff[2] |= val;
// Cell
val = (player->ammo[am_cell] << 3) / maxcell;
if ((player->ammo[am_cell] << 3) % maxcell) { val += 1; }
tmpbuff[3] = val << 4;
// Missile
val = (player->ammo[am_misl] << 3) / maxmisl;
if ((player->ammo[am_misl] << 3) % maxmisl) { val += 1; }
tmpbuff[3] |= val;
// Health
val = (player->health << 3) / 200;
if ((player->health << 3) % 200) { val += 1; }
tmpbuff[4] = val << 4;
// Armor
val = (player->armorpoints << 3) / 200;
if ((player->armorpoints << 3) % 200) { val += 1; }
tmpbuff[4] |= val;
// ArmorType
tmpbuff[5] = (byte)player->armortype << 3;
#if ENABLE_NIGHTMARE == 1
//I used the ArmorType space to add the 0x80 flag to identify that the difficulty is nightmare
if(skillnightmare != 0) {
tmpbuff[5] |= 0x80;
}
#endif // ENABLE_NIGHTMARE
#if ENABLE_MOREMAPS == 1
//Enables the possibility of incorporating more maps, maximum 255
if(nextmap >= 192) {
tmpbuff[5] |= (MAPUP1|MAPUP2);
}
else if(nextmap >= 128) {
tmpbuff[5] |= MAPUP2;
}
else if(nextmap >= 64) {
tmpbuff[5] |= MAPUP1;
}
#endif // ENABLE_MOREMAPS
//Encode Encrypt System
for (i = 0; i < 45;)
{
newval = 0;
shift = 16;
for (j = 4; j >= 0; j--)
{
pos = i;
if (i < 0) { pos = i + 7;}
pos >>= 3;
code = tmpbuff[pos] & (0x80 >> (i - (pos << 3)));
if (code != 0)
newval |= shift;
shift >>= 1;
i++;
}
pos = ((i - 1) / 5);
buff[pos] = newval;
}
buff[9] = 0;
for (i = 0; i < 9; i++)
buff[9] ^= buff[i];
for (i = 0; i < 9; i++)
buff[i] ^= buff[9];
}
int Decode_Password(byte *inbuff, int *levelnum, int *skill, player_t *player)//L80037FB0()
{
int val, newval, i, j, shift, code, pos;
byte decbuff[8];
byte buff[10];
D_memcpy(buff, inbuff, 10);
val = 0;
for (i = 0; i < 9; i++)
buff[i] ^= buff[9];
for (i = 0; i < 9; i++)
val ^= buff[i];
if (val == buff[9])
{
//Decode Encrypt System
for (i = 0; i < 48;)
{
newval = 0;
shift = 0x80;
for (j = 7; j >= 0; j--)
{
pos = (i / 5);
code = buff[pos] & (16 >> (i - (pos * 5)));
if (code != 0)
newval |= shift;
shift >>= 1;
i++;
}
pos = (i - 1);
if (pos < 0) { pos = i + 6; }
pos >>= 3;
decbuff[pos] = newval;
}
*levelnum = decbuff[0] >> 2;
#if ENABLE_MOREMAPS == 1
if (decbuff[5] & MAPUP1) {
decbuff[5] &= ~MAPUP1;
*levelnum |= 64;
}
if (decbuff[5] & MAPUP2) {
decbuff[5] &= ~MAPUP2;
*levelnum |= 128;
}
#endif // ENABLE_MOREMAPS
if (*levelnum != 0 && (*levelnum < LASTLEVEL))
{
*skill = decbuff[0] & 3;
#if ENABLE_NIGHTMARE == 1
//Check that the flag is 0x80, add the nightmare difficulty and remove the flag 0x80
if (decbuff[5] & NIGHTMARE)
{
decbuff[5] &= ~NIGHTMARE;
*skill = sk_nightmare;
}
#endif // ENABLE_NIGHTMARE
#if GH_UPDATES == 1
if (((decbuff[2] & 15) < 9) && // Shell
((decbuff[2] >> 4) < 9) && // Clip
((decbuff[3] & 15) < 9) && // Missile
((decbuff[3] >> 4) < 9) && // Cell
((decbuff[4] & 15) < 9) && // Armor
((decbuff[4] >> 4) < 9)) // Health
#endif // GH_UPDATES
{
// ArmorType
if ((decbuff[5] >> 3) < 3)
{
// Health
if ((decbuff[4] >> 4) != 0)
{
if (player != 0)
{
// Weapons
for (i = 0; i < 7; i++)
{
if ((decbuff[1] >> i) & 1)
{
player->weaponowned[wp_shotgun + i] = 1;
}
}
// Backpack
if (decbuff[1] & 0x80)
{
if (!player->backpack)
{
player->backpack = 1;
for (i = 0; i < 4; i++)
player->maxammo[i] <<= 1;
}
}
// Clip
val = decbuff[2] >> 4;
val *= player->maxammo[am_clip];
if (val < 0) { val += 7; }
player->ammo[am_clip] = val >> 3;
// Shell
val = decbuff[2] & 0xf;
val *= player->maxammo[am_shell];
if (val < 0) { val += 7; }
player->ammo[am_shell] = val >> 3;
// Cell
val = decbuff[3] >> 4;
val *= player->maxammo[am_cell];
if (val < 0) { val += 7; }
player->ammo[am_cell] = val >> 3;
// Shell
val = decbuff[3] & 0xf;
val *= player->maxammo[am_misl];
if (val < 0) { val += 7; }
player->ammo[am_misl] = val >> 3;
// Health
player->health = (decbuff[4] >> 4) * 25;
// Armor
player->armorpoints = (decbuff[4] & 15) * 25;
// ArmorType
player->armortype = decbuff[5] >> 3;
// Apply Health on mobj_t
player->mo->health = player->health;
}
return 1;
}
}
}
}
}
return 0;
}
================================================
FILE: PSXDOOM/o_main.c
================================================
/* o_main.c -- options menu */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
#include "r_local.h"
#define MOVEWAIT 5
#define ITEMSPACE 40
#define SLIDEWIDTH 90
#define SetVolPsx(vol) ((int)((vol*0x7f)/100))
char optionsnames[][16] = //8007491C
{
"Music Volume",
"Sound Volume",
"Password",
"Configuration",
"Main Menu",
"Restart Level"
};
typedef struct
{
int casepos; //*
int x; //*4
int y; //*8
} menuitem_t;
menuitem_t menu_intro[5] = //8007497c
{
{ 0, 62, 65 },
{ 1, 62, 105 },
{ 2, 62, 145 },
{ 3, 62, 170 },
{ 4, 62, 195 },
};
menuitem_t menu_single[6] = //800749B8
{
{ 0, 62, 50 },
{ 1, 62, 90 },
{ 2, 62, 130 },
{ 3, 62, 155 },
{ 4, 62, 180 },
{ 5, 62, 205 },
};
menuitem_t menu_net[4] = //80074A00
{
{ 0, 62, 70 },
{ 1, 62, 110 },
{ 4, 62, 150 },
{ 5, 62, 175 },
};
menuitem_t *menuitem; //800780E4 puGp00000cd4
int itemlines; //80077F40 uGp00000b30
/*
=================
=
= O_Start
=
=================
*/
void O_Start(void)//L8003E680()
{
int i;
S_StartSound(NULL, sfx_pistol);
cursorframe = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
m_vframe1[i] = 0;
cursorpos[i] = 0;
}
if (netgame == gt_single)
{
if (gamepaused)
{
menuitem = menu_single;
itemlines = 6;
}
else
{
menuitem = menu_intro;
itemlines = 5;
}
}
else
{
menuitem = menu_net;
itemlines = 4;
}
}
/*
=================
=
= O_Stop
=
=================
*/
void O_Stop(int exit)//L8003E740()
{
int i;
for (i = 0; i < MAXPLAYERS; i++)
cursorpos[i] = 0;
}
/*
=================
=
= O_Ticker
=
=================
*/
int O_Ticker(void)//L8003E764()
{
int i, buttons, oldbuttons;
/* animate skull */
if ((gamevbls < (int)gametic) && ((gametic & 3) == 0))
cursorframe ^= 1;
//for (i = 0; i < MAXPLAYERS; i++)
for (i=(MAXPLAYERS-1) ; i >= 0 ; i--)
{
if (playeringame[i] != 0)
{
buttons = ticbuttons[i];
oldbuttons = oldticbuttons[i];
if ((buttons != oldbuttons) && (buttons & (PAD_START|PAD_SELECT)))
{
S_StartSound(0, sfx_pistol);
return ga_exit;
}
/* check for movement */
if (!(buttons & PAD_ARROWS))
{
m_vframe1[i] = 0;
}
else
{
m_vframe1[i] -= vblsinframe[0];
if (m_vframe1[i] <= 0)
{
m_vframe1[i] = TICRATE;
if (buttons & PAD_DOWN)
{
cursorpos[i]++;
if ((itemlines - 1) < cursorpos[i])
cursorpos[i] = 0;
if (consoleplayer == i)
S_StartSound(NULL, sfx_pstop);
}
else if (buttons & PAD_UP)
{
cursorpos[i]--;
if (cursorpos[i] < 0)
cursorpos[i] = (itemlines - 1);
if (consoleplayer == i)
S_StartSound(NULL, sfx_pstop);
}
}
}
switch ((menuitem + cursorpos[i])->casepos)
{
case 0: // music volume
if (consoleplayer == i)
{
if (buttons & PAD_RIGHT)
{
MusVolume++;
if (MusVolume > 100)
MusVolume = 100;
else
{
S_SetMusicVolume(SetVolPsx(MusVolume));
if (MusVolume & 1)
S_StartSound(NULL, sfx_stnmov);
}
CDVolume = (MusVolume * 0x3cff) / 100;
}
else if (buttons & PAD_LEFT)
{
MusVolume--;
if (MusVolume < 0)
MusVolume = 0;
else
{
S_SetMusicVolume(SetVolPsx(MusVolume));
if (MusVolume & 1)
S_StartSound(NULL, sfx_stnmov);
}
CDVolume = (MusVolume * 0x3cff) / 100;
}
}
break;
case 1: // sound volume
if (consoleplayer == i)
{
if (buttons & PAD_RIGHT)
{
SfxVolume++;
if (SfxVolume > 100)
SfxVolume = 100;
else
{
S_SetSoundVolume(SetVolPsx(SfxVolume));
if (SfxVolume & 1)
S_StartSound(NULL, sfx_stnmov);
}
}
else if (buttons & PAD_LEFT)
{
SfxVolume--;
if (SfxVolume < 0)
SfxVolume = 0;
else
{
S_SetSoundVolume(SetVolPsx(SfxVolume));
if (SfxVolume & 1)
S_StartSound(NULL, sfx_stnmov);
}
}
}
break;
case 2://Password
if (buttons & PAD_ACTION)
{
if (MiniLoop(PW_Start, PW_Stop, PW_Ticker, PW_Drawer) == ga_warped)
return ga_warped;
}
break;
case 3://Configuration
if (buttons & PAD_ACTION)
{
MiniLoop(CF_Start, CF_Stop, CF_Ticker, CF_Drawer);
}
break;
case 4://Main Menu
if (buttons & PAD_ACTION)
{
S_StartSound(0, sfx_pistol);
return ga_exitdemo;
}
break;
case 5:// Restar Level
if (buttons & PAD_ACTION)
{
S_StartSound(0, sfx_pistol);
return ga_restart;
}
break;
default:
break;
}
}
}
return ga_nothing;
}
/*
=================
=
= O_Drawer
=
=================
*/
void O_Drawer(void)//L8003EC38()
{
int i, j;
int xpos, ypos;
menuitem_t *m_item;
NextTextureCacheIdx();
//Draw Backround MARB01 Pic
for (ypos = 0; ypos < 4; ypos++)
{
for (xpos = 0; xpos < 4; xpos++)
{
DrawStaticImage(&marb01pic, xpos << 6, ypos << 6, palette[0]);
}
}
if (gameaction == 0)
{
ST_DrawText(-1, 20, "Options");
m_item = menuitem;
for (i = 0; i < itemlines; i++)
{
ST_DrawText(m_item->x, m_item->y, optionsnames[m_item->casepos]);
if (m_item->casepos < 2)
{
//Draw Bar Dial
DrawImage(statuspic.vtpage, palette[16], m_item->x + 13, m_item->y + 20, 0, 184, 108, 11);
if (m_item->casepos == 0)
DrawImage(statuspic.vtpage, palette[16], MusVolume + m_item->x + 14, m_item->y + 20, 108, 184, 6, 11);
else
DrawImage(statuspic.vtpage, palette[16], SfxVolume + m_item->x + 14, m_item->y + 20, 108, 184, 6, 11);
}
m_item++;
}
//Draw Skull
m_item = menuitem + cursorpos[consoleplayer];
DrawImage(statuspic.vtpage, palette[16], m_item->x - 24, m_item->y - 2, (cursorframe * M_SKULL_W) + M_SKULL_VX, M_SKULL_VY, M_SKULL_W, M_SKULL_H);
}
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/obj/tmp.txt
================================================
temp file
================================================
FILE: PSXDOOM/p_base.c
================================================
/* p_base.c */
#include "doomdef.h"
#include "p_local.h"
//completo y revisado
static mobj_t *checkthing; /* Used for PB_CheckThing */ //pmGp00000c60
static fixed_t testx, testy; //fGp00000910, fGp0000091c
static fixed_t testfloorz, testceilingz, testdropoffz; //iGp00000984, iGp00000b1c, iGp00000b38
static subsector_t *testsubsec; //psGp00000944
static line_t *ceilingline; //iGp000009a8
static mobj_t *hitthing; //iGp00000b9c
static fixed_t testbbox[4]; /* Bounding box for tests */ //800a8e48
static int testflags; //uGp00000cc8
//psx doom new
extern int checkcount; //*L80077DE4
void P_XYMovement(mobj_t *mo);
void P_FloatChange(mobj_t *mo);
void P_ZMovement(mobj_t *mo);
void P_MobjThinker(mobj_t *mobj);
boolean PB_TryMove(int tryx, int tryy);
void PB_UnsetThingPosition(mobj_t *thing);
void PB_SetThingPosition(mobj_t *thing);
boolean PB_CheckPosition(void);
boolean PB_BoxCrossLine(line_t *ld);
boolean PB_CheckLine(line_t *ld);
boolean PB_CheckThing(mobj_t *thing);
boolean PB_BlockLinesIterator(int x, int y);
boolean PB_BlockThingsIterator(int x, int y);
/*
=================
=
= P_RunMobjBase
=
= Execute base think logic for the critters every tic
=
=================
*/
void P_RunMobjBase(void)//L80013814()
{
checkcount = 0;
for (checkthing = mobjhead.next; checkthing != &mobjhead; checkthing = checkthing->next)
{
if (!checkthing->player)
{
checkthing->latecall = NULL;
checkcount++;
P_MobjThinker(checkthing);
}
}
}
/*
===================
=
= P_XYMovement
=
===================
*/
#define STOPSPEED 0x1000
#define FRICTION 0xd200 //Jag 0xd240
void P_XYMovement(mobj_t *mo)//L800138AC()
{
fixed_t xleft, yleft;
fixed_t xuse, yuse;
//
// cut the move into chunks if too large
//
xleft = xuse = mo->momx & ~7;
yleft = yuse = mo->momy & ~7;
while (xuse > MAXMOVE || xuse < -MAXMOVE
|| yuse > MAXMOVE || yuse < -MAXMOVE)
{
xuse >>= 1;
yuse >>= 1;
}
while (xleft || yleft)
{
xleft -= xuse;
yleft -= yuse;
if (!PB_TryMove(mo->x + xuse, mo->y + yuse))
{
// blocked move
if (mo->flags & MF_SKULLFLY)
{
mo->latecall = L_SkullBash;
mo->extramobj = hitthing;
}
// explode a missile
if (mo->flags & MF_MISSILE)
{
if (ceilingline && ceilingline->backsector &&
ceilingline->backsector->ceilingpic == -1)// hack to prevent missiles exploding against the sky
{
mo->latecall = P_RemoveMobj;
return;
}
mo->latecall = L_MissileHit;
mo->extramobj = hitthing;
return;
}
mo->momx = mo->momy = 0;
return;
}
}
//
// slow down
//
if (mo->flags & (MF_MISSILE | MF_SKULLFLY))
return; // no friction for missiles ever
if (mo->z > mo->floorz)
return; // no friction when airborne
if ((mo->flags & MF_CORPSE) && (mo->floorz != mo->subsector->sector->floorheight))
return; // don't stop halfway off a step
if (mo->momx > -STOPSPEED && mo->momx < STOPSPEED &&
mo->momy > -STOPSPEED && mo->momy < STOPSPEED)
{
mo->momx = 0;
mo->momy = 0;
}
else
{
mo->momx = (mo->momx >> 8) * (FRICTION >> 8);
mo->momy = (mo->momy >> 8) * (FRICTION >> 8);
}
}
/*
===================
=
= P_FloatChange
=
= Float up or down at a set speed, used by flying monsters
=
===================
*/
//inline
void P_FloatChange(mobj_t *mo)//L80013B0C()
{
mobj_t *target;
fixed_t dist, delta;
fixed_t dx, dy;
target = mo->target; /* Get the target object */
//inline function ??
//dist = P_AproxDistance(target->x - mo->x, target->y - mo->y); /* Distance to target */
dx = abs(target->x - mo->x);
dy = abs(target->y - mo->y);
dist = dx+dy;
if (dx < dy)
dist -=(dx>>1);
else
dist -=(dy>>1);
delta = (target->z + (mo->height >> 1)) - mo->z; /* Get the height differance */
delta *= 3; /* Mul by 3 for a fudge factor */
if (delta<0) /* Delta is signed... */
{
if (dist < (-delta)) /* Negate */
{
mo->z -= FLOATSPEED; /* Adjust the height */
}
}
else if (delta>0) /* Delta is signed... */
{
if (dist < delta) /* Normal compare */
{
mo->z += FLOATSPEED; /* Adjust the height */
}
}
}
/*
===================
=
= P_ZMovement
=
= Move a critter in the Z axis
=
===================
*/
void P_ZMovement(mobj_t *mo)//L80013BD4()
{
mo->z += mo->momz; /* Basic z motion */
if ((mo->flags & MF_FLOAT) && mo->target) /* float down towards target if too close */
{
P_FloatChange(mo);
}
//
// clip movement
//
if (mo->z <= mo->floorz) // hit the floor
{
if (mo->momz < 0)
mo->momz = 0;
mo->z = mo->floorz;
if (mo->flags & MF_MISSILE)
{
mo->latecall = P_ExplodeMissile;
return;
}
}
else if (!(mo->flags & MF_NOGRAVITY))
{
// apply gravity
if (mo->momz == 0)
mo->momz = -GRAVITY;
else
mo->momz -= (GRAVITY/2);
}
if (mo->z + mo->height > mo->ceilingz) // hit the ceiling
{
if (mo->momz > 0)
mo->momz = 0;
mo->z = mo->ceilingz - mo->height;
if (mo->flags & MF_MISSILE)
mo->latecall = P_ExplodeMissile;
}
}
/*
===================
=
= P_MobjThinker
=
= Process all the critter logic
=
===================
*/
void P_MobjThinker(mobj_t *mobj)//L80013DB4()
{
state_t *st;
statenum_t state;
// momentum movement
if (mobj->momx || mobj->momy)
{
P_XYMovement(mobj);
// removed or has a special action to perform?
if (mobj->latecall)
return;
}
if (mobj->z != mobj->floorz || mobj->momz)
{
P_ZMovement(mobj);
// removed or has a special action to perform?
if (mobj->latecall)
return;
}
// cycle through states
if (mobj->tics != -1)
{
mobj->tics--;
// you can cycle through multiple states in a tic
if (mobj->tics <= 0)
{
state = mobj->state->nextstate;
if (state == S_NULL)
{
mobj->latecall = P_RemoveMobj;
}
else
{
st = &states[state];
mobj->state = st;
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
mobj->latecall = st->action;
}
}
}
}
/*
===================
=
= PB_TryMove
=
= Attempt to move to a new position
=
===================
*/
boolean PB_TryMove(int tryx, int tryy)//L80013ED4()
{
testx = tryx;
testy = tryy;
if (!PB_CheckPosition())
return false; // solid wall or thing
if (testceilingz - testfloorz < checkthing->height)
return false; // doesn't fit
if (testceilingz - checkthing->z < checkthing->height)
return false; // mobj must lower itself to fit
if (testfloorz - checkthing->z > 24 * FRACUNIT)
return false; // too big a step up
if (!(testflags&(MF_DROPOFF | MF_FLOAT)) && testfloorz - testdropoffz > 24 * FRACUNIT)
return false; // don't stand over a dropoff
//
// the move is ok, so link the thing into its new position
//
PB_UnsetThingPosition(checkthing);
checkthing->floorz = testfloorz;
checkthing->ceilingz = testceilingz;
checkthing->x = tryx;
checkthing->y = tryy;
PB_SetThingPosition(checkthing);
return true;
}
/*
===================
=
= PB_UnsetThingPosition
=
===================
*/
void PB_UnsetThingPosition(mobj_t *thing)//L80013FB4()
{
int blockx, blocky;
// inert things don't need to be in blockmap
// unlink from subsector
if (thing->snext)
thing->snext->sprev = thing->sprev;
if (thing->sprev)
thing->sprev->snext = thing->snext;
else
thing->subsector->sector->thinglist = thing->snext;
if (!(testflags & MF_NOBLOCKMAP))
{
// inert things don't need to be in blockmap
// unlink from block map
if (thing->bnext)
thing->bnext->bprev = thing->bprev;
if (thing->bprev)
thing->bprev->bnext = thing->bnext;
else
{
blockx = (thing->x - bmaporgx) >> MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy) >> MAPBLOCKSHIFT;
// Prevent buffer overflow if the map object is out of bounds.
// This is part of the fix for the famous 'linedef deletion' bug.
// From StationDoom by BodbDearg
#if FIX_LINEDEFS_DELETION
if (blockx>=0 && blockx < bmapwidth
&& blocky>=0 && blocky bnext;
}
#else
blocklinks[blocky*bmapwidth+blockx] = thing->bnext;
#endif
}
}
}
/*
===================
=
= PB_SetThingPosition
=
===================
*/
void PB_SetThingPosition(mobj_t *thing)//L800140B0()
{
sector_t *sec;
int blockx, blocky;
mobj_t **link;
//
// link into subsector
//
thing->subsector = testsubsec;
sec = thing->subsector->sector;
thing->sprev = NULL;
thing->snext = sec->thinglist;
if (sec->thinglist)
sec->thinglist->sprev = thing;
sec->thinglist = thing;
//
// link into blockmap
//
if (!(testflags & MF_NOBLOCKMAP))
{
// inert things don't need to be in blockmap
blockx = (thing->x - bmaporgx) >> MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy) >> MAPBLOCKSHIFT;
if (blockx >= 0 && blockx < bmapwidth && blocky >= 0 && blocky < bmapheight)
{
link = &blocklinks[blocky*bmapwidth + blockx];
thing->bprev = NULL;
thing->bnext = *link;
if (*link)
(*link)->bprev = thing;
*link = thing;
}
else
{
// thing is off the map
thing->bnext = thing->bprev = NULL;
}
}
}
/*
==================
=
= PB_CheckPosition
=
= This is purely informative, nothing is modified (except things picked up)
in:
basething a mobj_t
testx,testy a position to be checked (doesn't need relate to the mobj_t->x,y)
out:
testsubsec
floorz
ceilingz
testdropoffz the lowest point contacted (monsters won't move to a dropoff)
hitthing
==================
*/
boolean PB_CheckPosition(void)//L800141B0()
{
int xl, xh, yl, yh, bx, by;
fixed_t r;
testflags = checkthing->flags;
r = checkthing->radius;
testbbox[BOXTOP ] = testy + r;
testbbox[BOXBOTTOM] = testy - r;
testbbox[BOXRIGHT ] = testx + r;
testbbox[BOXLEFT ] = testx - r;
//
// the base floor / ceiling is from the subsector that contains the
// point. Any contacted lines the step closer together will adjust them
//
testsubsec = R_PointInSubsector(testx, testy);
testfloorz = testdropoffz = testsubsec->sector->floorheight;
testceilingz = testsubsec->sector->ceilingheight;
++validcount;
ceilingline = NULL;
hitthing = NULL;
//
// the bounding box is extended by MAXRADIUS because mobj_ts are grouped
// into mapblocks based on their origin point, and can overlap into adjacent
// blocks by up to MAXRADIUS units
//
xl = (testbbox[BOXLEFT] - bmaporgx - MAXRADIUS) >> MAPBLOCKSHIFT;
xh = (testbbox[BOXRIGHT] - bmaporgx + MAXRADIUS) >> MAPBLOCKSHIFT;
yl = (testbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS) >> MAPBLOCKSHIFT;
yh = (testbbox[BOXTOP] - bmaporgy + MAXRADIUS) >> MAPBLOCKSHIFT;
if (xl<0)
{
xl = 0;
}
if (yl<0)
{
yl = 0;
}
if (xh >= bmapwidth)
{
xh = bmapwidth - 1;
}
if (yh >= bmapheight)
{
yh = bmapheight - 1;
}
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
if (!PB_BlockLinesIterator(bx, by))
return false;
if (!PB_BlockThingsIterator(bx, by))
return false;
}
}
return true;
}
/*
=================
=
= PB_BoxCrossLine
=
=================
*/
//inline
boolean PB_BoxCrossLine(line_t *ld)//L80014394()
{
fixed_t x1, x2;
fixed_t lx, ly;
fixed_t ldx, ldy;
fixed_t dx1, dy1;
fixed_t dx2, dy2;
boolean side1, side2;
// entirely outside bounding box of line?
if(testbbox[BOXRIGHT ] <= ld->bbox[BOXLEFT ] ||
testbbox[BOXLEFT ] >= ld->bbox[BOXRIGHT ] ||
testbbox[BOXTOP ] <= ld->bbox[BOXBOTTOM] ||
testbbox[BOXBOTTOM] >= ld->bbox[BOXTOP ])
{
return false;
}
if (ld->slopetype == ST_POSITIVE)
{
x1 = testbbox[BOXLEFT];
x2 = testbbox[BOXRIGHT];
}
else
{
x1 = testbbox[BOXRIGHT];
x2 = testbbox[BOXLEFT];
}
lx = ld->v1->x;
ly = ld->v1->y;
ldx = ld->dx >> FRACBITS; //ldx = (ld->v2.x - ld->v1.x) >> FRACBITS;
ldy = ld->dy >> FRACBITS; //ldy = (ld->v2.y - ld->v1.y) >> FRACBITS;
dx1 = (x1 - lx) >> 16;
dy1 = (testbbox[BOXTOP] - ly) >> FRACBITS;
dx2 = (x2 - lx) >> 16;
dy2 = (testbbox[BOXBOTTOM] - ly) >> FRACBITS;
side1 = ldy*dx1 < dy1*ldx;
side2 = ldy*dx2 < dy2*ldx;
return (side1 != side2);
}
/*
==================
=
= PB_CheckLine
=
= Adjusts testfloorz and testceilingz as lines are contacted
==================
*/
//inline
boolean PB_CheckLine(line_t *ld)//L800144AC()
{
fixed_t opentop, openbottom;
fixed_t lowfloor;
sector_t *front, *back;
/*
=
= The moving thing's destination position will cross the given line.
= If this should not be allowed, return FALSE.
*/
if (!ld->backsector)
return false; // one sided line
if (!(testflags & MF_MISSILE) && (ld->flags & (ML_BLOCKING | ML_BLOCKMONSTERS)))
return false; // explicitly blocking
if ((ld->flags & ML_BLOCKPRJECTILE)) //psx doom new
return false;
front = ld->frontsector;
back = ld->backsector;
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
if (front->floorheight > back->floorheight)
{
openbottom = front->floorheight;
lowfloor = back->floorheight;
}
else
{
openbottom = back->floorheight;
lowfloor = front->floorheight;
}
// adjust floor / ceiling heights
if (opentop < testceilingz)
{
testceilingz = opentop;
ceilingline = ld;
}
if (openbottom > testfloorz)
testfloorz = openbottom;
if (lowfloor < testdropoffz)
testdropoffz = lowfloor;
return true;
}
/*
==================
=
= PB_CheckThing
=
==================
*/
boolean PB_CheckThing(mobj_t *thing)//L80014598()
{
fixed_t blockdist;
int delta;
mobj_t *mo;
if (!(thing->flags & MF_SOLID))
return true; // not blocking
mo = checkthing;
blockdist = thing->radius + mo->radius;
delta = thing->x - testx;
if (delta < 0)
delta = -delta;
if (delta >= blockdist)
return true; // didn't hit it
delta = thing->y - testy;
if (delta < 0)
delta = -delta;
if (delta >= blockdist)
return true; // didn't hit it
if (thing == mo)
return true; // don't clip against self
//
// check for skulls slamming into things
//
if (testflags & MF_SKULLFLY)
{
hitthing = thing;
return false; // stop moving
}
//
// missiles can hit other things
//
if (testflags & MF_MISSILE)
{
// see if it went over / under
if (mo->z > thing->z + thing->height)
return true; // overhead
if (mo->z + mo->height < thing->z)
return true; // underneath
if (mo->target->type == thing->type) // don't hit same species as originator
{
if (thing == mo->target)
return true; // don't explode on shooter
if (thing->type != MT_PLAYER)
return false; // explode, but do no damage
// let players missile other players
}
if (!(thing->flags & MF_SHOOTABLE))
return !(thing->flags & MF_SOLID); // didn't do any damage
// damage / explode
hitthing = thing;
return false; // don't traverse any more
}
return !(thing->flags & MF_SOLID);
}
/*
==================
=
= PB_BlockLinesIterator
=
==================
*/
boolean PB_BlockLinesIterator(int x, int y) //L800146C4()
{
int offset;
short *list;
line_t *ld;
offset = y*bmapwidth+x;
offset = *(blockmap + offset);
for (list = blockmaplump + offset; *list != -1; list++)
{
ld = &lines[*list];
if (ld->validcount == validcount)
continue; // line has already been checked
ld->validcount = validcount;
if (PB_BoxCrossLine(ld))
{
if (!PB_CheckLine(ld))
return false;
}
}
return true; // everything was checked
}
/*
==================
=
= PB_BlockThingsIterator
=
==================
*/
boolean PB_BlockThingsIterator(int x, int y)//L8001498C()
{
mobj_t *mobj;
for (mobj = blocklinks[y*bmapwidth+x]; mobj; mobj = mobj->bnext)
{
if (!PB_CheckThing(mobj))
return false;
}
return true;
}
================================================
FILE: PSXDOOM/p_ceilng.c
================================================
#include "doomdef.h"
#include "p_local.h"
/*================================================================== */
/*================================================================== */
/* */
/* CEILINGS */
/* */
/*================================================================== */
/*================================================================== */
ceiling_t *activeceilings[MAXCEILINGS];//800A9AFC
/*================================================================== */
/* */
/* T_MoveCeiling */
/* */
/*================================================================== */
void T_MoveCeiling (ceiling_t *ceiling)//L80014A04()
{
result_e res;
switch(ceiling->direction)
{
case 0: /* IN STASIS */
break;
case 1: /* UP */
res = T_MovePlane(ceiling->sector,ceiling->speed,
ceiling->topheight,false,1,ceiling->direction);
if (!(gametic & 7))
{
switch (ceiling->type)
{
case silentCrushAndRaise:
break;
default:
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov);
break;
}
}
if (res == pastdest)
{
switch(ceiling->type)
{
case raiseToHighest:
P_RemoveActiveCeiling(ceiling);
break;
case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop);
case fastCrushAndRaise:
case crushAndRaise:
ceiling->direction = -1;
break;
default:
break;
}
}
break;
case -1: /* DOWN */
res = T_MovePlane(ceiling->sector,ceiling->speed,
ceiling->bottomheight,ceiling->crush,1,ceiling->direction);
if (!(gametic & 7))
{
switch (ceiling->type)
{
case silentCrushAndRaise:
break;
default:
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov);
break;
}
}
if (res == pastdest)
{
switch(ceiling->type)
{
case silentCrushAndRaise:
S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop);
case crushAndRaise:
ceiling->speed = CEILSPEED;
case fastCrushAndRaise:
ceiling->direction = 1;
break;
case lowerAndCrush:
case lowerToFloor:
P_RemoveActiveCeiling(ceiling);
break;
default:
break;
}
}
else if (res == crushed)
{
switch(ceiling->type)
{
case silentCrushAndRaise:
case crushAndRaise:
case lowerAndCrush:
ceiling->speed = CEILSPEED / 8;
break;
default:
break;
}
}
break;
}
}
/*================================================================== */
/* */
/* EV_DoCeiling */
/* Move a ceiling up/down and all around! */
/* */
/*================================================================== */
int EV_DoCeiling (line_t *line, ceiling_e type)//L80014C18()
{
int secnum,rtn;
sector_t *sec;
ceiling_t *ceiling;
secnum = -1;
rtn = 0;
/* */
/* Reactivate in-stasis ceilings...for certain types. */
/* */
switch(type)
{
case fastCrushAndRaise:
case silentCrushAndRaise:
case crushAndRaise:
P_ActivateInStasisCeiling(line);
default:
break;
}
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
/* */
/* new door thinker */
/* */
rtn = 1;
ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVSPEC, 0);
P_AddThinker (&ceiling->thinker);
sec->specialdata = ceiling;
ceiling->thinker.function = T_MoveCeiling;
ceiling->sector = sec;
ceiling->crush = false;
switch(type)
{
case fastCrushAndRaise:
ceiling->crush = true;
ceiling->topheight = sec->ceilingheight;
ceiling->bottomheight = sec->floorheight + (8*FRACUNIT);
ceiling->direction = -1;
ceiling->speed = CEILSPEED * 2;
break;
case silentCrushAndRaise:
case crushAndRaise:
ceiling->crush = true;
ceiling->topheight = sec->ceilingheight;
case lowerAndCrush:
case lowerToFloor:
ceiling->bottomheight = sec->floorheight;
if (type != lowerToFloor)
ceiling->bottomheight += 8*FRACUNIT;
ceiling->direction = -1;
ceiling->speed = CEILSPEED;
break;
case raiseToHighest:
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
ceiling->direction = 1;
ceiling->speed = CEILSPEED;
break;
}
ceiling->tag = sec->tag;
ceiling->type = type;
P_AddActiveCeiling(ceiling);
}
return rtn;
}
/*================================================================== */
/* */
/* Add an active ceiling */
/* */
/*================================================================== */
void P_AddActiveCeiling(ceiling_t *c)//L80014DEC()
{
int i;
for (i = 0; i < MAXCEILINGS;i++)
{
if (activeceilings[i] == NULL)
{
activeceilings[i] = c;
return;
}
}
}
/*================================================================== */
/* */
/* Remove a ceiling's thinker */
/* */
/*================================================================== */
void P_RemoveActiveCeiling(ceiling_t *c)//L80014E28()
{
int i;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i] == c)
{
activeceilings[i]->sector->specialdata = NULL;
P_RemoveThinker (&activeceilings[i]->thinker);
activeceilings[i] = NULL;
break;
}
}
}
/*================================================================== */
/* */
/* Restart a ceiling that's in-stasis */
/* */
/*================================================================== */
void P_ActivateInStasisCeiling(line_t *line)//L80014E90()
{
int i;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i] && (activeceilings[i]->tag == line->tag) &&
(activeceilings[i]->direction == 0))
{
activeceilings[i]->direction = activeceilings[i]->olddirection;
activeceilings[i]->thinker.function = T_MoveCeiling;
}
}
}
/*================================================================== */
/* */
/* EV_CeilingCrushStop */
/* Stop a ceiling from crushing! */
/* */
/*================================================================== */
int EV_CeilingCrushStop(line_t *line)//L80014F04()
{
int i;
int rtn;
rtn = 0;
for (i = 0;i < MAXCEILINGS;i++)
{
if (activeceilings[i] && (activeceilings[i]->tag == line->tag) &&
(activeceilings[i]->direction != 0))
{
activeceilings[i]->olddirection = activeceilings[i]->direction;
activeceilings[i]->thinker.function = NULL;
activeceilings[i]->direction = 0; /* in-stasis */
rtn = 1;
}
}
return rtn;
}
================================================
FILE: PSXDOOM/p_change.c
================================================
/* p_change.c */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
//completo y revisado
/*
==============================================================================
SECTOR HEIGHT CHANGING
= After modifying a sectors floor or ceiling height, call this
= routine to adjust the positions of all things that touch the
= sector.
=
= If anything doesn't fit anymore, true will be returned.
= If crunch is true, they will take damage as they are being crushed
= If Crunch is false, you should set the sector height back the way it
= was and call P_ChangeSector again to undo the changes
==============================================================================
*/
boolean crushchange;//iGp000009bc
boolean nofit; //uGp000008d8
/*
==================
=
= P_ThingHeightClip
=
= Takes a valid thing and adjusts the thing->floorz, thing->ceilingz,
= anf possibly thing->z
=
= This is called for all nearby monsters whenever a sector changes height
=
= If the thing doesn't fit, the z will be set to the lowest value and
= false will be returned
==================
*/
//inline
boolean P_ThingHeightClip (mobj_t *thing)//L80014F78()
{
boolean onfloor;
onfloor = (thing->z == thing->floorz);
P_CheckPosition (thing, thing->x, thing->y);
/* what about stranding a monster partially off an edge? */
thing->floorz = tmfloorz;
thing->ceilingz = tmceilingz;
if (onfloor)
/* walking monsters rise and fall with the floor */
thing->z = thing->floorz;
else
{ /* don't adjust a floating monster unless forced to */
if (thing->z+thing->height > thing->ceilingz)
thing->z = thing->ceilingz - thing->height;
}
if (thing->ceilingz - thing->floorz < thing->height)
return false;
return true;
}
/*
===============
=
= PIT_ChangeSector
=
===============
*/
boolean PIT_ChangeSector (mobj_t *thing)//L80015020()
{
mobj_t *mo;
if (P_ThingHeightClip (thing))
return true; /* keep checking */
/* crunch bodies to giblets */
if (thing->health <= 0)
{
P_SetMobjState (thing, S_GIBS);
S_StartSound(thing,sfx_slop);
thing->height = 0;
thing->radius = 0;
if (thing->player == &players[consoleplayer])
stbar.gotgibbed = true;
return true; /* keep checking */
}
/* crunch dropped items */
if (thing->flags & MF_DROPPED)
{
P_RemoveMobj (thing);
return true; /* keep checking */
}
if (! (thing->flags & MF_SHOOTABLE) )
return true; /* assume it is bloody gibs or something */
nofit = true;
if (crushchange && !(gametic&3) )
{
P_DamageMobj(thing,NULL,NULL,10);
/* spray blood in a random direction */
mo = P_SpawnMobj (thing->x, thing->y, thing->z + thing->height/2, MT_BLOOD);
mo->momx = (P_Random() - P_Random ())<<12;
mo->momy = (P_Random() - P_Random ())<<12;
}
return true; /* keep checking (crush other things) */
}
/*
===============
=
= P_ChangeSector
=
===============
*/
boolean P_ChangeSector (sector_t *sector, boolean crunch)//L8001520C()
{
int x,y;
int i;
/* force next sound to reflood */
//for (i=0 ; i= 0 ; i--)
players[i].lastsoundsector = NULL;
nofit = false;
crushchange = crunch;
/* recheck heights for all things near the moving sector */
for (x = sector->blockbox[BOXLEFT]; x <= sector->blockbox[BOXRIGHT]; x++)
{
for (y = sector->blockbox[BOXBOTTOM]; y <= sector->blockbox[BOXTOP]; y++)
{
P_BlockThingsIterator(x, y, PIT_ChangeSector);
}
}
return nofit;
}
================================================
FILE: PSXDOOM/p_doors.c
================================================
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
/*================================================================== */
/*================================================================== */
/* */
/* VERTICAL DOORS */
/* */
/*================================================================== */
/*================================================================== */
/*================================================================== */
/* */
/* T_VerticalDoor */
/* */
/*================================================================== */
void T_VerticalDoor (vldoor_t *door)//L800152D0()
{
result_e res;
switch(door->direction)
{
case 0: /* WAITING */
if (!--door->topcountdown)
{
switch(door->type)
{
case BlazeRaise:
door->direction = -1; /* time to go back down */
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls);
break;
case Normal:
door->direction = -1; /* time to go back down */
S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
break;
case Close30ThenOpen:
door->direction = 1;
S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
break;
default:
break;
}
}
break;
case 2: /* INITIAL WAIT */
if (!--door->topcountdown)
{
switch(door->type)
{
case RaiseIn5Mins:
door->direction = 1;
door->type = Normal;
S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
break;
default:
break;
}
}
break;
case -1: /* DOWN */
res = T_MovePlane(door->sector,door->speed,
door->sector->floorheight,false,1,door->direction);
if (res == pastdest)
{
switch(door->type)
{
case BlazeRaise:
case BlazeClose:
door->sector->specialdata = NULL;
P_RemoveThinker(&door->thinker); /* unlink and free */
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls);
break;
case Normal:
case Close:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); /* unlink and free */
break;
case Close30ThenOpen:
door->direction = 0;
door->topcountdown = TICRATE*30;
break;
default:
break;
}
}
else if (res == crushed)
{
switch (door->type)
{
case BlazeClose:
case Close: /* DO NOT GO BACK UP! */
break;
default:
door->direction = 1;
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn);
break;
}
}
break;
case 1: /* UP */
res = T_MovePlane(door->sector,door->speed,
door->topheight,false,1,door->direction);
if (res == pastdest)
{
switch(door->type)
{
case BlazeRaise:
case Normal:
door->direction = 0; /* wait at top */
door->topcountdown = door->topwait;
break;
case Close30ThenOpen:
case BlazeOpen:
case Open:
door->sector->specialdata = NULL;
P_RemoveThinker (&door->thinker); /* unlink and free */
break;
default:
break;
}
}
break;
}
}
/*================================================================== */
/* */
/* P_CheckKeyLock */
/* Exclusive Psx Doom */
/* Check for locks */
/* */
/*================================================================== */
boolean P_CheckKeyLock(line_t *line, mobj_t *thing)//L80015514()
{
player_t *player;
player = thing->player;
if (!player)
return false;
switch (line->special)
{
case 26: /* Blue Card Lock */
case 32:
case 99:
case 133:
if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
{
player->message = "You need a blue key.";
S_StartSound(thing, sfx_oof);
if (player == &players[consoleplayer])
{
#if GH_UPDATES == 1
stbar.tryopen[MapBlueKeyType] = true;
#else
stbar.tryopen[it_bluecard] = true;
#endif // GH_UPDATES
}
return false;
}
break;
case 27: /* Yellow Card Lock */
case 34:
case 136:
case 137:
if (!player->cards[it_yellowcard] && !player->cards[it_yellowskull])
{
player->message = "You need a yellow key.";
S_StartSound(thing, sfx_oof);
if (player == &players[consoleplayer])
{
#if GH_UPDATES == 1
stbar.tryopen[MapYellowKeyType] = true;
#else
stbar.tryopen[it_yellowcard] = true;
#endif // GH_UPDATES
}
return false;
}
break;
case 28: /* Red Card Lock */
case 33:
case 134:
case 135:
if (!player->cards[it_redcard] && !player->cards[it_redskull])
{
player->message = "You need a red key.";
S_StartSound(thing, sfx_oof);
if (player == &players[consoleplayer])
{
#if GH_UPDATES == 1
stbar.tryopen[MapRedKeyType] = true;
#else
stbar.tryopen[it_redcard] = true;
#endif // GH_UPDATES
}
return false;
}
break;
}
return true;
}
/*================================================================== */
/* */
/* EV_DoDoor */
/* Move a door up/down and all around! */
/* */
/*================================================================== */
int EV_DoDoor (line_t *line, vldoor_e type)//L800156FC()
{
int secnum,rtn;
sector_t *sec;
vldoor_t *door;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
/* */
/* new door thinker */
/* */
rtn = 1;
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
door->thinker.function = T_VerticalDoor;
door->topwait = VDOORWAIT;
door->speed = VDOORSPEED;
door->sector = sec;
door->type = type;
switch(type)
{
case BlazeClose:
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4 * FRACUNIT;
door->direction = -1;
door->speed = VDOORSPEED * 4;
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls);
break;
case Close:
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->direction = -1;
S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
break;
case Close30ThenOpen:
door->topheight = sec->ceilingheight;
door->direction = -1;
S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
break;
case BlazeRaise:
case BlazeOpen:
door->direction = 1;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4 * FRACUNIT;
door->speed = VDOORSPEED * 4;
if (door->topheight != sec->ceilingheight)
S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdopn);
break;
case Normal:
case Open:
door->direction = 1;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
if (door->topheight != sec->ceilingheight)
S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
break;
default:
break;
}
}
return rtn;
}
/*================================================================== */
/* */
/* EV_VerticalDoor : open a door manually, no tag value */
/* */
/*================================================================== */
void EV_VerticalDoor (line_t *line, mobj_t *thing)//L80015920()
{
player_t *player;
int secnum;
sector_t *sec;
vldoor_t *door;
int side;
side = 0; /* only front sides can be used */
/* if the sector has an active thinker, use it */
sec = sides[ line->sidenum[side^1]] .sector;
secnum = sec-sectors;
if (sec->specialdata)
{
door = sec->specialdata;
switch(line->special)
{
case 1: /* ONLY FOR "RAISE" DOORS, NOT "OPEN"s */
case 26:
case 27:
case 28:
case 117:
if (door->direction == -1)
door->direction = 1; /* go back up */
else
{
if (!thing->player)
return; /* JDC: bad guys never close doors */
door->direction = -1; /* start going down immediately */
}
return;
}
}
/* for proper sound */
switch(line->special)
{
case 1: /* NORMAL DOOR SOUND */
case 31:
S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn);
break;
case 117: /* BLAZING DOOR RAISE */
case 118: /* BLAZING DOOR OPEN */
S_StartSound((mobj_t *)&sec->soundorg, sfx_bdopn);
break;
default: /* LOCKED DOOR SOUND */
S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn);
break;
}
/* */
/* new door thinker */
/* */
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
door->thinker.function = T_VerticalDoor;
door->speed = VDOORSPEED;
door->sector = sec;
door->direction = 1;
door->topwait = VDOORWAIT;
switch(line->special)
{
case 1:
case 26:
case 27:
case 28:
door->type = Normal;
break;
case 31:
case 32:
case 33:
case 34:
door->type = Open;
line->special = 0;
break;
case 117: /* blazing door raise */
door->type = BlazeRaise;
door->speed = VDOORSPEED * 4;
break;
case 118: /* blazing door open */
door->type = BlazeOpen;
door->speed = VDOORSPEED * 4;
line->special = 0;
break;
}
/* */
/* find the top and bottom of the movement range */
/* */
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
}
/*================================================================== */
/* */
/* Spawn a door that closes after 30 seconds */
/* */
/*================================================================== */
void P_SpawnDoorCloseIn30 (sector_t *sec)//L80015B1C()
{
vldoor_t *door;
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
sec->special = 0;
door->thinker.function = T_VerticalDoor;
door->sector = sec;
door->direction = 0;
door->type = Normal;
door->speed = VDOORSPEED;
door->topcountdown = 30 * TICRATE;
}
/*================================================================== */
/* */
/* Spawn a door that opens after 5 minutes */
/* */
/*================================================================== */
void P_SpawnDoorRaiseIn5Mins (sector_t *sec, int secnum)//L80015B9C()
{
vldoor_t *door;
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
P_AddThinker (&door->thinker);
sec->specialdata = door;
sec->special = 0;
door->thinker.function = T_VerticalDoor;
door->sector = sec;
door->direction = 2;
door->type = RaiseIn5Mins;
door->speed = VDOORSPEED;
door->topheight = P_FindLowestCeilingSurrounding(sec);
door->topheight -= 4*FRACUNIT;
door->topwait = VDOORWAIT;
door->topcountdown = 5 * 60 * TICRATE;
}
================================================
FILE: PSXDOOM/p_enemy.c
================================================
/* P_enemy.c */
#include "doomdef.h"
#include "p_local.h"
void A_Fall (mobj_t *actor);
/*
===============================================================================
ENEMY THINKING
enemies are allways spawned with targetplayer = -1, threshold = 0
Most monsters are spawned unaware of all players, but some can be made preaware
===============================================================================
*/
/*
================
=
= P_CheckMeleeRange
=
================
*/
//inline
boolean P_CheckMeleeRange (mobj_t *actor)//L80015C40()
{
mobj_t *pl;
fixed_t dist;
if (!(actor->flags&MF_SEETARGET))
return false;
if (!actor->target)
return false;
pl = actor->target;
dist = P_AproxDistance (pl->x-actor->x, pl->y-actor->y);
if (dist >= MELEERANGE)
return false;
return true;
}
/*
================
=
= P_CheckMissileRange
=
================
*/
//inline
boolean P_CheckMissileRange (mobj_t *actor)//L80015CB4()
{
fixed_t dist;
if (!(actor->flags & MF_SEETARGET))
return false;
if (actor->flags & MF_JUSTHIT)
{ /* the target just hit the enemy, so fight back! */
actor->flags &= ~MF_JUSTHIT;
return true;
}
if (actor->reactiontime)
return false; /* don't attack yet */
dist = P_AproxDistance ( actor->x-actor->target->x, actor->y-actor->target->y) - 64*FRACUNIT;
if (!actor->info->meleestate)
dist -= 128*FRACUNIT; /* no melee attack, so fire more */
dist >>= 16;
if (actor->type == MT_SKULL)
dist >>= 1;
if (dist > 200)
dist = 200;
if (P_Random() < dist)
return false;
return true;
}
/*
================
=
= P_Move
=
= Move in the current direction
= returns false if the move is blocked
================
*/
fixed_t xspeed[8] = {FRACUNIT,47000,0,-47000,-FRACUNIT,-47000,0,47000};//80066e90
fixed_t yspeed[8] = {0,47000,FRACUNIT,47000,0,-47000,-FRACUNIT,-47000};//80066eb0
extern line_t *blockline;//8007806c
boolean P_Move (mobj_t *actor)//L80015D98()
{
fixed_t tryx, tryy;
boolean good;
line_t *blkline;
if (actor->movedir == DI_NODIR)
return false;
tryx = actor->x + actor->info->speed * xspeed[actor->movedir];
tryy = actor->y + actor->info->speed * yspeed[actor->movedir];
if (!P_TryMove (actor, tryx, tryy) )
{ /* open any specials */
if (actor->flags & MF_FLOAT && floatok)
{ /* must adjust height */
if (actor->z < tmfloorz)
actor->z += FLOATSPEED;
else
actor->z -= FLOATSPEED;
actor->flags |= MF_INFLOAT;
return true;
}
blkline = blockline;//(line_t *)DSPRead (&blockline);
if (!blkline || !blkline->special)
return false;
actor->movedir = DI_NODIR;
good = false;
/* if the special isn't a door that can be opened, return false */
if (P_UseSpecialLine (actor, blkline))
good = true;
return good;
}
else
actor->flags &= ~MF_INFLOAT;
if (!(actor->flags & MF_FLOAT))
actor->z = actor->floorz;
return true;
}
/*
==================================
=
= TryWalk
=
= Attempts to move actoron in its current (ob->moveangle) direction.
=
= If blocked by either a wall or an actor returns FALSE
= If move is either clear or blocked only by a door, returns TRUE and sets
= If a door is in the way, an OpenDoor call is made to start it opening.
=
==================================
*/
//inline
boolean P_TryWalk (mobj_t *actor)//L80015F00()
{
if (!P_Move (actor))
return false;
actor->movecount = P_Random()&15;
return true;
}
/*
================
=
= P_NewChaseDir
=
================
*/
dirtype_t opposite[] = //80066ed0
{DI_WEST, DI_SOUTHWEST, DI_SOUTH, DI_SOUTHEAST, DI_EAST, DI_NORTHEAST,
DI_NORTH, DI_NORTHWEST, DI_NODIR};
dirtype_t diags[] = {DI_NORTHWEST,DI_NORTHEAST,DI_SOUTHWEST,DI_SOUTHEAST};//80066ef4
void P_NewChaseDir (mobj_t *actor)//L80015F4C()
{
fixed_t deltax,deltay;
dirtype_t d[3];
dirtype_t tdir, olddir, turnaround;
if (!actor->target)
I_Error ("P_NewChaseDir: called with no target");
olddir = actor->movedir;
turnaround=opposite[olddir];
deltax = actor->target->x - actor->x;
deltay = actor->target->y - actor->y;
if (deltax>10*FRACUNIT)
d[1]= DI_EAST;
else if (deltax<-10*FRACUNIT)
d[1]= DI_WEST;
else
d[1]=DI_NODIR;
if (deltay<-10*FRACUNIT)
d[2]= DI_SOUTH;
else if (deltay>10*FRACUNIT)
d[2]= DI_NORTH;
else
d[2]=DI_NODIR;
/* try direct route */
if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{
actor->movedir = diags[((deltay<0)<<1)+(deltax>0)];
if (actor->movedir != turnaround && P_TryWalk(actor))
return;
}
/* try other directions */
if (P_Random() > 200 || abs(deltay)>abs(deltax))
{
tdir=d[1];
d[1]=d[2];
d[2]=tdir;
}
if (d[1]==turnaround)
d[1]=DI_NODIR;
if (d[2]==turnaround)
d[2]=DI_NODIR;
if (d[1]!=DI_NODIR)
{
actor->movedir = d[1];
if (P_TryWalk(actor))
return; /*either moved forward or attacked*/
}
if (d[2]!=DI_NODIR)
{
actor->movedir =d[2];
if (P_TryWalk(actor))
return;
}
/* there is no direct path to the player, so pick another direction */
if (olddir!=DI_NODIR)
{
actor->movedir =olddir;
if (P_TryWalk(actor))
return;
}
if (P_Random()&1) /*randomly determine direction of search*/
{
for (tdir=DI_EAST ; tdir<=DI_SOUTHEAST ; tdir++)
{
if (tdir!=turnaround)
{
actor->movedir =tdir;
if ( P_TryWalk(actor) )
return;
}
}
}
else
{
for (tdir=DI_SOUTHEAST ; (int)tdir >= (int)DI_EAST;tdir--)
{
if (tdir!=turnaround)
{
actor->movedir =tdir;
if ( P_TryWalk(actor) )
return;
}
}
}
if (turnaround != DI_NODIR)
{
actor->movedir =turnaround;
if ( P_TryWalk(actor) )
return;
}
actor->movedir = DI_NODIR; /* can't move */
}
/*
================
=
= P_LookForPlayers
=
= If allaround is false, only look 180 degrees in front
= returns true if a player is targeted
================
*/
boolean P_LookForPlayers (mobj_t *actor, boolean allaround)//L800162CC()
{
angle_t an;
fixed_t dist;
mobj_t *mo;
int plyrnd;
if (!(actor->flags & MF_SEETARGET))
{ /* pick another player as target if possible */
newtarget:
/*if (playeringame[1] && actor->target == players[0].mo)
actor->target = players[1].mo;
else
actor->target = players[0].mo;
return false;*/
plyrnd = 0;
if (playeringame[1])
{
plyrnd = P_Random() & 1;
if (players[plyrnd].health <= 0)
{
plyrnd = plyrnd ^ 1;
}
}
actor->target = players[plyrnd].mo;
return false;
}
mo = actor->target;
if (!mo || mo->health <= 0)
goto newtarget;
if (actor->subsector->sector->soundtarget == actor->target)
allaround = true; /* ambush guys will turn around on a shot */
if (!allaround)
{
an = R_PointToAngle2 (actor->x, actor->y, mo->x, mo->y) - actor->angle;
if (an > ANG90 && an < ANG270)
{
dist = P_AproxDistance (mo->x - actor->x, mo->y - actor->y);
/* if real close, react anyway */
if (dist > MELEERANGE)
return false; /* behind back */
}
}
//actor->threshold = 60;
return true;
}
/*
===============================================================================
ACTION ROUTINES
===============================================================================
*/
/*
==============
=
= A_Look
=
= Stay in state until a player is sighted
=
==============
*/
void A_Look (mobj_t *actor)//L8001644C()
{
mobj_t *targ;
int sound;
/* if current target is visible, start attacking */
if (!P_LookForPlayers(actor, false))
{
/* if the sector has a living soundtarget, make that the new target */
actor->threshold = 0; /* any shot will wake up */
targ = actor->subsector->sector->soundtarget;
if (targ == NULL || !(targ->flags & MF_SHOOTABLE) || (actor->flags & MF_AMBUSH))
return;
actor->target = targ;
}
/* go into chase state */
if (actor->info->seesound)
{
switch (actor->info->seesound)
{
case sfx_posit1:
case sfx_posit2:
case sfx_posit3:
sound = sfx_posit1+(P_Random()&1);
break;
case sfx_bgsit1:
case sfx_bgsit2:
sound = sfx_bgsit1+(P_Random()&1);
break;
default:
sound = actor->info->seesound;
break;
}
if (actor->type == MT_SPIDER || actor->type == MT_CYBORG)
S_StartSound(NULL, sound); // full volume
else
S_StartSound(actor, sound);
}
P_SetMobjState (actor, actor->info->seestate);
}
/*
==============
=
= A_Chase
=
= Actor has a melee attack, so it tries to close as fast as possible
=
==============
*/
void A_Chase (mobj_t *actor)//L80016578()
{
int delta;
if (actor->reactiontime)
actor->reactiontime--;
/* */
/* modify target threshold */
/* */
if (actor->threshold)
actor->threshold--;
/* */
/* turn towards movement direction if not there yet */
/* */
if (actor->movedir < 8)
{
actor->angle &= (7<<29);
delta = actor->angle - (actor->movedir << 29);
if (delta > 0)
actor->angle -= ANG90/2;
else if (delta < 0)
actor->angle += ANG90/2;
}
if (!actor->target || !(actor->target->flags&MF_SHOOTABLE))
{ /* look for a new target */
if (P_LookForPlayers(actor,true))
return; /* got a new target */
P_SetMobjState (actor, actor->info->spawnstate);
return;
}
/* */
/* don't attack twice in a row */
/* */
if (actor->flags & MF_JUSTATTACKED)
{
actor->flags &= ~MF_JUSTATTACKED;
P_NewChaseDir (actor);
return;
}
/* */
/* check for melee attack */
/* */
if (actor->info->meleestate && P_CheckMeleeRange (actor))
{
if (actor->info->attacksound)
S_StartSound (actor, actor->info->attacksound);
P_SetMobjState (actor, actor->info->meleestate);
return;
}
/* */
/* check for missile attack */
/* */
if ( (gameskill == sk_nightmare || !actor->movecount) && actor->info->missilestate
&& P_CheckMissileRange (actor))
{
P_SetMobjState (actor, actor->info->missilestate);
if (gameskill != sk_nightmare)
actor->flags |= MF_JUSTATTACKED;
return;
}
/* */
/* chase towards player */
/* */
if (--actor->movecount<0 || !P_Move (actor))
P_NewChaseDir (actor);
/* */
/* make active sound */
/* */
if (actor->info->activesound && P_Random () < 3)
S_StartSound (actor, actor->info->activesound);
}
/*============================================================================= */
/*
==============
=
= A_FaceTarget
=
==============
*/
//inline
void A_FaceTarget (mobj_t *actor)//L800168C0()
{
if (!actor->target)
return;
actor->flags &= ~MF_AMBUSH;
actor->angle = R_PointToAngle2 (actor->x, actor->y , actor->target->x, actor->target->y);
if (actor->target->flags & (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3))
actor->angle += (P_Random() - P_Random()) << 21;
}
/*
==============
=
= A_PosAttack
=
==============
*/
void A_PosAttack (mobj_t *actor)//L80016964()
{
int angle, damage;
if (!actor->target)
return;
A_FaceTarget (actor);
angle = actor->angle;
S_StartSound (actor, sfx_pistol);
angle += (P_Random()-P_Random())<<20;
damage = ((P_Random()&7)+1)*3;
P_LineAttack (actor, angle, MISSILERANGE, MAXINT, damage);
}
/*
==============
=
= A_SPosAttack
=
==============
*/
void A_SPosAttack (mobj_t *actor)//L80016A6C()
{
int i;
int angle, bangle, damage;
if (!actor->target)
return;
S_StartSound (actor, sfx_shotgn);
A_FaceTarget (actor);
bangle = actor->angle;
for (i=0 ; i<3 ; i++)
{
angle = bangle + ((P_Random()-P_Random())<<20);
damage = ((P_Random() % 5) + 1) * 3;
P_LineAttack (actor, angle, MISSILERANGE, MAXINT, damage);
}
}
/*
==============
=
= A_CPosAttack
=
==============
*/
void A_CPosAttack(mobj_t* actor)//L80016BBC()
{
int angle;
int bangle;
int damage;
int slope;
if (!actor->target)
return;
S_StartSound(actor, sfx_pistol);
A_FaceTarget(actor);
bangle = actor->angle;
slope = P_AimLineAttack(actor, bangle, MISSILERANGE);
angle = bangle + ((P_Random() - P_Random()) << 20);
damage = ((P_Random() % 5) + 1) * 3;
P_LineAttack(actor, angle, MISSILERANGE, slope, damage);
}
/*
==============
=
= A_CPosRefire
=
==============
*/
void A_CPosRefire(mobj_t* actor)//L80016D08()
{
A_FaceTarget(actor);
if (P_Random() < 40)
return;
if (!actor->target || actor->target->health <= 0
|| !P_CheckSight(actor, actor->target))
{
P_SetMobjState(actor, actor->info->seestate);
}
}
/*
==============
=
= A_SpidAttack
=
==============
*/
void A_SpidAttack(mobj_t *actor)//L80016E04()
{
int i;
int angle, bangle, damage;
if (!actor->target)
return;
S_StartSound(actor, sfx_pistol);
A_FaceTarget(actor);
bangle = actor->angle;
for (i = 0; i < 3; i++)
{
angle = bangle + ((P_Random() - P_Random()) << 20);
damage = ((P_Random() % 5) + 1) * 3;
P_LineAttack(actor, angle, MISSILERANGE, MAXINT, damage);
}
}
/*
==============
=
= A_SpidRefire
=
==============
*/
void A_SpidRefire (mobj_t *actor)//L80016F54()
{
/* keep firing unless target got out of sight */
A_FaceTarget (actor);
if (P_Random () < 10)
return;
if (!actor->target || actor->target->health <= 0 || !(actor->flags&MF_SEETARGET) )
P_SetMobjState (actor, actor->info->seestate);
}
/*
==============
=
= A_BspiAttack
=
==============
*/
void A_BspiAttack(mobj_t *actor)//L80017054()
{
if (!actor->target)
return;
A_FaceTarget(actor);
// launch a missile
P_SpawnMissile(actor, actor->target, MT_ARACHPLAZ);
}
/*
==============
=
= A_TroopAttack
=
==============
*/
void A_TroopAttack (mobj_t *actor)//L80017108()
{
int damage;
if (!actor->target)
return;
A_FaceTarget (actor);
if (P_CheckMeleeRange (actor))
{
S_StartSound (actor, sfx_claw);
damage = ((P_Random()&7)+1)*3;
P_DamageMobj (actor->target, actor, actor, damage);
return;
}
/* */
/* launch a missile */
/* */
P_SpawnMissile (actor, actor->target, MT_TROOPSHOT);
}
/*
==============
=
= A_SargAttack
=
==============
*/
void A_SargAttack (mobj_t *actor)//L80017248()
{
int damage;
if (!actor->target)
return;
A_FaceTarget (actor);
damage = ((P_Random()&7)+1)*4;
P_LineAttack (actor, actor->angle, MELEERANGE, 0, damage);
}
/*
==============
=
= A_HeadAttack
=
==============
*/
void A_HeadAttack (mobj_t *actor)//L80017318()
{
int damage;
if (!actor->target)
return;
A_FaceTarget (actor);
if (P_CheckMeleeRange (actor))
{
damage = ((P_Random()&7)+1)*8;
P_DamageMobj (actor->target, actor, actor, damage);
return;
}
/* */
/* launch a missile */
/* */
P_SpawnMissile (actor, actor->target, MT_HEADSHOT);
}
/*
==============
=
= A_CyberAttack
=
==============
*/
void A_CyberAttack (mobj_t *actor)//L8001744C()
{
if (!actor->target)
return;
A_FaceTarget (actor);
P_SpawnMissile (actor, actor->target, MT_ROCKET);
}
/*
==============
=
= A_BruisAttack
=
==============
*/
void A_BruisAttack (mobj_t *actor)//L80017500()
{
int damage;
if (!actor->target)
return;
if (P_CheckMeleeRange (actor))
{
S_StartSound (actor, sfx_claw);
damage = ((P_Random()&7)+1)*11;
P_DamageMobj (actor->target, actor, actor, damage);
return;
}
/* */
/* launch a missile */
/* */
P_SpawnMissile (actor, actor->target, MT_BRUISERSHOT);
}
/*
==============
=
= A_SkelMissile
=
==============
*/
void A_SkelMissile(mobj_t *actor) //L800175C8()
{
mobj_t* mo;
if (!actor->target)
return;
A_FaceTarget(actor);
actor->z += 16 * FRACUNIT; // so missile spawns higher
mo = P_SpawnMissile(actor, actor->target, MT_TRACER);
actor->z -= 16 * FRACUNIT; // back to normal
mo->x += mo->momx;
mo->y += mo->momy;
mo->tracer = actor->target;
}
/*
==============
=
= A_Tracer
=
==============
*/
#define TRACEANGLE 0xC000000
void A_Tracer(mobj_t *actor) //L800176C8()
{
angle_t exact;
fixed_t dist;
fixed_t slope;
mobj_t *dest;
mobj_t *th;
if (!(gametic & 3))
{
// spawn a puff of smoke behind the rocket
P_SpawnPuff(actor->x, actor->y, actor->z);
th = P_SpawnMobj(actor->x - actor->momx, actor->y - actor->momy, actor->z, MT_SMOKE);
th->momz = FRACUNIT;
th->tics -= P_Random() & 3;
if (th->tics < 1)
th->tics = 1;
// adjust direction
dest = actor->tracer;
if (!dest || dest->health <= 0)
return;
// change angle
exact = R_PointToAngle2(actor->x, actor->y, dest->x, dest->y);
if (exact != actor->angle)
{
if (exact - actor->angle > 0x80000000)
{
actor->angle -= TRACEANGLE;
if (exact - actor->angle < 0x80000000)
actor->angle = exact;
}
else
{
actor->angle += TRACEANGLE;
if (exact - actor->angle > 0x80000000)
actor->angle = exact;
}
}
exact = actor->angle >> ANGLETOFINESHIFT;
actor->momx = FixedMul(actor->info->speed, finecosine[exact]);
actor->momy = FixedMul(actor->info->speed, finesine[exact]);
// change slope
dist = P_AproxDistance(dest->x - actor->x, dest->y - actor->y);
dist = dist / actor->info->speed;
if (dist <= 0)
dist = 1;
//slope = (dest->z + 40 * FRACUNIT - actor->z) / dist;
slope = (dest->z - (actor->z + -(40 * FRACUNIT)))/ dist;
if (slope < actor->momz)
actor->momz -= FRACUNIT / 8;
else
actor->momz += FRACUNIT / 8;
}
}
/*
==============
=
= A_SkelWhoosh
=
==============
*/
void A_SkelWhoosh(mobj_t* actor) //L80017918()
{
if (!actor->target)
return;
A_FaceTarget(actor);
S_StartSound(actor, sfx_skeswg);
}
/*
==============
=
= A_SkelFist
=
==============
*/
void A_SkelFist(mobj_t* actor) //L800179C8()
{
int damage;
if (!actor->target)
return;
A_FaceTarget(actor);
if (P_CheckMeleeRange(actor))
{
damage = ((P_Random() % 10) + 1) * 6;
S_StartSound(actor, sfx_skepch);
P_DamageMobj(actor->target, actor, actor, damage);
}
}
/*
==============
=
= A_FatRaise
=
==============
*/
#define FATSPREAD (ANG90/8)
void A_FatRaise(mobj_t *actor)//L80017B28()
{
A_FaceTarget(actor);
S_StartSound(actor, sfx_manatk);
}
/*
==============
=
= A_FatAttack1
=
==============
*/
void A_FatAttack1(mobj_t *actor)//L80017BD8()
{
mobj_t *mo;
mobj_t *target;
int an;
A_FaceTarget(actor);
// Change direction to ...
target = actor->target;
actor->angle += FATSPREAD;
P_SpawnMissile(actor, target, MT_FATSHOT);
mo = P_SpawnMissile(actor, target, MT_FATSHOT);
mo->angle += FATSPREAD;
an = mo->angle >> ANGLETOFINESHIFT;
mo->momx = FixedMul(mo->info->speed, finecosine[an]);
mo->momy = FixedMul(mo->info->speed, finesine[an]);
}
/*
==============
=
= A_FatAttack2
=
==============
*/
void A_FatAttack2(mobj_t *actor)//L80017D14()
{
mobj_t *mo;
mobj_t *target;
int an;
A_FaceTarget(actor);
// Now here choose opposite deviation.
target = actor->target;
actor->angle -= FATSPREAD;
P_SpawnMissile(actor, target, MT_FATSHOT);
mo = P_SpawnMissile(actor, target, MT_FATSHOT);
mo->angle -= FATSPREAD * 2;
an = mo->angle >> ANGLETOFINESHIFT;
mo->momx = FixedMul(mo->info->speed, finecosine[an]);
mo->momy = FixedMul(mo->info->speed, finesine[an]);
}
/*
==============
=
= A_FatAttack3
=
==============
*/
void A_FatAttack3(mobj_t *actor)//L80017E50()
{
mobj_t *mo;
mobj_t *target;
int an;
A_FaceTarget(actor);
target = actor->target; // [9/2/2021] haleyjd: add missing assignment
mo = P_SpawnMissile(actor, target, MT_FATSHOT);
mo->angle -= FATSPREAD / 2;
an = mo->angle >> ANGLETOFINESHIFT;
mo->momx = FixedMul(mo->info->speed, finecosine[an]);
mo->momy = FixedMul(mo->info->speed, finesine[an]);
mo = P_SpawnMissile(actor, target, MT_FATSHOT);
mo->angle += FATSPREAD / 2;
an = mo->angle >> ANGLETOFINESHIFT;
mo->momx = FixedMul(mo->info->speed, finecosine[an]);
mo->momy = FixedMul(mo->info->speed, finesine[an]);
}
/*
==================
=
= SkullAttack
=
= Fly at the player like a missile
=
==================
*/
#define SKULLSPEED (40*FRACUNIT)
void A_SkullAttack (mobj_t *actor)//L80017FE4()
{
mobj_t *dest;
angle_t an;
int dist;
if (!actor->target)
return;
dest = actor->target;
actor->flags |= MF_SKULLFLY;
S_StartSound (actor, actor->info->attacksound);
A_FaceTarget (actor);
an = actor->angle >> ANGLETOFINESHIFT;
actor->momx = FixedMul (SKULLSPEED, finecosine[an]);
actor->momy = FixedMul (SKULLSPEED, finesine[an]);
dist = P_AproxDistance (dest->x - actor->x, dest->y - actor->y);
dist = dist / SKULLSPEED;
if (dist < 1)
dist = 1;
actor->momz = (dest->z+(dest->height>>1) - actor->z) / dist;
}
/*
==============
=
= A_PainShootSkull
=
==============
*/
//inline
void A_PainShootSkull(mobj_t *actor, angle_t angle)//L80018194()
{
fixed_t x;
fixed_t y;
fixed_t z;
mobj_t* newmobj;
angle_t an;
int prestep;
int count;
#if FIX_PE_SKULL_LIMIT == 1
mobj_t *mo;
#else
thinker_t* currentthinker;
#endif // FIX_PE_SKULL_LIMIT
// count total number of skull currently on the level
count = 0;
#if FIX_PE_SKULL_LIMIT == 1
for (mo=mobjhead.next ; mo != &mobjhead ; mo=mo->next)
{
if ((mo->type == MT_SKULL))
{
count++;
}
}
#else
currentthinker = thinkercap.next;
while (currentthinker != &thinkercap)
{
if ((currentthinker->function == P_MobjThinker) && ((mobj_t *)currentthinker)->type == MT_SKULL)
{
count++;
}
currentthinker = currentthinker->next;
}
#endif // FIX_PE_SKULL_LIMIT
// if there are allready 20 skulls on the level,
// don't spit another one
if (count > 20)
return;
// okay, there's playe for another one
an = angle >> ANGLETOFINESHIFT;
prestep = mobjinfo[MT_SKULL].radius + (4 * FRACUNIT) + actor->info->radius;
//r16 = *L8005E37C + 262144 + *(*(r18 + 88) + 64);
//prestep = 4 * FRACUNIT + 3 * (actor->info->radius + mobjinfo[MT_SKULL].radius) / 2;
x = actor->x + FixedMul(prestep, finecosine[an]);
y = actor->y + FixedMul(prestep, finesine[an]);
z = actor->z + 8 * FRACUNIT;
newmobj = P_SpawnMobj(x, y, z, MT_SKULL);
// Check for movements.
if (!P_TryMove(newmobj, newmobj->x, newmobj->y))
{
// kill it immediately
P_DamageMobj(newmobj, actor, actor, 10000);
return;
}
newmobj->target = actor->target;
A_SkullAttack(newmobj);
}
/*
==============
=
= A_PainAttack
=
==============
*/
void A_PainAttack(mobj_t *actor)//L800182E8()
{
if (!actor->target)
return;
A_FaceTarget(actor);
A_PainShootSkull(actor, actor->angle);
}
/*
==============
=
= A_PainDie
=
==============
*/
void A_PainDie(mobj_t *actor)//L800184B8()
{
A_Fall(actor);
A_PainShootSkull(actor, actor->angle + ANG90);
A_PainShootSkull(actor, actor->angle + ANG180);
A_PainShootSkull(actor, actor->angle + ANG270);
}
/*
==============
=
= A_Scream
=
==============
*/
void A_Scream (mobj_t *actor)//L800188BC()
{
int sound;
switch (actor->info->deathsound)
{
case 0:
return;
case sfx_podth1:
case sfx_podth2:
case sfx_podth3:
sound = sfx_podth1 + (P_Random ()&1);
break;
case sfx_bgdth1:
case sfx_bgdth2:
sound = sfx_bgdth1 + (P_Random ()&1);
break;
default:
sound = actor->info->deathsound;
break;
}
// Check for bosses.
if (actor->type == MT_SPIDER || actor->type == MT_CYBORG)
{
// full volume
S_StartSound(NULL, sound);
}
else
S_StartSound(actor, sound);
}
/*
==============
=
= A_XScream
=
==============
*/
void A_XScream (mobj_t *actor)//L8001892C()
{
S_StartSound (actor, sfx_slop);
}
/*
==============
=
= A_Pain
=
==============
*/
void A_Pain (mobj_t *actor)//L8001894C()
{
if (actor->info->painsound)
S_StartSound (actor, actor->info->painsound);
}
/*
==============
=
= A_Fall
=
==============
*/
void A_Fall (mobj_t *actor)//L80018984()
{
/* actor is on ground, it can be walked over */
actor->flags &= ~MF_SOLID;
}
/*
================
=
= A_Explode
=
================
*/
void A_Explode (mobj_t *thingy)//L80018998()
{
P_RadiusAttack(thingy, thingy->target, 128);
}
/*
================
=
= A_BossDeath
=
= Possibly trigger special effects
================
*/
extern int enemyspecial; //80077DB4
void A_BossDeath (mobj_t *mo)//L800189BC()
{
mobj_t *mo2;
line_t junk;
if (enemyspecial & 1)
{
junk.tag = 666;
if (mo->type == MT_FATSO)
goto RunAction;
}
if (enemyspecial & 2)
{
junk.tag = 667;
if (mo->type == MT_BABY)
goto RunAction;
}
if (enemyspecial & 4)
{
junk.tag = 668;
if (mo->type == MT_SPIDER)
goto RunAction;
}
if (enemyspecial & 8)
{
junk.tag = 669;
if (mo->type == MT_KNIGHT)
goto RunAction;
}
if (enemyspecial & 16)
{
junk.tag = 670;
if (mo->type == MT_CYBORG)
goto RunAction;
}
if (enemyspecial & 32)
{
junk.tag = 671;
if (mo->type == MT_BRUISER)
goto RunAction;
}
//No Find Enemy Special Flag
return;
RunAction:
/* */
/* scan the remaining thinkers to see if all bosses are dead */
/* */
/* FIXME */
for (mo2=mobjhead.next ; mo2 != &mobjhead ; mo2=mo2->next)
{
if ((mo2 != mo) && (mo2->type == mo->type) && (mo2->health > 0))
return; /* other boss not dead */
}
/* */
/* victory! */
/* */
switch (junk.tag)// Get case number
{
case 666:
enemyspecial &= ~1;
EV_DoFloor(&junk, lowerFloorToLowest);
break;
case 667:
enemyspecial &= ~2;
EV_DoFloor(&junk, raiseFloor24);
break;
case 668:
enemyspecial &= ~4;
EV_DoFloor(&junk, lowerFloorToLowest);
break;
case 669:
enemyspecial &= ~8;
EV_DoFloor(&junk, lowerFloorToLowest);
break;
case 670:
enemyspecial &= ~16;
EV_DoDoor(&junk, Open);
break;
case 671:
enemyspecial &= ~32;
EV_DoFloor(&junk, lowerFloorToLowest);
break;
default:
break;
}
}
/*
================
=
= A_Hoof
=
================
*/
void A_Hoof (mobj_t *mo)//L80018BDC()
{
S_StartSound(mo, sfx_hoof);
A_Chase(mo);
}
/*
================
=
= A_Metal
=
================
*/
void A_Metal (mobj_t *mo)//L80018C10()
{
S_StartSound(mo, sfx_metal);
A_Chase(mo);
}
/*
================
=
= A_BabyMetal
=
================
*/
void A_BabyMetal(mobj_t* mo)//L80018C44()
{
S_StartSound(mo, sfx_bspwlk);
A_Chase(mo);
}
/*============================================================================= */
/* a move in p_base.c crossed a special line */
#if 0
void L_CrossSpecial (mobj_t *mo)
{
line_t *line;
line = (line_t *)(mo->extradata & ~1);
P_CrossSpecialLine (line, mo);
}
#endif
/*
================
=
= L_MissileHit
=
================
*/
/* a move in p_base.c caused a missile to hit another thing or wall */
void L_MissileHit (mobj_t *mo)//L80018C78()
{
int damage;
mobj_t *missilething;
missilething = mo->extramobj;
if (missilething)
{
damage = ((P_Random()&7)+1)*mo->info->damage;
P_DamageMobj (missilething, mo, mo->target, damage);
}
P_ExplodeMissile (mo);
}
/*
================
=
= L_SkullBash
=
================
*/
/* a move in p_base.c caused a flying skull to hit another thing or a wall */
void L_SkullBash (mobj_t *mo)//L80018CEC()
{
int damage;
mobj_t *skullthing;
skullthing = mo->extramobj;
if (skullthing)
{
damage = ((P_Random()&7)+1)*mo->info->damage;
P_DamageMobj (skullthing, mo, mo, damage);
}
mo->flags &= ~MF_SKULLFLY;
mo->momx = mo->momy = mo->momz = 0;
P_SetMobjState (mo, mo->info->spawnstate);
}
================================================
FILE: PSXDOOM/p_floor.c
================================================
#include "doomdef.h"
#include "p_local.h"
/*================================================================== */
/*================================================================== */
/* */
/* FLOORS */
/* */
/*================================================================== */
/*================================================================== */
/*================================================================== */
/* */
/* Move a plane (floor or ceiling) and check for crushing */
/* */
/*================================================================== */
result_e T_MovePlane(sector_t *sector,fixed_t speed,
fixed_t dest,boolean crush,int floorOrCeiling,int direction)//L80018D88()
{
boolean flag;
fixed_t lastpos;
switch(floorOrCeiling)
{
case 0: /* FLOOR */
switch(direction)
{
case -1: /* DOWN */
if (sector->floorheight - speed < dest)
{
lastpos = sector->floorheight;
sector->floorheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->floorheight =lastpos;
P_ChangeSector(sector,crush);
/*return crushed; */
}
return pastdest;
}
else
{
lastpos = sector->floorheight;
sector->floorheight -= speed;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;
case 1: /* UP */
if (sector->floorheight + speed > dest)
{
lastpos = sector->floorheight;
sector->floorheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
return crushed; /*return crushed; */
}
return pastdest;
}
else /* COULD GET CRUSHED */
{
lastpos = sector->floorheight;
sector->floorheight += speed;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
if (crush == true)
return crushed;
sector->floorheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;
}
break;
case 1: /* CEILING */
switch(direction)
{
case -1: /* DOWN */
if (sector->ceilingheight - speed < dest)
{
lastpos = sector->ceilingheight;
sector->ceilingheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
/*return crushed; */
}
return pastdest;
}
else /* COULD GET CRUSHED */
{
lastpos = sector->ceilingheight;
sector->ceilingheight -= speed;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
if (crush == true)
return crushed;
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
}
break;
case 1: /* UP */
if (sector->ceilingheight + speed > dest)
{
lastpos = sector->ceilingheight;
sector->ceilingheight = dest;
flag = P_ChangeSector(sector,crush);
if (flag == true)
{
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
/*return crushed; */
}
return pastdest;
}
else
{
lastpos = sector->ceilingheight;
sector->ceilingheight += speed;
flag = P_ChangeSector(sector,crush);
#if 0
if (flag == true)
{
sector->ceilingheight = lastpos;
P_ChangeSector(sector,crush);
return crushed;
}
#endif
}
break;
}
break;
}
return ok;
}
/*================================================================== */
/* */
/* MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN) */
/* */
/*================================================================== */
void T_MoveFloor(floormove_t *floor)//L80018FA8()
{
result_e res;
res = T_MovePlane(floor->sector,floor->speed,
floor->floordestheight,floor->crush,0,floor->direction);
if (!(gametic&3))
S_StartSound((mobj_t *)&floor->sector->soundorg,sfx_stnmov);
if (res == pastdest)
{
floor->sector->specialdata = NULL;
if (floor->direction == 1)
{
switch(floor->type)
{
case donutRaise:
floor->sector->special = floor->newspecial;
floor->sector->floorpic = floor->texture;
default:
break;
}
}
else if (floor->direction == -1)
{
switch(floor->type)
{
case lowerAndChange:
floor->sector->special = floor->newspecial;
floor->sector->floorpic = floor->texture;
default:
break;
}
}
P_RemoveThinker(&floor->thinker);
}
}
/*================================================================== */
/* */
/* HANDLE FLOOR TYPES */
/* */
/*================================================================== */
int EV_DoFloor(line_t *line,floor_e floortype)//L80019098()
{
int secnum;
int rtn;
int i;
sector_t *sec;
floormove_t *floor;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
/* ALREADY MOVING? IF SO, KEEP GOING... */
if (sec->specialdata)
continue;
/* */
/* new floor thinker */
/* */
rtn = 1;
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
sec->specialdata = floor;
floor->thinker.function = T_MoveFloor;
floor->type = floortype;
floor->crush = false;
switch(floortype)
{
case lowerFloor:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = P_FindHighestFloorSurrounding(sec);
break;
case lowerFloorToLowest:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = P_FindLowestFloorSurrounding(sec);
break;
case turboLower:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED * 4;
floor->floordestheight = P_FindHighestFloorSurrounding(sec);
if (floor->floordestheight != sec->floorheight)
floor->floordestheight += 8 * FRACUNIT;
break;
case raiseFloorCrush:
floor->crush = true;
case raiseFloor:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = P_FindLowestCeilingSurrounding(sec);
if (floor->floordestheight > sec->ceilingheight)
floor->floordestheight = sec->ceilingheight;
if (floortype == raiseFloorCrush)
floor->floordestheight -= (8 * FRACUNIT);
break;
case raiseFloorToNearest:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = P_FindNextHighestFloor(sec,sec->floorheight);
break;
case raiseFloor24:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = floor->sector->floorheight + 24 * FRACUNIT;
break;
case raiseFloor24AndChange:
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = floor->sector->floorheight + 24 * FRACUNIT;
sec->floorpic = line->frontsector->floorpic;
sec->special = line->frontsector->special;
break;
case raiseToTexture:
{
int minsize = MAXINT;
side_t *side;
floor->direction = 1;
floor->sector = sec;
floor->speed = FLOORSPEED;
for (i = 0; i < sec->linecount; i++)
{
if (twoSided (secnum, i) )
{
side = getSide(secnum,i,0);
if (side->bottomtexture >= 0)
{
if ((textures[side->bottomtexture].h << FRACBITS) < minsize)
minsize = (textures[side->bottomtexture].h << FRACBITS);
}
side = getSide(secnum,i,1);
if (side->bottomtexture >= 0)
{
if ((textures[side->bottomtexture].h << FRACBITS) < minsize)
minsize = (textures[side->bottomtexture].h << FRACBITS);
}
}
}
floor->floordestheight = floor->sector->floorheight + minsize;
}
break;
case lowerAndChange:
floor->direction = -1;
floor->sector = sec;
floor->speed = FLOORSPEED;
floor->floordestheight = P_FindLowestFloorSurrounding(sec);
floor->texture = sec->floorpic;
for (i = 0; i < sec->linecount; i++)
{
if ( twoSided(secnum, i) )
{
if (getSide(secnum,i,0)->sector-sectors == secnum)
{
sec = getSector(secnum,i,1);
floor->texture = sec->floorpic;
floor->newspecial = sec->special;
break;
}
else
{
sec = getSector(secnum,i,0);
floor->texture = sec->floorpic;
floor->newspecial = sec->special;
break;
}
}
}
default:
break;
}
}
return rtn;
}
/*================================================================== */
/* */
/* BUILD A STAIRCASE! */
/* */
/*================================================================== */
int EV_BuildStairs(line_t *line, stair_e type)//L800194E0()
{
int secnum;
int height;
int i;
int newsecnum;
int texture;
int ok;
int rtn;
fixed_t stairsize;
fixed_t speed;
sector_t *sec, *tsec;
floormove_t *floor;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
/* ALREADY MOVING? IF SO, KEEP GOING... */
if (sec->specialdata)
continue;
/* */
/* new floor thinker */
/* */
rtn = 1;
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
sec->specialdata = floor;
floor->thinker.function = T_MoveFloor;
floor->direction = 1;
floor->sector = sec;
switch (type)
{
case build8:
speed = FLOORSPEED / 2;
stairsize = 8 * FRACUNIT;
break;
case turbo16:
speed = FLOORSPEED * 2;
stairsize = 16 * FRACUNIT;
break;
}
floor->speed = speed;
height = sec->floorheight + stairsize;
floor->floordestheight = height;
texture = sec->floorpic;
/* */
/* Find next sector to raise */
/* 1. Find 2-sided line with same sector side[0] */
/* 2. Other side is the next sector to raise */
/* */
do
{
ok = 0;
for (i = 0;i < sec->linecount;i++)
{
if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
continue;
tsec = (sec->lines[i])->frontsector;
newsecnum = tsec-sectors;
if (secnum != newsecnum)
continue;
tsec = (sec->lines[i])->backsector;
newsecnum = tsec - sectors;
if (tsec->floorpic != texture)
continue;
height += stairsize;
if (tsec->specialdata)
continue;
sec = tsec;
secnum = newsecnum;
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
sec->specialdata = floor;
floor->thinker.function = T_MoveFloor;
floor->direction = 1;
floor->sector = sec;
floor->speed = speed;
floor->floordestheight = height;
ok = 1;
break;
}
} while(ok);
}
return rtn;
}
================================================
FILE: PSXDOOM/p_inter.c
================================================
/* P_inter.c */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
#define BONUSADD 4
/* a weapon is found with two clip loads, a big item has five clip loads */
int maxammo[NUMAMMO] = {200, 50, 300, 50};//80066F04
int clipammo[NUMAMMO] = {10, 4, 20, 1};//80066f14
/*
===============================================================================
GET STUFF
===============================================================================
*/
/*
===================
=
= P_GiveAmmo
=
= Num is the number of clip loads, not the individual count (0= 1/2 clip)
= Returns false if the ammo can't be picked up at all
===================
*/
boolean P_GiveAmmo (player_t *player, ammotype_t ammo, int num)//L8001973C()
{
int oldammo;
if (ammo == am_noammo)
return false;
if (ammo > NUMAMMO)
I_Error ("P_GiveAmmo: bad type %i", ammo);
if ( player->ammo[ammo] == player->maxammo[ammo] )
return false;
if (num)
num *= clipammo[ammo];
else
num = clipammo[ammo]/2;
if (gameskill == sk_baby)
num <<= 1; /* give double ammo in trainer mode */
oldammo = player->ammo[ammo];
player->ammo[ammo] += num;
if (player->ammo[ammo] > player->maxammo[ammo])
player->ammo[ammo] = player->maxammo[ammo];
if (oldammo)
return true; /* don't change up weapons, player was lower on */
/* purpose */
switch (ammo)
{
case am_clip:
if (player->readyweapon == wp_fist)
{
if (player->weaponowned[wp_chaingun])
player->pendingweapon = wp_chaingun;
else
player->pendingweapon = wp_pistol;
}
break;
case am_shell:
if (player->readyweapon == wp_fist || player->readyweapon == wp_pistol)
{
if (player->weaponowned[wp_shotgun])
player->pendingweapon = wp_shotgun;
}
break;
case am_cell:
if (player->readyweapon == wp_fist || player->readyweapon == wp_pistol)
{
if (player->weaponowned[wp_plasma])
player->pendingweapon = wp_plasma;
}
break;
case am_misl:
if (player->readyweapon == wp_fist)
{
if (player->weaponowned[wp_missile])
player->pendingweapon = wp_missile;
}
default:
break;
}
return true;
}
/*
===================
=
= P_GiveWeapon
=
= The weapon name may have a MF_DROPPED flag ored in
===================
*/
boolean P_GiveWeapon (player_t *player, weapontype_t weapon, boolean dropped)//L80019924()
{
boolean gaveammo, gaveweapon;
if (netgame == gt_coop && !dropped)
{ /* leave placed weapons forever on cooperative net games */
if (player->weaponowned[weapon])
return false;
player->weaponowned[weapon] = true;
P_GiveAmmo (player, weaponinfo[weapon].ammo, 2);
player->pendingweapon = weapon;
S_StartSound (player->mo, sfx_wpnup);
return false;
}
if (weaponinfo[weapon].ammo != am_noammo)
{ /* give one clip with a dropped weapon, two clips with a found weapon */
if (dropped)
gaveammo = P_GiveAmmo (player, weaponinfo[weapon].ammo, 1);
else
gaveammo = P_GiveAmmo (player, weaponinfo[weapon].ammo, 2);
}
else
gaveammo = false;
if (player->weaponowned[weapon])
gaveweapon = false;
else
{
gaveweapon = true;
player->weaponowned[weapon] = true;
player->pendingweapon = weapon;
if (player == &players[consoleplayer])
stbar.specialFace = f_gotgat;
}
return gaveweapon || gaveammo;
}
/*
===================
=
= P_GiveBody
=
= Returns false if the body isn't needed at all
===================
*/
//inline
boolean P_GiveBody (player_t *player, int num)//L80019A8C()
{
if (player->health >= MAXHEALTH)
return false;
player->health += num;
if (player->health > MAXHEALTH)
player->health = MAXHEALTH;
player->mo->health = player->health;
return true;
}
/*
===================
=
= P_GiveArmor
=
= Returns false if the armor is worse than the current armor
===================
*/
//inline
boolean P_GiveArmor (player_t *player, int armortype)//L80019AD8()
{
int hits;
hits = armortype*100;
if (player->armorpoints >= hits)
return false; /* don't pick up */
player->armortype = armortype;
player->armorpoints = hits;
return true;
}
/*
===================
=
= P_GiveCard
=
===================
*/
//inline
void P_GiveCard (player_t *player, card_t card)//L80019B14()
{
if (player->cards[card])
return;
player->bonuscount = BONUSADD;
player->cards[card] = true;
}
/*
===================
=
= P_GivePower
=
===================
*/
//inline
boolean P_GivePower (player_t *player, powertype_t power)//L80019B40()
{
if(power >= NUMPOWERS)
return false;
switch (power)
{
case pw_invulnerability:
player->powers[power] = INVULNTICS;
return true;
case pw_invisibility:
player->powers[power] = INVISTICS;
player->mo->flags |= (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3);
return true;
case pw_infrared:
player->powers[power] = INFRATICS;
return true;
case pw_ironfeet:
player->powers[power] = IRONTICS;
return true;
case pw_strength:
P_GiveBody(player, 100);
player->powers[power] = 1;
return true;
default:
break;
}
//pw_allmap
if (player->powers[power])
return false; /* already got it */
player->powers[power] = 1;
return true;
}
/*
==================
=
= P_TouchSpecialThing
=
==================
*/
void P_TouchSpecialThing (mobj_t *special, mobj_t *toucher)//L80019C24()
{
player_t *player;
int i;
fixed_t delta;
int sound;
delta = special->z - toucher->z;
if (delta > toucher->height || delta < -8*FRACUNIT)
return; /* out of reach */
sound = sfx_itemup;
player = toucher->player;
if (toucher->health <= 0)
return; /* can happen with a sliding player corpse */
switch (special->sprite)
{
/* */
/* bonus items */
/* */
case SPR_BON1:
player->health+=2; /* can go over 100% */
if (player->health > 200)
player->health = 200;
player->mo->health = player->health;
player->message = "You pick up a health bonus.";
break;
case SPR_BON2:
player->armorpoints+=2; /* can go over 100% */
if (player->armorpoints > 200)
player->armorpoints = 200;
if (!player->armortype)
player->armortype = 1;
player->message = "You pick up an armor bonus.";
break;
case SPR_SOUL:
player->health += 100;
if (player->health > 200)
player->health = 200;
player->mo->health = player->health;
player->message = "Supercharge!";
sound = sfx_getpow;
break;
case SPR_MEGA:
player->health = 200;
player->mo->health = 200;
P_GiveArmor(player, 2);
player->message = "Mega Sphere!";
sound = sfx_getpow;
break;
/* */
/* ammo */
/* */
case SPR_CLIP:
if (special->flags & MF_DROPPED)
{
if (!P_GiveAmmo (player,am_clip,0))
return;
}
else
{
if (!P_GiveAmmo (player,am_clip,1))
return;
}
player->message = "Picked up a clip.";
break;
case SPR_AMMO:
if (!P_GiveAmmo (player, am_clip,5))
return;
player->message = "Picked up a box of bullets.";
break;
case SPR_ROCK:
if (!P_GiveAmmo (player, am_misl,1))
return;
player->message = "Picked up a rocket.";
break;
case SPR_BROK:
if (!P_GiveAmmo (player, am_misl,5))
return;
player->message = "Picked up a box of rockets.";
break;
case SPR_CELL:
if (!P_GiveAmmo (player, am_cell,1))
return;
player->message = "Picked up an energy cell.";
break;
case SPR_CELP:
if (!P_GiveAmmo (player, am_cell,5))
return;
player->message = "Picked up an energy cell pack.";
break;
case SPR_SHEL:
if (!P_GiveAmmo (player, am_shell,1))
return;
player->message = "Picked up 4 shotgun shells.";
break;
case SPR_SBOX:
if (!P_GiveAmmo (player, am_shell,5))
return;
player->message = "Picked up a box of shells.";
break;
case SPR_BPAK:
if (!player->backpack)
{
for (i=0 ; imaxammo[i] *= 2;
player->backpack = true;
}
for (i=0 ; imessage = "You got the backpack!";
break;
/* */
/* weapons */
/* */
case SPR_BFUG:
if (!P_GiveWeapon (player, wp_bfg, false) )
return;
player->message = "You got the BFG9000! Oh, yes.";
sound = sfx_wpnup;
break;
case SPR_MGUN:
if (!P_GiveWeapon (player, wp_chaingun, special->flags&MF_DROPPED) )
return;
player->message = "You got the chaingun!";
sound = sfx_wpnup;
break;
case SPR_CSAW:
if (!P_GiveWeapon (player, wp_chainsaw, false) )
return;
player->message = "A chainsaw! Find some meat!";
sound = sfx_wpnup;
break;
case SPR_LAUN:
if (!P_GiveWeapon (player, wp_missile, false) )
return;
player->message = "You got the rocket launcher!";
sound = sfx_wpnup;
break;
case SPR_PLAS:
if (!P_GiveWeapon (player, wp_plasma, false) )
return;
player->message = "You got the plasma gun!";
sound = sfx_wpnup;
break;
case SPR_SHOT:
if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) )
return;
player->message = "You got the shotgun!";
sound = sfx_wpnup;
break;
case SPR_SGN2:
if (!P_GiveWeapon(player, wp_supershotgun, special->flags&MF_DROPPED))
return;
player->message = "You got the super shotgun!";
sound = sfx_wpnup;
break;
/* */
/* armor */
/* */
case SPR_ARM1:
if (!P_GiveArmor(player, 1))
return;
player->message = "You pick up the armor.";
break;
case SPR_ARM2:
if (!P_GiveArmor(player, 2))
return;
player->message = "You got the MegaArmor!";
break;
/* */
/* cards */
/* leave cards for everyone */
/* */
case SPR_BKEY:
if (!player->cards[it_bluecard])
player->message = "You pick up a blue keycard.";
P_GiveCard(player, it_bluecard);
if (!netgame)
break;
return;
case SPR_RKEY:
if (!player->cards[it_redcard])
player->message = "You pick up a red keycard.";
P_GiveCard(player, it_redcard);
if (!netgame)
break;
return;
case SPR_YKEY:
if (!player->cards[it_yellowcard])
player->message = "You pick up a yellow keycard.";
P_GiveCard(player, it_yellowcard);
if (!netgame)
break;
return;
case SPR_BSKU:
if (!player->cards[it_blueskull])
player->message = "You pick up a blue skull key.";
P_GiveCard(player, it_blueskull);
if (!netgame)
break;
return;
case SPR_RSKU:
if (!player->cards[it_redskull])
player->message = "You pick up a red skull key.";
P_GiveCard(player, it_redskull);
if (!netgame)
break;
return;
case SPR_YSKU:
if (!player->cards[it_yellowskull])
player->message = "You pick up a yellow skull key.";
P_GiveCard(player, it_yellowskull);
if (!netgame)
break;
return;
/* */
/* heals */
/* */
case SPR_STIM:
if (!P_GiveBody(player, 10))
return;
player->message = "You pick up a stimpack.";
break;
case SPR_MEDI:
if (!P_GiveBody(player, 25))
return;
if (player->health < 25)
player->message = "You pick up a medikit that you REALLY need!";
else
player->message = "You pick up a medikit.";
break;
/* */
/* power ups */
/* */
case SPR_PINV:
P_GivePower(player, pw_invulnerability);
player->message = "Invulnerability!";
sound = sfx_getpow;
break;
case SPR_PSTR:
P_GivePower(player, pw_strength);
player->message = "Berserk!";
if (player->readyweapon != wp_fist)
player->pendingweapon = wp_fist;
sound = sfx_getpow;
break;
case SPR_PINS:
P_GivePower(player, pw_invisibility);
player->message = "Partial Invisibility!";
sound = sfx_getpow;
break;
case SPR_SUIT:
P_GivePower(player, pw_ironfeet);
player->message = "Radiation Shielding Suit";
sound = sfx_getpow;
break;
case SPR_PMAP:
if (!P_GivePower(player, pw_allmap))
return;
player->message = "Computer Area Map";
sound = sfx_getpow;
break;
case SPR_PVIS:
P_GivePower(player, pw_infrared);
player->message = "Light Amplification Goggles";
sound = sfx_getpow;
break;
default:
//I_Error("P_SpecialThing: Unknown gettable thing");
break;
}
if (special->flags & MF_COUNTITEM)
player->itemcount++;
P_RemoveMobj (special);
player->bonuscount += BONUSADD;
//[GEC] Info: (NULL parameter) This is the reason why items always sound echo when picked up.
if (player == &players[consoleplayer])
S_StartSound(NULL, sound);//S_StartSound (toucher, sound);
}
/*
==============
=
= KillMobj
=
==============
*/
void P_KillMobj (mobj_t *source, mobj_t *target)//L8001A514()
{
mobjtype_t item;
mobj_t *mo;
boolean forceXdeath;
target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY);
if (target->type != MT_SKULL)
target->flags &= ~MF_NOGRAVITY;
target->flags |= MF_CORPSE|MF_DROPOFF;
target->height >>= 2;
forceXdeath = false; //New PsxDoom
if (target->player)
{ /* a frag of one sort or another */
if (!source || !source->player || source->player == target->player)
{ /* killed self somehow */
target->player->frags--;
//if (target->player->frags < 0)
//target->player->frags = 0;
}
else
{ /* killed by other player */
source->player->frags++;
}
/* else just killed by a monster */
}
else if (source && source->player && (target->flags & MF_COUNTKILL) )
{ /* a deliberate kill by a player */
source->player->killcount++; /* count for intermission */
}
else if (!netgame && (target->flags & MF_COUNTKILL) )
players[0].killcount++; /* count all monster deaths, even */
/* those caused by other monsters */
if (target->player)
{
target->flags &= ~MF_SOLID;
target->player->playerstate = PST_DEAD;
P_DropWeapon (target->player);
if (target->health < -50)
{
forceXdeath = true; //Force the player to the state of Xdeath
if (target->player == &players[consoleplayer])
stbar.gotgibbed = true;
S_StartSound (target, sfx_slop);
}
else
S_StartSound (target, sfx_pldeth);
// Psx Doom New
if (playercounttarget >= MAXTARGET)
P_RemoveMobj(playertarget[playercounttarget & (MAXTARGET-1)]);
playertarget[playercounttarget & (MAXTARGET-1)] = target;
playercounttarget++;
}
if (forceXdeath || (target->health < -target->info->spawnhealth) && target->info->xdeathstate)
P_SetMobjState (target, target->info->xdeathstate);
else
P_SetMobjState (target, target->info->deathstate);
target->tics -= P_Random()&1;
if (target->tics < 1)
target->tics = 1;
/* */
/* drop stuff */
/* */
switch (target->type)
{
case MT_POSSESSED:
item = MT_CLIP;
break;
case MT_SHOTGUY:
item = MT_SHOTGUN;
break;
case MT_CHAINGUY:
item = MT_CHAINGUN;
break;
default:
return;
}
mo = P_SpawnMobj (target->x,target->y,ONFLOORZ, item);
mo->flags |= MF_DROPPED; /* special versions of items */
}
/*
=================
=
= P_DamageMobj
=
= Damages both enemies and players
= inflictor is the thing that caused the damage
= creature or missile, can be NULL (slime, etc)
= source is the thing to target after taking damage
= creature or NULL
= Source and inflictor are the same for melee attacks
= source can be null for barrel explosions and other environmental stuff
==================
*/
void P_DamageMobj (mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage)//L8001A838()
{
unsigned ang, an;
int saved;
player_t *player;
fixed_t thrust;
if (!(target->flags & MF_SHOOTABLE))
return; /* shouldn't happen... */
if (target->health <= 0)
return;
if (target->flags & MF_SKULLFLY)
{
target->momx = target->momy = target->momz = 0;
}
player = target->player;
if (player && gameskill == sk_baby)
damage >>= 1; /* take half damage in trainer mode */
if (player && (damage > 30) && player == &players[consoleplayer])
stbar.specialFace = f_hurtbad;
/* */
/* kick away unless using the chainsaw */
/* */
if (inflictor && (!source || !source->player || source->player->readyweapon != wp_chainsaw))
{
ang = R_PointToAngle2 (inflictor->x, inflictor->y, target->x, target->y);
thrust = (damage * ((FRACUNIT >> 2) * 100)) / target->info->mass;
/* make fall forwards sometimes */
if ( (damage < 40) && (damage > target->health) && (target->z - inflictor->z > (64*FRACUNIT)) && (P_Random ()&1))
{
ang += ANG180;
thrust *= 4;
}
an = ang >> ANGLETOFINESHIFT;
thrust >>= 16;
target->momx += thrust * finecosine[an];
target->momy += thrust * finesine[an];
if (target->player)//psx new
{
if (target->momx > MAXMOVE)
target->momx = MAXMOVE;
else if (target->momx < -MAXMOVE)
target->momx = -MAXMOVE;
if (target->momy > MAXMOVE)
target->momy = MAXMOVE;
else if (target->momy < -MAXMOVE)
target->momy = -MAXMOVE;
}
}
else
{
ang = target->angle;
}
/* */
/* player specific */
/* */
if (player)
{
if ((player->cheats&CF_GODMODE) || player->powers[pw_invulnerability])
return;
if (player == &players[consoleplayer])
{
ang -= target->angle;
if (ang > 0x30000000 && ang <0x80000000)
stbar.specialFace = f_faceright;
else if (ang >0x80000000 && ang < 0xd0000000)
stbar.specialFace = f_faceleft;
}
if (player->armortype)
{
if (player->armortype == 1)
saved = damage/3;
else
saved = damage/2;
if (player->armorpoints <= saved)
{ /* armor is used up */
saved = player->armorpoints;
player->armortype = 0;
}
player->armorpoints -= saved;
damage -= saved;
}
S_StartSound (target,sfx_plpain);
player->health -= damage; /* mirror mobj health here for Dave */
if (player->health < 0)
player->health = 0;
player->attacker = source;
// Tweak made in PSX version: add '1' here so that all damage causes a palette flash
player->damagecount += 1 + (damage>>1); /* add damage after armor / invuln */
}
/* */
/* do the damage */
/* */
target->health -= damage;
if (target->health <= 0)
{
P_KillMobj (source, target);
return;
}
if ( (P_Random () < target->info->painchance) && !(target->flags&MF_SKULLFLY) )
{
target->flags |= MF_JUSTHIT; /* fight back! */
P_SetMobjState (target, target->info->painstate);
}
target->reactiontime = 0; /* we're awake now... */
if (!target->threshold && source)
{ /* if not intent on another player, chase after this one */
target->target = source;
target->threshold = BASETHRESHOLD;
if (target->state == &states[target->info->spawnstate] && target->info->seestate != S_NULL)
{
P_SetMobjState (target, target->info->seestate);
}
}
}
================================================
FILE: PSXDOOM/p_lights.c
================================================
#include "doomdef.h"
#include "p_local.h"
/*================================================================== */
/*================================================================== */
/* */
/* BROKEN LIGHT FLASHING */
/* */
/*================================================================== */
/*================================================================== */
/*================================================================== */
/* */
/* T_FireFlicker */
/* */
/* Exclusive Psx Doom From PC Doom */
/* */
/*================================================================== */
void T_FireFlicker(fireflicker_t *flick)//L8001AD0C()
{
int amount;
if (--flick->count)
return;
amount = (P_Random() & 3) * 16;
if (flick->sector->lightlevel - amount < flick->minlight)
flick->sector->lightlevel = flick->minlight;
else
flick->sector->lightlevel = flick->maxlight - amount;
flick->count = 3;
}
/*================================================================== */
/* */
/* P_SpawnFireFlicker */
/* */
/* Exclusive Psx Doom From PC Doom */
/* */
/*================================================================== */
void P_SpawnFireFlicker(sector_t *sector)//L8001AD98()
{
fireflicker_t *flick;
sector->special = 0; /* nothing special about it during gameplay */
flick = Z_Malloc(sizeof(*flick), PU_LEVSPEC, 0);
P_AddThinker(&flick->thinker);
flick->thinker.function = T_FireFlicker;
flick->sector = sector;
flick->maxlight = sector->lightlevel;
flick->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel) + 16;
flick->count = 3;
}
/*================================================================== */
/* */
/* T_LightFlash */
/* */
/* After the map has been loaded, scan each sector for specials */
/* that spawn thinkers */
/* */
/*================================================================== */
void T_LightFlash (lightflash_t *flash)//L8001AE24()
{
if (--flash->count)
return;
if (flash->sector->lightlevel == flash->maxlight)
{
flash-> sector->lightlevel = flash->minlight;
flash->count = (P_Random()&flash->mintime)+1;
}
else
{
flash-> sector->lightlevel = flash->maxlight;
flash->count = (P_Random()&flash->maxtime)+1;
}
}
/*================================================================== */
/* */
/* P_SpawnLightFlash */
/* */
/* After the map has been loaded, scan each sector for specials that spawn thinkers */
/* */
/*================================================================== */
void P_SpawnLightFlash (sector_t *sector)//L8001AEAC()
{
lightflash_t *flash;
sector->special = 0; /* nothing special about it during gameplay */
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker (&flash->thinker);
flash->thinker.function = T_LightFlash;
flash->sector = sector;
flash->maxlight = sector->lightlevel;
flash->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
flash->maxtime = 64;
flash->mintime = 7;
flash->count = (P_Random()&flash->maxtime)+1;
}
/*================================================================== */
/* */
/* STROBE LIGHT FLASHING */
/* */
/*================================================================== */
/*================================================================== */
/* */
/* T_StrobeFlash */
/* */
/* After the map has been loaded, scan each sector for specials that spawn thinkers */
/* */
/*================================================================== */
void T_StrobeFlash (strobe_t *flash)//L8001AF54()
{
if (--flash->count)
return;
if (flash->sector->lightlevel == flash->minlight)
{
flash-> sector->lightlevel = flash->maxlight;
flash->count = flash->brighttime;
}
else
{
flash-> sector->lightlevel = flash->minlight;
flash->count =flash->darktime;
}
}
/*================================================================== */
/* */
/* P_SpawnLightFlash */
/* */
/* After the map has been loaded, scan each sector for specials that spawn thinkers */
/* */
/*================================================================== */
//inline
void P_SpawnStrobeFlash (sector_t *sector,int fastOrSlow, int inSync)//L8001AFB8()
{
strobe_t *flash;
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker (&flash->thinker);
flash->sector = sector;
flash->darktime = fastOrSlow;
flash->brighttime = STROBEBRIGHT;
flash->thinker.function = T_StrobeFlash;
flash->maxlight = sector->lightlevel;
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
if (flash->minlight == flash->maxlight)
flash->minlight = 0;
sector->special = 0; /* nothing special about it during gameplay */
if (!inSync)
flash->count = (P_Random()&7)+1;
else
flash->count = 1;
}
/*================================================================== */
/* */
/* P_SpawnLightFlash */
/* */
/* Exclusive Psx Doom */
/* After the map has been loaded, scan each sector for specials that spawn thinkers */
/* */
/*================================================================== */
void P_SpawnStrobeFlashFast(sector_t *sector)//L8001B08C()
{
strobe_t *flash;
flash = Z_Malloc(sizeof(*flash), PU_LEVSPEC, 0);
P_AddThinker(&flash->thinker);
flash->sector = sector;
flash->darktime = 1;
flash->brighttime = 1;
flash->thinker.function = T_StrobeFlash;
flash->minlight = 10;
flash->maxlight = sector->lightlevel;
flash->count = 1;
if (flash->minlight == flash->maxlight)
flash->minlight = 0;
sector->special = 0; /* nothing special about it during gameplay */
}
/*================================================================== */
/* */
/* Start strobing lights (usually from a trigger) */
/* */
/*================================================================== */
void EV_StartLightStrobing(line_t *line)//L8001B120()
{
int secnum;
sector_t *sec;
secnum = -1;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
//inline function
P_SpawnStrobeFlash (sec,SLOWDARK, 0);
}
}
/*================================================================== */
/* */
/* TURN LINE'S TAG LIGHTS OFF */
/* */
/*================================================================== */
void EV_TurnTagLightsOff(line_t *line)//L8001B230()
{
int i;
int j;
int min;
sector_t *sector;
sector_t *tsec;
line_t *templine;
sector = sectors;
for (j = 0;j < numsectors; j++, sector++)
{
if (sector->tag == line->tag)
{
min = sector->lightlevel;
for (i = 0;i < sector->linecount; i++)
{
templine = sector->lines[i];
tsec = getNextSector(templine,sector);
if (!tsec)
continue;
if (tsec->lightlevel < min)
min = tsec->lightlevel;
}
sector->lightlevel = min;
}
}
}
/*================================================================== */
/* */
/* TURN LINE'S TAG LIGHTS ON */
/* */
/*================================================================== */
void EV_LightTurnOn(line_t *line, int bright)//L8001B32C()
{
int i;
int j;
sector_t *sector;
sector_t *temp;
line_t *templine;
sector = sectors;
for (i = 0; i < numsectors; i++, sector++)
{
if (sector->tag == line->tag)
{
/* */
/* bright = 0 means to search for highest */
/* light level surrounding sector */
/* */
if (!bright)
{
for (j = 0; j < sector->linecount; j++)
{
templine = sector->lines[j];
temp = getNextSector(templine, sector);
if (!temp)
continue;
if (temp->lightlevel > bright)
bright = temp->lightlevel;
}
}
sector->lightlevel = bright;
}
}
}
/*================================================================== */
/* */
/* Spawn glowing light */
/* */
/*================================================================== */
void T_Glow(glow_t *g)//L8001B438()
{
switch(g->direction)
{
case -1: /* DOWN */
g->sector->lightlevel -= GLOWSPEED;
if (g->sector->lightlevel < g->minlight)
{
g->sector->lightlevel = g->minlight;
g->direction = 1;
}
break;
case 1: /* UP */
g->sector->lightlevel += GLOWSPEED;
if (g->maxlight < g->sector->lightlevel)
{
g->sector->lightlevel = g->maxlight;
g->direction = -1;
}
break;
}
}
void P_SpawnGlowingLight(sector_t *sector, glowtype_e type)//L8001B4F0()
{
glow_t *g;
g = Z_Malloc(sizeof(*g), PU_LEVSPEC, 0);
P_AddThinker(&g->thinker);
g->sector = sector;
g->thinker.function = T_Glow;
switch (type)
{
case glowtolower: //special == 8
g->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
g->maxlight = sector->lightlevel;
g->direction = -1;
break;
case glowto10: //special == 200
g->minlight = 10;
g->maxlight = sector->lightlevel;
g->direction = -1;
break;
case glowto255: //special == 201
g->minlight = sector->lightlevel;
g->maxlight = 255;
g->direction = 1;
break;
}
sector->special = 0;
}
================================================
FILE: PSXDOOM/p_local.h
================================================
/* P_local.h */
#ifndef __P_LOCAL__
#define __P_LOCAL__
#ifndef __R_LOCAL__
#include "r_local.h"
#endif
#define FLOATSPEED (FRACUNIT*8)
#define GRAVITY (FRACUNIT*4) //like JagDoom
#define MAXMOVE (16*FRACUNIT)
#define MAXHEALTH 100
#define VIEWHEIGHT (41*FRACUNIT)
/* mapblocks are used to check movement against lines and things */
#define MAPBLOCKUNITS 128
#define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT)
#define MAPBLOCKSHIFT (FRACBITS+7)
#define MAPBMASK (MAPBLOCKSIZE-1)
#define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS)
/* player radius for movement checking */
#define PLAYERRADIUS 16*FRACUNIT
/* MAXRADIUS is for precalculated sector block boxes */
/* the spider demon is larger, but we don't have any moving sectors */
/* nearby */
#define MAXRADIUS 32*FRACUNIT
#define USERANGE (70*FRACUNIT)
#define MELEERANGE (70*FRACUNIT)
#define MISSILERANGE (32*64*FRACUNIT)
typedef enum
{
DI_EAST,
DI_NORTHEAST,
DI_NORTH,
DI_NORTHWEST,
DI_WEST,
DI_SOUTHWEST,
DI_SOUTH,
DI_SOUTHEAST,
DI_NODIR,
NUMDIRS
} dirtype_t;
#define BASETHRESHOLD 100 /* follow a player exlusively for 3 seconds */
/*
===============================================================================
P_TICK
===============================================================================
*/
extern thinker_t thinkercap; /* both the head and tail of the thinker list */
void P_InitThinkers (void);
void P_AddThinker (thinker_t *thinker);
void P_RemoveThinker (thinker_t *thinker);
/*
===============================================================================
P_PSPR
===============================================================================
*/
void P_SetupPsprites (int curplayer); //(player_t *curplayer);
void P_MovePsprites (player_t *curplayer);
void P_DropWeapon (player_t *player);
/*
===============================================================================
P_USER
===============================================================================
*/
void P_PlayerThink (player_t *player);
/*
===============================================================================
P_MOBJ
===============================================================================
*/
extern mobj_t mobjhead;
extern int activethinkers; /* debug count */
extern int activemobjs; /* debug count */
#define ONFLOORZ MININT
#define ONCEILINGZ MAXINT
inline mobj_t *P_SpawnMobj (fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
void P_RemoveMobj (mobj_t *th);
boolean P_SetMobjState (mobj_t *mobj, statenum_t state);
void P_MobjThinker (mobj_t *mobj);
void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
mobj_t *P_SpawnMissile (mobj_t *source, mobj_t *dest, mobjtype_t type);
void P_SpawnPlayerMissile (mobj_t *source, mobjtype_t type);
void P_RunMobjBase (void);//P_RunMobjBase2 (void);
void P_RunMobjExtra (void);
void L_SkullBash (mobj_t *mo);
void L_MissileHit (mobj_t *mo);
void L_CrossSpecial (mobj_t *mo);
void P_ExplodeMissile (mobj_t *mo);
/*
===============================================================================
P_ENEMY
===============================================================================
*/
void A_MissileExplode (mobj_t *mo);
void A_SkullBash (mobj_t *mo);
/*
===============================================================================
P_MAPUTL
===============================================================================
*/
/*typedef struct
{
fixed_t x,y, dx, dy;
} divline_t;*/
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
int P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line);
int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line);
void P_MakeDivline (line_t *li, divline_t *dl);
inline fixed_t P_InterceptVector (divline_t *v2, divline_t *v1);
int P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
extern fixed_t opentop, openbottom, openrange;//,,800780A0
extern fixed_t lowfloor;
void P_LineOpening (line_t *linedef);
boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
extern divline_t trace;
void P_UnsetThingPosition (mobj_t *thing);
void P_SetThingPosition (mobj_t *thing);
void P_PlayerLand (mobj_t *mo);
/*
===============================================================================
P_MAP
===============================================================================
*/
extern boolean floatok; /* if true, move would be ok if */ //80077ea8
extern fixed_t tmfloorz, tmceilingz; /* within tmfloorz - tmceilingz */ //80078010, 80077d30
extern line_t *specialline;//80077dc8
extern mobj_t *movething;
boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
boolean P_TryMove (mobj_t *thing, fixed_t x, fixed_t y);
boolean P_CheckSight (mobj_t *t1, mobj_t *t2);
void P_UseLines (player_t *player);
boolean P_ChangeSector (sector_t *sector, boolean crunch);
extern mobj_t *linetarget; /* who got hit (or NULL) */
fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance);
void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage);
/*
===============================================================================
P_SETUP
===============================================================================
*/
extern byte *rejectmatrix; /* for fast sight rejection */
extern short *blockmaplump; /* offsets in blockmap are from here */
extern short *blockmap;
extern int bmapwidth, bmapheight; /* in mapblocks */
extern fixed_t bmaporgx, bmaporgy; /* origin of block map */
extern mobj_t **blocklinks; /* for thing chains */
/*
===============================================================================
P_INTER
===============================================================================
*/
extern int maxammo[NUMAMMO];
extern int clipammo[NUMAMMO];
void P_TouchSpecialThing (mobj_t *special, mobj_t *toucher);
void P_DamageMobj (mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage);
#include "p_spec.h"
extern int iquehead, iquetail;
#define MAXTARGET 32
extern mobj_t *playertarget[MAXTARGET]; //Psx Doom New 800A854C
extern int playercounttarget; //Psx Doom New 80077E3C
extern int playernum;//80078110, iGp00000d00
void P_RespawnSpecials (void);
/*
===============================================================================
P_MOVE
===============================================================================
*/
//PSX NEW
#define MAXTHINGSPEC 8
extern line_t *thingspec[8];
extern int numthingspec;//80077ee8
extern mobj_t *tmthing;
extern fixed_t tmx, tmy;
extern boolean checkposonly;
void P_TryMove2(void);
int PM_PointOnLineSide(fixed_t x, fixed_t y, line_t *line);
void PM_UnsetThingPosition(mobj_t *thing);
void PM_SetThingPosition(mobj_t *thing);
void PM_CheckPosition(void);
boolean PM_BoxCrossLine(line_t *ld);
boolean PIT_CheckLine(line_t *ld);
boolean PIT_CheckThing(mobj_t *thing);
boolean PM_BlockLinesIterator(int x, int y);
boolean PM_BlockThingsIterator(int x, int y);
/*
===============================================================================
P_SHOOT
===============================================================================
*/
void P_Shoot2(void);
boolean PA_DoIntercept(void *value, boolean isline, int frac);
boolean PA_ShootLine(line_t *li, fixed_t interceptfrac);
boolean PA_ShootThing(mobj_t *th, fixed_t interceptfrac);
fixed_t PA_SightCrossLine(line_t *line);
boolean PA_CrossSubsector(subsector_t *sub);
int PA_DivlineSide(fixed_t x, fixed_t y, divline_t *line);
boolean PA_CrossBSPNode(int bspnum);
/*
===============================================================================
P_SIGHT
===============================================================================
*/
void P_CheckSights(void);
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
boolean PS_CrossBSPNode(int bspnum);
boolean PS_CrossSubsector(subsector_t *sub);
fixed_t PS_SightCrossLine (line_t *line);
#endif /* __P_LOCAL__ */
================================================
FILE: PSXDOOM/p_map.c
================================================
/* P_map.c */
#include "doomdef.h"
#include "p_local.h"
//int DSPRead (void volatile *adr);
/*============================================================================= */
/*================== */
/* */
/* in */
/* */
/*================== */
mobj_t *tmthing; //80077EB8 ||pmGp00000aa8
fixed_t tmx, tmy; //80077F78 , 80077F7C ||fGp00000b68, fGp00000b6c
boolean checkposonly; //80077F10 || Gp00000b00
/*================== */
/* */
/* out */
/* */
/*================== */
extern boolean trymove2; //80077f64
extern boolean floatok; /* if true, move would be ok if */
/* within tmfloorz - tmceilingz */
extern fixed_t tmfloorz, tmceilingz, tmdropoffz;
extern mobj_t *movething; //800780E8
/*============================================================================= */
/*
===================
=
= P_TryMove
=
in:
tmthing a mobj_t (can be valid or invalid)
tmx,tmy a position to be checked (doesn't need relate to the mobj_t->x,y)
out:
newsubsec
floatok if true, move would be ok if within tmfloorz - tmceilingz
floorz
ceilingz
tmdropoffz the lowest point contacted (monsters won't move to a dropoff)
movething
==================
*/
void P_TryMove2 (void);
//int checkpostics;
boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y)//L8001B5D8()
{
checkposonly = true;
tmthing = thing;
tmx = x;
tmy = y;
P_TryMove2 ();
return trymove2;
}
boolean P_TryMove (mobj_t *thing, fixed_t x, fixed_t y)//L8001B614()
{
int damage;
mobj_t *latchedmovething;
tmthing = thing;
tmx = x;
tmy = y;
P_TryMove2 ();
/* */
/* pick up the specials */
/* */
latchedmovething = movething;
if (latchedmovething)
{
if (thing->flags & MF_MISSILE)
{ /* missile bash into a monster */
damage = ((P_Random()&7)+1)*thing->info->damage;
P_DamageMobj (latchedmovething, thing, thing->target, damage);
}
else if (thing->flags & MF_SKULLFLY)
{ /* skull bash into a monster */
damage = ((P_Random()&7)+1)*thing->info->damage;
P_DamageMobj (latchedmovething, thing, thing, damage);
thing->flags &= ~MF_SKULLFLY;
thing->momx = thing->momy = thing->momz = 0;
P_SetMobjState (thing, thing->info->spawnstate);
}
else /* pick up */
P_TouchSpecialThing (latchedmovething, thing);
}
return trymove2;
}
/*
==============================================================================
USE LINES
==============================================================================
*/
int usebbox[4]; //800a853c
divline_t useline; //800A8528
line_t *closeline; //plGp00000c88
fixed_t closedist; //iGp00000cbc
/*
===============
=
= P_InterceptVector
=
= Returns the fractional intercept point along the first divline
=
===============
*/
//inline
fixed_t P_InterceptVector (divline_t *v2, divline_t *v1)//L8001B73C()
{
fixed_t frac, num, den;
den = (v1->dy>>16)*(v2->dx>>16) - (v1->dx>>16)*(v2->dy>>16);
if (den == 0)
return -1;
num = ((v1->x-v2->x)>>16) *(v1->dy>>16) + ((v2->y-v1->y)>>16) * (v1->dx>>16);
frac = (num<<16) / den;
return frac;
}
/*
================
=
= PIT_UseLines
=
================
*/
boolean PIT_UseLines (line_t *li)//L8001B7E0()
{
divline_t dl;
fixed_t frac;
/* */
/* check bounding box first */
/* */
if (usebbox[BOXRIGHT] <= li->bbox[BOXLEFT]
|| usebbox[BOXLEFT] >= li->bbox[BOXRIGHT]
|| usebbox[BOXTOP] <= li->bbox[BOXBOTTOM]
|| usebbox[BOXBOTTOM] >= li->bbox[BOXTOP] )
return true;
/* */
/* find distance along usetrace */
/* */
P_MakeDivline (li, &dl);
frac = P_InterceptVector (&useline, &dl);
if (frac < 0)
return true; /* behind source */
if (frac > closedist)
return true; /* too far away */
/* */
/* the line is actually hit, find the distance */
/* */
if (!li->special)
{
P_LineOpening (li);
if (openrange > 0)
return true; /* keep going */
}
closeline = li;
closedist = frac;
return true; /* can't use for than one special line in a row */
}
/*
================
=
= P_UseLines
=
= Looks for special lines in front of the player to activate
================
*/
void P_UseLines (player_t *player) //L8001B98C()
{
int angle;
fixed_t x1, y1, x2, y2;
int x,y, xl, xh, yl, yh;
angle = player->mo->angle >> ANGLETOFINESHIFT;
x1 = player->mo->x;
y1 = player->mo->y;
x2 = x1 + (USERANGE>>FRACBITS)*finecosine[angle];
y2 = y1 + (USERANGE>>FRACBITS)*finesine[angle];
useline.x = x1;
useline.y = y1;
useline.dx = x2-x1;
useline.dy = y2-y1;
if (useline.dx > 0)
{
usebbox[BOXRIGHT ] = x2;
usebbox[BOXLEFT ] = x1;
}
else
{
usebbox[BOXRIGHT ] = x1;
usebbox[BOXLEFT ] = x2;
}
if (useline.dy > 0)
{
usebbox[BOXTOP ] = y2;
usebbox[BOXBOTTOM] = y1;
}
else
{
usebbox[BOXTOP ] = y1;
usebbox[BOXBOTTOM] = y2;
}
yh = (usebbox[BOXTOP ] - bmaporgy) >> MAPBLOCKSHIFT;
yl = (usebbox[BOXBOTTOM] - bmaporgy) >> MAPBLOCKSHIFT;
xh = (usebbox[BOXRIGHT ] - bmaporgx) >> MAPBLOCKSHIFT;
xl = (usebbox[BOXLEFT ] - bmaporgx) >> MAPBLOCKSHIFT;
// Clamp these coords to the valid range of the blockmap to avoid potential undefined behavior near map edges
#if RANGE_CHECKS == 1
if (xl<0)
xl = 0;
if (yl<0)
yl = 0;
if (xh>= bmapwidth)
xh = bmapwidth -1;
if (yh>= bmapheight)
yh = bmapheight -1;
#endif // RANGE_CHECKS
closeline = NULL;
closedist = FRACUNIT;
validcount++;
for (y = yl; y <= yh; y++)
{
for (x = xl; x <= xh; x++)
{
P_BlockLinesIterator(x, y, PIT_UseLines);
}
}
/* */
/* check closest line */
/* */
if (!closeline)
return;
if (!closeline->special)
S_StartSound (player->mo, sfx_noway);
else
P_UseSpecialLine (player->mo, closeline);
}
/*
==============================================================================
RADIUS ATTACK
==============================================================================
*/
mobj_t *bombsource; //pmGp0000090c
mobj_t *bombspot; //pmGp00000bb8
int bombdamage; //iGp000008b4
/*
=================
=
= PIT_RadiusAttack
=
= Source is the creature that casued the explosion at spot
=================
*/
boolean PIT_RadiusAttack (mobj_t *thing)//L8001BBC8()
{
fixed_t dx, dy, dist;
if (!(thing->flags & MF_SHOOTABLE))
return true;
if ((thing->type == MT_CYBORG) || (thing->type == MT_SPIDER))
return true;
dx = abs(thing->x - bombspot->x);
dy = abs(thing->y - bombspot->y);
dist = dx>dy ? dx : dy;
dist = dist - thing->radius >> FRACBITS;
if (dist < 0)
dist = 0;
if (dist >= bombdamage)
return true; /* out of range */
if (P_CheckSight(thing, bombspot) != 0) // must be in direct path */
{
P_DamageMobj(thing, bombspot, bombsource, bombdamage - dist);
}
return true;
}
/*
=================
=
= P_RadiusAttack
=
= Source is the creature that casued the explosion at spot
=================
*/
void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage)//L8001BCBC()
{
int x,y, xl, xh, yl, yh;
fixed_t dist;
dist = (damage/*+MAXRADIUS*/)<y + dist - bmaporgy)>>MAPBLOCKSHIFT;
yl = (spot->y - dist - bmaporgy)>>MAPBLOCKSHIFT;
xh = (spot->x + dist - bmaporgx)>>MAPBLOCKSHIFT;
xl = (spot->x - dist - bmaporgx)>>MAPBLOCKSHIFT;
// Clamp these coords to the valid range of the blockmap to avoid potential undefined behavior near map edges
#if RANGE_CHECKS == 1
if (xl<0)
xl = 0;
if (yl<0)
yl = 0;
if (xh>= bmapwidth)
xh = bmapwidth -1;
if (yh>= bmapheight)
yh = bmapheight -1;
#endif // RANGE_CHECKS
bombspot = spot;
bombsource = source;
bombdamage = damage;
for (y = yl; y <= yh; y++)
{
for (x = xl; x <= xh; x++)
{
P_BlockThingsIterator(x, y, PIT_RadiusAttack);
}
}
}
/*============================================================================ */
//int sightcounts[2];
/*=================== */
/* */
/* IN */
/* */
/* A line will be traced from the middle of shooter in the direction of */
/* attackangle until either a shootable mobj is within the visible */
/* aimtopslope / aimbottomslope range, or a solid wall blocks further */
/* tracing. If no thing is targeted along the entire range, the first line */
/* that blocks the midpoint of the trace will be hit. */
/*=================== */
mobj_t *shooter; //pmGp00000acc
angle_t attackangle; //aGp0000099c
fixed_t attackrange; //fGp000009b4
fixed_t aimtopslope; //uGp00000a14
fixed_t aimbottomslope; //uGp00000d0c
/*=================== */
/* */
/* OUT */
/* */
/*=================== */
extern line_t *shootline; //800780f4
extern mobj_t *shootmobj; //800780f8
extern fixed_t shootslope; /* between aimtop and aimbottom */ //80077d78
extern fixed_t shootx, shooty, shootz; /* location for puff/blood */ //80077DF0,80077DFC,80077e00
mobj_t *linetarget; /* shootmobj latched in main memory */ //iGp00000904 80077d14
//int shoottics;
/*
=================
=
= P_AimLineAttack
=
=================
*/
fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance)//L8001BD9C()
{
aimtopslope = 100*FRACUNIT/160; /* can't shoot outside view angles */
aimbottomslope = -100*FRACUNIT/160;
validcount++;
attackangle = angle;
attackrange = distance;
shooter = t1;
P_Shoot2 ();
linetarget = shootmobj;
if (shootmobj)
return shootslope;
return 0;
}
/*
=================
=
= P_LineAttack
=
= If slope == MAXINT, use screen bounds for attacking
=
=================
*/
void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage)//L8001BE10()
{
line_t *shootline2;
int shootx2, shooty2, shootz2;
if (slope == MAXINT)
{
aimtopslope = 100*FRACUNIT/160; /* can't shoot outside view angles */
aimbottomslope = -100*FRACUNIT/160;
}
else
{
aimtopslope = slope+1;
aimbottomslope = slope-1;
}
validcount++;
attackangle = angle;
attackrange = distance;
shooter = t1;
P_Shoot2 ();
shootline2 = shootline;
shootx2 = shootx;
shooty2 = shooty;
shootz2 = shootz;
linetarget = shootmobj;
/* */
/* shoot thing */
/* */
if (linetarget)
{
if (linetarget->flags & MF_NOBLOOD)
P_SpawnPuff (shootx2,shooty2,shootz2);
else
P_SpawnBlood (shootx2,shooty2,shootz2, damage);
P_DamageMobj (linetarget, t1, t1, damage);
return;
}
/* */
/* shoot wall */
/* */
if (shootline2)
{
if (shootline2->special)
P_ShootSpecialLine (t1, shootline2);
if (shootline2->frontsector->ceilingpic == -1)
{
if (shootz2 > shootline2->frontsector->ceilingheight)
return; /* don't shoot the sky! */
if (shootline2->backsector && shootline2->backsector->ceilingpic == -1)
return; /* it's a sky hack wall */
}
P_SpawnPuff (shootx2,shooty2,shootz2);
}
}
================================================
FILE: PSXDOOM/p_maputl.c
================================================
/* P_maputl.c */
#include "doomdef.h"
#include "p_local.h"
/*
===================
=
= P_AproxDistance
=
= Gives an estimation of distance (not exact)
=
===================
*/
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy)//L8001BFC8()
{
dx = abs(dx);
dy = abs(dy);
if (dx < dy)
return dx+dy-(dx>>1);
return dx+dy-(dy>>1);
}
/*
==================
=
= P_PointOnLineSide
=
= Returns 0 or 1
==================
*/
int P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line)//L8001C000()
{
fixed_t dx,dy;
fixed_t left, right;
if (!line->dx)
{
if (x <= line->v1->x)
return line->dy > 0;
return line->dy < 0;
}
if (!line->dy)
{
if (y <= line->v1->y)
return line->dx < 0;
return line->dx > 0;
}
dx = (x - line->v1->x);
dy = (y - line->v1->y);
left = (line->dy>>16) * (dx>>16);
right = (dy>>16) * (line->dx>>16);
if (right < left)
return 0; /* front side */
return 1; /* back side */
}
/*
==================
=
= P_PointOnDivlineSide
=
= Returns 0 or 1
==================
*/
int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line)//L8001C0C0()
{
fixed_t dx,dy;
fixed_t left, right;
if (!line->dx)
{
if (x <= line->x)
return line->dy > 0;
return line->dy < 0;
}
if (!line->dy)
{
if (y <= line->y)
return line->dx < 0;
return line->dx > 0;
}
dx = (x - line->x);
dy = (y - line->y);
/* try to quickly decide by looking at sign bits */
if ( (line->dy ^ line->dx ^ dx ^ dy)&0x80000000 )
{
if ( (line->dy ^ dx) & 0x80000000 )
return 1; /* (left is negative) */
return 0;
}
left = FixedMul ( line->dy>>8, dx>>8 );
right = FixedMul ( dy>>8 , line->dx>>8 );
if (right < left)
return 0; /* front side */
return 1; /* back side */
}
/*
==============
=
= P_MakeDivline
=
==============
*/
void P_MakeDivline (line_t *li, divline_t *dl)//L8001C1B4()
{
dl->x = li->v1->x;
dl->y = li->v1->y;
dl->dx = li->dx;
dl->dy = li->dy;
}
/*
==================
=
= P_LineOpening
=
= Sets opentop and openbottom to the window through a two sided line
= OPTIMIZE: keep this precalculated
==================
*/
fixed_t opentop, openbottom, openrange;//80077EE4, 80077D5C, 800780A0 || iGp00000ad4,iGp0000094c,iGp00000c90
fixed_t lowfloor;//80078004||fGp00000bf4
void P_LineOpening (line_t *linedef)//L8001C1F4()
{
sector_t *front, *back;
if (linedef->sidenum[1] == -1)
{ /* single sided line */
openrange = 0;
return;
}
front = linedef->frontsector;
back = linedef->backsector;
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
if (front->floorheight > back->floorheight)
{
openbottom = front->floorheight;
lowfloor = back->floorheight;
}
else
{
openbottom = back->floorheight;
lowfloor = front->floorheight;
}
openrange = opentop - openbottom;
}
/*
===============================================================================
THING POSITION SETTING
===============================================================================
*/
/*
===================
=
= P_UnsetThingPosition
=
= Unlinks a thing from block map and sectors
=
===================
*/
void P_UnsetThingPosition (mobj_t *thing)//L8001C290()
{
int blockx, blocky;
if (!(thing->flags & MF_NOSECTOR))
{ /* inert things don't need to be in blockmap */
/* unlink from subsector */
if (thing->snext)
thing->snext->sprev = thing->sprev;
if (thing->sprev)
thing->sprev->snext = thing->snext;
else
thing->subsector->sector->thinglist = thing->snext;
}
if (!(thing->flags & MF_NOBLOCKMAP))
{ /* inert things don't need to be in blockmap */
/* unlink from block map */
if (thing->bnext)
thing->bnext->bprev = thing->bprev;
if (thing->bprev)
thing->bprev->bnext = thing->bnext;
else
{
blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT;
// Prevent buffer overflow if the map object is out of bounds.
// This is part of the fix for the famous 'linedef deletion' bug.
// From StationDoom by BodbDearg
#if FIX_LINEDEFS_DELETION
if (blockx>=0 && blockx < bmapwidth
&& blocky>=0 && blocky bnext;
}
#else
blocklinks[blocky*bmapwidth+blockx] = thing->bnext;
#endif
}
}
}
/*
===================
=
= P_SetThingPosition
=
= Links a thing into both a block and a subsector based on it's x y
= Sets thing->subsector properly
=
===================
*/
void P_SetThingPosition (mobj_t *thing)//L8001C3A0()
{
subsector_t *ss;
sector_t *sec;
int blockx, blocky;
mobj_t **link;
/* */
/* link into subsector */
/* */
ss = R_PointInSubsector (thing->x,thing->y);
thing->subsector = ss;
if(!(thing->flags & MF_NOSECTOR))
{
/* invisible things don't go into the sector links */
sec = ss->sector;
thing->sprev = NULL;
thing->snext = sec->thinglist;
if(sec->thinglist)
sec->thinglist->sprev = thing;
sec->thinglist = thing;
}
/* */
/* link into blockmap */
/* */
if(!(thing->flags & MF_NOBLOCKMAP))
{
/* inert things don't need to be in blockmap */
blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT;
if(blockx >= 0 && blockx < bmapwidth && blocky >= 0 && blocky < bmapheight)
{
link = &blocklinks[blocky*bmapwidth+blockx];
thing->bprev = NULL;
thing->bnext = *link;
if (*link)
(*link)->bprev = thing;
*link = thing;
}
else
{
/* thing is off the map */
thing->bnext = thing->bprev = NULL;
}
}
}
/*
===============================================================================
BLOCK MAP ITERATORS
For each line/thing in the given mapblock, call the passed function.
If the function returns false, exit with false without checking anything else.
===============================================================================
*/
/*
==================
=
= P_BlockLinesIterator
=
= The validcount flags are used to avoid checking lines
= that are marked in multiple mapblocks, so increment validcount before
= the first call to P_BlockLinesIterator, then make one or more calls to it
===================
*/
boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) )//L8001C4D8()
{
int offset;
short *list;
line_t *ld;
if (x<0 || y<0 || x>=bmapwidth || y>=bmapheight)
return true;
offset = y*bmapwidth+x;
offset = *(blockmap+offset);
for ( list = blockmaplump+offset ; *list != -1 ; list++)
{
ld = &lines[*list];
if (ld->validcount == validcount)
continue; /* line has already been checked */
ld->validcount = validcount;
if ( !func(ld) )
return false;
}
return true; /* everything was checked */
}
/*
==================
=
= P_BlockThingsIterator
=
==================
*/
boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) )//L8001C5F8()
{
mobj_t *mobj;
if (x<0 || y<0 || x>=bmapwidth || y>=bmapheight)
return true;
for (mobj = blocklinks[y*bmapwidth+x] ; mobj ; mobj = mobj->bnext)
{
if (!func( mobj ) )
return false;
}
return true;
}
================================================
FILE: PSXDOOM/p_mobj.c
================================================
/* P_mobj.c */
#include "doomdef.h"
#include "p_local.h"
#include "sounds.h"
void G_PlayerReborn (int player);
#define ITEMQUESIZE 64
mapthing_t itemrespawnque[ITEMQUESIZE];//80085f54
int itemrespawntime[ITEMQUESIZE];//800976f0
int iquehead, iquetail;//80077F60,80077FA8 ||uGp00000b50,uGp00000b98
#define MAXTARGET 32
mobj_t *playertarget[MAXTARGET]; //Psx Doom New 800A854C
int playercounttarget; //Psx Doom New 80077E3C
/*
===============
=
= P_RemoveMobj
=
===============
*/
//inline
void P_RemoveMobj (mobj_t *mobj)//L8001C6BC()
{
int spot;
/* add to the respawnque for altdeath mode */
if ((mobj->flags & MF_SPECIAL) &&
!(mobj->flags & MF_DROPPED) &&
(mobj->type != MT_INV) &&
(mobj->type != MT_INS))
{
spot = iquehead&(ITEMQUESIZE-1);
itemrespawnque[spot].x = mobj->spawnx;
itemrespawnque[spot].y = mobj->spawny;
itemrespawnque[spot].type = mobj->spawntype;
itemrespawnque[spot].angle = mobj->spawnangle;
itemrespawntime[spot] = ticon;
iquehead++;
}
/* unlink from sector and block lists */
P_UnsetThingPosition (mobj);
/* unlink from mobj list */
mobj->next->prev = mobj->prev;
mobj->prev->next = mobj->next;
Z_Free (mobj);
}
/*
===============
=
= P_RespawnSpecials
=
===============
*/
void P_RespawnSpecials (void)//L8001C7D0()
{
fixed_t x,y,z;
subsector_t *ss;
mobj_t *mo;
mapthing_t *mthing;
int i;
int spot;
if (netgame != gt_deathmatch)
return;
if (iquehead == iquetail)
return; /* nothing left to respawn */
if (iquehead - iquetail > ITEMQUESIZE)
iquetail = iquehead - ITEMQUESIZE; /* loose some off the que */
spot = iquetail&(ITEMQUESIZE-1);
if (ticon - itemrespawntime[spot] < 120*15)
return; /* wait at least 120 seconds */
mthing = &itemrespawnque[spot];
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
/* spawn a teleport fog at the new spot */
ss = R_PointInSubsector (x,y);
mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_IFOG);
S_StartSound (mo, sfx_itmbk);
/* find which type to spawn */
for (i=0 ; i< NUMMOBJTYPES ; i++)
{
if (mthing->type == mobjinfo[i].doomednum)
break;
}
/* spawn it */
if (mobjinfo[i].flags & MF_SPAWNCEILING)
z = ONCEILINGZ;
else
z = ONFLOORZ;
mo = P_SpawnMobj (x,y,z, i);
mo->angle = ANG45 * (mthing->angle/45);
mo->spawnx = mthing->x;
mo->spawny = mthing->y;
mo->spawntype = mthing->type;
mo->spawnangle = mthing->angle;
/* pull it from the que */
iquetail++;
}
/*
================
=
= P_SetMobjState
=
= Returns true if the mobj is still present
================
*/
boolean P_SetMobjState (mobj_t *mobj, statenum_t state)//L8001C9B0()
{
state_t *st;
if (state == S_NULL)
{
mobj->state = S_NULL;
P_RemoveMobj (mobj);
return false;
}
st = &states[state];
mobj->state = st;
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
if (st->action) /* call action functions when the state is set */
st->action (mobj);
mobj->latecall = NULL; /* make sure it doesn't come back to life... */
return true;
}
/*
===================
=
= P_ExplodeMissile
=
===================
*/
//inline
void P_ExplodeMissile (mobj_t *mo)//L8001CB34()
{
mo->momx = mo->momy = mo->momz = 0;
P_SetMobjState (mo, mobjinfo[mo->type].deathstate);
mo->tics -= P_Random()&1;
if (mo->tics < 1)
mo->tics = 1;
mo->flags &= ~MF_MISSILE;
if (mo->info->deathsound)
{
S_StopSound((unsigned long)mo->target);
S_StartSound(mo, mo->info->deathsound);
}
}
/*
===============
=
= P_SpawnMobj
=
===============
*/
//int zonetics;
//inline
mobj_t *P_SpawnMobj (fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)//L8001CC00()
{
mobj_t *mobj;
state_t *st;
mobjinfo_t *info;
mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL);
D_memset (mobj, 0, sizeof (*mobj));
info = &mobjinfo[type];
mobj->type = type;
mobj->info = info;
mobj->x = x;
mobj->y = y;
mobj->radius = info->radius;
mobj->height = info->height;
mobj->flags = info->flags;
mobj->health = info->spawnhealth;
mobj->reactiontime = info->reactiontime;
/* do not set the state with P_SetMobjState, because action routines can't */
/* be called yet */
st = &states[info->spawnstate];
mobj->state = st;
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
/* set subsector and/or block links */
P_SetThingPosition (mobj);
mobj->floorz = mobj->subsector->sector->floorheight;
mobj->ceilingz = mobj->subsector->sector->ceilingheight;
if (z == ONFLOORZ)
mobj->z = mobj->floorz;
else if (z == ONCEILINGZ)
mobj->z = mobj->ceilingz - mobj->info->height;
else
mobj->z = z;
/* */
/* link into the mobj list */
/* */
mobjhead.prev->next = mobj;
mobj->next = &mobjhead;
mobj->prev = mobjhead.prev;
mobjhead.prev = mobj;
return mobj;
}
/*============================================================================= */
/*
============
=
= P_SpawnPlayer
=
= Called when a player is spawned on the level
= Most of the player structure stays unchanged between levels
============
*/
extern byte Passwordbuff[12];//0x80096388
extern boolean doPassword;//80077A6C
void P_SpawnPlayer (mapthing_t *mthing)//L8001CDD8()
{
player_t *p;
fixed_t x,y,z;
mobj_t *mobj;
int i;
int levelnum;
int skill;
if (!playeringame[mthing->type-1])
return; /* not playing */
p = &players[mthing->type-1];
if (p->playerstate == PST_REBORN)
G_PlayerReborn (mthing->type-1);
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
z = ONFLOORZ;
mobj = P_SpawnMobj (x,y,z, MT_PLAYER);
mobj->angle = ANG45 * (mthing->angle/45);
mobj->player = p;
mobj->health = p->health;
p->mo = mobj;
p->playerstate = PST_LIVE;
p->refire = 0;
p->message = NULL;
p->damagecount = 0;
p->bonuscount = 0;
p->extralight = 0;
p->fixedcolormap = 0;
p->viewheight = VIEWHEIGHT;
p->automapscale = 36;
p->viewz = mobj->z + VIEWHEIGHT; //new line psxdoom
P_SetupPsprites (mthing->type-1); /* setup gun psprite */
if (netgame == gt_deathmatch)
{
for (i = 0; i < NUMCARDS; i++)
p->cards[i] = true; /* give all cards in death match mode */
}
if (netgame == gt_single)
{
if ((mthing->type-1) != consoleplayer)
return;
if (doPassword != 0)
{
Decode_Password(Passwordbuff, &levelnum, &skill, p);
doPassword = false;
}
}
if ((mthing->type-1) == consoleplayer)
{
ST_InitEveryLevel();
ST_doPaletteStuff();
}
}
/*
=================
=
= P_SpawnMapThing
=
= The fields of the mapthing should already be in host byte order
==================
*/
void P_SpawnMapThing (mapthing_t *mthing)//L8001D11C()
{
int i, bit;
mobj_t *mobj;
fixed_t x,y,z;
//printf("P_SpawnMapThing %d\n",mthing->type);
/* save spots for respawning in network games */
if (mthing->type <= MAXPLAYERS)
{
playerstarts[mthing->type-1] = *mthing;
return;
}
/* count deathmatch start positions */
if (mthing->type == 11)
{
if (deathmatch_p < &deathmatchstarts[10])
D_memcpy (deathmatch_p, mthing, sizeof(*mthing));
deathmatch_p++;
return;
}
/* check for players specially */
#if 0
if (mthing->type > 4)
return; /*DEBUG */
if (mthing->type <= 4)
{
/* save spots for respawning in network games */
if (mthing->type <= MAXPLAYERS)
{
playerstarts[mthing->type-1] = *mthing;
if (netgame != gt_deathmatch)
P_SpawnPlayer (mthing);
}
return;
}
#endif
/* check for apropriate skill level */
if ( (netgame != gt_deathmatch) && (mthing->options & 16) )
return;
if (gameskill == sk_baby)
bit = 1;
else if (gameskill == sk_nightmare)
bit = 4;
else
bit = 1<<(gameskill-1);
if (!(mthing->options & bit) )
return;
/* find which type to spawn */
for (i = 0; i < NUMMOBJTYPES; i++)
{
if (mthing->type == mobjinfo[i].doomednum)
break;
}
if (i==NUMMOBJTYPES)
{
I_Error ("P_SpawnMapThing: Unknown type %i at (%i, %i)",mthing->type , mthing->x, mthing->y);
}
/* don't spawn keycards and players in deathmatch */
if (netgame == gt_deathmatch && mobjinfo[i].flags & (MF_NOTDMATCH|MF_COUNTKILL) )
return;
/* spawn it */
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
if (mobjinfo[i].flags & MF_SPAWNCEILING)
z = ONCEILINGZ;
else
z = ONFLOORZ;
mobj = P_SpawnMobj (x,y,z, i);
if (mobj->tics > 0)
mobj->tics = 1 + (P_Random () % mobj->tics);
if (mobj->flags & MF_COUNTKILL)
totalkills++;
if (mobj->flags & MF_COUNTITEM)
totalitems++;
mobj->angle = ANG45 * (mthing->angle/45);
mobj->spawnx = mthing->x;
mobj->spawny = mthing->y;
mobj->spawntype = mthing->type;
mobj->spawnangle = mthing->angle;
if (mthing->options & MTF_AMBUSH)
mobj->flags |= MF_AMBUSH;
//Set Blend Mask
mobj->flags |= (mthing->options & (MTF_BLENDMASK1 | MTF_BLENDMASK2 | MTF_BLENDMASK3)) << 23;
//Check Nightmare Monster
if ((mobj->flags & (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3)) == (MF_BLENDMASK1 | MF_BLENDMASK3))
{
mobj->health *= 2;
}
}
/*
===============================================================================
GAME SPAWN FUNCTIONS
===============================================================================
*/
/*
================
=
= P_SpawnPuff
=
================
*/
extern fixed_t attackrange;//80077dc4
void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z)//L8001D69C()
{
mobj_t *th;
z += ((P_Random()-P_Random())<<10);
th = P_SpawnMobj (x,y,z, MT_PUFF);
th->momz = FRACUNIT;
th->tics -= P_Random()&1;
if (th->tics < 1)
th->tics = 1;
/* don't make punches spark on the wall */
if (attackrange == MELEERANGE)
P_SetMobjState (th, S_PUFF3);
}
/*
================
=
= P_SpawnBlood
=
================
*/
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage)//L8001D8C8()
{
mobj_t *th;
z += ((P_Random()-P_Random())<<10);
th = P_SpawnMobj (x,y,z, MT_BLOOD);
th->momz = FRACUNIT*2;
th->tics -= P_Random()&1;
if (th->tics<1)
th->tics = 1;
if (damage <= 12 && damage >= 9)
P_SetMobjState (th,S_BLOOD2);
else if (damage < 9)
P_SetMobjState (th,S_BLOOD3);
}
/*
================
=
= P_CheckMissileSpawn
=
= Moves the missile forward a bit and possibly explodes it right there
=
================
*/
//inline
void P_CheckMissileSpawn (mobj_t *th)//L8001DB10()
{
th->x += (th->momx>>1);
th->y += (th->momy>>1); /* move a little forward so an angle can */
/* be computed if it immediately explodes */
th->z += (th->momz>>1);
if (!P_TryMove (th, th->x, th->y))
P_ExplodeMissile (th);
}
/*
================
=
= P_SpawnMissile
=
================
*/
mobj_t *P_SpawnMissile (mobj_t *source, mobj_t *dest, mobjtype_t type)//L8001DC2C()
{
mobj_t *th;
angle_t an;
int dist;
int speed;
th = P_SpawnMobj (source->x,source->y, source->z + 4*8*FRACUNIT, type);
if (th->info->seesound)
S_StartSound (source, th->info->seesound);
th->target = source; /* where it came from */
an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y);
if (dest->flags & (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3))
an = an + (P_Random() - P_Random() << 20);
th->angle = an;
an >>= ANGLETOFINESHIFT;
speed = th->info->speed >> 16;
th->momx = speed * finecosine[an];
th->momy = speed * finesine[an];
dist = P_AproxDistance (dest->x - source->x, dest->y - source->y);
dist = dist / th->info->speed;
if (dist < 1)
dist = 1;
th->momz = (dest->z - source->z) / dist;
P_CheckMissileSpawn (th);
return th;
}
/*
================
=
= P_SpawnPlayerMissile
=
= Tries to aim at a nearby monster
================
*/
void P_SpawnPlayerMissile (mobj_t *source, mobjtype_t type)//L8001E08C()
{
mobj_t *th;
angle_t an;
fixed_t x,y,z, slope;
int speed;
/* */
/* see which target is to be aimed at */
/* */
an = source->angle;
slope = P_AimLineAttack (source, an, 16*64*FRACUNIT);
if (!linetarget)
{
an += 1<<26;
slope = P_AimLineAttack (source, an, 16*64*FRACUNIT);
if (!linetarget)
{
an -= 2<<26;
slope = P_AimLineAttack (source, an, 16*64*FRACUNIT);
}
if (!linetarget)
{
an = source->angle;
slope = 0;
}
}
x = source->x;
y = source->y;
z = source->z + 4*8*FRACUNIT;
th = P_SpawnMobj (x,y,z, type);
if (th->info->seesound)
S_StartSound (source, th->info->seesound);
th->target = source;
th->angle = an;
speed = th->info->speed >> 16;
th->momx = speed * finecosine[an>>ANGLETOFINESHIFT];
th->momy = speed * finesine[an>>ANGLETOFINESHIFT];
th->momz = speed * slope;
P_CheckMissileSpawn (th);
}
================================================
FILE: PSXDOOM/p_move.c
================================================
#include "doomdef.h"
#include "p_local.h"
/*================== */
/* */
/* out */
/* */
/*================== */
extern mobj_t *tmthing; //80077EB8
extern fixed_t tmx, tmy; //80077F78 , 80077F7C
extern boolean checkposonly; //80077F10
/*================== */
/* */
/* in */
/* */
/*================== */
boolean trymove2; //80077F64|iGp00000b54 /* Result from P_TryMove2 */
boolean floatok; //80077EA8|uGp00000a98 /* if true, move would be ok if within tmfloorz - tmceilingz */
fixed_t tmfloorz; //80078010|fGp00000c00 /* Current floor z for P_TryMove2 */
fixed_t tmceilingz; //80077D30|fGp00000920 /* Current ceiling z for P_TryMove2 */
mobj_t *movething; //800780E8|uGp00000cd8 /* Either a skull/missile target or a special pickup */
line_t *blockline; //8007806C|uGp00000c5c /* Might be a door that can be opened */
fixed_t oldx, oldy; //80078064, 80078068 ||fGp00000c54,fGp00000c58
fixed_t tmbbox[4]; //800979f0
int tmflags; //80077EA4|uGp00000a94
fixed_t tmdropoffz; //80077D68|fGp00000958 /* Lowest point contacted */
subsector_t *newsubsec; //800780E0|psGp00000cd0 /* Dest subsector */
//PSX NEW
line_t *thingspec[8]; //800A8d0C
int numthingspec; //80077EE8|iGp00000ad8
/*
===================
=
= P_TryMove2
=
= Attempt to move to a new position, crossing special lines unless MF_TELEPORT
= is set
=
===================
*/
void P_TryMove2(void)//L8001E48C()
{
int side;
int oldside;
line_t *line;
trymove2 = false; // until proven otherwise
floatok = false;
oldx = tmthing->x;
oldy = tmthing->y;
PM_CheckPosition();
if (checkposonly)
{
checkposonly = false;
return;
}
if (!trymove2)
return;
if (!(tmthing->flags & MF_NOCLIP))
{
trymove2 = false;
if (tmceilingz - tmfloorz < tmthing->height)
return; // doesn't fit
floatok = true;
if ( !(tmthing->flags&MF_TELEPORT) &&tmceilingz - tmthing->z < tmthing->height)
return; // mobj must lower itself to fit
if ( !(tmthing->flags&MF_TELEPORT) && tmfloorz - tmthing->z > 24*FRACUNIT )
return; // too big a step up
if ( !(tmthing->flags&(MF_DROPOFF|MF_FLOAT)) && tmfloorz - tmdropoffz > 24*FRACUNIT )
return; // don't stand over a dropoff
}
//
// the move is ok, so link the thing into its new position
//
PM_UnsetThingPosition(tmthing);
tmthing->floorz = tmfloorz;
tmthing->ceilingz = tmceilingz;
tmthing->x = tmx;
tmthing->y = tmy;
PM_SetThingPosition(tmthing);
if (!tmthing->player && !(tmthing->flags & (MF_NOCLIP | MF_TELEPORT)))
{
while (numthingspec > 0)
{
numthingspec--;
line = thingspec[numthingspec];
side = P_PointOnLineSide(tmthing->x, tmthing->y, line);
oldside = P_PointOnLineSide(oldx, oldy, line);
if (side != oldside)
P_CrossSpecialLine(line, tmthing);
}
}
trymove2 = true;
return;
}
#if 0
static boolean PM_CrossCheck(line_t *ld)
{
if (PM_BoxCrossLine (ld)) {
if (!PIT_CheckLine(ld)) {
return true;
}
}
return false;
}
#endif
/*
==================
=
= PM_PointOnLineSide
= Exclusive Psx Doom
=
= Returns 0 or 1
=
==================
*/
//inline
int PM_PointOnLineSide(fixed_t x, fixed_t y, line_t *line)//L8001E6B8()
{
fixed_t dx, dy;
fixed_t left, right;
dx = (x - line->v1->x);
dy = (y - line->v1->y);
left = (line->dy >> 16) * (dx >> 16);
right = (dy >> 16) *(line->dx >> 16);
if (right < left)
return 0; /* front side */
return 1; /* back side */
}
/*
=================
=
= PM_UnsetThingPosition
= Exclusive Psx Doom
=
= Unlinks a thing from block map and sectors
=
=================
*/
void PM_UnsetThingPosition(mobj_t *thing)//L8001E704()
{
int blockx, blocky;
/* inert things don't need to be in blockmap */
/* unlink from subsector */
if (thing->snext)
thing->snext->sprev = thing->sprev;
if (thing->sprev)
thing->sprev->snext = thing->snext;
else
thing->subsector->sector->thinglist = thing->snext;
if (!(thing->flags & MF_NOBLOCKMAP))
{
/* inert things don't need to be in blockmap */
/* unlink from block map */
if (thing->bnext)
thing->bnext->bprev = thing->bprev;
if (thing->bprev)
thing->bprev->bnext = thing->bnext;
else
{
blockx = (thing->x - bmaporgx) >> MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy) >> MAPBLOCKSHIFT;
// Prevent buffer overflow if the map object is out of bounds.
// This is part of the fix for the famous 'linedef deletion' bug.
// From StationDoom by BodbDearg
#if FIX_LINEDEFS_DELETION
if (blockx>=0 && blockx < bmapwidth
&& blocky>=0 && blocky bnext;
}
#else
blocklinks[blocky*bmapwidth+blockx] = thing->bnext;
#endif
}
}
}
/*
=================
=
= PM_SetThingPosition
= Exclusive Psx Doom
=
= Links a thing into both a block and a subsector based on it's x y
= Sets thing->subsector properly
=
=================
*/
void PM_SetThingPosition(mobj_t *thing)//L8001E800()
{
sector_t *sec;
int blockx, blocky;
mobj_t **link;
/* */
/* link into subsector */
/* */
thing->subsector = newsubsec;
if (!(thing->flags & MF_NOSECTOR))
{
/* invisible things don't go into the sector links */
sec = newsubsec->sector;
thing->sprev = NULL;
thing->snext = sec->thinglist;
if (sec->thinglist)
sec->thinglist->sprev = thing;
sec->thinglist = thing;
}
/* */
/* link into blockmap */
/* */
if (!(thing->flags & MF_NOBLOCKMAP))
{
/* inert things don't need to be in blockmap */
blockx = (thing->x - bmaporgx) >> MAPBLOCKSHIFT;
blocky = (thing->y - bmaporgy) >> MAPBLOCKSHIFT;
if (blockx >= 0 && blockx < bmapwidth && blocky >= 0 && blocky < bmapheight)
{
link = &blocklinks[blocky*bmapwidth + blockx];
thing->bprev = NULL;
thing->bnext = *link;
if (*link)
(*link)->bprev = thing;
*link = thing;
}
else
{
/* thing is off the map */
thing->bnext = thing->bprev = NULL;
}
}
}
/*
==================
=
= PM_CheckPosition
=
= This is purely informative, nothing is modified (except things picked up)
in:
tmthing a mobj_t (can be valid or invalid)
tmx,tmy a position to be checked (doesn't need relate to the mobj_t->x,y)
out:
newsubsec
floorz
ceilingz
tmdropoffz the lowest point contacted (monsters won't move to a dropoff)
movething
==================
*/
void PM_CheckPosition (void) //L8001E910()
{
int xl,xh,yl,yh,bx,by;
tmflags = tmthing->flags;
tmbbox[BOXTOP] = tmy + tmthing->radius;
tmbbox[BOXBOTTOM] = tmy - tmthing->radius;
tmbbox[BOXRIGHT] = tmx + tmthing->radius;
tmbbox[BOXLEFT] = tmx - tmthing->radius;
newsubsec = R_PointInSubsector(tmx,tmy);
//
// the base floor / ceiling is from the subsector that contains the
// point. Any contacted lines the step closer together will adjust them
//
tmfloorz = tmdropoffz = newsubsec->sector->floorheight;
tmceilingz = newsubsec->sector->ceilingheight;
++validcount;
numthingspec = 0;//PSX
movething = 0;
blockline = 0;
if ( tmflags & MF_NOCLIP )
{
trymove2 = true;
return;
}
//
// check things first, possibly picking things up
// the bounding box is extended by MAXRADIUS because mobj_ts are grouped
// into mapblocks based on their origin point, and can overlap into adjacent
// blocks by up to MAXRADIUS units
//
xl = (tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT;
xh = (tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT;
yl = (tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT;
yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT;
if (xl<0)
xl = 0;
if (yl<0)
yl = 0;
if (xh>= bmapwidth)
xh = bmapwidth -1;
if (yh>= bmapheight)
yh = bmapheight -1;
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
if (!PM_BlockThingsIterator(bx, by))
{
trymove2 = false;
return;
}
}
}
//
// check lines
//
xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT;
xh = (tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT;
yl = (tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT;
yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT;
if (xl<0)
xl = 0;
if (yl<0)
yl = 0;
if (xh>= bmapwidth)
xh = bmapwidth -1;
if (yh>= bmapheight)
yh = bmapheight -1;
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
if (!PM_BlockLinesIterator(bx, by))
{
trymove2 = false;
return;
}
}
}
trymove2 = true;
return;
}
//=============================================================================
/*
=================
=
= PM_BoxCrossLine
=
=================
*/
//inlne
boolean PM_BoxCrossLine (line_t *ld)//L8001EC00()
{
fixed_t x1, y1, x2, y2;
fixed_t lx, ly;
fixed_t ldx, ldy;
fixed_t dx1,dy1;
fixed_t dx2,dy2;
boolean side1, side2;
if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT]
|| tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
|| tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM]
|| tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP] )
return false;
y1 = tmbbox[BOXTOP];
y2 = tmbbox[BOXBOTTOM];
if (ld->slopetype == ST_POSITIVE)
{
x1 = tmbbox[BOXLEFT];
x2 = tmbbox[BOXRIGHT];
} else
{
x1 = tmbbox[BOXRIGHT];
x2 = tmbbox[BOXLEFT];
}
lx = ld->v1->x;
ly = ld->v1->y;
ldx = ld->dx >> FRACBITS; //(ld->v2->x - lx) >> FRACBITS;
ldy = ld->dy >> FRACBITS; //(ld->v2->y - ly) >> FRACBITS;
dx1 = (x1 - lx) >> FRACBITS;
dy1 = (y1 - ly) >> FRACBITS;
dx2 = (x2 - lx) >> FRACBITS;
dy2 = (y2 - ly) >> FRACBITS;
side1 = ldy*dx1 < dy1*ldx;
side2 = ldy*dx2 < dy2*ldx;
return (side1 != side2);
}
//=============================================================================
/*
==================
=
= PIT_CheckLine
=
= Adjusts tmfloorz and tmceilingz as lines are contacted
==================
*/
boolean PIT_CheckLine (line_t *ld)//L8001ED0C()
{
fixed_t pm_opentop, pm_openbottom;
fixed_t pm_lowfloor;
sector_t *front, *back;
// a line has been hit
/*
=
= The moving thing's destination position will cross the given line.
= If this should not be allowed, return false.
*/
if (!ld->backsector)
return false; // one sided line
if (!(tmthing->flags & MF_MISSILE) )
{
if ( ld->flags & ML_BLOCKING )
return false; // explicitly blocking everything
if ( !tmthing->player && ld->flags & ML_BLOCKMONSTERS )
return false; // block monsters only
}
front = ld->frontsector;
back = ld->backsector;
if (front->ceilingheight == front->floorheight
|| back->ceilingheight == back->floorheight)
{
blockline = ld;
return false; // probably a closed door
}
if (front->ceilingheight < back->ceilingheight)
pm_opentop = front->ceilingheight;
else
pm_opentop = back->ceilingheight;
if (front->floorheight > back->floorheight)
{
pm_openbottom = front->floorheight;
pm_lowfloor = back->floorheight;
}
else
{
pm_openbottom = back->floorheight;
pm_lowfloor = front->floorheight;
}
// adjust floor / ceiling heights
if (pm_opentop < tmceilingz)
tmceilingz = pm_opentop;
if (pm_openbottom > tmfloorz)
tmfloorz = pm_openbottom;
if (pm_lowfloor < tmdropoffz)
tmdropoffz = pm_lowfloor;
if (ld->special != 0)
{
//New Psx Doom
if (numthingspec < MAXTHINGSPEC)
{
thingspec[numthingspec] = ld;
numthingspec++;
}
}
return true;
}
/*
==================
=
= PIT_CheckThing
=
==================
*/
boolean PIT_CheckThing(mobj_t *thing)//L8001EE5C()
{
fixed_t blockdist;
int delta;
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_SHOOTABLE) ))
return true;
blockdist = thing->radius + tmthing->radius;
delta = thing->x - tmx;
if (delta < 0)
delta = -delta;
if (delta >= blockdist)
return true; // didn't hit it
delta = thing->y - tmy;
if (delta < 0)
delta = -delta;
if (delta >= blockdist)
return true; // didn't hit it
if (thing == tmthing)
return true; // don't clip against self
//
// check for skulls slamming into things
//
if (tmthing->flags & MF_SKULLFLY)
{
movething = thing;
return false; // stop moving
}
//
// missiles can hit other things
//
if (tmthing->flags & MF_MISSILE)
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z+tmthing->height < thing->z)
return true; // underneath
if (tmthing->target->type == thing->type) // don't hit same species as originator
{
if (thing == tmthing->target)
return true;
if (thing->type != MT_PLAYER/*&mobjinfo[MT_PLAYER]*/) // let players missile other players
return false; // explode, but do no damage
}
if (! (thing->flags & MF_SHOOTABLE) )
return !(thing->flags & MF_SOLID); // didn't do any damage
// damage / explode
movething = thing;
return false; // don't traverse any more
}
//
// check for special pickup
//
if ((thing->flags&MF_SPECIAL) && (tmflags&MF_PICKUP) )
{
movething = thing;
return true;
}
return !(thing->flags & MF_SOLID);
}
/*
===============================================================================
BLOCK MAP ITERATORS
For each line/thing in the given mapblock, call the passed function.
If the function returns false, exit with false without checking anything else.
===============================================================================
*/
/*
==================
=
= PM_BlockLinesIterator
= Exclusive Psx Doom
=
= The validcount flags are used to avoid checking lines
= that are marked in multiple mapblocks, so increment validcount before
= the first call to PM_BlockLinesIterator, then make one or more calls to it
=
==================
*/
boolean PM_BlockLinesIterator(int x, int y)//L8001EFC0()
{
int offset;
short *list;
line_t *ld;
offset = (y*bmapwidth)+x;
offset = *(blockmap + offset);
for (list = blockmaplump + offset; *list != -1; list++)
{
ld = &lines[*list];
if (ld->validcount == validcount)
continue; /* line has already been checked */
ld->validcount = validcount;
if (PM_BoxCrossLine(ld))
{
if (!PIT_CheckLine(ld))
return false;
}
}
return true; /* everything was checked */
}
/*
==================
=
= PM_BlockThingsIterator
= Exclusive Psx Doom
=
==================
*/
boolean PM_BlockThingsIterator(int x, int y)//L8001F1A0()
{
mobj_t *mobj;
for (mobj = blocklinks[y * bmapwidth + x]; mobj; mobj = mobj->bnext)
{
if (!PIT_CheckThing(mobj))
return false;
}
return true;
}
================================================
FILE: PSXDOOM/p_plats.c
================================================
/*================================================================== */
/*================================================================== */
/* */
/* PLATFORM RAISING */
/* */
/*================================================================== */
/*================================================================== */
#include "doomdef.h"
#include "p_local.h"
plat_t *activeplats[MAXPLATS];//80097a24
/*================================================================== */
/* */
/* Move a plat up and down */
/* */
/*================================================================== */
void T_PlatRaise(plat_t *plat)//L8001F218()
{
result_e res;
switch(plat->status)
{
case up:
res = T_MovePlane(plat->sector,plat->speed, plat->high,plat->crush,0,1);
if (plat->type == raiseAndChange || plat->type == raiseToNearestAndChange)
{
if (!(gametic&7))
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_stnmov);
}
if (res == crushed && (!plat->crush))
{
plat->count = plat->wait;
plat->status = down;
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstart);
}
else
{
if (res == pastdest)
{
plat->count = plat->wait;
plat->status = waiting;
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstop);
switch(plat->type)
{
case downWaitUpStay:
P_RemoveActivePlat(plat);
break;
case raiseAndChange:
P_RemoveActivePlat(plat);
break;
case blazeDWUS:
P_RemoveActivePlat(plat);
break;
default:
break;
}
}
}
break;
case down:
res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1);
if (res == pastdest)
{
plat->count = plat->wait;
plat->status = waiting;
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstop);
}
break;
case waiting:
if (!--plat->count)
{
if (plat->sector->floorheight == plat->low)
plat->status = up;
else
plat->status = down;
S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstart);
}
case in_stasis:
break;
}
}
/*================================================================== */
/* */
/* Do Platforms */
/* "amount" is only used for SOME platforms. */
/* */
/*================================================================== */
int EV_DoPlat(line_t *line,plattype_e type,int amount)//L8001F3FC()
{
plat_t *plat;
int secnum;
int rtn;
sector_t *sec;
secnum = -1;
rtn = 0;
/* */
/* Activate all plats that are in_stasis */
/* */
switch(type)
{
case perpetualRaise:
P_ActivateInStasis(line->tag);
break;
default:
break;
}
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
sec = §ors[secnum];
if (sec->specialdata)
continue;
/* */
/* Find lowest & highest floors around sector */
/* */
rtn = 1;
plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC, 0);
P_AddThinker(&plat->thinker);
plat->type = type;
plat->sector = sec;
plat->sector->specialdata = plat;
plat->thinker.function = T_PlatRaise;
plat->crush = false;
plat->tag = line->tag;
switch(type)
{
case raiseToNearestAndChange:
plat->speed = PLATSPEED/2;
sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
plat->wait = 0;
plat->status = up;
sec->special = 0; /* NO MORE DAMAGE, IF APPLICABLE */
S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov);
break;
case raiseAndChange:
plat->speed = PLATSPEED/2;
sec->floorpic = sides[line->sidenum[0]].sector->floorpic;
plat->high = sec->floorheight + amount*FRACUNIT;
plat->wait = 0;
plat->status = up;
S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov);
break;
case downWaitUpStay:
plat->speed = PLATSPEED * 4;
plat->low = P_FindLowestFloorSurrounding(sec);
if (plat->low > sec->floorheight)
plat->low = sec->floorheight;
plat->high = sec->floorheight;
plat->wait = 15*PLATWAIT;
plat->status = down;
S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart);
break;
case blazeDWUS:
plat->speed = PLATSPEED * 8;
plat->low = P_FindLowestFloorSurrounding(sec);
if (plat->low > sec->floorheight)
plat->low = sec->floorheight;
plat->high = sec->floorheight;
plat->wait = 15 * PLATWAIT;
plat->status = down;
S_StartSound((mobj_t *)&sec->soundorg, sfx_pstart);
break;
case perpetualRaise:
plat->speed = PLATSPEED;
plat->low = P_FindLowestFloorSurrounding(sec);
if (plat->low > sec->floorheight)
plat->low = sec->floorheight;
plat->high = P_FindHighestFloorSurrounding(sec);
if (plat->high < sec->floorheight)
plat->high = sec->floorheight;
plat->wait = 15*PLATWAIT;
plat->status = P_Random()&1;
S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart);
break;
}
P_AddActivePlat(plat);
}
return rtn;
}
void P_ActivateInStasis(int tag)//L8001F6F8()
{
int i;
for (i = 0;i < MAXPLATS;i++)
if (activeplats[i] &&
(activeplats[i])->tag == tag &&
(activeplats[i])->status == in_stasis)
{
(activeplats[i])->status = (activeplats[i])->oldstatus;
(activeplats[i])->thinker.function = T_PlatRaise;
}
}
void EV_StopPlat(line_t *line)//L8001F76C()
{
int j;
for (j = 0; j < MAXPLATS; j++)
{
if (activeplats[j] && ((activeplats[j])->status != in_stasis) &&
((activeplats[j])->tag == line->tag))
{
(activeplats[j])->oldstatus = (activeplats[j])->status;
(activeplats[j])->status = in_stasis;
(activeplats[j])->thinker.function = NULL;
}
}
}
void P_AddActivePlat(plat_t *plat)//L8001F7E0()
{
int i;
for (i = 0;i < MAXPLATS;i++)
{
if (activeplats[i] == NULL)
{
activeplats[i] = plat;
return;
}
}
I_Error ("P_AddActivePlat: no more plats!");
}
void P_RemoveActivePlat(plat_t *plat)//L8001F838()
{
int i;
for (i = 0;i < MAXPLATS;i++)
{
if (plat == activeplats[i])
{
(activeplats[i])->sector->specialdata = NULL;
P_RemoveThinker(&(activeplats[i])->thinker);
activeplats[i] = NULL;
return;
}
}
I_Error ("P_RemoveActivePlat: can't find plat!");
}
================================================
FILE: PSXDOOM/p_pspr.c
================================================
/* P_pspr.c */
#include "doomdef.h"
#include "p_local.h"
#define LOWERSPEED FRACUNIT*12
#define RAISESPEED FRACUNIT*12
#define WEAPONX FRACUNIT
#define WEAPONBOTTOM (96)*FRACUNIT //old 128
#define WEAPONTOP (0)*FRACUNIT //old 32
#define BFGCELLS 40 /* plasma cells for a bfg attack */
/*
=================
=
= P_NoiseAlert
=
= If a monster yells at a player, it will alert other monsters to the player
=
=================
*/
mobj_t *soundtarget;//pmGp00000a18
//inline
void P_RecursiveSound (sector_t *sec, int soundblocks)//L8001F8B0()
{
int i;
line_t *check;
sector_t *other;
sector_t *front, *back;
/* wake up all monsters in this sector */
if (sec->validcount == validcount && sec->soundtraversed <= soundblocks+1)
return; /* already flooded */
sec->validcount = validcount;
sec->soundtraversed = soundblocks+1;
sec->soundtarget = soundtarget;
for (i=0 ;ilinecount ; i++)
{
check = sec->lines[i];
back = check->backsector;
if (!back)
continue; /* single sided */
front = check->frontsector;
if (front->floorheight >= back->ceilingheight || front->ceilingheight <= back->floorheight)
continue; /* closed door */
if ( front == sec)
other = back;
else
other = front;
if (check->flags & ML_SOUNDBLOCK)
{
if (!soundblocks)
P_RecursiveSound (other, 1);
}
else
P_RecursiveSound (other, soundblocks);
}
}
/*
=================
=
= P_NoiseAlert
=
=================
*/
//inline
void P_NoiseAlert (player_t *player)//L8001F9CC()
{
sector_t *sec;
sec = player->mo->subsector->sector;
if (player->lastsoundsector == (void *)sec)
return; /* don't bother doing it again here */
soundtarget = player->mo;
player->lastsoundsector = (void *)sec;
validcount++;
P_RecursiveSound (sec, 0);
}
/*
==================
=
= P_SetPsprite
=
==================
*/
//inline
void P_SetPsprite (player_t *player, int position, statenum_t stnum) //L8001FB08()
{
pspdef_t *psp;
state_t *state;
psp = &player->psprites[position];
do
{
if (!stnum)
{
psp->state = NULL;
break; /* object removed itself */
}
state = &states[stnum];
psp->state = state;
psp->tics = state->tics; /* could be 0 */
/* call action routine */
if (state->action)
{
state->action (player, psp);
if (!psp->state)
break;
}
stnum = psp->state->nextstate;
} while (!psp->tics); /* an initial state of 0 could cycle through */
}
/*
===============================================================================
PSPRITE ACTIONS
===============================================================================
*/
weaponinfo_t weaponinfo[NUMWEAPONS] = //80066f24
{
{ /* fist */
/* ammo */ am_noammo,
/* upstate */ S_PUNCHUP,
/* downstate */ S_PUNCHDOWN,
/* readystate */ S_PUNCH,
/* atkstate */ S_PUNCH1,
/* flashstate */ S_NULL
},
{ /* pistol */
/* ammo */ am_clip,
/* upstate */ S_PISTOLUP,
/* downstate */ S_PISTOLDOWN,
/* readystate */ S_PISTOL,
/* atkstate */ S_PISTOL2,
/* flashstate */ S_PISTOLFLASH
},
{ /* shotgun */
/* ammo */ am_shell,
/* upstate */ S_SGUNUP,
/* downstate */ S_SGUNDOWN,
/* readystate */ S_SGUN,
/* atkstate */ S_SGUN2,
/* flashstate */ S_SGUNFLASH1
},
{ /* super shotgun */
/* ammo */ am_shell,
/* upstate */ S_DSGUNUP,
/* downstate */ S_DSGUNDOWN,
/* readystate */ S_DSGUN,
/* atkstate */ S_DSGUN1,
/* flashstate */ S_DSGUNFLASH1
},
{ /* chaingun */
/* ammo */ am_clip,
/* upstate */ S_CHAINUP,
/* downstate */ S_CHAINDOWN,
/* readystate */ S_CHAIN,
/* atkstate */ S_CHAIN1,
/* flashstate */ S_CHAINFLASH1
},
{ /* missile */
/* ammo */ am_misl,
/* upstate */ S_MISSILEUP,
/* downstate */ S_MISSILEDOWN,
/* readystate */ S_MISSILE,
/* atkstate */ S_MISSILE1,
/* flashstate */ S_MISSILEFLASH1
},
{ /* plasma */
/* ammo */ am_cell,
/* upstate */ S_PLASMAUP,
/* downstate */ S_PLASMADOWN,
/* readystate */ S_PLASMA,
/* atkstate */ S_PLASMA1,
/* flashstate */ S_PLASMAFLASH1
},
{ /* bfg */
/* ammo */ am_cell,
/* upstate */ S_BFGUP,
/* downstate */ S_BFGDOWN,
/* readystate */ S_BFG,
/* atkstate */ S_BFG1,
/* flashstate */ S_BFGFLASH1
},
{ /* saw */
/* ammo */ am_noammo,
/* upstate */ S_SAWUP,
/* downstate */ S_SAWDOWN,
/* readystate */ S_SAW,
/* atkstate */ S_SAW1,
/* flashstate */ S_NULL
}
};
/*
================
=
= P_BringUpWeapon
=
= Starts bringing the pending weapon up from the bottom of the screen
= Uses player
================
*/
//inline
void P_BringUpWeapon (player_t *player)//L8001FBB0()
{
statenum_t new;
if (player->pendingweapon == wp_nochange)
player->pendingweapon = player->readyweapon;
if (player->pendingweapon == wp_chainsaw)
{
if(disableload)// Psx Doom
S_StartSound(player->mo, sfx_sawup);
}
new = weaponinfo[player->pendingweapon].upstate;
player->pendingweapon = wp_nochange;
player->psprites[ps_weapon].sx = WEAPONX;
player->psprites[ps_weapon].sy = WEAPONBOTTOM;
P_SetPsprite (player, ps_weapon, new);
}
/*
================
=
= P_CheckAmmo
=
= returns true if there is enough ammo to shoot
= if not, selects the next weapon to use
================
*/
boolean P_CheckAmmo (player_t *player)//L8001FCE4()
{
ammotype_t ammo;
int count;
ammo = weaponinfo[player->readyweapon].ammo;
if (player->readyweapon == wp_bfg)
count = BFGCELLS;
else if (player->readyweapon == wp_supershotgun)
count = 2; // Double barrel.
else
count = 1;
if (ammo == am_noammo || player->ammo[ammo] >= count)
return true;
/* out of ammo, pick a weapon to change to */
do
{
if (player->weaponowned[wp_plasma] && player->ammo[am_cell])
player->pendingweapon = wp_plasma;
else if (player->weaponowned[wp_supershotgun] && player->ammo[am_shell] > 2)
player->pendingweapon = wp_supershotgun;
else if (player->weaponowned[wp_chaingun] && player->ammo[am_clip])
player->pendingweapon = wp_chaingun;
else if (player->weaponowned[wp_shotgun] && player->ammo[am_shell])
player->pendingweapon = wp_shotgun;
else if (player->ammo[am_clip])
player->pendingweapon = wp_pistol;
else if (player->weaponowned[wp_chainsaw])
player->pendingweapon = wp_chainsaw;
else if (player->weaponowned[wp_missile] && player->ammo[am_misl])
player->pendingweapon = wp_missile;
else if (player->weaponowned[wp_bfg] && player->ammo[am_cell]>40)
player->pendingweapon = wp_bfg;
else
player->pendingweapon = wp_fist;
} while (player->pendingweapon == wp_nochange);
P_SetPsprite (player, ps_weapon, weaponinfo[player->readyweapon].downstate);
return false;
}
/*
================
=
= P_FireWeapon
=
================
*/
void P_FireWeapon (player_t *player)//L8001FF54()
{
statenum_t new;
if (!P_CheckAmmo (player))
return;
P_SetMobjState (player->mo, S_PLAY_ATK1);
player->psprites[ps_weapon].sx = WEAPONX;
player->psprites[ps_weapon].sy = WEAPONTOP;
new = weaponinfo[player->readyweapon].atkstate;
P_SetPsprite (player, ps_weapon, new);
P_NoiseAlert (player);
}
/*
================
=
= P_DropWeapon
=
= Player died, so put the weapon away
================
*/
void P_DropWeapon (player_t *player)//L8002015C()
{
P_SetPsprite (player, ps_weapon, weaponinfo[player->readyweapon].downstate);
}
/*
=================
=
= A_WeaponReady
=
= The player can fire the weapon or change to another weapon at this time
=
=================
*/
void A_WeaponReady (player_t *player, pspdef_t *psp)//L80020230()
{
statenum_t new;
int angle;
if (player->readyweapon == wp_chainsaw && psp->state == &states[S_SAW])
{
S_StartSound (player->mo, sfx_sawidl);
}
/* */
/* check for change */
/* if player is dead, put the weapon away */
/* */
if (player->pendingweapon != wp_nochange || !player->health)
{
/* change weapon (pending weapon should allready be validated) */
new = weaponinfo[player->readyweapon].downstate;
P_SetPsprite (player, ps_weapon, new);
return;
}
/* */
/* check for fire */
/* */
/* the missile launcher and bfg do not auto fire */
if (ticbuttons[playernum] & BT_DATA[playernum]->BT_ATTACK)
{
P_FireWeapon (player);
return;
}
/* */
/* bob the weapon based on movement speed */
/* */
//angle = (64*gamevbls)&(FINEANGLES-1);
angle = (64*ticon)&(FINEANGLES-1);//PsxDoom use ticon no gamevbls
psp->sx = WEAPONX + (player->bob>>16) * finecosine[angle];
angle &= FINEANGLES/2-1;
psp->sy = WEAPONTOP + (player->bob>>16) * finesine[angle];
}
/*
=================
=
= A_ReFire
=
= The player can re fire the weapon without lowering it entirely
=
=================
*/
//inline
void A_ReFire (player_t *player, pspdef_t *psp)//L80020418()
{
/* */
/* check for fire (if a weaponchange is pending, let it go through instead) */
/* */
if ((ticbuttons[playernum] & BT_DATA[playernum]->BT_ATTACK)
&& player->pendingweapon == wp_nochange && player->health)
{
player->refire++;
P_FireWeapon (player);
}
else
{
player->refire = 0;
P_CheckAmmo (player);
}
}
/*
=================
=
= A_CheckReload
=
=================
*/
void A_CheckReload(player_t *player, pspdef_t *psp)//L800204B4()
{
P_CheckAmmo(player);
}
/*
=================
=
= A_Lower
=
=================
*/
void A_Lower (player_t *player, pspdef_t *psp)//L800204D4()
{
psp->sy += LOWERSPEED;
if (psp->sy < WEAPONBOTTOM )
return;
if (player->playerstate == PST_DEAD)
{
psp->sy = WEAPONBOTTOM;
return; /* don't bring weapon back up */
}
/* */
/* The old weapon has been lowered off the screen, so change the weapon */
/* and start raising it */
/* */
if (!player->health)
{ /* player is dead, so keep the weapon off screen */
P_SetPsprite (player, ps_weapon, S_NULL);
return;
}
player->readyweapon = player->pendingweapon;
P_BringUpWeapon (player);
}
/*
=================
=
= A_Raise
=
=================
*/
void A_Raise (player_t *player, pspdef_t *psp)//L8002064C()
{
statenum_t new;
psp->sy -= RAISESPEED;
if (psp->sy > WEAPONTOP )
return;
psp->sy = WEAPONTOP;
/* */
/* the weapon has been raised all the way, so change to the ready state */
/* */
new = weaponinfo[player->readyweapon].readystate;
P_SetPsprite (player, ps_weapon, new);
}
/*
================
=
= A_GunFlash
=
=================
*/
void A_GunFlash (player_t *player, pspdef_t *psp) //L80020738()
{
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate);
}
/*
===============================================================================
WEAPON ATTACKS
===============================================================================
*/
/*
==================
=
= A_Punch
=
==================
*/
void A_Punch (player_t *player, pspdef_t *psp) //L8002080C()
{
angle_t angle;
int damage;
damage = ((P_Random ()&7)+1)*3;
if (player->powers[pw_strength])
damage *= 10;
angle = player->mo->angle;
angle += (angle_t)(P_Random()-P_Random())<<18;
P_LineAttack (player->mo, angle, MELEERANGE, MAXINT, damage);
/* turn to face target */
if (linetarget)
{
S_StartSound(player->mo, sfx_punch);
player->mo->angle = R_PointToAngle2 (player->mo->x, player->mo->y, linetarget->x, linetarget->y);
}
}
/*
==================
=
= A_Saw
=
==================
*/
void A_Saw (player_t *player, pspdef_t *psp) //L80020904()
{
angle_t angle;
int damage;
damage = ((P_Random ()&7)+1)*3;
angle = player->mo->angle;
angle += (angle_t)(P_Random()-P_Random())<<18;
/* use meleerange + 1 se the puff doesn't skip the flash */
P_LineAttack (player->mo, angle, MELEERANGE+1, MAXINT, damage);
if (!linetarget)
{
S_StartSound (player->mo, sfx_sawful);
return;
}
S_StartSound (player->mo, sfx_sawhit);
/* turn to face target */
angle = R_PointToAngle2 (player->mo->x, player->mo->y, linetarget->x, linetarget->y);
if (angle - player->mo->angle > ANG180)
{
if (angle - player->mo->angle < -ANG90/20)
player->mo->angle = angle + ANG90/21;
else
player->mo->angle -= ANG90/20;
}
else
{
if (angle - player->mo->angle > ANG90/20)
player->mo->angle = angle - ANG90/21;
else
player->mo->angle += ANG90/20;
}
player->mo->flags |= MF_JUSTATTACKED;
}
/*
==================
=
= A_FireMissile
=
==================
*/
void A_FireMissile (player_t *player, pspdef_t *psp) //L80020A7C()
{
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SpawnPlayerMissile (player->mo, MT_ROCKET);
}
/*
==================
=
= A_FireBFG
=
==================
*/
void A_FireBFG (player_t *player, pspdef_t *psp) //L80020AE0()
{
player->ammo[weaponinfo[player->readyweapon].ammo] -= BFGCELLS;
P_SpawnPlayerMissile (player->mo, MT_BFG);
}
/*
==================
=
= A_FirePlasma
=
==================
*/
void A_FirePlasma (player_t *player, pspdef_t *psp) //L80020B44()
{
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate+(P_Random ()&1) );
P_SpawnPlayerMissile (player->mo, MT_PLASMA);
}
/*
===============
=
= P_BulletSlope
=
===============
*/
fixed_t bulletslope; //fGp00000a0c
//inline
void P_BulletSlope(mobj_t* mo)//L80020C6C()
{
angle_t an;
// see which target is to be aimed at
an = mo->angle;
bulletslope = P_AimLineAttack(mo, an, 16 * 64 * FRACUNIT);
if (!linetarget)
{
an += 1 << 26;
bulletslope = P_AimLineAttack(mo, an, 16 * 64 * FRACUNIT);
if (!linetarget)
{
an -= 2 << 26;
bulletslope = P_AimLineAttack(mo, an, 16 * 64 * FRACUNIT);
}
}
}
/*
===============
=
= P_GunShot
=
===============
*/
//inline
void P_GunShot (mobj_t *mo, boolean accurate)//L80020CF8()
{
angle_t angle;
int damage;
damage = ((P_Random ()&3)+1)*4;
angle = mo->angle;
if (!accurate)
angle += (P_Random()-P_Random())<<18;
P_LineAttack (mo, angle, MISSILERANGE, MAXINT, damage);
}
/*
==================
=
= A_FirePistol
=
==================
*/
void A_FirePistol (player_t *player, pspdef_t *psp) //L80020D88()
{
S_StartSound (player->mo, sfx_pistol);
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate);
P_GunShot (player->mo, !player->refire);
}
/*
==================
=
= A_FireShotgun
=
==================
*/
void A_FireShotgun (player_t *player, pspdef_t *psp) //L80020F14()
{
angle_t angle;
int damage;
int i;
int slope;
S_StartSound (player->mo, sfx_shotgn);
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate);
slope = P_AimLineAttack (player->mo, player->mo->angle, MISSILERANGE);
/* shotgun pellets all go at a fixed slope */
for (i=0 ; i<7 ; i++)
{
damage = ((P_Random ()&3)+1)*4;
angle = player->mo->angle;
angle += (P_Random()-P_Random())<<18;
P_LineAttack (player->mo, angle, MISSILERANGE, slope, damage);
}
}
/*
==================
=
= A_FireShotgun2
=
==================
*/
void A_FireShotgun2(player_t *player, pspdef_t *psp)//L800210C4()
{
angle_t angle;
int damage;
int i;
S_StartSound(player->mo, sfx_dshtgn);
P_SetMobjState(player->mo, S_PLAY_ATK2);
player->ammo[weaponinfo[player->readyweapon].ammo] -= 2;
P_SetPsprite(player, ps_flash, weaponinfo[player->readyweapon].flashstate);
P_BulletSlope(player->mo);
for (i = 0; i<20; i++)
{
damage = 5 * (P_Random() % 3 + 1);
angle = player->mo->angle;
angle += (P_Random() - P_Random()) << 19;
P_LineAttack(player->mo, angle, MISSILERANGE, bulletslope + ((P_Random() - P_Random()) << 5), damage);
}
}
/*
==================
=
= A_CockSgun
=
==================
*/
#if 0 //No Used In PSX Doom
void A_CockSgun (player_t *player, pspdef_t *psp)
{
S_StartSound (player->mo, sfx_sgcock);
}
#endif // 0
/*
==================
=
= A_FireCGun
=
==================
*/
void A_FireCGun (player_t *player, pspdef_t *psp) //L8002130C()
{
S_StartSound (player->mo, sfx_pistol);
if (!player->ammo[weaponinfo[player->readyweapon].ammo])
return;
player->ammo[weaponinfo[player->readyweapon].ammo]--;
P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate + psp->state - &states[S_CHAIN1]);
P_GunShot (player->mo, !player->refire);
}
/*============================================================================= */
void A_Light0 (player_t *player, pspdef_t *psp)//L800214F4()
{
player->extralight = 0;
}
void A_Light1 (player_t *player, pspdef_t *psp)//L800214FC()
{
player->extralight = 8;
}
void A_Light2 (player_t *player, pspdef_t *psp)//L80021508()
{
player->extralight = 16;
}
/*
================
=
= A_BFGSpray
=
= Spawn a BFG explosion on every monster in view
=
=================
*/
//inline
void A_BFGSpray (mobj_t *mo) //L80021514()
{
int i, j, damage;
angle_t an;
/* offset angles from its attack angle */
for (i=0 ; i<40 ; i++)
{
an = mo->angle - ANG90/2 + ANG90/40*i;
/* mo->target is the originator (player) of the missile */
P_AimLineAttack (mo->target, an, 16*64*FRACUNIT);
if (!linetarget)
continue;
P_SpawnMobj (linetarget->x, linetarget->y, linetarget->z + (linetarget->height>>2), MT_EXTRABFG);
damage = 0;
for (j=0;j<15;j++)
{
damage += (P_Random()&7) + 1;
}
P_DamageMobj (linetarget, mo->target,mo->target, damage);
}
}
/*
================
=
= A_BFGsound
=
=================
*/
void A_BFGsound (player_t *player, pspdef_t *psp)//L80021604()
{
S_StartSound (player->mo, sfx_bfg);
}
/*
================
=
= A_OpenShotgun2
=
=================
*/
void A_OpenShotgun2(player_t *player, pspdef_t *psp)//L80021628()
{
S_StartSound(player->mo, sfx_dbopn);
}
/*
================
=
= A_LoadShotgun2
=
=================
*/
void A_LoadShotgun2(player_t *player, pspdef_t *psp)//L8002164C()
{
S_StartSound(player->mo, sfx_dbload);
}
/*
================
=
= A_CloseShotgun2
=
=================
*/
void A_CloseShotgun2(player_t *player, pspdef_t *psp)//L80021670()
{
S_StartSound(player->mo, sfx_dbcls);
A_ReFire(player, psp);
}
/*============================================================================= */
int ticremainder[MAXPLAYERS];//0x80077ebc
/*
==================
=
= P_SetupPsprites
=
= Called at start of level for each player
==================
*/
void P_SetupPsprites (int curplayer) //L8002172C() //(player_t *player)
{
int i;
player_t *player;
ticremainder[curplayer] = 0;
player = &players[curplayer];
/* remove all psprites */
for (i=0 ; ipsprites[i].state = NULL;
/* spawn the gun */
player->pendingweapon = player->readyweapon;
P_BringUpWeapon (player);
}
/*
==================
=
= P_MovePsprites
=
= Called every tic by player thinking routine
==================
*/
void P_MovePsprites (player_t *player) //L800218A4()
{
int i;
pspdef_t *psp;
state_t *state;
ticremainder[playernum] += vblsinframe[playernum];
while (ticremainder[playernum] >= 4)
{
ticremainder[playernum] -= 4;
psp = &player->psprites[0];
for (i=0 ; istate) != 0) /* a null state means not active */
{
/* drop tic count and possibly change state */
if (psp->tics != -1) /* a -1 tic count never changes */
{
psp->tics--;
if (!psp->tics)
P_SetPsprite (player, i, psp->state->nextstate);
}
}
}
}
player->psprites[ps_flash].sx = player->psprites[ps_weapon].sx;
player->psprites[ps_flash].sy = player->psprites[ps_weapon].sy;
}
================================================
FILE: PSXDOOM/p_setup.c
================================================
/* P_main.c */
#include "doomdef.h"
#include "p_local.h"
void P_SpawnMapThing (mapthing_t *mthing);
void P_Init(void);
void P_SetupLevel(int map, skill_t skill);
void P_LoadBlocks(char *filename);
void P_CacheSprite(spritedef_t *sprdef);
void P_LoadTextureByWidth(int width);
int numvertexes; //80077E44|uGp00000a34
vertex_t *vertexes; //8007800C|puGp00000bfc
int numsegs; //80077ECC
seg_t *segs; //8007805C
int numsectors; //80077D80
sector_t *sectors; //80077ED0
int numsubsectors; //80078048
subsector_t *subsectors; //80077D6C
int numnodes; //80077FE0
node_t *nodes; //80077CD0
int numlines; //80077FF0
line_t *lines; //80077CDC
int numsides; //80077FDC
side_t *sides; //80077CCC
int numleafs; //80077D90
leaf_t *leafs; //80077F34
short *blockmaplump; //80077EEC /* offsets in blockmap are from here */
short *blockmap;
int bmapwidth, bmapheight; /* in mapblocks */ //800780A8, 80077CE4
fixed_t bmaporgx, bmaporgy; /* origin of block map */ //80077FB4,80077FBC
mobj_t **blocklinks; /* for thing chains */ //80077D08
byte *rejectmatrix; /* for fast sight rejection */
//mapthing_t deathmatchstarts[10], *deathmatch_p;//80097e4c, 80077E8C
//mapthing_t playerstarts[MAXPLAYERS];//800a8c60
/*
=================
=
= P_LoadVertexes
=
=================
*/
//inline
void P_LoadVertexes (int lump)//L80021A64()
{
byte *data;
int i, lumpSize;
mapvertex_t *ml;
vertex_t *li;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadVertexes: lump > 64K");
numvertexes = W_MapLumpLength(lump) / sizeof(mapvertex_t);
vertexes = Z_Malloc (numvertexes*sizeof(vertex_t),PU_LEVEL,0);
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
ml = (mapvertex_t *)data;
li = vertexes;
for (i=0 ; ix = LITTLELONG(ml->x);
li->y = LITTLELONG(ml->y);
li->index = 0;
}
}
/*
=================
=
= P_LoadSegs
=
=================
*/
void P_LoadSegs (int lump)//L80021B38()
{
byte *data;
int i;
mapseg_t *ml;
seg_t *li;
line_t *ldef;
int linedef, side;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadSegs: lump > 64K");
numsegs = W_MapLumpLength(lump) / sizeof(mapseg_t);
segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0);
D_memset (segs, 0, numsegs*sizeof(seg_t));
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
ml = (mapseg_t *)data;
li = segs;
for (i=0 ; iv1 = &vertexes[LITTLESHORT(ml->v1)];
li->v2 = &vertexes[LITTLESHORT(ml->v2)];
li->angle = (LITTLESHORT(ml->angle)) << FRACBITS;
li->offset = (LITTLESHORT(ml->offset)) << FRACBITS;
linedef = LITTLESHORT(ml->linedef);
ldef = &lines[linedef];
li->linedef = ldef;
side = LITTLESHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[side]];
li->frontsector = sides[ldef->sidenum[side]].sector;
if (ldef-> flags & ML_TWOSIDED)
li->backsector = sides[ldef->sidenum[side^1]].sector;
else
li->backsector = 0;
if (ldef->v1 == li->v1)
ldef->fineangle = li->angle >> ANGLETOFINESHIFT;
}
}
/*
=================
=
= P_LoadSubsectors
=
=================
*/
//inline
void P_LoadSubsectors (int lump)//L80021D70()
{
byte *data;
int i;
mapsubsector_t *ms;
subsector_t *ss;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadSubsectors: lump > 64K");
numsubsectors = W_MapLumpLength (lump) / sizeof(mapsubsector_t);
subsectors = Z_Malloc (numsubsectors*sizeof(subsector_t),PU_LEVEL,0);
D_memset (subsectors,0, numsubsectors*sizeof(subsector_t));
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
ms = (mapsubsector_t *)data;
ss = subsectors;
for (i=0 ; inumlines = LITTLESHORT(ms->numsegs);
ss->firstline = LITTLESHORT(ms->firstseg);
ss->numleafs = 0;
ss->leaf = 0;
}
}
/*
=================
=
= P_LoadSectors
=
=================
*/
void P_LoadSectors (int lump)//L80021E5C()
{
byte *data;
int i;
mapsector_t *ms;
sector_t *ss;
int skytexture;
char skyname[16];
skyname[0] = 'S';
skyname[1] = 'K';
skyname[2] = 'Y';
skyname[3] = 0;
skyname[4] = 0;
skyname[5] = 0;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadSectors: lump > 64K");
numsectors = W_MapLumpLength(lump) / sizeof(mapsector_t);
sectors = Z_Malloc (numsectors*sizeof(sector_t),PU_LEVEL,0);
D_memset (sectors, 0, numsectors*sizeof(sector_t));
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
ms = (mapsector_t *)data;
ss = sectors;
for (i=0 ; ifloorheight = LITTLESHORT(ms->floorheight)<ceilingheight = LITTLESHORT(ms->ceilingheight)<colorid = ms->colorid;
ss->lightlevel = ms->lightlevel;
ss->special = LITTLESHORT(ms->special);
ss->thinglist = NULL;
ss->tag = LITTLESHORT(ms->tag);
ss->flags = LITTLELONG(ms->flags);
ss->floorpic = R_FlatNumForName(ms->floorpic);
if (!D_strncasecmp(ms->ceilingpic, "F_SKY", 5))
{
ss->ceilingpic = -1;
skyname[3] = ms->ceilingpic[5];
skyname[4] = ms->ceilingpic[6];
}
else
{
ss->ceilingpic = R_FlatNumForName(ms->ceilingpic);
}
}
skytexturep = NULL;
if (skyname[3] != 0)
{
skytexture = R_TextureNumForName(skyname);
skytexturep = &textures[skytexture];
}
}
/*
=================
=
= P_LoadNodes
=
=================
*/
void P_LoadNodes (int lump)//L8002209C()
{
byte *data;
int i,j,k;
mapnode_t *mn;
node_t *no;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadNodes: lump > 64K");
numnodes = W_MapLumpLength(lump) / sizeof(mapnode_t);
nodes = Z_Malloc (numnodes*sizeof(node_t),PU_LEVEL,0);
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
mn = (mapnode_t *)data;
no = nodes;
for (i=0 ; iline.x = LITTLESHORT(mn->x) << FRACBITS;
no->line.y = LITTLESHORT(mn->y) << FRACBITS;
no->line.dx = LITTLESHORT(mn->dx) << FRACBITS;
no->line.dy = LITTLESHORT(mn->dy) << FRACBITS;
for (j=0 ; j<2 ; j++)
{
no->children[j] = (unsigned short)LITTLESHORT(mn->children[j]);
for (k=0 ; k<4 ; k++)
no->bbox[j][k] = LITTLESHORT(mn->bbox[j][k]) << FRACBITS;
}
}
}
/*
=================
=
= P_LoadThings
=
=================
*/
//inline
void P_LoadThings (int lump)//L80022210()
{
byte *data;
int i;
mapthing_t *mt;
int numthings;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadThings: lump > 64K");
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
numthings = W_MapLumpLength(lump) / sizeof(mapthing_t);
mt = (mapthing_t *)data;
for (i=0 ; ix = LITTLESHORT(mt->x);
mt->y = LITTLESHORT(mt->y);
mt->angle = LITTLESHORT(mt->angle);
mt->type = LITTLESHORT(mt->type);
mt->options = LITTLESHORT(mt->options);
P_SpawnMapThing (mt);
if (mt->type >= 4096)
I_Error("P_LoadThings: doomednum:%d >= 4096", mt->type);
}
}
/*
=================
=
= P_LoadLineDefs
=
= Also counts secret lines for intermissions
=================
*/
void P_LoadLineDefs (int lump)//L80022314()
{
byte *data;
int i;
maplinedef_t *mld;
line_t *ld;
vertex_t *v1, *v2;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadLineDefs: lump > 64K");
numlines = W_MapLumpLength(lump) / sizeof(maplinedef_t);
lines = Z_Malloc (numlines*sizeof(line_t),PU_LEVEL,0);
D_memset (lines, 0, numlines*sizeof(line_t));
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
mld = (maplinedef_t *)data;
ld = lines;
for (i=0 ; iflags = LITTLESHORT(mld->flags);
ld->special = LITTLESHORT(mld->special);
ld->tag = LITTLESHORT(mld->tag);
v1 = ld->v1 = &vertexes[LITTLESHORT(mld->v1)];
v2 = ld->v2 = &vertexes[LITTLESHORT(mld->v2)];
ld->dx = (v2->x - v1->x);
ld->dy = (v2->y - v1->y);
if (!ld->dx)
ld->slopetype = ST_VERTICAL;
else if (!ld->dy)
ld->slopetype = ST_HORIZONTAL;
else
{
if (FixedDiv (ld->dy , ld->dx) > 0)
ld->slopetype = ST_POSITIVE;
else
ld->slopetype = ST_NEGATIVE;
}
if (v1->x < v2->x)
{
ld->bbox[BOXLEFT] = v1->x;
ld->bbox[BOXRIGHT] = v2->x;
}
else
{
ld->bbox[BOXLEFT] = v2->x;
ld->bbox[BOXRIGHT] = v1->x;
}
if (v1->y < v2->y)
{
ld->bbox[BOXBOTTOM] = v1->y;
ld->bbox[BOXTOP] = v2->y;
}
else
{
ld->bbox[BOXBOTTOM] = v2->y;
ld->bbox[BOXTOP] = v1->y;
}
ld->sidenum[0] = LITTLESHORT(mld->sidenum[0]);
ld->sidenum[1] = LITTLESHORT(mld->sidenum[1]);
if (ld->sidenum[0] != -1)
ld->frontsector = sides[ld->sidenum[0]].sector;
else
ld->frontsector = 0;
if (ld->sidenum[1] != -1)
ld->backsector = sides[ld->sidenum[1]].sector;
else
ld->backsector = 0;
}
}
/*
=================
=
= P_LoadSideDefs
=
=================
*/
void P_LoadSideDefs (int lump)//L800225E8()
{
byte *data;
int i;
mapsidedef_t *msd;
side_t *sd;
if (W_MapLumpLength(lump) > 65536)
I_Error("P_LoadSideDefs: lump > 64K");
numsides = W_MapLumpLength(lump) / sizeof(mapsidedef_t);
sides = Z_Malloc (numsides*sizeof(side_t),PU_LEVEL,0);
D_memset (sides, 0, numsides*sizeof(side_t));
data = (byte *)tempbuffer;
W_ReadMapLump(lump, data, true);
msd = (mapsidedef_t *)data;
sd = sides;
for (i=0 ; itextureoffset = LITTLESHORT(msd->textureoffset)<rowoffset = LITTLESHORT(msd->rowoffset)<sector = §ors[LITTLESHORT(msd->sector)];
sd->toptexture = R_TextureNumForName(msd->toptexture);
sd->midtexture = R_TextureNumForName(msd->midtexture);
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
}
}
/*
=================
=
= P_LoadBlockMap
=
=================
*/
void P_LoadBlockMap (int lump)//L80022764()
{
int count;
int i;
int length;
length = W_MapLumpLength(lump);
blockmaplump = Z_Malloc(length, PU_LEVEL, 0);
W_ReadMapLump(lump, blockmaplump, true);
blockmap = blockmaplump+4;//skip blockmap header
count = W_MapLumpLength(lump)/2;
for (i=0 ; i 65536)
I_Error("P_LoadLeafs: lump > 64K");
data = tempbuffer;
W_ReadMapLump(lump, data, true);
size = 0;
count = 0;
mlf = (short *)data;
length = W_MapLumpLength(lump);
while ((int)mlf < (int)(data + length))
{
count += 1;
size += (int)*mlf;
mlf += (int)(*mlf << 1) + 1;
}
if (count != numsubsectors)
I_Error("P_LoadLeafs: leaf/subsector inconsistancy\n");
leafs = Z_Malloc(size * sizeof(leaf_t), PU_LEVEL, 0);//plGp00000b24 = leafs;
lf = leafs;
ss = subsectors;
numleafs = 0;
mlf = (short *)data;
for (i = 0; i < count; i++, ss++)
{
ss->numleafs = LITTLESHORT(*mlf++);
ss->leaf = (short)numleafs;
for (j = 0; j < (int)ss->numleafs; j++, lf++)
{
vertex = LITTLESHORT(*mlf++);
if (vertex >= numvertexes)
I_Error("P_LoadLeafs: vertex out of range\n");
lf->vertex = &vertexes[vertex];
seg = LITTLESHORT(*mlf++);
if (seg != -1)
{
if (seg >= numsegs)
I_Error("P_LoadLeafs: seg out of range\n");
lf->seg = &segs[seg];
}
else
{
lf->seg = NULL;
}
}
numleafs += (int)ss->numleafs;
}
}
/*
=================
=
= P_GroupLines
=
= Builds sector line lists and subsector sector numbers
= Finds block bounding boxes for sectors
=================
*/
void P_GroupLines (void)//L80022AF0()
{
line_t **linebuffer;
int i, j, total;
sector_t *sector;
subsector_t *ss;
seg_t *seg;
int block;
line_t *li;
fixed_t bbox[4];
/* look up sector number for each subsector */
ss = subsectors;
for (i=0 ; ifirstline];
ss->sector = seg->sidedef->sector;
}
/* count number of lines in each sector */
li = lines;
total = 0;
for (i=0 ; ifrontsector->linecount++;
if (li->backsector && li->backsector != li->frontsector)
{
li->backsector->linecount++;
total++;
}
}
/* build line tables for each sector */
linebuffer = Z_Malloc (total*4, PU_LEVEL, 0);
sector = sectors;
for (i=0 ; ilines = linebuffer;
li = lines;
for (j=0 ; jfrontsector == sector || li->backsector == sector)
{
*linebuffer++ = li;
M_AddToBox (bbox, li->v1->x, li->v1->y);
M_AddToBox (bbox, li->v2->x, li->v2->y);
}
}
if (linebuffer - sector->lines != sector->linecount)
I_Error ("P_GroupLines: miscounted");
/* set the degenmobj_t to the middle of the bounding box */
sector->soundorg.x = (bbox[BOXRIGHT]+bbox[BOXLEFT])/2;
sector->soundorg.y = (bbox[BOXTOP]+bbox[BOXBOTTOM])/2;
//sector->soundorg.z = (sector->floorheight + sector->ceilingheight) / 2;
/* link into subsector */
sector->soundorg.subsec = R_PointInSubsector(sector->soundorg.x, sector->soundorg.y);
/* adjust bounding box to map blocks */
block = (bbox[BOXTOP]-bmaporgy+MAXRADIUS)>>MAPBLOCKSHIFT;
block = (block >= bmapheight) ? bmapheight-1 : block;
sector->blockbox[BOXTOP]=block;
block = (bbox[BOXBOTTOM]-bmaporgy-MAXRADIUS)>>MAPBLOCKSHIFT;
block = (block < 0) ? 0 : block;
sector->blockbox[BOXBOTTOM]=block;
block = (bbox[BOXRIGHT]-bmaporgx+MAXRADIUS)>>MAPBLOCKSHIFT;
block = (block >= bmapwidth) ? bmapwidth-1 : block;
sector->blockbox[BOXRIGHT]=block;
block = (bbox[BOXLEFT]-bmaporgx-MAXRADIUS)>>MAPBLOCKSHIFT;
block = (block < 0) ? 0 : block;
sector->blockbox[BOXLEFT]=block;
}
}
/*============================================================================= */
/*
=================
=
= P_Init
=
=================
*/
void P_Init (void)//L80022E00()
{
int i;
sector_t *sector;
side_t *sd;
sector = sectors;
for (i = 0; i < numsectors; i++, sector++)
{
if ((sector->ceilingpic != -1) && (texflats[sector->ceilingpic].vtpage == 0))
{
TextureCache(&texflats[sector->ceilingpic]);
}
if (texflats[sector->floorpic].vtpage == 0)
{
TextureCache(&texflats[sector->floorpic]);
}
}
//V_pages
PageCount = 2;
xcount = 0;
ycount = 0;
xycount = 0;
V_PagFlags|= 2;//sky valloc
spreadfire = NULL;
skypalette = palette[0];
if (skytexturep)
{
if (lumpinfo[skytexturep->lump].name[4] == '9')// initialize fire sky
{
W_CacheLumpNum(skytexturep->lump, PU_ANIMATION, true);
spreadfire = P_FireSky;
skypalette = palette[15];
for (i = 0; i < 64; i++)
P_FireSky(skytexturep);
}
TextureCache(skytexturep);
}
P_LoadTextureByWidth(16);
P_LoadTextureByWidth(64);
P_InitSwitchList();
P_LoadTextureByWidth(128);
sd = sides;
for (i = 0; i < numsides; i++, sd++)
{
if (sd->toptexture == -1)
sd->toptexture = 0;
if (sd->midtexture == -1)
sd->midtexture = 0;
if (sd->bottomtexture == -1)
sd->bottomtexture = 0;
}
//V_pages
PageCount = 5;
xcount = 0;
ycount = 0;
xycount = 0;
V_PagFlags|= 28;//sprites valloc
Z_FreeTags(mainzone, PU_CACHE);
P_InitPicAnims();
}
/*
=================
=
= P_SetupLevel
=
=================
*/
extern boolean restarlevel;
void P_SetupLevel(int map, skill_t skill)//L8002306C()
{
int i, memory;
int map_file, map_index, map_folder;
byte *map_ptr;
int lumpnum;
mobj_t *mobj;
char lumpname[16];
Z_FreeTags(mainzone, PU_CACHE|PU_LEVSPEC|PU_LEVEL);
if (!restarlevel)
{
V_PagFlags &= 1;
Z_FreeTags(mainzone, PU_ANIMATION);
}
Valloc_Init();
Z_CheckHeap(mainzone);
M_ClearRandom();
//printf("P_SetupLevel(%i,%i)\n", map, skill);
totalkills = totalitems = totalsecret = 0;
for (i = 0; i2 = Error
struct psxblock_s *next; //*16
struct psxblock_s *prev; //*20
} psxblock_t;
void P_LoadBlocks(char *filename)//L80023698()
{
#if 1 /*New Version*/
// Try and load the memory blocks containing lumps from the given file.
// Retry this a number of times before giving up, if the initial load attempt fails.
// Presumably this was to try and recover from a bad CD...
psxblock_t header, *base, *block;
int i, file_num, data_size, size;
boolean loaded_ok;
byte *ptr;
i = 0;
while (true)
{
// If there have been too many failed load attempts then issue an error
if (i >= 4)
I_Error("P_LoadBlocks: Data Failure");
i++;
// Open the blocks file and get it's size
file_num = OpenFile(filename);
data_size = SeekFile(file_num, 0, PSXCD_SEEK_END);
ptr = (byte *)Z_Malloc(data_size - sizeof(psxblock_t), PU_STATIC, 0);
base = (psxblock_t *)((byte *)ptr - sizeof(psxblock_t));
header = *base;
// Read the file contents
SeekFile(file_num, 0, PSXCD_SEEK_SET);
ReadFile(file_num, (byte *)base, data_size);
CloseFile(file_num);
// Process all of the memory blocks in the file and make sure they are ok.
// Once they are verified then we can start linking them in with other memory blocks in the heap:
loaded_ok = true;
block = base;
size = data_size;
do
{
if ((((block->id != ZONEID) || // Verify the block has a valid zoneid
(block->lump >= numlumps)) || // Verify the lump number is valid
(block->flags >= Error)) || // Verify the compression mode is valid
(block->flags == Decode && // Verify the decompressed size is valid
(decodedsize((byte *)block + sizeof(psxblock_t)) != lumpinfo[block->lump].size)))
{
loaded_ok = false;
break;
}
// Advance onto the next block and make sure we haven't gone past the end of the data
size -= block->size;
if (size < 0)
{
loaded_ok = false;
break;
}
(byte *)block += block->size;
} while (size != 0);
// If everything was loaded ok then link the first block into the heap block list and finish up.
// Will do the rest of the linking in the loop below:
if (loaded_ok)
{
base->prev = header.prev;
break;
}
// Load failed: restore the old alloc header and free the memory block.
// Will try again a certain number of times to try and counteract unreliable CDs.
base = &header;
Z_Free((byte *)ptr);
}
// Once all the blocks are loaded and verified then setup all of the block links.
// Also mark blocks for lumps that are already loaded as freeable.
do
{
// Check if this lump is already loaded
if (lumpcache[base->lump].cache == NULL)
{
// Lump not loaded, set the lump cache entry to point to the newly loaded data.
// Also save whether the lump is compressed or not:
base->user = (void *)&lumpcache[base->lump];
lumpcache[base->lump].cache = (void *)((byte *)base + sizeof(memblock_t));
lumpencode[base->lump] = base->flags;
}
else
{
// If the lump is already loaded then mark this memory block as freeable
base->user = NULL;
base->tag = 0;
base->id = 0;
}
// Is this the last loade block in the file?
// If it is then set the size based on where the next block in the heap starts, otherwise just use the size defined in the file.
data_size -= base->size;
if (data_size == 0)
{
if (header.next)
base->size = ((int)header.next - (int)base);
base->next = header.next;
}
else
{
base->next = (psxblock_t *)((byte *)base + base->size);
}
// Set backlinks for the next block
if (base->next)
base->next->prev = base;
// Move onto the next block loaded
base = base->next;
} while (data_size != 0);
// After all that is done, make sure the heap is valid
Z_CheckHeap(mainzone);
#else /*Old Version*/
psxblock_t header, *base, *block, *next, *prev;
int i, file_num, data_size, size;
boolean error;
byte *ptr;
i = 0;
while (true)
{
if (i >= 4)
I_Error("P_LoadBlocks: Data Failure");
i++;
error = false;
file_num = OpenFile(filename);
data_size = SeekFile(file_num, 0, PSXCD_SEEK_END);
ptr = (byte *)Z_Malloc(data_size - sizeof(psxblock_t), PU_STATIC, 0);
base = (psxblock_t *)((byte *)ptr - sizeof(psxblock_t));
header.size = base->size;
header.user = base->user;
header.tag = base->tag;
header.id = base->id;
header.lump = base->lump;
header.flags = base->flags;
header.next = base->next;
header.prev = base->prev;
prev = base->prev;
next = base->next;
SeekFile(file_num, 0, PSXCD_SEEK_SET);
ReadFile(file_num, (byte *)base, data_size);
CloseFile(file_num);
block = base;
size = data_size;
do
{
if ((((block->id != ZONEID) || (block->lump >= numlumps)) || (block->flags > NoDecode)) ||
(block->flags == Decode &&
(decodedsize((byte *)block + sizeof(psxblock_t)) != lumpinfo[block->lump].size)))
{
error_:
error = true;
break;
}
size -= block->size;
if (size < 0) goto error_;
(byte *)block = (byte *)block + block->size;
} while (size != 0);
if (!error)
{
base->prev = prev;
do
{
if (lumpcache[base->lump].cache == NULL)
{
base->user = (void *)&lumpcache[base->lump];
lumpcache[base->lump].cache = (void *)((byte *)base + sizeof(memblock_t));
lumpencode[base->lump] = base->flags;
}
else
{
base->user = NULL;
base->tag = 0;
base->id = 0;
}
data_size -= base->size;
if (data_size == 0)
{
if (next)
*(psxblock_t **)&base->size = (psxblock_t *)((int)next - (int)base);
base->next = next;
}
else
{
base->next = (psxblock_t *)((int)&base->size + base->size);
}
if (base->next)
base->next->prev = base;
base = base->next;
} while (data_size != 0);
Z_CheckHeap(mainzone);
return;
}
base->size = header.size;
base->user = header.user;
base->tag = header.tag;
base->id = header.id;
base->lump = header.lump;
base->flags = header.flags;
base->next = header.next;
base->prev = header.prev;
Z_Free((byte *)ptr);
}
#endif
}
/*
=================
=
= P_CacheSprite
= Exclusive Psx Doom
=
=================
*/
void P_CacheSprite(spritedef_t *sprdef)//L80023970()
{
int i, j, lump;
spriteframe_t *sprframe;
sprframe = sprdef->spriteframes;
for (i = 0; i < sprdef->numframes; i++)
{
for (j = 0; j < 8; j++)
{
lump = sprframe->lump[j];
if ((lump < firstsprite) || (lastsprite < lump))
I_Error("CacheSprite: invalid sprite lump %d", lump);
W_CacheLumpNum(lump, PU_ANIMATION, false);
if (sprframe->rotate == false)
break;
}
sprframe++;
}
}
/*
=================
=
= P_LoadTextureByWidth
= Exclusive Psx Doom
=
=================
*/
void P_LoadTextureByWidth(int width)//L80023A60()
{
side_t *sd;
int i, w;
if (width < 0)
width += 15;
xcount = (xcount-1) + (width/16) & -(width/16);
sd = sides;
for (i = 0; i < numsides; i++, sd++)
{
if (sd->toptexture != -1)
{
if ((textures[sd->toptexture].w == width) && (textures[sd->toptexture].vtpage == 0))
TextureCache(&textures[sd->toptexture]);
}
if (sd->midtexture != -1)
{
if ((textures[sd->midtexture].w == width) && (textures[sd->midtexture].vtpage == 0))
TextureCache(&textures[sd->midtexture]);
}
if (sd->bottomtexture != -1)
{
if ((textures[sd->bottomtexture].w == width) && (textures[sd->bottomtexture].vtpage == 0))
TextureCache(&textures[sd->bottomtexture]);
}
}
}
================================================
FILE: PSXDOOM/p_shoot.c
================================================
#include "doomdef.h"
#include "p_local.h"
//===================
//
// IN
//
// A line will be shootdivd from the middle of shooter in the direction of
// attackangle until either a shootable mobj is within the visible
// aimtopslope / aimbottomslope range, or a solid wall blocks further
// tracing. If no thing is targeted along the entire range, the first line
// that blocks the midpoint of the shootdiv will be hit.
//===================
line_t *shootline; //iGp00000ce4
mobj_t *shootmobj; //iGp00000ce8
fixed_t shootslope; // between aimtop and aimbottom //iGp00000968
fixed_t shootx, shooty, shootz; // location for puff/blood //iGp000009e0, iGp000009ec, iGp000009f0
//===================
//
// TEMPS
//
//===================
fixed_t aimmidslope; // for detecting first wall hit iGp000009c8
divline_t shootdiv; //800a8e58
fixed_t shootx2, shooty2; //iGp00000a54,iGp00000a60
fixed_t firstlinefrac; //iGp00000be8
int shootdivpositive; //uGp00000a88
fixed_t old_frac; //uGp00000b44
void *old_value; //pvGp00000c74
boolean old_isline; //bGp000008e4
int ssx1,ssy1,ssx2,ssy2; //iGp00000c08, iGp00000c18, iGp00000c14, iGp00000c24
typedef struct
{
vertex_t v1, v2;
} thingline_t;
static thingline_t thingline;//800A8824*/
static vertex_t *thing_line[2] = {&thingline.v1, &thingline.v2};//iGp00000534, iGp00000538
extern mobj_t *shooter;//*(r28 + 2764)
extern angle_t attackangle;//*(r28 + 2484)
extern fixed_t attackrange;//*(r28 + 2460)
extern fixed_t aimtopslope;//*(r28 + 2580)
extern fixed_t aimbottomslope;//*(r28 + 3340)
/*
=====================
=
= P_Shoot2
=
=====================
*/
void P_Shoot2(void)//L80023BCC()
{
mobj_t *t1;
unsigned angle;
t1 = shooter;
shootline = 0;
shootmobj = 0;
angle = attackangle >> ANGLETOFINESHIFT;
shootdiv.x = t1->x;
shootdiv.y = t1->y;
shootx2 = t1->x + (attackrange>>FRACBITS)*finecosine[angle];
shooty2 = t1->y + (attackrange>>FRACBITS)*finesine[angle];
shootdiv.dx = shootx2 - shootdiv.x;
shootdiv.dy = shooty2 - shootdiv.y;
shootz = t1->z + (t1->height>>1) + 8*FRACUNIT;
shootdivpositive = (shootdiv.dx ^ shootdiv.dy)>0;
ssx1 = shootdiv.x >> 16;
ssy1 = shootdiv.y >> 16;
ssx2 = shootx2 >> 16;
ssy2 = shooty2 >> 16;
aimmidslope = (aimtopslope + aimbottomslope)>>1;
//
// cross everything
//
old_frac = 0;
PA_CrossBSPNode(numnodes-1);
// check the last intercept if needed
if (!shootmobj)
PA_DoIntercept(0, false, FRACUNIT);
//
// post process
//
if (shootmobj)
return;
if (!shootline)
return;
//
// calculate the intercept point for the first line hit
//
// position a bit closer
firstlinefrac -= FixedDiv(4*FRACUNIT,attackrange);
shootx = shootdiv.x + FixedMul(shootdiv.dx, firstlinefrac);
shooty = shootdiv.y + FixedMul(shootdiv.dy, firstlinefrac);
shootz += FixedMul(aimmidslope, FixedMul(firstlinefrac,attackrange));
}
/*
==================
=
= PA_DoIntercept
=
==================
*/
//inline
boolean PA_DoIntercept(void *value, boolean isline, int frac)//L80023DD4()
{
void *value_;
int frac_;
boolean isline_;
isline_ = isline;
value_ = value;
frac_ = frac;
if (old_frac < frac)
{
isline_ = old_isline;
value_ = old_value;
frac_ = old_frac;
old_isline = isline;
old_frac = frac;
old_value = value;
}
if (frac_ == 0 || (0xffff < frac_))//frac >= FRACUNIT)
return true;
if (isline_)
return PA_ShootLine ((line_t *)value_, frac_);
else
return PA_ShootThing ((mobj_t *)value_, frac_);
}
/*
==============================================================================
=
= PA_ShootLine
=
==============================================================================
*/
boolean PA_ShootLine(line_t *li, fixed_t interceptfrac)//L80023E5C()
{
fixed_t slope;
fixed_t dist;
sector_t *front, *back;
static fixed_t opentop,openbottom;//80077ee4, 80077d5c
if ( !(li->flags & ML_TWOSIDED) )
{
if (!shootline)
{
shootline = li;
firstlinefrac = interceptfrac;
}
old_frac = 0; // don't shoot anything past this
return false;
}
//
// crosses a two sided line
//
front = li->frontsector;
back = li->backsector;
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
if (front->floorheight > back->floorheight)
openbottom = front->floorheight;
else
openbottom = back->floorheight;
dist = FixedMul(attackrange,interceptfrac);
if (li->frontsector->floorheight != li->backsector->floorheight)
{
slope = FixedDiv(openbottom - shootz , dist);
if (slope >= aimmidslope && !shootline)
{
shootline = li;
firstlinefrac = interceptfrac;
}
if (slope > aimbottomslope)
aimbottomslope = slope;
}
if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
{
slope = FixedDiv(opentop - shootz , dist);
if (slope <= aimmidslope && !shootline)
{
shootline = li;
firstlinefrac = interceptfrac;
}
if (slope < aimtopslope)
aimtopslope = slope;
}
if (aimtopslope <= aimbottomslope)
return false; // stop
return true; // shot continues
}
/*
==============================================================================
=
= PA_ShootThing
=
==============================================================================
*/
boolean PA_ShootThing(mobj_t *th, fixed_t interceptfrac)//L80024054()
{
fixed_t frac;
fixed_t dist;
fixed_t thingaimtopslope, thingaimbottomslope;
if (th == shooter)
return true; // can't shoot self
if (!(th->flags&MF_SHOOTABLE))
return true; // corpse or something
// check angles to see if the thing can be aimed at
dist = FixedMul(attackrange, interceptfrac);
thingaimtopslope = FixedDiv(th->z+th->height - shootz , dist);
if (thingaimtopslope < aimbottomslope)
return true; // shot over the thing
thingaimbottomslope = FixedDiv(th->z - shootz, dist);
if (thingaimbottomslope > aimtopslope)
return true; // shot under the thing
//
// this thing can be hit!
//
if (thingaimtopslope > aimtopslope)
thingaimtopslope = aimtopslope;
if (thingaimbottomslope < aimbottomslope)
thingaimbottomslope = aimbottomslope;
// shoot midway in the visible part of the thing
shootslope = (thingaimtopslope+thingaimbottomslope)/2;
shootmobj = th;
// position a bit closer
frac = interceptfrac - FixedDiv(10*FRACUNIT,attackrange);
shootx = shootdiv.x + FixedMul(shootdiv.dx, frac);
shooty = shootdiv.y + FixedMul(shootdiv.dy, frac);
shootz = shootz + FixedMul(shootslope, FixedMul(frac,attackrange));
return false; // don't go any farther
}
/*
=================
=
= PA_SightCrossLine
=
= First checks the endpoints of the line to make sure that they cross the
= sight trace treated as an infinite line.
=
= If so, it calculates the fractional distance along the sight trace that
= the intersection occurs at. If 0 < intercept < 1.0, the line will block
= the sight.
=================
*/
//inline
fixed_t PA_SightCrossLine(line_t *line)//L800241F4()
{
int s1, s2;
int p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,dx,dy,ndx,ndy;
// p1, p2 are line endpoints
p1x = line->v1->x >> FRACBITS;
p1y = line->v1->y >> FRACBITS;
p2x = line->v2->x >> FRACBITS;
p2y = line->v2->y >> FRACBITS;
// p3, p4 are sight endpoints
p3x = ssx1;
p3y = ssy1;
p4x = ssx2;
p4y = ssy2;
dx = p2x - p3x;
dy = p2y - p3y;
ndx = p4x - p3x; // this can be precomputed if worthwhile
ndy = p4y - p3y;
s1 = (ndy * dx) < (dy * ndx);
dx = p1x - p3x;
dy = p1y - p3y;
s2 = (ndy * dx) < (dy * ndx);
if (s1 == s2)
return -1; // line isn't crossed
ndx = p1y - p2y; // vector normal to world line
ndy = p2x - p1x;
s1 = ndx*dx + ndy*dy; // distance projected onto normal
dx = p4x - p1x;
dy = p4y - p1y;
s2 = ndx*dx + ndy*dy; // distance projected onto normal
s2 = FixedDiv(s1,(s1+s2));
return s2;
}
/*
=================
=
= PA_CrossSubsectorPass
=
= Returns true if strace crosses the given subsector successfuly
=================
*/
boolean PA_CrossSubsector(subsector_t *sub)//L800242CC
{
seg_t *seg;
line_t *line;
int count;
fixed_t frac;
mobj_t *thing;
//
// check things
//
for (thing = sub->sector->thinglist ; thing ; thing = thing->snext )
{
if (thing->subsector != sub)
continue;
// check a corner to corner crossection for hit
if (shootdivpositive)
{
thingline.v1.x = thing->x - thing->radius;
thingline.v1.y = thing->y + thing->radius;
thingline.v2.x = thing->x + thing->radius;
thingline.v2.y = thing->y - thing->radius;
}
else
{
thingline.v1.x = thing->x - thing->radius;
thingline.v1.y = thing->y - thing->radius;
thingline.v2.x = thing->x + thing->radius;
thingline.v2.y = thing->y + thing->radius;
}
// inline function
frac = PA_SightCrossLine ((line_t *)&thing_line);
if (frac < 0 || frac > FRACUNIT) {
continue;
}
// inline function
if (!PA_DoIntercept (thing, false, frac))
{
return false;
}
}
//
// check lines
//
count = sub->numlines;
seg = &segs[sub->firstline];
for ( ; count ; seg++, count--)
{
line = seg->linedef;
if (line->validcount == validcount)
continue; // already checked other side
line->validcount = validcount;
// inline function
frac = PA_SightCrossLine (line);
if (frac < 0 || frac > FRACUNIT)
continue;
// inline function
if (!PA_DoIntercept (line, true, frac))
{
return false;
}
}
return true; // passed the subsector ok
}
/*
=====================
=
= PA_DivlineSide
=
=====================
*/
//inline
int PA_DivlineSide(fixed_t x, fixed_t y, divline_t *line)//L800246F0()
{
fixed_t dx, dy;
x = (x - line->x) >> FRACBITS;
y = (y - line->y) >> FRACBITS;
dx = x * (line->dy >> FRACBITS);
dy = y * (line->dx >> FRACBITS);
return dy < dx ^ 1;
}
/**********************************
Returns true if strace crosses the given node successfuly
**********************************/
boolean PA_CrossBSPNode(int bspnum)//L80024734()
{
node_t *bsp;
int bsp_num, side;
if (bspnum & NF_SUBSECTOR)
{
bsp_num = (bspnum & ~NF_SUBSECTOR);
if (bsp_num >= numsubsectors)
{
I_Error("PA_CrossSubsector: ss %i with numss = %i", bsp_num, numsubsectors);
}
return PA_CrossSubsector(&subsectors[bsp_num]);
}
bsp = &nodes[bspnum];
//
// decide which side the start point is on
//
side = PA_DivlineSide(shootdiv.x, shootdiv.y, &bsp->line);
// cross the starting side
if (!PA_CrossBSPNode(bsp->children[side]))
return false;
// the partition plane is crossed here
if (side == PA_DivlineSide(shootx2, shooty2, &bsp->line))
return true; // the line doesn't touch the other side
// cross the ending side
return PA_CrossBSPNode(bsp->children[side ^ 1]);
}
================================================
FILE: PSXDOOM/p_sight.c
================================================
#include "doomdef.h"
#include "p_local.h"
//iGp00000a3c
fixed_t sightzstart; //80077E4C // eye z of looker
//iGp00000bf8, iGp00000a24
fixed_t topslope, bottomslope; //80078008 ,80077E34 // slopes to top and bottom of target
divline_t strace; //800979E0 // from t1 to t2
fixed_t t2x, t2y; //80077F28,80077F2C || uGp00000b18, uGp00000b20
//iGp00000c10,iGp00000c20,iGp00000c1c,iGp00000c28
int t1xs,t1ys,t2xs,t2ys; //80078020,80078030,8007802C,80078038
/*
===============
=
= P_CheckSights
=
= Check sights of all mobj thinkers that are going to change state this
= tic and have MF_COUNTKILL set
===============
*/
void P_CheckSights(void)//L800248A0()
{
mobj_t *mobj;
for (mobj = mobjhead.next; mobj != &mobjhead; mobj = mobj->next)
{
// must be killable
if (!(mobj->flags & MF_COUNTKILL))
continue;
// must be about to change states
if (mobj->tics != 1)
continue;
mobj->flags &= ~MF_SEETARGET;
// must have a target
if (!mobj->target)
continue;
if (P_CheckSight(mobj, mobj->target))
mobj->flags |= MF_SEETARGET;
}
}
/**********************************
Returns true if a straight line between t1 and t2 is unobstructed
**********************************/
boolean P_CheckSight(mobj_t *t1, mobj_t *t2)//L8002494C()
{
int s1, s2;
int pnum, bytenum, bitnum;
//
// check for trivial rejection
//
s1 = (t1->subsector->sector - sectors)/* * (int)0xE9BD37A7*/;
s2 = (t2->subsector->sector - sectors)/* * (int)0xE9BD37A7*/;
pnum = s1*numsectors + s2;
bytenum = pnum >> 3;
bitnum = 1 << (pnum & 7);
if (rejectmatrix[bytenum] & bitnum) {
return false; // can't possibly be connected
}
// look from eyes of t1 to any part of t2
++validcount;
// make sure it never lies exactly on a vertex coordinate
strace.x = (t1->x & ~0x1ffff) | 0x10000;
strace.y = (t1->y & ~0x1ffff) | 0x10000;
t2x = (t2->x & ~0x1ffff) | 0x10000;
t2y = (t2->y & ~0x1ffff) | 0x10000;
strace.dx = t2x - strace.x;
strace.dy = t2y - strace.y;
t1xs = strace.x >> FRACBITS;
t1ys = strace.y >> FRACBITS;
t2xs = t2x >> FRACBITS;
t2ys = t2y >> FRACBITS;
sightzstart = (t1->z + t1->height) - (t1->height >> 2);
topslope = (t2->z + t2->height) - sightzstart;
bottomslope = (t2->z) - sightzstart;
return PS_CrossBSPNode(numnodes - 1);
}
/*
=================
=
= PS_SightCrossLine
=
= First checks the endpoints of the line to make sure that they cross the
= sight trace treated as an infinite line.
=
= If so, it calculates the fractional distance along the sight trace that
= the intersection occurs at. If 0 < intercept < 1.0, the line will block
= the sight.
=================
*/
//inline
fixed_t PS_SightCrossLine (line_t *line)//L80024AD4()
{
int s1, s2;
int p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y,dx,dy,ndx,ndy;
// p1, p2 are line endpoints
p1x = line->v1->x >> FRACBITS;
p1y = line->v1->y >> FRACBITS;
p2x = line->v2->x >> FRACBITS;
p2y = line->v2->y >> FRACBITS;
// p3, p4 are sight endpoints
p3x = t1xs;
p3y = t1ys;
p4x = t2xs;
p4y = t2ys;
dx = p2x - p3x;
dy = p2y - p3y;
ndx = p4x - p3x; // this can be precomputed if worthwhile
ndy = p4y - p3y;
s1 = (ndy * dx) < (dy * ndx);
dx = p1x - p3x;
dy = p1y - p3y;
s2 = (ndy * dx) < (dy * ndx);
if (s1 == s2)
return -1; // line isn't crossed
ndx = p1y - p2y; // vector normal to world line
ndy = p2x - p1x;
s1 = ndx*dx + ndy*dy; // distance projected onto normal
dx = p4x - p1x;
dy = p4y - p1y;
s2 = ndx*dx + ndy*dy; // distance projected onto normal
s2 = FixedDiv(s1,(s1+s2));
return s2;
}
/*
=================
=
= PS_CrossSubsector
=
= Returns true if strace crosses the given subsector successfuly
=================
*/
boolean PS_CrossSubsector(subsector_t *sub)//L80024BAC()
{
seg_t *seg;
line_t *line;
int count;
sector_t *front, *back;
fixed_t opentop, openbottom;
fixed_t frac, slope;
//
// check lines
//
count = sub->numlines;
seg = &segs[sub->firstline];
for ( ; count ; seg++, count--)
{
line = seg->linedef;
if (line->validcount == validcount)
continue; // allready checked other side
line->validcount = validcount;
frac = PS_SightCrossLine (line);
if (frac < 4 || frac > FRACUNIT)
continue;
//
// crosses line
//
back = line->backsector;
if (!back)
return false; // one sided line
front = line->frontsector;
if (front->floorheight == back->floorheight
&& front->ceilingheight == back->ceilingheight)
continue; // no wall to block sight with
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
if (front->floorheight > back->floorheight)
openbottom = front->floorheight;
else
openbottom = back->floorheight;
if (openbottom >= opentop) // quick test for totally closed doors
return false; // stop
frac >>= 2;
if (front->floorheight != back->floorheight)
{
slope = (((openbottom - sightzstart)<<6) / frac) << 8;
if (slope > bottomslope)
bottomslope = slope;
}
if (front->ceilingheight != back->ceilingheight)
{
slope = (((opentop - sightzstart)<<6) / frac) << 8;
if (slope < topslope)
topslope = slope;
}
if (topslope <= bottomslope)
return false; // stop
}
return true; // passed the subsector ok
}
/*
=================
=
= PS_CrossBSPNode
=
= Returns true if strace crosses the given node successfuly
=================
*/
boolean PS_CrossBSPNode(int bspnum)//L80024E58()
{
node_t *bsp;
int side;
int bsp_num;
if (bspnum & NF_SUBSECTOR)
{
bsp_num = (bspnum & ~NF_SUBSECTOR);
if (bsp_num >= numsubsectors)
{
I_Error("PS_CrossSubsector: ss %i with numss = %i", bsp_num, numsubsectors);
}
return PS_CrossSubsector(&subsectors[bsp_num]);
}
bsp = &nodes[bspnum];
// decide which side the start point is on
// inline function ??
side = PA_DivlineSide(strace.x, strace.y, &bsp->line);
// cross the starting side
if (!PS_CrossBSPNode(bsp->children[side]))
return false;
// the partition plane is crossed here
// inline function ??
if (side == PA_DivlineSide(t2x, t2y, &bsp->line))
return true; // the line doesn't touch the other side
// cross the ending side
return PS_CrossBSPNode(bsp->children[side ^ 1]);
}
================================================
FILE: PSXDOOM/p_slide.c
================================================
#include "doomdef.h"
#include "p_local.h"
#define CLIPRADIUS 23
#define SIDE_ON 0
#define SIDE_FRONT 1
#define SIDE_BACK -1
fixed_t slidex, slidey; // the final position //80077DBC|fGp000009ac, 80077DC0|fGp000009b0
line_t *specialline; //80077DC8, uGp000009b8
fixed_t slidedx, slidedy; // current move for completablefrac //80077E9C|fGp00000a8c, 80077EA0|fGp00000a90
fixed_t endbox[4]; // final proposed position //800979d0
fixed_t blockfrac; // the fraction of move that gets completed //8007804C|iGp00000c3c
fixed_t blocknvx, blocknvy; // the vector of the line that blocks move //80077FD0|fGp00000bc0, 80077FD8|fGp00000bc8
// p1, p2 are line endpoints
// p3, p4 are move endpoints
/*iGp00000ae4, iGp00000aec*///p1x, p1y
/*iGp00000ae8, iGp00000af8*///p2x, p2y
/*iGp00000af4, iGp00000b0c*///p3x, p3y
/*iGp00000b08, iGp00000b14*///p4x, p4y
int p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y;
fixed_t nvx, nvy; // normalized line vector //fGp00000b70, fGp00000b74
extern mobj_t *slidething;//80077D04
fixed_t P_CompletableFrac(fixed_t dx, fixed_t dy);
int SL_PointOnSide(fixed_t x, fixed_t y);
fixed_t SL_CrossFrac (void);
boolean CheckLineEnds (void);
void SL_ClipToLine( void );
boolean SL_CheckLine(line_t *ld);
int SL_PointOnSide2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, fixed_t x3, fixed_t y3);
void SL_CheckSpecialLines (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2);
/*
===================
=
= P_SlideMove
=
===================
*/
void P_SlideMove(void)//L80024FC4()
{
fixed_t dx, dy, rx, ry;
fixed_t frac, slide;
int i;
dx = slidething->momx;
dy = slidething->momy;
slidex = slidething->x;
slidey = slidething->y;
if (slidething->flags & MF_NOCLIP)//Psx Doom
{
frac = FRACUNIT;
goto Skip_P_CompletableFrac;
}
// perform a maximum of three bumps
for (i = 0; i < 3; i++)
{
frac = P_CompletableFrac(dx, dy);
if (frac != FRACUNIT)
frac -= 0x1000;
if (frac < 0)
frac = 0;
Skip_P_CompletableFrac:
rx = FixedMul(frac, dx);
ry = FixedMul(frac, dy);
slidex += rx;
slidey += ry;
// made it the entire way
if (frac == FRACUNIT)
{
slidething->momx = dx;
slidething->momy = dy;
SL_CheckSpecialLines(slidething->x, slidething->y, slidex, slidey);
return;
}
// project the remaining move along the line that blocked movement
dx -= rx;
dy -= ry;
slide = FixedMul(dx, blocknvx) + FixedMul(dy, blocknvy);
dx = FixedMul(slide, blocknvx);
dy = FixedMul(slide, blocknvy);
}
// some hideous situation has happened that won't let the player slide
slidex = slidething->x;
slidey = slidething->y;
slidething->momx = slidething->momy = 0;
}
/*
===================
=
= P_CompletableFrac
=
= Returns the fraction of the move that is completable
===================
*/
fixed_t P_CompletableFrac(fixed_t dx, fixed_t dy)//L80025154()
{
int xl,xh,yl,yh,bx,by;
int offset;
short *list;
line_t *ld;
blockfrac = FRACUNIT; // the entire dist until shown otherwise
slidedx = dx;
slidedy = dy;
endbox[BOXTOP ] = slidey + CLIPRADIUS*FRACUNIT;
endbox[BOXBOTTOM] = slidey - CLIPRADIUS*FRACUNIT;
endbox[BOXRIGHT ] = slidex + CLIPRADIUS*FRACUNIT;
endbox[BOXLEFT ] = slidex - CLIPRADIUS*FRACUNIT;
if (dx > 0)
endbox[BOXRIGHT ] += dx;
else
endbox[BOXLEFT ] += dx;
if (dy > 0)
endbox[BOXTOP ] += dy;
else
endbox[BOXBOTTOM] += dy;
++validcount;
//
// check lines
//
xl = (endbox[BOXLEFT ] - bmaporgx) >> MAPBLOCKSHIFT;
xh = (endbox[BOXRIGHT ] - bmaporgx) >> MAPBLOCKSHIFT;
yl = (endbox[BOXBOTTOM] - bmaporgy) >> MAPBLOCKSHIFT;
yh = (endbox[BOXTOP ] - bmaporgy) >> MAPBLOCKSHIFT;
if (xl<0)
xl = 0;
if (yl<0)
yl = 0;
if (xh>= bmapwidth)
xh = bmapwidth -1;
if (yh>= bmapheight)
yh = bmapheight -1;
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
/*inline ??*/
//P_BlockLinesIterator(bx, by, SL_CheckLine);
offset = by*bmapwidth+bx;
offset = *(blockmap+offset);
for ( list = blockmaplump+offset ; *list != -1 ; list++)
{
ld = &lines[*list];
if (ld->validcount != validcount)
{
ld->validcount = validcount;
SL_CheckLine(ld);
}
}
}
}
//
// examine results
//
if (blockfrac < 0x1000)
{
blockfrac = 0;
specialline = 0; // can't cross anything on a bad move
return 0; // solid wall or thing
}
return blockfrac;
}
//inline
int SL_PointOnSide(fixed_t x, fixed_t y)//L800253F8()
{
//checked
fixed_t dx, dy, dist;
dx = x - p1x;
dy = y - p1y;
dist = FixedMul(dx,nvx) + FixedMul(dy,nvy);
if(dist > FRACUNIT)
return SIDE_FRONT;
else if(dist < -FRACUNIT)
return SIDE_BACK;
else
return SIDE_ON;
}
//inline
fixed_t SL_CrossFrac (void)//L80025468()
{
//checked
fixed_t dx, dy, dist1, dist2, frac;
// project move start and end points onto line normal
dx = p3x - p1x;
dy = p3y - p1y;
dist1 = FixedMul(dx,nvx) + FixedMul(dy,nvy);
dx = p4x - p1x;
dy = p4y - p1y;
dist2 = FixedMul(dx,nvx) + FixedMul(dy,nvy);
if ((dist1 < 0) == (dist2 < 0))
return FRACUNIT; // doesn't cross
frac = FixedDiv(dist1, dist1 - dist2 );
return frac;
}
boolean CheckLineEnds (void)//L80025520()
{
//checked
fixed_t snx, sny; // sight normals
fixed_t dist1, dist2;
fixed_t dx, dy;
snx = p4y - p3y;
sny = p3x - p4x;
dx = p1x - p3x;
dy = p1y - p3y;
dist1 = FixedMul(dx,snx) + FixedMul(dy,sny);
dx = p2x - p3x;
dy = p2y - p3y;
dist2 = FixedMul(dx,snx) + FixedMul(dy,sny);
return ((dist1 < 0)^(dist2 < 0));
/*
if ( (dist1<0) == (dist2<0) )
return false;
return true;
*/
}
/*
====================
=
= SL_ClipToLine
=
= Call with p1 and p2 set to the endpoints
= and nvx, nvy set to normalized vector
= Assumes the start point is definately on the front side of the line
= returns the fraction of the current move that crosses the line segment
====================
*/
void SL_ClipToLine( void )//L800255E0()
{
fixed_t frac;
int side2, side3;
// adjust start so it will be the first point contacted on the player circle
// p3, p4 are move endpoints
p3x = slidex - CLIPRADIUS * nvx;
p3y = slidey - CLIPRADIUS * nvy;
p4x = p3x + slidedx;
p4y = p3y + slidedy;
// if the adjusted point is on the other side of the line, the endpoint must
// be checked.
side2 = SL_PointOnSide(p3x, p3y);
if(side2 == SIDE_BACK)
return; // ClipToPoint and slide along normal to line
side3 = SL_PointOnSide(p4x, p4y);
if(side3 == SIDE_ON)
return; // the move goes flush with the wall
else if(side3 == SIDE_FRONT)
return; // move doesn't cross line
if(side2 == SIDE_ON)
{
frac = 0; // moves toward the line
goto blockmove;
}
// the line endpoints must be on opposite sides of the move trace
// find the fractional intercept
frac = SL_CrossFrac();
if(frac < blockfrac)
{
blockmove:
blockfrac = frac;
blocknvx = -nvy;
blocknvy = nvx;
}
}
/*
==================
=
= SL_CheckLine
=
==================
*/
boolean SL_CheckLine(line_t *ld)//L800257D8()
{
fixed_t opentop, openbottom;
sector_t *front, *back;
int side1, temp;
// check bbox first
if (endbox[BOXRIGHT ] < ld->bbox[BOXLEFT ]
|| endbox[BOXLEFT ] > ld->bbox[BOXRIGHT ]
|| endbox[BOXTOP ] < ld->bbox[BOXBOTTOM]
|| endbox[BOXBOTTOM] > ld->bbox[BOXTOP ] )
return true;
// see if it can possibly block movement
if (!ld->backsector || ld->flags & ML_BLOCKING)
goto findfrac; // explicitly blocking
front = ld->frontsector;
back = ld->backsector;
if (front->floorheight > back->floorheight)
openbottom = front->floorheight;
else
openbottom = back->floorheight;
if (openbottom - slidething->z > 24*FRACUNIT)
goto findfrac; // too big of a step up
if (front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
else
opentop = back->ceilingheight;
if (opentop - openbottom >= 56*FRACUNIT)
return true; // the line doesn't block movement
// the line definately blocks movement
findfrac:
// p1, p2 are line endpoints
p1x = ld->v1->x;
p1y = ld->v1->y;
p2x = ld->v2->x;
p2y = ld->v2->y;
nvx = finesine[ld->fineangle];
nvy = -finecosine[ld->fineangle];
side1 = SL_PointOnSide (slidex, slidey);
if (side1 == SIDE_ON)
return true;
if (side1 == SIDE_BACK)
{
if (!ld->backsector)
return true; // don't clip to backs of one sided lines
temp = p1x;
p1x = p2x;
p2x = temp;
temp = p1y;
p1y = p2y;
p2y = temp;
nvx = -nvx;
nvy = -nvy;
}
SL_ClipToLine();
return true;
}
int SL_PointOnSide2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, fixed_t x3, fixed_t y3)//L80025A24()
{
//checked
fixed_t nx, ny;
fixed_t dist;
x1 = (x1 - x2);
y1 = (y1 - y2);
nx = (y3 - y2);
ny = (x2 - x3);
dist = FixedMul(x1, nx) + FixedMul(y1, ny);
if (dist < 0)
return SIDE_BACK;
return SIDE_FRONT;
}
static short *list_; //80078074|psGp00000c64
static line_t *ld_; //80077E48|plGp00000a38
static int offset_; //80077DB0|iGp000009a0
void SL_CheckSpecialLines (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2)//L80025A94()
{
fixed_t bx, by, xl, xh, yl, yh, bxl, bxh, byl, byh;
fixed_t x3,y3,x4,y4;
int side1, side2;
if (x1>MAPBLOCKSHIFT;
bxh = (xh - bmaporgx)>>MAPBLOCKSHIFT;
byl = (yl - bmaporgy)>>MAPBLOCKSHIFT;
byh = (yh - bmaporgy)>>MAPBLOCKSHIFT;
if (bxl<0)
bxl = 0;
if (byl<0)
byl = 0;
if (bxh>= bmapwidth)
bxh = bmapwidth -1;
if (byh>= bmapheight)
byh = bmapheight -1;
specialline = 0;
++validcount;
for (bx = bxl; bx <= bxh; bx++)
{
for (by = byl; by <= byh; by++)
{
offset_ = (by*bmapwidth) + bx;
offset_ = *(blockmap + offset_);
for (list_ = blockmaplump + offset_; *list_ != -1; list_++)
{
ld_ = &lines[*list_];
if (!ld_->special)
continue;
if (ld_->validcount == validcount)
continue; // line has already been checked
ld_->validcount = validcount;
if (xh < ld_->bbox[BOXLEFT]
|| xl > ld_->bbox[BOXRIGHT]
|| yh < ld_->bbox[BOXBOTTOM]
|| yl > ld_->bbox[BOXTOP])
continue;
x3 = ld_->v1->x;
y3 = ld_->v1->y;
x4 = ld_->v2->x;
y4 = ld_->v2->y;
side1 = SL_PointOnSide2(x1, y1, x3, y3, x4, y4);
side2 = SL_PointOnSide2(x2, y2, x3, y3, x4, y4);
if (side1 == side2)
continue; // move doesn't cross line
side1 = SL_PointOnSide2(x3, y3, x1, y1, x2, y2);
side2 = SL_PointOnSide2(x4, y4, x1, y1, x2, y2);
if (side1 == side2)
continue; // line doesn't cross move
specialline = ld_;
return;
}
}
}
}
================================================
FILE: PSXDOOM/p_spec.c
================================================
/* P_Spec.c */
#include "doomdef.h"
#include "r_local.h"
#include "p_local.h"
#include "st_main.h"
/*
===================
=
= P_InitPicAnims
=
===================
*/
animdef_t animdefs[MAXANIMS] =//0x80067074
{
{ false, "BLOOD1", "BLOOD3", 3 },
{ false, "BSLIME01", "BSLIME04", 3 },
{ false, "CSLIME01", "CSLIME04", 3 },
{ false, "ENERG01", "ENERG04", 3 },
{ false, "LAVA01", "LAVA04", 3 },
{ false, "WATER01", "WATER04", 3 },
{ false, "SLIME01", "SLIME03", 3 },
{ true, "BFALL1", "BFALL1", 3 },
{ true, "ENERGY01", "ENERGY04", 3 },
{ true, "FIRE01", "FIRE02", 3 },
{ true, "FLAME01", "FLAME03", 3 },
{ true, "LAVWAL01", "LAVWAL03", 3 },
{ true, "SFALL1", "SFALL4", 3 },
{ true, "SLIM01", "SLIM04", 3 },
{ true, "TVSNOW01", "TVSNOW03", 1 },
{ true, "WARN01", "WARN02", 3 }
};
anim_t /*anims[MAXANIMS],*/ *lastanim;//800861d4, ||80077F8C, pbGp00000b7c
void P_InitPicAnims (void)//L80025EDC()
{
int i, lump;
/* */
/* Init animation */
/* */
lastanim = anims;
for (i=0 ; i < MAXANIMS ; i++)
{
if (animdefs[i].istexture)
{
lastanim->basepic = R_TextureNumForName (animdefs[i].startname);
lastanim->picnum = R_TextureNumForName(animdefs[i].endname);
if (textures[lastanim->basepic].vtpage == NULL)
continue;
for(lump = lastanim->basepic; lump <= lastanim->picnum; lump++)
{
W_CacheLumpNum(lump + firsttex, PU_ANIMATION, false);
textures[lump].vramx = textures[lastanim->basepic].vramx;
textures[lump].vramy = textures[lastanim->basepic].vramy;
textures[lump].vtpage = textures[lastanim->basepic].vtpage;
textures[lump].vptr = textures[lastanim->basepic].vptr;
}
}
else
{
lastanim->basepic = R_FlatNumForName (animdefs[i].startname);
lastanim->picnum = R_FlatNumForName(animdefs[i].endname);
if (texflats[lastanim->basepic].vtpage == NULL)
continue;
for (lump = lastanim->basepic; lump <= lastanim->picnum; lump++)
{
W_CacheLumpNum(lump + firstflat, PU_ANIMATION, false);
texflats[lump].vramx = texflats[lastanim->basepic].vramx;
texflats[lump].vramy = texflats[lastanim->basepic].vramy;
texflats[lump].vtpage = texflats[lastanim->basepic].vtpage;
texflats[lump].vptr = texflats[lastanim->basepic].vptr;
}
}
lastanim->istexture = animdefs[i].istexture;
lastanim->current = lastanim->basepic;
lastanim->numpics = (lastanim->picnum - lastanim->basepic) + 1;
lastanim->tics = animdefs[i].speed;
#if 0
/* FIXME */
if (lastanim->numpics < 2)
I_Error ("P_InitPicAnims: bad cycle from %s to %s"
, animdefs[i].startname, animdefs[i].endname);
#endif
lastanim++;
}
}
/*
==============================================================================
UTILITIES
==============================================================================
*/
/* */
/* Will return a side_t* given the number of the current sector, */
/* the line number, and the side (0/1) that you want. */
/* */
side_t *getSide(int currentSector,int line, int side)//L800261BC()
{
return &sides[ (sectors[currentSector].lines[line])->sidenum[side] ];
}
/* */
/* Will return a sector_t* given the number of the current sector, */
/* the line number and the side (0/1) that you want. */
/* */
sector_t *getSector(int currentSector,int line,int side)//L80026218()
{
return sides[ (sectors[currentSector].lines[line])->sidenum[side] ].sector;
}
/* */
/* Given the sector number and the line number, will tell you whether */
/* the line is two-sided or not. */
/* */
int twoSided(int sector,int line)//L8002627C()
{
return (sectors[sector].lines[line])->flags & ML_TWOSIDED;
}
/*================================================================== */
/* */
/* Return sector_t * of sector next to current. NULL if not two-sided line */
/* */
/*================================================================== */
sector_t *getNextSector(line_t *line,sector_t *sec)//L800262BC()
{
if (!(line->flags & ML_TWOSIDED))
return NULL;
if (line->frontsector == sec)
return line->backsector;
return line->frontsector;
}
/*================================================================== */
/* */
/* FIND LOWEST FLOOR HEIGHT IN SURROUNDING SECTORS */
/* */
/*================================================================== */
fixed_t P_FindLowestFloorSurrounding(sector_t *sec)//L800262EC()
{
int i;
line_t *check;
sector_t *other;
fixed_t floor = sec->floorheight;
for (i=0 ;i < sec->linecount ; i++)
{
check = sec->lines[i];
other = getNextSector(check,sec);
if (!other)
continue;
if (other->floorheight < floor)
floor = other->floorheight;
}
return floor;
}
/*================================================================== */
/* */
/* FIND HIGHEST FLOOR HEIGHT IN SURROUNDING SECTORS */
/* */
/*================================================================== */
fixed_t P_FindHighestFloorSurrounding(sector_t *sec)//L80026380()
{
int i;
line_t *check;
sector_t *other;
fixed_t floor = -500*FRACUNIT;
for (i=0 ;i < sec->linecount ; i++)
{
check = sec->lines[i];
other = getNextSector(check,sec);
if (!other)
continue;
if (other->floorheight > floor)
floor = other->floorheight;
}
return floor;
}
/*================================================================== */
/* */
/* FIND NEXT HIGHEST FLOOR IN SURROUNDING SECTORS */
/* */
/*================================================================== */
fixed_t P_FindNextHighestFloor(sector_t *sec,int currentheight)//L80026418()
{
#if P_FNHF_UPDATE == 1
// PSYDOOM: rewrite this to eliminate potential buffer overflow and also an undefined answer when there is no next higher floor
int lineIdx;
line_t *line;
sector_t *pNextSector;
fixed_t floorH;
fixed_t nextHighestFloor = MAXINT;
for (lineIdx = 0; lineIdx < sec->linecount; ++lineIdx)
{
line = sec->lines[lineIdx];
pNextSector = getNextSector(line, sec);
if (!pNextSector)
continue;
floorH = pNextSector->floorheight;
if ((floorH > currentheight) && (floorH < nextHighestFloor))
{
nextHighestFloor = floorH;
}
}
// If there is no next highest floor return the input height rather than something undefined
return (nextHighestFloor != MAXINT) ? nextHighestFloor : currentheight;
#else
int i;
int h;
int min;
line_t *check;
sector_t *other;
fixed_t height = currentheight;
fixed_t heightlist[20]; /* 20 adjoining sectors max! */
for (i =0,h = 0 ;i < sec->linecount ; i++)
{
check = sec->lines[i];
other = getNextSector(check,sec);
if (!other)
continue;
if (other->floorheight > height)
heightlist[h++] = other->floorheight;
}
/* */
/* Find lowest height in list */
/* */
min = heightlist[0];
for (i = 1;i < h;i++)
if (heightlist[i] < min)
min = heightlist[i];
return min;
#endif //P_FNHF_UPDATE
}
/*================================================================== */
/* */
/* FIND LOWEST CEILING IN THE SURROUNDING SECTORS */
/* */
/*================================================================== */
fixed_t P_FindLowestCeilingSurrounding(sector_t *sec)//L800264FC()
{
int i;
line_t *check;
sector_t *other;
fixed_t height = MAXINT;
for (i=0 ;i < sec->linecount ; i++)
{
check = sec->lines[i];
other = getNextSector(check,sec);
if (!other)
continue;
if (other->ceilingheight < height)
height = other->ceilingheight;
}
return height;
}
/*================================================================== */
/* */
/* FIND HIGHEST CEILING IN THE SURROUNDING SECTORS */
/* */
/*================================================================== */
fixed_t P_FindHighestCeilingSurrounding(sector_t *sec)//L80026598()
{
int i;
line_t *check;
sector_t *other;
fixed_t height = 0;
for (i=0 ;i < sec->linecount ; i++)
{
check = sec->lines[i];
other = getNextSector(check,sec);
if (!other)
continue;
if (other->ceilingheight > height)
height = other->ceilingheight;
}
return height;
}
/*================================================================== */
/* */
/* RETURN NEXT SECTOR # THAT LINE TAG REFERS TO */
/* */
/*================================================================== */
int P_FindSectorFromLineTag(line_t *line,int start)//L80026630()
{
int i;
for (i=start+1;itag)
return i;
return -1;
}
/*================================================================== */
/* */
/* Find minimum light from an adjacent sector */
/* */
/*================================================================== */
int P_FindMinSurroundingLight(sector_t *sector,int max)//L80026698()
{
int i;
int min;
line_t *line;
sector_t *check;
min = max;
for (i=0 ; i < sector->linecount ; i++)
{
line = sector->lines[i];
check = getNextSector(line,sector);
if (!check)
continue;
if (check->lightlevel < min)
min = check->lightlevel;
}
return min;
}
/*
==============================================================================
EVENTS
Events are operations triggered by using, crossing, or shooting special lines, or by timed thinkers
==============================================================================
*/
/*
===============================================================================
=
= P_CrossSpecialLine - TRIGGER
=
= Called every time a thing origin is about to cross
= a line with a non 0 special
=
===============================================================================
*/
void P_CrossSpecialLine (line_t *line, mobj_t *thing)//L8002672C()
{
int ok;
/* */
/* Triggers that other things can activate */
/* */
if (!thing->player)
{
if ((thing->type >= MT_TROOPSHOT) && (thing->type < MT_ARACHPLAZ))
return;
ok = 0;
switch(line->special)
{
case 39: /* TELEPORT TRIGGER */
case 97: /* TELEPORT RETRIGGER */
case 125: /* TELEPORT MONSTERONLY TRIGGER */
case 126: /* TELEPORT MONSTERONLY RETRIGGER */
case 4: /* RAISE DOOR */
case 10: /* PLAT DOWN-WAIT-UP-STAY TRIGGER */
case 88: /* PLAT DOWN-WAIT-UP-STAY RETRIGGER */
ok = 1;
break;
}
if (!ok)
return;
}
switch (line->special)
{
/*==================================================== */
/* TRIGGERS */
/*==================================================== */
case 2: /* Open Door */
EV_DoDoor(line, Open);
line->special = 0;
break;
case 3: /* Close Door */
EV_DoDoor(line, Close);
line->special = 0;
break;
case 4: /* Raise Door */
EV_DoDoor(line, Normal);
line->special = 0;
break;
case 5: /* Raise Floor */
EV_DoFloor(line, raiseFloor);
line->special = 0;
break;
case 6: /* Fast Ceiling Crush & Raise */
EV_DoCeiling(line, fastCrushAndRaise);
line->special = 0;
break;
case 8: /* Build Stairs */
EV_BuildStairs(line, build8);
line->special = 0;
break;
case 10: /* PlatDownWaitUp */
EV_DoPlat(line, downWaitUpStay, 0);
line->special = 0;
break;
case 12: /* Light Turn On - brightest near */
EV_LightTurnOn(line, 0);
line->special = 0;
break;
case 13: /* Light Turn On 255 */
EV_LightTurnOn(line, 255);
line->special = 0;
break;
case 16: /* Close Door 30 */
EV_DoDoor(line, Close30ThenOpen);
line->special = 0;
break;
case 17: /* Start Light Strobing */
EV_StartLightStrobing(line);
line->special = 0;
break;
case 19: /* Lower Floor */
EV_DoFloor(line, lowerFloor);
line->special = 0;
break;
case 22: /* Raise floor to nearest height and change texture */
EV_DoPlat(line, raiseToNearestAndChange, 0);
line->special = 0;
break;
case 25: /* Ceiling Crush and Raise */
EV_DoCeiling(line, crushAndRaise);
line->special = 0;
break;
case 30: /* Raise floor to shortest texture height on either side of lines */
EV_DoFloor(line, raiseToTexture);
line->special = 0;
break;
case 35: /* Lights Very Dark */
EV_LightTurnOn(line, 35);
line->special = 0;
break;
case 36: /* Lower Floor (TURBO) */
EV_DoFloor(line, turboLower);
line->special = 0;
break;
case 37: /* LowerAndChange */
EV_DoFloor(line, lowerAndChange);
line->special = 0;
break;
case 38: /* Lower Floor To Lowest */
EV_DoFloor(line, lowerFloorToLowest);
line->special = 0;
break;
case 39: /* TELEPORT! */
EV_Teleport(line, thing);
line->special = 0;
break;
case 40: /* RaiseCeilingLowerFloor */
EV_DoCeiling(line, raiseToHighest);
EV_DoFloor(line, lowerFloorToLowest);
line->special = 0;
break;
case 44: /* Ceiling Crush */
EV_DoCeiling(line, lowerAndCrush);
line->special = 0;
break;
case 52: /* EXIT! */
P_ExitLevel();
line->special = 0;
break;
case 53: /* Perpetual Platform Raise */
EV_DoPlat(line, perpetualRaise, 0);
line->special = 0;
break;
case 54: /* Platform Stop */
EV_StopPlat(line);
line->special = 0;
break;
case 56: /* Raise Floor Crush */
EV_DoFloor(line, raiseFloorCrush);
line->special = 0;
break;
case 57: /* Ceiling Crush Stop */
EV_CeilingCrushStop(line);
line->special = 0;
break;
case 58: /* Raise Floor 24 */
EV_DoFloor(line, raiseFloor24);
line->special = 0;
break;
case 59: /* Raise Floor 24 And Change */
EV_DoFloor(line, raiseFloor24AndChange);
line->special = 0;
break;
case 104: /* Turn lights off in sector(tag) */
EV_TurnTagLightsOff(line);
line->special = 0;
break;
case 108: /* Blazing Door Raise (faster than TURBO!) */
EV_DoDoor(line, BlazeRaise);
line->special = 0;
break;
case 109: /* Blazing Door Open (faster than TURBO!) */
EV_DoDoor(line, BlazeOpen);
line->special = 0;
break;
case 100: /* Build Stairs Turbo 16 */
EV_BuildStairs(line, turbo16);
line->special = 0;
break;
case 110: /* Blazing Door Close (faster than TURBO!) */
EV_DoDoor(line, BlazeClose);
line->special = 0;
break;
case 119: /* Raise floor to nearest surr. floor */
EV_DoFloor(line, raiseFloorToNearest);
line->special = 0;
break;
case 121: /* Blazing PlatDownWaitUpStay */
EV_DoPlat(line, blazeDWUS, 0);
line->special = 0;
break;
case 124: /* Secret EXIT */
P_SecretExitLevel(line->tag);
break;
case 125: /* TELEPORT MonsterONLY */
if (!thing->player)
{
EV_Teleport(line, thing);
line->special = 0;
}
break;
case 141: /* Silent Ceiling Crush & Raise */
EV_DoCeiling(line, silentCrushAndRaise);
line->special = 0;
break;
case 142: /* Play Track Club Doom PSX DOOM EXCLUSIVE */
S_StopMusic();
psxcd_play_at_andloop(CD_TRACK[cdmusic_club_doom],CDVolume,0,0,CD_TRACK[cdmusic_club_doom],CDVolume,0,0);
line->special = 0;
break;
/*==================================================== */
/* RE-DOABLE TRIGGERS */
/*==================================================== */
case 72: /* Ceiling Crush */
EV_DoCeiling(line, lowerAndCrush);
break;
case 73: /* Ceiling Crush and Raise */
EV_DoCeiling(line, crushAndRaise);
break;
case 74: /* Ceiling Crush Stop */
EV_CeilingCrushStop(line);
break;
case 75: /* Close Door */
EV_DoDoor(line, Close);
break;
case 76: /* Close Door 30 */
EV_DoDoor(line, Close30ThenOpen);
break;
case 77: /* Fast Ceiling Crush & Raise */
EV_DoCeiling(line, fastCrushAndRaise);
break;
case 79: /* Lights Very Dark */
EV_LightTurnOn(line, 35);
break;
case 80: /* Light Turn On - brightest near */
EV_LightTurnOn(line, 0);
break;
case 81: /* Light Turn On 255 */
EV_LightTurnOn(line, 255);
break;
case 82: /* Lower Floor To Lowest */
EV_DoFloor(line, lowerFloorToLowest);
break;
case 83: /* Lower Floor */
EV_DoFloor(line, lowerFloor);
break;
case 84: /* LowerAndChange */
EV_DoFloor(line, lowerAndChange);
break;
case 86: /* Open Door */
EV_DoDoor(line, Open);
break;
case 87: /* Perpetual Platform Raise */
EV_DoPlat(line, perpetualRaise, 0);
break;
case 88: /* PlatDownWaitUp */
EV_DoPlat(line, downWaitUpStay, 0);
break;
case 89: /* Platform Stop */
EV_StopPlat(line);
break;
case 90: /* Raise Door */
EV_DoDoor(line, Normal);
break;
case 91: /* Raise Floor */
EV_DoFloor(line, raiseFloor);
break;
case 92: /* Raise Floor 24 */
EV_DoFloor(line, raiseFloor24);
break;
case 93: /* Raise Floor 24 And Change */
EV_DoFloor(line, raiseFloor24AndChange);
break;
case 94: /* Raise Floor Crush */
EV_DoFloor(line, raiseFloorCrush);
break;
case 95: /* Raise floor to nearest height and change texture */
EV_DoPlat(line, raiseToNearestAndChange, 0);
break;
case 96: /* Raise floor to shortest texture height on either side of lines */
EV_DoFloor(line, raiseToTexture);
break;
case 97: /* TELEPORT! */
EV_Teleport(line, thing);
break;
case 98: /* Lower Floor (TURBO) */
EV_DoFloor(line, turboLower);
break;
case 105: /* Blazing Door Raise (faster than TURBO!) */
EV_DoDoor(line, BlazeRaise);
break;
case 106: /* Blazing Door Open (faster than TURBO!) */
EV_DoDoor(line, BlazeOpen);
break;
case 107: /* Blazing Door Close (faster than TURBO!) */
EV_DoDoor(line, BlazeClose);
break;
case 120: /* Blazing PlatDownWaitUpStay */
EV_DoPlat(line, blazeDWUS, 0);
break;
case 126: /* TELEPORT MonsterONLY */
if (!thing->player)
EV_Teleport(line, thing);
break;
}
}
/*
===============================================================================
=
= P_ShootSpecialLine - IMPACT SPECIALS
=
= Called when a thing shoots a special line
=
===============================================================================
*/
void P_ShootSpecialLine ( mobj_t *thing, line_t *line)//L80026CD8()
{
int ok;
/* */
/* Impacts that other things can activate */
/* */
if (!thing->player)
{
ok = 0;
switch(line->special)
{
case 46: /* OPEN DOOR IMPACT */
ok = 1;
break;
}
if (!ok)
return;
}
switch(line->special)
{
case 24: /* RAISE FLOOR */
if(EV_DoFloor(line,raiseFloor))
P_ChangeSwitchTexture(line,0);
break;
case 46: /* OPEN DOOR */
if(EV_DoDoor(line,Open))
P_ChangeSwitchTexture(line,1);
break;
case 47: /* RAISE FLOOR NEAR AND CHANGE */
if(EV_DoPlat(line,raiseToNearestAndChange,0))
P_ChangeSwitchTexture(line,0);
break;
}
}
/*
===============================================================================
=
= P_PlayerInSpecialSector
=
= Called every tic frame that the player origin is in a special sector
=
===============================================================================
*/
void P_PlayerInSpecialSector (player_t *player)//L80026DA0()
{
sector_t *sector;
sector = player->mo->subsector->sector;
if (player->mo->z != sector->floorheight)
return; /* not all the way down yet */
switch (sector->special)
{
case 5: /* HELLSLIME DAMAGE */
if (!player->powers[pw_ironfeet])
{
stbar.specialFace = f_mowdown;
if ((gamevbls < (int)gametic) && !(gametic & 0xf))
P_DamageMobj(player->mo, NULL, NULL, 10);
}
break;
case 7: /* NUKAGE DAMAGE */
if (!player->powers[pw_ironfeet])
{
stbar.specialFace = f_mowdown;
if ((gamevbls < (int)gametic) && !(gametic & 0xf))
P_DamageMobj(player->mo, NULL, NULL, 5);
}
break;
case 16: /* SUPER HELLSLIME DAMAGE */
case 4: /* STROBE HURT */
if (!player->powers[pw_ironfeet] || (P_Random() < 5))
{
stbar.specialFace = f_mowdown;
if ((gamevbls < (int)gametic) && !(gametic & 0xf))
P_DamageMobj(player->mo, NULL, NULL, 20);
}
break;
case 9: /* SECRET SECTOR */
player->secretcount++;
sector->special = 0;
break;
default:
I_Error ("P_PlayerInSpecialSector: unknown special %i", sector->special);
};
}
/*
===============================================================================
=
= P_UpdateSpecials
=
= Animate planes, scroll walls, etc
===============================================================================
*/
#define SCROLLLIMIT (FRACUNIT*-129)
int numlinespecials;//0x80077D7C, iGp0000096c
//line_t *linespeciallist[MAXLINEANIMS];//0x800973a4
firesky_t spreadfire; //80077964, pcGp00000554
void P_UpdateSpecials (void)//L80026F60()
{
anim_t *anim;
int i;
line_t *line;
psxobj_t *animtex;
/* */
/* ANIMATE FLATS AND TEXTURES GLOBALY */
/* */
for (anim = anims ; anim < lastanim ; anim++)
{
if (!(gametic & anim->tics))//leveltime
{
if (!anim->istexture)
{
anim->current++;
if (anim->picnum < anim->current)
anim->current = anim->basepic;
flattranslation[anim->basepic] = anim->current;
animtex = &texflats[anim->current];
}
else
{
anim->current++;
if (anim->picnum < anim->current)
anim->current = anim->basepic;
texturetranslation[anim->basepic] = anim->current;
animtex = &textures[anim->current];
}
animtex->index = -1;
}
}
/* */
/* ANIMATE LINE SPECIALS */
/* */
for (i = 0; i < numlinespecials; i++)
{
line = linespeciallist[i];
switch(line->special)
{
case 200: /* EFFECT SCROLL LEFT*/
sides[line->sidenum[0]].textureoffset += FRACUNIT;
sides[line->sidenum[0]].textureoffset &= SCROLLLIMIT;
break;
case 201: /* EFFECT SCROLL RIGHT*/
sides[line->sidenum[0]].textureoffset -= FRACUNIT;
sides[line->sidenum[0]].textureoffset &= SCROLLLIMIT;
break;
case 202: /* EFFECT SCROLL UP*/
sides[line->sidenum[0]].rowoffset += FRACUNIT;
sides[line->sidenum[0]].rowoffset &= SCROLLLIMIT;
break;
case 203: /* EFFECT SCROLL DOWN*/
sides[line->sidenum[0]].rowoffset -= FRACUNIT;
sides[line->sidenum[0]].rowoffset &= SCROLLLIMIT;
break;
}
}
/* */
/* DO BUTTONS */
/* */
for (i = 0; i < MAXBUTTONS; i++)
{
if (buttonlist[i].btimer > 0)
{
buttonlist[i].btimer -= vblsinframe[consoleplayer];
if (buttonlist[i].btimer <= 0)
{
switch (buttonlist[i].where)
{
case top:
sides[buttonlist[i].line->sidenum[0]].toptexture = buttonlist[i].btexture;
break;
case middle:
sides[buttonlist[i].line->sidenum[0]].midtexture = buttonlist[i].btexture;
break;
case bottom:
sides[buttonlist[i].line->sidenum[0]].bottomtexture = buttonlist[i].btexture;
break;
}
S_StartSound((mobj_t *)buttonlist[i].soundorg, sfx_swtchn);
D_memset(&buttonlist[i], 0, sizeof(button_t));
}
}
}
//Update spread fire
if (rendersky && spreadfire)
spreadfire(skytexturep);
}
/*============================================================ */
/* */
/* Special Stuff that can't be categorized */
/* */
/*============================================================ */
int EV_DoDonut(line_t *line)//L800273F4()
{
sector_t *s1;
sector_t *s2;
sector_t *s3;
int secnum;
int rtn;
int i;
floormove_t *floor;
secnum = -1;
rtn = 0;
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
{
s1 = §ors[secnum];
/* ALREADY MOVING? IF SO, KEEP GOING... */
if (s1->specialdata)
continue;
rtn = 1;
s2 = getNextSector(s1->lines[0],s1);
for (i = 0;i < s2->linecount;i++)
{
if (//(!s2->lines[i]->flags & ML_TWOSIDED) ||
(s2->lines[i]->backsector == s1))
continue;
s3 = s2->lines[i]->backsector;
/* */
/* Spawn rising slime */
/* */
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
s2->specialdata = floor;
floor->thinker.function = T_MoveFloor;
floor->type = donutRaise;
floor->crush = false;
floor->direction = 1;
floor->sector = s2;
floor->speed = FLOORSPEED / 2;
floor->texture = s3->floorpic;
floor->newspecial = 0;
floor->floordestheight = s3->floorheight;
/* */
/* Spawn lowering donut-hole */
/* */
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
P_AddThinker (&floor->thinker);
s1->specialdata = floor;
floor->thinker.function = T_MoveFloor;
floor->type = lowerFloor;
floor->crush = false;
floor->direction = -1;
floor->sector = s1;
floor->speed = FLOORSPEED / 2;
floor->floordestheight = s3->floorheight;
break;
}
}
return rtn;
}
/*
==============================================================================
EXIT DELAY
==============================================================================
*/
/*
================================================================================
= P_SpawnDelayTimer
=
= Exclusive Psx Doom
=
===============================================================================
*/
void P_SpawnDelayTimer(int tics, void(*action)())//L80027640()
{
delay_t *timer;
timer = Z_Malloc(sizeof(*timer), PU_LEVSPEC, 0);
P_AddThinker(&timer->thinker);
timer->thinker.function = T_CountdownTimer;
timer->tics = tics;
timer->finishfunc = action;
}
/*
================================================================================
= T_CountdownTimer
=
= Exclusive Psx Doom
=
===============================================================================
*/
void T_CountdownTimer(delay_t *timer)//L800276B0()
{
if ((timer->tics--) <= 0)
{
timer->finishfunc();
P_RemoveThinker(&timer->thinker);
return;
}
}
/*
================================================================================
= P_ExitLevel
=
= Exclusive Psx Doom
=
===============================================================================
*/
void P_ExitLevel(void)//L80027700()
{
nextmap = gamemap + 1;
P_SpawnDelayTimer(4, G_CompleteLevel);
}
/*
================================================================================
= P_SecretExitLevel
=
= Exclusive Psx Doom
=
===============================================================================
*/
void P_SecretExitLevel(int map)//L80027778()
{
nextmap = map;
P_SpawnDelayTimer(4, G_CompleteLevel);
}
/*
==============================================================================
SPECIAL SPAWNING
==============================================================================
*/
/*
================================================================================
= P_SpawnSpecials
=
= After the map has been loaded, scan for specials that
= spawn thinkers
=
===============================================================================
*/
#if GH_UPDATES == 1
card_t MapBlueKeyType; //0x80077E9C
card_t MapRedKeyType; //0x8007821C
card_t MapYellowKeyType; //0x800780A0
#endif // GH_UPDATES
int enemyspecial; //80077DB4
void P_SpawnSpecials (void)//L800277E4()
{
sector_t *sector;
int i;
#if GH_UPDATES == 1
mobj_t *mo;
#endif // GH_UPDATES
/* */
/* Init special SECTORs */
/* */
sector = sectors;
for (i = 0; i < numsectors; i++, sector++)
{
if (!sector->special)
continue;
switch (sector->special)
{
case 1: /* FLICKERING LIGHTS */
P_SpawnLightFlash(sector);
break;
case 2: /* STROBE FAST */
P_SpawnStrobeFlash(sector, FASTDARK, 0);
break;
case 3: /* STROBE SLOW */
P_SpawnStrobeFlash(sector, SLOWDARK, 0);
break;
case 8: /* GLOWING LIGHT */
P_SpawnGlowingLight(sector, glowtolower);
break;
case 9: /* SECRET SECTOR */
totalsecret++;
break;
case 10: /* DOOR CLOSE IN 30 SECONDS */
P_SpawnDoorCloseIn30(sector);
break;
case 12: /* SYNC STROBE SLOW */
P_SpawnStrobeFlash(sector, SLOWDARK, 1);
break;
case 13: /* SYNC STROBE FAST */
P_SpawnStrobeFlash(sector, FASTDARK, 1);
break;
case 14: /* DOOR RAISE IN 5 MINUTES */
P_SpawnDoorRaiseIn5Mins(sector, i);
break;
case 17: /* FIRE FLICKER */
P_SpawnFireFlicker(sector);
break;
case 200: /* GLOW TO DARK */
P_SpawnGlowingLight(sector, glowto10);
break;
case 201: /* GLOW TO BRIGHT */
P_SpawnGlowingLight(sector, glowto255);
break;
case 202: /* RAPID STROBE FLASH (PSX ADDITION) */
P_SpawnStrobeFlashFast(sector);
break;
case 204: /* STROBE FLASH */
P_SpawnStrobeFlash(sector, TURBODARK, 0);
break;
}
}
/* */
/* Init line EFFECTs */
/* */
numlinespecials = 0;
for (i = 0;i < numlines; i++)
{
switch(lines[i].special)
{
//case 48: /* EFFECT FIRSTCOL SCROLL+ */
case 200: /* EFFECT: SCROLL LEFT */
case 201: /* EFFECT: SCROLL RIGHT */
case 202: /* EFFECT: SCROLL UP */
case 203: /* EFFECT: SCROLL DOWN */
if(numlinespecials < MAXLINEANIMS)
{
linespeciallist[numlinespecials] = &lines[i];
numlinespecials++;
}
break;
}
}
/* */
/* Init Enemy Special Death Flags */
/* Exclusive Psx Doom */
/* */
enemyspecial = 0;
sector = sectors;
for (i = 0; i < numsectors; i++, sector++)
{
switch (sector->tag)
{
case 666:
enemyspecial |= 1; // "Mancubus"
break;
case 667:
enemyspecial |= 2; // "Arachnotron",
break;
case 668:
enemyspecial |= 4; // "SpiderMastermind",
break;
case 669:
enemyspecial |= 8; // "Hell Knight",
break;
case 670:
enemyspecial |= 16; // "Cyberdemon",
break;
case 671:
enemyspecial |= 32; // "Baron of Hell",
break;
default:
break;
}
}
#if GH_UPDATES == 1
/* */
/* Info From PsyDoom */
/* Run through all map objects to see if any skull keys are being used instead of keycards. */
/* This is required for the correct sprite to be used for HUD key flashes (skull vs card). */
/* */
MapRedKeyType = it_redcard;
MapBlueKeyType = it_bluecard;
MapYellowKeyType = it_yellowcard;
for (mo = mobjhead.next ; mo != &mobjhead ; mo = mo->next)
{
switch (mo->type)
{
case MT_MISC7: MapYellowKeyType = it_yellowskull; break;
case MT_MISC8: MapRedKeyType = it_redskull; break;
case MT_MISC9: MapBlueKeyType = it_blueskull; break;
}
}
#endif // GH_UPDATES
/* */
/* Init other misc stuff */
/* */
D_memset(activeceilings, 0, MAXCEILINGS * sizeof(ceiling_t*));
D_memset(activeplats, 0, MAXPLATS * sizeof(plat_t*));
D_memset(buttonlist, 0, MAXBUTTONS * sizeof(button_t));
}
/*
================================================================================
= P_FireSky
=
= Exclusive Psx Doom Fire Sequence
=
===============================================================================
*/
int frndindex = 0;//*(r28 + 1368) 80077968
void P_FireSky(psxobj_t *psxobj)//L80027B90()
{
byte *src, *srcoffset;
byte randIdx1, randIdx2;
int width, height;
int pixel, counter;
src = (byte *)(lumpcache[psxobj->lump].cache) + (FIRESKY_WIDTH + 8);//8 = skip header texture data
width = 0;
do // width
{
height = 1;
counter = width + 1;
srcoffset = src + width;
do // height
{
pixel = *(byte*)srcoffset;
if (pixel != 0)
{
randIdx1 = rndtable[(frndindex & 0xff)];
randIdx2 = rndtable[(frndindex + 1) & 0xff];
frndindex = ((frndindex + 2) & 0xff);
*(byte*)((counter - (randIdx1 & 3) & (FIRESKY_WIDTH - 1)) + src - FIRESKY_WIDTH) = pixel - ((randIdx2 & 1));
}
else
{
*(byte*)(srcoffset - FIRESKY_WIDTH) = 0;
}
srcoffset += FIRESKY_WIDTH;
src += FIRESKY_WIDTH;
height++;
} while (height < FIRESKY_HEIGHT);
src -= ((FIRESKY_WIDTH*FIRESKY_HEIGHT) - FIRESKY_WIDTH);
width++;
} while (width < FIRESKY_WIDTH);
psxobj->index = -1;
}
================================================
FILE: PSXDOOM/p_spec.h
================================================
/* P_spec.h */
#include "r_local.h"
/*
===============================================================================
P_SPEC
===============================================================================
*/
/* */
/* Animating textures and planes */
/* */
typedef struct
{
boolean istexture; //*
int picnum; //*4
int basepic; //*8
int numpics; //*12
int current; //*16
int tics; //*20
} anim_t;
/* */
/* source animation definition */
/* */
typedef struct
{
boolean istexture; /* if false, it's a flat */
char startname[9]; //*4 endname
char endname[9]; //*13 startname
int speed; //*24
} animdef_t;
#define MAXANIMS 16 //[psx] change to 16
extern anim_t anims[MAXANIMS], *lastanim;
#if GH_UPDATES == 1
extern card_t MapBlueKeyType;
extern card_t MapRedKeyType;
extern card_t MapYellowKeyType;
#endif // GH_UPDATES
extern int enemyspecial; //80077DB4
/* */
/* Animating line specials */
/* */
#define MAXLINEANIMS 32 //[psx] change to 32
extern int numlinespecials;
extern line_t *linespeciallist[MAXLINEANIMS];
/* Define values for map objects */
#define MO_TELEPORTMAN 14
/* at game start */
void P_InitPicAnims (void);
/* psx doom exit delay */
typedef struct
{
thinker_t thinker;
int tics;
void(*finishfunc)(void);
}delay_t;
void P_SpawnDelayTimer(int tics, void(*action)());
void T_CountdownTimer(delay_t *timer);
void P_ExitLevel(void);
void P_SecretExitLevel(int map);
/* at map load */
void P_SpawnSpecials (void);
/* psx doom fire sky */
typedef void(*firesky_t)(psxobj_t *psxobj);
extern firesky_t spreadfire; //80077964, pcGp00000554
#define FIRESKY_WIDTH 64
#define FIRESKY_HEIGHT 128
extern int frndindex;
void P_FireSky(psxobj_t *psxobj);
/* every tic */
void P_UpdateSpecials (void);
/* when needed */
boolean P_UseSpecialLine ( mobj_t *thing, line_t *line);
void P_ShootSpecialLine ( mobj_t *thing, line_t *line);
void P_CrossSpecialLine (line_t *line,mobj_t *thing);
void P_PlayerInSpecialSector (player_t *player);
int twoSided(int sector,int line);
sector_t *getSector(int currentSector,int line,int side);
side_t *getSide(int currentSector,int line, int side);
fixed_t P_FindLowestFloorSurrounding(sector_t *sec);
fixed_t P_FindHighestFloorSurrounding(sector_t *sec);
fixed_t P_FindNextHighestFloor(sector_t *sec,int currentheight);
fixed_t P_FindLowestCeilingSurrounding(sector_t *sec);
fixed_t P_FindHighestCeilingSurrounding(sector_t *sec);
int P_FindSectorFromLineTag(line_t *line,int start);
int P_FindMinSurroundingLight(sector_t *sector,int max);
sector_t *getNextSector(line_t *line,sector_t *sec);
/* */
/* SPECIAL */
/* */
int EV_DoDonut(line_t *line);
/*
===============================================================================
P_LIGHTS
===============================================================================
*/
// Psx Doom New From PC Doom
typedef struct
{
thinker_t thinker; //8
sector_t *sector; //12
int count; //16
int maxlight; //20
int minlight; //24
} fireflicker_t;
typedef struct
{
thinker_t thinker;
sector_t *sector;
int count;
int maxlight;
int minlight;
int maxtime;
int mintime;
} lightflash_t;
typedef struct
{
thinker_t thinker;
sector_t *sector;
int count;
int minlight;
int maxlight;
int darktime;
int brighttime;
} strobe_t;
typedef enum
{
glowtolower,
glowto10,
glowto255
} glowtype_e;//Psx Doom
typedef struct
{
thinker_t thinker;
sector_t *sector;
int minlight;
int maxlight;
int direction;
} glow_t;
#define GLOWSPEED 3 //old 16
#define STROBEBRIGHT 3
#define TURBODARK 4
#define FASTDARK 8
#define SLOWDARK 15
void T_FireFlicker(fireflicker_t *flick);// PSX DOOM
void P_SpawnFireFlicker(sector_t *sector);// PSX DOOM
void T_LightFlash (lightflash_t *flash);
void P_SpawnLightFlash (sector_t *sector);
void T_StrobeFlash (strobe_t *flash);
void P_SpawnStrobeFlash (sector_t *sector, int fastOrSlow, int inSync);
void P_SpawnStrobeFlashFast(sector_t *sector);// PSX DOOM
void EV_StartLightStrobing(line_t *line);
void EV_TurnTagLightsOff(line_t *line);
void EV_LightTurnOn(line_t *line, int bright);
void T_Glow(glow_t *g);
void P_SpawnGlowingLight(sector_t *sector, glowtype_e type);
/*
===============================================================================
P_SWITCH
===============================================================================
*/
typedef struct
{
char name1[9];
char name2[9];
} switchlist_t;
typedef enum
{
top,
middle,
bottom
} bwhere_e;
typedef struct
{
line_t *line;
bwhere_e where;
int btexture;
int btimer;
mobj_t *soundorg;
} button_t;
#define MAXSWITCHES 50 /* max # of wall switches in a level */
#define MAXBUTTONS 16 /* 4 players, 4 buttons each at once, max. */
#define BUTTONTIME 15 /* 1 second */
extern button_t buttonlist[MAXBUTTONS];
extern int switchlist[MAXSWITCHES * 2];
void P_ChangeSwitchTexture(line_t *line,int useAgain);
void P_InitSwitchList(void);
/*
===============================================================================
P_PLATS
===============================================================================
*/
typedef enum
{
up,
down,
waiting,
in_stasis
} plat_e;
typedef enum
{
perpetualRaise,
downWaitUpStay,
raiseAndChange,
raiseToNearestAndChange,
blazeDWUS
} plattype_e;
typedef struct
{
thinker_t thinker;
sector_t *sector;
fixed_t speed;
fixed_t low;
fixed_t high;
int wait;
int count;
plat_e status;
plat_e oldstatus;
boolean crush;
int tag;
plattype_e type;
} plat_t;
#define PLATWAIT 3 /* seconds */
#define PLATSPEED (FRACUNIT*2)
#define MAXPLATS 30
extern plat_t *activeplats[MAXPLATS];
void T_PlatRaise(plat_t *plat);
int EV_DoPlat(line_t *line,plattype_e type,int amount);
void P_AddActivePlat(plat_t *plat);
void P_RemoveActivePlat(plat_t *plat);
void EV_StopPlat(line_t *line);
void P_ActivateInStasis(int tag);
/*
===============================================================================
P_DOORS
===============================================================================
*/
typedef enum
{
Normal,
Close30ThenOpen,
Close,
Open,
RaiseIn5Mins,
BlazeRaise,
BlazeOpen,
BlazeClose
} vldoor_e;
typedef struct
{
thinker_t thinker;
vldoor_e type;
sector_t *sector;
fixed_t topheight;
fixed_t speed;
int direction; /* 1 = up, 0 = waiting at top, -1 = down */
int topwait; /* tics to wait at the top */
/* (keep in case a door going down is reset) */
int topcountdown; /* when it reaches 0, start going down */
} vldoor_t;
#define VDOORSPEED FRACUNIT*6
#define VDOORWAIT 70
void EV_VerticalDoor (line_t *line, mobj_t *thing);
boolean P_CheckKeyLock(line_t *line, mobj_t *thing); // Psx Doom New
int EV_DoDoor (line_t *line, vldoor_e type);
void T_VerticalDoor (vldoor_t *door);
void P_SpawnDoorCloseIn30 (sector_t *sec);
void P_SpawnDoorRaiseIn5Mins (sector_t *sec, int secnum);
/*
===============================================================================
P_CEILNG
===============================================================================
*/
typedef enum
{
lowerToFloor,
raiseToHighest,
lowerAndCrush,
crushAndRaise,
fastCrushAndRaise,
silentCrushAndRaise,
} ceiling_e;
typedef struct
{
thinker_t thinker;
ceiling_e type;
sector_t *sector;
fixed_t bottomheight, topheight;
fixed_t speed;
boolean crush;
int direction; /* 1 = up, 0 = waiting, -1 = down */
int tag; /* ID */
int olddirection;
} ceiling_t;
#define CEILSPEED FRACUNIT*2
#define MAXCEILINGS 30
extern ceiling_t *activeceilings[MAXCEILINGS];
int EV_DoCeiling (line_t *line, ceiling_e type);
void T_MoveCeiling (ceiling_t *ceiling);
void P_AddActiveCeiling(ceiling_t *c);
void P_RemoveActiveCeiling(ceiling_t *c);
int EV_CeilingCrushStop(line_t *line);
void P_ActivateInStasisCeiling(line_t *line);
/*
===============================================================================
P_FLOOR
===============================================================================
*/
typedef enum
{
lowerFloor, /* lower floor to highest surrounding floor */
lowerFloorToLowest, /* lower floor to lowest surrounding floor */
turboLower, /* lower floor to highest surrounding floor VERY FAST */
raiseFloor, /* raise floor to lowest surrounding CEILING */
raiseFloorToNearest, /* raise floor to next highest surrounding floor */
raiseToTexture, /* raise floor to shortest height texture around it */
lowerAndChange, /* lower floor to lowest surrounding floor and change */
/* floorpic */
raiseFloor24,
raiseFloor24AndChange,
raiseFloorCrush,
donutRaise
} floor_e;
typedef enum
{
build8, // slowly build by 8
turbo16 // quickly build by 16
} stair_e;
typedef struct
{
thinker_t thinker;
floor_e type;
boolean crush;
sector_t *sector;
int direction;
int newspecial;
short texture;
fixed_t floordestheight;
fixed_t speed;
} floormove_t;
#define FLOORSPEED FRACUNIT*3
typedef enum
{
ok,
crushed,
pastdest
} result_e;
result_e T_MovePlane(sector_t *sector,fixed_t speed,
fixed_t dest,boolean crush,int floorOrCeiling,int direction);
int EV_BuildStairs(line_t *line, stair_e type);
int EV_DoFloor(line_t *line,floor_e floortype);
void T_MoveFloor(floormove_t *floor);
/*
===============================================================================
P_TELEPT
===============================================================================
*/
int EV_Teleport( line_t *line,mobj_t *thing );
================================================
FILE: PSXDOOM/p_switch.c
================================================
#include "doomdef.h"
#include "p_local.h"
/*================================================================== */
/* */
/* CHANGE THE TEXTURE OF A WALL SWITCH TO ITS OPPOSITE */
/* */
/*================================================================== */
#define numswitches 49
switchlist_t alphSwitchList[numswitches] = //80067234
{
{ "SW1BMET", "SW2BMET" },
{ "SW1BRICK", "SW2BRICK" },
{ "SW1BRNZ", "SW2BRNZ" },
{ "SW1BROWN", "SW2BROWN" },
{ "SW1MARB", "SW2MARB" },
{ "SW1MET", "SW2MET" },
{ "SW1METAL", "SW2METAL" },
{ "SW1NEW02", "SW2NEW02" },
{ "SW1NEW03", "SW2NEW03" },
{ "SW1NEW04", "SW2NEW04" },
{ "SW1NEW05", "SW2NEW05" },
{ "SW1NEW06", "SW2NEW06" },
{ "SW1NEW10", "SW2NEW10" },
{ "SW1NEW11", "SW2NEW11" },
{ "SW1NEW13", "SW2NEW13" },
{ "SW1NEW14", "SW2NEW14" },
{ "SW1NEW20", "SW2NEW20" },
{ "SW1NEW25", "SW2NEW25" },
{ "SW1NEW26", "SW2NEW26" },
{ "SW1NEW28", "SW2NEW28" },
{ "SW1NEW29", "SW2NEW29" },
{ "SW1NEW30", "SW2NEW30" },
{ "SW1NEW31", "SW2NEW31" },
{ "SW1NEW32", "SW2NEW32" },
{ "SW1NEW33", "SW2NEW33" },
{ "SW1NEW34", "SW2NEW34" },
{ "SW1NEW35", "SW2NEW35" },
{ "SW1NEW36", "SW2NEW36" },
{ "SW1NEW39", "SW2NEW39" },
{ "SW1NEW40", "SW2NEW40" },
{ "SW1NEW41", "SW2NEW41" },
{ "SW1NEW42", "SW2NEW42" },
{ "SW1NEW45", "SW2NEW45" },
{ "SW1NEW46", "SW2NEW46" },
{ "SW1NEW47", "SW2NEW47" },
{ "SW1NEW51", "SW2NEW51" },
{ "SW1NEW57", "SW2NEW57" },
{ "SW1NEW60", "SW2NEW60" },
{ "SW1NEW63", "SW2NEW63" },
{ "SW1NEW65", "SW2NEW65" },
{ "SW1NEW66", "SW2NEW66" },
{ "SW1NEW68", "SW2NEW68" },
{ "SW1NEW69", "SW2NEW69" },
{ "SW1NEW70", "SW2NEW70" },
{ "SW1RED", "SW2RED" },
{ "SW1RUST", "SW2RUST" },
{ "SW1SKULL", "SW2SKULL" },
{ "SW1STAR", "SW2STAR" },
{ "SW1STEEL", "SW2STEEL" },
};
//int switchlist[MAXSWITCHES * 2];//80097424
//int numswitches;
//button_t buttonlist[MAXBUTTONS];//800975B0
/*
===============
=
= P_InitSwitchList
=
= Only called at game initialization
=
===============
*/
void P_InitSwitchList(void)//L80027C64()
{
int i;
int index;
int tex1, tex2;
//numswitches = sizeof(alphSwitchList)/sizeof(alphSwitchList[0]);
for (index = 0,i = 0;i < numswitches;i++)
{
//if (!alphSwitchList[i].name1[0])
//break;
tex1 = R_TextureNumForName(alphSwitchList[i].name1);
tex2 = R_TextureNumForName(alphSwitchList[i].name2);
if (textures[tex1].vtpage != 0 && textures[tex2].vtpage == 0)
TextureCache(&textures[tex2]);
if (textures[tex2].vtpage != 0 && textures[tex1].vtpage == 0)
TextureCache(&textures[tex1]);
switchlist[index] = tex1;
index++;
switchlist[index] = tex2;
index++;
}
//switchlist[index] = -1;
}
/*================================================================== */
/* */
/* Start a button counting down till it turns off. */
/* */
/*================================================================== */
void P_StartButton(line_t *line,bwhere_e w,int texture,int time)//80027D88
{
int i;
for (i = 0;i < MAXBUTTONS;i++)
{
if (buttonlist[i].btimer == 0)
{
buttonlist[i].line = line;
buttonlist[i].where = w;
buttonlist[i].btexture = texture;
buttonlist[i].btimer = time;
buttonlist[i].soundorg = (mobj_t *)&line->frontsector->soundorg;
return;
}
}
//I_Error("P_StartButton: no button slots left!");
}
/*================================================================== */
/* */
/* Function that changes wall texture. */
/* Tell it if switch is ok to use again (1=yes, it's a button). */
/* */
/*================================================================== */
void P_ChangeSwitchTexture(line_t *line,int useAgain)//L80027E1C()
{
int texTop;
int texMid;
int texBot;
int i;
int sound;
if (!useAgain)
line->special = 0;
texTop = sides[line->sidenum[0]].toptexture;
texMid = sides[line->sidenum[0]].midtexture;
texBot = sides[line->sidenum[0]].bottomtexture;
sound = sfx_swtchn;
if (line->special == 11) /* EXIT SWITCH? */
sound = sfx_swtchx;
for (i = 0;i < numswitches*2;i++)
{
if (switchlist[i] == texTop)
{
S_StartSound(buttonlist->soundorg,sound);
sides[line->sidenum[0]].toptexture = switchlist[i^1];
if (useAgain)
P_StartButton(line,top,switchlist[i],BUTTONTIME);
return;
}
else if (switchlist[i] == texMid)
{
S_StartSound(buttonlist->soundorg,sound);
sides[line->sidenum[0]].midtexture = switchlist[i^1];
if (useAgain)
P_StartButton(line, middle,switchlist[i],BUTTONTIME);
return;
}
else if (switchlist[i] == texBot)
{
S_StartSound(buttonlist->soundorg,sound);
sides[line->sidenum[0]].bottomtexture = switchlist[i^1];
if (useAgain)
P_StartButton(line, bottom,switchlist[i],BUTTONTIME);
return;
}
}
}
/*
==============================================================================
=
= P_UseSpecialLine
=
= Called when a thing uses a special line
= Only the front sides of lines are usable
===============================================================================
*/
boolean P_UseSpecialLine ( mobj_t *thing, line_t *line)//L8002810C()
{
/* */
/* Switches that other things can activate */
/* */
if (!thing->player)
{
if (line->flags & ML_SECRET)
return false; /* never open secret doors */
switch(line->special)
{
case 1: /* MANUAL DOOR RAISE */
/* case 32: // MANUAL BLUE */
/* case 33: // MANUAL RED */
/* case 34: // MANUAL YELLOW */
break;
default:
return false;
}
}
/* */
/* do something */
/* */
switch (line->special)
{
/*=============================================== */
/* MANUALS */
/*=============================================== */
case 26: /* Blue Door Raise */
case 27: /* Yellow Door Raise */
case 28: /* Red Door Raise */
case 32: /* Blue Door Open */
case 33: /* Red Door Open */
case 34: /* Yellow Door open */
if (P_CheckKeyLock(line,thing))
EV_VerticalDoor(line, thing);
break;
case 1: /* Vertical Door */
case 31: /* Manual Door Open */
case 117: /* Blazing Door Raise */
case 118: /* Blazing Door Open */
EV_VerticalDoor(line, thing);
break;
case 99: /* Blue Blazing Door Open */
case 134: /* Red Blazing Door Open */
case 136: /* Yellow Blazing Door open */
if (P_CheckKeyLock(line,thing))
{
if (EV_DoDoor(line, BlazeOpen))
P_ChangeSwitchTexture(line, 1);
}
break;
case 133: /* Blue Blazing Door Open */
case 135: /* Red Blazing Door Open */
case 137: /* Yellow Blazing Door open */
if (P_CheckKeyLock(line,thing))
{
if (EV_DoDoor(line, BlazeOpen))
P_ChangeSwitchTexture(line, 1);//[GEC] Bug?? DoomPc is 0
}
break;
/*=============================================== */
/* BUTTONS */
/*=============================================== */
case 42: /* Close Door */
if (EV_DoDoor(line, Close))
P_ChangeSwitchTexture(line, 1);
break;
case 43: /* Lower Ceiling to Floor */
if (EV_DoCeiling(line, lowerToFloor))
P_ChangeSwitchTexture(line, 1);
break;
case 45: /* Lower Floor to Surrounding floor height */
if (EV_DoFloor(line, lowerFloor))
P_ChangeSwitchTexture(line, 1);
break;
case 60: /* Lower Floor to Lowest */
if (EV_DoFloor(line, lowerFloorToLowest))
P_ChangeSwitchTexture(line, 1);
break;
case 61: /* Open Door */
if (EV_DoDoor(line, Open))
P_ChangeSwitchTexture(line, 1);
break;
case 62: /* PlatDownWaitUpStay */
if (EV_DoPlat(line, downWaitUpStay, 1))
P_ChangeSwitchTexture(line, 1);
break;
case 63: /* Raise Door */
if (EV_DoDoor(line, Normal))
P_ChangeSwitchTexture(line, 1);
break;
case 64: /* Raise Floor to ceiling */
if (EV_DoFloor(line, raiseFloor))
P_ChangeSwitchTexture(line, 1);
break;
case 65: /* Raise Floor Crush */
if (EV_DoFloor(line, raiseFloorCrush))
P_ChangeSwitchTexture(line, 1);
break;
case 66: /* Raise Floor 24 and change texture */
if (EV_DoPlat(line, raiseAndChange, 24))
P_ChangeSwitchTexture(line, 1);
break;
case 67: /* Raise Floor 32 and change texture */
if (EV_DoPlat(line, raiseAndChange, 32))
P_ChangeSwitchTexture(line, 1);
break;
case 68: /* Raise Plat to next highest floor and change texture */
if (EV_DoPlat(line, raiseToNearestAndChange, 0))
P_ChangeSwitchTexture(line, 1);
break;
case 69: /* Raise Floor to next highest floor */
if (EV_DoFloor(line, raiseFloorToNearest))
P_ChangeSwitchTexture(line, 1);
break;
case 70: /* Turbo Lower Floor */
if (EV_DoFloor(line, turboLower))
P_ChangeSwitchTexture(line, 1);
break;
case 114: /* Blazing Door Raise (faster than TURBO!) */
if (EV_DoDoor(line, BlazeRaise))
P_ChangeSwitchTexture(line, 1);
break;
case 115: /* Blazing Door Open (faster than TURBO!) */
if (EV_DoDoor(line, BlazeOpen))
P_ChangeSwitchTexture(line, 1);
break;
case 116: /* Blazing Door Close (faster than TURBO!) */
if (EV_DoDoor(line, BlazeClose))
P_ChangeSwitchTexture(line, 1);
break;
case 123: /* Blazing PlatDownWaitUpStay */
if (EV_DoPlat(line, blazeDWUS, 0))
P_ChangeSwitchTexture(line, 1);
break;
case 138: /* Light Turn On */
EV_LightTurnOn(line, 255);
P_ChangeSwitchTexture(line, 1);
break;
case 139: /* Light Turn Off */
EV_LightTurnOn(line, 35);
P_ChangeSwitchTexture(line, 1);
break;
/*=============================================== */
/* SWITCHES */
/*=============================================== */
case 7: /* Build Stairs */
if (EV_BuildStairs(line, build8))
P_ChangeSwitchTexture(line, 0);
break;
case 9: /* Change Donut */
if (EV_DoDonut(line))
P_ChangeSwitchTexture(line, 0);
break;
case 11: /* Exit level */
P_ExitLevel();
P_ChangeSwitchTexture(line, 0);
break;
case 14: /* Raise Floor 32 and change texture */
if (EV_DoPlat(line, raiseAndChange, 32))
P_ChangeSwitchTexture(line, 0);
break;
case 15: /* Raise Floor 24 and change texture */
if (EV_DoPlat(line, raiseAndChange, 24))
P_ChangeSwitchTexture(line, 0);
break;
case 18: /* Raise Floor to next highest floor */
if (EV_DoFloor(line, raiseFloorToNearest))
P_ChangeSwitchTexture(line, 0);
break;
case 20: /* Raise Plat next highest floor and change texture */
if (EV_DoPlat(line, raiseToNearestAndChange, 0))
P_ChangeSwitchTexture(line, 0);
break;
case 21: /* PlatDownWaitUpStay */
if (EV_DoPlat(line, downWaitUpStay, 0))
P_ChangeSwitchTexture(line, 0);
break;
case 23: /* Lower Floor to Lowest */
if (EV_DoFloor(line, lowerFloorToLowest))
P_ChangeSwitchTexture(line, 0);
break;
case 29: /* Raise Door */
if (EV_DoDoor(line, Normal))
P_ChangeSwitchTexture(line, 0);
break;
case 41: /* Lower Ceiling to Floor */
if (EV_DoCeiling(line, lowerToFloor))
P_ChangeSwitchTexture(line, 0);
break;
case 49: /* Ceiling Crush And Raise */
if (EV_DoCeiling(line, crushAndRaise))
P_ChangeSwitchTexture(line, 0);
break;
case 50: /* Close Door */
if (EV_DoDoor(line, Close))
P_ChangeSwitchTexture(line, 0);
break;
case 51: /* Secret EXIT */
P_SecretExitLevel(line->tag);
P_ChangeSwitchTexture(line, 0);
break;
case 55: /* Raise Floor Crush */
if (EV_DoFloor(line, raiseFloorCrush))
P_ChangeSwitchTexture(line, 0);
break;
case 71: /* Turbo Lower Floor */
if (EV_DoFloor(line, turboLower))
P_ChangeSwitchTexture(line, 0);
break;
case 101: /* Raise Floor */
if (EV_DoFloor(line, raiseFloor))
P_ChangeSwitchTexture(line, 0);
break;
case 102: /* Lower Floor to Surrounding floor height */
if (EV_DoFloor(line, lowerFloor))
P_ChangeSwitchTexture(line, 0);
break;
case 103: /* Open Door */
if (EV_DoDoor(line, Open))
P_ChangeSwitchTexture(line, 0);
break;
case 111: /* Blazing Door Raise (faster than TURBO!) */
if (EV_DoDoor(line, BlazeRaise))
P_ChangeSwitchTexture(line, 0);
break;
case 112: /* Blazing Door Open (faster than TURBO!) */
if (EV_DoDoor(line, BlazeOpen))
P_ChangeSwitchTexture(line, 0);
break;
case 113: /* Blazing Door Close (faster than TURBO!) */
if (EV_DoDoor(line, BlazeClose))
P_ChangeSwitchTexture(line, 0);
break;
case 122: /* Blazing PlatDownWaitUpStay */
if (EV_DoPlat(line, blazeDWUS, 0))
P_ChangeSwitchTexture(line, 0);
break;
case 127: /* Build Stairs Turbo 16 */
if (EV_BuildStairs(line, turbo16))
P_ChangeSwitchTexture(line, 0);
break;
}
return true;
}
================================================
FILE: PSXDOOM/p_telept.c
================================================
#include "doomdef.h"
#include "p_local.h"
/*
==============
=
= P_Telefrag
=
= Kill all monsters around the given spot
=
==============
*/
//inline
void P_Telefrag (mobj_t *thing, fixed_t x, fixed_t y)//L80028700()
{
int delta;
int size;
mobj_t *m;
for (m=mobjhead.next ; m != &mobjhead ; m=m->next)
{
if (!(m->flags & MF_SHOOTABLE) )
continue; /* not shootable */
size = m->radius + thing->radius + 4*FRACUNIT;
delta = m->x - x;
if (delta < - size || delta > size)
continue;
delta = m->y - y;
if (delta < -size || delta > size)
continue;
P_DamageMobj (m, thing, thing, 10000);
m->flags &= ~(MF_SOLID|MF_SHOOTABLE);
}
}
/*================================================================== */
/* */
/* TELEPORTATION */
/* */
/*================================================================== */
int EV_Teleport( line_t *line,mobj_t *thing )//L800287F8()
{
int i;
int tag;
boolean flag;
mobj_t *m,*fog;
unsigned an;
sector_t *sector;
fixed_t oldx, oldy, oldz;
int side;
//printf("EV_Teleport\n");
side = !P_PointOnLineSide (thing->x, thing->y, line);
if (thing->flags & MF_MISSILE)
return 0; /* don't teleport missiles */
if (side == 1) /* don't teleport if hit back of line, */
return 0; /* so you can get out of teleporter */
tag = line->tag;
for (i = 0; i < numsectors; i++)
{
if (sectors[ i ].tag == tag )
{
for (m=mobjhead.next ; m != &mobjhead ; m=m->next)
{
if (m->type != MT_TELEPORTMAN )
continue; /* not a teleportman */
//sector = (m->subsector->sector - sectors) * (int)(0xE9BD37A7);
//if ((sector >> 2) != i)
//if((*(int *)m->subsector - (int)sectors) * -0x1642c859 >> 2 == i)
sector = m->subsector->sector;
if(sector-sectors != i )
continue; /* wrong sector */
oldx = thing->x;
oldy = thing->y;
oldz = thing->z;
thing->flags |= MF_TELEPORT;
numthingspec = 0;
if (thing->player)
P_Telefrag (thing, m->x, m->y);
flag = P_TryMove (thing, m->x, m->y);
thing->flags &= ~MF_TELEPORT;
if (!flag)
return 0; /* move is blocked */
thing->z = thing->floorz;
/* spawn teleport fog at source and destination */
fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
S_StartSound (fog, sfx_telept);
an = m->angle >> ANGLETOFINESHIFT;
fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
, thing->z, MT_TFOG);
S_StartSound (fog, sfx_telept);
if (thing->player)
thing->reactiontime = 9; /* don't move for a bit */ //[psx] changed to 9
thing->angle = m->angle;
thing->momx = thing->momy = thing->momz = 0;
return 1;
}
}
}
return 0;
}
================================================
FILE: PSXDOOM/p_tick.c
================================================
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
int playertics, thinkertics, sighttics, basetics, latetics;
int tictics;
boolean gamepaused; //80077CEC, iGp000008dc
//jagobj_t *pausepic;
/*
===============================================================================
THINKERS
All thinkers should be allocated by Z_Malloc so they can be operated on uniformly. The actual
structures will vary in size, but the first element must be thinker_t.
Mobjs are similar to thinkers, but kept seperate for more optimal list
processing
===============================================================================
*/
//thinker_t thinkercap; /* both the head and tail of the thinker list */ //80096378
//mobj_t mobjhead; /* head and tail of mobj list */ //800A8C74,
int activethinkers; /* debug count */ //80078118, iGp00000d08
int activemobjs; /* debug count */
/*
===============
=
= P_InitThinkers
=
===============
*/
#if 0
void P_InitThinkers (void)
{
thinkercap.prev = thinkercap.next = &thinkercap;
mobjhead.next = mobjhead.prev = &mobjhead;
}
#endif // 0
/*
===============
=
= P_AddThinker
=
= Adds a new thinker at the end of the list
=
===============
*/
void P_AddThinker (thinker_t *thinker)//L80028B18()
{
thinkercap.prev->next = thinker;
thinker->next = &thinkercap;
thinker->prev = thinkercap.prev;
thinkercap.prev = thinker;
}
/*
===============
=
= P_RemoveThinker
=
= Deallocation is lazy -- it will not actually be freed until its
= thinking turn comes up
=
===============
*/
void P_RemoveThinker (thinker_t *thinker)//L80028B48()
{
thinker->function = (think_t)-1;
}
/*
===============
=
= P_RunThinkers
=
===============
*/
//inline
void P_RunThinkers (void)//L80028B54()
{
thinker_t *currentthinker;
activethinkers = 0;
currentthinker = thinkercap.next;
if (thinkercap.next != &thinkercap)
{
while (currentthinker != &thinkercap)
{
if (currentthinker->function == (think_t)-1)
{ // time to remove it
currentthinker->next->prev = currentthinker->prev;
currentthinker->prev->next = currentthinker->next;
Z_Free (currentthinker);
}
else
{
if (currentthinker->function)
{
currentthinker->function (currentthinker);
}
activethinkers++;
}
currentthinker = currentthinker->next;
}
}
}
/*
===================
=
= P_RunMobjLate
=
= Run stuff that doesn't happen every tick
===================
*/
//inline
void P_RunMobjLate (void)//L80028C10()
{
mobj_t *mo;
mobj_t *next;
for (mo=mobjhead.next ; mo != &mobjhead ; mo=next)
{
next = mo->next; /* in case mo is removed this time */
if (mo->latecall)
{
mo->latecall(mo);
}
}
}
/*
==============
=
= P_CheckCheats
=
==============
*/
int codepos; //80077E10, iGp00000a00
short codetmp[8]; //800a8f88
int m_vframe1[MAXPLAYERS]; //80077D24
int cht_ticon; //800780FC
int warpmap; //80078094, iGp00000c84
int Vram_page; //80077D00, iGp000008f0
typedef enum
{
CH_ALLLINES, //0
CH_ALLTHINGS, //1
CH_GODMODE, //2
CH_AMMOWEAPONS, //3
CH_NOCLIP, //4 Enabled in Station Doom
CH_WARPLEVEL, //5
CH_NULL2, //6
CH_VRAMVIEWER, //7 Enabled in GEC Master Edition
CH_NULL3, //8
CH_X_RAY, //9
CH_NULL4, //10
CH_NULL5, //11
NUMCHEATS
} cheatnum_t;
short cheatcodes[NUMCHEATS][8] = //800675A8
{
{ PAD_TRIANGLE, PAD_TRIANGLE, PAD_L2, PAD_R2, PAD_L2, PAD_R2, PAD_R1, PAD_SQUARE },
{ PAD_TRIANGLE, PAD_TRIANGLE, PAD_L2, PAD_R2, PAD_L2, PAD_R2, PAD_R1, PAD_CIRCLE },
{ PAD_DOWN, PAD_L2, PAD_SQUARE, PAD_R1, PAD_RIGHT, PAD_L1, PAD_LEFT, PAD_CIRCLE },
{ PAD_CROSS, PAD_TRIANGLE, PAD_L1, PAD_UP, PAD_DOWN, PAD_R2, PAD_LEFT, PAD_LEFT },
{ PAD_UP, PAD_UP, PAD_UP, PAD_UP, PAD_UP, PAD_UP, PAD_UP, PAD_R1 },
{ PAD_RIGHT, PAD_LEFT, PAD_R2, PAD_R1, PAD_TRIANGLE, PAD_L1, PAD_CIRCLE, PAD_CROSS },
{ PAD_LEFT, PAD_LEFT, PAD_LEFT, PAD_LEFT, PAD_LEFT, PAD_LEFT, PAD_LEFT, PAD_LEFT },
{ PAD_TRIANGLE, PAD_SQUARE, PAD_UP, PAD_LEFT, PAD_DOWN, PAD_RIGHT, PAD_CROSS, PAD_CIRCLE },
{ PAD_CROSS, PAD_CROSS, PAD_CROSS, PAD_CROSS, PAD_CROSS, PAD_CROSS, PAD_CROSS, PAD_CROSS },
{ PAD_L1, PAD_R2, PAD_L2, PAD_R1, PAD_RIGHT, PAD_TRIANGLE, PAD_CROSS, PAD_RIGHT },
{ PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE },
{ PAD_SQUARE, PAD_SQUARE, PAD_SQUARE, PAD_SQUARE, PAD_SQUARE, PAD_SQUARE, PAD_SQUARE, PAD_SQUARE },
};
void P_CheckCheats (void)//L80028C74()
{
int buttons, oldbuttons;
int i, j;
int action;
player_t *p;
mobj_t *m;
for (i=(MAXPLAYERS-1) ; i >= 0 ; i--)
{
if (!playeringame[i])
continue;
buttons = ticbuttons[i];
oldbuttons = oldticbuttons[i];
if ((buttons & PAD_START) && !(oldbuttons & PAD_START))
{
gamepaused ^= 1;
if (gamepaused)
{
psxcd_pause();
#if GH_UPDATES == 1
//Only PSX (FINAL DOOM / DOOM Greatest Hits)
wess_seq_stop(sfx_sawful);
wess_seq_stop(sfx_sawhit);
#endif // GH_UPDATES
S_Pause();
codepos = 0;
cht_ticon = ticon;
return;
}
psxcd_restart(0);
do {} while (psxcd_seeking_for_play() != 0);
psxspu_start_cd_fade((FADE_TIME*2), CDVolume);
S_Resume();
players[0].cheats &= ~(CF_WARPLEVEL | CF_VRAMVIEWER);
ticon = cht_ticon;
ticsinframe = cht_ticon >> 2;
}
p = &players[i];
if (((buttons & PAD_SELECT) && !(oldbuttons & PAD_SELECT)) && gamepaused)
{
p->cheats &= ~(CF_WARPLEVEL | CF_VRAMVIEWER);
DrawRender();
action = MiniLoop(O_Start,O_Stop,O_Ticker,O_Drawer);
if(action == ga_exit)
return;
gameaction = action;
if (gameaction == ga_restart || gameaction == ga_exitdemo)
{
O_Drawer();
return;
}
}
}
if (netgame != gt_single)
return;
if (buttons == 0)
m_vframe1[0] = 0;
if (p->cheats & CF_WARPLEVEL)
{
m_vframe1[0] -= vblsinframe[0];
if (m_vframe1[0] <= 0)
{
if (buttons & PAD_LEFT)
{
warpmap -= 1;
if (warpmap <= 0)
warpmap = 1;
m_vframe1[0] = TICRATE;
}
else if (buttons & PAD_RIGHT)
{
warpmap += 1;
if (warpmap >= 55)
warpmap = 54;
m_vframe1[0] = TICRATE;
}
}
if ((buttons != oldbuttons) && (buttons & PAD_ACTION))
{
gameaction = ga_warped;
p->cheats &= ~CF_WARPLEVEL;
gamemap = startmap = warpmap;
}
return;
}
if (p->cheats & CF_VRAMVIEWER)
{
if (buttons != oldbuttons)
{
if (buttons & PAD_LEFT)
{
Vram_page -= 1;
if (Vram_page < 0)
Vram_page = 0;
}
else if (buttons & PAD_RIGHT)
{
Vram_page += 1;
if (Vram_page >= MAX_DYNAMIC_TPAGE)
Vram_page = (MAX_DYNAMIC_TPAGE-1);
}
}
return;
}
if (!gamepaused)
return;
if (buttons == 0)
return;
if (buttons == oldbuttons)
return;
codetmp[codepos] = buttons;
codepos += 1;
//Check code
for (i = 0; i < NUMCHEATS; i++)
{
for (j = 0; j < codepos; j++)
{
if (cheatcodes[i][j] != codetmp[j])
break;
}
//Cycle Code Complete
if (j >= 8)
{
switch (i)// Get case number
{
case CH_ALLLINES:
p->cheats ^= CF_ALLLINES;
stbar.messagedelay = 1;
if (p->cheats & CF_ALLLINES)
{
stbar.message = "Map All Lines ON.";
}
else
{
stbar.message = "Map All Lines OFF.";
}
break;
case CH_ALLTHINGS:
p->cheats ^= CF_ALLTHINGS;
stbar.messagedelay = 1;
if (p->cheats & CF_ALLTHINGS)
{
stbar.message = "Map All Things ON.";
}
else
{
stbar.message = "Map All Things OFF.";
}
break;
case CH_GODMODE:
p->cheats ^= CF_GODMODE;
stbar.messagedelay = 1;
if (p->cheats & CF_GODMODE)
{
stbar.message = "All Powerful Mode ON.";
p->health = 100;
p->mo->health = 100;
}
else
{
stbar.message = "All Powerful Mode OFF.";
}
break;
case CH_AMMOWEAPONS:
for (m = mobjhead.next; m != &mobjhead; m = m->next)
{
switch (m->type)
{
case MT_MISC4:
p->cards[it_bluecard] = true;
break;
case MT_MISC5:
p->cards[it_redcard] = true;
break;
case MT_MISC6:
p->cards[it_yellowcard] = true;
break;
case MT_MISC7:
p->cards[it_yellowskull] = true;
break;
case MT_MISC8:
p->cards[it_redskull] = true;
break;
case MT_MISC9:
p->cards[it_blueskull] = true;
break;
default:
break;
}
}
p->armorpoints = 200;
p->armortype = 2;
for (i = 0; iweaponowned[i] = true;}
for (i = 0; iammo[i] = p->maxammo[i];}
stbar.messagedelay = 1;
stbar.message = "Lots Of Goodies!";
break;
case CH_WARPLEVEL:
p->cheats |= CF_WARPLEVEL;
if (warpmap >= 55)
warpmap = 54;
else
warpmap = gamemap;
break;
case CH_X_RAY:
p->cheats ^= CF_X_RAY;
break;
case CH_VRAMVIEWER: //Enabled in [GEC] Master Edition
p->cheats ^= CF_VRAMVIEWER;
break;
case CH_NOCLIP: //Enabled in Station Doom
p->mo->flags ^= MF_NOCLIP;
stbar.messagedelay = 1;
if (p->mo->flags & MF_NOCLIP)
{
stbar.message = "No Clip ON.";
}
else
{
stbar.message = "No Clip OFF.";
}
break;
}
break;//break for i
}
}
i = codepos;
if (codepos < 0) i = codepos + 7;
codepos = codepos - ((i/8) * 8);
}
int playernum;//80078110, iGp00000d00
void G_DoReborn (int playernum);//extern
/*
=================
=
= P_Ticker
=
=================
*/
//int ticphase;
//psx doom new
int checkcount; //*L80077DE4
//extern functions
void P_CheckSights (void);
void P_RunMobjBase (void);
int P_Ticker (void)//800292E4
{
player_t *pl;
gameaction = ga_nothing;
//
// check for pause and cheats
//
P_CheckCheats();
if ((!gamepaused) && (gamevbls < gametic))
{
P_RunThinkers();
P_CheckSights();
P_RunMobjBase();
P_RunMobjLate();
P_UpdateSpecials();
P_RespawnSpecials();
ST_Ticker(); // update status bar
}
//
// run player actions
//
for (playernum = 0, pl = players; playernum < MAXPLAYERS; playernum++, pl++)
{
if (playeringame[playernum])
{
if (pl->playerstate == PST_REBORN)
{
G_DoReborn(playernum);
}
AM_Control(pl);
P_PlayerThink(pl);
}
}
return gameaction; // may have been set to ga_died, ga_completed, or ga_secretexit
}
/*
=============
=
= P_Drawer
=
= draw current display
=============
*/
void P_Drawer (void) //L800294CC()
{
NextTextureCacheIdx();
if (players[consoleplayer].automapflags & AF_ACTIVE)
AM_Drawer();
else
R_RenderPlayerView();
ST_Drawer();
UpdateDrawOTag();
}
//extern int ticremainder[2];
void P_Start (void)//L80029554()
{
gamepaused = false;
validcount = 1;
AM_Start();
M_ClearRandom();
disableload = true;
if (demoplayback)
psxcd_play_at_andloop(CD_TRACK[cdmusic_credits_demo],CDVolume,0,0,CD_TRACK[cdmusic_credits_demo],CDVolume,0,0);
else
S_StartMusic();
}
void P_Stop (int exit)//L800295EC()
{
int i;
DrawSync(0);
S_StopAll();
psxcd_stop();
S_StopMusic();
gamepaused = false;
disableload = false;
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
{
G_PlayerFinishLevel(i);
}
}
}
================================================
FILE: PSXDOOM/p_user.c
================================================
/* P_user.c */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
fixed_t forwardmove[2] = {0x40000, 0x60000};//80067668
fixed_t sidemove[2] = {0x38000, 0x58000}; //80067670
#define SLOWTURNTICS 10
fixed_t angleturn[] = //80067678
{300,300,500,500,600,700,800,900,900,1000};
fixed_t fastangleturn[] = //800676A0
{800,800,900,1000,1000,1200,1200,1300,1300,1400};
/*============================================================================= */
mobj_t *slidething; //80077D04, pmGp000008f4
extern fixed_t slidex, slidey; //80077dbc || 80077dc0
extern line_t *specialline; //80077dc8
void P_SlideMove ();
void P_PlayerMove (mobj_t *mo)//L80029670()
{
fixed_t momx, momy;
line_t *latchedline;
fixed_t latchedx, latchedy;
momx = vblsinframe[playernum] * (mo->momx>>2);
momy = vblsinframe[playernum] * (mo->momy>>2);
slidething = mo;
P_SlideMove ();
latchedline = (line_t *)specialline;
latchedx = slidex;
latchedy = slidey;
if ((latchedx == mo->x) && (latchedy == mo->y))
goto stairstep;
if (P_TryMove (mo, latchedx, latchedy))
goto dospecial;
stairstep:
if (momx > MAXMOVE)
momx = MAXMOVE;
else if (momx < -MAXMOVE)
momx = -MAXMOVE;
if (momy > MAXMOVE)
momy = MAXMOVE;
else if (momy < -MAXMOVE)
momy = -MAXMOVE;
/* something fucked up in slidemove, so stairstep */
if (P_TryMove (mo, mo->x, mo->y + momy))
{
mo->momx = 0;
mo->momy = momy;
goto dospecial;
}
if (P_TryMove (mo, mo->x + momx, mo->y))
{
mo->momx = momx;
mo->momy = 0;
goto dospecial;
}
mo->momx = mo->momy = 0;
dospecial:
if (latchedline)
P_CrossSpecialLine (latchedline, mo);
}
/*
===================
=
= P_PlayerXYMovement
=
===================
*/
#define STOPSPEED 0x1000
#define FRICTION 0xd200 //Jag 0xd240
//inline
void P_PlayerXYMovement (mobj_t *mo)//L800297E8()
{
P_PlayerMove (mo);
/* */
/* slow down */
/* */
if (mo->z > mo->floorz)
return; /* no friction when airborne */
if (mo->flags & MF_CORPSE)
if (mo->floorz != mo->subsector->sector->floorheight)
return; /* don't stop halfway off a step */
if (mo->momx > -STOPSPEED && mo->momx < STOPSPEED
&& mo->momy > -STOPSPEED && mo->momy < STOPSPEED)
{
mo->momx = 0;
mo->momy = 0;
}
else
{
mo->momx = (mo->momx>>8)*(FRICTION>>8);
mo->momy = (mo->momy>>8)*(FRICTION>>8);
}
}
/*
===============
=
= P_PlayerZMovement
=
===============
*/
//inline
void P_PlayerZMovement (mobj_t *mo)//L800298D8()
{
/* */
/* check for smooth step up */
/* */
if (mo->z < mo->floorz)
{
mo->player->viewheight -= (mo->floorz - mo->z);
mo->player->deltaviewheight = (VIEWHEIGHT - mo->player->viewheight) >> 2;
}
/* */
/* adjust height */
/* */
mo->z += mo->momz;
/* */
/* clip movement */
/* */
if (mo->z <= mo->floorz)
{ /* hit the floor */
if (mo->momz < 0)
{
if (mo->momz < -(GRAVITY*2)) /* squat down */
{
mo->player->deltaviewheight = mo->momz>>3;
S_StartSound (mo, sfx_oof);
}
mo->momz = 0;
}
mo->z = mo->floorz;
}
else
{
if (mo->momz == 0)
mo->momz = -GRAVITY;
else
mo->momz -= (GRAVITY/2);
}
if (mo->z + mo->height > mo->ceilingz)
{ /* hit the ceiling */
if (mo->momz > 0)
mo->momz = 0;
mo->z = mo->ceilingz - mo->height;
}
}
/*
================
=
= P_PlayerMobjThink
=
================
*/
void P_PlayerMobjThink (mobj_t *mobj)//L80029A08()
{
state_t *st;
int state;
/* */
/* momentum movement */
/* */
if (mobj->momx || mobj->momy)
P_PlayerXYMovement (mobj);
if ( (mobj->z != mobj->floorz) || mobj->momz)
P_PlayerZMovement (mobj);
/* */
/* cycle through states, calling action functions at transitions */
/* */
if (mobj->tics == -1)
return; /* never cycle */
mobj->tics--;
if (mobj->tics > 0)
return; /* not time to cycle yet */
state = mobj->state->nextstate;
st = &states[state];
mobj->state = st;
mobj->tics = st->tics;
mobj->sprite = st->sprite;
mobj->frame = st->frame;
}
/*============================================================================= */
/*
====================
=
= P_BuildMove
=
====================
*/
void P_BuildMove (player_t *player) //L80029CA4()
{
int speed;
int buttons, oldbuttons;
mobj_t *mo;
buttons_t *cbutton;
fixed_t ForwardMove, SideMove;
angle_t AngleTurn;
cbutton = BT_DATA[playernum];
buttons = ticbuttons[playernum];
oldbuttons = oldticbuttons[playernum];
speed = (buttons & cbutton->BT_SPEED) > 0;
/* */
/* use two stage accelerative turning on the joypad */
/* */
if (((buttons & PAD_LEFT) && (oldbuttons & PAD_LEFT)) || ((buttons & PAD_RIGHT) && (oldbuttons & PAD_RIGHT)))
player->turnheld++;
else
player->turnheld = 0;
if (player->turnheld >= SLOWTURNTICS)
player->turnheld = SLOWTURNTICS-1;
player->forwardmove = player->sidemove = player->angleturn = 0;
if (buttons & cbutton->BT_STRAFELEFT)
{
SideMove = -vblsinframe[playernum] * sidemove[speed];
if (SideMove < 0) { SideMove += 3; }
player->sidemove = (SideMove >> 2);
}
else if (buttons & cbutton->BT_STRAFERIGHT)
{
SideMove = vblsinframe[playernum] * sidemove[speed];
if (SideMove < 0) { SideMove += 3; }
player->sidemove = (SideMove >> 2);
}
if (buttons & cbutton->BT_STRAFE)
{
if (buttons & PAD_LEFT)
{
SideMove = -vblsinframe[playernum] * sidemove[speed];
if (SideMove < 0) { SideMove += 3; }
player->sidemove = (SideMove >> 2);
}
else if (buttons & PAD_RIGHT)
{
SideMove = vblsinframe[playernum] * sidemove[speed];
if (SideMove < 0) { SideMove += 3; }
player->sidemove = (SideMove >> 2);
}
}
else
{
if (speed && !(buttons & (PAD_UP| PAD_DOWN)))
{
if (buttons & PAD_LEFT)
{
AngleTurn = vblsinframe[playernum] * fastangleturn[player->turnheld];
if (AngleTurn < 0) { AngleTurn += 3; }
AngleTurn >>= 2;
player->angleturn = AngleTurn << 17;
}
else if (buttons & PAD_RIGHT)
{
AngleTurn = vblsinframe[playernum] * fastangleturn[player->turnheld];
if (AngleTurn < 0) { AngleTurn += 3; }
AngleTurn >>= 2;
player->angleturn = -AngleTurn << 17;
}
}
else
{
if (buttons & PAD_LEFT)
{
AngleTurn = vblsinframe[playernum] * angleturn[player->turnheld];
if (AngleTurn < 0) { AngleTurn += 3; }
AngleTurn >>= 2;
player->angleturn = AngleTurn << 17;
}
else if (buttons & PAD_RIGHT)
{
AngleTurn = vblsinframe[playernum] * angleturn[player->turnheld];
if (AngleTurn < 0) { AngleTurn += 3; }
AngleTurn >>= 2;
player->angleturn = -AngleTurn << 17;
}
}
}
if (buttons & PAD_UP)
{
ForwardMove = vblsinframe[playernum] * forwardmove[speed];
if (ForwardMove < 0) { ForwardMove += 3; }
player->forwardmove = (ForwardMove >> 2);
}
else if (buttons & PAD_DOWN)
{
ForwardMove = -vblsinframe[playernum] * forwardmove[speed];
if (ForwardMove < 0) { ForwardMove += 3; }
player->forwardmove = (ForwardMove >> 2);
}
/* */
/* if slowed down to a stop, change to a standing frame */
/* */
mo = player->mo;
if (!mo->momx && !mo->momy && player->forwardmove == 0 && player->sidemove == 0 )
{ /* if in a walking frame, stop moving */
if (mo->state == &states[S_PLAY_RUN1]
|| mo->state == &states[S_PLAY_RUN2]
|| mo->state == &states[S_PLAY_RUN3]
|| mo->state == &states[S_PLAY_RUN4])
P_SetMobjState (mo, S_PLAY);
}
}
/*
===============================================================================
movement
===============================================================================
*/
#define MAXBOB 0x100000 /* 16 pixels of bob */
boolean onground;//80077FF4, iGp00000be4
/*
==================
=
= P_Thrust
=
= moves the given origin along a given angle
=
==================
*/
//inline
void P_Thrust (player_t *player, angle_t angle, fixed_t move) //L8002A188()
{
angle >>= ANGLETOFINESHIFT;
player->mo->momx += (move >> 8)*(finecosine[angle] >> 8);
player->mo->momy += (move >> 8)*(finesine[angle] >> 8);
}
/*
==================
=
= P_CalcHeight
=
= Calculate the walking / running height adjustment
=
==================
*/
void P_CalcHeight (player_t *player) //L8002A1FC()
{
int angle;
fixed_t bob;
fixed_t val;
/* */
/* regular movement bobbing (needs to be calculated for gun swing even */
/* if not on ground) */
/* OPTIMIZE: tablify angle */
/* */
val = player->mo->momx>>8;
player->bob = val*val;
val = player->mo->momy>>8;
player->bob += val*val;
player->bob >>= 4;
if (player->bob > MAXBOB)
{
player->bob = MAXBOB;
}
if (!onground)
{
player->viewz = player->mo->z + VIEWHEIGHT;
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
player->viewz = player->mo->ceilingz-4*FRACUNIT;
return;
}
//angle = (FINEANGLES/40*gamevbls)&(FINEANGLES-1);
angle = (FINEANGLES/40*ticon)&(FINEANGLES-1);
bob = (player->bob >> 17) * finesine[angle];
/* */
/* move viewheight */
/* */
if (player->playerstate == PST_LIVE)
{
player->viewheight += player->deltaviewheight;
if (player->viewheight > VIEWHEIGHT)
{
player->viewheight = VIEWHEIGHT;
player->deltaviewheight = 0;
}
if (player->viewheight < VIEWHEIGHT/2)
{
player->viewheight = VIEWHEIGHT/2;
if (player->deltaviewheight <= 0)
player->deltaviewheight = 1;
}
if (player->deltaviewheight)
{
player->deltaviewheight += FRACUNIT/2;
if (!player->deltaviewheight)
player->deltaviewheight = 1;
}
}
player->viewz = player->mo->z + player->viewheight + bob;
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
player->viewz = player->mo->ceilingz-4*FRACUNIT;
}
/*
=================
=
= P_MovePlayer
=
=================
*/
void P_MovePlayer (player_t *player)//L8002A3B8()
{
player->mo->angle += player->angleturn;
/* don't let the player control movement if not onground */
onground = (player->mo->z <= player->mo->floorz);
if (player->forwardmove && onground)
P_Thrust (player, player->mo->angle, player->forwardmove);
if (player->sidemove && onground)
P_Thrust (player, player->mo->angle-ANG90, player->sidemove);
if ((player->forwardmove || player->sidemove) && player->mo->state == &states[S_PLAY])
P_SetMobjState (player->mo, S_PLAY_RUN1);
}
/*
=================
=
= P_DeathThink
=
=================
*/
#define ANG5 (ANG90/18)
void P_DeathThink (player_t *player)//L8002A570()
{
angle_t angle, delta;
P_MovePsprites (player);
/* fall to the ground */
if (player->viewheight > 8*FRACUNIT)
player->viewheight -= FRACUNIT;
onground = (player->mo->z <= player->mo->floorz);
P_CalcHeight (player);
if (player->attacker && player->attacker != player->mo)
{
angle = R_PointToAngle2 (player->mo->x, player->mo->y, player->attacker->x, player->attacker->y);
delta = angle - player->mo->angle;
if (delta < ANG5 || delta > (unsigned)-ANG5)
{ /* looking at killer, so fade damage flash down */
player->mo->angle = angle;
if (player->damagecount)
player->damagecount--;
}
else if (delta < ANG180)
player->mo->angle += ANG5;
else
player->mo->angle -= ANG5;
}
else if (player->damagecount)
player->damagecount--;
if (((byte)ticbuttons[playernum] != 0) && (player->viewheight <= 8*FRACUNIT))
{
player->playerstate = PST_REBORN;
}
}
/*
=================
=
= P_PlayerThink
=
=================
*/
//extern int ticphase;
void P_PlayerThink (player_t *player)//L8002A6C8()
{
int buttons, oldbuttons;
buttons_t *cbutton;
weapontype_t weapon, lastweapon;
buttons = ticbuttons[playernum];
oldbuttons = oldticbuttons[playernum];
cbutton = BT_DATA[playernum];
/* */
/* check for weapon change */
/* */
if (player->playerstate == PST_LIVE)
{
weapon = player->pendingweapon;
if (weapon == wp_nochange)
weapon = player->readyweapon;
lastweapon = weaponowned[weapon];
weapon = lastweapon;
if ((buttons & cbutton->BT_WEAPONBACKWARD) && !(oldbuttons & cbutton->BT_WEAPONBACKWARD))
{
if (!lastweapon && player->weaponowned[wp_chainsaw])
{
lastweapon = wp_pistol;
}
else if(lastweapon > wp_fist)
{
weapon -= 1;
if (!player->weaponowned[weapon] && (weapon > wp_fist))
{
weapon -= 1;
while (!player->weaponowned[weapon] && (weapon > wp_fist))
{
weapon -= 1;
}
}
}
}
else if ((buttons & cbutton->BT_WEAPONFORWARD) && !(oldbuttons & cbutton->BT_WEAPONFORWARD))
{
if (lastweapon < wp_chainsaw)
{
weapon += 1;
if (!player->weaponowned[weapon] && (weapon < wp_chainsaw))
{
weapon += 1;
while (!player->weaponowned[weapon] && (weapon < wp_chainsaw))
{
weapon += 1;
}
}
}
if (weapon == wp_chainsaw)
{
weapon = wp_bfg;
if (!player->weaponowned[wp_bfg])
{
do
{
weapon -= 1;
} while (!player->weaponowned[weapon]);
}
}
}
if (weapon != lastweapon)
{
if ((weapon == wp_fist) && (player->readyweapon != wp_chainsaw))
{
weapon = (player->weaponowned[wp_chainsaw] > 0) << 3;
}
player->pendingweapon = weapon;
}
}
if (!gamepaused)
{
P_PlayerMobjThink(player->mo);
P_BuildMove(player);
if (player->playerstate == PST_DEAD)
{
P_DeathThink(player);
return;
}
/* */
/* chain saw run forward */
/* */
if (player->mo->flags & MF_JUSTATTACKED)
{
player->angleturn = 0;
player->forwardmove = 0xc800;
player->sidemove = 0;
player->mo->flags &= ~MF_JUSTATTACKED;
}
/* */
/* move around */
/* reactiontime is used to prevent movement for a bit after a teleport */
/* */
if (player->mo->reactiontime)
player->mo->reactiontime--;
else
P_MovePlayer(player);
P_CalcHeight(player);
if (player->mo->subsector->sector->special)
{
P_PlayerInSpecialSector(player);
if (player->playerstate == PST_DEAD)
return;
}
/* */
/* check for use */
/* */
if (buttons & cbutton->BT_USE)
{
if (player->usedown == false)
{
P_UseLines(player);
player->usedown = true;
}
}
else
player->usedown = false;
if (buttons & cbutton->BT_ATTACK)
{
P_SetMobjState(player->mo, S_PLAY_ATK1);
player->attackdown++;
if (player->attackdown > 30 && playernum == consoleplayer &&
(player->readyweapon == wp_chaingun || player->readyweapon == wp_plasma))
{
stbar.specialFace = f_mowdown;
}
}
else
player->attackdown = 0;
/* */
/* cycle psprites */
/* */
P_MovePsprites(player);
/* */
/* counters */
/* */
if (gamevbls < gametic)
{
if (player->powers[pw_strength])
player->powers[pw_strength]++; /* strength counts up to diminish fade */
if (player->powers[pw_invulnerability])
player->powers[pw_invulnerability]--;
if (player->powers[pw_invisibility])
{
player->powers[pw_invisibility]--;
if (!player->powers[pw_invisibility])
{
player->mo->flags &= ~(MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3);
}
else if ((player->powers[pw_invisibility] < 61) && !(player->powers[pw_invisibility] & 7))
{
player->mo->flags ^= (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3);
}
}
if (player->powers[pw_infrared])
player->powers[pw_infrared]--;
if (player->powers[pw_ironfeet])
player->powers[pw_ironfeet]--;
if (player->damagecount)
player->damagecount--;
if (player->bonuscount)
player->bonuscount--;
}
}
}
================================================
FILE: PSXDOOM/psxmain.c
================================================
/*-------------------------------------------------**
** **
**-------------------------------------------------*/
/* SONY LIBRARIES */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include //O_RDONLY|O_WRONLY|O_NOWAIT
#include
//---------------------------------------
#include "doomdef.h"
#include "r_local.h"
DRAWENV draw[2]; /* draw environment */ //800A8E90, 800A8EEC
DISPENV disp[2]; /* display environment*/ //800a8f48, 800A8F5C
long drawside;//80077F20
int drawsync1;//80077FE4
int drawsync2;//80077F3C
extern int v_sync;//80077CC8
#define OTSIZE (1<<14)//16384
unsigned long ot[OTSIZE];//80086378 psxdoom ot
unsigned long *sys_ot[2] = {ot, ot};//off_80077A44[0], off_80077A48[1]
#define BUFFSIZE (8)
static long fr, fw;//80078058, 80077D40
static unsigned long ev_r, ev_w, ev_e; //read/write/error event descriptor //80077D50, 80077E6C,
static char recbuf[BUFFSIZE];//0x80077cd4
static char senbuf[BUFFSIZE];//0x80077ddc
// Vram
unsigned int PagesXY[12][2] =
{
//0x80073aac, 0x80073ab0
{ 512 , 0 },
{ 640 , 0 },
{ 768 , 0 },
{ 896 , 0 },
{ 0 , 256 },
{ 128 , 256 },
{ 256 , 256 },
{ 384 , 256 },
{ 512 , 256 },
{ 640 , 256 },
{ 768 , 256 },
{ 896 , 256 },
};
//unsigned char *vram_cache;//80077DA0
int PageCount = 0;//*(r28 + 2628)
int TextureCacheIdx = 0;//80077A40
int xycount = 0; //*(r28 + 3212);
int xcount = 0; //*(r28 + 3320)
int ycount = 0; //*(r28 + 3324)
int V_PagFlags = 0;//*(r28 + 1576)//80077A38
int main()
{
D_DoomMain ();
return (0);
}
void PSX_INIT(void)//L80032804()
{
ResetCallback();
PadInit(0);
ResetGraph(0);
SetGraphDebug(0);
InitGeom();
SetGeomScreen(128);
SetGeomOffset(128, 100);
SetDefDrawEnv(&draw[0], 0, 0, 256, 240);
draw[0].isbg = 1;
draw[0].dtd = 0;
SetDefDrawEnv(&draw[1], 256, 0, 256, 240);
draw[1].isbg = 1;
draw[1].dtd = 0;
SetDefDispEnv(&disp[0], 256, 0, 256, 240);
SetDefDispEnv(&disp[1], 0, 0, 256, 240);
drawside = 0;
EnterCriticalSection();
//__asm__("nop");
ExitCriticalSection();
/* Initialize link cable communications */
{
/* attacth the SIO driver to the kernel */
AddCOMB();
/* open an event to detect the end of read operation */
ev_r = OpenEvent(HwSIO, EvSpIOER, EvMdNOINTR, NULL);
EnableEvent(ev_r);
/* open an event to detect the end of write operation */
ev_w = OpenEvent(HwSIO, EvSpIOEW, EvMdNOINTR, NULL);
EnableEvent(ev_w);
/* open stream for writing */
fw = open("sio:", O_WRONLY);
/* open stream for reading */
fr = open("sio:", O_RDONLY|O_NOWAIT);
/* set comminucation rate */
CombSetBPS(38400);
}
DrawRender();
DrawRender();
SetDispMask(1);
}
#include //va_list|va_start|va_end
void I_Error(char *error, ...)//L800329BC
{
int Fnt;
char buffer[256];
va_list args;
va_start (args, error);
D_vsprintf (buffer, error, args);
va_end (args);
DrawRender();
FntLoad(960, 256); // load the font from the BIOS into the framebuffer
Fnt = FntOpen(0, 0, 256, 200, 0, 256);
SetDumpFnt(Fnt); // screen X,Y | max text length X,Y | autmatic background clear 0,1 | max characters
FntPrint("\n\n\n %s", buffer);
FntFlush(Fnt);// refresh the font
DrawRender();
while (1){} // draw and display forever
}
void ImageToVram(psxobj_t *pic, char *name, int lump)//L80032A68()
{
int w, h;
byte *data;
if (name) {
lump = W_GetNumForName(name);
}
data = (byte *)W_CacheLumpNum(lump, PU_CACHE, false);
if (!lumpencode[lump]) {
decode(data, tempbuffer);
data = (byte *)&tempbuffer;
}
/* vram xy_wh */
pic->x = BIGSHORT(((patchpsx_t*)data)->leftoffset);
pic->y = BIGSHORT(((patchpsx_t*)data)->topoffset);
pic->w = BIGSHORT(((patchpsx_t*)data)->width);
pic->h = BIGSHORT(((patchpsx_t*)data)->height);
/* vram base x */
w = (int)BIGSHORT(((patchpsx_t*)data)->width) + 0xf;
if (w < 0) {
w = (int)BIGSHORT(((patchpsx_t*)data)->width) + 0x1e;
}
pic->vbasex = (short)(w >> 4);
/* vram base y */
h = (int)BIGSHORT(((patchpsx_t*)data)->height) + 0xf;
if (h < 0) {
h = (int)BIGSHORT(((patchpsx_t*)data)->height) + 0x1e;
}
pic->vbasey = (short)(h >> 4);
/* vram tpage */
pic->vtpage = 0;
/* vram lump */
pic->lump = (short)lump;
TextureCache(pic);
}
void DrawStaticImage(psxobj_t *psxobj, int xpos, int ypos, int pal)//L80032B78()
{
TextureCache(psxobj);
DrawImage(psxobj->vtpage, pal, xpos, ypos, psxobj->vramx, psxobj->vramy, psxobj->w, psxobj->h);
}
void DrawImage(int vtpage, int pal, int xpos, int ypos, char vramx, char vramy, int width, int height)//L80032BF8()
{
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *pic = (SPRT*) getScratchAddr(128);//1F800200
SetDrawMode(drawmode, 0, 0, vtpage, NULL);
W_AddPrim(drawmode);// add to order table
setSprt(pic);
setRGB0(pic, 128, 128, 128);
setUV0(pic, vramx, vramy);
setWH(pic, width, height);
setXY0(pic, xpos, ypos);
pic->clut = pal;
W_AddPrim(pic);// add to order table
}
void P_LoadingPlaque(psxobj_t *psxobj, int xpos, int ypos, int pal)//L80033154()
{
DrawSync(0);
MoveImage(&disp[drawside].disp, disp[drawside^1].disp.x, disp[drawside^1].disp.y);
//Setup Loading Image Obj
NextTextureCacheIdx();
TextureCache(psxobj);
DrawImage(psxobj->vtpage, pal, xpos, ypos, psxobj->vramx, psxobj->vramy, psxobj->w, psxobj->h);
UpdateDrawOTag();
DrawRender();
}
void NextTextureCacheIdx(void)//L8003324C()
{
TextureCacheIdx += 1;
}
#if SHOWFPS
int fps;
#endif // SHOWFPS
void DrawRender(void)//80033264
{
DrawSync(0);
#if SHOWFPS
fps = VSync(0);
#else
VSync(0);
#endif // SHOWFPS
drawside ^= 1;
PutDrawEnv(&draw[drawside]);
PutDispEnv(&disp[drawside]);
do
{
v_sync = VSync(-1);
drawsync1 = v_sync - drawsync2;
} while(drawsync1 < 2);
if (demoplayback || demorecording)
{
do
{
v_sync = VSync(-1);
drawsync1 = v_sync - drawsync2;
} while(drawsync1 < 4);
drawsync1 = 4;
}
drawsync2 = v_sync;
}
void Add_vsync(void)//L80033380()
{
v_sync++;
}
/* VRAM memory allocation structure */
typedef struct v_vrammem
{
psxobj_t *imgobj[MAX_VRAMMEM]; // ptr to start addr of image
} VRAMMEM;
VRAMMEM *vram_cache;//80077DA0
//uGp00000628 V_PagFlags
//iGp00000990 vram_cache
//uGp00000a44 PageCount
//uGp00000c8c xycount
//uGp00000cf8 xcount
//uGp00000cfc ycount
//uGp00000630 TextureCacheIdx
void Init_Vram_Cache(void)//800333A0
{
vram_cache = (VRAMMEM *)Z_Malloc((sizeof(VRAMMEM) * MAX_DYNAMIC_TPAGE), PU_STATIC, 0);
D_memset(vram_cache, 0, (sizeof(VRAMMEM) *MAX_DYNAMIC_TPAGE));
Valloc_Init();
}
void TextureCache(psxobj_t *psxobj)
{
RECT frame;
psxobj_t **imgobj;
unsigned long *vram, *vram2;
byte *tmp;
psxobj_t *psxobj1;
byte *data;
unsigned int lastpage;
int x, y;
short xs, ys;
lastpage = PageCount;
psxobj->index = TextureCacheIdx;
if (psxobj->vtpage == 0)
{
check_again:
if ((psxobj->vbasex + xcount) > MIN_VRAM_ALLOC_SIZE)
{
ycount += xycount;
xcount = 0;
xycount = 0;
}
if ((psxobj->vbasey + ycount) > MIN_VRAM_ALLOC_SIZE)
{
do
{
PageCount = (PageCount + 1) % MAX_DYNAMIC_TPAGE;
} while ((V_PagFlags >> (PageCount & 0x1f) & 1U) != 0);
if (PageCount == lastpage)
{
I_Error("Texture Cache Overflow\n");
}
xcount = 0;
ycount = 0;
xycount = 0;
}
imgobj = &vram_cache[PageCount].imgobj[(ycount * MIN_VRAM_ALLOC_SIZE) + xcount];
vram = (unsigned long*)imgobj;
xs = psxobj->vbasex; // xsize of alloc block
ys = psxobj->vbasey; // ysize of alloc block
// copy address object into the block
for (y = 0; y < ys; y++, vram += (MIN_VRAM_ALLOC_SIZE - xs))
{
for (x = 0; x < xs; x++, vram++)
{
psxobj1 = (psxobj_t *)*(unsigned long*)vram;//get address obj on vram
if (psxobj1 != 0)
{
if (psxobj1->index == TextureCacheIdx)
{
xcount += psxobj1->vbasex;
if (xycount < psxobj1->vbasey)
xycount = psxobj1->vbasey;
goto check_again;
}
else
V_ClearBlock(psxobj1);
}
}
}
vram2 = (unsigned long*)imgobj;
xs = psxobj->vbasex; // xsize of alloc block
ys = psxobj->vbasey; // ysize of alloc block
// copy address object into the block
for (y = 0; y < ys; y++, vram2 += (MIN_VRAM_ALLOC_SIZE - xs))
{
for (x = 0; x < xs; x++, vram2++)
{
*(unsigned long *)vram2 = (unsigned long)(void*)psxobj;
}
}
data = (byte *)W_CacheLumpNum(psxobj->lump, PU_CACHE, false);
if (lumpencode[psxobj->lump] == 0)
{
tmp = (byte *)tempbuffer;
decode(data, tmp);
data = tmp;
}
// copy address vram into the object
psxobj->vptr = (unsigned long*)imgobj;
frame.x = PagesXY[PageCount][0] + (xcount << 3);
frame.y = PagesXY[PageCount][1] + (ycount << 4);
frame.w = ((psxobj->w) << 16) >> 17;
frame.h = psxobj->h;
LoadImage(&frame, (unsigned long*)(byte*)(data + 8));
psxobj->vramx = (xcount << 4);
psxobj->vramy = (ycount << 4);
psxobj->vtpage = GetTPage(1, 0, (PageCount + 4) * 128, PagesXY[PageCount][1]);
xcount += psxobj->vbasex;
if (xycount < psxobj->vbasey)
xycount = psxobj->vbasey;
}
}
void V_ClearBlock(psxobj_t *psxobj)
{
unsigned long *vmptr;
int x, y;
short xs, ys;
vmptr = (unsigned long *)psxobj->vptr;
psxobj->vtpage = 0; // erase texture page ID.
xs = psxobj->vbasex; // xsize of alloc block
ys = psxobj->vbasey; // ysize of alloc block
// erase address block
for (y = 0; y < ys; y++, vmptr += (MIN_VRAM_ALLOC_SIZE - xs))
{
for (x = 0; x < xs; x++, vmptr++)
{
*vmptr = 0; // zero block
}
}
}
void Valloc_Init(void)
{
int obj, j, i;
short xs, ys;
psxobj_t *psxobj;
psxobj_t **imgobj;
unsigned long *vmptr;
unsigned int page;
unsigned int pagenum;
unsigned int flags;
for (page = 0; page < MAX_DYNAMIC_TPAGE; page = pagenum + 1)
{
do
{
pagenum = page;
page = pagenum + 1;
} while ((V_PagFlags >> (pagenum & 0x1f)) & 1U);
imgobj = vram_cache[pagenum].imgobj;
for (obj = 0; obj < MAX_VRAMMEM; obj++, imgobj++)
{
psxobj = *imgobj;
if (psxobj != 0)
{
vmptr = (unsigned long *)psxobj->vptr;
psxobj->vtpage = 0; // erase texture page ID.
xs = psxobj->vbasex; // xsize of alloc block
ys = psxobj->vbasey; // ysize of alloc block
// erase address block
for (j = 0; j < ys; j++, vmptr += (MIN_VRAM_ALLOC_SIZE - xs))
{
for (i = 0; i < xs; i++, vmptr++)
{
*vmptr = 0; // zero block
}
}
}
}
}
// Set Page Position
PageCount = 0;
flags = V_PagFlags & 1;
while (flags != 0)
{
PageCount = (PageCount + 1) % MAX_DYNAMIC_TPAGE;
flags = V_PagFlags >> (PageCount & MAX_DYNAMIC_TPAGE) & 1;
}
//Reset Positions
xycount = 0;
xcount = 0;
ycount = 0;
}
void Vram_Viewer(int page)//80033938
{
psxobj_t **imgobj;
psxobj_t *psxobj;
int i, xpos, ypos, w, y, h, obj;
POLY_FT4 *pagepic = (POLY_FT4*) getScratchAddr(128);//1F800200
LINE_F2 *line = (LINE_F2*) getScratchAddr(128);//1F800200
setPolyFT4(pagepic);
setRGB0(pagepic, 128, 128, 128);
setXYWH(pagepic, 0, 0, 256, 240);
setUVWH(pagepic, 0, 0, 255, 255);
pagepic->tpage = GetTPage(1, 0, (page + 4) * 128, PagesXY[page][1]);
pagepic->clut =palette[0];
W_AddPrim (pagepic);
imgobj = vram_cache[page].imgobj;
for (obj = 0; obj < MAX_VRAMMEM; obj++, imgobj++)
{
psxobj = *imgobj;
if(psxobj)
{
y = psxobj->vramy;
xpos = psxobj->vramx;
y = (y << 4) - y << 4;
if(y < 0)
{
y += 255;
}
h = psxobj->h;
w = psxobj->w;
h = (h << 4) - h << 4;
ypos = y >> 8;
if(h < 0)
{
h += 255;
}
h = (h >> 8);
setLineF2(line);
setRGB0(line, 255, 0, 0);
//top line
setXY2(line, xpos, ypos, xpos + w, ypos);
W_AddPrim (line);
//right line
setXY2(line, xpos + w, ypos, xpos + w, ypos + h);
W_AddPrim (line);
//bottom line
setXY2(line, xpos + w, ypos + h, xpos, ypos + h);
W_AddPrim (line);
//left line
setXY2(line, xpos, ypos + h, xpos, ypos);
W_AddPrim (line);
}
}
}
boolean cancel_link; //0x80077A3C *(r28 + 1580)
unsigned int TempConfiguration[8] = { PAD_TRIANGLE, PAD_CIRCLE, PAD_CROSS, PAD_SQUARE, PAD_L1, PAD_R1, PAD_L2, PAD_R2 };//80073c1c
unsigned int ActualConfiguration[8] = { PAD_TRIANGLE, PAD_CIRCLE, PAD_CROSS, PAD_SQUARE, PAD_L1, PAD_R1, PAD_L2, PAD_R2 }; //80073c3c
unsigned int DefaultConfiguration[8] = { PAD_TRIANGLE, PAD_CIRCLE, PAD_CROSS, PAD_SQUARE, PAD_L1, PAD_R1, PAD_L2, PAD_R2 }; //80073C5C
unsigned int NewConfiguration[8];//0x80078120
void Link_Conection(void)//L800345A0()
{
/* The following lines enclosed by square brackets are necessary for the current PSYQ SDK libcomb.lib */
/* This is due to the version of libcomb.lib library used in the original PSXDOOM, it worked differently. */
/* Also the CompaCTS macros were added as it is the current way to create links between two consoles */
{
/* wait for DSR and CTS line to be asserted */
/* wait for other PlayStation to be powered-up */
while((CombSioStatus() & (COMB_DSR|COMB_CTS)) == 0x180 )
{
if (PadRead(0) & PAD_SELECT)
{
cancel_link = true;
CombCancelRead(); // Cancel async read request
return;
}
};
}
//if (_comb_control(3,0,0) != 0) //Original line
if(CombCTS() == 0) /* Return status of CTS */
{
consoleplayer = 0;
read(fr, recbuf, BUFFSIZE);
do
{
if (PadRead(0) & PAD_SELECT)
{
cancel_link = true;
CombCancelRead(); // Cancel async read request
return;
}
} while (TestEvent(ev_r) == 0);
//do {} while (_comb_control(3,0,0) == 0); //Original line
do {} while (CombCTS() == 0); /* Return status of CTS */
write(fw, senbuf, BUFFSIZE);
}
else
{
consoleplayer = 1;
write(fw, senbuf, BUFFSIZE);
read(fr, recbuf, BUFFSIZE);
do
{
if (PadRead(0) & PAD_SELECT)
{
cancel_link = true;
CombCancelRead(); // Cancel async read request
return;
}
} while (TestEvent(ev_r) == 0);
}
Sync_Data_Transmission();
if (consoleplayer == 0)
{
senbuf[1] = (char)starttype;
senbuf[2] = (char)startskill;
senbuf[3] = (char)startmap;
*(int*)&senbuf[4] = Get_CfgCode(ActualConfiguration);
//do {} while (_comb_control(3,0,0) == 0); //Original line
do {} while (CombCTS() == 0);/* Return status of CTS */
write(fw, senbuf, BUFFSIZE);
read(fr, recbuf, BUFFSIZE);
do {} while (TestEvent(ev_r) == 0);
BT_DATA[0] = (buttons_t *)ActualConfiguration;
BT_DATA[1] = (buttons_t *)Get_CfgByCode(*(int*)&recbuf[4]);
}
else
{
read(fr, recbuf, BUFFSIZE);
do {} while (TestEvent(ev_r) == 0);
starttype = recbuf[1];
startskill = recbuf[2];
startmap = recbuf[3];
BT_DATA[1] = (buttons_t *)ActualConfiguration;
BT_DATA[0] = (buttons_t *)Get_CfgByCode(*(int*)&recbuf[4]);
*(int*)&senbuf[4] = Get_CfgCode(ActualConfiguration);
//do {} while (_comb_control(3,0,0) == 0); //Original line
do {} while (CombCTS() == 0);/* Return status of CTS */
write(fw, senbuf, BUFFSIZE);
}
cancel_link = false;
}
boolean Update_Conection(void)//L80034868()
{
unsigned char up1, up2;
long side;
boolean conection;
up1 = players[0].mo->x ^ players[0].mo->y ^ players[1].mo->x ^ players[1].mo->y;
up2 = up1 ^ (up1 >> 8);
up2 = up2 ^ (up1 >> 16);
senbuf[0] = 170;//171 on final doom
senbuf[1] = up2;
senbuf[2] = *(char *)(vblsinframe + consoleplayer);
*(int*)&senbuf[4] = ticbuttons[consoleplayer];
Sync_Read_Write();
if (recbuf[0] == 170 && (recbuf[1] == senbuf[1]))//171 on final doom
{
if (consoleplayer == 0)
{
ticbuttons[1] = *(int*)&recbuf[4];
}
else
{
ticbuttons[0] = *(int*)&recbuf[4];
}
if (consoleplayer == 0)
vblsinframe[1] = recbuf[2];
else
vblsinframe[0] = recbuf[2];
conection = false;
}
else
{
DrawSync(0);
side = drawside ^ 1;
MoveImage(&disp[drawside].disp, disp[side].disp.x, disp[side].disp.y);
//Setup Net Error image obj
NextTextureCacheIdx();
TextureCache(&neterrpic);
DrawImage(neterrpic.vtpage, palette[16], 84, 109, neterrpic.vramx, neterrpic.vramy, neterrpic.w, neterrpic.h);
UpdateDrawOTag();
DrawRender();
Sync_Data_Transmission();
ticbuttons[1] = 0;
oldticbuttons[0] = 0;
ticbuttons[1] = 0;
oldticbuttons[0] = 0;
conection = true;
}
return conection;
}
void Sync_Data_Transmission(void) //L80034AC0()
{
int cnt;
cnt = 0;
Again:
do
{
senbuf[0] = (char)cnt;
/* Data transmission */
Sync_Read_Write();
if (recbuf[0] == senbuf[0])
{
cnt += 1;
if (cnt < 8) goto Again;
}
if (!(cnt < 8)) return;
cnt = 0;
} while( true );
}
void Sync_Read_Write (void) //L80034B1C()
{
int sync;
do
{
if (consoleplayer == 0)
{
//do {} while (_comb_control(3,0,0) == 0); //Original line
do {} while (CombCTS() == 0); /* Return status of CTS */
write(fw, &senbuf, BUFFSIZE);
read(fr, &recbuf, BUFFSIZE);
sync = VSync(-1);
do
{
if (TestEvent(ev_r) != 0) return;
} while ((VSync(-1) - sync) < 300);
}
else
{
read(fr, &recbuf, BUFFSIZE);
sync = VSync(-1);
do
{
if (TestEvent(ev_r) != 0)
{
//do {} while (_comb_control(3,0,0) == 0); //Original line
do {} while (CombCTS() == 0); /* Return status of CTS */
write(fw, &senbuf, BUFFSIZE);
return;
}
} while ((VSync(-1) - sync) < 300);
}
CombResetError(); /* Reset error bits */
} while( true );
}
void UpdateDrawOTag(void)//80034C60
{
if(sys_ot[0] != sys_ot[1])
{
*sys_ot[1] = 0xffffff;
DrawOTag(sys_ot[0]);
}
sys_ot[0] = ot;
sys_ot[1] = ot;
}
/*
==============
=
= Get_CfgCode
=
= Encodes the buttons flags to send them to the link connection
=
==============
*/
unsigned int Get_CfgCode(unsigned int *cfgdata)//L80034CAC
{
unsigned int *tmpcfg;
int i, j, cfgcode;
tmpcfg = TempConfiguration;
cfgcode = 0;
for(i = 0; i < 8; i++, cfgdata++)
{
for(j = 0; j < 8; j++, tmpcfg++)
{
if (*cfgdata == *tmpcfg)
break;
}
cfgcode |= (j << (i << 2));
}
return cfgcode;
}
/*
==============
=
= Get_CfgByCode
=
= Decodes the value received from the link connection and turn them into the buttons flags
=
==============
*/
unsigned int *Get_CfgByCode(unsigned int cfgcode)//L80034D0C
{
unsigned int *tmpcfg;
unsigned int *newcfg;
unsigned int i, code;
tmpcfg = TempConfiguration;
newcfg = NewConfiguration;
for(i = 0; i < 8; i++)
{
code = (cfgcode >> (i << 2)) & 0xF;
*newcfg++ = *(tmpcfg + code);
}
return NewConfiguration;
}
/*================================================================== */
/* */
/* W_AddPrim: Add primitive polygons to the buffer (ot), created by williams. */
/* This function does not exist in the code as a function, it should have been a macro define. */
/* */
/*================================================================== */
#define GP0_GPUREAD ((unsigned long*) getScratchAddr(1540))
#define GP1_GPUSTAT ((unsigned long*) getScratchAddr(1541))
void W_AddPrim (void* prim)
{
unsigned long *entry, *entry1;
int length;
entry1 = sys_ot[1];
do
{
length = getlen(prim);
entry = sys_ot[1];
if(sys_ot[1] >= sys_ot[0])
{
if((((length+1) + entry) < (ot + (OTSIZE))))
{
addprim:
entry = (length+1) + sys_ot[1];
sys_ot[1] = entry;
catPrim(entry1, sys_ot[1]);
setlen(entry1, length);
entry = (unsigned long *)prim+1;//skip prim->tag
//Copy prim to ot
while (length--)
{
entry1++;
*entry1 = *entry++;
}
while (sys_ot[0] != sys_ot[1])
{
if((*GP1_GPUSTAT & 0x4000000) == 0) {break;}
entry = sys_ot[0];
length = getlen(entry);
sys_ot[0] = nextPrim(entry);
//Copy address
while (length--)
{
entry++;
*GP0_GPUREAD = *entry;
}
}
return;
}
sys_ot[1] = ot;
catPrim(entry1, sys_ot[1]);
setlen(entry1, 0);
entry1 = sys_ot[1];
}
if (((length+1) + entry) < sys_ot[0]) goto addprim;
while (sys_ot[0] != sys_ot[1])
{
if((*GP1_GPUSTAT & 0x4000000) == 0) {break;}
entry = sys_ot[0];
length = getlen(entry);
sys_ot[0] = nextPrim(entry);
//Copy address
while (length--)
{
entry++;
*GP0_GPUREAD = *entry;
}
}
} while(1);
}
#if 0 //OLD VERSION
void W_AddPrim (void* prim, unsigned long* addr0, unsigned long* addr1)
{
unsigned long *entry, *entry1;
int length;
entry1 = sys_ot[1];
do
{
length = getlen(prim);
entry = sys_ot[1];
if(sys_ot[1] >= sys_ot[0])
{
if((((length+1) + entry) < (ot + (OTSIZE))))
{
addprim:
entry = (length+1) + sys_ot[1];
sys_ot[1] = entry;
catPrim(entry1, sys_ot[1]);
setlen(entry1, length);
entry = (unsigned long *)prim+1;//skip prim->tag
//Copy prim to ot
while (length--)
{
entry1++;
*entry1 = *entry++;
}
if(sys_ot[0] != sys_ot[1])
{
do {
if((*addr1 & 0x4000000) == 0) {break;}
entry = sys_ot[0];
length = getlen(entry);
sys_ot[0] = nextPrim(entry);
//Copy address
while (length--)
{
entry++;
*addr0 = *entry;
}
} while(sys_ot[0] != sys_ot[1]);
}
return;
}
sys_ot[1] = ot;
catPrim(entry1, sys_ot[1]);
setlen(entry1, 0);
entry1 = sys_ot[1];
}
if (((length+1) + entry) < sys_ot[0]) goto addprim;
if(sys_ot[0] != sys_ot[1])
{
do
{
if((*addr1 & 0x4000000) == 0) {break;}
entry = sys_ot[0];
length = getlen(entry);
sys_ot[0] = nextPrim(entry);
//Copy address
while (length--)
{
entry++;
*addr0 = *entry;
}
} while (sys_ot[0] != sys_ot[1]);
}
} while(1);
}
#endif // 0
/******************END OF MAIN.C*************************/
================================================
FILE: PSXDOOM/pw_main.c
================================================
/* pw_main.c -- password menu */
#include "doomdef.h"
#include "p_local.h"
#include "st_main.h"
#include "r_local.h"
char *passwordChar = "bcdfghjklmnpqrstvwxyz0123456789!";//80073B7C
byte Passwordbuff[12];//0x80096388
int CurPasswordSlot = 0;//80077A70 iGp00000660
int PassInvalidTic;//80077E58 uGp00000a48
int PassCodePos;//80077F9C uGp00000b8c
boolean doPassword = false;//80077A6C
/*
=================
=
= PW_Start
=
=================
*/
void PW_Start(void)//L80036C1C()
{
S_StartSound(NULL, sfx_pistol);
oldticbuttons[0] = ticbuttons[0];
oldticbuttons[1] = ticbuttons[1];
m_vframe1[0] = 0;
PassInvalidTic = 0;
PassCodePos = 0;
}
/*
=================
=
= PW_Stop
=
=================
*/
void PW_Stop(int exit)//L80036C1C()
{
S_StartSound(NULL, 7);// SNDPSTOL.mid
PassCodePos = 32;
PW_Drawer();
}
/*
=================
=
= PW_Ticker
=
=================
*/
int PW_Ticker(void)//L80036CA0()
{
int buttons, levelnum, skill;
if(PassInvalidTic && (gamevbls < (int)gametic))
{
PassInvalidTic--;
if((PassInvalidTic & 7) == 4)
S_StartSound(0,0x18);
}
buttons = ticbuttons[0];
if (buttons & PAD_ARROWS)
{
m_vframe1[0] -= vblsinframe[0];
if (m_vframe1[0] <= 0)
{
m_vframe1[0] = TICRATE;
if (buttons & PAD_DOWN)
{
if (PassCodePos < 24)
{
PassCodePos += 8;
S_StartSound(NULL, sfx_pstop);
}
}
else if (buttons & PAD_UP)
{
if (PassCodePos >= 8)
{
PassCodePos -= 8;
S_StartSound(NULL, sfx_pstop);
}
}
if (buttons & PAD_RIGHT)
{
PassCodePos += 1;
if (PassCodePos >= 32)
PassCodePos = 31;
else
S_StartSound(NULL, sfx_pstop);
}
else if (buttons & PAD_LEFT)
{
PassCodePos -= 1;
if (PassCodePos < 0)
PassCodePos = 0;
else
S_StartSound(NULL, sfx_pstop);
}
}
}
else
{
m_vframe1[0] = 0;
}
if (buttons & (PAD_START | PAD_SELECT))
return ga_exit;// exit
if (buttons != oldticbuttons[0])
{
if (buttons & (PAD_SQUARE | PAD_CROSS| PAD_CIRCLE))
{
S_StartSound(NULL, sfx_swtchx);
if (CurPasswordSlot < 10)
{
Passwordbuff[CurPasswordSlot] = PassCodePos;
CurPasswordSlot++;
if (CurPasswordSlot < 10)
return ga_nothing;
}
if(Decode_Password(Passwordbuff, &levelnum, &skill, NULL))
{
startskill = skill;
startmap = levelnum;
gamemap = levelnum;
gameskill = skill;
doPassword = true; //80077A6C
//I_Error("startskill: %d\n startmap: %d", startskill, startmap);
return ga_warped;
}
PassInvalidTic = 16;
}
else if(buttons & PAD_TRIANGLE)
{
S_StartSound(NULL, sfx_swtchx);
CurPasswordSlot--;
if (CurPasswordSlot < 0)
CurPasswordSlot = 0;
}
Passwordbuff[CurPasswordSlot] = 0;
}
return ga_nothing;
}
/*
=================
=
= PW_Drawer
=
=================
*/
void PW_Drawer(void) //L80036F34()
{
byte pass[2] = {0,0};
byte c;
int texid, cnt;
int xpos, ypos, pos1, pos2;
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *textsprite = (SPRT*) getScratchAddr(128);//1F800200
NextTextureCacheIdx();
//Draw Backround MARB01 Pic
for (ypos = 0; ypos < 4; ypos++)
{
for (xpos = 0; xpos < 4; xpos++)
{
DrawStaticImage(&marb01pic, xpos << 6, ypos << 6, palette[0]);
}
}
SetDrawMode(drawmode, 0, 0, statuspic.vtpage, NULL);
W_AddPrim(drawmode);// add to order table
setSprt(textsprite);
textsprite->clut = palette[16];
for (cnt = 0; cnt < 32; cnt++)
{
setRGB0(textsprite, 128, 128, 128);
pos1 = cnt;
if (cnt < 0)
pos1 = cnt + 7;
pos1 >>= 3;
pos2 = cnt - (pos1 << 3);
xpos = (pos2 * 20) + 48;
ypos = (pos1 * 20) + 60;
if (PassCodePos == cnt)
{
if (!(ticon & 4)) continue;
setRGB0(textsprite, 255, 0, 0);
}
c = passwordChar[cnt];
if ((byte)(c - 'a') < 26)
{
texid = (byte)(c - 57);
ypos = (pos1 * 20) + 63;
}
else
{
if ((byte)(c - '0') < 10)
{
texid = (byte)(c - '0');
}
else if (c == '!')
{
texid = 12;
}
}
setXY0(textsprite, xpos, ypos);
setUV0(textsprite, symboldata[texid].x, symboldata[texid].y);
setWH(textsprite, symboldata[texid].w, symboldata[texid].h);
W_AddPrim(textsprite);// add to order table
}
ST_DrawText(-1,20,"Password");
xpos = 58;
ypos = 160;
for (cnt = 0; cnt < CurPasswordSlot; cnt++)
{
pass[0] = passwordChar[Passwordbuff[cnt]];
ST_DrawText(xpos, ypos, pass);//Draw Text
xpos += 14;
}
if (cnt < 10)
{
xpos = (cnt * 14) + 58;
do
{
ST_DrawText(xpos, ypos, ".");//Draw Text
xpos += 14;
cnt++;
} while (cnt < 10);
}
if (PassInvalidTic & 4)//80077E58
{
ST_DrawText(-1, 200, "Invalid Password");//Draw Text
}
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/r_data.c
================================================
/* R_data.c */
#include "doomdef.h"
#include "r_local.h"
#include "p_local.h"
int firstflat; //800780DC|iGp00000ccc
int lastflat; //80077F98|iGp00000b88
int numflats; //80077FE8|iGp00000bd8
psxobj_t *texflats; //80077F4C|puGp00000b3c
int firsttex; //80078104|iGp00000cf4
int lasttex; //80077FC4|iGp00000bb4
int numtextures; //80077FFC|iGp00000bec
psxobj_t *textures; //80077F50|puGp00000b40
int firstsprite; //80077E40|iGp00000a30
int lastsprite; //80077D64|iGp00000954
int numsprites; //80077D88|iGp00000978
psxobj_t *texsprites; //80077CF0|puGp000008e0
int *flattranslation; //80077D8C|puGp00000988 /* for global animation */
int *texturetranslation; //80077D98|puGp0000097c /* for global animation */
short skypalette; //800780F0 psx doom
psxobj_t *skytexturep; //80077E7C
#define MAX_PALETTES 20
extern light_t *lights; //80077E94
extern short palette[MAX_PALETTES]; //800A8E68
extern short palettebase; //80077DA8
void R_InitTextures(void);
void R_InitFlats(void);
void R_InitSprite(void);
void R_InitPalettes(void);
/*============================================================================ */
/*
================
=
= R_InitData
=
= Locates all the lumps that will be used by all views
= Must be called after W_Init
=================
*/
void R_InitData (void)//L8002B878()
{
//printf("\nR_InitData\n");
R_InitPalettes();
R_InitTextures();
R_InitFlats();
R_InitSprite();
}
/*
==================
=
= R_InitTextures
=
= Initializes the texture list with the textures from the world map
=
==================
*/
void R_InitTextures(void)//L8002B8B0()
{
maptexture_t *mtexture;
psxobj_t *texture;
byte *data;
int width, height, lump, i;
firsttex = W_GetNumForName("T_START") + 1;
lasttex = W_GetNumForName("T_END") - 1;
numtextures = (lasttex - firsttex) + 1;
textures = Z_Malloc(numtextures * (sizeof(psxobj_t) + sizeof(int)), PU_STATIC, 0);
texturetranslation = (int *) textures + (numtextures * (sizeof(psxobj_t)/4));
data = (byte *)W_CacheLumpName("TEXTURE1", PU_CACHE, true);
texture = textures;
mtexture = (maptexture_t *)data;
for (lump = firsttex; lump <= lasttex; lump++)
{
texture->lump = lump;
texture->vtpage = 0;
texture->w = BIGSHORT(mtexture->width);
texture->h = BIGSHORT(mtexture->height);
width = texture->w + 15;
if (width < 0) { width = texture->w + 30; }
height = texture->h + 15;
if (height < 0) { height = texture->h + 30; }
texture->vbasex = width >> 4;
texture->vbasey = height >> 4;
mtexture++;
texture++;
}
Z_Free(data);
/* */
/* translation table for global animation */
/* */
for (i = 0; ilump = lump;
flat->w = 64;
flat->h = 64;
flat->vtpage = 0;
flat->vbasex = 4;
flat->vbasey = 4;
flat++;
}
/* translation table for global animation */
for (i = 0; ilump = lump;
sprite->vtpage = 0;
sprite->x = BIGSHORT(msprite->leftoffset);
sprite->y = BIGSHORT(msprite->topoffset);
sprite->w = BIGSHORT(msprite->width);
sprite->h = BIGSHORT(msprite->height);
width = sprite->w + 15;
if (width < 0) { width = sprite->w + 30; }
height = sprite->h + 15;
if (height < 0) { height = sprite->h + 30; }
sprite->vbasex = width >> 4;
sprite->vbasey = height >> 4;
msprite++;
sprite++;
}
Z_Free(data);
Z_FreeTags(mainzone, PU_CACHE);
}
/*============================================================================= */
#define HIBIT (1<<7)
/*
================
=
= R_TextureNumForName
=
================
*/
int R_TextureNumForName(char *name)//L8002BC74()
{
#if 0
int i;
i = R_CheckTextureNumForName(name);
if (i == -1)
I_Error("R_TextureNumForName: %s not found", name);
return i;
#endif
int i;
lumpinfo_t *lump_p;
char name8[8];
int v1, v2;
int c;
/* make the name into two integers for easy compares */
*(int *)&name8[0] = 0;
*(int *)&name8[4] = 0;
for (i = 0; i<8 && name[i]; i++)
{
c = name[i];
if (c >= 'a' && c <= 'z')
c -= 'a' - 'A';
name8[i] = c;
}
v1 = *(int *)&name8[0];
v2 = *(int *)&name8[4];
lump_p = &lumpinfo[firsttex];
for (i = 0; iname[4] == v2) &&
((*(int *)&lump_p->name[0] & ~HIBIT) == v1))
return i;
}
//I_Error("R_TextureNumForName: %s not found", name);
return -1;
}
/*
================
=
= R_FlatNumForName
=
================
*/
int R_FlatNumForName (char *name)//L8002BD38()
{
int i;
lumpinfo_t *lump_p;
char name8[8];
int v1,v2;
int c;
/* make the name into two integers for easy compares */
*(int *)&name8[0] = 0;
*(int *)&name8[4] = 0;
for (i=0 ; i<8 && name[i] ; i++)
{
c = name[i];
if (c == 0) break;
if (c >= 'a' && c <= 'z')
c -= 'a'-'A';
name8[i] = c;
}
v1 = *(int *)&name8[0];
v2 = *(int *)&name8[4];
lump_p = &lumpinfo[firstflat];
for (i=0 ; iname[4] == v2) &&
((*(int *)&lump_p->name[0] & ~HIBIT) == v1))
return i;
}
//I_Error ("R_FlatNumForName: %s not found",name);
return 0; /* FIXME -1; */
}
/*
================
=
= R_InitPalettes
=
= Exclusive Psx Doom
================
*/
void R_InitPalettes(void)//L8002BDFC()
{
int lump, i, x, y;
byte *paldata;
RECT rect;
light_t *light;
//printf("R_InitPalettes\n");
lights = (light_t*)W_CacheLumpName("LIGHTS", PU_STATIC, true);
lights[0].r = 0xff;
lights[0].g = 0xff;
lights[0].b = 0xff;
lump = W_GetNumForName("PLAYPAL");
paldata = (byte *)W_CacheLumpNum(lump, PU_CACHE, true);
if ((W_LumpLength(lump) / 512) != MAX_PALETTES)
{
I_Error("R_InitPalettes: palette foulup\n");
}
rect.w = 256;
rect.h = 1;
for (i = 0; i < MAX_PALETTES; i++)
{
y = i;
if (y < 0) { y = i + 0xf; }
y = y >> 4;
x = y << 8;
rect.x = x;
rect.y = i - (y << 4) + 240;
LoadImage(&rect, (unsigned long *)paldata);
palette[i] = getClut(rect.x, rect.y);
paldata += 512;
}
palettebase = palette[0];
Z_FreeTags(mainzone, PU_CACHE);
}
/*
================
=
= R_CheckTextureNumForName
=
================
*/
#if 0 //dont use on Psx Doom
int R_CheckTextureNumForName (char *name)
{
int i,c;
char temp[8];
int v1, v2;
texture_t *texture_p;
if (name[0] == '-') /* no texture marker */
return 0;
*(int *)&temp[0] = 0;
*(int *)&temp[4] = 0;
for (i=0 ; i<8 && name[i] ; i++)
{
c = name[i];
if (c >= 'a' && c<='z')
c -= ('a'-'A');
temp[i] = c;
}
v1 = *(int *)temp;
v2 = *(int *)&temp[4];
texture_p = textures;
for (i=0 ; iname[4] == v2
&& (*(int *)texture_p->name) == v1)
return i;
return 0; /* FIXME -1; */
}
#endif
================================================
FILE: PSXDOOM/r_local.h
================================================
/* R_local.h */
#ifndef __R_LOCAL__
#define __R_LOCAL__
/* proper screen size would be 160*100, stretched to 224 is 2.2 scale */
#define STRETCH (22*FRACUNIT/10)
#define CENTERX (SCREENWIDTH/2)
#define CENTERY (SCREENHEIGHT/2)
#define CENTERXFRAC (SCREENWIDTH/2*FRACUNIT)
#define CENTERYFRAC (SCREENHEIGHT/2*FRACUNIT)
#define PROJECTION CENTERXFRAC
#define ANGLETOSKYSHIFT 22 /* sky map is 256*128*4 maps */
#define BASEYCENTER 100
#define CENTERY (SCREENHEIGHT/2)
#define WINDOWHEIGHT (SCREENHEIGHT-SBARHEIGHT)
#define MINZ 4//(FRACUNIT*4)
#define FIELDOFVIEW 2048 /* fineangles in the SCREENWIDTH wide window */
/* */
/* Seg flags */
/* */
#define SGF_VISIBLE_COLS 1 /* The seg has at least 1 visible (non fully occluded column) */
/* */
/* lighting constants */
/* */
#define LIGHTLEVELS 256 /* number of diminishing */
#define INVERSECOLORMAP 255
/*
==============================================================================
INTERNAL MAP TYPES
==============================================================================
*/
/*================ used by play and refresh */
typedef struct
{
fixed_t x, y, dx, dy;
} divline_t;
typedef struct
{
fixed_t x,y;//*, *4
int yy;//*8
int vx;//*12
int vy;//*16
int xx;//*20
int index; //*24
} vertex_t;
struct line_s;
struct subsector_s;
typedef struct
{
fixed_t floorheight, ceilingheight;
VINT floorpic, ceilingpic; /* if ceilingpic == -1,draw sky */
short colorid; // Psx Doom New
short lightlevel;
VINT special, tag;
VINT soundtraversed; /* 0 = untraversed, 1,2 = sndlines -1 */
mobj_t *soundtarget; /* thing that made a sound (or null) */
VINT flags; // Psx Doom New
VINT blockbox[4]; /* mapblock bounding box for height changes */
degenmobj_t soundorg; /* for any sounds played by the sector */
int validcount; /* if == validcount, already checked */
mobj_t *thinglist; /* list of mobjs in sector */
void *specialdata; /* thinker_t for reversable actions */
VINT linecount;
struct line_s **lines; /* [linecount] size */
} sector_t;
typedef struct
{
fixed_t textureoffset; /* add this to the calculated texture col */
fixed_t rowoffset; /* add this to the calculated texture top */
VINT toptexture, bottomtexture, midtexture;
sector_t *sector;
} side_t;
typedef enum {ST_HORIZONTAL, ST_VERTICAL, ST_POSITIVE, ST_NEGATIVE} slopetype_t;
typedef struct line_s
{
vertex_t *v1, *v2;
fixed_t dx,dy; /* v2 - v1 for side checking */
VINT flags;
VINT special, tag;
VINT sidenum[2]; /* sidenum[1] will be -1 if one sided */
fixed_t bbox[4];
slopetype_t slopetype; /* to aid move clipping */
sector_t *frontsector, *backsector;
int validcount; /* if == validcount, already checked */
void *specialdata; /* thinker_t for reversable actions */
int fineangle; /* to get sine / cosine for sliding */
} line_t;
typedef struct subsector_s
{
sector_t *sector; //*
short numlines; //*4
short firstline; //*6
//Psx Doom
short numleafs; //*8
short leaf; //*10
short unk1; //*12
short unk2; //*14
} subsector_t;
typedef struct seg_s
{
vertex_t *v1, *v2;
fixed_t offset;
angle_t angle; /* this is not used (keep for padding) */
side_t *sidedef;
line_t *linedef;
sector_t *frontsector;
sector_t *backsector; /* NULL for one sided lines */
//New PsxDoom
short flag;
short xpos1;
short xpos2;
short pad1;
} seg_t;
typedef struct
{
//fixed_t x,y,dx,dy; //old
divline_t line; /* partition line */
fixed_t bbox[2][4]; /* bounding box for each child */
int children[2]; /* if NF_SUBSECTOR its a subsector */
} node_t;
typedef struct {
vertex_t *vertex;
seg_t *seg;//*(A24 + 4)
} leaf_t;
#if 0
typedef struct
{
char name[8]; /* for switch changing, etc */
int width;
int height;
pixel_t *data; /* cached data to draw from */
int lumpnum;
int usecount; /* for precaching */
int pad;
} texture_t;
#endif // 0
//
// Light Data Psx Doom
//
typedef struct {
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char pad1;
} light_t;
/*
==============================================================================
OTHER TYPES
==============================================================================
*/
/* Sprites are patches with a special naming convention so they can be */
/* recognized by R_InitSprites. The sprite and frame specified by a */
/* thing_t is range checked at run time. */
/* a sprite is a patch_t that is assumed to represent a three dimensional */
/* object and may have multiple rotations pre drawn. Horizontal flipping */
/* is used to save space. Some sprites will only have one picture used */
/* for all views. */
#ifdef MARS
int spritelump[NUMSPRITES]; /* no rotations, so just add frame num... */
#else
typedef struct
{
boolean rotate; /* if false use 0 for any position */
int lump[8]; /* lump to use for view angles 0-7 */
byte flip[8]; /* flip (1 = flip) to use for view angles 0-7 */
} spriteframe_t;
typedef struct
{
int numframes;
spriteframe_t *spriteframes;
} spritedef_t;
extern spritedef_t sprites[NUMSPRITES];
#endif
/*
===============================================================================
MAP DATA
===============================================================================
*/
extern int numvertexes;
extern vertex_t *vertexes;
extern int numsegs;
extern seg_t *segs;
extern int numsectors;
extern sector_t *sectors;
extern int numsubsectors;
extern subsector_t *subsectors;
extern int numnodes;
extern node_t *nodes;
extern int numlines;
extern line_t *lines;
extern int numsides;
extern side_t *sides;
extern int numleafs;
extern leaf_t *leafs;
/*============================================================================= */
/*------*/
/*R_main*/
/*------*/
extern light_t *baselight; //*(r28 + 2672) L80077E80
extern unsigned int base_r; //*(r28 + 2220) L80077CBC//r
extern unsigned int base_g; //*(r28 + 2640) L80077E60//g
extern unsigned int base_b; //*(r28 + 2444) L80077D9C//b
extern boolean viewlighting; //80078088
extern sector_t *frontsector; //80077E38 //psGp00000a28
/*------*/
/*R_data*/
/*------*/
void R_InitData (void);
//void R_InitSpriteDefs (char **namelist);
/*--------*/
/*r_phase1*/
/*--------*/
void R_BSP (void);
void R_RenderBSPNode (int bspnum);
/*--------*/
/*r_phase2*/
/*--------*/
void R_RenderSKY(void);
void R_Render_Hud_Weapons(void);
/* to get a global angle from cartesian coordinates, the coordinates are */
/* flipped until they are in the first octant of the coordinate system, then */
/* the y (<=x) is scaled and divided by x to get a tangent (slope) value */
/* which is looked up in the tantoangle[] table. The +1 size is to handle */
/* the case when x==y without additional checking. */
#define SLOPERANGE 2048
#define SLOPEBITS 11
#define DBITS (FRACBITS-SLOPEBITS)
extern int tantoangle[SLOPERANGE+1];
#define VIEW_3D_H 200
extern fixed_t yslope[VIEW_3D_H];
#define HEIGHTBITS 6
#define SCALEBITS 9
#define FIXEDTOSCALE (FRACBITS-SCALEBITS)
#define FIXEDTOHEIGHT (FRACBITS-HEIGHTBITS)
#define HALF_SCREEN_W (SCREENWIDTH/2)
extern fixed_t viewx, viewy, viewz; //80077D0C, 80077D10, 80077D18
extern angle_t viewangle; //800780B8
extern fixed_t viewcos, viewsin; //80077EC8, 80077EE0
extern player_t *viewplayer; //80077D60
extern fixed_t finetangent[FINEANGLES/2];
extern int validcount; //800779F4
//extern int framecount;
/* */
/* R_data.c */
/* */
#define MAXSUBSECTORS 192 /* Maximum number of subsectors to scan */
extern short skypalette;
extern psxobj_t *skytexturep;
extern int firsttex, lasttex, numtextures;
extern psxobj_t *textures;
extern int *flattranslation; /* for global animation */
extern int *texturetranslation; /* for global animation */
extern int firstflat, lastflat, numflats;
extern psxobj_t *texflats;
extern int firstsprite, lastsprite, numsprites;
extern psxobj_t *texsprites;
#define MAX_PALETTES 20
extern short palette[MAX_PALETTES];
extern short palettebase;
extern light_t *lights;
#endif /* __R_LOCAL__ */
================================================
FILE: PSXDOOM/r_main.c
================================================
/* r_main.c */
#include "doomdef.h"
#include "r_local.h"
/*===================================== */
/* */
/* subsectors */
/* */
//subsector_t *vissubsectors[MAXVISSSEC], **lastvissubsector;
/* */
/* walls */
/* */
//viswall_t viswalls[MAXWALLCMDS], *lastwallcmd;
/* */
/* planes */
/* */
//visplane_t visplanes[MAXVISPLANES], *lastvisplane;
/* */
/* sprites */
/* */
//vissprite_t vissprites[MAXVISSPRITES], *lastsprite_p, *vissprite_p;
/* */
/* openings / misc refresh memory */
/* */
//unsigned short openings[MAXOPENINGS], *lastopening;
/*===================================== */
//boolean phase1completed;
//pixel_t *workingscreen;
fixed_t viewx, viewy, viewz; //80077D0C|uGp000008fc, 80077D10|uGp00000900, 80077D18|uGp00000908
angle_t viewangle; //800780B8|uGp00000ca8
fixed_t viewcos, viewsin; //80077EC8|iGp00000ab8, 80077EE0|iGp00000ad0
player_t *viewplayer; //80077D60|ppGp00000950
int validcount = 1; /* increment every time a check is made */ //800779F4
//int framecount; /* incremented every frame */
/* */
/* sky mapping */
/* */
boolean rendersky;//8007801C|iGp00000c0c
subsector_t *solidsubsectors[MAXSUBSECTORS]; //800A8F98 /* List of valid ranges to scan through */
subsector_t **endsubsector; //80077E90|ppsGp00000a80 /* Pointer to the first free entry */
int numdrawsubsectors; //80077F14|iGp00000b04
byte solidcols[256]; //800A8D2C psxdoom
/* */
/* precalculated math */
/* */
fixed_t *finecosine = &finesine[FINEANGLES/4];//80077A00
/* */
/* News */
/* */
light_t *baselight; //pbGp00000a70 L80077E80
unsigned int base_r; //iGp000008ac L80077CBC//r
unsigned int base_g; //iGp00000a50 L80077E60//g
unsigned int base_b; //iGp0000098c L80077D9C//b
boolean viewlighting; //80078088|iGp00000c78
sector_t *frontsector; //80077E38|psGp00000a28
light_t *lights; //80077E94|pbGp00000a84
short palette[MAX_PALETTES]; //800A8E68
short palettebase; //80077DA8
/*============================================================================= */
/*
==============
=
= R_Init
=
==============
*/
static MATRIX R_Matrix;//80086358
void R_Init (void) //L80030480()
{
R_InitData ();
//Initialize Matrix
R_Matrix.t[0] = 0;
R_Matrix.t[1] = 0;
R_Matrix.t[2] = 0;
SetTransMatrix(&R_Matrix);
R_Matrix.m[0][0] = 0;
R_Matrix.m[0][1] = 0;
R_Matrix.m[0][2] = 0;
R_Matrix.m[1][0] = 0;
R_Matrix.m[1][1] = 4096;
R_Matrix.m[1][2] = 0;
R_Matrix.m[2][0] = 0;
R_Matrix.m[2][1] = 0;
R_Matrix.m[2][2] = 0;
SetRotMatrix(&R_Matrix);
}
/*
==============
=
= R_RenderView
=
==============
*/
void R_RenderPlayerView(void)//L80030504()
{
RECT area;
angle_t angle;
DR_TWIN *texwindow = (DR_TWIN*) getScratchAddr(128);//1F800200
if (!viewlighting)
{
base_r = 128;
base_g = 128;
base_b = 128;
baselight = &lights[0];
}
viewplayer = &players[consoleplayer];
viewx = viewplayer->mo->x & (~FRACMASK);
viewy = viewplayer->mo->y & (~FRACMASK);
viewz = viewplayer->viewz & (~FRACMASK);
viewangle = viewplayer->mo->angle;
viewcos = finecosine[viewangle >> ANGLETOFINESHIFT];
viewsin = finesine[viewangle >> ANGLETOFINESHIFT];
R_Matrix.m[0][0] = viewsin >> 4;
R_Matrix.m[0][2] = -viewcos >> 4;
R_Matrix.m[2][0] = viewcos >> 4;
R_Matrix.m[2][2] = viewsin >> 4;
SetRotMatrix(&R_Matrix);
R_BSP();
numdrawsubsectors = (endsubsector - solidsubsectors);
DrawRender();
if (rendersky)
R_RenderSKY();
while (endsubsector--, (solidsubsectors-1) < endsubsector)
{
frontsector = (*endsubsector)->sector;
if (viewlighting)
{
baselight = &lights[frontsector->colorid];
base_r = (frontsector->lightlevel * baselight->r) >> 8;
base_g = (frontsector->lightlevel * baselight->g) >> 8;
base_b = (frontsector->lightlevel * baselight->b) >> 8;
if (viewplayer->extralight != 0)
{
base_r += viewplayer->extralight;
base_g += viewplayer->extralight;
base_b += viewplayer->extralight;
if (base_r > 255) { base_r = 255; }
if (base_g > 255) { base_g = 255; }
if (base_b > 255) { base_b = 255; }
}
}
R_RenderAll(*endsubsector);
}
R_Render_Hud_Weapons();
setRECT(&area, 0, 0, 0, 0);
SetTexWindow(texwindow, &area);
W_AddPrim(texwindow); /* add to order table*/
}
/*============================================================================= */
/*
===============================================================================
=
= R_PointToAngle
=
===============================================================================
*/
extern int tantoangle[SLOPERANGE + 1];
inline int SlopeDiv(unsigned num, unsigned den)//L80030A28()
{
unsigned ans;
if (den < 512)
return SLOPERANGE;
ans = (num << 3) / (den >> 8);
return ans <= SLOPERANGE ? ans : SLOPERANGE;
}
angle_t R_PointToAngle2(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2)//L80030A70()
{
int x;
int y;
x = x2 - x1;
y = y2 - y1;
if ((!x) && (!y))
return 0;
if (x >= 0)
{ /* x >=0 */
if (y >= 0)
{ /* y>= 0 */
if (x>y)
return tantoangle[SlopeDiv(y, x)]; /* octant 0 */
else
return ANG90 - 1 - tantoangle[SlopeDiv(x, y)]; /* octant 1 */
}
else
{ /* y<0 */
y = -y;
if (x>y)
return -tantoangle[SlopeDiv(y, x)]; /* octant 8 */
else
return ANG270 + tantoangle[SlopeDiv(x, y)]; /* octant 7 */
}
}
else
{ /* x<0 */
x = -x;
if (y >= 0)
{ /* y>= 0 */
if (x>y)
return ANG180 - 1 - tantoangle[SlopeDiv(y, x)]; /* octant 3 */
else
return ANG90 + tantoangle[SlopeDiv(x, y)]; /* octant 2 */
}
else
{ /* y<0 */
y = -y;
if (x>y)
return ANG180 + tantoangle[SlopeDiv(y, x)]; /* octant 4 */
else
return ANG270 - 1 - tantoangle[SlopeDiv(x, y)]; /* octant 5 */
}
}
}
/*
===============================================================================
=
= R_PointOnSide
=
= Returns side 0 (front) or 1 (back)
===============================================================================
*/
inline int R_PointOnSide(int x, int y, node_t *node)//L80030D84()
{
fixed_t dx, dy;
fixed_t left, right;
if (!node->line.dx)
{
if (x <= node->line.x)
return node->line.dy > 0;
return node->line.dy < 0;
}
if (!node->line.dy)
{
if (y <= node->line.y)
return node->line.dx < 0;
return node->line.dx > 0;
}
dx = (x - node->line.x);
dy = (y - node->line.y);
left = (node->line.dy >> 16) * (dx >> 16);
right = (dy >> 16) * (node->line.dx >> 16);
if (right < left)
return 0; /* front side */
return 1; /* back side */
}
/*
==============
=
= R_PointInSubsector
=
==============
*/
struct subsector_s *R_PointInSubsector(fixed_t x, fixed_t y)//L80030E2C()
{
node_t *node;
int side, nodenum;
if (!numnodes) /* single subsector is a special case */
return subsectors;
nodenum = numnodes - 1;
while (!(nodenum & NF_SUBSECTOR))
{
node = &nodes[nodenum];
side = R_PointOnSide(x, y, node);
nodenum = node->children[side];
}
return &subsectors[nodenum & ~NF_SUBSECTOR];
}
================================================
FILE: PSXDOOM/r_phase1.c
================================================
//Renderer phase 1 - BSP traversal
#include "doomdef.h"
#include "r_local.h"
int checkcoord[12][4] = //800676C8
{
{ 3, 0, 2, 1 },/* Above,Left */
{ 3, 0, 2, 0 },/* Above,Center */
{ 3, 1, 2, 0 },/* Above,Right */
{ 0, 0, 0, 0 },
{ 2, 0, 2, 1 },/* Center,Left */
{ 0, 0, 0, 0 },/* Center,Center */
{ 3, 1, 3, 0 },/* Center,Right */
{ 0, 0, 0, 0 },
{ 2, 0, 3, 1 },/* Below,Left */
{ 2, 1, 3, 1 },/* Below,Center */
{ 2, 1, 3, 0 },/* Below,Right */
{ 0, 0, 0, 0 }
};
extern subsector_t *solidsubsectors[MAXSUBSECTORS]; //800A8F98 /* List of valid ranges to scan through */
extern subsector_t **endsubsector; //80077E90|ppsGp00000a80 /* Pointer to the first free entry */
extern byte solidcols[256]; //800A8D2C psxdoom
void R_RenderBSPNode(int bspnum);
boolean R_CheckBBox(fixed_t bspcoord[4]);
void R_Subsector(int num);
void R_AddLine(seg_t *line);
//
// Kick off the rendering process by initializing the solidsubsectors array and then
// starting the BSP traversal.
//
void R_BSP(void) //L8002ABB8()
{
endsubsector = solidsubsectors; /* Init the free memory pointer */
D_memset(solidcols, 0, 256);
rendersky = false;
R_RenderBSPNode(numnodes - 1); /* Begin traversing the BSP tree for all walls in render range */
}
//
// Recursively descend through the BSP, classifying nodes according to the
// player's point of view, and render subsectors in view.
//
void R_RenderBSPNode(int bspnum)//L8002AC0C()
{
node_t *bsp;
//int side;
fixed_t dx, dy;
fixed_t left, right;
//printf("R_RenderBSPNode\n");
if (bspnum & NF_SUBSECTOR) // reached a subsector leaf?
{
if (bspnum == -1)
{
R_Subsector(0);
}
else
{
R_Subsector(bspnum & ~NF_SUBSECTOR);
}
}
else
{
bsp = &nodes[bspnum];
//decide which side the view point is on
//side = R_PointOnSide(viewx, viewy, bsp);
dx = (viewx - bsp->line.x);
dy = (viewy - bsp->line.y);
left = (bsp->line.dy >> 16) * (dx >> 16);
right = (dy >> 16) * (bsp->line.dx >> 16);
// Depending on which side of the halfspace we are on, reverse the traversal order:
if (right < left)
{
if (R_CheckBBox(bsp->bbox[0]))
R_RenderBSPNode(bsp->children[0]);
if (R_CheckBBox(bsp->bbox[1]))
R_RenderBSPNode(bsp->children[1]);
}
else
{
if (R_CheckBBox(bsp->bbox[1]))
R_RenderBSPNode(bsp->children[1]);
if (R_CheckBBox(bsp->bbox[0]))
R_RenderBSPNode(bsp->children[0]);
}
#if 0
if (right < left)
side = 0; /* front side */
else
side = 1; /* back side */
// recursively render front space
if (R_CheckBBox(bsp->bbox[side]))
R_RenderBSPNode(bsp->children[side]);
// possibly divide back space
if (R_CheckBBox(bsp->bbox[side ^ 1]))
R_RenderBSPNode(bsp->children[side ^ 1]);
#endif // 0
}
}
//
// Checks BSP node/subtree bounding box. Returns true if some part of the bbox
// might be visible.
//
#define SKIPVIS_FUDGE (FRACUNIT * 2)
boolean R_CheckBBox(fixed_t bspcoord[4])//L8002AD44()
{
int boxx;
int boxy;
int boxpos;
fixed_t x1, y1, x2, y2;
byte *solid_cols;
SVECTOR v0;
VECTOR v1;
long flag[4];
fixed_t vp1, vp2;
long vx1, vy1, vx2, vy2, delta;
long Xstart, Xend;
boolean skipvischeck;
// find the corners of the box that define the edges from current viewpoint
if (viewx < bspcoord[BOXLEFT])//if (viewx <= bspcoord[BOXLEFT])
boxx = 0;
else if (viewx <= bspcoord[BOXRIGHT])//if (viewx < bspcoord[BOXRIGHT])
boxx = 1;
else
boxx = 2;
if (viewy > bspcoord[BOXTOP])//if (viewy >= bspcoord[BOXTOP])
boxy = 0;
else if (viewy >= bspcoord[BOXBOTTOM])//if (viewy > bspcoord[BOXBOTTOM])
boxy = 1;
else
boxy = 2;
boxpos = (boxy << 2) + boxx;
if (boxpos == 5)
return true;
x1 = bspcoord[checkcoord[boxpos][0]];
y1 = bspcoord[checkcoord[boxpos][1]];
x2 = bspcoord[checkcoord[boxpos][2]];
y2 = bspcoord[checkcoord[boxpos][3]];
if (boxpos != 4)
{
if (boxpos < 5)
{
if (boxpos == 1)
{
// Above, Inside
skipvischeck = (viewy - y1 <= SKIPVIS_FUDGE);
} else
{
// Above, Left or Right
skipvischeck = false;
}
}
else if (boxpos == 6)
{
// Inside, Right
skipvischeck = (viewx - x1 <= SKIPVIS_FUDGE);
}
else if (boxpos == 9)
{
// Below, Inside
skipvischeck = (viewy - y1 >= -SKIPVIS_FUDGE);
}
else
{
// Below, Left or Right
skipvischeck = false;
}
}
else
{
// Inside, Left
skipvischeck = (viewx - x1 >= -SKIPVIS_FUDGE);
}
// If we decided to skip the check just assume the node is visible
if (skipvischeck)
return true;
v0.vy = 0;
v0.vx = (short)((x1 - viewx) >> 16);
v0.vz = (short)((y1 - viewy) >> 16);
RotTrans(&v0,&v1,flag);
vy1 = v1.vz;
vx1 = v1.vx;
v0.vy = 0;
v0.vx = (short)((x2 - viewx) >> 16);
v0.vz = (short)((y2 - viewy) >> 16);
RotTrans(&v0,&v1,flag);
vy2 = v1.vz;
vx2 = v1.vx;
if ((vx1 < -vy1) && (vx2 < -vy2))
return false;
if ((vy1 < vx1) && (vy2 < vx2))
return false;
if ((vx1 < -vy1) && (-vy2 < vx2))
{
delta = (vx1 + vy1);
delta = (delta << 16) / ((delta - vx2) - vy2);
delta = delta * (vy2 - vy1);
vy1 += (delta >> 16);
vx1 = -vy1;
}
if ((vx1 < vy1) && (vy2 < vx2))
{
delta = (vx1 - vy1);
delta = (delta << 16) / ((delta - vx2) + vy2);
delta = delta * (vy2 - vy1);
vy2 = vy1 + (delta >> 16);
vx2 = vy2;
}
if ((vy1 < 0) && (vy2 < 0))
return false;
if ((vy1 < 2) && (vy2 < 2))
return true;
if (vy1 < 1)
vy1 = 1;
if (vy2 < 1)
vy2 = 1;
Xstart = (((vx1 << 7) / vy1) + 0x80);
Xend = (((vx2 << 7) / vy2) + 0x80);
if (Xstart < 0)
Xstart = 0;
if (Xend > 256)
Xend = 256;
solid_cols = &solidcols[Xstart];
while (Xstart < Xend)
{
if (*solid_cols == 0)
return true;
solid_cols++;
Xstart++;
}
return false;
}
//
// Determine floor/ceiling planes, add sprites of things in sector,
// draw one or more segments.
//
void R_Subsector(int num)//L8002B1A8()
{
subsector_t *sub;
seg_t *line;
int count;
if (num >= numsubsectors)
{
I_Error("R_Subsector: ss %i with numss = %i", num, numsubsectors);
}
if ((endsubsector - solidsubsectors) < MAXSUBSECTORS)
{
sub = &subsectors[num];
frontsector = sub->sector;
*endsubsector = sub;//copy subsector
endsubsector++;
line = &segs[sub->firstline];
count = sub->numlines;
do
{
R_AddLine(line); /* Render each line */
++line; /* Inc the line pointer */
} while (--count); /* All done? */
}
}
//
// Clips the given segment and adds any visible pieces to the line list.
//
void R_AddLine(seg_t *line)//L8002B288
{
sector_t *backsector;
vertex_t *vrt, *vrt2;
int x1, y1, x2, y2, xpos1, xpos2, count;
long Xstart, Xend, delta;
byte *solid_cols;
SVECTOR v0;
VECTOR v1;
long flag[4];
line->flag &= ~1;
vrt = line->v1;
if (vrt->index != TextureCacheIdx)
{
v0.vy = 0;
v0.vx = (short)((vrt->x - viewx) >> 16);
v0.vz = (short)((vrt->y - viewy) >> 16);
RotTrans(&v0,&v1,flag);
vrt->vx = v1.vx;
vrt->vy = v1.vz;
if (vrt->vy >= 4)
{
vrt->yy = 0x800000 / vrt->vy;
vrt->xx = ((vrt->vx * (0x800000 / vrt->vy)) >> 16) + 0x80;
}
vrt->index = TextureCacheIdx;
y1 = vrt->vy;
x1 = vrt->vx;
}
else
{
x1 = vrt->vx;
y1 = vrt->vy;
}
vrt2 = line->v2;
if (vrt2->index != TextureCacheIdx)
{
v0.vy = 0;
v0.vx = (short)((vrt2->x - viewx) >> 16);
v0.vz = (short)((vrt2->y - viewy) >> 16);
RotTrans(&v0,&v1,flag);
vrt2->vx = v1.vx;
vrt2->vy = v1.vz;
if (vrt2->vy >= 4)
{
vrt2->yy = 0x800000 / vrt2->vy;
vrt2->xx = ((vrt2->vx * (0x800000 / vrt2->vy)) >> 16) + 0x80;
}
vrt2->index = TextureCacheIdx;
y2 = vrt2->vy;
x2 = vrt2->vx;
}
else
{
x2 = vrt2->vx;
y2 = vrt2->vy;
}
if ((x1 >= -y1) || (x2 >= -y2))
{
if ((y1 < x1) && (y2 < x2))
return;
if (((x2 * y1) - (x1 * y2)) > 0)
{
if ((x1 < -y1) && (-y2 < x2))
{
delta = (x1 + y1);
delta = (delta << 16) / ((delta - x2) - y2);
delta = delta * (y2 - y1);
y1 += (delta >> 16);
x1 = -y1;
}
if ((x1 < y1) && (y2 < x2))
{
delta = (x1 - y1);
delta = (delta << 16) / ((delta - x2) + y2);
delta = delta * (y2 - y1);
y2 = y1 + (delta >> 16);
x2 = y2;
}
if ((y1 >= 3) || (y2 >= 3))
{
if ((y1 < 2) && (y2 > 2))
{
delta = (2 - y1);
delta = (delta << 16) / (y2 - y1);
delta = delta * (x2 - x1);
y1 = 2;
x1 += (delta >> 16);
}
else if ((y2 < 2) && (y1 > 2))
{
delta = (2 - y2);
delta = (delta << 16) / (y1 - y2);
delta = delta * (x1 - x2);
y2 = 2;
x2 += (delta >> 16);
}
Xstart = (((x1 << 7) / y1) + 0x80);
Xend = (((x2 << 7) / y2) + 0x80);
if (Xstart != Xend)
{
if (frontsector->ceilingpic == -1)
rendersky = true;
if (Xstart < 0)
Xstart = 0;
if (Xend > 256)
Xend = 256;
solid_cols = &solidcols[Xstart];
count = Xstart;
xpos1 = 256;
while (count < Xend)
{
xpos1 = count;
if (*solid_cols == 0) break;
solid_cols++;
count++;
}
solid_cols = &solidcols[Xend-1];
count = Xend;
xpos2 = 0;
while (count >= Xstart)
{
xpos2 = count;
if (*solid_cols == 0) break;
solid_cols--;
count--;
}
if (xpos1 <= xpos2)
{
line->xpos1 = (short)xpos1 - 1;
line->xpos2 = (short)xpos2 + 1;
line->flag |= 1;
}
if (!(line->linedef->flags & ML_MIDMASKED))
{
backsector = line->backsector;
if(!backsector ||
backsector->ceilingheight <= frontsector->floorheight ||
backsector->floorheight >= frontsector->ceilingheight)
{
solid_cols = &solidcols[Xstart];
while (Xstart < Xend)
{
*solid_cols = 1;
Xstart += 1;
solid_cols++;
}
}
}
}
}
}
}
}
================================================
FILE: PSXDOOM/r_phase2.c
================================================
//Renderer phase 2
#include "doomdef.h"
#include "r_local.h"
void R_RenderSKY(void)//L8002BF4C
{
RECT rect;
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *skysprt = (SPRT*) getScratchAddr(128);//1F800200
if (skytexturep->index == -1)
{
rect.x = (skytexturep->vramx >> 1) + (skytexturep->vtpage & 15) * 64;
rect.y = (skytexturep->vramy) + (skytexturep->vtpage & 16) * 16;
rect.w = 32;
rect.h = 128;
LoadImage(&rect, (unsigned long *)(byte*)(lumpcache[skytexturep->lump].cache+8));
skytexturep->index = TextureCacheIdx;
}
setRECT(&rect, skytexturep->vramx, skytexturep->vramy, skytexturep->w, 128);
SetDrawMode(drawmode, 0, 0, skytexturep->vtpage, &rect);
W_AddPrim(drawmode);// add to order table
/* make sprite sky*/
setSprt(skysprt);
setShadeTex(skysprt, 1);
setXY0(skysprt, 0, 0);
setWH(skysprt, 256, skytexturep->h);
setUV0(skysprt, skytexturep->vramx - (char)(viewangle >> ANGLETOSKYSHIFT), skytexturep->vramy);
skysprt->clut = skypalette;
W_AddPrim(skysprt);// add to order table
}
#define VERTEXES 32
vertex_t newvertexes[VERTEXES];//0x80097acc
int numnewvertexes; //80078044, uGp00000c34
#define MAXLEAF 21
typedef struct
{
int num_leafs; //*
leaf_t lf[MAXLEAF]; //*4
} vleaf_t;
#define SKIP_NUM_LEAFS (sizeof(int)/4)
#define V_LEAF_SIZE (sizeof(vleaf_t)/4)
void R_FrontZClip(vleaf_t *vlf_in, vleaf_t **vlf_out);
int R_EdgeClipSide(int mode, vleaf_t **vlf);
int R_LeftEdgeClip(vleaf_t *vlf_in, vleaf_t **vlf_out);
int R_RightEdgeClip(vleaf_t *vlf_in, vleaf_t **vlf_out);
/*WALL*/
void R_WallPrep(leaf_t *lf);
void R_Render_Wall(leaf_t *lf, psxobj_t *texture, int topheight, int bottomheight, int top_V, int bottom_V, boolean translucent);
/*PLANE*/
typedef enum PlaneType {FLOOR, CEILING} PlaneType;
void R_PlanePrep(vleaf_t *vlf1, PlaneType mode);
void R_Render_Plane(vleaf_t *vlf1, int zheight, psxobj_t *psxobj);
/*SPRITE*/
void R_Render_Sprite(subsector_t *sub);
/*WEAPON*/
void R_Render_Hud_Weapons(void);
void R_RenderAll(subsector_t *sub)//L8002C5C8
{
SVECTOR v0;
VECTOR v1;
long flag[4];
leaf_t *lf;
leaf_t *leafs_ptr;//0x1F8000AC
vleaf_t *leafs_side[2], *leafs_s;//0x1F8000A8
vertex_t *vrt;
int i, sideclip, num_leafs, side;
unsigned long *memaddr;
memaddr = (unsigned long *)getScratchAddr(42);//0x1F8000A8
leafs_ptr = (leaf_t *)(memaddr + SKIP_NUM_LEAFS); //0x1F8000AC Memory leafs_side[0]->lf
leafs_side[0] = (vleaf_t *)(memaddr); //0x1F8000A8 Memory Base1
leafs_side[1] = (vleaf_t *)(memaddr + V_LEAF_SIZE); //0x1F800154 Memory Base2
num_leafs = sub->numleafs;
lf = &leafs[sub->leaf];
for (i = 0; i < num_leafs; i++)
{
vrt = lf->vertex;
leafs_ptr->seg = lf->seg;
leafs_ptr->vertex = vrt;
if (vrt->index != TextureCacheIdx)
{
v0.vy = 0;
v0.vx = (vrt->x - viewx) >> 16;
v0.vz = (vrt->y - viewy) >> 16;
RotTrans(&v0, &v1, flag);
vrt->vx = v1.vx;
vrt->vy = v1.vz;
if (v1.vz > 3)
{
vrt->yy = 0x800000 / v1.vz;
vrt->xx = ((0x800000 / v1.vz) * vrt->vx >> 0x10) + 0x80;
}
vrt->index = TextureCacheIdx;
}
lf++;
leafs_ptr++;
}
leafs_side[0]->num_leafs = num_leafs; //initial count leafs
numnewvertexes = 0;
side = 0;
lf = leafs_side[0]->lf;
for (i = 0; i < leafs_side[0]->num_leafs; i++)
{
if (lf->vertex->vy < 4)
{
if (side == 0)
leafs_s = leafs_side[1];
else
leafs_s = leafs_side[0];
R_FrontZClip(leafs_side[0], &leafs_s);
side ^= 1;
break;
}
lf++;
}
sideclip = R_EdgeClipSide(0, &leafs_side[side]);
if (sideclip > -1)
{
if (sideclip > 0)
{
if (side == 0)
leafs_s = leafs_side[1];
else
leafs_s = leafs_side[0];
sideclip = R_LeftEdgeClip(leafs_side[side], &leafs_s);
side ^= 1;
if (sideclip < 3)
return;
}
sideclip = R_EdgeClipSide(1, &leafs_side[side]);
if (sideclip > -1)
{
if (sideclip > 0)
{
if (side == 0)
leafs_s = leafs_side[1];
else
leafs_s = leafs_side[0];
sideclip = R_RightEdgeClip(leafs_side[side], &leafs_s);
side ^= 1;
if (sideclip < 3)
return;
}
//Walls
leafs_s = leafs_side[side];
lf = leafs_s->lf;
lf[leafs_s->num_leafs].vertex = leafs_s->lf[0].vertex;
lf[leafs_s->num_leafs].seg = leafs_s->lf[0].seg;
for (i = 0; i < leafs_s->num_leafs; i++)
{
if ((lf->seg) && (lf->seg->flag & 1))
{
R_WallPrep(lf);
}
lf++;
}
if (frontsector->floorheight < viewz)
{
R_PlanePrep(leafs_side[side],FLOOR);
}
if ((frontsector->ceilingpic != -1) && (viewz < frontsector->ceilingheight))
{
R_PlanePrep(leafs_side[side],CEILING);
}
//Sprites*/
R_Render_Sprite(sub);
}
}
}
void R_FrontZClip(vleaf_t *vlf_in, vleaf_t **vlf_out)//L8002C95C()
{
vertex_t *vrt;
leaf_t *lfin, *lfout, *lfnext;
int num_leafs, leafs_cnt, i;
int delta, y1, y2;
vleaf_t *vlf;
lfin = vlf_in->lf;
lfout = (*vlf_out)->lf;
num_leafs = vlf_in->num_leafs;
leafs_cnt = 0;
for (i = 0; i < num_leafs; i++)
{
if (i == (num_leafs-1))
lfnext = vlf_in->lf;
else
lfnext = (lfin+1);
y1 = 4 - lfin->vertex->vy;
y2 = 4 - lfnext->vertex->vy;
if (y1 == 0)
{
lfout->vertex = lfin->vertex;
lfout->seg = lfin->seg;
checkpoint:
leafs_cnt += 1;
lfout++;
if (leafs_cnt >= MAXLEAF)
I_Error("FrontZClip: Point Overflow");
}
else
{
if (y1 < 0)
{
lfout->vertex = lfin->vertex;
lfout->seg = lfin->seg;
leafs_cnt += 1;
lfout++;
if (leafs_cnt >= MAXLEAF)
I_Error("FrontZClip: Point Overflow");
}
if ((y2 != 0) && (~y2 >> 31 == y1 >> 31))
{
vrt = &newvertexes[numnewvertexes];
numnewvertexes++;
if (numnewvertexes >= VERTEXES)
I_Error("FrontZClip: exceeded max new vertexes\n");
delta = (y1 << 16) / (y1 - y2);
vrt->vy = 4;
vrt->vx = ((delta * (lfnext->vertex->vx - lfin->vertex->vx)) >> 16) + lfin->vertex->vx;
vrt->x = ((delta * (lfnext->vertex->x - lfin->vertex->x)) >> 16) + lfin->vertex->x;
vrt->y = ((delta * (lfnext->vertex->y - lfin->vertex->y)) >> 16) + lfin->vertex->y;
vrt->yy = (0x800000 / vrt->vy);
vrt->xx = ((vrt->yy * vrt->vx) >> 16) + 128;
vrt->index = TextureCacheIdx;
if ((y1 < 1) || (y2 > -1))
lfout->seg = NULL;
else
lfout->seg = lfin->seg;
lfout->vertex = vrt;
goto checkpoint;
}
}
lfin++;
}
(*vlf_out)->num_leafs = leafs_cnt;
}
int R_EdgeClipSide(int mode, vleaf_t **vlf)//L8002CC38()
{
leaf_t *lf;
int num_leafs, leafcnt, i, side;
unsigned long *addr;
lf = (*vlf)->lf;
addr = (unsigned long *)getScratchAddr(0); //0x1F800000
num_leafs = (*vlf)->num_leafs;
leafcnt = 0;
if (mode == 0)
{
for (i = 0; i < num_leafs; i++)
{
if (lf->vertex->vx >= -lf->vertex->vy)
{
addr[0] = 0;
leafcnt++;
}
else
{
addr[0] = 1;
leafcnt--;
}
lf++;
addr++;
}
}
else
{
for (i = 0; i < num_leafs; i++)
{
if (lf->vertex->vy >= lf->vertex->vx)
{
addr[0] = 0;
leafcnt++;
}
else
{
addr[0] = 1;
leafcnt--;
}
lf++;
addr++;
}
}
addr[0] = *getScratchAddr(0); //*0x1F800000
if (leafcnt == num_leafs)
side = 0;
else if (leafcnt != -num_leafs)
side = 1;
else
side = -1;
return side;
}
int R_LeftEdgeClip(vleaf_t *vlf_in, vleaf_t **vlf_out)//L8002CD38()
{
vertex_t *vrt;
leaf_t *lfin, *lfout, *lfnext;
int num_leafs, leafs_cnt, i;
unsigned long *addr;
int vx1, vx2, vy1, delta;
lfout = (*vlf_out)->lf;
lfin = vlf_in->lf;
leafs_cnt = 0;
num_leafs = vlf_in->num_leafs;
addr = (unsigned long *)getScratchAddr(0); //0x1F800000
for (i = 0; i < num_leafs; i++)
{
if (addr[0] == 0)
{
lfout->vertex = lfin->vertex;
lfout->seg = lfin->seg;
lfout++;
leafs_cnt++;
}
if (addr[0] == 0)
{
if (addr[1] == 1)
{
checknext:
if (i < (num_leafs-1))
lfnext = (lfin+1);
else
lfnext = vlf_in->lf;
vrt = &newvertexes[numnewvertexes];
numnewvertexes++;
if (numnewvertexes >= VERTEXES)
I_Error("LeftEdgeClip: exceeded max new vertexes\n");
vx1 = (lfin->vertex->vx + lfin->vertex->vy) << 16;
vx2 = (lfin->vertex->vx + lfin->vertex->vy) - (lfnext->vertex->vx + lfnext->vertex->vy);
delta = (vx1 / vx2);
vy1 = ((delta * (lfnext->vertex->vy - lfin->vertex->vy)) >> 16) + lfin->vertex->vy;
vrt->vy = vy1;
vrt->vx = -vy1;
vrt->x = ((delta * (lfnext->vertex->x - lfin->vertex->x)) >> 16) + lfin->vertex->x;
vrt->y = ((delta * (lfnext->vertex->y - lfin->vertex->y)) >> 16) + lfin->vertex->y;
vrt->yy = (0x800000 / vrt->vy);
vrt->xx = ((vrt->yy * vrt->vx) >> 16) + 128;
vrt->index = TextureCacheIdx;
lfout->vertex = vrt;
lfout->seg = lfin->seg;
lfout++;
leafs_cnt++;
if (leafs_cnt >= MAXLEAF)
I_Error("LeftEdgeClip: Point Overflow");
}
}
else if (addr[1] == 0) goto checknext;
lfin++;
addr++;
}
(*vlf_out)->num_leafs = leafs_cnt;
return leafs_cnt;
}
int R_RightEdgeClip(vleaf_t *vlf_in, vleaf_t **vlf_out)//L8002CFDC()
{
vertex_t *vrt;
leaf_t * lfin, *lfout, *lfnext;
int num_leafs, leafs_cnt, i;
unsigned long *addr;
int vx1, vx2, vy1, delta;
lfout = (*vlf_out)->lf;
lfin = vlf_in->lf;
leafs_cnt = 0;
num_leafs = vlf_in->num_leafs;
addr = (unsigned long *)getScratchAddr(0); //0x1F800000
for (i = 0; i < num_leafs; i++)
{
if (addr[0] == 0)
{
lfout->vertex = lfin->vertex;
lfout->seg = lfin->seg;
lfout++;
leafs_cnt++;
}
if (addr[0] == 0)
{
if (addr[1] == 1)
{
checknext:
if (i < (num_leafs-1))
lfnext = (lfin+1);
else
lfnext = vlf_in->lf;
vrt = &newvertexes[numnewvertexes];
numnewvertexes++;
if (numnewvertexes >= VERTEXES)
I_Error("RightEdgeClip: exceeded max new vertexes\n");
vx1 = (lfin->vertex->vx - lfin->vertex->vy) << 16;
vx2 = (lfin->vertex->vx - lfin->vertex->vy) - (lfnext->vertex->vx - lfnext->vertex->vy);
delta = (vx1 / vx2);
vy1 = ((delta * (lfnext->vertex->vy - lfin->vertex->vy)) >> 16) + lfin->vertex->vy;
vrt->vy = vy1;
vrt->vx = vy1;
vrt->x = ((delta * (lfnext->vertex->x - lfin->vertex->x)) >> 16) + lfin->vertex->x;
vrt->y = ((delta * (lfnext->vertex->y - lfin->vertex->y)) >> 16) + lfin->vertex->y;
vrt->yy = (0x800000 / vrt->vy) + 1;
vrt->xx = ((vrt->yy * vrt->vx) >> 16) + 128;
vrt->index = TextureCacheIdx;
lfout->vertex = vrt;
lfout->seg = lfin->seg;
lfout++;
leafs_cnt++;
if (leafs_cnt >= MAXLEAF)
I_Error("RightEdgeClip: Point Overflow");
}
}
else if (addr[1] == 0) goto checknext;
lfin++;
addr++;
}
(*vlf_out)->num_leafs = leafs_cnt;
return leafs_cnt;
}
//--------------------------------------
void R_WallPrep(leaf_t *lf)//L8002D27C
{
psxobj_t *texture;
sector_t *back_sector;
seg_t *seg;
line_t *li;
fixed_t f_ceilingheight;
fixed_t f_floorheight;
fixed_t b_ceilingheight;
fixed_t b_floorheight;
fixed_t m_top;
fixed_t m_bottom;
fixed_t height;
fixed_t top_V, bottom_V;
seg = lf->seg;
li = seg->linedef;
f_ceilingheight = (viewz - frontsector->ceilingheight) >> 16;
f_floorheight = (viewz - frontsector->floorheight) >> 16;
m_top = f_ceilingheight;//set middle top
m_bottom = f_floorheight;//set middle bottom
li->flags |= ML_MAPPED;
back_sector = seg->backsector;
if (back_sector)
{
b_ceilingheight = (viewz - back_sector->ceilingheight) >> 16;
b_floorheight = (viewz - back_sector->floorheight) >> 16;
if (back_sector->ceilingheight < frontsector->ceilingheight)
{
if (back_sector->ceilingpic != -1)
{
height = b_ceilingheight - f_ceilingheight;
if (height >= 256)
height = 255;
if (li->flags & ML_DONTPEGTOP)
{
top_V = (seg->sidedef->rowoffset >> FRACBITS);
bottom_V = top_V + height;
}
else
{
bottom_V = (seg->sidedef->rowoffset >> FRACBITS) + 255;
top_V = bottom_V - height;
}
m_top = b_ceilingheight;//clip middle top height
texture = &textures[texturetranslation[seg->sidedef->toptexture]];
R_Render_Wall(lf, texture, f_ceilingheight, b_ceilingheight, top_V, bottom_V, false);
}
}
if (frontsector->floorheight < back_sector->floorheight)
{
height = f_floorheight - b_floorheight;
if (height >= 256)
height = 255;
if (li->flags & ML_DONTPEGBOTTOM)
{
top_V = ((b_floorheight - f_ceilingheight) + (seg->sidedef->rowoffset >> FRACBITS)) & ~128;
}
else
{
top_V = (seg->sidedef->rowoffset >> FRACBITS);
}
bottom_V = top_V + height;
m_bottom = b_floorheight;//clip middle bottom height
texture = &textures[texturetranslation[seg->sidedef->bottomtexture]];
R_Render_Wall(lf, texture, b_floorheight, f_floorheight, top_V, bottom_V, false);
}
if (!(li->flags & (ML_MIDTRANSLUCENT| ML_MIDMASKED)))
{
return;
}
}
height = m_bottom - m_top;
if (height >= 256)
height = 255;
// handle unpegging (bottom of texture at bottom, or top of texture at top)
if (li->flags & ML_DONTPEGBOTTOM)
{
bottom_V = (seg->sidedef->rowoffset >> FRACBITS) + 255;
top_V = bottom_V - height;
}
else
{
top_V = (seg->sidedef->rowoffset >> FRACBITS);
bottom_V = top_V + height;
}
texture = &textures[texturetranslation[seg->sidedef->midtexture]];
R_Render_Wall(lf, texture, m_top, m_bottom, top_V, bottom_V, (li->flags & ML_MIDTRANSLUCENT));
}
//L8002D554
void R_Render_Wall(leaf_t *lf, psxobj_t *texture, int topheight, int bottomheight, int top_V, int bottom_V, boolean translucent)
{
RECT rect;
vertex_t *vrt;
seg_t *seg;
angle_t angle;
int xx, x1, x2;
int yy, y1, y2;
int ztop, zbot;
int ystep1, ystep2, xstep1, xstep2, zstep1;
int vcos, vsin, vx, vy, vstep1, vstep2, vd, vs1, vs2;
int intensity, r, g, b;
int v0, v1, u0, vd1, vd2, upos;
int deltax, deltay, ypos1, ypos2;
DR_TWIN *texwindow = (DR_TWIN*) getScratchAddr(128);//1F800200
POLY_FT3 *wallpoly = (POLY_FT3*) getScratchAddr(128);//1F800200
vrt = lf->vertex;
x1 = vrt->xx;
x2 = (lf[1].vertex)->xx;
xx = (unsigned)(x2 - x1);
if (xx > 0)
{
if (viewplayer->cheats & CF_X_RAY)
translucent = true;
if (texture->index == -1)
{
decode(lumpcache[texture->lump].cache, tempbuffer);
rect.x = (texture->vramx >> 1) + (texture->vtpage & 15) * 64;
rect.y = texture->vramy + (texture->vtpage & 16) * 16;
rect.w = 32;
rect.h = 128;
LoadImage(&rect, (unsigned long *)(byte*)(tempbuffer + 8));
texture->index = TextureCacheIdx;
}
setRECT(&rect, texture->vramx, texture->vramy, texture->w, texture->h);
SetTexWindow(texwindow, &rect);
W_AddPrim(texwindow);// add to order table
//Setup Wall Primitive Polygon
setPolyFT3(wallpoly);
if (translucent)
{
setSemiTrans(wallpoly, 1);
}
wallpoly->clut = palettebase;
wallpoly->tpage = texture->vtpage;
y1 = lf->vertex->yy;
y2 = (lf[1].vertex)->yy;
yy = (unsigned)(y2 - y1);
ztop = (topheight * y2) - (topheight * y1);
zbot = (bottomheight * y2) - (bottomheight * y1);
seg = lf->seg;
angle = seg->angle >> ANGLETOFINESHIFT;
vsin = finesine[angle];
vcos = finecosine[angle];
vx = (seg->v1->x - viewx) >> 8;
vy = (seg->v1->y - viewy) >> 8;
angle = ((seg->angle - viewangle) + ANG90) >> ANGLETOFINESHIFT;
vd = ((vx * (vsin >> 8)) - (vy * (vcos >> 8))) >> 8;
vstep1 = (vd * (finecosine[angle] >> 8)) >> 4;
vstep2 = finesine[angle] >> 12;
ystep1 = (topheight * y1) + (100 * FRACUNIT);
ystep2 = (bottomheight * y1) + (100 * FRACUNIT);
vs1 = ((x1 - 0x80) * vstep1) + ((vd * 8) * (finesine[angle] >> 8));
vs2 = ((x1 - 0x80) * vstep2) - ((finecosine[angle] >> 8) * 8);
deltax = (seg->xpos1 - x1);
if (x1 < seg->xpos1)
{
ystep1 += deltax * (ztop / xx);
ystep2 += deltax * (zbot / xx);
vs1 += deltax * vstep1;
vs2 += deltax * vstep2;
x1 = seg->xpos1;
}
if (seg->xpos2 < x2)
x2 = seg->xpos2;
while(x1 < x2)
{
ypos1 = (ystep1 >> 16);
ypos2 = (ystep2 >> 16);
if ((ypos1 <= 200) && (ypos2 >= 0))
{
upos = 0;
if (vs2 != 0)
{
upos = ((((seg->offset + FRACUNIT + seg->sidedef->textureoffset) -
((vx * (vcos >> 8)) + (vy * (vsin >> 8))) >> 8) + (vs1 / vs2)) >> 8);
}
v0 = top_V;
v1 = bottom_V;
deltay = (ypos2 - ypos1);
if ((deltay > 509))
{
vd = (100 - ypos1) << 16;
vd1 = v0 + (((vd/ deltay) * (v1 - v0)) >> 16);
vd2 = ((((100 * FRACUNIT) / deltay) * (v1 - v0)) >> 16);
if (ypos1 < 0)
{
ypos1 = 0;
v0 = vd1 - vd2;
}
if (ypos2 >= 201)
{
ypos2 = 200;
v1 = vd1 + vd2;
}
}
if (!viewlighting)
{
r = base_r;
g = base_g;
b = base_b;
}
else
{
intensity = y1 >> 8;
if (intensity < 64)
intensity = 64;
else if (intensity > 160)
intensity = 160;
r = (intensity * base_r) >> 7;
g = (intensity * base_g) >> 7;
b = (intensity * base_b) >> 7;
if (r > 255) { r = 255; }
if (g > 255) { g = 255; }
if (b > 255) { b = 255; }
}
setRGB0(wallpoly, r, g, b);
//setXY3(p,_x0,_y0,_x1,_y1,_x2,_y2)
setXY3(wallpoly,
x1 , ypos1-1,
x1+1, ypos2+1,
x1 , ypos2+1);
//setUV3(p,_u0,_v0,_u1,_v1,_u2,_v2)
setUV3(wallpoly,
upos, v0,
upos, v1,
upos, v1);
W_AddPrim(wallpoly);// add to order table
}
x1 += 1;
y1 += (yy / xx);
vs1 += vstep1;
vs2 += vstep2;
ystep1 += (ztop / xx);
ystep2 += (zbot / xx);
}
}
}
void R_PlanePrep(vleaf_t *vlf1, PlaneType planeType)//L8002E178
{
RECT rect;
int pic;
fixed_t zheight;
psxobj_t *psxobj;
byte *data;
DR_TWIN *texwindow = (DR_TWIN*) getScratchAddr(128);//1F800200
if (planeType == FLOOR)
{
pic = frontsector->floorpic;
}
//ceiling
else
{
pic = frontsector->ceilingpic;
}
//printf("flattranslation[pic] %d\n",flattranslation[pic]);
psxobj = &texflats[flattranslation[pic]];
if (psxobj->index == -1)
{
if (lumpencode[psxobj->lump] == 0)
{
data = (byte *)tempbuffer;
decode(lumpcache[psxobj->lump].cache, tempbuffer);
}
else
{
data = (byte *)lumpcache[psxobj->lump].cache;
}
rect.x = (psxobj->vramx >> 1) + (psxobj->vtpage & 15) * 64;
rect.y = psxobj->vramy + (psxobj->vtpage & 16) * 16;
rect.w = 32;
rect.h = 64;
LoadImage(&rect, (unsigned long *)(byte*)(data + 8));
psxobj->index = TextureCacheIdx;
}
setRECT(&rect, psxobj->vramx, psxobj->vramy, 64, 64);
SetTexWindow(texwindow, &rect);
W_AddPrim(texwindow);// add to order table
if (planeType == FLOOR)
{
zheight = (frontsector->floorheight - viewz);
}
//ceiling
else
{
zheight = (frontsector->ceilingheight - viewz);
}
//R_Render_Plane
R_Render_Plane(vlf1, zheight >> FRACBITS, psxobj);
}
typedef struct
{
unsigned int x_pos[2]; //*, 4
} xpos_t;
xpos_t x_table[200];//0x80097eb0
//L8002E5E4
void R_Render_Plane(vleaf_t *vlf1, int zheight, psxobj_t *psxobj)
{
leaf_t* lf1;
int num_leafs, i, j, v_index1, v_index2;
angle_t angle;
int yy1, yy2;
int x1, x2, y1, y2, side, tmp, xpos, ypos, linecnt;
int vcos, vsin, vx, vy;
int dx1, dx2, dx3, dx4;
int vx1, vx2, vy1, vy2;
int intensity, r, g, b;
int delta, delta1, delta2, delta3;
unsigned long *v_xx;
unsigned long *v_yy;
xpos_t *xtable;
#if FIX_FLATSPANS == 1
int origSpanR;
int origSpanUR;
int origSpanVR;
#endif
POLY_FT3 *planepoly = (POLY_FT3*) getScratchAddr(128);//1F800200
lf1 = vlf1->lf;
v_xx = (unsigned long *)getScratchAddr(160);
v_yy = (unsigned long *)getScratchAddr(160+MAXLEAF);
num_leafs = vlf1->num_leafs;
for (i = 0; i < num_leafs; i++)
{
v_xx[i] = lf1->vertex->xx;
v_yy[i] = 99 - ((zheight * lf1->vertex->yy) >> 16);
lf1++;
}
yy1 = 200;
yy2 = 0;
for (i = 0; i < num_leafs; i++)
{
if (i == (num_leafs - 1))
v_index1 = 0;
else
v_index1 = (i + 1);
if (v_yy[v_index1] != v_yy[i])
{
if ((int)v_yy[i] < (int)v_yy[v_index1])
{
v_index2 = i;
side = 1;
}
else
{
v_index2 = v_index1;
v_index1 = i;
side = 0;
}
y1 = v_yy[v_index2];
y2 = v_yy[v_index1];
x1 = v_xx[v_index2] << 16;
x2 = v_xx[v_index1] << 16;
delta = ((x2-x1)/(y2-y1));
if (y1 < 0)
{
x1 -= (y1 * delta);
y1 = 0;
}
if (y2 > 200)
y2 = 200;
if (y1 < yy1)
yy1 = y1;
if (yy2 < y2)
yy2 = y2;
xtable = &x_table[y1];
while (y1 < y2)
{
xtable->x_pos[side] = (x1 >> 16);
xtable++;
x1 += delta;
y1 += 1;
}
}
}
setPolyFT3(planepoly);
planepoly->clut = palettebase;
planepoly->tpage = psxobj->vtpage;
xtable = &x_table[yy1];
while (yy1 < yy2)
{
x1 = xtable->x_pos[0];
x2 = xtable->x_pos[1];
xtable++;
if (x1 != x2)
{
tmp = x1;
if (x2 < x1)
{
x1 = x2;
x2 = tmp;
}
angle = (zheight * yslope[yy1]) >> 16;
vcos = (angle * viewcos);
vsin = (angle * viewsin);
x1 -= 2;
x2 += 2;
vy = vsin + viewy;
vx = vcos + viewx;
if (vsin < 0)
vsin += 127;
vcos = (-viewcos * angle);
if (vcos < 0)
vcos += 127;
dx1 = ((x1 - 128) * (vsin >> 7));
dx2 = ((x1 - 128) * (vcos >> 7));
dx3 = ((x2 - 128) * (vsin >> 7));
dx4 = ((x2 - 128) * (vcos >> 7));
vx1 = (vx + dx1) >> 16;
vx2 = (vx + dx3) >> 16;
vy2 = (vy + dx4) >> 16;
vy1 = (vy + dx2) >> 16;
//------------------
if (vx1 < vx2)
{
tmp = (vx1 & -64);
vx1 -= tmp;
vx2 -= tmp;
}
else
{
tmp = (vx2 & -64);
vx2 -= tmp;
vx1 -= tmp;
}
if (vy1 < vy2)
{
tmp = (vy1 & -64);
vy1 -= tmp;
vy2 -= tmp;
}
else
{
tmp = (vy2 & -64);
vy2 -= tmp;
vy1 -= tmp;
}
if (!viewlighting)
{
r = base_r;
g = base_g;
b = base_b;
}
else
{
angle >>= 1;
intensity = 160;
intensity -= angle;
if (intensity < 64)
{
intensity = 64;
}
else if (intensity >= 161)
{
intensity = 160;
}
r = (intensity * base_r) >> 7;
g = (intensity * base_g) >> 7;
b = (intensity * base_b) >> 7;
if (r > 255) { r = 255; }
if (g > 255) { g = 255; }
if (b > 255) { b = 255; }
}
setRGB0(planepoly, r, g, b);
linecnt = 0;
if((vx1 < 256) == 0 || (vx2 < 256) == 0 || (vy1 < 256) == 0 || (vy2 < 256) == 0)
{
xpos = (vx2 - vx1);
if (xpos < 0)
xpos = -xpos;
xpos >>= 7;
ypos = (vy2 - vy1);
if (ypos < 0)
ypos = -ypos;
ypos >>= 7;
if (linecnt < ypos)
linecnt = ypos;
else
linecnt = xpos;
}
if (linecnt == 0)
{
//setXY3(p,_x0,_y0,_x1,_y1,_x2,_y2)
setXY3(planepoly,
x1, yy1,
x2, yy1,
x2, yy1+1);
//setUV3(p,_u0,_v0,_u1,_v1,_u2,_v2)
setUV3(planepoly,
vx1, vy1,
vx2, vy2,
vx2, vy2);
W_AddPrim(planepoly);// add to order table
}
else
{
linecnt += 1;
delta1 = ((x2 - x1) / linecnt);
delta2 = ((vx2 - vx1) / linecnt);
delta3 = ((vy2 - vy1) / linecnt);
// From PsyDoom: precision fix to prevent cracks at the right side of the screen on large open maps like 'Tower Of Babel'.
// Store the coords where the last span should end, and use those for the right side of the last span instead of
// the somewhat truncated/imprecise stepped coords.
//
// TODO: make this tweak configurable according to user prefs.
#if FIX_FLATSPANS == 1
origSpanR = x2;
origSpanUR = vx2;
origSpanVR = vy2;
#endif
for (j = 0; j < linecnt; j++)
{
x2 = (x1 + delta1);
vx2 = (vx1 + delta2);
vy2 = (vy1 + delta3);
// From PsyDoom: precision fix to prevent cracks at the right side of the screen on large open maps like 'Tower Of Babel'.
// TODO: make this tweak configurable according to user prefs.
#if FIX_FLATSPANS == 1
if ((j + 1) >= linecnt)
{
x2 = origSpanR;
vx2 = origSpanUR;
vy2 = origSpanVR;
}
#endif
xpos = 0;
if ((vx1 < vx2) && (vx2 < 256) == 0)
{
xpos = vx1 & -128;
vx1 -= xpos;
vx2 -= xpos;
}
else if((vx2 < vx1) && (vx1 < 256 == 0))
{
xpos = vx2 & -128;
vx2 -= xpos;
vx1 -= xpos;
}
ypos = 0;
if ((vy1 < vy2) && (vy2 < 256) == 0)
{
ypos = vy1 & -128;
vy1 -= ypos;
vy2 -= ypos;
}
else if ((vy2 < vy1) && (vy1 < 256) == 0)
{
ypos = vy2 & -128;
vy2 -= ypos;
vy1 -= ypos;
}
//setXY3(p,_x0,_y0,_x1,_y1,_x2,_y2)
setXY3(planepoly,
x1, yy1,
x2, yy1,
x2, yy1 + 1);
//setUV3(p,_u0,_v0,_u1,_v1,_u2,_v2)
setUV3(planepoly,
vx1, vy1,
vx2, vy2,
vx2, vy2);
W_AddPrim(planepoly);// add to order table
x1 = x2;
vx1 = vx2 + xpos;
vy1 = vy2 + ypos;
}
}
}
yy1++;
}
}
// A vissprite_t is a thing that will be drawn during a refresh
typedef struct vissprite_s
{
int x;
int z;
mobj_t *thing;
struct vissprite_s *next;//800A886C || L80096BA0 on tmp
} vissprite_t;
#define MAXVISSPRITES 64
vissprite_t vissprites[MAXVISSPRITES];//800a8860
vissprite_t visspritehead;//80096b94
#define ASPECT_CORRECT ((FRACUNIT * 4) / 5)
void R_Render_Sprite(subsector_t *sub)//L8002F200
{
mobj_t *thing;
fixed_t tx, tz;
spritedef_t *sprdef;
spriteframe_t *sprframe;
vissprite_t *vissprite_p;
vissprite_t *vissprite_p2;
angle_t ang;
unsigned int rot;
boolean flip;
int lump;
int blendflags ;
int x, y, w, h;
psxobj_t *spr;
RECT area;
SVECTOR v0;
VECTOR v1;
long flag[4];
int count;
DR_TWIN *texwindow = (DR_TWIN*) getScratchAddr(128);//1F800200
POLY_FT4 *spritepoly = (POLY_FT4*) getScratchAddr(128);//1F800200
visspritehead.next = &visspritehead;
vissprite_p = vissprites;
count = 0;
for (thing = sub->sector->thinglist; thing; thing = thing->snext)
{
if (thing->subsector != sub)
continue;
// transform origin relative to viewpoint
v0.vy = 0;
v0.vx = (short)((unsigned int)(thing->x - viewx) >> 0x10);
v0.vz = (short)((unsigned int)(thing->y - viewy) >> 0x10);
RotTrans(&v0,&v1,flag);
tz = v1.vz;
// thing is behind view plane?
if (tz < MINZ)
continue;
tx = v1.vx;
// too far off the side?
if (tx > (tz << 1) || tx < -(tz << 1))
continue;
vissprite_p->x = tx;
vissprite_p->z = 0x800000 / tz;
vissprite_p->thing = thing;
vissprite_p2 = &visspritehead;
if (vissprite_p2->next != &visspritehead)
{
do
{
if (vissprite_p->z <= vissprite_p2->next->z)
break;
vissprite_p2 = vissprite_p2->next;
} while (vissprite_p2->next != &visspritehead);
}
vissprite_p->next = vissprite_p2->next;
vissprite_p2->next = vissprite_p;
vissprite_p++;
count++;
if (count >= MAXVISSPRITES)
{
break;
}
}
if (count != 0)
{
setRECT(&area, 0, 0, 0, 0);
SetTexWindow(texwindow, &area);
W_AddPrim(texwindow);// add to order table
setPolyFT4(spritepoly);
spritepoly->clut = palettebase;
vissprite_p = visspritehead.next;
if (vissprite_p != &visspritehead)
{
do
{
thing = vissprite_p->thing;
sprdef = &sprites[thing->sprite];
sprframe = &sprdef->spriteframes[thing->frame & FF_FRAMEMASK];
if (sprframe->rotate != 0)
{
ang = R_PointToAngle2(viewx, viewy, thing->x, thing->y);
rot = (ang - thing->angle + (unsigned int)(ANG45 / 2) * 9) >> 29;
lump = sprframe->lump[rot];
flip = (boolean)(sprframe->flip[rot]);
}
else
{
lump = sprframe->lump[0];
flip = (boolean)(sprframe->flip[0]);
}
lump = lump - firstsprite;
spr = &texsprites[lump];
TextureCache(spr);
blendflags = (thing->flags & MF_ALL_BLEND_MASKS) >> 28;
if (blendflags != 0)
{
setSemiTrans(spritepoly, true);
}
else
{
setSemiTrans(spritepoly, false);
}
//Blend Translucent
spritepoly->tpage = spr->vtpage | getTPage(0, blendflags >> 1, 0, 0);
if (thing->frame & FF_FULLBRIGHT)
{
setRGB0(spritepoly, 160, 160, 160);
}
else
{
setRGB0(spritepoly, base_r, base_g, base_b);
}
y = -vissprite_p->z * ((thing->z - viewz >> 16) + spr->y);
y = (y >> 16) + 100;
w = ((((spr->w * ASPECT_CORRECT) >> 16) * vissprite_p->z) >> 16);
h = ((spr->h * vissprite_p->z) >> 16);
if (flip == 0)
{
//setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3)
setUV4(spritepoly,
spr->vramx , spr->vramy,
spr->vramx + spr->w - 1, spr->vramy,
spr->vramx , spr->vramy + spr->h - 1,
spr->vramx + spr->w - 1, spr->vramy + spr->h - 1);
x = (vissprite_p->x - ((spr->x * ASPECT_CORRECT) >> 16)) * vissprite_p->z;
x = (x >> 16) + 128;
}
else
{
//setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3)
setUV4(spritepoly,
spr->vramx + spr->w - 1, spr->vramy,
spr->vramx , spr->vramy,
spr->vramx + spr->w - 1, spr->vramy + spr->h - 1,
spr->vramx , spr->vramy + spr->h - 1);
x = (vissprite_p->x + ((spr->x * ASPECT_CORRECT) >> 16)) * vissprite_p->z;
x = (x >> 16) - (w - 128);
}
//setXY4(p,_x0,_y0,_x1,_y1,_x2,_y2,_x3,_y3)
setXY4(spritepoly,
x , y,
x + w , y,
x , y + h,
x + w , y + h);
W_AddPrim(spritepoly);// add to order table
vissprite_p = vissprite_p->next;
} while (vissprite_p != &visspritehead);
}
}
}
void R_Render_Hud_Weapons(void)//L8002FD04
{
int i;
pspdef_t *psp;
state_t *state;
spritedef_t *sprdef;
spriteframe_t *sprframe;
int lump;
int flagtranslucent;
unsigned short control_tpage;
byte r, g, b;
psxobj_t *spr;
RECT area;
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *weaponpic = (SPRT*) getScratchAddr(128);//1F800200
psp = &viewplayer->psprites[0];
for (i = 0; i < NUMPSPRITES; i++, psp++)
{
if ((state = psp->state) != 0) /* a null state means not active */
{
sprdef = &sprites[state->sprite];
sprframe = &sprdef->spriteframes[state->frame & FF_FRAMEMASK];
lump = sprframe->lump[0];
lump = lump - firstsprite;
spr = &texsprites[lump];
TextureCache(spr);
/* change default tpage directive */
setRECT(&area, 0, 0, 0, 0);
flagtranslucent = (viewplayer->mo->flags & (MF_BLENDMASK1 | MF_BLENDMASK2 | MF_BLENDMASK3)) != 0;
control_tpage = spr->vtpage | flagtranslucent << 5;
SetDrawMode(drawmode, 0, 0, control_tpage, &area);
W_AddPrim(drawmode);// add to order table
/* make sprite hud*/
setSprt(weaponpic);
if (flagtranslucent)
{
setSemiTrans(weaponpic, 1);
}
setXY0(weaponpic, ((psp->sx >> 16) + 128) - spr->x, ((psp->sy >> 16) + 199) - spr->y);
setWH(weaponpic, spr->w, spr->h);
setUV0(weaponpic, spr->vramx, spr->vramy);
weaponpic->clut = palettebase;
if (psp->state->frame & FF_FULLBRIGHT)
{
r = (baselight->r * 5) / 8;
g = (baselight->g * 5) / 8;
b = (baselight->b * 5) / 8;
setRGB0(weaponpic, r, g, b);
}
else
{
setRGB0(weaponpic, base_r, base_g, base_b);
}
W_AddPrim(weaponpic);// add to order table
}
}
}
================================================
FILE: PSXDOOM/s_sound.c
================================================
/* s_sound.c */
#include "doomdef.h"
#include "p_local.h"
#define abs(x) ((x)<0 ? -(x) : (x))
int CD_TRACK[NUM_CD_MUSIC_TRACKS] = { //80073C7C
2, // cdmusic_title_screen
3, // cdmusic_main_menu
4, // cdmusic_credits_demo
5, // cdmusic_intermission
6, // cdmusic_club_doom
7, // cdmusic_finale_doom1
8 // cdmusic_finale_doom2
};
typedef struct mapaudio_s
{
int Sfx_lcd_indx;
int music_indx;
}mapaudio_t;
typedef struct music_s
{
int lcd_indx;
int midi_indx;
int rev_mode;
short depthleft;
short depthright;
}music_t;
enum Musics
{
NO_MUSIC,
MUSAMB01,
MUSAMB02,
MUSAMB03,
MUSAMB04,
MUSAMB05,
MUSAMB06,
MUSAMB07,
MUSAMB08,
MUSAMB09,
MUSAMB10,
MUSAMB11,
MUSAMB12,
MUSAMB13,
MUSAMB14,
MUSAMB15,
MUSAMB16,
MUSAMB17,
MUSAMB18,
MUSAMB19,
MUSAMB20,
MUSAMB21,
MUSAMB22,
MUSAMB23,
MUSAMB24,
MUSAMB25,
MUSAMB26,
MUSAMB27,
MUSAMB28,
MUSAMB29
};
static mapaudio_t Map_Audio[62] = //800754FC
{
{ 0 , NO_MUSIC },
{ _MAP01_LCD , MUSAMB01 },
{ _MAP02_LCD , MUSAMB02 },
{ _MAP03_LCD , MUSAMB03 },
{ _MAP04_LCD , MUSAMB04 },
{ _MAP05_LCD , MUSAMB05 },
{ _MAP06_LCD , MUSAMB06 },
{ _MAP07_LCD , MUSAMB07 },
{ _MAP08_LCD , MUSAMB08 },
{ _MAP09_LCD , MUSAMB11 },
{ _MAP10_LCD , MUSAMB09 },
{ _MAP11_LCD , MUSAMB15 },
{ _MAP12_LCD , MUSAMB10 },
{ _MAP13_LCD , MUSAMB21 },
{ _MAP14_LCD , MUSAMB22 },
{ _MAP15_LCD , MUSAMB23 },
{ _MAP16_LCD , MUSAMB12 },
{ _MAP17_LCD , MUSAMB16 },
{ _MAP18_LCD , MUSAMB17 },
{ _MAP19_LCD , MUSAMB06 },
{ _MAP20_LCD , MUSAMB18 },
{ _MAP21_LCD , MUSAMB24 },
{ _MAP22_LCD , MUSAMB14 },
{ _MAP23_LCD , MUSAMB03 },
{ _MAP24_LCD , MUSAMB20 },
{ _MAP25_LCD , MUSAMB11 },
{ _MAP26_LCD , MUSAMB25 },
{ _MAP27_LCD , MUSAMB04 },
{ _MAP28_LCD , MUSAMB05 },
{ _MAP29_LCD , MUSAMB10 },
{ _MAP30_LCD , MUSAMB19 },
{ _MAP31_LCD , MUSAMB01 },
{ _MAP32_LCD , MUSAMB09 },
{ _MAP33_LCD , MUSAMB14 },
{ _MAP34_LCD , MUSAMB12 },
{ _MAP35_LCD , MUSAMB08 },
{ _MAP36_LCD , MUSAMB13 },
{ _MAP37_LCD , MUSAMB18 },
{ _MAP38_LCD , MUSAMB20 },
{ _MAP39_LCD , MUSAMB15 },
{ _MAP40_LCD , MUSAMB19 },
{ _MAP41_LCD , MUSAMB11 },
{ _MAP42_LCD , MUSAMB26 },
{ _MAP43_LCD , MUSAMB12 },
{ _MAP44_LCD , MUSAMB29 },
{ _MAP45_LCD , MUSAMB06 },
{ _MAP46_LCD , MUSAMB27 },
{ _MAP47_LCD , MUSAMB09 },
{ _MAP48_LCD , MUSAMB22 },
{ _MAP49_LCD , MUSAMB03 },
{ _MAP50_LCD , MUSAMB28 },
{ _MAP51_LCD , MUSAMB07 },
{ _MAP52_LCD , MUSAMB08 },
{ _MAP53_LCD , MUSAMB15 },
{ _MAP54_LCD , MUSAMB04 },
{ _MAP55_LCD , MUSAMB17 },
{ _MAP56_LCD , MUSAMB18 },
{ _MAP57_LCD , MUSAMB10 },
{ _MAP58_LCD , MUSAMB16 },
{ _MAP59_LCD , MUSAMB13 },
{ _MAP60_LCD , NO_MUSIC },
{ 0 , NO_MUSIC }
};
static music_t Music[31] = //8007530C
{
{ 0 , 0 , PSXSPU_REV_MODE_OFF , 0 , 0 },// No Music
{ _MUSLEV1_LCD, 90 , PSXSPU_REV_MODE_SPACE , 4095 , 4095 },// MUSAMB01
{ _MUSLEV2_LCD, 91 , PSXSPU_REV_MODE_SPACE , 4095 , 4095 },// MUSAMB02
{ _MUSLEV3_LCD, 92 , PSXSPU_REV_MODE_STUDIO_B, 10239, 10239 },// MUSAMB03
{ _MUSLEV4_LCD, 93 , PSXSPU_REV_MODE_HALL , 6143 , 6143 },// MUSAMB04
{ _MUSLEV5_LCD, 94 , PSXSPU_REV_MODE_STUDIO_A, 9215 , 9215 },// MUSAMB05
{ _MUSLEV6_LCD, 95 , PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB06
{ _MUSLEV7_LCD, 96 , PSXSPU_REV_MODE_STUDIO_C, 9983 , 9983 },// MUSAMB07
{ _MUSLEV8_LCD, 97 , PSXSPU_REV_MODE_STUDIO_B, 11775, 11775 },// MUSAMB08
{ _MUSLEV9_LCD, 98 , PSXSPU_REV_MODE_STUDIO_C, 12287, 12287 },// MUSAMB09
{ _MUSLEV10_LCD, 99 , PSXSPU_REV_MODE_SPACE , 4095 , 4095 },// MUSAMB10
{ _MUSLEV11_LCD, 100, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB11
{ _MUSLEV12_LCD, 101, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB12
{ _MUSLEV13_LCD, 102, PSXSPU_REV_MODE_SPACE , 4095 , 4095 },// MUSAMB13
{ _MUSLEV14_LCD, 103, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB14
{ _MUSLEV15_LCD, 104, PSXSPU_REV_MODE_STUDIO_B, 10239, 10239 },// MUSAMB15
{ _MUSLEV16_LCD, 105, PSXSPU_REV_MODE_SPACE , 4095 , 4095 },// MUSAMB16
{ _MUSLEV17_LCD, 106, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB17
{ _MUSLEV18_LCD, 107, PSXSPU_REV_MODE_SPACE , 4095 , 4095 },// MUSAMB18
{ _MUSLEV19_LCD, 108, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB19
{ _MUSLEV20_LCD, 109, PSXSPU_REV_MODE_STUDIO_C, 12287, 12287 },// MUSAMB20
{ _MUSLEV19_LCD, 108, PSXSPU_REV_MODE_STUDIO_C, 12287, 12287 },// MUSAMB19
{ _MUSLEV2_LCD, 91 , PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB02
{ _MUSLEV1_LCD, 90 , PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB01
{ _MUSLEV13_LCD, 102, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB13
{ _MUSLEV7_LCD, 96 , PSXSPU_REV_MODE_STUDIO_B, 10239, 10239 },// MUSAMB07
{ _MUSLEV16_LCD, 105, PSXSPU_REV_MODE_HALL , 8191 , 8191 },// MUSAMB16
{ _MUSLEV5_LCD, 94 , PSXSPU_REV_MODE_STUDIO_C, 12287, 12287 },// MUSAMB05
{ _MUSLEV1_LCD, 90 , PSXSPU_REV_MODE_STUDIO_C, 12287, 12287 },// MUSAMB01
{ _MUSLEV17_LCD, 106, PSXSPU_REV_MODE_STUDIO_C, 12287, 12287 },// MUSAMB17
{ 0 , 0 , PSXSPU_REV_MODE_OFF , 0 , 0 },// No Music
};
/*//FINAL DOOM
music_t Music[30] = //80075310
{
{ 0, 0, 0, 0, 0,
{ _MUSLEV23, 112, 5, 8191 , 8191 },// MUSAMB23
{ _MUSLEV29, 118, 4, 9983 , 9983 },// MUSAMB29
{ _MUSLEV24, 113, 6, 8191 , 8191 },// MUSAMB24
{ _MUSLEV30, 119, 6, 4095 , 4095 },// MUSAMB30
{ _MUSLEV21, 110, 6, 8191 , 8191 },// MUSAMB21
{ _MUSLEV27, 116, 5, 8191 , 8191 },// MUSAMB27
{ _MUSLEV25, 114, 6, 4095 , 4095 },// MUSAMB25
{ _MUSLEV28, 117, 5, 8191 , 8191 },// MUSAMB28
{ _MUSLEV22, 111, 6, 8191 , 8191 },// MUSAMB22
{ _MUSLEV26, 115, 6, 4095 , 4095 },// MUSAMB26
{ _MUSLEV1 , 90 , 6, 4095 , 4095 },// MUSAMB01
{ _MUSLEV2 , 91 , 6, 4095 , 4095 },// MUSAMB02
{ _MUSLEV3 , 92 , 3, 10239, 10239},// MUSAMB03
{ _MUSLEV4 , 93 , 5, 6143 , 6143 },// MUSAMB04
{ _MUSLEV5 , 94 , 2, 9215 , 9215 },// MUSAMB05
{ _MUSLEV6 , 95 , 5, 8191 , 8191 },// MUSAMB06
{ _MUSLEV7 , 96 , 4, 9983 , 9983 },// MUSAMB07
{ _MUSLEV8 , 97 , 3, 11775, 11775},// MUSAMB08
{ _MUSLEV9 , 98 , 4, 12287, 12287},// MUSAMB09
{ _MUSLEV10, 99 , 3, 10239, 10239},// MUSAMB10
{ _MUSLEV11, 100, 5, 8191 , 8191 },// MUSAMB11
{ _MUSLEV12, 101, 4, 12287, 12287},// MUSAMB12
{ _MUSLEV13, 102, 6, 4095 , 4095 },// MUSAMB13
{ _MUSLEV14, 103, 5, 8191 , 8191 },// MUSAMB14
{ _MUSLEV15, 104, 3, 10239, 10239},// MUSAMB15
{ _MUSLEV16, 105, 6, 4095 , 4095 },// MUSAMB16
{ _MUSLEV17, 106, 5, 8191 , 8191 },// MUSAMB17
{ _MUSLEV18, 107, 6, 4095 , 4095 },// MUSAMB18
{ _MUSLEV22, 111, 4, 12287, 12287},// MUSAMB22
{ _MUSLEV26, 115, 4, 12287, 12287},// MUSAMB26
};
*/
extern int psxsettings[SNDHW_TAG_MAX*2];
extern int *settings_list[2];
extern SampleBlock doomsfxblk;//8007eac0
extern SampleBlock mapsfxblk;//8007ec54
extern NoteState tmp_notestate;//0x8007e93c
#define WMD_SIZE 26000
static int mem_size = WMD_SIZE;//80077C34
static char mem_pntr[WMD_SIZE];//800783ac
#define SRAM_START 4112
int sram_pos = SRAM_START; //80077C48
int sram_load = 0;//80077C50
void *trackptr; //80077C4C
static int lcd_file_indx = 0;//80077C40
static int music_indx = 0; //80077C44
static int snd_vol = 0;//80077C54 iGp00000844
static int snd_pan = 0;//80077C58 iGp00000848
static int update_snd = 0; //80077C5C
/*
==================
=
= S_SetSoundVolume
=
==================
*/
void S_SetSoundVolume (int volume) //80040D1C
{
wess_master_sfx_vol_set(volume);
}
/*
==================
=
= S_SetMusicVolume
=
==================
*/
void S_SetMusicVolume(int volume)//80040D3C
{
int cd_volume;
wess_master_mus_vol_set(volume);
cd_volume = volume << 7;
if (0x3cff < cd_volume)
cd_volume = 0x3cff;
psxspu_set_cd_vol(cd_volume);
}
/*
==================
=
= S_StopMusic
=
==================
*/
void S_StopMusic(void)//80040D84
{
if (music_indx != 0)
wess_seq_stop(Music[music_indx].midi_indx);
}
/*
==================
=
= S_StartMusic
=
==================
*/
void S_StartMusic(void)//80040DC0
{
S_StopMusic();
if (music_indx != 0)
wess_seq_trigger(Music[music_indx].midi_indx);
}
/*
==================
=
= S_InitBlock
=
==================
*/
void S_InitBlock(SampleBlock *sampblk)//80040E08
{
sampblk->numsamps = 0;
}
/*
==================
=
= S_DoBlockClear
=
==================
*/
void S_DoBlockClear(SampleBlock *sampblk)//80040E10
{
while(sampblk->numsamps)
{
sampblk->numsamps--;
//if no other buffers have the sound, clear position
wess_dig_set_sample_position(sampblk->sampindx[sampblk->numsamps], (char *)0);
}
}
void S_Lcd_Load(int map_indx)//80040E88
{
int sram_pos_tmp;
if (lcd_file_indx != map_indx)
{
if (lcd_file_indx != 0)
{
if (music_indx != 0)
{
S_StopMusic();
do{} while (wess_seq_status(Music[music_indx].midi_indx) != SEQUENCE_INACTIVE);
wess_seq_range_free(90, 20);
}
S_DoBlockClear(&mapsfxblk);
}
if (map_indx == LASTLEVEL)
{
S_DoBlockClear(&doomsfxblk);
sram_load = 0;
sram_pos = SRAM_START;
}
else
{
if (sram_load == 0)
{
sram_pos = wess_dig_lcd_load((char *)_DOOMSFX_LCD, (void *)SRAM_START, &doomsfxblk, 0);
sram_pos += SRAM_START;
sram_load = 1;
}
}
sram_pos_tmp = sram_pos;
music_indx = Map_Audio[map_indx].music_indx;
if (music_indx == 0)
{
psxspu_init_reverb(0, 0, 0, 0, 0);
}
else
{
psxspu_init_reverb(Music[music_indx].rev_mode, Music[music_indx].depthleft, Music[music_indx].depthright, 0, 0);
wess_seq_load(Music[music_indx].midi_indx, trackptr);
sram_pos_tmp += wess_dig_lcd_load((char *)Music[music_indx].lcd_indx, (void *)sram_pos_tmp, &mapsfxblk, 0);
}
lcd_file_indx = map_indx;
if ((char *)Map_Audio[map_indx].Sfx_lcd_indx != (char *)0x0)
{
wess_dig_lcd_load((char *)Map_Audio[map_indx].Sfx_lcd_indx, (void *)sram_pos_tmp, &mapsfxblk, 0);
}
}
}
/*
==================
=
= S_Pause
=
==================
*/
void S_Pause(void)//80041088
{
wess_seq_pauseall (YesMute, &tmp_notestate);
}
/*
==================
=
= S_Resume
=
==================
*/
void S_Resume(void)//800410B0
{
wess_seq_restartall (&tmp_notestate);
}
/*
==================
=
= S_StopSound
=
==================
*/
void S_StopSound(unsigned long sequence_type)//800410D8
{
wess_seq_stoptype(sequence_type);
}
/*
==================
=
= S_StopAll
=
==================
*/
void S_StopAll(void)//800410F8
{
wess_seq_stopall();
}
/*
==================
=
= S_AdjustSoundParams
=
= Exclusive Psx Doom
==================
*/
// when to clip out sounds
// Does not fit the large outdoor areas.
#define S_CLIPPING_DIST (1124<>FRACBITS)
#define REVERB_OFF 1
int volume; //80077C54
int pan; //80077C54
void S_AdjustSoundParams(mobj_t *origin, int sound_id, TriggerPlayAttr *attr)//80041118
{
fixed_t dx, dy;
fixed_t dist_approx;
char vol;
char pan;
angle_t angle;
mobj_t* listener;
TriggerPlayAttr t_attr;
if ((NUMSFX-1) < sound_id)
return;
listener = players[consoleplayer].mo;
vol = 127;
if (origin == NULL)
{
pan = 64;
}
else
{
pan = 64;
if (origin != listener)
{
dx = abs(origin->x - listener->x);
dy = abs(origin->y - listener->y);
dist_approx = (dx + dy) - ((dx < dy ? dx : dy) >> 1);
if(dist_approx > S_CLIPPING_DIST)
return;
// angle of source to listener
angle = R_PointToAngle2(listener->x, listener->y, origin->x, origin->y);
if (angle <= listener->angle)
angle += 0xffffffff;
angle -= listener->angle;
// stereo separation
pan = 128 - ((finesine[angle >> ANGLETOFINESHIFT] * 96) >> FRACBITS) >> 1;
// volume calculation
if(dist_approx < S_CLOSE_DIST)
vol = 127;
else
vol = (((S_CLIPPING_DIST - dist_approx) >> FRACBITS) * 127) / S_ATTENUATOR;
if ((origin->x == listener->x) && (origin->y == listener->y))
pan = 64;
if (!(vol > 0))
return;
}
}
//Check Reverb Flag Sector
if (origin && (origin->subsector->sector->flags & REVERB_OFF))
t_attr.reverb = 0;
else
t_attr.reverb = 127;
t_attr.mask = (TRIGGER_VOLUME|TRIGGER_PAN|TRIGGER_REVERB);
t_attr.volume = vol;
t_attr.pan = pan;
attr = &t_attr;
snd_vol = vol;
snd_pan = pan;
wess_seq_trigger_type_special(sound_id, (unsigned long)origin, attr);
}
/*
==================
=
= S_StartSound
=
==================
*/
void S_StartSound(mobj_t *origin, int sound_id)//80041324
{
S_AdjustSoundParams(origin, sound_id, 0);
}
/*
==================
=
= S_UpdateSounds
=
==================
*/
void S_UpdateSounds(void) //80041344
{
update_snd += 1;
}
/*
==================
=
= PsxSoundInit
=
==================
*/
void PsxSoundInit(int sfx_volume, int mus_volume, void *data)//8004135C
{
PsxCd_File *fileptr;
//char *wmd_data;
wess_init();
psxcd_init();
fileptr = psxcd_open((char*)_DOOMSND_WMD);
psxcd_read(data, fileptr->file.size, fileptr);
psxcd_close(fileptr);
S_InitBlock(&doomsfxblk);
S_InitBlock(&mapsfxblk);
//Init wmd_data
//wmd_data = Z_Alloc(0x1e000, PU_STATIC, 0);
wess_load_module(data, mem_pntr, mem_size, settings_list);
//printf("wess_dig_lcd_loader_init\n");
wess_dig_lcd_loader_init(wess_get_master_status());
//printf("wess_seq_loader_init\n");
wess_seq_loader_init(wess_get_master_status(), (char*)_DOOMSND_WMD, YesOpenSeqHandle);
//printf("wess_seq_range_load\n");
//printf("wess_get_wmd_end %X\n", (int)wess_get_wmd_end);
trackptr = wess_get_wmd_end();
trackptr += wess_seq_range_load(0, 90, wess_get_wmd_end());
//printf("trackptr %X\n", (int)trackptr);
//Free wmd_data tmp
//Z_Free(wmd_data);
S_SetSoundVolume(sfx_volume);
S_SetMusicVolume(mus_volume);
sram_load = 0;
sram_pos += wess_dig_lcd_load((char *)_DOOMSFX_LCD,(void *)SRAM_START, &doomsfxblk, 0);
//printf("sram_pos %d\n",sram_pos);
sram_load = 1;
}
/*
==================
=
= PsxSoundExit
=
==================
*/
void PsxSoundExit (void)//8004149C
{
return;
}
================================================
FILE: PSXDOOM/snmain.s
================================================
; SN Systems replacement for main module
; in API lib
opt c+
DIPSW equ $1F802040 ;byte, read only
section .rdata
section .text
section .ctors
section .dtors
section .data
section .sdata
section .sbss
section .bss
xdef __SN_ENTRY_POINT,__main,__do_global_dtors
xdef _stacksize,_ramsize,_bbsstart
xdef __heapbase,__heapsize
xdef __text,__textlen
xdef __data,__datalen
xdef __bss,__bsslen
xref InitHeap,main
section .text
;_stacksize dw $00008000 ; /* set 32K stack */
;_ramsize dw $00200000 ; /* and 2MB CD ROM ram */
;
; This is the program entry point.
; 1) Clear program BSS section to zero
; 2) Set stack and heap
; 3) Call user entry point i.e. main()
; 4) Jmp back to downloader stub (should be call exit() or something?)
;
; Note: default ram size is 8 Megabytes
; default stack size is 32K
; stack position is top of RAM
; heap is all of RAM from end of prog to lowest stack addr
;
; Use can override these settings by declaring suitable values
; for these variables in his C code module along with main().
; e.g.
; _stacksize=0x00002000; /* set 8K stack */
; _ramsize=0x00100000; /* and 1MB ram */
;
; If user does not specify override valuse for these variables then
; the default values will be loaded from the SNDEF module in LIBSN.LIB
;
__SN_ENTRY_POINT:
la v0,sect(.sbss)
la v1,sectend(.bss)
@clrit:
opt at-
sw zero,0(v0)
addiu v0,v0,4
sltu at,v0,v1
bne at,zero,@clrit
nop
opt at+
; This was the old way to set ram-top. Read mem config from DIP switches.
;
; lui a0,DIPSW>>16
; lb v0,DIPSW&$FFFF(a0) ;read dip settings
; nop
; andi v0,v0,%00110000 ;mem size in bits 4 & 5
; srl v0,v0,2
; la a0,MemSizes
; addu a0,a0,v0
; lw v0,0(a0) ;put stack at top of RAM
; nop
lw v0,_ramsize ;this is the new way; because there
nop ; are no switches on new hardware.
addi v0,v0,-8 ;but leave room for two parameters
lui t0,$8000 ;(mem seg for kernel cached RAM)
or sp,v0,t0 ;set stack in kseg0
la a0,sectend(.bss) ; a0 = heap base
sll a0,a0,3
srl a0,a0,3 ;remove mem seg bits
lw v1,_stacksize
nop
subu a1,v0,v1 ;calc a1 = top of heap
subu a1,a1,a0 ; -heap base, => a1 = size of heap
or a0,a0,t0 ;heap in kseg0
sw ra,__ra_temp
la gp,sect(.sdata)
move fp,sp
jal InitHeap
addi a0,a0,4 ;don't know why they do this.
lw ra,__ra_temp
nop
jal main
nop
; Will fall through here if main() returns. Fall into debugger stub.
break $1 ;for want of something better
;MemSizes dw $00100000 ; 1 Megabyte
; dw $00200000 ; 2 Megabytes
; dw $00800000 ; 8 Megabytes ** default for MW 3.0
; dw $01000000 ;16 Megabytes
__main lw t0,__initialised
addiu sp,sp,-16
sw s0,4(sp)
sw s1,8(sp)
sw ra,12(sp)
bne t0,zero,@exit
li t0,1
sw t0,__initialised
la s0,sect(.ctors)
la s1,(sectend(.ctors)-sect(.ctors))/4
beq s1,zero,@exit
nop
@loop lw t0,0(s0)
addiu s0,s0,4
jalr t0
addiu s1,s1,-1
bne s1,zero,@loop
nop
@exit lw ra,12(sp)
lw s1,8(sp)
lw s0,4(sp)
addiu sp,sp,16
jr ra
nop
__do_global_dtors
lw t0,__initialised
addiu sp,sp,-16
sw s0,4(sp)
sw s1,8(sp)
sw ra,12(sp)
beq t0,zero,@exit
nop
la s0,sect(.dtors)
la s1,(sectend(.dtors)-sect(.dtors))/4
beq s1,zero,@exit
nop
@loop lw t0,0(s0)
addiu s0,s0,4
jalr t0
addiu s1,s1,-1
bne s1,zero,@loop
nop
@exit lw ra,12(sp)
lw s1,8(sp)
lw s0,4(sp)
addiu sp,sp,16
jr ra
nop
section .data
cnop 0,4 ;longword align
_ramsize dw $00200000 ; 2 Megabytes
_stacksize dw $00008000 ; default stack is 32k
_bbsstart dw sectend(.bss)
_gpstart dw 0
__heapbase dw 0
__heapsize dw 0
__text dw sect(.text)
__textlen dw sectend(.text)-sect(.text)
__data dw sect(.data)
__datalen dw sectend(.data)-sect(.data)
__bss dw sect(.bss)
__bsslen dw sectend(.bss)-sect(.bss)
__initialised dw 0
section .sbss
__ra_temp dsw 1
end
================================================
FILE: PSXDOOM/sounds.h
================================================
#ifndef __SOUNDSH__
#define __SOUNDSH__
/*
* Identifiers for all sfx in game.
*/
typedef enum
{
sfx_None,
sfx_sgcock,
sfx_punch,
sfx_itmbk,
sfx_firsht2,
sfx_barexp,
sfx_firxpl,
sfx_pistol,
sfx_shotgn,
sfx_plasma,
sfx_bfg,
sfx_sawup,
sfx_sawidl,
sfx_sawful,
sfx_sawhit,
sfx_rlaunc,
sfx_rxplod,
sfx_pstart,
sfx_pstop,
sfx_doropn,
sfx_dorcls,
sfx_stnmov,
sfx_swtchn,
sfx_swtchx,
sfx_itemup,
sfx_wpnup,
sfx_oof,
sfx_telept,
sfx_noway,
sfx_dshtgn,
sfx_dbopn,
sfx_dbload,
sfx_dbcls,
sfx_plpain,
sfx_pldeth,
sfx_slop,
sfx_posit1,
sfx_posit2,
sfx_posit3,
sfx_podth1,
sfx_podth2,
sfx_podth3,
sfx_posact,
sfx_popain,
sfx_dmpain,
sfx_dmact,
sfx_claw,
sfx_bgsit1,
sfx_bgsit2,
sfx_bgdth1,
sfx_bgdth2,
sfx_bgact,
sfx_sgtsit,
sfx_sgtatk,
sfx_sgtdth,
sfx_brssit,
sfx_brsdth,
sfx_cacsit,
sfx_cacdth,
sfx_sklatk,
sfx_skldth,
sfx_kntsit,
sfx_kntdth,
sfx_pesit,
sfx_pepain,
sfx_pedth,
sfx_bspsit,
sfx_bspdth,
sfx_bspact,
sfx_bspwlk,
sfx_manatk,
sfx_mansit,
sfx_mnpain,
sfx_mandth,
sfx_firsht,
sfx_skesit,
sfx_skedth,
sfx_skeact,
sfx_skeatk,
sfx_skeswg,
sfx_skepch,
sfx_cybsit,
sfx_cybdth,
sfx_hoof,
sfx_metal,
sfx_spisit,
sfx_spidth,
sfx_bdopn,
sfx_bdcls,
sfx_getpow,
NUMSFX
} sfxenum_t;
#endif
================================================
FILE: PSXDOOM/soundst.h
================================================
/* newsfx.h */
#if 0
typedef struct
{
int samples;
int loop_start;
int loop_end;
int info;
int unity;
int pitch_correction;
int decay_step;
unsigned char data[1];
} sfx_t;
typedef struct sfxinfo_s
{
char *name; /* up to 6-character name */
boolean singularity; /* Sfx singularity (only one at a time) */
int priority; /* Sfx priority */
struct sfxinfo_s *link; /* referenced sound if a link */
int pitch; /* pitch if a link */
int volume; /* volume if a link */
sfx_t *md_data; /* machine-dependent sound data */
} sfxinfo_t;
typedef struct
{
char *name; /* up to 6-character name */
void *md_data; /* machine-dependent music data */
} musicinfo_t;
/*============================================================================ */
#define INTERNALQUADS 256 /* 4k / 16 bytes per quad (64 bits) */
#define EXTERNALQUADS 512 /* 16k / 32 bytes per quad (16 bits+music) */
#define SFXCHANNELS 4
typedef struct
{
unsigned *source; /* work in groups of 4 8 bit samples */
int startquad;
int stopquad;
int volume; /* range from 0-32k */
sfxinfo_t *sfx;
mobj_t *origin;
} sfxchannel_t;
extern sfxchannel_t sfxchannels[SFXCHANNELS];
extern int finalquad; /* the last quad mixed by update. */
extern int sfxvolume; /* range 0 - 255 */
extern int musicvolume; /* range 0 - 255 */
extern int oldsfxvolume; /* to detect transition to sound off */
extern int soundtics; /* time spent mixing sounds */
extern int soundstarttics; /* time S_Update started */
extern int sfxsample; /* the sample about to be output */
/* by S_WriteOutSamples */
/* external buffer for sfx and music */
extern int soundbuffer[EXTERNALQUADS*16];
extern int samplecount; /* 22khz sample counter in DSP memory */
#endif
/*============================================================================ */
void S_Init(void);
void S_Clear (void);
void S_StartSound(mobj_t *origin, int sound_id);
void S_UpdateSounds(void);
================================================
FILE: PSXDOOM/sprinfo.c
================================================
/* sprinfo.c -- generated by sprgen */
#include "doomdef.h"
#include "r_local.h"
spriteframe_t spriteframes[] = {//80060A10
{1, {857,858,859,860,861,860,859,858}, {0,0,0,0,0,1,1,1}},
{1, {862,863,864,865,866,865,864,863}, {0,0,0,0,0,1,1,1}},
{1, {867,868,869,870,871,870,869,868}, {0,0,0,0,0,1,1,1}},
{1, {872,873,874,875,876,875,874,873}, {0,0,0,0,0,1,1,1}},
{1, {877,878,879,880,881,880,879,878}, {0,0,0,0,0,1,1,1}},
{1, {882,883,884,885,886,885,884,883}, {0,0,0,0,0,1,1,1}},
{1, {887,888,889,890,891,890,889,888}, {0,0,0,0,0,1,1,1}},
{1, {892,893,894,895,896,895,894,893}, {0,0,0,0,0,1,1,1}},
{0, {897,897,897,897,897,897,897,897}, {0,0,0,0,0,0,0,0}},
{0, {898,898,898,898,898,898,898,898}, {0,0,0,0,0,0,0,0}},
{0, {899,899,899,899,899,899,899,899}, {0,0,0,0,0,0,0,0}},
{0, {900,900,900,900,900,900,900,900}, {0,0,0,0,0,0,0,0}},
{0, {901,901,901,901,901,901,901,901}, {0,0,0,0,0,0,0,0}},
{0, {902,902,902,902,902,902,902,902}, {0,0,0,0,0,0,0,0}},
{0, {903,903,903,903,903,903,903,903}, {0,0,0,0,0,0,0,0}},
{0, {904,904,904,904,904,904,904,904}, {0,0,0,0,0,0,0,0}},
{0, {905,905,905,905,905,905,905,905}, {0,0,0,0,0,0,0,0}},
{0, {906,906,906,906,906,906,906,906}, {0,0,0,0,0,0,0,0}},
{0, {907,907,907,907,907,907,907,907}, {0,0,0,0,0,0,0,0}},
{0, {908,908,908,908,908,908,908,908}, {0,0,0,0,0,0,0,0}},
{0, {909,909,909,909,909,909,909,909}, {0,0,0,0,0,0,0,0}},
{0, {14,14,14,14,14,14,14,14}, {0,0,0,0,0,0,0,0}},
{0, {15,15,15,15,15,15,15,15}, {0,0,0,0,0,0,0,0}},
{0, {16,16,16,16,16,16,16,16}, {0,0,0,0,0,0,0,0}},
{0, {17,17,17,17,17,17,17,17}, {0,0,0,0,0,0,0,0}},
{0, {4,4,4,4,4,4,4,4}, {0,0,0,0,0,0,0,0}},
{0, {5,5,5,5,5,5,5,5}, {0,0,0,0,0,0,0,0}},
{0, {6,6,6,6,6,6,6,6}, {0,0,0,0,0,0,0,0}},
{0, {7,7,7,7,7,7,7,7}, {0,0,0,0,0,0,0,0}},
{0, {8,8,8,8,8,8,8,8}, {0,0,0,0,0,0,0,0}},
{0, {9,9,9,9,9,9,9,9}, {0,0,0,0,0,0,0,0}},
{0, {10,10,10,10,10,10,10,10}, {0,0,0,0,0,0,0,0}},
{0, {11,11,11,11,11,11,11,11}, {0,0,0,0,0,0,0,0}},
{0, {12,12,12,12,12,12,12,12}, {0,0,0,0,0,0,0,0}},
{0, {13,13,13,13,13,13,13,13}, {0,0,0,0,0,0,0,0}},
{0, {18,18,18,18,18,18,18,18}, {0,0,0,0,0,0,0,0}},
{0, {19,19,19,19,19,19,19,19}, {0,0,0,0,0,0,0,0}},
{0, {20,20,20,20,20,20,20,20}, {0,0,0,0,0,0,0,0}},
{0, {21,21,21,21,21,21,21,21}, {0,0,0,0,0,0,0,0}},
{0, {22,22,22,22,22,22,22,22}, {0,0,0,0,0,0,0,0}},
{0, {23,23,23,23,23,23,23,23}, {0,0,0,0,0,0,0,0}},
{0, {24,24,24,24,24,24,24,24}, {0,0,0,0,0,0,0,0}},
{0, {25,25,25,25,25,25,25,25}, {0,0,0,0,0,0,0,0}},
{0, {26,26,26,26,26,26,26,26}, {0,0,0,0,0,0,0,0}},
{0, {27,27,27,27,27,27,27,27}, {0,0,0,0,0,0,0,0}},
{0, {28,28,28,28,28,28,28,28}, {0,0,0,0,0,0,0,0}},
{0, {29,29,29,29,29,29,29,29}, {0,0,0,0,0,0,0,0}},
{0, {30,30,30,30,30,30,30,30}, {0,0,0,0,0,0,0,0}},
{0, {31,31,31,31,31,31,31,31}, {0,0,0,0,0,0,0,0}},
{0, {32,32,32,32,32,32,32,32}, {0,0,0,0,0,0,0,0}},
{0, {33,33,33,33,33,33,33,33}, {0,0,0,0,0,0,0,0}},
{0, {34,34,34,34,34,34,34,34}, {0,0,0,0,0,0,0,0}},
{0, {35,35,35,35,35,35,35,35}, {0,0,0,0,0,0,0,0}},
{0, {36,36,36,36,36,36,36,36}, {0,0,0,0,0,0,0,0}},
{0, {37,37,37,37,37,37,37,37}, {0,0,0,0,0,0,0,0}},
{0, {38,38,38,38,38,38,38,38}, {0,0,0,0,0,0,0,0}},
{0, {39,39,39,39,39,39,39,39}, {0,0,0,0,0,0,0,0}},
{0, {40,40,40,40,40,40,40,40}, {0,0,0,0,0,0,0,0}},
{0, {41,41,41,41,41,41,41,41}, {0,0,0,0,0,0,0,0}},
{0, {42,42,42,42,42,42,42,42}, {0,0,0,0,0,0,0,0}},
{0, {43,43,43,43,43,43,43,43}, {0,0,0,0,0,0,0,0}},
{0, {44,44,44,44,44,44,44,44}, {0,0,0,0,0,0,0,0}},
{0, {45,45,45,45,45,45,45,45}, {0,0,0,0,0,0,0,0}},
{0, {46,46,46,46,46,46,46,46}, {0,0,0,0,0,0,0,0}},
{0, {47,47,47,47,47,47,47,47}, {0,0,0,0,0,0,0,0}},
{0, {48,48,48,48,48,48,48,48}, {0,0,0,0,0,0,0,0}},
{0, {49,49,49,49,49,49,49,49}, {0,0,0,0,0,0,0,0}},
{0, {50,50,50,50,50,50,50,50}, {0,0,0,0,0,0,0,0}},
{0, {51,51,51,51,51,51,51,51}, {0,0,0,0,0,0,0,0}},
{0, {52,52,52,52,52,52,52,52}, {0,0,0,0,0,0,0,0}},
{0, {966,966,966,966,966,966,966,966}, {0,0,0,0,0,0,0,0}},
{0, {967,967,967,967,967,967,967,967}, {0,0,0,0,0,0,0,0}},
{0, {968,968,968,968,968,968,968,968}, {0,0,0,0,0,0,0,0}},
{0, {1101,1101,1101,1101,1101,1101,1101,1101}, {0,0,0,0,0,0,0,0}},
{0, {1102,1102,1102,1102,1102,1102,1102,1102}, {0,0,0,0,0,0,0,0}},
{0, {1103,1103,1103,1103,1103,1103,1103,1103}, {0,0,0,0,0,0,0,0}},
{0, {1104,1104,1104,1104,1104,1104,1104,1104}, {0,0,0,0,0,0,0,0}},
{0, {922,922,922,922,922,922,922,922}, {0,0,0,0,0,0,0,0}},
{0, {923,923,923,923,923,923,923,923}, {0,0,0,0,0,0,0,0}},
{0, {924,924,924,924,924,924,924,924}, {0,0,0,0,0,0,0,0}},
{0, {925,925,925,925,925,925,925,925}, {0,0,0,0,0,0,0,0}},
{0, {926,926,926,926,926,926,926,926}, {0,0,0,0,0,0,0,0}},
{0, {927,927,927,927,927,927,927,927}, {0,0,0,0,0,0,0,0}},
{0, {928,928,928,928,928,928,928,928}, {0,0,0,0,0,0,0,0}},
{0, {929,929,929,929,929,929,929,929}, {0,0,0,0,0,0,0,0}},
{0, {930,930,930,930,930,930,930,930}, {0,0,0,0,0,0,0,0}},
{0, {931,931,931,931,931,931,931,931}, {0,0,0,0,0,0,0,0}},
{1, {932,933,934,935,932,935,934,933}, {0,0,0,0,1,1,1,1}},
{1, {936,937,938,939,936,939,938,937}, {0,0,0,0,1,1,1,1}},
{0, {940,940,940,940,940,940,940,940}, {0,0,0,0,0,0,0,0}},
{0, {941,941,941,941,941,941,941,941}, {0,0,0,0,0,0,0,0}},
{0, {942,942,942,942,942,942,942,942}, {0,0,0,0,0,0,0,0}},
{0, {1084,1084,1084,1084,1084,1084,1084,1084}, {0,0,0,0,0,0,0,0}},
{0, {1085,1085,1085,1085,1085,1085,1085,1085}, {0,0,0,0,0,0,0,0}},
{0, {1079,1079,1079,1079,1079,1079,1079,1079}, {0,0,0,0,0,0,0,0}},
{0, {1080,1080,1080,1080,1080,1080,1080,1080}, {0,0,0,0,0,0,0,0}},
{0, {1081,1081,1081,1081,1081,1081,1081,1081}, {0,0,0,0,0,0,0,0}},
{0, {1082,1082,1082,1082,1082,1082,1082,1082}, {0,0,0,0,0,0,0,0}},
{0, {1083,1083,1083,1083,1083,1083,1083,1083}, {0,0,0,0,0,0,0,0}},
{1, {1062,1066,1065,1064,1063,1064,1065,1066}, {0,1,1,1,0,0,0,0}},
{0, {1067,1067,1067,1067,1067,1067,1067,1067}, {0,0,0,0,0,0,0,0}},
{0, {1068,1068,1068,1068,1068,1068,1068,1068}, {0,0,0,0,0,0,0,0}},
{0, {1069,1069,1069,1069,1069,1069,1069,1069}, {0,0,0,0,0,0,0,0}},
{0, {960,960,960,960,960,960,960,960}, {0,0,0,0,0,0,0,0}},
{0, {961,961,961,961,961,961,961,961}, {0,0,0,0,0,0,0,0}},
{0, {950,950,950,950,950,950,950,950}, {0,0,0,0,0,0,0,0}},
{0, {951,951,951,951,951,951,951,951}, {0,0,0,0,0,0,0,0}},
{0, {952,952,952,952,952,952,952,952}, {0,0,0,0,0,0,0,0}},
{0, {953,953,953,953,953,953,953,953}, {0,0,0,0,0,0,0,0}},
{0, {954,954,954,954,954,954,954,954}, {0,0,0,0,0,0,0,0}},
{0, {955,955,955,955,955,955,955,955}, {0,0,0,0,0,0,0,0}},
{0, {956,956,956,956,956,956,956,956}, {0,0,0,0,0,0,0,0}},
{0, {957,957,957,957,957,957,957,957}, {0,0,0,0,0,0,0,0}},
{0, {958,958,958,958,958,958,958,958}, {0,0,0,0,0,0,0,0}},
{0, {959,959,959,959,959,959,959,959}, {0,0,0,0,0,0,0,0}},
{0, {1148,1148,1148,1148,1148,1148,1148,1148}, {0,0,0,0,0,0,0,0}},
{0, {1149,1149,1149,1149,1149,1149,1149,1149}, {0,0,0,0,0,0,0,0}},
{0, {1150,1150,1150,1150,1150,1150,1150,1150}, {0,0,0,0,0,0,0,0}},
{0, {1151,1151,1151,1151,1151,1151,1151,1151}, {0,0,0,0,0,0,0,0}},
{0, {1152,1152,1152,1152,1152,1152,1152,1152}, {0,0,0,0,0,0,0,0}},
{0, {1153,1153,1153,1153,1153,1153,1153,1153}, {0,0,0,0,0,0,0,0}},
{0, {1154,1154,1154,1154,1154,1154,1154,1154}, {0,0,0,0,0,0,0,0}},
{0, {1155,1155,1155,1155,1155,1155,1155,1155}, {0,0,0,0,0,0,0,0}},
{0, {1156,1156,1156,1156,1156,1156,1156,1156}, {0,0,0,0,0,0,0,0}},
{0, {1157,1157,1157,1157,1157,1157,1157,1157}, {0,0,0,0,0,0,0,0}},
{0, {1040,1040,1040,1040,1040,1040,1040,1040}, {0,0,0,0,0,0,0,0}},
{0, {1041,1041,1041,1041,1041,1041,1041,1041}, {0,0,0,0,0,0,0,0}},
{0, {1042,1042,1042,1042,1042,1042,1042,1042}, {0,0,0,0,0,0,0,0}},
{0, {1043,1043,1043,1043,1043,1043,1043,1043}, {0,0,0,0,0,0,0,0}},
{0, {1044,1044,1044,1044,1044,1044,1044,1044}, {0,0,0,0,0,0,0,0}},
{1, {490,491,492,493,494,493,492,491}, {0,0,0,0,0,1,1,1}},
{1, {495,496,497,498,499,498,497,496}, {0,0,0,0,0,1,1,1}},
{1, {500,501,502,503,504,503,502,501}, {0,0,0,0,0,1,1,1}},
{1, {505,506,507,508,509,508,507,506}, {0,0,0,0,0,1,1,1}},
{1, {510,511,512,513,514,513,512,511}, {0,0,0,0,0,1,1,1}},
{1, {515,516,517,518,519,518,517,516}, {0,0,0,0,0,1,1,1}},
{1, {520,521,522,523,524,523,522,521}, {0,0,0,0,0,1,1,1}},
{0, {525,525,525,525,525,525,525,525}, {0,0,0,0,0,0,0,0}},
{0, {526,526,526,526,526,526,526,526}, {0,0,0,0,0,0,0,0}},
{0, {527,527,527,527,527,527,527,527}, {0,0,0,0,0,0,0,0}},
{0, {528,528,528,528,528,528,528,528}, {0,0,0,0,0,0,0,0}},
{0, {529,529,529,529,529,529,529,529}, {0,0,0,0,0,0,0,0}},
{0, {530,530,530,530,530,530,530,530}, {0,0,0,0,0,0,0,0}},
{0, {531,531,531,531,531,531,531,531}, {0,0,0,0,0,0,0,0}},
{0, {532,532,532,532,532,532,532,532}, {0,0,0,0,0,0,0,0}},
{0, {533,533,533,533,533,533,533,533}, {0,0,0,0,0,0,0,0}},
{0, {534,534,534,534,534,534,534,534}, {0,0,0,0,0,0,0,0}},
{0, {535,535,535,535,535,535,535,535}, {0,0,0,0,0,0,0,0}},
{0, {536,536,536,536,536,536,536,536}, {0,0,0,0,0,0,0,0}},
{0, {537,537,537,537,537,537,537,537}, {0,0,0,0,0,0,0,0}},
{0, {538,538,538,538,538,538,538,538}, {0,0,0,0,0,0,0,0}},
{0, {539,539,539,539,539,539,539,539}, {0,0,0,0,0,0,0,0}},
{0, {540,540,540,540,540,540,540,540}, {0,0,0,0,0,0,0,0}},
{1, {541,542,543,544,545,544,543,542}, {0,0,0,0,0,1,1,1}},
{1, {546,547,548,549,550,549,548,547}, {0,0,0,0,0,1,1,1}},
{1, {551,552,553,554,555,554,553,552}, {0,0,0,0,0,1,1,1}},
{1, {556,557,558,559,560,559,558,557}, {0,0,0,0,0,1,1,1}},
{1, {561,562,563,564,565,564,563,562}, {0,0,0,0,0,1,1,1}},
{1, {566,567,568,569,570,569,568,567}, {0,0,0,0,0,1,1,1}},
{1, {571,572,573,574,575,574,573,572}, {0,0,0,0,0,1,1,1}},
{0, {576,576,576,576,576,576,576,576}, {0,0,0,0,0,0,0,0}},
{0, {577,577,577,577,577,577,577,577}, {0,0,0,0,0,0,0,0}},
{0, {578,578,578,578,578,578,578,578}, {0,0,0,0,0,0,0,0}},
{0, {579,579,579,579,579,579,579,579}, {0,0,0,0,0,0,0,0}},
{0, {580,580,580,580,580,580,580,580}, {0,0,0,0,0,0,0,0}},
{0, {581,581,581,581,581,581,581,581}, {0,0,0,0,0,0,0,0}},
{0, {582,582,582,582,582,582,582,582}, {0,0,0,0,0,0,0,0}},
{0, {583,583,583,583,583,583,583,583}, {0,0,0,0,0,0,0,0}},
{0, {584,584,584,584,584,584,584,584}, {0,0,0,0,0,0,0,0}},
{0, {585,585,585,585,585,585,585,585}, {0,0,0,0,0,0,0,0}},
{0, {586,586,586,586,586,586,586,586}, {0,0,0,0,0,0,0,0}},
{0, {587,587,587,587,587,587,587,587}, {0,0,0,0,0,0,0,0}},
{0, {588,588,588,588,588,588,588,588}, {0,0,0,0,0,0,0,0}},
{0, {589,589,589,589,589,589,589,589}, {0,0,0,0,0,0,0,0}},
{1, {700,701,702,703,704,703,702,701}, {0,0,0,0,0,1,1,1}},
{1, {705,706,707,708,709,708,707,706}, {0,0,0,0,0,1,1,1}},
{1, {710,711,712,713,714,713,712,711}, {0,0,0,0,0,1,1,1}},
{1, {715,716,717,718,719,718,717,716}, {0,0,0,0,0,1,1,1}},
{1, {720,721,722,723,724,723,722,721}, {0,0,0,0,0,1,1,1}},
{1, {725,726,727,728,729,728,727,726}, {0,0,0,0,0,1,1,1}},
{1, {730,731,732,733,734,733,732,731}, {0,0,0,0,0,1,1,1}},
{0, {735,735,735,735,735,735,735,735}, {0,0,0,0,0,0,0,0}},
{0, {736,736,736,736,736,736,736,736}, {0,0,0,0,0,0,0,0}},
{0, {737,737,737,737,737,737,737,737}, {0,0,0,0,0,0,0,0}},
{0, {738,738,738,738,738,738,738,738}, {0,0,0,0,0,0,0,0}},
{0, {739,739,739,739,739,739,739,739}, {0,0,0,0,0,0,0,0}},
{0, {740,740,740,740,740,740,740,740}, {0,0,0,0,0,0,0,0}},
{0, {741,741,741,741,741,741,741,741}, {0,0,0,0,0,0,0,0}},
{0, {742,742,742,742,742,742,742,742}, {0,0,0,0,0,0,0,0}},
{0, {743,743,743,743,743,743,743,743}, {0,0,0,0,0,0,0,0}},
{0, {744,744,744,744,744,744,744,744}, {0,0,0,0,0,0,0,0}},
{0, {745,745,745,745,745,745,745,745}, {0,0,0,0,0,0,0,0}},
{0, {746,746,746,746,746,746,746,746}, {0,0,0,0,0,0,0,0}},
{0, {747,747,747,747,747,747,747,747}, {0,0,0,0,0,0,0,0}},
{0, {748,748,748,748,748,748,748,748}, {0,0,0,0,0,0,0,0}},
{1, {1006,1007,1008,1009,1010,1009,1008,1007}, {0,0,0,0,0,1,1,1}},
{1, {1011,1012,1013,1014,1015,1014,1013,1012}, {0,0,0,0,0,1,1,1}},
{0, {1016,1016,1016,1016,1016,1016,1016,1016}, {0,0,0,0,0,0,0,0}},
{0, {1017,1017,1017,1017,1017,1017,1017,1017}, {0,0,0,0,0,0,0,0}},
{0, {1018,1018,1018,1018,1018,1018,1018,1018}, {0,0,0,0,0,0,0,0}},
{1, {749,750,751,752,753,754,755,756}, {0,0,0,0,0,0,0,0}},
{1, {757,758,759,760,761,762,763,764}, {0,0,0,0,0,0,0,0}},
{1, {765,766,767,768,769,770,771,772}, {0,0,0,0,0,0,0,0}},
{1, {749,756,755,754,753,752,751,750}, {1,1,1,1,1,1,1,1}},
{1, {757,764,763,762,761,760,759,758}, {1,1,1,1,1,1,1,1}},
{1, {765,772,771,770,769,768,767,766}, {1,1,1,1,1,1,1,1}},
{1, {773,774,775,776,777,778,779,780}, {0,0,0,0,0,0,0,0}},
{1, {781,782,783,784,785,786,787,788}, {0,0,0,0,0,0,0,0}},
{1, {789,790,791,792,793,794,795,796}, {0,0,0,0,0,0,0,0}},
{1, {797,798,799,800,801,802,803,804}, {0,0,0,0,0,0,0,0}},
{1, {805,806,807,808,809,810,811,812}, {0,0,0,0,0,0,0,0}},
{1, {813,814,815,816,817,818,819,820}, {0,0,0,0,0,0,0,0}},
{0, {821,821,821,821,821,821,821,821}, {0,0,0,0,0,0,0,0}},
{0, {822,822,822,822,822,822,822,822}, {0,0,0,0,0,0,0,0}},
{0, {823,823,823,823,823,823,823,823}, {0,0,0,0,0,0,0,0}},
{0, {824,824,824,824,824,824,824,824}, {0,0,0,0,0,0,0,0}},
{0, {825,825,825,825,825,825,825,825}, {0,0,0,0,0,0,0,0}},
{1, {1046,1050,1049,1048,1047,1048,1049,1050}, {0,1,1,1,0,0,0,0}},
{1, {1051,1055,1054,1053,1052,1053,1054,1055}, {0,1,1,1,0,0,0,0}},
{1, {350,351,352,353,354,353,352,351}, {0,0,0,0,0,1,1,1}},
{1, {355,356,357,358,359,358,357,356}, {0,0,0,0,0,1,1,1}},
{1, {360,361,362,363,364,363,362,361}, {0,0,0,0,0,1,1,1}},
{1, {365,366,367,368,369,368,367,366}, {0,0,0,0,0,1,1,1}},
{1, {370,371,372,373,374,373,372,371}, {0,0,0,0,0,1,1,1}},
{1, {375,376,377,378,379,378,377,376}, {0,0,0,0,0,1,1,1}},
{1, {380,381,382,383,384,383,382,381}, {0,0,0,0,0,1,1,1}},
{1, {385,386,387,388,389,388,387,386}, {0,0,0,0,0,1,1,1}},
{1, {390,391,392,393,394,393,392,391}, {0,0,0,0,0,1,1,1}},
{1, {395,396,397,398,399,400,401,402}, {0,0,0,0,0,0,0,0}},
{0, {403,403,403,403,403,403,403,403}, {0,0,0,0,0,0,0,0}},
{0, {404,404,404,404,404,404,404,404}, {0,0,0,0,0,0,0,0}},
{0, {405,405,405,405,405,405,405,405}, {0,0,0,0,0,0,0,0}},
{0, {406,406,406,406,406,406,406,406}, {0,0,0,0,0,0,0,0}},
{0, {407,407,407,407,407,407,407,407}, {0,0,0,0,0,0,0,0}},
{0, {408,408,408,408,408,408,408,408}, {0,0,0,0,0,0,0,0}},
{0, {409,409,409,409,409,409,409,409}, {0,0,0,0,0,0,0,0}},
{0, {410,410,410,410,410,410,410,410}, {0,0,0,0,0,0,0,0}},
{0, {411,411,411,411,411,411,411,411}, {0,0,0,0,0,0,0,0}},
{0, {412,412,412,412,412,412,412,412}, {0,0,0,0,0,0,0,0}},
{1, {216,217,218,219,220,221,222,223}, {0,0,0,0,0,0,0,0}},
{1, {224,225,226,227,228,229,230,231}, {0,0,0,0,0,0,0,0}},
{1, {232,233,234,235,236,237,238,239}, {0,0,0,0,0,0,0,0}},
{1, {240,241,242,243,244,245,246,247}, {0,0,0,0,0,0,0,0}},
{1, {248,249,250,251,252,253,254,255}, {0,0,0,0,0,0,0,0}},
{1, {256,257,258,259,260,261,262,263}, {0,0,0,0,0,0,0,0}},
{1, {264,265,266,267,268,269,270,271}, {0,0,0,0,0,0,0,0}},
{0, {272,272,272,272,272,272,272,272}, {0,0,0,0,0,0,0,0}},
{0, {273,273,273,273,273,273,273,273}, {0,0,0,0,0,0,0,0}},
{0, {274,274,274,274,274,274,274,274}, {0,0,0,0,0,0,0,0}},
{0, {275,275,275,275,275,275,275,275}, {0,0,0,0,0,0,0,0}},
{0, {276,276,276,276,276,276,276,276}, {0,0,0,0,0,0,0,0}},
{0, {277,277,277,277,277,277,277,277}, {0,0,0,0,0,0,0,0}},
{0, {278,278,278,278,278,278,278,278}, {0,0,0,0,0,0,0,0}},
{0, {279,279,279,279,279,279,279,279}, {0,0,0,0,0,0,0,0}},
{0, {280,280,280,280,280,280,280,280}, {0,0,0,0,0,0,0,0}},
{0, {281,281,281,281,281,281,281,281}, {0,0,0,0,0,0,0,0}},
{0, {282,282,282,282,282,282,282,282}, {0,0,0,0,0,0,0,0}},
{0, {283,283,283,283,283,283,283,283}, {0,0,0,0,0,0,0,0}},
{0, {284,284,284,284,284,284,284,284}, {0,0,0,0,0,0,0,0}},
{1, {590,591,592,593,594,593,592,591}, {0,0,0,0,0,1,1,1}},
{1, {595,596,597,598,599,598,597,596}, {0,0,0,0,0,1,1,1}},
{1, {600,601,602,603,604,603,602,601}, {0,0,0,0,0,1,1,1}},
{1, {605,606,607,608,609,608,607,606}, {0,0,0,0,0,1,1,1}},
{1, {610,611,612,613,614,615,616,617}, {0,0,0,0,0,0,0,0}},
{1, {618,619,620,621,622,623,624,625}, {0,0,0,0,0,0,0,0}},
{1, {626,627,628,629,630,631,632,633}, {0,0,0,0,0,0,0,0}},
{1, {634,635,636,637,638,639,640,641}, {0,0,0,0,0,0,0,0}},
{0, {642,642,642,642,642,642,642,642}, {0,0,0,0,0,0,0,0}},
{0, {643,643,643,643,643,643,643,643}, {0,0,0,0,0,0,0,0}},
{0, {644,644,644,644,644,644,644,644}, {0,0,0,0,0,0,0,0}},
{0, {645,645,645,645,645,645,645,645}, {0,0,0,0,0,0,0,0}},
{0, {646,646,646,646,646,646,646,646}, {0,0,0,0,0,0,0,0}},
{0, {647,647,647,647,647,647,647,647}, {0,0,0,0,0,0,0,0}},
{1, {413,414,415,416,417,416,415,414}, {0,0,0,0,0,1,1,1}},
{1, {418,421,424,427,430,427,424,421}, {0,0,0,0,0,1,1,1}},
{1, {419,422,425,428,431,428,425,422}, {0,0,0,0,0,1,1,1}},
{1, {420,423,426,429,432,429,426,423}, {0,0,0,0,0,1,1,1}},
{1, {433,436,438,440,442,440,438,436}, {0,0,0,0,0,1,1,1}},
{1, {434,437,439,441,443,441,439,437}, {0,0,0,0,0,1,1,1}},
{0, {435,435,435,435,435,435,435,435}, {0,0,0,0,0,0,0,0}},
{0, {444,444,444,444,444,444,444,444}, {0,0,0,0,0,0,0,0}},
{0, {445,445,445,445,445,445,445,445}, {0,0,0,0,0,0,0,0}},
{0, {446,446,446,446,446,446,446,446}, {0,0,0,0,0,0,0,0}},
{0, {447,447,447,447,447,447,447,447}, {0,0,0,0,0,0,0,0}},
{0, {448,448,448,448,448,448,448,448}, {0,0,0,0,0,0,0,0}},
{1, {108,109,110,111,112,111,110,109}, {0,0,0,0,0,1,1,1}},
{1, {113,114,115,116,117,116,115,114}, {0,0,0,0,0,1,1,1}},
{1, {118,119,120,121,122,121,120,119}, {0,0,0,0,0,1,1,1}},
{1, {123,124,125,126,127,126,125,124}, {0,0,0,0,0,1,1,1}},
{1, {128,129,130,131,132,133,134,135}, {0,0,0,0,0,0,0,0}},
{1, {136,137,138,139,140,141,142,143}, {0,0,0,0,0,0,0,0}},
{1, {144,145,146,147,148,149,150,151}, {0,0,0,0,0,0,0,0}},
{1, {152,153,154,155,156,157,158,159}, {0,0,0,0,0,0,0,0}},
{0, {160,160,160,160,160,160,160,160}, {0,0,0,0,0,0,0,0}},
{0, {161,161,161,161,161,161,161,161}, {0,0,0,0,0,0,0,0}},
{0, {162,162,162,162,162,162,162,162}, {0,0,0,0,0,0,0,0}},
{0, {163,163,163,163,163,163,163,163}, {0,0,0,0,0,0,0,0}},
{0, {164,164,164,164,164,164,164,164}, {0,0,0,0,0,0,0,0}},
{0, {165,165,165,165,165,165,165,165}, {0,0,0,0,0,0,0,0}},
{0, {166,166,166,166,166,166,166,166}, {0,0,0,0,0,0,0,0}},
{1, {53,54,55,56,57,58,59,60}, {0,0,0,0,0,0,0,0}},
{1, {61,62,63,64,65,66,67,68}, {0,0,0,0,0,0,0,0}},
{1, {53,60,59,58,57,56,55,54}, {1,1,1,1,1,1,1,1}},
{1, {61,68,67,66,65,64,63,62}, {1,1,1,1,1,1,1,1}},
{1, {69,70,71,72,73,74,75,76}, {0,0,0,0,0,0,0,0}},
{1, {77,78,79,80,81,82,83,84}, {0,0,0,0,0,0,0,0}},
{1, {85,86,87,88,89,90,91,92}, {0,0,0,0,0,0,0,0}},
{1, {93,94,95,96,97,98,99,100}, {0,0,0,0,0,0,0,0}},
{0, {101,101,101,101,101,101,101,101}, {0,0,0,0,0,0,0,0}},
{0, {102,102,102,102,102,102,102,102}, {0,0,0,0,0,0,0,0}},
{0, {103,103,103,103,103,103,103,103}, {0,0,0,0,0,0,0,0}},
{0, {104,104,104,104,104,104,104,104}, {0,0,0,0,0,0,0,0}},
{0, {105,105,105,105,105,105,105,105}, {0,0,0,0,0,0,0,0}},
{0, {106,106,106,106,106,106,106,106}, {0,0,0,0,0,0,0,0}},
{0, {107,107,107,107,107,107,107,107}, {0,0,0,0,0,0,0,0}},
{1, {826,827,828,829,830,829,828,827}, {0,1,1,1,0,0,0,0}},
{1, {831,832,833,834,835,834,833,832}, {0,1,1,1,0,0,0,0}},
{1, {836,837,838,839,840,839,838,837}, {0,1,1,1,0,0,0,0}},
{1, {841,842,843,844,845,844,843,842}, {0,1,1,1,0,0,0,0}},
{1, {846,847,848,849,850,849,848,847}, {0,1,1,1,0,0,0,0}},
{0, {851,851,851,851,851,851,851,851}, {0,0,0,0,0,0,0,0}},
{0, {852,852,852,852,852,852,852,852}, {0,0,0,0,0,0,0,0}},
{0, {853,853,853,853,853,853,853,853}, {0,0,0,0,0,0,0,0}},
{0, {854,854,854,854,854,854,854,854}, {0,0,0,0,0,0,0,0}},
{0, {855,855,855,855,855,855,855,855}, {0,0,0,0,0,0,0,0}},
{0, {856,856,856,856,856,856,856,856}, {0,0,0,0,0,0,0,0}},
{1, {648,649,650,651,652,651,650,649}, {0,0,0,0,0,1,1,1}},
{1, {653,654,655,656,657,656,655,654}, {0,0,0,0,0,1,1,1}},
{1, {658,659,660,661,662,661,660,659}, {0,0,0,0,0,1,1,1}},
{1, {648,663,664,665,652,665,664,663}, {1,0,0,0,1,1,1,1}},
{1, {653,666,667,668,657,668,667,666}, {1,0,0,0,1,1,1,1}},
{1, {658,669,670,671,662,671,670,669}, {1,0,0,0,1,1,1,1}},
{1, {672,673,674,675,676,675,674,673}, {0,0,0,0,0,1,1,1}},
{1, {677,678,679,680,681,680,679,678}, {0,0,0,0,0,1,1,1}},
{1, {682,683,684,685,686,687,688,689}, {0,0,0,0,0,0,0,0}},
{0, {690,690,690,690,690,690,690,690}, {0,0,0,0,0,0,0,0}},
{0, {691,691,691,691,691,691,691,691}, {0,0,0,0,0,0,0,0}},
{0, {692,692,692,692,692,692,692,692}, {0,0,0,0,0,0,0,0}},
{0, {693,693,693,693,693,693,693,693}, {0,0,0,0,0,0,0,0}},
{0, {694,694,694,694,694,694,694,694}, {0,0,0,0,0,0,0,0}},
{0, {695,695,695,695,695,695,695,695}, {0,0,0,0,0,0,0,0}},
{0, {696,696,696,696,696,696,696,696}, {0,0,0,0,0,0,0,0}},
{0, {697,697,697,697,697,697,697,697}, {0,0,0,0,0,0,0,0}},
{0, {698,698,698,698,698,698,698,698}, {0,0,0,0,0,0,0,0}},
{0, {699,699,699,699,699,699,699,699}, {0,0,0,0,0,0,0,0}},
{1, {167,168,169,170,171,170,169,168}, {0,0,0,0,0,1,1,1}},
{1, {172,173,174,175,176,175,174,173}, {0,0,0,0,0,1,1,1}},
{1, {177,178,179,180,181,180,179,178}, {0,0,0,0,0,1,1,1}},
{1, {167,182,183,184,171,184,183,182}, {1,0,0,0,1,1,1,1}},
{1, {172,185,186,187,176,187,186,185}, {1,0,0,0,1,1,1,1}},
{1, {177,188,189,190,181,190,189,188}, {1,0,0,0,1,1,1,1}},
{1, {191,192,193,194,195,194,193,192}, {0,0,0,0,0,1,1,1}},
{1, {196,197,198,199,200,199,198,197}, {0,0,0,0,0,1,1,1}},
{1, {201,202,203,204,205,206,207,208}, {0,0,0,0,0,0,0,0}},
{0, {209,209,209,209,209,209,209,209}, {0,0,0,0,0,0,0,0}},
{0, {210,210,210,210,210,210,210,210}, {0,0,0,0,0,0,0,0}},
{0, {211,211,211,211,211,211,211,211}, {0,0,0,0,0,0,0,0}},
{0, {212,212,212,212,212,212,212,212}, {0,0,0,0,0,0,0,0}},
{0, {213,213,213,213,213,213,213,213}, {0,0,0,0,0,0,0,0}},
{0, {214,214,214,214,214,214,214,214}, {0,0,0,0,0,0,0,0}},
{0, {215,215,215,215,215,215,215,215}, {0,0,0,0,0,0,0,0}},
{0, {916,916,916,916,916,916,916,916}, {0,0,0,0,0,0,0,0}},
{0, {917,917,917,917,917,917,917,917}, {0,0,0,0,0,0,0,0}},
{0, {911,911,911,911,911,911,911,911}, {0,0,0,0,0,0,0,0}},
{0, {912,912,912,912,912,912,912,912}, {0,0,0,0,0,0,0,0}},
{0, {913,913,913,913,913,913,913,913}, {0,0,0,0,0,0,0,0}},
{0, {914,914,914,914,914,914,914,914}, {0,0,0,0,0,0,0,0}},
{0, {915,915,915,915,915,915,915,915}, {0,0,0,0,0,0,0,0}},
{1, {285,286,287,288,289,290,291,292}, {0,0,0,0,0,0,0,0}},
{1, {293,294,295,296,297,298,299,300}, {0,0,0,0,0,0,0,0}},
{1, {301,302,303,304,305,306,307,308}, {0,0,0,0,0,0,0,0}},
{1, {309,310,311,312,313,314,315,316}, {0,0,0,0,0,0,0,0}},
{1, {317,318,319,320,321,322,323,324}, {0,0,0,0,0,0,0,0}},
{1, {325,326,327,328,329,330,331,332}, {0,0,0,0,0,0,0,0}},
{1, {333,334,335,336,337,338,339,340}, {0,0,0,0,0,0,0,0}},
{0, {341,341,341,341,341,341,341,341}, {0,0,0,0,0,0,0,0}},
{0, {342,342,342,342,342,342,342,342}, {0,0,0,0,0,0,0,0}},
{0, {343,343,343,343,343,343,343,343}, {0,0,0,0,0,0,0,0}},
{0, {344,344,344,344,344,344,344,344}, {0,0,0,0,0,0,0,0}},
{0, {345,345,345,345,345,345,345,345}, {0,0,0,0,0,0,0,0}},
{0, {346,346,346,346,346,346,346,346}, {0,0,0,0,0,0,0,0}},
{0, {347,347,347,347,347,347,347,347}, {0,0,0,0,0,0,0,0}},
{0, {348,348,348,348,348,348,348,348}, {0,0,0,0,0,0,0,0}},
{0, {349,349,349,349,349,349,349,349}, {0,0,0,0,0,0,0,0}},
{1, {449,450,451,452,453,452,451,450}, {0,0,0,0,0,1,1,1}},
{1, {454,455,456,457,458,457,456,455}, {0,0,0,0,0,1,1,1}},
{1, {459,460,461,462,463,462,461,460}, {0,0,0,0,0,1,1,1}},
{1, {464,465,466,467,468,467,466,465}, {0,0,0,0,0,1,1,1}},
{1, {469,470,471,472,473,472,471,470}, {0,0,0,0,0,1,1,1}},
{1, {474,475,476,477,478,477,476,475}, {0,0,0,0,0,1,1,1}},
{1, {479,480,481,482,483,482,481,480}, {0,0,0,0,0,1,1,1}},
{0, {484,484,484,484,484,484,484,484}, {0,0,0,0,0,0,0,0}},
{0, {485,485,485,485,485,485,485,485}, {0,0,0,0,0,0,0,0}},
{0, {486,486,486,486,486,486,486,486}, {0,0,0,0,0,0,0,0}},
{0, {487,487,487,487,487,487,487,487}, {0,0,0,0,0,0,0,0}},
{0, {488,488,488,488,488,488,488,488}, {0,0,0,0,0,0,0,0}},
{0, {489,489,489,489,489,489,489,489}, {0,0,0,0,0,0,0,0}},
{0, {918,918,918,918,918,918,918,918}, {0,0,0,0,0,0,0,0}},
{0, {919,919,919,919,919,919,919,919}, {0,0,0,0,0,0,0,0}},
{0, {920,920,920,920,920,920,920,920}, {0,0,0,0,0,0,0,0}},
{0, {921,921,921,921,921,921,921,921}, {0,0,0,0,0,0,0,0}},
{0, {943,943,943,943,943,943,943,943}, {0,0,0,0,0,0,0,0}},
{0, {944,944,944,944,944,944,944,944}, {0,0,0,0,0,0,0,0}},
{0, {945,945,945,945,945,945,945,945}, {0,0,0,0,0,0,0,0}},
{0, {946,946,946,946,946,946,946,946}, {0,0,0,0,0,0,0,0}},
{0, {947,947,947,947,947,947,947,947}, {0,0,0,0,0,0,0,0}},
{0, {948,948,948,948,948,948,948,948}, {0,0,0,0,0,0,0,0}},
{0, {949,949,949,949,949,949,949,949}, {0,0,0,0,0,0,0,0}},
{0, {1019,1019,1019,1019,1019,1019,1019,1019}, {0,0,0,0,0,0,0,0}},
{0, {1020,1020,1020,1020,1020,1020,1020,1020}, {0,0,0,0,0,0,0,0}},
{0, {1021,1021,1021,1021,1021,1021,1021,1021}, {0,0,0,0,0,0,0,0}},
{0, {969,969,969,969,969,969,969,969}, {0,0,0,0,0,0,0,0}},
{0, {970,970,970,970,970,970,970,970}, {0,0,0,0,0,0,0,0}},
{0, {971,971,971,971,971,971,971,971}, {0,0,0,0,0,0,0,0}},
{0, {972,972,972,972,972,972,972,972}, {0,0,0,0,0,0,0,0}},
{0, {973,973,973,973,973,973,973,973}, {0,0,0,0,0,0,0,0}},
{0, {974,974,974,974,974,974,974,974}, {0,0,0,0,0,0,0,0}},
{0, {975,975,975,975,975,975,975,975}, {0,0,0,0,0,0,0,0}},
{0, {976,976,976,976,976,976,976,976}, {0,0,0,0,0,0,0,0}},
{0, {963,963,963,963,963,963,963,963}, {0,0,0,0,0,0,0,0}},
{0, {964,964,964,964,964,964,964,964}, {0,0,0,0,0,0,0,0}},
{0, {1107,1107,1107,1107,1107,1107,1107,1107}, {0,0,0,0,0,0,0,0}},
{0, {1108,1108,1108,1108,1108,1108,1108,1108}, {0,0,0,0,0,0,0,0}},
{0, {1168,1168,1168,1168,1168,1168,1168,1168}, {0,0,0,0,0,0,0,0}},
{0, {1169,1169,1169,1169,1169,1169,1169,1169}, {0,0,0,0,0,0,0,0}},
{0, {980,980,980,980,980,980,980,980}, {0,0,0,0,0,0,0,0}},
{0, {981,981,981,981,981,981,981,981}, {0,0,0,0,0,0,0,0}},
{0, {1110,1110,1110,1110,1110,1110,1110,1110}, {0,0,0,0,0,0,0,0}},
{0, {1111,1111,1111,1111,1111,1111,1111,1111}, {0,0,0,0,0,0,0,0}},
{0, {1170,1170,1170,1170,1170,1170,1170,1170}, {0,0,0,0,0,0,0,0}},
{0, {1171,1171,1171,1171,1171,1171,1171,1171}, {0,0,0,0,0,0,0,0}},
{0, {1134,1134,1134,1134,1134,1134,1134,1134}, {0,0,0,0,0,0,0,0}},
{0, {1056,1056,1056,1056,1056,1056,1056,1056}, {0,0,0,0,0,0,0,0}},
{0, {1130,1130,1130,1130,1130,1130,1130,1130}, {0,0,0,0,0,0,0,0}},
{0, {1131,1131,1131,1131,1131,1131,1131,1131}, {0,0,0,0,0,0,0,0}},
{0, {1132,1132,1132,1132,1132,1132,1132,1132}, {0,0,0,0,0,0,0,0}},
{0, {1133,1133,1133,1133,1133,1133,1133,1133}, {0,0,0,0,0,0,0,0}},
{0, {1074,1074,1074,1074,1074,1074,1074,1074}, {0,0,0,0,0,0,0,0}},
{0, {1075,1075,1075,1075,1075,1075,1075,1075}, {0,0,0,0,0,0,0,0}},
{0, {1076,1076,1076,1076,1076,1076,1076,1076}, {0,0,0,0,0,0,0,0}},
{0, {1077,1077,1077,1077,1077,1077,1077,1077}, {0,0,0,0,0,0,0,0}},
{0, {1100,1100,1100,1100,1100,1100,1100,1100}, {0,0,0,0,0,0,0,0}},
{0, {1070,1070,1070,1070,1070,1070,1070,1070}, {0,0,0,0,0,0,0,0}},
{0, {1071,1071,1071,1071,1071,1071,1071,1071}, {0,0,0,0,0,0,0,0}},
{0, {1072,1072,1072,1072,1072,1072,1072,1072}, {0,0,0,0,0,0,0,0}},
{0, {1073,1073,1073,1073,1073,1073,1073,1073}, {0,0,0,0,0,0,0,0}},
{0, {1057,1057,1057,1057,1057,1057,1057,1057}, {0,0,0,0,0,0,0,0}},
{0, {1058,1058,1058,1058,1058,1058,1058,1058}, {0,0,0,0,0,0,0,0}},
{0, {1059,1059,1059,1059,1059,1059,1059,1059}, {0,0,0,0,0,0,0,0}},
{0, {1060,1060,1060,1060,1060,1060,1060,1060}, {0,0,0,0,0,0,0,0}},
{0, {1135,1135,1135,1135,1135,1135,1135,1135}, {0,0,0,0,0,0,0,0}},
{0, {1086,1086,1086,1086,1086,1086,1086,1086}, {0,0,0,0,0,0,0,0}},
{0, {1087,1087,1087,1087,1087,1087,1087,1087}, {0,0,0,0,0,0,0,0}},
{0, {1088,1088,1088,1088,1088,1088,1088,1088}, {0,0,0,0,0,0,0,0}},
{0, {1089,1089,1089,1089,1089,1089,1089,1089}, {0,0,0,0,0,0,0,0}},
{0, {1105,1105,1105,1105,1105,1105,1105,1105}, {0,0,0,0,0,0,0,0}},
{0, {1106,1106,1106,1106,1106,1106,1106,1106}, {0,0,0,0,0,0,0,0}},
{0, {989,989,989,989,989,989,989,989}, {0,0,0,0,0,0,0,0}},
{0, {910,910,910,910,910,910,910,910}, {0,0,0,0,0,0,0,0}},
{0, {1109,1109,1109,1109,1109,1109,1109,1109}, {0,0,0,0,0,0,0,0}},
{0, {978,978,978,978,978,978,978,978}, {0,0,0,0,0,0,0,0}},
{0, {984,984,984,984,984,984,984,984}, {0,0,0,0,0,0,0,0}},
{0, {985,985,985,985,985,985,985,985}, {0,0,0,0,0,0,0,0}},
{0, {1114,1114,1114,1114,1114,1114,1114,1114}, {0,0,0,0,0,0,0,0}},
{0, {1112,1112,1112,1112,1112,1112,1112,1112}, {0,0,0,0,0,0,0,0}},
{0, {977,977,977,977,977,977,977,977}, {0,0,0,0,0,0,0,0}},
{0, {962,962,962,962,962,962,962,962}, {0,0,0,0,0,0,0,0}},
{0, {1061,1061,1061,1061,1061,1061,1061,1061}, {0,0,0,0,0,0,0,0}},
{0, {998,998,998,998,998,998,998,998}, {0,0,0,0,0,0,0,0}},
{0, {1045,1045,1045,1045,1045,1045,1045,1045}, {0,0,0,0,0,0,0,0}},
{0, {1078,1078,1078,1078,1078,1078,1078,1078}, {0,0,0,0,0,0,0,0}},
{0, {1115,1115,1115,1115,1115,1115,1115,1115}, {0,0,0,0,0,0,0,0}},
{0, {1113,1113,1113,1113,1113,1113,1113,1113}, {0,0,0,0,0,0,0,0}},
{0, {997,997,997,997,997,997,997,997}, {0,0,0,0,0,0,0,0}},
{0, {1129,1129,1129,1129,1129,1129,1129,1129}, {0,0,0,0,0,0,0,0}},
{0, {1093,1093,1093,1093,1093,1093,1093,1093}, {0,0,0,0,0,0,0,0}},
{0, {1097,1097,1097,1097,1097,1097,1097,1097}, {0,0,0,0,0,0,0,0}},
{0, {1096,1096,1096,1096,1096,1096,1096,1096}, {0,0,0,0,0,0,0,0}},
{0, {1092,1092,1092,1092,1092,1092,1092,1092}, {0,0,0,0,0,0,0,0}},
{0, {1028,1028,1028,1028,1028,1028,1028,1028}, {0,0,0,0,0,0,0,0}},
{0, {1029,1029,1029,1029,1029,1029,1029,1029}, {0,0,0,0,0,0,0,0}},
{0, {1030,1030,1030,1030,1030,1030,1030,1030}, {0,0,0,0,0,0,0,0}},
{0, {1031,1031,1031,1031,1031,1031,1031,1031}, {0,0,0,0,0,0,0,0}},
{0, {1124,1124,1124,1124,1124,1124,1124,1124}, {0,0,0,0,0,0,0,0}},
{0, {990,990,990,990,990,990,990,990}, {0,0,0,0,0,0,0,0}},
{0, {991,991,991,991,991,991,991,991}, {0,0,0,0,0,0,0,0}},
{0, {992,992,992,992,992,992,992,992}, {0,0,0,0,0,0,0,0}},
{0, {993,993,993,993,993,993,993,993}, {0,0,0,0,0,0,0,0}},
{0, {996,996,996,996,996,996,996,996}, {0,0,0,0,0,0,0,0}},
{0, {982,982,982,982,982,982,982,982}, {0,0,0,0,0,0,0,0}},
{0, {983,983,983,983,983,983,983,983}, {0,0,0,0,0,0,0,0}},
{0, {1166,1166,1166,1166,1166,1166,1166,1166}, {0,0,0,0,0,0,0,0}},
{0, {1005,1005,1005,1005,1005,1005,1005,1005}, {0,0,0,0,0,0,0,0}},
{0, {1022,1022,1022,1022,1022,1022,1022,1022}, {0,0,0,0,0,0,0,0}},
{0, {1023,1023,1023,1023,1023,1023,1023,1023}, {0,0,0,0,0,0,0,0}},
{0, {1024,1024,1024,1024,1024,1024,1024,1024}, {0,0,0,0,0,0,0,0}},
{0, {1116,1116,1116,1116,1116,1116,1116,1116}, {0,0,0,0,0,0,0,0}},
{0, {1117,1117,1117,1117,1117,1117,1117,1117}, {0,0,0,0,0,0,0,0}},
{0, {1118,1118,1118,1118,1118,1118,1118,1118}, {0,0,0,0,0,0,0,0}},
{0, {1119,1119,1119,1119,1119,1119,1119,1119}, {0,0,0,0,0,0,0,0}},
{0, {1120,1120,1120,1120,1120,1120,1120,1120}, {0,0,0,0,0,0,0,0}},
{0, {1121,1121,1121,1121,1121,1121,1121,1121}, {0,0,0,0,0,0,0,0}},
{0, {1122,1122,1122,1122,1122,1122,1122,1122}, {0,0,0,0,0,0,0,0}},
{0, {1123,1123,1123,1123,1123,1123,1123,1123}, {0,0,0,0,0,0,0,0}},
{0, {1125,1125,1125,1125,1125,1125,1125,1125}, {0,0,0,0,0,0,0,0}},
{0, {1126,1126,1126,1126,1126,1126,1126,1126}, {0,0,0,0,0,0,0,0}},
{0, {1127,1127,1127,1127,1127,1127,1127,1127}, {0,0,0,0,0,0,0,0}},
{0, {1128,1128,1128,1128,1128,1128,1128,1128}, {0,0,0,0,0,0,0,0}},
{0, {1032,1032,1032,1032,1032,1032,1032,1032}, {0,0,0,0,0,0,0,0}},
{0, {965,965,965,965,965,965,965,965}, {0,0,0,0,0,0,0,0}},
{0, {1033,1033,1033,1033,1033,1033,1033,1033}, {0,0,0,0,0,0,0,0}},
{0, {999,999,999,999,999,999,999,999}, {0,0,0,0,0,0,0,0}},
{0, {1000,1000,1000,1000,1000,1000,1000,1000}, {0,0,0,0,0,0,0,0}},
{0, {1001,1001,1001,1001,1001,1001,1001,1001}, {0,0,0,0,0,0,0,0}},
{0, {1002,1002,1002,1002,1002,1002,1002,1002}, {0,0,0,0,0,0,0,0}},
{0, {1003,1003,1003,1003,1003,1003,1003,1003}, {0,0,0,0,0,0,0,0}},
{0, {1004,1004,1004,1004,1004,1004,1004,1004}, {0,0,0,0,0,0,0,0}},
{0, {1158,1158,1158,1158,1158,1158,1158,1158}, {0,0,0,0,0,0,0,0}},
{0, {1159,1159,1159,1159,1159,1159,1159,1159}, {0,0,0,0,0,0,0,0}},
{0, {1160,1160,1160,1160,1160,1160,1160,1160}, {0,0,0,0,0,0,0,0}},
{0, {1161,1161,1161,1161,1161,1161,1161,1161}, {0,0,0,0,0,0,0,0}},
{0, {1162,1162,1162,1162,1162,1162,1162,1162}, {0,0,0,0,0,0,0,0}},
{0, {1163,1163,1163,1163,1163,1163,1163,1163}, {0,0,0,0,0,0,0,0}},
{0, {1164,1164,1164,1164,1164,1164,1164,1164}, {0,0,0,0,0,0,0,0}},
{0, {1165,1165,1165,1165,1165,1165,1165,1165}, {0,0,0,0,0,0,0,0}},
{0, {994,994,994,994,994,994,994,994}, {0,0,0,0,0,0,0,0}},
{0, {995,995,995,995,995,995,995,995}, {0,0,0,0,0,0,0,0}},
{0, {986,986,986,986,986,986,986,986}, {0,0,0,0,0,0,0,0}},
{0, {987,987,987,987,987,987,987,987}, {0,0,0,0,0,0,0,0}},
{0, {988,988,988,988,988,988,988,988}, {0,0,0,0,0,0,0,0}},
{0, {1136,1136,1136,1136,1136,1136,1136,1136}, {0,0,0,0,0,0,0,0}},
{0, {1137,1137,1137,1137,1137,1137,1137,1137}, {0,0,0,0,0,0,0,0}},
{0, {1138,1138,1138,1138,1138,1138,1138,1138}, {0,0,0,0,0,0,0,0}},
{0, {1139,1139,1139,1139,1139,1139,1139,1139}, {0,0,0,0,0,0,0,0}},
{0, {1140,1140,1140,1140,1140,1140,1140,1140}, {0,0,0,0,0,0,0,0}},
{0, {1141,1141,1141,1141,1141,1141,1141,1141}, {0,0,0,0,0,0,0,0}},
{0, {1142,1142,1142,1142,1142,1142,1142,1142}, {0,0,0,0,0,0,0,0}},
{0, {1143,1143,1143,1143,1143,1143,1143,1143}, {0,0,0,0,0,0,0,0}},
{0, {1144,1144,1144,1144,1144,1144,1144,1144}, {0,0,0,0,0,0,0,0}},
{0, {1145,1145,1145,1145,1145,1145,1145,1145}, {0,0,0,0,0,0,0,0}},
{0, {1146,1146,1146,1146,1146,1146,1146,1146}, {0,0,0,0,0,0,0,0}},
{0, {1147,1147,1147,1147,1147,1147,1147,1147}, {0,0,0,0,0,0,0,0}},
{0, {1025,1025,1025,1025,1025,1025,1025,1025}, {0,0,0,0,0,0,0,0}},
{0, {1026,1026,1026,1026,1026,1026,1026,1026}, {0,0,0,0,0,0,0,0}},
{0, {1027,1027,1027,1027,1027,1027,1027,1027}, {0,0,0,0,0,0,0,0}},
{0, {1094,1094,1094,1094,1094,1094,1094,1094}, {0,0,0,0,0,0,0,0}},
{0, {1095,1095,1095,1095,1095,1095,1095,1095}, {0,0,0,0,0,0,0,0}},
{0, {1098,1098,1098,1098,1098,1098,1098,1098}, {0,0,0,0,0,0,0,0}},
{0, {1099,1099,1099,1099,1099,1099,1099,1099}, {0,0,0,0,0,0,0,0}},
{0, {1167,1167,1167,1167,1167,1167,1167,1167}, {0,0,0,0,0,0,0,0}},
{0, {1034,1034,1034,1034,1034,1034,1034,1034}, {0,0,0,0,0,0,0,0}},
{0, {1035,1035,1035,1035,1035,1035,1035,1035}, {0,0,0,0,0,0,0,0}},
{0, {1036,1036,1036,1036,1036,1036,1036,1036}, {0,0,0,0,0,0,0,0}},
{0, {1037,1037,1037,1037,1037,1037,1037,1037}, {0,0,0,0,0,0,0,0}},
{0, {1038,1038,1038,1038,1038,1038,1038,1038}, {0,0,0,0,0,0,0,0}},
{0, {1039,1039,1039,1039,1039,1039,1039,1039}, {0,0,0,0,0,0,0,0}},
{0, {1090,1090,1090,1090,1090,1090,1090,1090}, {0,0,0,0,0,0,0,0}},
{0, {1091,1091,1091,1091,1091,1091,1091,1091}, {0,0,0,0,0,0,0,0}},
{0, {979,979,979,979,979,979,979,979}, {0,0,0,0,0,0,0,0}}
};
spritedef_t sprites[] = {//80066A28
{21, &spriteframes[0]},
{4, &spriteframes[21]},
{4, &spriteframes[25]},
{5, &spriteframes[29]},
{1, &spriteframes[34]},
{2, &spriteframes[35]},
{10, &spriteframes[37]},
{2, &spriteframes[47]},
{2, &spriteframes[49]},
{2, &spriteframes[51]},
{4, &spriteframes[53]},
{4, &spriteframes[57]},
{2, &spriteframes[61]},
{2, &spriteframes[63]},
{3, &spriteframes[65]},
{2, &spriteframes[68]},
{3, &spriteframes[70]},
{4, &spriteframes[73]},
{5, &spriteframes[77]},
{5, &spriteframes[82]},
{5, &spriteframes[87]},
{2, &spriteframes[92]},
{5, &spriteframes[94]},
{4, &spriteframes[99]},
{2, &spriteframes[103]},
{6, &spriteframes[105]},
{4, &spriteframes[111]},
{10, &spriteframes[115]},
{5, &spriteframes[125]},
{23, &spriteframes[130]},
{21, &spriteframes[153]},
{21, &spriteframes[174]},
{2, &spriteframes[195]},
{3, &spriteframes[197]},
{17, &spriteframes[200]},
{2, &spriteframes[217]},
{20, &spriteframes[219]},
{20, &spriteframes[239]},
{14, &spriteframes[259]},
{12, &spriteframes[273]},
{15, &spriteframes[285]},
{15, &spriteframes[300]},
{11, &spriteframes[315]},
{19, &spriteframes[326]},
{16, &spriteframes[345]},
{2, &spriteframes[361]},
{5, &spriteframes[363]},
{16, &spriteframes[368]},
{13, &spriteframes[384]},
{2, &spriteframes[397]},
{2, &spriteframes[399]},
{2, &spriteframes[401]},
{5, &spriteframes[403]},
{3, &spriteframes[408]},
{4, &spriteframes[411]},
{4, &spriteframes[415]},
{2, &spriteframes[419]},
{2, &spriteframes[421]},
{2, &spriteframes[423]},
{2, &spriteframes[425]},
{2, &spriteframes[427]},
{2, &spriteframes[429]},
{1, &spriteframes[431]},
{1, &spriteframes[432]},
{4, &spriteframes[433]},
{4, &spriteframes[437]},
{1, &spriteframes[441]},
{4, &spriteframes[442]},
{4, &spriteframes[446]},
{1, &spriteframes[450]},
{4, &spriteframes[451]},
{2, &spriteframes[455]},
{1, &spriteframes[457]},
{1, &spriteframes[458]},
{1, &spriteframes[459]},
{1, &spriteframes[460]},
{1, &spriteframes[461]},
{1, &spriteframes[462]},
{1, &spriteframes[463]},
{1, &spriteframes[464]},
{1, &spriteframes[465]},
{1, &spriteframes[466]},
{1, &spriteframes[467]},
{1, &spriteframes[468]},
{1, &spriteframes[469]},
{1, &spriteframes[470]},
{1, &spriteframes[471]},
{1, &spriteframes[472]},
{1, &spriteframes[473]},
{1, &spriteframes[474]},
{1, &spriteframes[475]},
{1, &spriteframes[476]},
{1, &spriteframes[477]},
{1, &spriteframes[478]},
{1, &spriteframes[479]},
{1, &spriteframes[480]},
{1, &spriteframes[481]},
{1, &spriteframes[482]},
{1, &spriteframes[483]},
{1, &spriteframes[484]},
{1, &spriteframes[485]},
{1, &spriteframes[486]},
{1, &spriteframes[487]},
{1, &spriteframes[488]},
{1, &spriteframes[489]},
{1, &spriteframes[490]},
{1, &spriteframes[491]},
{1, &spriteframes[492]},
{3, &spriteframes[493]},
{4, &spriteframes[496]},
{4, &spriteframes[500]},
{4, &spriteframes[504]},
{1, &spriteframes[508]},
{1, &spriteframes[509]},
{1, &spriteframes[510]},
{1, &spriteframes[511]},
{1, &spriteframes[512]},
{1, &spriteframes[513]},
{1, &spriteframes[514]},
{1, &spriteframes[515]},
{1, &spriteframes[516]},
{4, &spriteframes[517]},
{4, &spriteframes[521]},
{2, &spriteframes[525]},
{3, &spriteframes[527]},
{4, &spriteframes[530]},
{4, &spriteframes[534]},
{4, &spriteframes[538]},
{3, &spriteframes[542]},
{2, &spriteframes[545]},
{2, &spriteframes[547]},
{1, &spriteframes[549]},
{1, &spriteframes[550]},
{1, &spriteframes[551]},
{1, &spriteframes[552]},
{1, &spriteframes[553]},
{1, &spriteframes[554]},
{1, &spriteframes[555]},
{1, &spriteframes[556]},
{1, &spriteframes[557]},
{1, &spriteframes[558]}
};
================================================
FILE: PSXDOOM/st_main.c
================================================
/* st_main.c -- status bar */
#include "doomdef.h"
#include "st_main.h"
#include "r_local.h"
stbar_t stbar; //800984F4
psxobj_t statuspic;//0x800a92cc
int weaponowned[NUMWEAPONS] = {0, 1, 2, 3, 4, 5, 6, 7, 0}; //80073ebc
short micronums_x[NUMMICROS] = { 199, 212, 225, 238, 199, 212, 225, 238 };//80073ee0
short micronums_y[NUMMICROS] = { 204, 204, 204, 204, 216, 216, 216, 216 };//80073ef0
short card_y[NUMCARDS] = { 204, 212, 220, 204, 212, 220 };//80073f00
sbflash_t flashCards[NUMCARDS]; /* INFO FOR FLASHING CARDS & SKULLS */ //800a9298
boolean facedraw; //uGp00000b48
int facetics; //uGp00000b4c
int newface; //uGp00000a40
boolean gibdraw; //uGp00000a74
boolean doSpclFace; //uGp000008e8
spclface_e spclFaceType; //sGp00000924
facedata_t *facegraphic; //0x80078054|puGp00000c44
facedata_t facedata[NUMFACES] = //0x80073c98
{
{ 118, 202, 0, 41, 19, 29 }, // STFST01 - 0
{ 118, 202, 20, 41, 19, 29 }, // STFST02 - 1
{ 118, 202, 234, 137, 19, 29 }, // STFST00 - 2
{ 118, 202, 40, 41, 21, 31 }, // STFTL00 - 3
{ 118, 202, 62, 41, 21, 31 }, // STFTR00 - 4
{ 118, 202, 84, 41, 19, 31 }, // STFOUCH0 - 5
{ 118, 202, 104, 41, 19, 31 }, // STFEVL0 - 6 (EVILFACE)
{ 118, 202, 124, 41, 19, 31 }, // STFKILL0 - 7
{ 118, 202, 144, 41, 19, 31 }, // STFST11 - 8
{ 118, 202, 164, 41, 19, 31 }, // STFST10 - 9
{ 118, 202, 184, 41, 19, 31 }, // STFST12 - 10
{ 118, 202, 204, 41, 20, 31 }, // STFTL10 - 11
{ 118, 202, 226, 41, 21, 31 }, // STFTR10 - 12
{ 118, 202, 0, 73, 19, 31 }, // STFOUCH1 - 13
{ 118, 202, 20, 73, 19, 31 }, // STFEVL1 - 14
{ 118, 202, 40, 73, 19, 31 }, // STFKILL1 - 15
{ 118, 202, 60, 73, 19, 31 }, // STFST21 - 16
{ 118, 202, 80, 73, 19, 31 }, // STFST20 - 17
{ 118, 202, 100, 73, 19, 31 }, // STFST22 - 18
{ 118, 202, 120, 73, 22, 31 }, // STFTL20 - 19
{ 118, 202, 142, 73, 22, 31 }, // STFTR20 - 20
{ 118, 202, 166, 73, 19, 31 }, // STFOUCH2 - 21
{ 118, 202, 186, 73, 19, 31 }, // STFEVL2 - 22
{ 118, 202, 206, 73, 19, 31 }, // STFKILL2 - 23
{ 118, 202, 226, 73, 19, 31 }, // STFST31 - 24
{ 118, 202, 0, 105, 19, 31 }, // STFST30 - 25
{ 118, 202, 20, 105, 19, 31 }, // STFST32 - 26
{ 118, 202, 40, 105, 23, 31 }, // STFTL30 - 27
{ 118, 202, 64, 105, 23, 31 }, // STFTR30 - 28
{ 118, 202, 88, 105, 19, 31 }, // STFOUCH3 - 29
{ 118, 202, 108, 105, 19, 31 }, // STFEVL3 - 30
{ 118, 202, 128, 105, 19, 31 }, // STFKILL3 - 31
{ 118, 202, 148, 105, 19, 31 }, // STFST41 - 32
{ 118, 202, 168, 105, 19, 31 }, // STFST40 - 33
{ 118, 202, 188, 105, 19, 31 }, // STFST42 - 34
{ 118, 202, 208, 105, 24, 31 }, // STFTL40 - 35
{ 118, 202, 232, 105, 23, 31 }, // STFTR40 - 36
{ 118, 202, 0, 137, 18, 31 }, // STFOUCH4 - 37
{ 118, 202, 20, 137, 19, 31 }, // STFEVL4 - 38
{ 118, 202, 40, 137, 19, 31 }, // STFKILL4 - 39
{ 118, 202, 60, 137, 19, 31 }, // STFGOD0 - 40 (GODFACE)
{ 118, 202, 80, 137, 19, 31 }, // STFDEAD0 - 41 (DEADFACE)
{ 118, 202, 100, 137, 19, 30 }, // STSPLAT0 - 42 (FIRSTSPLAT)
{ 114, 201, 120, 137, 27, 30 }, // STSPLAT1 - 43
{ 114, 204, 148, 137, 28, 30 }, // STSPLAT2 - 44
{ 114, 204, 176, 137, 28, 30 }, // STSPLAT3 - 45
{ 114, 204, 204, 137, 28, 30 } // STSPLAT4 - 46
};
symboldata_t symboldata[] = // 80073db4
{
{ 0, 195, 11, 16 }, // 0 - 0
{ 12, 195, 11, 16 }, // 1 - 1
{ 24, 195, 11, 16 }, // 2 - 2
{ 36, 195, 11, 16 }, // 3 - 3
{ 48, 195, 11, 16 }, // 4 - 4
{ 60, 195, 11, 16 }, // 5 - 5
{ 72, 195, 11, 16 }, // 6 - 6
{ 84, 195, 11, 16 }, // 7 - 7
{ 96, 195, 11, 16 }, // 8 - 8
{ 108, 195, 11, 16 }, // 9 - 9
{ 232, 195, 11, 16 }, // - - 10
{ 120, 195, 11, 15 }, // % - 11
{ 0, 211, 7, 16 }, // ! - 12
{ 8, 211, 7, 16 }, // . - 13
{ 16, 211, 15, 16 }, // A - 14
{ 32, 211, 13, 16 }, // B - 15
{ 46, 211, 12, 16 }, // C - 16
{ 60, 211, 13, 16 }, // D - 17
{ 74, 211, 13, 16 }, // E - 18
{ 88, 211, 13, 16 }, // F - 19
{ 102, 211, 13, 16 }, // G - 20
{ 116, 211, 13, 16 }, // H - 21
{ 130, 211, 6, 16 }, // I - 22
{ 136, 211, 12, 16 }, // J - 23
{ 148, 211, 14, 16 }, // K - 24
{ 162, 211, 13, 16 }, // L - 25
{ 176, 211, 15, 16 }, // M - 26
{ 192, 211, 15, 16 }, // N - 27
{ 208, 211, 13, 16 }, // O - 28
{ 222, 211, 13, 16 }, // P - 29
{ 236, 211, 13, 16 }, // Q - 30
{ 0, 227, 13, 16 }, // R - 31
{ 14, 227, 13, 16 }, // S - 32
{ 28, 227, 14, 16 }, // T - 33
{ 42, 227, 13, 16 }, // U - 34
{ 56, 227, 15, 16 }, // V - 35
{ 72, 227, 15, 16 }, // W - 36
{ 88, 227, 15, 16 }, // X - 37
{ 104, 227, 13, 16 }, // Y - 38
{ 118, 227, 13, 16 }, // Z - 39
{ 132, 230, 13, 13 }, // a - 40
{ 146, 230, 12, 13 }, // b - 41
{ 158, 230, 11, 13 }, // c - 42
{ 170, 230, 11, 13 }, // d - 43
{ 182, 230, 10, 13 }, // e - 44
{ 192, 230, 11, 13 }, // f - 45
{ 204, 230, 11, 13 }, // g - 46
{ 216, 230, 12, 13 }, // h - 47
{ 228, 230, 5, 13 }, // i - 48
{ 234, 230, 10, 13 }, // j - 49
{ 0, 243, 12, 13 }, // k - 50
{ 12, 243, 9, 13 }, // l - 51
{ 22, 243, 13, 13 }, // m - 52
{ 36, 243, 13, 13 }, // n - 53
{ 50, 243, 11, 13 }, // o - 54
{ 62, 243, 11, 13 }, // p - 55
{ 74, 243, 11, 13 }, // q - 56
{ 86, 243, 11, 13 }, // r - 57
{ 98, 243, 12, 13 }, // s - 58
{ 112, 243, 11, 13 }, // t - 59
{ 124, 243, 11, 13 }, // u - 60
{ 136, 243, 13, 13 }, // v - 61
{ 150, 243, 13, 13 }, // w - 62
{ 164, 243, 13, 13 }, // x - 63
{ 178, 243, 13, 13 }, // y - 64
{ 192, 243, 13, 13 } // z - 65
};
/*
====================
=
= ST_Init
=
= Locate and load all needed graphics
====================
*/
void ST_Init (void)//L800382D4()
{
if (PageCount != 0)
I_Error("ST_Init: initial texture cache foulup\n");
ImageToVram(&statuspic, "STATUS", 0);
if (PageCount != 0)
I_Error("ST_Init: final texture cache foulup\n");
xcount = 0;
ycount = 0;
PageCount = 1;
xycount = 0;
V_PagFlags |= 1;// vram page pos
Z_FreeTags(mainzone, PU_CACHE);
//printf("ST_Init: DONE\n");
}
/*================================================== */
/* */
/* Init this stuff EVERY LEVEL */
/* */
/*================================================== */
void ST_InitEveryLevel(void)//L8003838C()
{
int i;
stbar.gotgibbed = false;
stbar.specialFace = f_none;
stbar.messagedelay = 0;
for (i = 0; i < NUMCARDS; i++)
{
stbar.tryopen[i] = false;
flashCards[i].active = false;
}
doSpclFace = false;
gibdraw = false; /* DON'T DRAW GIBBED HEAD SEQUENCE */
/* force everything to be updated on next ST_Update */
facedraw = true;
facetics = 0;
facegraphic = &facedata[0];
}
/*
====================
=
= ST_Ticker
=
====================
*/
void ST_Ticker (void)//L80038404()
{
player_t *player;
int ind, base;
player = &players[consoleplayer];
/* */
/* Animate face */
/* */
if (--facetics <= 0)
{
facetics = M_Random() & 15;
newface = M_Random() & 3;
if (newface == 3)
newface = 1;
doSpclFace = false;
}
/* */
/* Draw special face? */
/* */
if (stbar.specialFace)
{
doSpclFace = true;
spclFaceType = stbar.specialFace;
facetics = TICRATE;
stbar.specialFace = f_none;
}
/* */
/* Did we get gibbed? */
/* */
if (stbar.gotgibbed)
{
stbar.gibdelay = GIBTIME;
stbar.gibframe = 0;
stbar.gotgibbed = false;
gibdraw = true;
}
/* */
/* Animate gibbed face */
/* */
if (gibdraw && (--stbar.gibdelay <= 0))
{
stbar.gibdelay = GIBTIME;
stbar.gibframe += 1;
if (stbar.gibframe >= 5)
{
gibdraw = false;
facedraw = false;
}
}
/* */
/* Message initialization */
/* */
if (player->message)
{
stbar.message = player->message;
stbar.messagedelay = 75;
player->message = NULL;
}
/* */
/* Countdown time for the message */
/* */
if (stbar.messagedelay)
stbar.messagedelay--;
/* */
/* Tried to open a CARD or SKULL door? */
/* */
for (ind = 0; ind < NUMCARDS; ind++)
{
/* CHECK FOR INITIALIZATION */
if (stbar.tryopen[ind])
{
stbar.tryopen[ind] = false;
flashCards[ind].active = true;
flashCards[ind].delay = FLASHDELAY;
flashCards[ind].times = FLASHTIMES+1;
flashCards[ind].doDraw = false;
}
/* MIGHT AS WELL DO TICKING IN THE SAME LOOP! */
else if (flashCards[ind].active && !--flashCards[ind].delay)
{
flashCards[ind].delay = FLASHDELAY;
flashCards[ind].doDraw ^= 1;
if (!--flashCards[ind].times)
flashCards[ind].active = false;
if (flashCards[ind].doDraw && flashCards[ind].active)
S_StartSound(NULL,sfx_itemup);
}
}
/* */
/* God mode cheat */
/* */
if ((player->cheats & CF_GODMODE) || player->powers[pw_invulnerability])
{
stbar.face = GODFACE;
}
else
{
/* */
/* Draw gibbed head */
/* */
if (gibdraw)
{
stbar.face = stbar.gibframe + FIRSTSPLAT;
}
/* */
/* face change */
/* */
else
{
if (player->health)
{
if (doSpclFace)
{
base = player->health / 20;
base = (base < 4) ? (4 - base) * 8 : 0;
stbar.face = spclFaceType + base;
}
else
{
base = player->health / 20;
base = (base < 4) ? (4 - base) * 8 : 0;
stbar.face = newface + base;
}
}
else
{
stbar.face = DEADFACE;
}
}
}
facegraphic = &facedata[stbar.face];
/* */
/* Do red-/gold-shifts from damage/items */
/* */
ST_doPaletteStuff();
}
/*
====================
=
= ST_Drawer
=
====================
*/
extern char mapnames[][32];
#if SHOWFPS == 1
extern int fps;
#endif // _SHOWFPS
void ST_Drawer (void)//L80038888();
{
char text[64];
player_t *player;
weapontype_t weapon;
int ammo, ind, xpos, ypos;
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *sprtstat = (SPRT*) getScratchAddr(128);//1F800200
player = &players[consoleplayer];
SetDrawMode(drawmode, 0, 0, statuspic.vtpage, NULL);
W_AddPrim(drawmode);// add to order table
/* */
/* make sprite status */
/* */
setSprt(sprtstat);
setShadeTex(sprtstat, 1);
sprtstat->clut = palette[16];
/* */
/* Draw Text Message */
/* */
if (stbar.messagedelay > 0)
{
//In Psx Doom Greatest Hits and Final Doom, the value of position X was changed to 7
#if GH_UPDATES == 1
ST_DrawMessage(7, 193, stbar.message);
#else
ST_DrawMessage(2, 193, stbar.message);
#endif // GH_UPDATES
}
else if (player->automapflags & AF_ACTIVE)
{
/* */
/* Draw Map Name Message */
/* */
sprintf(text, "LEVEL %d:%s", gamemap, mapnames[gamemap-1]);
//In Psx Doom Greatest Hits and Final Doom, the value of position X was changed to 7
#if GH_UPDATES == 1
ST_DrawMessage(7, 193, text);
#else
ST_DrawMessage(2, 193, text);
#endif // GH_UPDATES
}
/* */
/* Draw StatusBar Graphic */
/* */
setXY0(sprtstat, 0, 200);
setUV0(sprtstat, 0, 0);
setWH(sprtstat, 256, 40);
W_AddPrim(sprtstat);// add to order table
weapon = player->pendingweapon;
if (weapon == wp_nochange)
weapon = player->readyweapon;
if (weaponinfo[weapon].ammo == am_noammo)
ammo = 0;
else
ammo = player->ammo[weaponinfo[weapon].ammo];
/* */
/* Ammo */
/* */
ST_DrawValue(28, 204, ammo);
/* */
/* Health */
/* */
ST_DrawValue(71, 204, player->health);
/* */
/* Armor */
/* */
ST_DrawValue(168, 204, player->armorpoints);
/* */
/* Cards & skulls */
/* */
xpos = 114;
ypos = 184;
for (ind = 0; ind < NUMCARDS; ind++)
{
if (player->cards[ind] || (flashCards[ind].active && flashCards[ind].doDraw))
{
/* */
/* Draw Keys Graphics */
/* */
setXY0(sprtstat, 100, card_y[ind]);
setUV0(sprtstat, xpos, ypos);
setWH(sprtstat, 11, 8);
W_AddPrim(sprtstat);// add to order table
}
xpos += 11;
}
/* */
/* Weapons & level */
/* */
if (netgame != gt_deathmatch)
{
/* */
/* Number Box Graphic */
/* */
setXY0(sprtstat, 200, 205);
setUV0(sprtstat, 180, 184);
setWH(sprtstat, 51, 23);
W_AddPrim(sprtstat);// add to order table
/* */
/* Numbers Graphic */
/* */
xpos = 232;
ypos = 184;
for (ind = wp_shotgun; ind < NUMMICROS; ind++)
{
if (player->weaponowned[ind])
{
setXY0(sprtstat, micronums_x[ind] + 5, micronums_y[ind] + 3);
setUV0(sprtstat, xpos, ypos);
setWH(sprtstat, 4, 6);
W_AddPrim(sprtstat);// add to order table
}
xpos += 4;
}
/* */
/* White Selector Box Graphic */
/* */
setXY0(sprtstat, micronums_x[weaponowned[weapon]], micronums_y[weaponowned[weapon]]);
setUV0(sprtstat, 164, 192);
setWH(sprtstat, 12, 12);
W_AddPrim(sprtstat);// add to order table
}
/* */
/* Or, frag counts! */
/* */
else
{
/* */
/* Frags Graphic */
/* */
setXY0(sprtstat, 209, 221);
setUV0(sprtstat, 208, 243);
setWH(sprtstat, 33, 8);
W_AddPrim(sprtstat);// add to order table
/* */
/* Frag Count */
/* */
ST_DrawValue(225, 204, player->frags);
}
/* */
/* face change */
/* */
if (facedraw)
{
/* */
/* Face Graphic */
/* */
setXY0(sprtstat, facegraphic->xpos, facegraphic->ypos);
setUV0(sprtstat, facegraphic->x, facegraphic->y);
setWH(sprtstat, facegraphic->w, facegraphic->h);
W_AddPrim(sprtstat);// add to order table
}
/* */
/* Drawing cheat "Warp To Level and Vram_Viewer" */
/* */
if (gamepaused)
ST_CheatDraw();
#if SHOWFPS == 1
fps = (60-((fps)/60));
fps = fps > 0? fps:0;
D_DebugSetPrintPos(10, 10);
D_DebugPrint("fps %d", fps);
#endif // SHOWFPS
}
void ST_DrawValue(int x, int y, int value)//L8003A144()
{
int index, i;
unsigned char number[16];
boolean minus;
int xpos;
SPRT *sprtstat = (SPRT*) getScratchAddr(128);//1F800200
minus = false;
if (value < 0)
{
minus = true;
value = -value;// absolute value
}
for (index = 0; index < 16; index++)
{
number[index] = value % 10;
value /= 10;
if (!value) break;
}
setWH(sprtstat, 11, 16);
xpos = x;
for (i = 0; i <= index; i++)
{
setXY0(sprtstat, xpos, y);
setUV0(sprtstat, symboldata[number[i]].x, 195);
W_AddPrim(sprtstat);// add to order table
xpos -= 11;
}
if (minus)
{
setXY0(sprtstat, xpos, y);
setUV0(sprtstat, symboldata[10].x, 195);
W_AddPrim(sprtstat);// add to order table
}
}
void ST_DrawMessage(int x, int y, char *text)//L8003A750()
{
unsigned int c,cc;
unsigned int vx, vy, xpos;
SPRT *sprtstat = (SPRT*) getScratchAddr(128);//1F800200
setWH(sprtstat, 8, 8);
while (*text != 0)
{
c = *text;
if ((byte)(c - 'a') < 26) { c -= 32; }
cc = c - 33;
if (cc < '@')
{
vy = cc;
if (cc < 0) { vy = cc - 2; }
vx = cc << 3;
vy = ((vy >> 5) << 3) + 168;
setXY0(sprtstat, x, y);
setUV0(sprtstat, vx, vy);
W_AddPrim(sprtstat);// add to order table
}
text++;
x += 8;
}
}
extern int warpmap; //80078094, iGp00000c84
extern int Vram_page; //80077D00, iGp000008f0
void ST_CheatDraw(void)//L8003AA80()
{
char text[64];
player_t *p;
POLY_F4 *backgroud = (POLY_F4*) getScratchAddr(128);//1F800200
p = &players[consoleplayer];
//Draw Pause Graphic
if (!(p->cheats & CF_PAUSE) )
{
DrawStaticImage(&pausepic, 107, 108, palette[0]);
}
if (p->cheats & CF_WARPLEVEL)
{
sprintf(text, "warp to level %d", warpmap);
ST_DrawText(-1, 40, text);
ST_DrawText(-1, 60, mapnames[warpmap-1]);
}
else if (p->cheats & CF_VRAMVIEWER)
{
//Black Background for Vram_Viewer
setPolyF4(backgroud);
setRGB0(backgroud, 0, 0, 0);
setXY4(backgroud, 0, 0, 256, 0, 0, 240, 256, 240);
W_AddPrim(backgroud);// add to order table
Vram_Viewer(Vram_page);
}
}
// Palette indices.
// For damage/bonus red-/gold-shifts
#define STARTREDPALS 1
#define STARTBONUSPALS 9
#define NUMREDPALS 8
#define NUMBONUSPALS 4
// Radiation suit, green shift.
#define RADIATIONPAL 13
#define INVULNERABILITYPAL 14 //Doom psx
void ST_doPaletteStuff(void)//L8003AE6C()
{
int palette_;
int cnt;
int bzc;
player_t *plyr;
plyr = &players[consoleplayer];
cnt = plyr->damagecount;
if (plyr->powers[pw_strength])
{
// slowly fade the berzerk out
bzc = 12 - (plyr->powers[pw_strength] >> 6);
if (bzc > cnt)
cnt = bzc;
}
//Normal Palette
palette_ = 0;
// Handling colormaps.
viewlighting = true;
if (plyr->powers[pw_infrared] >= 61 || plyr->powers[pw_infrared] & 8)
{
viewlighting = false;
}
if (plyr->powers[pw_invulnerability] >= 61 || plyr->powers[pw_invulnerability] & 8)
{
viewlighting = false;
palette_ = INVULNERABILITYPAL;
}
else if (cnt)
{
palette_ = (cnt + 7) >> 3;
if (palette_ >= NUMREDPALS)
palette_ = NUMREDPALS - 1;
palette_ += STARTREDPALS;
}
else if(plyr->powers[pw_ironfeet] >= 61 || plyr->powers[pw_ironfeet] & 8)
{
palette_ = RADIATIONPAL;
}
else if (plyr->bonuscount)
{
palette_ = (plyr->bonuscount + 7) >> 3;
if (palette_ >= NUMBONUSPALS)
palette_ = NUMBONUSPALS - 1;
palette_ += STARTBONUSPALS;
}
palettebase = palette[palette_];
}
int ST_GetTextCenterX(char *text)//L8003AFB4()
{
int c;
int width;
width = 0;
while (*text)
{
c = *text;
if ((byte)(c - 'A') < 26)
{
c -= 51;
}
else if ((byte)(c - 'a') < 26)
{
c -= 57;
}
else if ((byte)(c - '0') < 10)
{
c -= '0';
}
else if (c == '%')
{
c = 11;
}
else if (c == '!')
{
c = 12;
}
else if (c == '.')
{
c = 13;
}
else if (c == '-')
{
c = 10;
}
else
{
width += 6; // space
text++;
continue;
}
width += symboldata[c].w;
text++;
}
return (((256 - width) * 128) / 256);
}
void ST_DrawText(int x, int y, char *text)//L8003B0A0()
{
int xpos;
int ypos;
int c;
DR_MODE *drawmode = (DR_MODE*) getScratchAddr(128);//1F800200
SPRT *sprtstat = (SPRT*) getScratchAddr(128);//1F800200
SetDrawMode(drawmode, 0, 0, statuspic.vtpage, NULL);
W_AddPrim(drawmode);// add to order table
/* make sprite status*/
SetSprt(sprtstat);
setShadeTex(sprtstat, 1);
sprtstat->clut = palette[16];
xpos = x;
if (xpos == -1)//Get Center Text Position
{
xpos = ST_GetTextCenterX(text);
}
while (*text)
{
c = *text;
ypos = y;
if ((byte)(c - 'A') < 26)
{
c -= 51;
}
else if ((byte)(c - 'a') < 26)
{
c -= 57;
ypos = y + 3;
}
else if ((byte)(c - '0') < 10)
{
c -= '0';
}
else if (c == '%')
{
c = 11;
}
else if (c == '!')
{
c = 12;
}
else if (c == '.')
{
c = 13;
}
else if (c == '-')
{
c = 10;
}
else
{
xpos += 6; // space
text++;
continue;
}
setWH(sprtstat, symboldata[c].w, symboldata[c].h);
setXY0(sprtstat, xpos, ypos);
setUV0(sprtstat, symboldata[c].x, symboldata[c].y);
W_AddPrim(sprtstat);// add to order table
xpos += symboldata[c].w;
text++;
}
}
================================================
FILE: PSXDOOM/st_main.h
================================================
/* the status bar consists of two 8 bit color objects: */
/* the static background pic and a transparent foreground object that */
/* all the stats are drawn onto when they change */
/* coordinates are status bar relative (0 is first line of sbar) */
#define FLASHDELAY 4 /* # of tics delay (1/30 sec) */
#define FLASHTIMES 6 /* # of times to flash new frag amount (EVEN!) */
#define AMMOX 52
#define AMMOY 14
#define HEALTHX 104
#define HEALTHY AMMOY
#define KEYX 124
#define REDKEYY 3
#define BLUKEYY 15
#define YELKEYY 27
#define KEYW 16
#define KEYH 11
#define FACEX 144
#define FACEY 5
#define ARMORX 226
#define ARMORY HEALTHY
#define MAPX 316
#define MAPY HEALTHY
#define HISFRAGX MAPX
#define HISFRAGY HEALTHY
#define YOURFRAGX 278
#define YOURFRAGY HEALTHY
typedef enum
{
f_none,
f_unk1,
f_unk2,
f_faceleft, /* turn face left */
f_faceright, /* turn face right */
f_hurtbad, /* surprised look when slammed hard */
f_gotgat, /* picked up a weapon smile */
f_mowdown, /* grimace while continuous firing */
NUMSPCLFACES
} spclface_e;
#define NUMFACES 47 //[PSX] Change 48 to 47
#define EVILFACE 6
#define GODFACE 40
#define DEADFACE 41
#define FIRSTSPLAT 42
#define GIBTIME 2 //[PSX] Change 4 to 2
#define NUMSPLATS 6
#define NUMMICROS 8 /* amount of micro-sized #'s (weapon armed) */
typedef struct
{
byte xpos;
byte ypos;
byte x;
byte y;
byte w;
byte h;
} facedata_t;
extern facedata_t facedata[NUMFACES];//0x80073c98
typedef enum
{
sb_minus,
sb_0,
sb_percent = 11,
sb_card_b,
sb_card_y,
sb_card_r,
sb_skul_b,
sb_skul_y,
sb_skul_r,
NUMSBOBJ
} sbobj_e;
typedef struct
{
short active; //*
short doDraw; //2
short delay; //4
short times; //6
} sbflash_t;
typedef struct
{
int face; //800984F4
/* Messaging */
spclface_e specialFace; //800984F8 /* Which type of special face to make */
boolean tryopen[NUMCARDS]; //800984FC /* Tried to open a card or skull door */
boolean gotgibbed; //80098514 /* Got gibbed */
int gibframe; //80098518
int gibdelay; //8009851C
char *message; //80098520
int messagedelay; //80098524
} stbar_t;
extern stbar_t stbar; //800984F4
extern psxobj_t statuspic;
extern int weaponowned[NUMWEAPONS]; //80073ebc
extern short micronums_x[NUMMICROS];//80073ee0
extern short micronums_y[NUMMICROS];//80073ef0
extern short card_y[NUMCARDS];//80073f00
typedef struct {
byte x;
byte y;
byte w;
byte h;
} symboldata_t;
extern symboldata_t symboldata[];//80073e16
void ST_Init (void);
void ST_InitEveryLevel(void);
void ST_Ticker (void);
void ST_Drawer (void);
void ST_DrawValue(int x, int y, int value);
void ST_DrawMessage(int x, int y, char *text);
void ST_CheatDraw(void);
void ST_doPaletteStuff(void);
int ST_GetTextCenterX(char *text);
void ST_DrawText(int x, int y, char *text);
================================================
FILE: PSXDOOM/t_main.c
================================================
/* t_main.c -- title intro */
#include "doomdef.h"
#include "p_spec.h"
#include "r_local.h"
int vframe1 = 0; //80077AB4 iGp000006a4
int vframe2 = 0; //80077AB8 iGp000006a8
psxobj_t loadingpic;//0x80097870
psxobj_t marb01pic;//0x80097890
psxobj_t buttonspic;//0x800978B0
psxobj_t neterrpic; //0x800978d0
psxobj_t pausepic;//0x80097850
psxobj_t titlepic;//0x80097810
/*
=======================
=
= T_Start
=
=======================
*/
void T_Start(void)//L80034EA0()
{
int lump;
Valloc_Init();
Z_FreeTags(mainzone,PU_CACHE);//test
W_CacheLumpName("LOADING", PU_STATIC, 0);
ImageToVram(&loadingpic, "LOADING", 0);
P_LoadingPlaque(&loadingpic, 95, 109, palette[16]);
S_Lcd_Load(0);
W_CacheLumpName("MARB01", PU_STATIC, 0);
W_CacheLumpName("BUTTONS", PU_STATIC, 0);
W_CacheLumpName("NETERR", PU_STATIC, 0);
W_CacheLumpName("PAUSE", PU_STATIC, 0);
ImageToVram(&marb01pic, "MARB01", 0);
ImageToVram(&buttonspic, "BUTTONS", 0);
ImageToVram(&neterrpic, "NETERR", 0);
ImageToVram(&pausepic, "PAUSE", 0);
ImageToVram(&titlepic, "TITLE", 0);
lump = R_TextureNumForName("SKY09");
skytexturep = &textures[lump];
skypalette = palette[15];
W_CacheLumpNum(skytexturep->lump, PU_CACHE, true);
TextureCache(skytexturep);
y_scroll = 250;
psxcd_play(CD_TRACK[cdmusic_title_screen], CDVolume);
do {} while(psxcd_elapsed_sectors() == 0);
}
/*
=======================
=
= T_Stop
=
=======================
*/
void T_Stop(int exit)//L80035070()
{
S_StartSound(NULL, sfx_barexp);
psxcd_stop();
}
/*
=======================
=
= T_Ticker
=
=======================
*/
int T_Ticker(void)//L8003509C()
{
byte *cache, *cachetmp;
int exit, pixel, cnt, i;
exit = ga_nothing;
if (ticbuttons[0] != 0)
{
exit = ga_exit;
}
else
{
vframe1 -= vblsinframe[consoleplayer];
if (vframe1 <= 0)
{
vframe1 = 2;
if (y_scroll != 0)
{
y_scroll--;
if (y_scroll == 0)
last_ticon = ticon;
}
}
vframe2 -= vblsinframe[consoleplayer];
if (vframe2 <= 0)
{
vframe2 = 2;
//Fire Out
if (((y_scroll < 50) & (y_scroll ^ 1) & 1) != 0)
{
cache = (byte *)(lumpcache[skytexturep->lump].cache) + 8;
pixel = *(cache + FIREPOS1) - 1;
if (pixel < 0)
pixel = 0;
cachetmp = (cache + FIREPOS2);
for (i = (FIRESKY_WIDTH - 1); i >= 0; i--)
*cachetmp-- = pixel;
}
P_FireSky(skytexturep);
}
if (y_scroll == 0)
exit = -((unsigned int)(ticon - last_ticon < 1800) ^ 1) & 7;
}
return exit;
}
/*
=======================
=
= T_Draw
=
=======================
*/
#if FIX_TITLE_FYRE_WITH == 1
#define SKY_W 64
#else
#define SKY_W 63
#endif // FIX_TITLE_FYRE_WITH
void T_Draw(void)//L80035214()
{
POLY_FT4 poly1;
RECT rect;
int i;
byte *cache;
NextTextureCacheIdx();
// Draw Title Textures
setPolyFT4(&poly1);
setRGB0(&poly1, 128, 128, 128);
//setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3)
setUV4(&poly1,
0 , 0 ,
255, 0 ,
0 , 239,
255, 239);
//setXY4(p,_x0,_y0,_x1,_y1,_x2,_y2,_x3,_y3)
setXY4(&poly1,
0 , y_scroll,
255, y_scroll,
0 , y_scroll + 239,
255, y_scroll + 239);
poly1.tpage = titlepic.vtpage;
poly1.clut = palette[17];
W_AddPrim(&poly1);// add to order table
// Draw 4 Fire Textures
if (skytexturep->index == -1)
{
rect.x = (skytexturep->vramx >> 1) + ((skytexturep->vtpage & 15) << 6);
rect.y = (skytexturep->vramy) + ((skytexturep->vtpage & 16) << 4);
rect.w = 32;
rect.h = 128;
cache = (byte *)(lumpcache[skytexturep->lump].cache) + 8;
LoadImage(&rect, (unsigned long *)(byte*)(cache));
skytexturep->index = TextureCacheIdx;
}
setPolyFT4(&poly1);
setRGB0(&poly1, 128, 128, 128);
//setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3)
setUV4(&poly1,
skytexturep->vramx , skytexturep->vramy,
skytexturep->vramx + SKY_W, skytexturep->vramy,
skytexturep->vramx , skytexturep->vramy + 127,
skytexturep->vramx + SKY_W, skytexturep->vramy + 127);
//setXY4(p,_x0,_y0,_x1,_y1,_x2,_y2,_x3,_y3)
setXY4(&poly1,
0, 116,
SKY_W, 116,
0, 243,
SKY_W, 243);
poly1.tpage = skytexturep->vtpage;
poly1.clut = skypalette;
for (i = 0; i < 4; i++)
{
W_AddPrim(&poly1);// add to order table
poly1.x0 += SKY_W;
poly1.x1 += SKY_W;
poly1.x2 += SKY_W;
poly1.x3 += SKY_W;
}
UpdateDrawOTag();
DrawRender();
}
================================================
FILE: PSXDOOM/tables.c
================================================
#include "doomdef.h"
int finesine[10240] = {//80067788
25,75,125,175,226,276,326,376,
427,477,527,578,628,678,728,779,
829,879,929,980,1030,1080,1130,1181,
1231,1281,1331,1382,1432,1482,1532,1583,
1633,1683,1733,1784,1834,1884,1934,1985,
2035,2085,2135,2186,2236,2286,2336,2387,
2437,2487,2537,2587,2638,2688,2738,2788,
2839,2889,2939,2989,3039,3090,3140,3190,
3240,3291,3341,3391,3441,3491,3541,3592,
3642,3692,3742,3792,3843,3893,3943,3993,
4043,4093,4144,4194,4244,4294,4344,4394,
4445,4495,4545,4595,4645,4695,4745,4796,
4846,4896,4946,4996,5046,5096,5146,5197,
5247,5297,5347,5397,5447,5497,5547,5597,
5647,5697,5748,5798,5848,5898,5948,5998,
6048,6098,6148,6198,6248,6298,6348,6398,
6448,6498,6548,6598,6648,6698,6748,6798,
6848,6898,6948,6998,7048,7098,7148,7198,
7248,7298,7348,7398,7448,7498,7548,7598,
7648,7697,7747,7797,7847,7897,7947,7997,
8047,8097,8147,8196,8246,8296,8346,8396,
8446,8496,8545,8595,8645,8695,8745,8794,
8844,8894,8944,8994,9043,9093,9143,9193,
9243,9292,9342,9392,9442,9491,9541,9591,
9640,9690,9740,9790,9839,9889,9939,9988,
10038,10088,10137,10187,10237,10286,10336,10386,
10435,10485,10534,10584,10634,10683,10733,10782,
10832,10882,10931,10981,11030,11080,11129,11179,
11228,11278,11327,11377,11426,11476,11525,11575,
11624,11674,11723,11773,11822,11872,11921,11970,
12020,12069,12119,12168,12218,12267,12316,12366,
12415,12464,12514,12563,12612,12662,12711,12760,
12810,12859,12908,12957,13007,13056,13105,13154,
13204,13253,13302,13351,13401,13450,13499,13548,
13597,13647,13696,13745,13794,13843,13892,13941,
13990,14040,14089,14138,14187,14236,14285,14334,
14383,14432,14481,14530,14579,14628,14677,14726,
14775,14824,14873,14922,14971,15020,15069,15118,
15167,15215,15264,15313,15362,15411,15460,15509,
15557,15606,15655,15704,15753,15802,15850,15899,
15948,15997,16045,16094,16143,16191,16240,16289,
16338,16386,16435,16484,16532,16581,16629,16678,
16727,16775,16824,16872,16921,16970,17018,17067,
17115,17164,17212,17261,17309,17358,17406,17455,
17503,17551,17600,17648,17697,17745,17793,17842,
17890,17939,17987,18035,18084,18132,18180,18228,
18277,18325,18373,18421,18470,18518,18566,18614,
18663,18711,18759,18807,18855,18903,18951,19000,
19048,19096,19144,19192,19240,19288,19336,19384,
19432,19480,19528,19576,19624,19672,19720,19768,
19816,19864,19912,19959,20007,20055,20103,20151,
20199,20246,20294,20342,20390,20438,20485,20533,
20581,20629,20676,20724,20772,20819,20867,20915,
20962,21010,21057,21105,21153,21200,21248,21295,
21343,21390,21438,21485,21533,21580,21628,21675,
21723,21770,21817,21865,21912,21960,22007,22054,
22102,22149,22196,22243,22291,22338,22385,22433,
22480,22527,22574,22621,22668,22716,22763,22810,
22857,22904,22951,22998,23045,23092,23139,23186,
23233,23280,23327,23374,23421,23468,23515,23562,
23609,23656,23703,23750,23796,23843,23890,23937,
23984,24030,24077,24124,24171,24217,24264,24311,
24357,24404,24451,24497,24544,24591,24637,24684,
24730,24777,24823,24870,24916,24963,25009,25056,
25102,25149,25195,25241,25288,25334,25381,25427,
25473,25520,25566,25612,25658,25705,25751,25797,
25843,25889,25936,25982,26028,26074,26120,26166,
26212,26258,26304,26350,26396,26442,26488,26534,
26580,26626,26672,26718,26764,26810,26856,26902,
26947,26993,27039,27085,27131,27176,27222,27268,
27313,27359,27405,27450,27496,27542,27587,27633,
27678,27724,27770,27815,27861,27906,27952,27997,
28042,28088,28133,28179,28224,28269,28315,28360,
28405,28451,28496,28541,28586,28632,28677,28722,
28767,28812,28858,28903,28948,28993,29038,29083,
29128,29173,29218,29263,29308,29353,29398,29443,
29488,29533,29577,29622,29667,29712,29757,29801,
29846,29891,29936,29980,30025,30070,30114,30159,
30204,30248,30293,30337,30382,30426,30471,30515,
30560,30604,30649,30693,30738,30782,30826,30871,
30915,30959,31004,31048,31092,31136,31181,31225,
31269,31313,31357,31402,31446,31490,31534,31578,
31622,31666,31710,31754,31798,31842,31886,31930,
31974,32017,32061,32105,32149,32193,32236,32280,
32324,32368,32411,32455,32499,32542,32586,32630,
32673,32717,32760,32804,32847,32891,32934,32978,
33021,33065,33108,33151,33195,33238,33281,33325,
33368,33411,33454,33498,33541,33584,33627,33670,
33713,33756,33799,33843,33886,33929,33972,34015,
34057,34100,34143,34186,34229,34272,34315,34358,
34400,34443,34486,34529,34571,34614,34657,34699,
34742,34785,34827,34870,34912,34955,34997,35040,
35082,35125,35167,35210,35252,35294,35337,35379,
35421,35464,35506,35548,35590,35633,35675,35717,
35759,35801,35843,35885,35927,35969,36011,36053,
36095,36137,36179,36221,36263,36305,36347,36388,
36430,36472,36514,36555,36597,36639,36681,36722,
36764,36805,36847,36889,36930,36972,37013,37055,
37096,37137,37179,37220,37262,37303,37344,37386,
37427,37468,37509,37551,37592,37633,37674,37715,
37756,37797,37838,37879,37920,37961,38002,38043,
38084,38125,38166,38207,38248,38288,38329,38370,
38411,38451,38492,38533,38573,38614,38655,38695,
38736,38776,38817,38857,38898,38938,38979,39019,
39059,39100,39140,39180,39221,39261,39301,39341,
39382,39422,39462,39502,39542,39582,39622,39662,
39702,39742,39782,39822,39862,39902,39942,39982,
40021,40061,40101,40141,40180,40220,40260,40300,
40339,40379,40418,40458,40497,40537,40576,40616,
40655,40695,40734,40773,40813,40852,40891,40931,
40970,41009,41048,41087,41127,41166,41205,41244,
41283,41322,41361,41400,41439,41478,41517,41556,
41595,41633,41672,41711,41750,41788,41827,41866,
41904,41943,41982,42020,42059,42097,42136,42174,
42213,42251,42290,42328,42366,42405,42443,42481,
42520,42558,42596,42634,42672,42711,42749,42787,
42825,42863,42901,42939,42977,43015,43053,43091,
43128,43166,43204,43242,43280,43317,43355,43393,
43430,43468,43506,43543,43581,43618,43656,43693,
43731,43768,43806,43843,43880,43918,43955,43992,
44029,44067,44104,44141,44178,44215,44252,44289,
44326,44363,44400,44437,44474,44511,44548,44585,
44622,44659,44695,44732,44769,44806,44842,44879,
44915,44952,44989,45025,45062,45098,45135,45171,
45207,45244,45280,45316,45353,45389,45425,45462,
45498,45534,45570,45606,45642,45678,45714,45750,
45786,45822,45858,45894,45930,45966,46002,46037,
46073,46109,46145,46180,46216,46252,46287,46323,
46358,46394,46429,46465,46500,46536,46571,46606,
46642,46677,46712,46747,46783,46818,46853,46888,
46923,46958,46993,47028,47063,47098,47133,47168,
47203,47238,47273,47308,47342,47377,47412,47446,
47481,47516,47550,47585,47619,47654,47688,47723,
47757,47792,47826,47860,47895,47929,47963,47998,
48032,48066,48100,48134,48168,48202,48237,48271,
48305,48338,48372,48406,48440,48474,48508,48542,
48575,48609,48643,48676,48710,48744,48777,48811,
48844,48878,48911,48945,48978,49012,49045,49078,
49112,49145,49178,49211,49244,49278,49311,49344,
49377,49410,49443,49476,49509,49542,49575,49608,
49640,49673,49706,49739,49771,49804,49837,49869,
49902,49935,49967,50000,50032,50065,50097,50129,
50162,50194,50226,50259,50291,50323,50355,50387,
50420,50452,50484,50516,50548,50580,50612,50644,
50675,50707,50739,50771,50803,50834,50866,50898,
50929,50961,50993,51024,51056,51087,51119,51150,
51182,51213,51244,51276,51307,51338,51369,51401,
51432,51463,51494,51525,51556,51587,51618,51649,
51680,51711,51742,51773,51803,51834,51865,51896,
51926,51957,51988,52018,52049,52079,52110,52140,
52171,52201,52231,52262,52292,52322,52353,52383,
52413,52443,52473,52503,52534,52564,52594,52624,
52653,52683,52713,52743,52773,52803,52832,52862,
52892,52922,52951,52981,53010,53040,53069,53099,
53128,53158,53187,53216,53246,53275,53304,53334,
53363,53392,53421,53450,53479,53508,53537,53566,
53595,53624,53653,53682,53711,53739,53768,53797,
53826,53854,53883,53911,53940,53969,53997,54026,
54054,54082,54111,54139,54167,54196,54224,54252,
54280,54308,54337,54365,54393,54421,54449,54477,
54505,54533,54560,54588,54616,54644,54672,54699,
54727,54755,54782,54810,54837,54865,54892,54920,
54947,54974,55002,55029,55056,55084,55111,55138,
55165,55192,55219,55246,55274,55300,55327,55354,
55381,55408,55435,55462,55489,55515,55542,55569,
55595,55622,55648,55675,55701,55728,55754,55781,
55807,55833,55860,55886,55912,55938,55965,55991,
56017,56043,56069,56095,56121,56147,56173,56199,
56225,56250,56276,56302,56328,56353,56379,56404,
56430,56456,56481,56507,56532,56557,56583,56608,
56633,56659,56684,56709,56734,56760,56785,56810,
56835,56860,56885,56910,56935,56959,56984,57009,
57034,57059,57083,57108,57133,57157,57182,57206,
57231,57255,57280,57304,57329,57353,57377,57402,
57426,57450,57474,57498,57522,57546,57570,57594,
57618,57642,57666,57690,57714,57738,57762,57785,
57809,57833,57856,57880,57903,57927,57950,57974,
57997,58021,58044,58067,58091,58114,58137,58160,
58183,58207,58230,58253,58276,58299,58322,58345,
58367,58390,58413,58436,58459,58481,58504,58527,
58549,58572,58594,58617,58639,58662,58684,58706,
58729,58751,58773,58795,58818,58840,58862,58884,
58906,58928,58950,58972,58994,59016,59038,59059,
59081,59103,59125,59146,59168,59190,59211,59233,
59254,59276,59297,59318,59340,59361,59382,59404,
59425,59446,59467,59488,59509,59530,59551,59572,
59593,59614,59635,59656,59677,59697,59718,59739,
59759,59780,59801,59821,59842,59862,59883,59903,
59923,59944,59964,59984,60004,60025,60045,60065,
60085,60105,60125,60145,60165,60185,60205,60225,
60244,60264,60284,60304,60323,60343,60363,60382,
60402,60421,60441,60460,60479,60499,60518,60537,
60556,60576,60595,60614,60633,60652,60671,60690,
60709,60728,60747,60766,60785,60803,60822,60841,
60859,60878,60897,60915,60934,60952,60971,60989,
61007,61026,61044,61062,61081,61099,61117,61135,
61153,61171,61189,61207,61225,61243,61261,61279,
61297,61314,61332,61350,61367,61385,61403,61420,
61438,61455,61473,61490,61507,61525,61542,61559,
61577,61594,61611,61628,61645,61662,61679,61696,
61713,61730,61747,61764,61780,61797,61814,61831,
61847,61864,61880,61897,61913,61930,61946,61963,
61979,61995,62012,62028,62044,62060,62076,62092,
62108,62125,62141,62156,62172,62188,62204,62220,
62236,62251,62267,62283,62298,62314,62329,62345,
62360,62376,62391,62407,62422,62437,62453,62468,
62483,62498,62513,62528,62543,62558,62573,62588,
62603,62618,62633,62648,62662,62677,62692,62706,
62721,62735,62750,62764,62779,62793,62808,62822,
62836,62850,62865,62879,62893,62907,62921,62935,
62949,62963,62977,62991,63005,63019,63032,63046,
63060,63074,63087,63101,63114,63128,63141,63155,
63168,63182,63195,63208,63221,63235,63248,63261,
63274,63287,63300,63313,63326,63339,63352,63365,
63378,63390,63403,63416,63429,63441,63454,63466,
63479,63491,63504,63516,63528,63541,63553,63565,
63578,63590,63602,63614,63626,63638,63650,63662,
63674,63686,63698,63709,63721,63733,63745,63756,
63768,63779,63791,63803,63814,63825,63837,63848,
63859,63871,63882,63893,63904,63915,63927,63938,
63949,63960,63971,63981,63992,64003,64014,64025,
64035,64046,64057,64067,64078,64088,64099,64109,
64120,64130,64140,64151,64161,64171,64181,64192,
64202,64212,64222,64232,64242,64252,64261,64271,
64281,64291,64301,64310,64320,64330,64339,64349,
64358,64368,64377,64387,64396,64405,64414,64424,
64433,64442,64451,64460,64469,64478,64487,64496,
64505,64514,64523,64532,64540,64549,64558,64566,
64575,64584,64592,64601,64609,64617,64626,64634,
64642,64651,64659,64667,64675,64683,64691,64699,
64707,64715,64723,64731,64739,64747,64754,64762,
64770,64777,64785,64793,64800,64808,64815,64822,
64830,64837,64844,64852,64859,64866,64873,64880,
64887,64895,64902,64908,64915,64922,64929,64936,
64943,64949,64956,64963,64969,64976,64982,64989,
64995,65002,65008,65015,65021,65027,65033,65040,
65046,65052,65058,65064,65070,65076,65082,65088,
65094,65099,65105,65111,65117,65122,65128,65133,
65139,65144,65150,65155,65161,65166,65171,65177,
65182,65187,65192,65197,65202,65207,65212,65217,
65222,65227,65232,65237,65242,65246,65251,65256,
65260,65265,65270,65274,65279,65283,65287,65292,
65296,65300,65305,65309,65313,65317,65321,65325,
65329,65333,65337,65341,65345,65349,65352,65356,
65360,65363,65367,65371,65374,65378,65381,65385,
65388,65391,65395,65398,65401,65404,65408,65411,
65414,65417,65420,65423,65426,65429,65431,65434,
65437,65440,65442,65445,65448,65450,65453,65455,
65458,65460,65463,65465,65467,65470,65472,65474,
65476,65478,65480,65482,65484,65486,65488,65490,
65492,65494,65496,65497,65499,65501,65502,65504,
65505,65507,65508,65510,65511,65513,65514,65515,
65516,65518,65519,65520,65521,65522,65523,65524,
65525,65526,65527,65527,65528,65529,65530,65530,
65531,65531,65532,65532,65533,65533,65534,65534,
65534,65535,65535,65535,65535,65535,65535,65535,
65535,65535,65535,65535,65535,65535,65535,65534,
65534,65534,65533,65533,65532,65532,65531,65531,
65530,65530,65529,65528,65527,65527,65526,65525,
65524,65523,65522,65521,65520,65519,65518,65516,
65515,65514,65513,65511,65510,65508,65507,65505,
65504,65502,65501,65499,65497,65496,65494,65492,
65490,65488,65486,65484,65482,65480,65478,65476,
65474,65472,65470,65467,65465,65463,65460,65458,
65455,65453,65450,65448,65445,65442,65440,65437,
65434,65431,65429,65426,65423,65420,65417,65414,
65411,65408,65404,65401,65398,65395,65391,65388,
65385,65381,65378,65374,65371,65367,65363,65360,
65356,65352,65349,65345,65341,65337,65333,65329,
65325,65321,65317,65313,65309,65305,65300,65296,
65292,65287,65283,65279,65274,65270,65265,65260,
65256,65251,65246,65242,65237,65232,65227,65222,
65217,65212,65207,65202,65197,65192,65187,65182,
65177,65171,65166,65161,65155,65150,65144,65139,
65133,65128,65122,65117,65111,65105,65099,65094,
65088,65082,65076,65070,65064,65058,65052,65046,
65040,65033,65027,65021,65015,65008,65002,64995,
64989,64982,64976,64969,64963,64956,64949,64943,
64936,64929,64922,64915,64908,64902,64895,64887,
64880,64873,64866,64859,64852,64844,64837,64830,
64822,64815,64808,64800,64793,64785,64777,64770,
64762,64754,64747,64739,64731,64723,64715,64707,
64699,64691,64683,64675,64667,64659,64651,64642,
64634,64626,64617,64609,64600,64592,64584,64575,
64566,64558,64549,64540,64532,64523,64514,64505,
64496,64487,64478,64469,64460,64451,64442,64433,
64424,64414,64405,64396,64387,64377,64368,64358,
64349,64339,64330,64320,64310,64301,64291,64281,
64271,64261,64252,64242,64232,64222,64212,64202,
64192,64181,64171,64161,64151,64140,64130,64120,
64109,64099,64088,64078,64067,64057,64046,64035,
64025,64014,64003,63992,63981,63971,63960,63949,
63938,63927,63915,63904,63893,63882,63871,63859,
63848,63837,63825,63814,63803,63791,63779,63768,
63756,63745,63733,63721,63709,63698,63686,63674,
63662,63650,63638,63626,63614,63602,63590,63578,
63565,63553,63541,63528,63516,63504,63491,63479,
63466,63454,63441,63429,63416,63403,63390,63378,
63365,63352,63339,63326,63313,63300,63287,63274,
63261,63248,63235,63221,63208,63195,63182,63168,
63155,63141,63128,63114,63101,63087,63074,63060,
63046,63032,63019,63005,62991,62977,62963,62949,
62935,62921,62907,62893,62879,62865,62850,62836,
62822,62808,62793,62779,62764,62750,62735,62721,
62706,62692,62677,62662,62648,62633,62618,62603,
62588,62573,62558,62543,62528,62513,62498,62483,
62468,62453,62437,62422,62407,62391,62376,62360,
62345,62329,62314,62298,62283,62267,62251,62236,
62220,62204,62188,62172,62156,62141,62125,62108,
62092,62076,62060,62044,62028,62012,61995,61979,
61963,61946,61930,61913,61897,61880,61864,61847,
61831,61814,61797,61780,61764,61747,61730,61713,
61696,61679,61662,61645,61628,61611,61594,61577,
61559,61542,61525,61507,61490,61473,61455,61438,
61420,61403,61385,61367,61350,61332,61314,61297,
61279,61261,61243,61225,61207,61189,61171,61153,
61135,61117,61099,61081,61062,61044,61026,61007,
60989,60971,60952,60934,60915,60897,60878,60859,
60841,60822,60803,60785,60766,60747,60728,60709,
60690,60671,60652,60633,60614,60595,60576,60556,
60537,60518,60499,60479,60460,60441,60421,60402,
60382,60363,60343,60323,60304,60284,60264,60244,
60225,60205,60185,60165,60145,60125,60105,60085,
60065,60045,60025,60004,59984,59964,59944,59923,
59903,59883,59862,59842,59821,59801,59780,59759,
59739,59718,59697,59677,59656,59635,59614,59593,
59572,59551,59530,59509,59488,59467,59446,59425,
59404,59382,59361,59340,59318,59297,59276,59254,
59233,59211,59190,59168,59146,59125,59103,59081,
59059,59038,59016,58994,58972,58950,58928,58906,
58884,58862,58840,58818,58795,58773,58751,58729,
58706,58684,58662,58639,58617,58594,58572,58549,
58527,58504,58481,58459,58436,58413,58390,58367,
58345,58322,58299,58276,58253,58230,58207,58183,
58160,58137,58114,58091,58067,58044,58021,57997,
57974,57950,57927,57903,57880,57856,57833,57809,
57785,57762,57738,57714,57690,57666,57642,57618,
57594,57570,57546,57522,57498,57474,57450,57426,
57402,57377,57353,57329,57304,57280,57255,57231,
57206,57182,57157,57133,57108,57083,57059,57034,
57009,56984,56959,56935,56910,56885,56860,56835,
56810,56785,56760,56734,56709,56684,56659,56633,
56608,56583,56557,56532,56507,56481,56456,56430,
56404,56379,56353,56328,56302,56276,56250,56225,
56199,56173,56147,56121,56095,56069,56043,56017,
55991,55965,55938,55912,55886,55860,55833,55807,
55781,55754,55728,55701,55675,55648,55622,55595,
55569,55542,55515,55489,55462,55435,55408,55381,
55354,55327,55300,55274,55246,55219,55192,55165,
55138,55111,55084,55056,55029,55002,54974,54947,
54920,54892,54865,54837,54810,54782,54755,54727,
54699,54672,54644,54616,54588,54560,54533,54505,
54477,54449,54421,54393,54365,54337,54308,54280,
54252,54224,54196,54167,54139,54111,54082,54054,
54026,53997,53969,53940,53911,53883,53854,53826,
53797,53768,53739,53711,53682,53653,53624,53595,
53566,53537,53508,53479,53450,53421,53392,53363,
53334,53304,53275,53246,53216,53187,53158,53128,
53099,53069,53040,53010,52981,52951,52922,52892,
52862,52832,52803,52773,52743,52713,52683,52653,
52624,52594,52564,52534,52503,52473,52443,52413,
52383,52353,52322,52292,52262,52231,52201,52171,
52140,52110,52079,52049,52018,51988,51957,51926,
51896,51865,51834,51803,51773,51742,51711,51680,
51649,51618,51587,51556,51525,51494,51463,51432,
51401,51369,51338,51307,51276,51244,51213,51182,
51150,51119,51087,51056,51024,50993,50961,50929,
50898,50866,50834,50803,50771,50739,50707,50675,
50644,50612,50580,50548,50516,50484,50452,50420,
50387,50355,50323,50291,50259,50226,50194,50162,
50129,50097,50065,50032,50000,49967,49935,49902,
49869,49837,49804,49771,49739,49706,49673,49640,
49608,49575,49542,49509,49476,49443,49410,49377,
49344,49311,49278,49244,49211,49178,49145,49112,
49078,49045,49012,48978,48945,48911,48878,48844,
48811,48777,48744,48710,48676,48643,48609,48575,
48542,48508,48474,48440,48406,48372,48338,48304,
48271,48237,48202,48168,48134,48100,48066,48032,
47998,47963,47929,47895,47860,47826,47792,47757,
47723,47688,47654,47619,47585,47550,47516,47481,
47446,47412,47377,47342,47308,47273,47238,47203,
47168,47133,47098,47063,47028,46993,46958,46923,
46888,46853,46818,46783,46747,46712,46677,46642,
46606,46571,46536,46500,46465,46429,46394,46358,
46323,46287,46252,46216,46180,46145,46109,46073,
46037,46002,45966,45930,45894,45858,45822,45786,
45750,45714,45678,45642,45606,45570,45534,45498,
45462,45425,45389,45353,45316,45280,45244,45207,
45171,45135,45098,45062,45025,44989,44952,44915,
44879,44842,44806,44769,44732,44695,44659,44622,
44585,44548,44511,44474,44437,44400,44363,44326,
44289,44252,44215,44178,44141,44104,44067,44029,
43992,43955,43918,43880,43843,43806,43768,43731,
43693,43656,43618,43581,43543,43506,43468,43430,
43393,43355,43317,43280,43242,43204,43166,43128,
43091,43053,43015,42977,42939,42901,42863,42825,
42787,42749,42711,42672,42634,42596,42558,42520,
42481,42443,42405,42366,42328,42290,42251,42213,
42174,42136,42097,42059,42020,41982,41943,41904,
41866,41827,41788,41750,41711,41672,41633,41595,
41556,41517,41478,41439,41400,41361,41322,41283,
41244,41205,41166,41127,41088,41048,41009,40970,
40931,40891,40852,40813,40773,40734,40695,40655,
40616,40576,40537,40497,40458,40418,40379,40339,
40300,40260,40220,40180,40141,40101,40061,40021,
39982,39942,39902,39862,39822,39782,39742,39702,
39662,39622,39582,39542,39502,39462,39422,39382,
39341,39301,39261,39221,39180,39140,39100,39059,
39019,38979,38938,38898,38857,38817,38776,38736,
38695,38655,38614,38573,38533,38492,38451,38411,
38370,38329,38288,38248,38207,38166,38125,38084,
38043,38002,37961,37920,37879,37838,37797,37756,
37715,37674,37633,37592,37551,37509,37468,37427,
37386,37344,37303,37262,37220,37179,37137,37096,
37055,37013,36972,36930,36889,36847,36805,36764,
36722,36681,36639,36597,36556,36514,36472,36430,
36388,36347,36305,36263,36221,36179,36137,36095,
36053,36011,35969,35927,35885,35843,35801,35759,
35717,35675,35633,35590,35548,35506,35464,35421,
35379,35337,35294,35252,35210,35167,35125,35082,
35040,34997,34955,34912,34870,34827,34785,34742,
34699,34657,34614,34571,34529,34486,34443,34400,
34358,34315,34272,34229,34186,34143,34100,34057,
34015,33972,33929,33886,33843,33799,33756,33713,
33670,33627,33584,33541,33498,33454,33411,33368,
33325,33281,33238,33195,33151,33108,33065,33021,
32978,32934,32891,32847,32804,32760,32717,32673,
32630,32586,32542,32499,32455,32411,32368,32324,
32280,32236,32193,32149,32105,32061,32017,31974,
31930,31886,31842,31798,31754,31710,31666,31622,
31578,31534,31490,31446,31402,31357,31313,31269,
31225,31181,31136,31092,31048,31004,30959,30915,
30871,30826,30782,30738,30693,30649,30604,30560,
30515,30471,30426,30382,30337,30293,30248,30204,
30159,30114,30070,30025,29980,29936,29891,29846,
29801,29757,29712,29667,29622,29577,29533,29488,
29443,29398,29353,29308,29263,29218,29173,29128,
29083,29038,28993,28948,28903,28858,28812,28767,
28722,28677,28632,28586,28541,28496,28451,28405,
28360,28315,28269,28224,28179,28133,28088,28042,
27997,27952,27906,27861,27815,27770,27724,27678,
27633,27587,27542,27496,27450,27405,27359,27313,
27268,27222,27176,27131,27085,27039,26993,26947,
26902,26856,26810,26764,26718,26672,26626,26580,
26534,26488,26442,26396,26350,26304,26258,26212,
26166,26120,26074,26028,25982,25936,25889,25843,
25797,25751,25705,25658,25612,25566,25520,25473,
25427,25381,25334,25288,25241,25195,25149,25102,
25056,25009,24963,24916,24870,24823,24777,24730,
24684,24637,24591,24544,24497,24451,24404,24357,
24311,24264,24217,24171,24124,24077,24030,23984,
23937,23890,23843,23796,23750,23703,23656,23609,
23562,23515,23468,23421,23374,23327,23280,23233,
23186,23139,23092,23045,22998,22951,22904,22857,
22810,22763,22716,22668,22621,22574,22527,22480,
22433,22385,22338,22291,22243,22196,22149,22102,
22054,22007,21960,21912,21865,21817,21770,21723,
21675,21628,21580,21533,21485,21438,21390,21343,
21295,21248,21200,21153,21105,21057,21010,20962,
20915,20867,20819,20772,20724,20676,20629,20581,
20533,20485,20438,20390,20342,20294,20246,20199,
20151,20103,20055,20007,19959,19912,19864,19816,
19768,19720,19672,19624,19576,19528,19480,19432,
19384,19336,19288,19240,19192,19144,19096,19048,
19000,18951,18903,18855,18807,18759,18711,18663,
18614,18566,18518,18470,18421,18373,18325,18277,
18228,18180,18132,18084,18035,17987,17939,17890,
17842,17793,17745,17697,17648,17600,17551,17503,
17455,17406,17358,17309,17261,17212,17164,17115,
17067,17018,16970,16921,16872,16824,16775,16727,
16678,16629,16581,16532,16484,16435,16386,16338,
16289,16240,16191,16143,16094,16045,15997,15948,
15899,15850,15802,15753,15704,15655,15606,15557,
15509,15460,15411,15362,15313,15264,15215,15167,
15118,15069,15020,14971,14922,14873,14824,14775,
14726,14677,14628,14579,14530,14481,14432,14383,
14334,14285,14236,14187,14138,14089,14040,13990,
13941,13892,13843,13794,13745,13696,13646,13597,
13548,13499,13450,13401,13351,13302,13253,13204,
13154,13105,13056,13007,12957,12908,12859,12810,
12760,12711,12662,12612,12563,12514,12464,12415,
12366,12316,12267,12218,12168,12119,12069,12020,
11970,11921,11872,11822,11773,11723,11674,11624,
11575,11525,11476,11426,11377,11327,11278,11228,
11179,11129,11080,11030,10981,10931,10882,10832,
10782,10733,10683,10634,10584,10534,10485,10435,
10386,10336,10286,10237,10187,10137,10088,10038,
9988,9939,9889,9839,9790,9740,9690,9640,
9591,9541,9491,9442,9392,9342,9292,9243,
9193,9143,9093,9043,8994,8944,8894,8844,
8794,8745,8695,8645,8595,8545,8496,8446,
8396,8346,8296,8246,8196,8147,8097,8047,
7997,7947,7897,7847,7797,7747,7697,7648,
7598,7548,7498,7448,7398,7348,7298,7248,
7198,7148,7098,7048,6998,6948,6898,6848,
6798,6748,6698,6648,6598,6548,6498,6448,
6398,6348,6298,6248,6198,6148,6098,6048,
5998,5948,5898,5848,5798,5748,5697,5647,
5597,5547,5497,5447,5397,5347,5297,5247,
5197,5146,5096,5046,4996,4946,4896,4846,
4796,4745,4695,4645,4595,4545,4495,4445,
4394,4344,4294,4244,4194,4144,4093,4043,
3993,3943,3893,3843,3792,3742,3692,3642,
3592,3541,3491,3441,3391,3341,3291,3240,
3190,3140,3090,3039,2989,2939,2889,2839,
2788,2738,2688,2638,2587,2537,2487,2437,
2387,2336,2286,2236,2186,2135,2085,2035,
1985,1934,1884,1834,1784,1733,1683,1633,
1583,1532,1482,1432,1382,1331,1281,1231,
1181,1130,1080,1030,980,929,879,829,
779,728,678,628,578,527,477,427,
376,326,276,226,175,125,75,25,
-25,-75,-125,-175,-226,-276,-326,-376,
-427,-477,-527,-578,-628,-678,-728,-779,
-829,-879,-929,-980,-1030,-1080,-1130,-1181,
-1231,-1281,-1331,-1382,-1432,-1482,-1532,-1583,
-1633,-1683,-1733,-1784,-1834,-1884,-1934,-1985,
-2035,-2085,-2135,-2186,-2236,-2286,-2336,-2387,
-2437,-2487,-2537,-2588,-2638,-2688,-2738,-2788,
-2839,-2889,-2939,-2989,-3039,-3090,-3140,-3190,
-3240,-3291,-3341,-3391,-3441,-3491,-3541,-3592,
-3642,-3692,-3742,-3792,-3843,-3893,-3943,-3993,
-4043,-4093,-4144,-4194,-4244,-4294,-4344,-4394,
-4445,-4495,-4545,-4595,-4645,-4695,-4745,-4796,
-4846,-4896,-4946,-4996,-5046,-5096,-5146,-5197,
-5247,-5297,-5347,-5397,-5447,-5497,-5547,-5597,
-5647,-5697,-5748,-5798,-5848,-5898,-5948,-5998,
-6048,-6098,-6148,-6198,-6248,-6298,-6348,-6398,
-6448,-6498,-6548,-6598,-6648,-6698,-6748,-6798,
-6848,-6898,-6948,-6998,-7048,-7098,-7148,-7198,
-7248,-7298,-7348,-7398,-7448,-7498,-7548,-7598,
-7648,-7697,-7747,-7797,-7847,-7897,-7947,-7997,
-8047,-8097,-8147,-8196,-8246,-8296,-8346,-8396,
-8446,-8496,-8545,-8595,-8645,-8695,-8745,-8794,
-8844,-8894,-8944,-8994,-9043,-9093,-9143,-9193,
-9243,-9292,-9342,-9392,-9442,-9491,-9541,-9591,
-9640,-9690,-9740,-9790,-9839,-9889,-9939,-9988,
-10038,-10088,-10137,-10187,-10237,-10286,-10336,-10386,
-10435,-10485,-10534,-10584,-10634,-10683,-10733,-10782,
-10832,-10882,-10931,-10981,-11030,-11080,-11129,-11179,
-11228,-11278,-11327,-11377,-11426,-11476,-11525,-11575,
-11624,-11674,-11723,-11773,-11822,-11872,-11921,-11970,
-12020,-12069,-12119,-12168,-12218,-12267,-12316,-12366,
-12415,-12464,-12514,-12563,-12612,-12662,-12711,-12760,
-12810,-12859,-12908,-12957,-13007,-13056,-13105,-13154,
-13204,-13253,-13302,-13351,-13401,-13450,-13499,-13548,
-13597,-13647,-13696,-13745,-13794,-13843,-13892,-13941,
-13990,-14040,-14089,-14138,-14187,-14236,-14285,-14334,
-14383,-14432,-14481,-14530,-14579,-14628,-14677,-14726,
-14775,-14824,-14873,-14922,-14971,-15020,-15069,-15118,
-15167,-15215,-15264,-15313,-15362,-15411,-15460,-15509,
-15557,-15606,-15655,-15704,-15753,-15802,-15850,-15899,
-15948,-15997,-16045,-16094,-16143,-16191,-16240,-16289,
-16338,-16386,-16435,-16484,-16532,-16581,-16629,-16678,
-16727,-16775,-16824,-16872,-16921,-16970,-17018,-17067,
-17115,-17164,-17212,-17261,-17309,-17358,-17406,-17455,
-17503,-17551,-17600,-17648,-17697,-17745,-17793,-17842,
-17890,-17939,-17987,-18035,-18084,-18132,-18180,-18228,
-18277,-18325,-18373,-18421,-18470,-18518,-18566,-18614,
-18663,-18711,-18759,-18807,-18855,-18903,-18951,-19000,
-19048,-19096,-19144,-19192,-19240,-19288,-19336,-19384,
-19432,-19480,-19528,-19576,-19624,-19672,-19720,-19768,
-19816,-19864,-19912,-19959,-20007,-20055,-20103,-20151,
-20199,-20246,-20294,-20342,-20390,-20438,-20485,-20533,
-20581,-20629,-20676,-20724,-20772,-20819,-20867,-20915,
-20962,-21010,-21057,-21105,-21153,-21200,-21248,-21295,
-21343,-21390,-21438,-21485,-21533,-21580,-21628,-21675,
-21723,-21770,-21817,-21865,-21912,-21960,-22007,-22054,
-22102,-22149,-22196,-22243,-22291,-22338,-22385,-22433,
-22480,-22527,-22574,-22621,-22668,-22716,-22763,-22810,
-22857,-22904,-22951,-22998,-23045,-23092,-23139,-23186,
-23233,-23280,-23327,-23374,-23421,-23468,-23515,-23562,
-23609,-23656,-23703,-23750,-23796,-23843,-23890,-23937,
-23984,-24030,-24077,-24124,-24171,-24217,-24264,-24311,
-24357,-24404,-24451,-24497,-24544,-24591,-24637,-24684,
-24730,-24777,-24823,-24870,-24916,-24963,-25009,-25056,
-25102,-25149,-25195,-25241,-25288,-25334,-25381,-25427,
-25473,-25520,-25566,-25612,-25658,-25705,-25751,-25797,
-25843,-25889,-25936,-25982,-26028,-26074,-26120,-26166,
-26212,-26258,-26304,-26350,-26396,-26442,-26488,-26534,
-26580,-26626,-26672,-26718,-26764,-26810,-26856,-26902,
-26947,-26993,-27039,-27085,-27131,-27176,-27222,-27268,
-27313,-27359,-27405,-27450,-27496,-27542,-27587,-27633,
-27678,-27724,-27770,-27815,-27861,-27906,-27952,-27997,
-28042,-28088,-28133,-28179,-28224,-28269,-28315,-28360,
-28405,-28451,-28496,-28541,-28586,-28632,-28677,-28722,
-28767,-28812,-28858,-28903,-28948,-28993,-29038,-29083,
-29128,-29173,-29218,-29263,-29308,-29353,-29398,-29443,
-29488,-29533,-29577,-29622,-29667,-29712,-29757,-29801,
-29846,-29891,-29936,-29980,-30025,-30070,-30114,-30159,
-30204,-30248,-30293,-30337,-30382,-30426,-30471,-30515,
-30560,-30604,-30649,-30693,-30738,-30782,-30826,-30871,
-30915,-30959,-31004,-31048,-31092,-31136,-31181,-31225,
-31269,-31313,-31357,-31402,-31446,-31490,-31534,-31578,
-31622,-31666,-31710,-31754,-31798,-31842,-31886,-31930,
-31974,-32017,-32061,-32105,-32149,-32193,-32236,-32280,
-32324,-32368,-32411,-32455,-32499,-32542,-32586,-32630,
-32673,-32717,-32760,-32804,-32847,-32891,-32934,-32978,
-33021,-33065,-33108,-33151,-33195,-33238,-33281,-33325,
-33368,-33411,-33454,-33498,-33541,-33584,-33627,-33670,
-33713,-33756,-33799,-33843,-33886,-33929,-33972,-34015,
-34057,-34100,-34143,-34186,-34229,-34272,-34315,-34358,
-34400,-34443,-34486,-34529,-34571,-34614,-34657,-34699,
-34742,-34785,-34827,-34870,-34912,-34955,-34997,-35040,
-35082,-35125,-35167,-35210,-35252,-35294,-35337,-35379,
-35421,-35464,-35506,-35548,-35590,-35633,-35675,-35717,
-35759,-35801,-35843,-35885,-35927,-35969,-36011,-36053,
-36095,-36137,-36179,-36221,-36263,-36305,-36347,-36388,
-36430,-36472,-36514,-36555,-36597,-36639,-36681,-36722,
-36764,-36805,-36847,-36889,-36930,-36972,-37013,-37055,
-37096,-37137,-37179,-37220,-37262,-37303,-37344,-37386,
-37427,-37468,-37509,-37551,-37592,-37633,-37674,-37715,
-37756,-37797,-37838,-37879,-37920,-37961,-38002,-38043,
-38084,-38125,-38166,-38207,-38248,-38288,-38329,-38370,
-38411,-38451,-38492,-38533,-38573,-38614,-38655,-38695,
-38736,-38776,-38817,-38857,-38898,-38938,-38979,-39019,
-39059,-39100,-39140,-39180,-39221,-39261,-39301,-39341,
-39382,-39422,-39462,-39502,-39542,-39582,-39622,-39662,
-39702,-39742,-39782,-39822,-39862,-39902,-39942,-39982,
-40021,-40061,-40101,-40141,-40180,-40220,-40260,-40299,
-40339,-40379,-40418,-40458,-40497,-40537,-40576,-40616,
-40655,-40695,-40734,-40773,-40813,-40852,-40891,-40931,
-40970,-41009,-41048,-41087,-41127,-41166,-41205,-41244,
-41283,-41322,-41361,-41400,-41439,-41478,-41517,-41556,
-41595,-41633,-41672,-41711,-41750,-41788,-41827,-41866,
-41904,-41943,-41982,-42020,-42059,-42097,-42136,-42174,
-42213,-42251,-42290,-42328,-42366,-42405,-42443,-42481,
-42520,-42558,-42596,-42634,-42672,-42711,-42749,-42787,
-42825,-42863,-42901,-42939,-42977,-43015,-43053,-43091,
-43128,-43166,-43204,-43242,-43280,-43317,-43355,-43393,
-43430,-43468,-43506,-43543,-43581,-43618,-43656,-43693,
-43731,-43768,-43806,-43843,-43880,-43918,-43955,-43992,
-44029,-44067,-44104,-44141,-44178,-44215,-44252,-44289,
-44326,-44363,-44400,-44437,-44474,-44511,-44548,-44585,
-44622,-44659,-44695,-44732,-44769,-44806,-44842,-44879,
-44915,-44952,-44989,-45025,-45062,-45098,-45135,-45171,
-45207,-45244,-45280,-45316,-45353,-45389,-45425,-45462,
-45498,-45534,-45570,-45606,-45642,-45678,-45714,-45750,
-45786,-45822,-45858,-45894,-45930,-45966,-46002,-46037,
-46073,-46109,-46145,-46180,-46216,-46252,-46287,-46323,
-46358,-46394,-46429,-46465,-46500,-46536,-46571,-46606,
-46642,-46677,-46712,-46747,-46783,-46818,-46853,-46888,
-46923,-46958,-46993,-47028,-47063,-47098,-47133,-47168,
-47203,-47238,-47273,-47308,-47342,-47377,-47412,-47446,
-47481,-47516,-47550,-47585,-47619,-47654,-47688,-47723,
-47757,-47792,-47826,-47860,-47895,-47929,-47963,-47998,
-48032,-48066,-48100,-48134,-48168,-48202,-48236,-48271,
-48304,-48338,-48372,-48406,-48440,-48474,-48508,-48542,
-48575,-48609,-48643,-48676,-48710,-48744,-48777,-48811,
-48844,-48878,-48911,-48945,-48978,-49012,-49045,-49078,
-49112,-49145,-49178,-49211,-49244,-49278,-49311,-49344,
-49377,-49410,-49443,-49476,-49509,-49542,-49575,-49608,
-49640,-49673,-49706,-49739,-49771,-49804,-49837,-49869,
-49902,-49935,-49967,-50000,-50032,-50065,-50097,-50129,
-50162,-50194,-50226,-50259,-50291,-50323,-50355,-50387,
-50420,-50452,-50484,-50516,-50548,-50580,-50612,-50644,
-50675,-50707,-50739,-50771,-50803,-50834,-50866,-50898,
-50929,-50961,-50993,-51024,-51056,-51087,-51119,-51150,
-51182,-51213,-51244,-51276,-51307,-51338,-51369,-51401,
-51432,-51463,-51494,-51525,-51556,-51587,-51618,-51649,
-51680,-51711,-51742,-51773,-51803,-51834,-51865,-51896,
-51926,-51957,-51988,-52018,-52049,-52079,-52110,-52140,
-52171,-52201,-52231,-52262,-52292,-52322,-52353,-52383,
-52413,-52443,-52473,-52503,-52534,-52564,-52594,-52624,
-52653,-52683,-52713,-52743,-52773,-52803,-52832,-52862,
-52892,-52922,-52951,-52981,-53010,-53040,-53069,-53099,
-53128,-53158,-53187,-53216,-53246,-53275,-53304,-53334,
-53363,-53392,-53421,-53450,-53479,-53508,-53537,-53566,
-53595,-53624,-53653,-53682,-53711,-53739,-53768,-53797,
-53826,-53854,-53883,-53911,-53940,-53969,-53997,-54026,
-54054,-54082,-54111,-54139,-54167,-54196,-54224,-54252,
-54280,-54308,-54337,-54365,-54393,-54421,-54449,-54477,
-54505,-54533,-54560,-54588,-54616,-54644,-54672,-54699,
-54727,-54755,-54782,-54810,-54837,-54865,-54892,-54920,
-54947,-54974,-55002,-55029,-55056,-55084,-55111,-55138,
-55165,-55192,-55219,-55246,-55274,-55300,-55327,-55354,
-55381,-55408,-55435,-55462,-55489,-55515,-55542,-55569,
-55595,-55622,-55648,-55675,-55701,-55728,-55754,-55781,
-55807,-55833,-55860,-55886,-55912,-55938,-55965,-55991,
-56017,-56043,-56069,-56095,-56121,-56147,-56173,-56199,
-56225,-56250,-56276,-56302,-56328,-56353,-56379,-56404,
-56430,-56456,-56481,-56507,-56532,-56557,-56583,-56608,
-56633,-56659,-56684,-56709,-56734,-56760,-56785,-56810,
-56835,-56860,-56885,-56910,-56935,-56959,-56984,-57009,
-57034,-57059,-57083,-57108,-57133,-57157,-57182,-57206,
-57231,-57255,-57280,-57304,-57329,-57353,-57377,-57402,
-57426,-57450,-57474,-57498,-57522,-57546,-57570,-57594,
-57618,-57642,-57666,-57690,-57714,-57738,-57762,-57785,
-57809,-57833,-57856,-57880,-57903,-57927,-57950,-57974,
-57997,-58021,-58044,-58067,-58091,-58114,-58137,-58160,
-58183,-58207,-58230,-58253,-58276,-58299,-58322,-58345,
-58367,-58390,-58413,-58436,-58459,-58481,-58504,-58527,
-58549,-58572,-58594,-58617,-58639,-58662,-58684,-58706,
-58729,-58751,-58773,-58795,-58818,-58840,-58862,-58884,
-58906,-58928,-58950,-58972,-58994,-59016,-59038,-59059,
-59081,-59103,-59125,-59146,-59168,-59190,-59211,-59233,
-59254,-59276,-59297,-59318,-59340,-59361,-59382,-59404,
-59425,-59446,-59467,-59488,-59509,-59530,-59551,-59572,
-59593,-59614,-59635,-59656,-59677,-59697,-59718,-59739,
-59759,-59780,-59801,-59821,-59842,-59862,-59883,-59903,
-59923,-59944,-59964,-59984,-60004,-60025,-60045,-60065,
-60085,-60105,-60125,-60145,-60165,-60185,-60205,-60225,
-60244,-60264,-60284,-60304,-60323,-60343,-60363,-60382,
-60402,-60421,-60441,-60460,-60479,-60499,-60518,-60537,
-60556,-60576,-60595,-60614,-60633,-60652,-60671,-60690,
-60709,-60728,-60747,-60766,-60785,-60803,-60822,-60841,
-60859,-60878,-60897,-60915,-60934,-60952,-60971,-60989,
-61007,-61026,-61044,-61062,-61081,-61099,-61117,-61135,
-61153,-61171,-61189,-61207,-61225,-61243,-61261,-61279,
-61297,-61314,-61332,-61350,-61367,-61385,-61403,-61420,
-61438,-61455,-61473,-61490,-61507,-61525,-61542,-61559,
-61577,-61594,-61611,-61628,-61645,-61662,-61679,-61696,
-61713,-61730,-61747,-61764,-61780,-61797,-61814,-61831,
-61847,-61864,-61880,-61897,-61913,-61930,-61946,-61963,
-61979,-61995,-62012,-62028,-62044,-62060,-62076,-62092,
-62108,-62125,-62141,-62156,-62172,-62188,-62204,-62220,
-62236,-62251,-62267,-62283,-62298,-62314,-62329,-62345,
-62360,-62376,-62391,-62407,-62422,-62437,-62453,-62468,
-62483,-62498,-62513,-62528,-62543,-62558,-62573,-62588,
-62603,-62618,-62633,-62648,-62662,-62677,-62692,-62706,
-62721,-62735,-62750,-62764,-62779,-62793,-62808,-62822,
-62836,-62850,-62865,-62879,-62893,-62907,-62921,-62935,
-62949,-62963,-62977,-62991,-63005,-63019,-63032,-63046,
-63060,-63074,-63087,-63101,-63114,-63128,-63141,-63155,
-63168,-63182,-63195,-63208,-63221,-63235,-63248,-63261,
-63274,-63287,-63300,-63313,-63326,-63339,-63352,-63365,
-63378,-63390,-63403,-63416,-63429,-63441,-63454,-63466,
-63479,-63491,-63504,-63516,-63528,-63541,-63553,-63565,
-63578,-63590,-63602,-63614,-63626,-63638,-63650,-63662,
-63674,-63686,-63698,-63709,-63721,-63733,-63745,-63756,
-63768,-63779,-63791,-63803,-63814,-63825,-63837,-63848,
-63859,-63871,-63882,-63893,-63904,-63915,-63927,-63938,
-63949,-63960,-63971,-63981,-63992,-64003,-64014,-64025,
-64035,-64046,-64057,-64067,-64078,-64088,-64099,-64109,
-64120,-64130,-64140,-64151,-64161,-64171,-64181,-64192,
-64202,-64212,-64222,-64232,-64242,-64252,-64261,-64271,
-64281,-64291,-64301,-64310,-64320,-64330,-64339,-64349,
-64358,-64368,-64377,-64387,-64396,-64405,-64414,-64424,
-64433,-64442,-64451,-64460,-64469,-64478,-64487,-64496,
-64505,-64514,-64523,-64532,-64540,-64549,-64558,-64566,
-64575,-64584,-64592,-64601,-64609,-64617,-64626,-64634,
-64642,-64651,-64659,-64667,-64675,-64683,-64691,-64699,
-64707,-64715,-64723,-64731,-64739,-64747,-64754,-64762,
-64770,-64777,-64785,-64793,-64800,-64808,-64815,-64822,
-64830,-64837,-64844,-64852,-64859,-64866,-64873,-64880,
-64887,-64895,-64902,-64908,-64915,-64922,-64929,-64936,
-64943,-64949,-64956,-64963,-64969,-64976,-64982,-64989,
-64995,-65002,-65008,-65015,-65021,-65027,-65033,-65040,
-65046,-65052,-65058,-65064,-65070,-65076,-65082,-65088,
-65094,-65099,-65105,-65111,-65117,-65122,-65128,-65133,
-65139,-65144,-65150,-65155,-65161,-65166,-65171,-65177,
-65182,-65187,-65192,-65197,-65202,-65207,-65212,-65217,
-65222,-65227,-65232,-65237,-65242,-65246,-65251,-65256,
-65260,-65265,-65270,-65274,-65279,-65283,-65287,-65292,
-65296,-65300,-65305,-65309,-65313,-65317,-65321,-65325,
-65329,-65333,-65337,-65341,-65345,-65349,-65352,-65356,
-65360,-65363,-65367,-65371,-65374,-65378,-65381,-65385,
-65388,-65391,-65395,-65398,-65401,-65404,-65408,-65411,
-65414,-65417,-65420,-65423,-65426,-65429,-65431,-65434,
-65437,-65440,-65442,-65445,-65448,-65450,-65453,-65455,
-65458,-65460,-65463,-65465,-65467,-65470,-65472,-65474,
-65476,-65478,-65480,-65482,-65484,-65486,-65488,-65490,
-65492,-65494,-65496,-65497,-65499,-65501,-65502,-65504,
-65505,-65507,-65508,-65510,-65511,-65513,-65514,-65515,
-65516,-65518,-65519,-65520,-65521,-65522,-65523,-65524,
-65525,-65526,-65527,-65527,-65528,-65529,-65530,-65530,
-65531,-65531,-65532,-65532,-65533,-65533,-65534,-65534,
-65534,-65535,-65535,-65535,-65535,-65535,-65535,-65535,
-65535,-65535,-65535,-65535,-65535,-65535,-65535,-65534,
-65534,-65534,-65533,-65533,-65532,-65532,-65531,-65531,
-65530,-65530,-65529,-65528,-65527,-65527,-65526,-65525,
-65524,-65523,-65522,-65521,-65520,-65519,-65518,-65516,
-65515,-65514,-65513,-65511,-65510,-65508,-65507,-65505,
-65504,-65502,-65501,-65499,-65497,-65496,-65494,-65492,
-65490,-65488,-65486,-65484,-65482,-65480,-65478,-65476,
-65474,-65472,-65470,-65467,-65465,-65463,-65460,-65458,
-65455,-65453,-65450,-65448,-65445,-65442,-65440,-65437,
-65434,-65431,-65429,-65426,-65423,-65420,-65417,-65414,
-65411,-65408,-65404,-65401,-65398,-65395,-65391,-65388,
-65385,-65381,-65378,-65374,-65371,-65367,-65363,-65360,
-65356,-65352,-65349,-65345,-65341,-65337,-65333,-65329,
-65325,-65321,-65317,-65313,-65309,-65305,-65300,-65296,
-65292,-65287,-65283,-65279,-65274,-65270,-65265,-65260,
-65256,-65251,-65246,-65242,-65237,-65232,-65227,-65222,
-65217,-65212,-65207,-65202,-65197,-65192,-65187,-65182,
-65177,-65171,-65166,-65161,-65155,-65150,-65144,-65139,
-65133,-65128,-65122,-65117,-65111,-65105,-65099,-65094,
-65088,-65082,-65076,-65070,-65064,-65058,-65052,-65046,
-65040,-65033,-65027,-65021,-65015,-65008,-65002,-64995,
-64989,-64982,-64976,-64969,-64963,-64956,-64949,-64943,
-64936,-64929,-64922,-64915,-64908,-64902,-64895,-64887,
-64880,-64873,-64866,-64859,-64852,-64844,-64837,-64830,
-64822,-64815,-64808,-64800,-64793,-64785,-64777,-64770,
-64762,-64754,-64747,-64739,-64731,-64723,-64715,-64707,
-64699,-64691,-64683,-64675,-64667,-64659,-64651,-64642,
-64634,-64626,-64617,-64609,-64601,-64592,-64584,-64575,
-64566,-64558,-64549,-64540,-64532,-64523,-64514,-64505,
-64496,-64487,-64478,-64469,-64460,-64451,-64442,-64433,
-64424,-64414,-64405,-64396,-64387,-64377,-64368,-64358,
-64349,-64339,-64330,-64320,-64310,-64301,-64291,-64281,
-64271,-64261,-64252,-64242,-64232,-64222,-64212,-64202,
-64192,-64181,-64171,-64161,-64151,-64140,-64130,-64120,
-64109,-64099,-64088,-64078,-64067,-64057,-64046,-64035,
-64025,-64014,-64003,-63992,-63981,-63971,-63960,-63949,
-63938,-63927,-63915,-63904,-63893,-63882,-63871,-63859,
-63848,-63837,-63825,-63814,-63803,-63791,-63779,-63768,
-63756,-63745,-63733,-63721,-63709,-63698,-63686,-63674,
-63662,-63650,-63638,-63626,-63614,-63602,-63590,-63578,
-63565,-63553,-63541,-63528,-63516,-63504,-63491,-63479,
-63466,-63454,-63441,-63429,-63416,-63403,-63390,-63378,
-63365,-63352,-63339,-63326,-63313,-63300,-63287,-63274,
-63261,-63248,-63235,-63221,-63208,-63195,-63182,-63168,
-63155,-63141,-63128,-63114,-63101,-63087,-63074,-63060,
-63046,-63032,-63019,-63005,-62991,-62977,-62963,-62949,
-62935,-62921,-62907,-62893,-62879,-62865,-62850,-62836,
-62822,-62808,-62793,-62779,-62764,-62750,-62735,-62721,
-62706,-62692,-62677,-62662,-62648,-62633,-62618,-62603,
-62588,-62573,-62558,-62543,-62528,-62513,-62498,-62483,
-62468,-62453,-62437,-62422,-62407,-62391,-62376,-62360,
-62345,-62329,-62314,-62298,-62283,-62267,-62251,-62236,
-62220,-62204,-62188,-62172,-62156,-62141,-62125,-62108,
-62092,-62076,-62060,-62044,-62028,-62012,-61995,-61979,
-61963,-61946,-61930,-61913,-61897,-61880,-61864,-61847,
-61831,-61814,-61797,-61780,-61764,-61747,-61730,-61713,
-61696,-61679,-61662,-61645,-61628,-61611,-61594,-61577,
-61559,-61542,-61525,-61507,-61490,-61473,-61455,-61438,
-61420,-61403,-61385,-61367,-61350,-61332,-61314,-61297,
-61279,-61261,-61243,-61225,-61207,-61189,-61171,-61153,
-61135,-61117,-61099,-61081,-61062,-61044,-61026,-61007,
-60989,-60971,-60952,-60934,-60915,-60897,-60878,-60859,
-60841,-60822,-60803,-60785,-60766,-60747,-60728,-60709,
-60690,-60671,-60652,-60633,-60614,-60595,-60576,-60556,
-60537,-60518,-60499,-60479,-60460,-60441,-60421,-60402,
-60382,-60363,-60343,-60323,-60304,-60284,-60264,-60244,
-60225,-60205,-60185,-60165,-60145,-60125,-60105,-60085,
-60065,-60045,-60025,-60004,-59984,-59964,-59944,-59923,
-59903,-59883,-59862,-59842,-59821,-59801,-59780,-59759,
-59739,-59718,-59697,-59677,-59656,-59635,-59614,-59593,
-59572,-59551,-59530,-59509,-59488,-59467,-59446,-59425,
-59404,-59382,-59361,-59340,-59318,-59297,-59276,-59254,
-59233,-59211,-59189,-59168,-59146,-59125,-59103,-59081,
-59059,-59038,-59016,-58994,-58972,-58950,-58928,-58906,
-58884,-58862,-58840,-58818,-58795,-58773,-58751,-58729,
-58706,-58684,-58662,-58639,-58617,-58594,-58572,-58549,
-58527,-58504,-58481,-58459,-58436,-58413,-58390,-58367,
-58345,-58322,-58299,-58276,-58253,-58230,-58207,-58183,
-58160,-58137,-58114,-58091,-58067,-58044,-58021,-57997,
-57974,-57950,-57927,-57903,-57880,-57856,-57833,-57809,
-57785,-57762,-57738,-57714,-57690,-57666,-57642,-57618,
-57594,-57570,-57546,-57522,-57498,-57474,-57450,-57426,
-57402,-57377,-57353,-57329,-57304,-57280,-57255,-57231,
-57206,-57182,-57157,-57133,-57108,-57083,-57059,-57034,
-57009,-56984,-56959,-56935,-56910,-56885,-56860,-56835,
-56810,-56785,-56760,-56734,-56709,-56684,-56659,-56633,
-56608,-56583,-56557,-56532,-56507,-56481,-56456,-56430,
-56404,-56379,-56353,-56328,-56302,-56276,-56250,-56225,
-56199,-56173,-56147,-56121,-56095,-56069,-56043,-56017,
-55991,-55965,-55938,-55912,-55886,-55860,-55833,-55807,
-55781,-55754,-55728,-55701,-55675,-55648,-55622,-55595,
-55569,-55542,-55515,-55489,-55462,-55435,-55408,-55381,
-55354,-55327,-55300,-55274,-55246,-55219,-55192,-55165,
-55138,-55111,-55084,-55056,-55029,-55002,-54974,-54947,
-54920,-54892,-54865,-54837,-54810,-54782,-54755,-54727,
-54699,-54672,-54644,-54616,-54588,-54560,-54533,-54505,
-54477,-54449,-54421,-54393,-54365,-54337,-54308,-54280,
-54252,-54224,-54196,-54167,-54139,-54111,-54082,-54054,
-54026,-53997,-53969,-53940,-53911,-53883,-53854,-53826,
-53797,-53768,-53739,-53711,-53682,-53653,-53624,-53595,
-53566,-53537,-53508,-53479,-53450,-53421,-53392,-53363,
-53334,-53304,-53275,-53246,-53216,-53187,-53158,-53128,
-53099,-53069,-53040,-53010,-52981,-52951,-52922,-52892,
-52862,-52832,-52803,-52773,-52743,-52713,-52683,-52653,
-52624,-52594,-52564,-52534,-52503,-52473,-52443,-52413,
-52383,-52353,-52322,-52292,-52262,-52231,-52201,-52171,
-52140,-52110,-52079,-52049,-52018,-51988,-51957,-51926,
-51896,-51865,-51834,-51803,-51773,-51742,-51711,-51680,
-51649,-51618,-51587,-51556,-51525,-51494,-51463,-51432,
-51401,-51369,-51338,-51307,-51276,-51244,-51213,-51182,
-51150,-51119,-51087,-51056,-51024,-50993,-50961,-50929,
-50898,-50866,-50834,-50803,-50771,-50739,-50707,-50675,
-50644,-50612,-50580,-50548,-50516,-50484,-50452,-50420,
-50387,-50355,-50323,-50291,-50259,-50226,-50194,-50162,
-50129,-50097,-50065,-50032,-50000,-49967,-49935,-49902,
-49869,-49837,-49804,-49771,-49739,-49706,-49673,-49640,
-49608,-49575,-49542,-49509,-49476,-49443,-49410,-49377,
-49344,-49311,-49278,-49244,-49211,-49178,-49145,-49112,
-49078,-49045,-49012,-48978,-48945,-48911,-48878,-48844,
-48811,-48777,-48744,-48710,-48676,-48643,-48609,-48575,
-48542,-48508,-48474,-48440,-48406,-48372,-48338,-48305,
-48271,-48237,-48202,-48168,-48134,-48100,-48066,-48032,
-47998,-47963,-47929,-47895,-47860,-47826,-47792,-47757,
-47723,-47688,-47654,-47619,-47585,-47550,-47516,-47481,
-47446,-47412,-47377,-47342,-47307,-47273,-47238,-47203,
-47168,-47133,-47098,-47063,-47028,-46993,-46958,-46923,
-46888,-46853,-46818,-46783,-46747,-46712,-46677,-46642,
-46606,-46571,-46536,-46500,-46465,-46429,-46394,-46358,
-46323,-46287,-46251,-46216,-46180,-46145,-46109,-46073,
-46037,-46002,-45966,-45930,-45894,-45858,-45822,-45786,
-45750,-45714,-45678,-45642,-45606,-45570,-45534,-45498,
-45462,-45425,-45389,-45353,-45316,-45280,-45244,-45207,
-45171,-45135,-45098,-45062,-45025,-44989,-44952,-44915,
-44879,-44842,-44806,-44769,-44732,-44695,-44659,-44622,
-44585,-44548,-44511,-44474,-44437,-44400,-44363,-44326,
-44289,-44252,-44215,-44178,-44141,-44104,-44067,-44029,
-43992,-43955,-43918,-43880,-43843,-43806,-43768,-43731,
-43693,-43656,-43618,-43581,-43543,-43506,-43468,-43430,
-43393,-43355,-43317,-43280,-43242,-43204,-43166,-43128,
-43091,-43053,-43015,-42977,-42939,-42901,-42863,-42825,
-42787,-42749,-42711,-42672,-42634,-42596,-42558,-42520,
-42481,-42443,-42405,-42366,-42328,-42290,-42251,-42213,
-42174,-42136,-42097,-42059,-42020,-41982,-41943,-41904,
-41866,-41827,-41788,-41750,-41711,-41672,-41633,-41595,
-41556,-41517,-41478,-41439,-41400,-41361,-41322,-41283,
-41244,-41205,-41166,-41127,-41087,-41048,-41009,-40970,
-40931,-40891,-40852,-40813,-40773,-40734,-40695,-40655,
-40616,-40576,-40537,-40497,-40458,-40418,-40379,-40339,
-40299,-40260,-40220,-40180,-40141,-40101,-40061,-40021,
-39982,-39942,-39902,-39862,-39822,-39782,-39742,-39702,
-39662,-39622,-39582,-39542,-39502,-39462,-39422,-39382,
-39341,-39301,-39261,-39221,-39180,-39140,-39100,-39059,
-39019,-38979,-38938,-38898,-38857,-38817,-38776,-38736,
-38695,-38655,-38614,-38573,-38533,-38492,-38451,-38411,
-38370,-38329,-38288,-38248,-38207,-38166,-38125,-38084,
-38043,-38002,-37961,-37920,-37879,-37838,-37797,-37756,
-37715,-37674,-37633,-37592,-37550,-37509,-37468,-37427,
-37386,-37344,-37303,-37262,-37220,-37179,-37137,-37096,
-37055,-37013,-36972,-36930,-36889,-36847,-36805,-36764,
-36722,-36681,-36639,-36597,-36556,-36514,-36472,-36430,
-36388,-36347,-36305,-36263,-36221,-36179,-36137,-36095,
-36053,-36011,-35969,-35927,-35885,-35843,-35801,-35759,
-35717,-35675,-35633,-35590,-35548,-35506,-35464,-35421,
-35379,-35337,-35294,-35252,-35210,-35167,-35125,-35082,
-35040,-34997,-34955,-34912,-34870,-34827,-34785,-34742,
-34699,-34657,-34614,-34571,-34529,-34486,-34443,-34400,
-34358,-34315,-34272,-34229,-34186,-34143,-34100,-34057,
-34015,-33972,-33929,-33886,-33843,-33799,-33756,-33713,
-33670,-33627,-33584,-33541,-33498,-33454,-33411,-33368,
-33325,-33281,-33238,-33195,-33151,-33108,-33065,-33021,
-32978,-32934,-32891,-32847,-32804,-32760,-32717,-32673,
-32630,-32586,-32542,-32499,-32455,-32411,-32368,-32324,
-32280,-32236,-32193,-32149,-32105,-32061,-32017,-31974,
-31930,-31886,-31842,-31798,-31754,-31710,-31666,-31622,
-31578,-31534,-31490,-31446,-31402,-31357,-31313,-31269,
-31225,-31181,-31136,-31092,-31048,-31004,-30959,-30915,
-30871,-30826,-30782,-30738,-30693,-30649,-30604,-30560,
-30515,-30471,-30426,-30382,-30337,-30293,-30248,-30204,
-30159,-30114,-30070,-30025,-29980,-29936,-29891,-29846,
-29801,-29757,-29712,-29667,-29622,-29577,-29533,-29488,
-29443,-29398,-29353,-29308,-29263,-29218,-29173,-29128,
-29083,-29038,-28993,-28948,-28903,-28858,-28812,-28767,
-28722,-28677,-28632,-28586,-28541,-28496,-28451,-28405,
-28360,-28315,-28269,-28224,-28179,-28133,-28088,-28042,
-27997,-27952,-27906,-27861,-27815,-27770,-27724,-27678,
-27633,-27587,-27542,-27496,-27450,-27405,-27359,-27313,
-27268,-27222,-27176,-27131,-27085,-27039,-26993,-26947,
-26902,-26856,-26810,-26764,-26718,-26672,-26626,-26580,
-26534,-26488,-26442,-26396,-26350,-26304,-26258,-26212,
-26166,-26120,-26074,-26028,-25982,-25936,-25889,-25843,
-25797,-25751,-25705,-25658,-25612,-25566,-25520,-25473,
-25427,-25381,-25334,-25288,-25241,-25195,-25149,-25102,
-25056,-25009,-24963,-24916,-24870,-24823,-24777,-24730,
-24684,-24637,-24591,-24544,-24497,-24451,-24404,-24357,
-24311,-24264,-24217,-24171,-24124,-24077,-24030,-23984,
-23937,-23890,-23843,-23796,-23750,-23703,-23656,-23609,
-23562,-23515,-23468,-23421,-23374,-23327,-23280,-23233,
-23186,-23139,-23092,-23045,-22998,-22951,-22904,-22857,
-22810,-22763,-22716,-22668,-22621,-22574,-22527,-22480,
-22432,-22385,-22338,-22291,-22243,-22196,-22149,-22102,
-22054,-22007,-21960,-21912,-21865,-21817,-21770,-21723,
-21675,-21628,-21580,-21533,-21485,-21438,-21390,-21343,
-21295,-21248,-21200,-21153,-21105,-21057,-21010,-20962,
-20915,-20867,-20819,-20772,-20724,-20676,-20629,-20581,
-20533,-20485,-20438,-20390,-20342,-20294,-20246,-20199,
-20151,-20103,-20055,-20007,-19959,-19912,-19864,-19816,
-19768,-19720,-19672,-19624,-19576,-19528,-19480,-19432,
-19384,-19336,-19288,-19240,-19192,-19144,-19096,-19048,
-19000,-18951,-18903,-18855,-18807,-18759,-18711,-18663,
-18614,-18566,-18518,-18470,-18421,-18373,-18325,-18277,
-18228,-18180,-18132,-18084,-18035,-17987,-17939,-17890,
-17842,-17793,-17745,-17697,-17648,-17600,-17551,-17503,
-17455,-17406,-17358,-17309,-17261,-17212,-17164,-17115,
-17067,-17018,-16970,-16921,-16872,-16824,-16775,-16727,
-16678,-16629,-16581,-16532,-16484,-16435,-16386,-16338,
-16289,-16240,-16191,-16143,-16094,-16045,-15997,-15948,
-15899,-15850,-15802,-15753,-15704,-15655,-15606,-15557,
-15509,-15460,-15411,-15362,-15313,-15264,-15215,-15167,
-15118,-15069,-15020,-14971,-14922,-14873,-14824,-14775,
-14726,-14677,-14628,-14579,-14530,-14481,-14432,-14383,
-14334,-14285,-14236,-14187,-14138,-14089,-14040,-13990,
-13941,-13892,-13843,-13794,-13745,-13696,-13647,-13597,
-13548,-13499,-13450,-13401,-13351,-13302,-13253,-13204,
-13154,-13105,-13056,-13007,-12957,-12908,-12859,-12810,
-12760,-12711,-12662,-12612,-12563,-12514,-12464,-12415,
-12366,-12316,-12267,-12217,-12168,-12119,-12069,-12020,
-11970,-11921,-11872,-11822,-11773,-11723,-11674,-11624,
-11575,-11525,-11476,-11426,-11377,-11327,-11278,-11228,
-11179,-11129,-11080,-11030,-10981,-10931,-10882,-10832,
-10782,-10733,-10683,-10634,-10584,-10534,-10485,-10435,
-10386,-10336,-10286,-10237,-10187,-10137,-10088,-10038,
-9988,-9939,-9889,-9839,-9790,-9740,-9690,-9640,
-9591,-9541,-9491,-9442,-9392,-9342,-9292,-9243,
-9193,-9143,-9093,-9043,-8994,-8944,-8894,-8844,
-8794,-8745,-8695,-8645,-8595,-8545,-8496,-8446,
-8396,-8346,-8296,-8246,-8196,-8147,-8097,-8047,
-7997,-7947,-7897,-7847,-7797,-7747,-7697,-7648,
-7598,-7548,-7498,-7448,-7398,-7348,-7298,-7248,
-7198,-7148,-7098,-7048,-6998,-6948,-6898,-6848,
-6798,-6748,-6698,-6648,-6598,-6548,-6498,-6448,
-6398,-6348,-6298,-6248,-6198,-6148,-6098,-6048,
-5998,-5948,-5898,-5848,-5798,-5747,-5697,-5647,
-5597,-5547,-5497,-5447,-5397,-5347,-5297,-5247,
-5197,-5146,-5096,-5046,-4996,-4946,-4896,-4846,
-4796,-4745,-4695,-4645,-4595,-4545,-4495,-4445,
-4394,-4344,-4294,-4244,-4194,-4144,-4093,-4043,
-3993,-3943,-3893,-3843,-3792,-3742,-3692,-3642,
-3592,-3541,-3491,-3441,-3391,-3341,-3291,-3240,
-3190,-3140,-3090,-3039,-2989,-2939,-2889,-2839,
-2788,-2738,-2688,-2638,-2588,-2537,-2487,-2437,
-2387,-2336,-2286,-2236,-2186,-2135,-2085,-2035,
-1985,-1934,-1884,-1834,-1784,-1733,-1683,-1633,
-1583,-1532,-1482,-1432,-1382,-1331,-1281,-1231,
-1181,-1130,-1080,-1030,-980,-929,-879,-829,
-779,-728,-678,-628,-578,-527,-477,-427,
-376,-326,-276,-226,-175,-125,-75,-25,
25,75,125,175,226,276,326,376,
427,477,527,578,628,678,728,779,
829,879,929,980,1030,1080,1130,1181,
1231,1281,1331,1382,1432,1482,1532,1583,
1633,1683,1733,1784,1834,1884,1934,1985,
2035,2085,2135,2186,2236,2286,2336,2387,
2437,2487,2537,2587,2638,2688,2738,2788,
2839,2889,2939,2989,3039,3090,3140,3190,
3240,3291,3341,3391,3441,3491,3542,3592,
3642,3692,3742,3792,3843,3893,3943,3993,
4043,4093,4144,4194,4244,4294,4344,4394,
4445,4495,4545,4595,4645,4695,4745,4796,
4846,4896,4946,4996,5046,5096,5146,5197,
5247,5297,5347,5397,5447,5497,5547,5597,
5647,5697,5747,5798,5848,5898,5948,5998,
6048,6098,6148,6198,6248,6298,6348,6398,
6448,6498,6548,6598,6648,6698,6748,6798,
6848,6898,6948,6998,7048,7098,7148,7198,
7248,7298,7348,7398,7448,7498,7548,7598,
7648,7697,7747,7797,7847,7897,7947,7997,
8047,8097,8147,8196,8246,8296,8346,8396,
8446,8496,8545,8595,8645,8695,8745,8794,
8844,8894,8944,8994,9043,9093,9143,9193,
9243,9292,9342,9392,9442,9491,9541,9591,
9640,9690,9740,9790,9839,9889,9939,9988,
10038,10088,10137,10187,10237,10286,10336,10386,
10435,10485,10534,10584,10634,10683,10733,10782,
10832,10882,10931,10981,11030,11080,11129,11179,
11228,11278,11327,11377,11426,11476,11525,11575,
11624,11674,11723,11773,11822,11872,11921,11970,
12020,12069,12119,12168,12218,12267,12316,12366,
12415,12464,12514,12563,12612,12662,12711,12760,
12810,12859,12908,12957,13007,13056,13105,13154,
13204,13253,13302,13351,13401,13450,13499,13548,
13597,13647,13696,13745,13794,13843,13892,13941,
13990,14040,14089,14138,14187,14236,14285,14334,
14383,14432,14481,14530,14579,14628,14677,14726,
14775,14824,14873,14922,14971,15020,15069,15118,
15167,15215,15264,15313,15362,15411,15460,15509,
15557,15606,15655,15704,15753,15802,15850,15899,
15948,15997,16045,16094,16143,16191,16240,16289,
16338,16386,16435,16484,16532,16581,16629,16678,
16727,16775,16824,16872,16921,16970,17018,17067,
17115,17164,17212,17261,17309,17358,17406,17455,
17503,17551,17600,17648,17697,17745,17793,17842,
17890,17939,17987,18035,18084,18132,18180,18228,
18277,18325,18373,18421,18470,18518,18566,18614,
18663,18711,18759,18807,18855,18903,18951,19000,
19048,19096,19144,19192,19240,19288,19336,19384,
19432,19480,19528,19576,19624,19672,19720,19768,
19816,19864,19912,19959,20007,20055,20103,20151,
20199,20246,20294,20342,20390,20438,20485,20533,
20581,20629,20676,20724,20772,20819,20867,20915,
20962,21010,21057,21105,21153,21200,21248,21295,
21343,21390,21438,21485,21533,21580,21628,21675,
21723,21770,21817,21865,21912,21960,22007,22054,
22102,22149,22196,22243,22291,22338,22385,22432,
22480,22527,22574,22621,22668,22716,22763,22810,
22857,22904,22951,22998,23045,23092,23139,23186,
23233,23280,23327,23374,23421,23468,23515,23562,
23609,23656,23703,23750,23796,23843,23890,23937,
23984,24030,24077,24124,24171,24217,24264,24311,
24357,24404,24451,24497,24544,24591,24637,24684,
24730,24777,24823,24870,24916,24963,25009,25056,
25102,25149,25195,25241,25288,25334,25381,25427,
25473,25520,25566,25612,25658,25705,25751,25797,
25843,25889,25936,25982,26028,26074,26120,26166,
26212,26258,26304,26350,26396,26442,26488,26534,
26580,26626,26672,26718,26764,26810,26856,26902,
26947,26993,27039,27085,27131,27176,27222,27268,
27313,27359,27405,27450,27496,27542,27587,27633,
27678,27724,27770,27815,27861,27906,27952,27997,
28042,28088,28133,28179,28224,28269,28315,28360,
28405,28451,28496,28541,28586,28632,28677,28722,
28767,28812,28858,28903,28948,28993,29038,29083,
29128,29173,29218,29263,29308,29353,29398,29443,
29488,29533,29577,29622,29667,29712,29757,29801,
29846,29891,29936,29980,30025,30070,30114,30159,
30204,30248,30293,30337,30382,30427,30471,30516,
30560,30604,30649,30693,30738,30782,30826,30871,
30915,30959,31004,31048,31092,31136,31181,31225,
31269,31313,31357,31402,31446,31490,31534,31578,
31622,31666,31710,31754,31798,31842,31886,31930,
31974,32017,32061,32105,32149,32193,32236,32280,
32324,32368,32411,32455,32499,32542,32586,32630,
32673,32717,32760,32804,32847,32891,32934,32978,
33021,33065,33108,33151,33195,33238,33281,33325,
33368,33411,33454,33498,33541,33584,33627,33670,
33713,33756,33799,33843,33886,33929,33972,34015,
34057,34100,34143,34186,34229,34272,34315,34358,
34400,34443,34486,34529,34571,34614,34657,34699,
34742,34785,34827,34870,34912,34955,34997,35040,
35082,35125,35167,35210,35252,35294,35337,35379,
35421,35464,35506,35548,35590,35633,35675,35717,
35759,35801,35843,35885,35927,35969,36011,36053,
36095,36137,36179,36221,36263,36305,36347,36388,
36430,36472,36514,36556,36597,36639,36681,36722,
36764,36805,36847,36889,36930,36972,37013,37055,
37096,37137,37179,37220,37262,37303,37344,37386,
37427,37468,37509,37551,37592,37633,37674,37715,
37756,37797,37838,37879,37920,37961,38002,38043,
38084,38125,38166,38207,38248,38288,38329,38370,
38411,38451,38492,38533,38573,38614,38655,38695,
38736,38776,38817,38857,38898,38938,38979,39019,
39059,39100,39140,39180,39221,39261,39301,39341,
39382,39422,39462,39502,39542,39582,39622,39662,
39702,39742,39782,39822,39862,39902,39942,39982,
40021,40061,40101,40141,40180,40220,40260,40299,
40339,40379,40418,40458,40497,40537,40576,40616,
40655,40695,40734,40773,40813,40852,40891,40931,
40970,41009,41048,41087,41127,41166,41205,41244,
41283,41322,41361,41400,41439,41478,41517,41556,
41595,41633,41672,41711,41750,41788,41827,41866,
41904,41943,41982,42020,42059,42097,42136,42174,
42213,42251,42290,42328,42366,42405,42443,42481,
42520,42558,42596,42634,42672,42711,42749,42787,
42825,42863,42901,42939,42977,43015,43053,43091,
43128,43166,43204,43242,43280,43317,43355,43393,
43430,43468,43506,43543,43581,43618,43656,43693,
43731,43768,43806,43843,43880,43918,43955,43992,
44029,44067,44104,44141,44178,44215,44252,44289,
44326,44363,44400,44437,44474,44511,44548,44585,
44622,44659,44695,44732,44769,44806,44842,44879,
44915,44952,44989,45025,45062,45098,45135,45171,
45207,45244,45280,45316,45353,45389,45425,45462,
45498,45534,45570,45606,45642,45678,45714,45750,
45786,45822,45858,45894,45930,45966,46002,46037,
46073,46109,46145,46180,46216,46252,46287,46323,
46358,46394,46429,46465,46500,46536,46571,46606,
46642,46677,46712,46747,46783,46818,46853,46888,
46923,46958,46993,47028,47063,47098,47133,47168,
47203,47238,47273,47308,47342,47377,47412,47446,
47481,47516,47550,47585,47619,47654,47688,47723,
47757,47792,47826,47861,47895,47929,47963,47998,
48032,48066,48100,48134,48168,48202,48237,48271,
48305,48338,48372,48406,48440,48474,48508,48542,
48575,48609,48643,48676,48710,48744,48777,48811,
48844,48878,48911,48945,48978,49012,49045,49078,
49112,49145,49178,49211,49244,49278,49311,49344,
49377,49410,49443,49476,49509,49542,49575,49608,
49640,49673,49706,49739,49771,49804,49837,49869,
49902,49935,49967,50000,50032,50064,50097,50129,
50162,50194,50226,50259,50291,50323,50355,50387,
50420,50452,50484,50516,50548,50580,50612,50644,
50675,50707,50739,50771,50803,50834,50866,50898,
50929,50961,50993,51024,51056,51087,51119,51150,
51182,51213,51244,51276,51307,51338,51369,51401,
51432,51463,51494,51525,51556,51587,51618,51649,
51680,51711,51742,51773,51803,51834,51865,51896,
51926,51957,51988,52018,52049,52079,52110,52140,
52171,52201,52231,52262,52292,52322,52353,52383,
52413,52443,52473,52503,52534,52564,52594,52624,
52653,52683,52713,52743,52773,52803,52832,52862,
52892,52922,52951,52981,53010,53040,53069,53099,
53128,53158,53187,53216,53246,53275,53304,53334,
53363,53392,53421,53450,53479,53508,53537,53566,
53595,53624,53653,53682,53711,53739,53768,53797,
53826,53854,53883,53912,53940,53969,53997,54026,
54054,54082,54111,54139,54167,54196,54224,54252,
54280,54309,54337,54365,54393,54421,54449,54477,
54505,54533,54560,54588,54616,54644,54672,54699,
54727,54755,54782,54810,54837,54865,54892,54920,
54947,54974,55002,55029,55056,55084,55111,55138,
55165,55192,55219,55246,55274,55300,55327,55354,
55381,55408,55435,55462,55489,55515,55542,55569,
55595,55622,55648,55675,55701,55728,55754,55781,
55807,55833,55860,55886,55912,55938,55965,55991,
56017,56043,56069,56095,56121,56147,56173,56199,
56225,56250,56276,56302,56328,56353,56379,56404,
56430,56456,56481,56507,56532,56557,56583,56608,
56633,56659,56684,56709,56734,56760,56785,56810,
56835,56860,56885,56910,56935,56959,56984,57009,
57034,57059,57083,57108,57133,57157,57182,57206,
57231,57255,57280,57304,57329,57353,57377,57402,
57426,57450,57474,57498,57522,57546,57570,57594,
57618,57642,57666,57690,57714,57738,57762,57785,
57809,57833,57856,57880,57903,57927,57950,57974,
57997,58021,58044,58067,58091,58114,58137,58160,
58183,58207,58230,58253,58276,58299,58322,58345,
58367,58390,58413,58436,58459,58481,58504,58527,
58549,58572,58594,58617,58639,58662,58684,58706,
58729,58751,58773,58795,58818,58840,58862,58884,
58906,58928,58950,58972,58994,59016,59038,59059,
59081,59103,59125,59146,59168,59190,59211,59233,
59254,59276,59297,59318,59340,59361,59382,59404,
59425,59446,59467,59488,59509,59530,59551,59572,
59593,59614,59635,59656,59677,59697,59718,59739,
59759,59780,59801,59821,59842,59862,59883,59903,
59923,59944,59964,59984,60004,60025,60045,60065,
60085,60105,60125,60145,60165,60185,60205,60225,
60244,60264,60284,60304,60323,60343,60363,60382,
60402,60421,60441,60460,60479,60499,60518,60537,
60556,60576,60595,60614,60633,60652,60671,60690,
60709,60728,60747,60766,60785,60803,60822,60841,
60859,60878,60897,60915,60934,60952,60971,60989,
61007,61026,61044,61062,61081,61099,61117,61135,
61153,61171,61189,61207,61225,61243,61261,61279,
61297,61314,61332,61350,61367,61385,61403,61420,
61438,61455,61473,61490,61507,61525,61542,61559,
61577,61594,61611,61628,61645,61662,61679,61696,
61713,61730,61747,61764,61780,61797,61814,61831,
61847,61864,61880,61897,61913,61930,61946,61963,
61979,61995,62012,62028,62044,62060,62076,62092,
62108,62125,62141,62156,62172,62188,62204,62220,
62236,62251,62267,62283,62298,62314,62329,62345,
62360,62376,62391,62407,62422,62437,62453,62468,
62483,62498,62513,62528,62543,62558,62573,62588,
62603,62618,62633,62648,62662,62677,62692,62706,
62721,62735,62750,62764,62779,62793,62808,62822,
62836,62850,62865,62879,62893,62907,62921,62935,
62949,62963,62977,62991,63005,63019,63032,63046,
63060,63074,63087,63101,63114,63128,63141,63155,
63168,63182,63195,63208,63221,63235,63248,63261,
63274,63287,63300,63313,63326,63339,63352,63365,
63378,63390,63403,63416,63429,63441,63454,63466,
63479,63491,63504,63516,63528,63541,63553,63565,
63578,63590,63602,63614,63626,63638,63650,63662,
63674,63686,63698,63709,63721,63733,63745,63756,
63768,63779,63791,63803,63814,63825,63837,63848,
63859,63871,63882,63893,63904,63915,63927,63938,
63949,63960,63971,63981,63992,64003,64014,64025,
64035,64046,64057,64067,64078,64088,64099,64109,
64120,64130,64140,64151,64161,64171,64181,64192,
64202,64212,64222,64232,64242,64252,64261,64271,
64281,64291,64301,64310,64320,64330,64339,64349,
64358,64368,64377,64387,64396,64405,64414,64424,
64433,64442,64451,64460,64469,64478,64487,64496,
64505,64514,64523,64532,64540,64549,64558,64566,
64575,64584,64592,64600,64609,64617,64626,64634,
64642,64651,64659,64667,64675,64683,64691,64699,
64707,64715,64723,64731,64739,64747,64754,64762,
64770,64777,64785,64793,64800,64808,64815,64822,
64830,64837,64844,64852,64859,64866,64873,64880,
64887,64895,64902,64908,64915,64922,64929,64936,
64943,64949,64956,64963,64969,64976,64982,64989,
64995,65002,65008,65015,65021,65027,65033,65040,
65046,65052,65058,65064,65070,65076,65082,65088,
65094,65099,65105,65111,65117,65122,65128,65133,
65139,65144,65150,65155,65161,65166,65171,65177,
65182,65187,65192,65197,65202,65207,65212,65217,
65222,65227,65232,65237,65242,65246,65251,65256,
65260,65265,65270,65274,65279,65283,65287,65292,
65296,65300,65305,65309,65313,65317,65321,65325,
65329,65333,65337,65341,65345,65349,65352,65356,
65360,65363,65367,65371,65374,65378,65381,65385,
65388,65391,65395,65398,65401,65404,65408,65411,
65414,65417,65420,65423,65426,65429,65431,65434,
65437,65440,65442,65445,65448,65450,65453,65455,
65458,65460,65463,65465,65467,65470,65472,65474,
65476,65478,65480,65482,65484,65486,65488,65490,
65492,65494,65496,65497,65499,65501,65502,65504,
65505,65507,65508,65510,65511,65513,65514,65515,
65516,65518,65519,65520,65521,65522,65523,65524,
65525,65526,65527,65527,65528,65529,65530,65530,
65531,65531,65532,65532,65533,65533,65534,65534,
65534,65535,65535,65535,65535,65535,65535,65535
};
int tantoangle[2049] = {//80071788
0,333772,667544,1001315,1335086,1668857,2002626,2336395,
2670163,3003929,3337694,3671457,4005219,4338979,4672736,5006492,
5340245,5673995,6007743,6341488,6675230,7008968,7342704,7676435,
8010164,8343888,8677609,9011325,9345037,9678744,10012447,10346145,
10679838,11013526,11347209,11680887,12014558,12348225,12681885,13015539,
13349187,13682829,14016464,14350092,14683714,15017328,15350936,15684536,
16018129,16351714,16685291,17018860,17352422,17685974,18019518,18353054,
18686582,19020100,19353610,19687110,20020600,20354080,20687552,21021014,
21354466,21687906,22021338,22354758,22688168,23021568,23354956,23688332,
24021698,24355052,24688396,25021726,25355046,25688352,26021648,26354930,
26688200,27021456,27354702,27687932,28021150,28354356,28687548,29020724,
29353888,29687038,30020174,30353296,30686404,31019496,31352574,31685636,
32018684,32351718,32684734,33017736,33350722,33683692,34016648,34349584,
34682508,35015412,35348300,35681172,36014028,36346868,36679688,37012492,
37345276,37678044,38010792,38343524,38676240,39008936,39341612,39674272,
40006912,40339532,40672132,41004716,41337276,41669820,42002344,42334848,
42667332,42999796,43332236,43664660,43997060,44329444,44661800,44994140,
45326456,45658752,45991028,46323280,46655512,46987720,47319908,47652072,
47984212,48316332,48648428,48980500,49312548,49644576,49976580,50308556,
50640512,50972444,51304352,51636236,51968096,52299928,52631740,52963524,
53295284,53627020,53958728,54290412,54622068,54953704,55285308,55616888,
55948444,56279972,56611472,56942948,57274396,57605816,57937212,58268576,
58599916,58931228,59262512,59593768,59924992,60256192,60587364,60918508,
61249620,61580704,61911760,62242788,62573788,62904756,63235692,63566604,
63897480,64228332,64559148,64889940,65220696,65551424,65882120,66212788,
66543420,66874024,67204600,67535136,67865648,68196120,68526568,68856984,
69187360,69517712,69848024,70178304,70508560,70838776,71168960,71499112,
71829224,72159312,72489360,72819376,73149360,73479304,73809216,74139096,
74468936,74798744,75128520,75458264,75787968,76117632,76447264,76776864,
77106424,77435952,77765440,78094888,78424304,78753688,79083032,79412336,
79741608,80070840,80400032,80729192,81058312,81387392,81716432,82045440,
82374408,82703336,83032224,83361080,83689896,84018664,84347400,84676096,
85004760,85333376,85661952,85990488,86318984,86647448,86975864,87304240,
87632576,87960872,88289128,88617344,88945520,89273648,89601736,89929792,
90257792,90585760,90913688,91241568,91569408,91897200,92224960,92552672,
92880336,93207968,93535552,93863088,94190584,94518040,94845448,95172816,
95500136,95827416,96154648,96481832,96808976,97136080,97463136,97790144,
98117112,98444032,98770904,99097736,99424520,99751256,100077944,100404592,
100731192,101057744,101384248,101710712,102037128,102363488,102689808,103016080,
103342312,103668488,103994616,104320696,104646736,104972720,105298656,105624552,
105950392,106276184,106601928,106927624,107253272,107578872,107904416,108229920,
108555368,108880768,109206120,109531416,109856664,110181872,110507016,110832120,
111157168,111482168,111807112,112132008,112456856,112781648,113106392,113431080,
113755720,114080312,114404848,114729328,115053760,115378136,115702464,116026744,
116350960,116675128,116999248,117323312,117647320,117971272,118295176,118619024,
118942816,119266560,119590248,119913880,120237456,120560984,120884456,121207864,
121531224,121854528,122177784,122500976,122824112,123147200,123470224,123793200,
124116120,124438976,124761784,125084528,125407224,125729856,126052432,126374960,
126697424,127019832,127342184,127664472,127986712,128308888,128631008,128953072,
129275080,129597024,129918912,130240744,130562520,130884232,131205888,131527480,
131849016,132170496,132491912,132813272,133134576,133455816,133776992,134098120,
134419184,134740176,135061120,135382000,135702816,136023584,136344272,136664912,
136985488,137306016,137626464,137946864,138267184,138587456,138907664,139227808,
139547904,139867920,140187888,140507776,140827616,141147392,141467104,141786752,
142106336,142425856,142745312,143064720,143384048,143703312,144022512,144341664,
144660736,144979744,145298704,145617584,145936400,146255168,146573856,146892480,
147211040,147529536,147847968,148166336,148484640,148802880,149121056,149439152,
149757200,150075168,150393072,150710912,151028688,151346400,151664048,151981616,
152299136,152616576,152933952,153251264,153568496,153885680,154202784,154519824,
154836784,155153696,155470528,155787296,156104000,156420624,156737200,157053696,
157370112,157686480,158002768,158318976,158635136,158951216,159267232,159583168,
159899040,160214848,160530592,160846256,161161840,161477376,161792832,162108208,
162423520,162738768,163053952,163369040,163684080,163999040,164313936,164628752,
164943504,165258176,165572784,165887312,166201776,166516160,166830480,167144736,
167458912,167773008,168087040,168400992,168714880,169028688,169342432,169656096,
169969696,170283216,170596672,170910032,171223344,171536576,171849728,172162800,
172475808,172788736,173101600,173414384,173727104,174039728,174352288,174664784,
174977200,175289536,175601792,175913984,176226096,176538144,176850096,177161984,
177473792,177785536,178097200,178408784,178720288,179031728,179343088,179654368,
179965568,180276704,180587744,180898720,181209616,181520448,181831184,182141856,
182452448,182762960,183073408,183383760,183694048,184004240,184314368,184624416,
184934400,185244288,185554096,185863840,186173504,186483072,186792576,187102000,
187411344,187720608,188029808,188338912,188647936,188956896,189265760,189574560,
189883264,190191904,190500448,190808928,191117312,191425632,191733872,192042016,
192350096,192658096,192966000,193273840,193581584,193889264,194196848,194504352,
194811792,195119136,195426400,195733584,196040688,196347712,196654656,196961520,
197268304,197574992,197881616,198188144,198494592,198800960,199107248,199413456,
199719584,200025616,200331584,200637456,200943248,201248960,201554576,201860128,
202165584,202470960,202776256,203081456,203386592,203691632,203996592,204301472,
204606256,204910976,205215600,205520144,205824592,206128960,206433248,206737456,
207041584,207345616,207649568,207953424,208257216,208560912,208864512,209168048,
209471488,209774832,210078112,210381296,210684384,210987408,211290336,211593184,
211895936,212198608,212501184,212803680,213106096,213408432,213710672,214012816,
214314880,214616864,214918768,215220576,215522288,215823920,216125472,216426928,
216728304,217029584,217330784,217631904,217932928,218233856,218534704,218835472,
219136144,219436720,219737216,220037632,220337952,220638192,220938336,221238384,
221538352,221838240,222138032,222437728,222737344,223036880,223336304,223635664,
223934912,224234096,224533168,224832160,225131072,225429872,225728608,226027232,
226325776,226624240,226922608,227220880,227519056,227817152,228115168,228413088,
228710912,229008640,229306288,229603840,229901312,230198688,230495968,230793152,
231090256,231387280,231684192,231981024,232277760,232574416,232870960,233167440,
233463808,233760096,234056288,234352384,234648384,234944304,235240128,235535872,
235831504,236127056,236422512,236717888,237013152,237308336,237603424,237898416,
238193328,238488144,238782864,239077488,239372016,239666464,239960816,240255072,
240549232,240843312,241137280,241431168,241724960,242018656,242312256,242605776,
242899200,243192512,243485744,243778896,244071936,244364880,244657744,244950496,
245243168,245535744,245828224,246120608,246412912,246705104,246997216,247289216,
247581136,247872960,248164688,248456320,248747856,249039296,249330640,249621904,
249913056,250204128,250495088,250785968,251076736,251367424,251658016,251948512,
252238912,252529200,252819408,253109520,253399536,253689456,253979280,254269008,
254558640,254848176,255137632,255426976,255716224,256005376,256294432,256583392,
256872256,257161024,257449696,257738272,258026752,258315136,258603424,258891600,
259179696,259467696,259755600,260043392,260331104,260618704,260906224,261193632,
261480960,261768176,262055296,262342320,262629248,262916080,263202816,263489456,
263776000,264062432,264348784,264635024,264921168,265207216,265493168,265779024,
266064784,266350448,266636000,266921472,267206832,267492096,267777264,268062336,
268347312,268632192,268916960,269201632,269486208,269770688,270055072,270339360,
270623552,270907616,271191616,271475488,271759296,272042976,272326560,272610048,
272893440,273176736,273459936,273743040,274026048,274308928,274591744,274874432,
275157024,275439520,275721920,276004224,276286432,276568512,276850528,277132416,
277414240,277695936,277977536,278259040,278540448,278821728,279102944,279384032,
279665056,279945952,280226752,280507456,280788064,281068544,281348960,281629248,
281909472,282189568,282469568,282749440,283029248,283308960,283588544,283868032,
284147424,284426720,284705920,284985024,285264000,285542912,285821696,286100384,
286378976,286657440,286935840,287214112,287492320,287770400,288048384,288326240,
288604032,288881696,289159264,289436768,289714112,289991392,290268576,290545632,
290822592,291099456,291376224,291652896,291929440,292205888,292482272,292758528,
293034656,293310720,293586656,293862496,294138240,294413888,294689440,294964864,
295240192,295515424,295790560,296065600,296340512,296615360,296890080,297164704,
297439200,297713632,297987936,298262144,298536256,298810240,299084160,299357952,
299631648,299905248,300178720,300452128,300725408,300998592,301271680,301544640,
301817536,302090304,302362976,302635520,302908000,303180352,303452608,303724768,
303996800,304268768,304540608,304812320,305083968,305355520,305626944,305898272,
306169472,306440608,306711616,306982528,307253344,307524064,307794656,308065152,
308335552,308605856,308876032,309146112,309416096,309685984,309955744,310225408,
310494976,310764448,311033824,311303072,311572224,311841280,312110208,312379040,
312647776,312916416,313184960,313453376,313721696,313989920,314258016,314526016,
314793920,315061728,315329408,315597024,315864512,316131872,316399168,316666336,
316933408,317200384,317467232,317733984,318000640,318267200,318533632,318799968,
319066208,319332352,319598368,319864288,320130112,320395808,320661408,320926912,
321192320,321457632,321722816,321987904,322252864,322517760,322782528,323047200,
323311744,323576192,323840544,324104800,324368928,324632992,324896928,325160736,
325424448,325688096,325951584,326215008,326478304,326741504,327004608,327267584,
327530464,327793248,328055904,328318496,328580960,328843296,329105568,329367712,
329629760,329891680,330153536,330415264,330676864,330938400,331199808,331461120,
331722304,331983392,332244384,332505280,332766048,333026752,333287296,333547776,
333808128,334068384,334328544,334588576,334848512,335108352,335368064,335627712,
335887200,336146624,336405920,336665120,336924224,337183200,337442112,337700864,
337959552,338218112,338476576,338734944,338993184,339251328,339509376,339767296,
340025120,340282848,340540480,340797984,341055392,341312704,341569888,341826976,
342083968,342340832,342597600,342854272,343110848,343367296,343623648,343879904,
344136032,344392064,344648000,344903808,345159520,345415136,345670656,345926048,
346181344,346436512,346691616,346946592,347201440,347456224,347710880,347965440,
348219872,348474208,348728448,348982592,349236608,349490528,349744320,349998048,
350251648,350505152,350758528,351011808,351264992,351518048,351771040,352023872,
352276640,352529280,352781824,353034272,353286592,353538816,353790944,354042944,
354294880,354546656,354798368,355049952,355301440,355552800,355804096,356055264,
356306304,356557280,356808128,357058848,357309504,357560032,357810464,358060768,
358311008,358561088,358811104,359060992,359310784,359560480,359810048,360059520,
360308896,360558144,360807296,361056352,361305312,361554144,361802880,362051488,
362300032,362548448,362796736,363044960,363293056,363541024,363788928,364036704,
364284384,364531936,364779392,365026752,365274016,365521152,365768192,366015136,
366261952,366508672,366755296,367001792,367248192,367494496,367740704,367986784,
368232768,368478656,368724416,368970080,369215648,369461088,369706432,369951680,
370196800,370441824,370686752,370931584,371176288,371420896,371665408,371909792,
372154080,372398272,372642336,372886304,373130176,373373952,373617600,373861152,
374104608,374347936,374591168,374834304,375077312,375320224,375563040,375805760,
376048352,376290848,376533248,376775520,377017696,377259776,377501728,377743584,
377985344,378227008,378468544,378709984,378951328,379192544,379433664,379674688,
379915584,380156416,380397088,380637696,380878176,381118560,381358848,381599040,
381839104,382079072,382318912,382558656,382798304,383037856,383277280,383516640,
383755840,383994976,384233984,384472896,384711712,384950400,385188992,385427488,
385665888,385904160,386142336,386380384,386618368,386856224,387093984,387331616,
387569152,387806592,388043936,388281152,388518272,388755296,388992224,389229024,
389465728,389702336,389938816,390175200,390411488,390647680,390883744,391119712,
391355584,391591328,391826976,392062528,392297984,392533312,392768544,393003680,
393238720,393473632,393708448,393943168,394177760,394412256,394646656,394880960,
395115136,395349216,395583200,395817088,396050848,396284512,396518080,396751520,
396984864,397218112,397451264,397684288,397917248,398150080,398382784,398615424,
398847936,399080320,399312640,399544832,399776928,400008928,400240832,400472608,
400704288,400935872,401167328,401398720,401629984,401861120,402092192,402323136,
402553984,402784736,403015360,403245888,403476320,403706656,403936896,404167008,
404397024,404626944,404856736,405086432,405316032,405545536,405774912,406004224,
406233408,406462464,406691456,406920320,407149088,407377760,407606336,407834784,
408063136,408291392,408519520,408747584,408975520,409203360,409431072,409658720,
409886240,410113664,410340992,410568192,410795296,411022304,411249216,411476032,
411702720,411929312,412155808,412382176,412608480,412834656,413060736,413286720,
413512576,413738336,413964000,414189568,414415040,414640384,414865632,415090784,
415315840,415540800,415765632,415990368,416215008,416439552,416663968,416888288,
417112512,417336640,417560672,417784576,418008384,418232096,418455712,418679200,
418902624,419125920,419349120,419572192,419795200,420018080,420240864,420463552,
420686144,420908608,421130976,421353280,421575424,421797504,422019488,422241344,
422463104,422684768,422906336,423127776,423349120,423570400,423791520,424012576,
424233536,424454368,424675104,424895744,425116288,425336736,425557056,425777280,
425997408,426217440,426437376,426657184,426876928,427096544,427316064,427535488,
427754784,427974016,428193120,428412128,428631040,428849856,429068544,429287168,
429505664,429724064,429942368,430160576,430378656,430596672,430814560,431032352,
431250048,431467616,431685120,431902496,432119808,432336992,432554080,432771040,
432987936,433204736,433421408,433637984,433854464,434070848,434287104,434503296,
434719360,434935360,435151232,435367008,435582656,435798240,436013696,436229088,
436444352,436659520,436874592,437089568,437304416,437519200,437733856,437948416,
438162880,438377248,438591520,438805696,439019744,439233728,439447584,439661344,
439875008,440088576,440302048,440515392,440728672,440941824,441154880,441367872,
441580736,441793472,442006144,442218720,442431168,442643552,442855808,443067968,
443280032,443492000,443703872,443915648,444127296,444338880,444550336,444761696,
444972992,445184160,445395232,445606176,445817056,446027840,446238496,446449088,
446659552,446869920,447080192,447290400,447500448,447710432,447920320,448130112,
448339776,448549376,448758848,448968224,449177536,449386720,449595808,449804800,
450013664,450222464,450431168,450639776,450848256,451056640,451264960,451473152,
451681248,451889248,452097152,452304960,452512672,452720288,452927808,453135232,
453342528,453549760,453756864,453963904,454170816,454377632,454584384,454791008,
454997536,455203968,455410304,455616544,455822688,456028704,456234656,456440512,
456646240,456851904,457057472,457262912,457468256,457673536,457878688,458083744,
458288736,458493600,458698368,458903040,459107616,459312096,459516480,459720768,
459924960,460129056,460333056,460536960,460740736,460944448,461148064,461351584,
461554976,461758304,461961536,462164640,462367680,462570592,462773440,462976160,
463178816,463381344,463583776,463786144,463988384,464190560,464392608,464594560,
464796448,464998208,465199872,465401472,465602944,465804320,466005600,466206816,
466407904,466608896,466809824,467010624,467211328,467411936,467612480,467812896,
468013216,468213440,468413600,468613632,468813568,469013440,469213184,469412832,
469612416,469811872,470011232,470210528,470409696,470608800,470807776,471006688,
471205472,471404192,471602784,471801312,471999712,472198048,472396288,472594400,
472792448,472990400,473188256,473385984,473583648,473781216,473978688,474176064,
474373344,474570528,474767616,474964608,475161504,475358336,475555040,475751648,
475948192,476144608,476340928,476537184,476733312,476929376,477125344,477321184,
477516960,477712640,477908224,478103712,478299104,478494400,478689600,478884704,
479079744,479274656,479469504,479664224,479858880,480053408,480247872,480442240,
480636512,480830656,481024736,481218752,481412640,481606432,481800128,481993760,
482187264,482380704,482574016,482767264,482960416,483153472,483346432,483539296,
483732064,483924768,484117344,484309856,484502240,484694560,484886784,485078912,
485270944,485462880,485654720,485846464,486038144,486229696,486421184,486612576,
486803840,486995040,487186176,487377184,487568096,487758912,487949664,488140320,
488330880,488521312,488711712,488901984,489092160,489282240,489472256,489662176,
489851968,490041696,490231328,490420896,490610336,490799712,490988960,491178144,
491367232,491556224,491745120,491933920,492122656,492311264,492499808,492688256,
492876608,493064864,493253056,493441120,493629120,493817024,494004832,494192544,
494380160,494567712,494755136,494942496,495129760,495316928,495504000,495691008,
495877888,496064704,496251424,496438048,496624608,496811040,496997408,497183680,
497369856,497555936,497741920,497927840,498113632,498299360,498484992,498670560,
498856000,499041376,499226656,499411840,499596928,499781920,499966848,500151680,
500336416,500521056,500705600,500890080,501074464,501258752,501442944,501627040,
501811072,501995008,502178848,502362592,502546240,502729824,502913312,503096704,
503280000,503463232,503646368,503829408,504012352,504195200,504377984,504560672,
504743264,504925760,505108192,505290496,505472736,505654912,505836960,506018944,
506200832,506382624,506564320,506745952,506927488,507108928,507290272,507471552,
507652736,507833824,508014816,508195744,508376576,508557312,508737952,508918528,
509099008,509279392,509459680,509639904,509820032,510000064,510180000,510359872,
510539648,510719328,510898944,511078432,511257856,511437216,511616448,511795616,
511974688,512153664,512332576,512511392,512690112,512868768,513047296,513225792,
513404160,513582432,513760640,513938784,514116800,514294752,514472608,514650368,
514828064,515005664,515183168,515360608,515537952,515715200,515892352,516069440,
516246432,516423328,516600160,516776896,516953536,517130112,517306592,517482976,
517659264,517835488,518011616,518187680,518363648,518539520,518715296,518891008,
519066624,519242144,519417600,519592960,519768256,519943424,520118528,520293568,
520468480,520643328,520818112,520992800,521167392,521341888,521516320,521690656,
521864896,522039072,522213152,522387168,522561056,522734912,522908640,523082304,
523255872,523429376,523602784,523776096,523949312,524122464,524295552,524468512,
524641440,524814240,524986976,525159616,525332192,525504640,525677056,525849344,
526021568,526193728,526365792,526537760,526709632,526881440,527053152,527224800,
527396352,527567840,527739200,527910528,528081728,528252864,528423936,528594880,
528765760,528936576,529107296,529277920,529448480,529618944,529789344,529959648,
530129856,530300000,530470048,530640000,530809888,530979712,531149440,531319072,
531488608,531658080,531827488,531996800,532166016,532335168,532504224,532673184,
532842080,533010912,533179616,533348288,533516832,533685312,533853728,534022048,
534190272,534358432,534526496,534694496,534862400,535030240,535197984,535365632,
535533216,535700704,535868128,536035456,536202720,536369888,536536992,536704000,
536870912
};
#define VIEW_3D_H 200
fixed_t yslope[VIEW_3D_H] = //8007378C
{
83886, 84733, 85598, 86480, 87381,
88301, 89240, 90200, 91180, 92182,
93206, 94254, 95325, 96420, 97541,
98689, 99864, 101067, 102300, 103563,
104857, 106184, 107546, 108942, 110376,
111848, 113359, 114912, 116508, 118149,
119837, 121574, 123361, 125203, 127100,
129055, 131072, 133152, 135300, 137518,
139810, 142179, 144631, 147168, 149796,
152520, 155344, 158275, 161319, 164482,
167772, 171196, 174762, 178481, 182361,
186413, 190650, 195083, 199728, 204600,
209715, 215092, 220752, 226719, 233016,
239674, 246723, 254200, 262144, 270600,
279620, 289262, 299593, 310689, 322638,
335544, 349525, 364722, 381300, 399457,
419430, 441505, 466033, 493447, 524288,
559240, 599186, 645277, 699050, 762600,
838860, 932067, 1048576, 1198372, 1398101,
1677721, 2097152, 2796202, 4194304, 8388608,
0,
-8388608, -4194304, -2796202, -2097152, -1677721,
-1398101, -1198372, -1048576, -932067, -838860,
-762600, -699050, -645277, -599186, -559240,
-524288, -493447, -466033, -441505, -419430,
-399457, -381300, -364722, -349525, -335544,
-322638, -310689, -299593, -289262, -279620,
-270600, -262144, -254200, -246723, -239674,
-233016, -226719, -220752, -215092, -209715,
-204600, -199728, -195083, -190650, -186413,
-182361, -178481, -174762, -171196, -167772,
-164482, -161319, -158275, -155344, -152520,
-149796, -147168, -144631, -142179, -139810,
-137518, -135300, -133152, -131072, -129055,
-127100, -125203, -123361, -121574, -119837,
-118149, -116508, -114912, -113359, -111848,
-110376, -108942, -107546, -106184, -104857,
-103563, -102300, -101067, -99864, -98689,
-97541, -96420, -95325, -94254, -93206,
-92182, -91180, -90200, -89240, -88301,
-87381, -86480, -85598, -84733
};
================================================
FILE: PSXDOOM/vsprintf.c
================================================
//inline
int mystrlen(char *string)//80030F58
{
int rc = 0;
if (string) while (*(string++)) rc++;
else rc = -1;
return rc;
}
int D_vsprintf(char *string, const char *format, int *argptr)//80030F98
{
int len, i, div, uselong;
int fieldsize;
unsigned long num;
long snum;
char padchar;
char *str;
char *origstring = string;
while (*format)
{
if (*format != '%') *(string++) = *(format++);
else
{
format++;
/* set field pad character to 0 if necessary */
if (*format == '0')
{
padchar = '0';
format++;
}
else padchar = ' ';
/* get the fieldwidth if any */
fieldsize = 0;
while (*format >= '0' && *format <= '9')
fieldsize = fieldsize * 10 + *(format++) - '0';
/* get rid of 'l' if present */
if (*format == 'l')
{
uselong = 1;
format++;
} else uselong = 0;
div = 10;
if (*format == 'c')
{
*(string++) = *argptr++;
format++;
}
else if (*format == 's')
{
str = (char *)*argptr++;
len = mystrlen(str);
while (fieldsize-- > len) *(string++) = padchar; /* do field pad */
while (*str) *(string++) = *(str++); /* copy string */
format++;
}
else
{
if (*format == 'o') /* octal */
{
div = 8;
if (uselong)
num = *argptr++;
else
num = *argptr++;
/* printf("o=0%o\n", num); */
}
else if (*format == 'x' || *format == 'X') /* hex */
{
div = 16;
if (uselong)
num = *argptr++;
else
num = *argptr++;
/* printf("x=%x\n", num); */
}
else if (*format == 'i' || *format == 'd' || *format == 'u') /* decimal */
{
div = 10;
if (uselong)
snum = *argptr++;
else
snum = *argptr++;
if (snum < 0 && *format != 'u') /* handle negative %i or %d */
{
*(string++) = '-';
num = -snum;
if (fieldsize) fieldsize--;
} else num = snum;
}
else return -1; /* unrecognized format specifier */
/* print any decimal or hex integer */
len = 0;
while (num || fieldsize || !len)
{
for (i=len ; i ; i--) string[i] = string[i-1]; /* shift right */
if (len && fieldsize && !num) *string = padchar; /* pad out */
else
{
/* put in a hex or decimal digit */
*string = num % div;
*string += *string > 9 ? 'A'-10 : '0';
/* printf("d = %c\n", *string); */
num /= div;
}
len++;
if (fieldsize) fieldsize--;
}
string += len;
format++;
}
}
}
*string = 0;
return origstring - string;
}
================================================
FILE: PSXDOOM/w_wad.c
================================================
/* W_wad.c */
#include "doomdef.h"
#include "r_local.h"
/*=============== */
/* TYPES */
/*=============== */
typedef struct
{
char identification[4]; /* should be IWAD */
int numlumps;
int infotableofs;
} wadinfo_t;
int wadfilenum; //80078078
/*============= */
/* GLOBALS */
/*============= */
lumpinfo_t *lumpinfo; //80077FEC /* points directly to rom image */
int numlumps; //80078014
lumpcache_t *lumpcache; //80078060
byte *lumpencode; //80078114 psxdoom
boolean disableload = false; //80077A14 psxdoom
byte *mapfileptr; //80077D44 psxdoom
int mapnumlumps; //80077F44 psxdoom
lumpinfo_t *maplump; //80077EF0 psxdoom
#define WINDOW_SIZE 4096
#define LOOKAHEAD_SIZE 16
#define LENSHIFT 4 /* this must be log2(LOOKAHEAD_SIZE) */
unsigned char *decomp_input;
unsigned char *decomp_output;
extern int decomp_start;
/*
============================================================================
LUMP BASED ROUTINES
============================================================================
*/
/*
====================
=
= W_Init
=
====================
*/
void W_Init (void)//L80031264()
{
byte *wadfileptr;
int infotableofs, i;
ClearFiles();
wadfilenum = OpenFile((char*)_PSXDOOM_WAD);
ReadFile(wadfilenum, wadfileptr, sizeof(wadinfo_t));
if (D_strncasecmp(((wadinfo_t*)wadfileptr)->identification, "IWAD", 4))
I_Error("W_Init: invalid main IWAD id");
numlumps = BIGLONG(((wadinfo_t*)wadfileptr)->numlumps);
lumpinfo = (lumpinfo_t *) Z_Malloc(numlumps * sizeof(lumpinfo_t), PU_STATIC, 0);
infotableofs = BIGLONG(((wadinfo_t*)wadfileptr)->infotableofs);
SeekFile(wadfilenum, infotableofs, PSXCD_SEEK_SET);
ReadFile(wadfilenum, lumpinfo, numlumps * sizeof(lumpinfo_t));
lumpcache = (lumpcache_t *) Z_Malloc(numlumps * sizeof(lumpcache_t), PU_STATIC, 0);
lumpencode = (byte *) Z_Malloc(numlumps, PU_STATIC, 0);
D_memset(lumpcache, NULL, numlumps * sizeof(lumpcache_t));
D_memset(lumpencode, 0, numlumps);
}
/*
====================
=
= W_CheckNumForName
=
= Returns -1 if name not found
=
====================
*/
int W_CheckNumForName (char *name)//L80031374()
{
char name8[12];
int v1,v2;
lumpinfo_t *lump_p;
/* make the name into two integers for easy compares */
D_memset (name8,0,sizeof(name8));
D_strncpy (name8,name,8);
name8[8] = 0; /* in case the name was a full 8 chars */
D_strupr(name8); /* case insensitive */
v1 = *(int *)name8;
v2 = *(int *)&name8[4];
/* scan backwards so patch lump files take precedence */
lump_p = lumpinfo + numlumps;
/* used for stripping out the hi bit of the first character of the */
/* name of the lump */
#define HIBIT (1<<7)
while (lump_p-- != lumpinfo)
if (*(int *)&lump_p->name[4] == v2
&& (*(int *)lump_p->name & ~HIBIT) == v1)
return lump_p - lumpinfo;
return -1;
}
/*
====================
=
= W_GetNumForName
=
= Calls W_CheckNumForName, but bombs out if not found
=
====================
*/
int W_GetNumForName (char *name)//L80031428()
{
int i;
i = W_CheckNumForName (name);
if (i != -1)
return i;
I_Error ("W_GetNumForName: %s not found!",name);
return -1;
}
/*
====================
=
= W_LumpLength
=
= Returns the buffer size needed to load the given lump
=
====================
*/
int W_LumpLength (int lump)//L80031518()
{
if (lump >= numlumps)
I_Error ("W_LumpLength: %i >= numlumps",lump);
return BIGLONG(lumpinfo[lump].size);
}
/*
====================
=
= W_ReadLump
=
= Loads the lump into the given buffer, which must be >= W_LumpLength()
=
====================
*/
//inline
void W_ReadLump (int lump, void *dest, boolean decodelump)//L80031568()
{
/*byte *input;
lumpinfo_t *l;
int lumpsize;
if (lump >= numlumps)
I_Error ("W_ReadLump: %i >= numlumps",lump);
l = lumpinfo + lump;
if(decodelump)
{
if ((l->name[0] & 0x80))
{
input = Z_Alloc(BIGLONG(l->size), PU_STATIC, 0);
lumpsize = BIGLONG(lumpinfo[lump + 1].filepos) - BIGLONG(l->filepos);
SeekFile(wadfilenum, BIGLONG(l->filepos), PSXCD_SEEK_SET);
ReadFile(wadfilenum, input, lumpsize);
decode((unsigned char *)input, (unsigned char *)dest);
Z_Free(input);
return;
}
}
lumpsize = BIGLONG(lumpinfo[lump + 1].filepos) - BIGLONG(l->filepos);
SeekFile(wadfilenum, BIGLONG(l->filepos), PSXCD_SEEK_SET);
ReadFile(wadfilenum, dest, lumpsize);*/
lumpinfo_t *l;
byte *input;
int lumpsize;
if (numlumps <= lump)
I_Error("W_ReadLump: %i >= numlumps", lump);
l = &lumpinfo[lump];
if ((decodelump == 0) ||/*&&*/ ((l->name[0] & 0x80) == 0))
{
lumpsize = BIGLONG(lumpinfo[lump + 1].filepos) - BIGLONG(l->filepos);
//printf("no comp SeekFile[%d] lumpsize[%d]", BIGLONG(l->filepos),lumpsize);
SeekFile(wadfilenum, BIGLONG(l->filepos), PSXCD_SEEK_SET);
ReadFile(wadfilenum, dest, lumpsize);
}
else /* compressed */
{
input = Z_Alloc(BIGLONG(l->size), PU_STATIC, 0);
lumpsize = BIGLONG(lumpinfo[lump + 1].filepos) - BIGLONG(l->filepos);
//printf("comp SeekFile[%d] lumpsize[%d]", BIGLONG(l->filepos),lumpsize);
SeekFile(wadfilenum, BIGLONG(l->filepos), PSXCD_SEEK_SET);
ReadFile(wadfilenum, input, lumpsize);
decode((unsigned char *)input, (unsigned char *)dest);
Z_Free2(mainzone, input);
}
}
/*
====================
=
= W_CacheLumpNum
=
====================
*/
void *W_CacheLumpNum (int lump, int tag, boolean decodelump)//L8003167C()
{
int lumpsize;
lumpcache_t *lc;
if (numlumps <= (unsigned)lump)
I_Error("W_CacheLumpNum: %i >= numlumps", lump);
lc = &lumpcache[lump];
if (!lc->cache)
{ /* read the lump in */
//if (disableload != 0)
//I_Error("cache miss on lump %i", lump);
if (decodelump == 0)
lumpsize = BIGLONG(lumpinfo[lump + 1].filepos) - BIGLONG(lumpinfo[lump].filepos);
else
lumpsize = BIGLONG(lumpinfo[lump].size);
Z_Malloc(lumpsize, tag, &lc->cache);
W_ReadLump(lump, lc->cache, decodelump);
if ((lumpinfo[lump].name[0] & 0x80) == 0)
lumpencode[lump] = 1;
else
lumpencode[lump] = (byte)decodelump;
}
return lc->cache;
}
/*
====================
=
= W_CacheLumpName
=
====================
*/
void *W_CacheLumpName (char *name, int tag, boolean decodelump)//L800318B4()
{
return W_CacheLumpNum (W_GetNumForName(name), tag, decodelump);
}
/*
============================================================================
MAP LUMP BASED ROUTINES
============================================================================
*/
/*
====================
=
= W_OpenMapWad
=
= Exclusive Psx Doom
====================
*/
byte *W_OpenMapWad(char *mapname)//L800319D4()
{
int mapfile, mapsize, infotableofs;
mapfile = OpenFile(mapname);
mapsize = SeekFile(mapfile, 0, PSXCD_SEEK_END);
mapfileptr = Z_Alloc(mapsize, PU_STATIC, 0);
SeekFile(mapfile, 0, PSXCD_SEEK_SET);
ReadFile(mapfile, mapfileptr, mapsize);
CloseFile(mapfile);
if (D_strncasecmp(((wadinfo_t*)mapfileptr)->identification, "IWAD", 4))
I_Error("W_OpenMapWad: invalid map IWAD id");
mapnumlumps = BIGLONG(((wadinfo_t*)mapfileptr)->numlumps);
infotableofs = BIGLONG(((wadinfo_t*)mapfileptr)->infotableofs);
maplump = (lumpinfo_t*)(mapfileptr + infotableofs);
return mapfileptr;
}
/*
====================
=
= W_MapLumpLength
=
= Exclusive Psx Doom
====================
*/
int W_MapLumpLength(int lump)//L80031AA4()
{
if (lump >= mapnumlumps)
I_Error("W_MapLumpLength: %i out of range", lump);
return maplump[lump].size;
}
/*
====================
=
= W_MapGetNumForName
=
= Exclusive Psx Doom
====================
*/
int W_MapGetNumForName(char *name)//L80031AF4()
{
char name8[16];
int v1, v2;
lumpinfo_t *lump_p;
/* make the name into two integers for easy compares */
D_memset(name8, 0, sizeof(name8));
D_strncpy(name8, name, 8);
name8[8] = 0; /* in case the name was a full 8 chars */
D_strupr(name8); /* case insensitive */
v1 = *(int *)name8;
v2 = *(int *)&name8[4];
/* scan backwards so patch lump files take precedence */
lump_p = &maplump[mapnumlumps];
/* used for stripping out the hi bit of the first character of the */
/* name of the lump */
#define HIBIT (1<<7)
while (lump_p-- != maplump)
if (*(int *)&lump_p->name[4] == v2
&& (*(int *)lump_p->name & ~HIBIT) == v1)
return lump_p - maplump;
return -1;
}
/*
====================
=
= W_ReadMapLump
=
= Exclusive Psx Doom
====================
*/
void W_ReadMapLump(int lump, void *dest, int decodelump)//L80031BB0()
{
lumpinfo_t *l;
int lumpsize;
if (lump >= mapnumlumps)
I_Error("W_ReadMapLump: lump %d out of range", mapnumlumps);
l = &maplump[lump];
if (decodelump)
{
if (l->name[0] & 0x80) // compressed
{
decode((unsigned char *)(mapfileptr + BIGLONG(l->filepos)), (unsigned char *)dest);
return;
}
}
lumpsize = BIGLONG((l + 1)->filepos) - BIGLONG(l->filepos);
D_memcpy(dest, mapfileptr + BIGLONG(l->filepos), lumpsize);
}
/*
============================================================================
DECODE BASED ROUTINES
============================================================================
*/
/*
== == == == == == == == == ==
=
= decode
=
= Exclusive Psx Doom from Jaguar Doom
== == == == == == == == == ==
*/
void decode(unsigned char *input, unsigned char *output)//L80031C60()
{
int getidbyte = 0;
int len;
int pos;
int i;
unsigned char *source;
int idbyte = 0;
while (1)
{
/* get a new idbyte if necessary */
if (!getidbyte) idbyte = *input++;
getidbyte = (getidbyte + 1) & 7;
if (idbyte & 1)
{
/* decompress */
pos = *input++ << LENSHIFT;
pos = pos | (*input >> LENSHIFT);
source = output - pos - 1;
len = (*input++ & 0xf) + 1;
if (len == 1) break;
for (i = 0; i> 1;
}
}
/*
== == == == == == == == == ==
=
= decodedsize
=
= Exclusive Psx Doom
== == == == == == == == == ==
*/
int decodedsize(unsigned char *input)//L80031D18()
{
int getidbyte = 0;
int len;
byte idbyte;
int accum = 0;
while (1)
{
/* get a new idbyte if necessary */
if (!getidbyte) idbyte = *input++;
getidbyte = (getidbyte + 1) & 7;
if (idbyte & 1)
{
/* decompress */
input++;
len = (*input++ & 0xf) + 1;
if (len == 1) break;
accum += len;
}
else
{
accum++;
input++;
}
idbyte = idbyte >> 1;
}
return accum;
}
================================================
FILE: PSXDOOM/z_zone.c
================================================
/* Z_zone.c */
#include "doomdef.h"
/*
==============================================================================
ZONE MEMORY ALLOCATION
There is never any space between memblocks, and there will never be two
contiguous free memblocks.
The rover can be left pointing at a non-empty block
It is of no value to free a cachable block, because it will get overwritten
automatically if needed
==============================================================================
*/
#define DEBUG 0
memzone_t *mainzone;
/*
========================
=
= Z_Init
=
========================
*/
extern unsigned int _bbsstart; // bss start free memory ram
extern unsigned long _ramsize; // megabytes of RAM
extern unsigned long _stacksize; // kilobytes of stack
unsigned int _bbsstart2 = 0x800A9CA8;//tmp addres
void Z_Init (void)//L80032014()
{
byte *mem;
int size;
mem = (byte *)((_bbsstart2 + 3) & ~3);
size = (((_ramsize - _stacksize) - (((_bbsstart2 + 3) & ~3) & 0x1FFFFFFF)) + 3) & ~3;
//printf("Mem __bss %X\n", _bbsstart);
//printf("Mem size %d\n", size);
/* mars doesn't have a refzone */
mainzone = Z_InitZone (mem, size);
}
/*
========================
=
= Z_InitZone
=
========================
*/
memzone_t *Z_InitZone(byte *base, int size)//L8003206C()
{
memzone_t *zone;
zone = (memzone_t *)base;
zone->size = size;
zone->rover = &zone->blocklist;
zone->blocklist.size = size - (int)((byte *)&zone->blocklist - (byte *)zone);
zone->blocklist.user = NULL;
zone->blocklist.tag = 0;
zone->blocklist.id = ZONEID;
zone->blocklist.next = NULL;
zone->blocklist.prev = NULL;
//zone->blocklist.lockframe = -1;
return zone;
}
/*
========================
=
= Z_Malloc2
=
= You can pass a NULL user if the tag is < PU_PURGELEVEL
========================
*/
#define MINFRAGMENT 64
void *Z_Malloc2 (memzone_t *mainzone, int size, int tag, void *user)//L800320A0()
{
int extra;
memblock_t *start, *rover, *newblock, *base;
#if DEBUG
Z_CheckHeap (mainzone); /* DEBUG */
#endif
/* */
/* scan through the block list looking for the first free block */
/* of sufficient size, throwing out any purgable blocks along the way */
/* */
size += sizeof(memblock_t); /* account for size of block header */
size = (size+3) & ~3; /* phrase align everything */
start = base = mainzone->rover;
while (base->user || base->size < size)
{
if (base->user)
rover = base;
else
rover = base->next;
if (!rover)
goto backtostart;
if (rover->user)
{
if (rover->tag < PU_PURGELEVEL)
{
/* hit an in use block, so move base past it */
base = rover->next;
if (!base)
{
backtostart:
base = &mainzone->blocklist;
}
if (base == start) /* scaned all the way around the list */
{
Z_DumpHeap(mainzone);
I_Error("Z_Malloc: failed allocation on %i", size);
}
continue;
}
/* */
/* free the rover block (adding the size to base) */
/* */
Z_Free((byte *)rover + sizeof(memblock_t)); /* mark as free */
}
if (base != rover)
{ /* merge with base */
base->size += rover->size;
base->next = rover->next;
if (rover->next)
rover->next->prev = base;
}
}
/* */
/* found a block big enough */
/* */
extra = base->size - size;
if (extra > MINFRAGMENT)
{ /* there will be a free fragment after the allocated block */
newblock = (memblock_t *) ((byte *)base + size );
newblock->prev = base;
newblock->next = base->next;
if (newblock->next)
newblock->next->prev = newblock;
base->next = newblock;
base->size = size;
newblock->size = extra;
newblock->user = NULL; /* free block */
newblock->tag = 0;
//printf("size %d\n",size);
}
if (user)
{
base->user = user; /* mark as an in use block */
*(void **)user = (void *)((byte *)base + sizeof(memblock_t));
//printf("base->user_M %d\n",base->user);
}
else
{
if (tag >= PU_PURGELEVEL)
I_Error ("Z_Malloc: an owner is required for purgable blocks");
base->user = (void *)1; /* mark as in use, but unowned */
}
base->tag = tag;
base->id = ZONEID;
mainzone->rover = base->next; /* next allocation will start looking here */
if (!mainzone->rover)
mainzone->rover = &mainzone->blocklist;
#if DEBUG
Z_CheckHeap (mainzone); /* DEBUG */
#endif
return (void *) ((byte *)base + sizeof(memblock_t));
}
/*
========================
=
= Z_Alloc2
=
= You can pass a NULL user if the tag is < PU_PURGELEVEL
= Exclusive Psx Doom
========================
*/
void *Z_Alloc2(memzone_t *mainzone, int size, int tag, void *user)//L80032298()
{
int extra;
memblock_t *rover, *newblock, *base, *block;
/* */
/* scan through the block list looking for the first free block */
/* of sufficient size, throwing out any purgable blocks along the way */
/* */
#if DEBUG
Z_CheckHeap (mainzone); /* DEBUG */
#endif
base = &mainzone->blocklist;
while (base->next)
{
base = base->next;
}
/*
for (block = mainzone->blocklist.next; block; block = base->next)
{
base = base->next;
}*/
size += sizeof(memblock_t); /* account for size of block header */
size = (size + 3)&~3; /* phrase align everything */
while (base->user || base->size < size)
{
if (base->user)
rover = base;
else
{
/* hit an in use block, so move base past it */
rover = base->prev;
if (!rover)
I_Error("Z_Alloc: failed allocation on %i", size);//FIXME Change Z_Malloc To Z_Alloc
}
if (rover->user)
{
if (rover->tag < PU_PURGELEVEL)
{
/* hit an in use block, so move base past it */
base = rover->prev;
if (!base)
I_Error("Z_Alloc: failed allocation on %i", size);//FIXME Change Z_Malloc To Z_Alloc
continue;
}
/* */
/* free the rover block (adding the size to base) */
/* */
Z_Free((byte *)rover + sizeof(memblock_t)); /* mark as free */
}
if (base != rover)
{ /* merge with base */
rover->size += base->size;
rover->next = base->next;
if (base->next)
base->next->prev = rover;
base = rover;
}
}
/* */
/* found a block big enough */
/* */
extra = base->size - size;
newblock = base;
if (extra > MINFRAGMENT)
{ /* there will be a free fragment after the allocated block */
base = (memblock_t *)((byte *)base + extra);
base->size = size;
base->prev = newblock;
base->next = newblock->next;
if (newblock->next)
newblock->next->prev = base;
newblock->next = base;
newblock->size = extra;
newblock->user = NULL; // free block
newblock->tag = 0;
}
if (user)
{
base->user = user; /* mark as an in use block */
*(void **)user = (void *)((byte *)base + sizeof(memblock_t));
}
else
{
if (tag >= PU_PURGELEVEL)
I_Error("Z_Alloc: an owner is required for purgable blocks");//FIXME Change Z_Malloc To Z_Alloc
base->user = (void *)1; /* mark as in use, but unowned */
}
base->id = ZONEID;
base->tag = tag;
mainzone->rover = &mainzone->blocklist;
#if DEBUG
Z_CheckHeap (mainzone); /* DEBUG */
#endif
return (void *)((byte *)base + sizeof(memblock_t));
}
/*
========================
=
= Z_Free2
=
========================
*/
inline void Z_Free2(memzone_t *mainzone, void *ptr)//L800324A8()
{
memblock_t *block;
block = (memblock_t *)((byte *)ptr - sizeof(memblock_t));
if (block->id != ZONEID)
I_Error("Z_Free: freed a pointer without ZONEID");
if (block->user > (void **)0x100) /* smaller values are not pointers */
*block->user = 0; /* clear the user's mark */
block->user = NULL; /* mark as free */
block->tag = 0;
block->id = 0;
}
/*
========================
=
= Z_FreeTags
=
========================
*/
void Z_FreeTags (memzone_t *mainzone, int tag)//L80032510()
{
memblock_t *block, *next;
for (block = &mainzone->blocklist ; block ; block = next)
{
next = block->next; /* get link before freeing */
if (!block->user)
continue; /* free block */
if (block->tag & tag)
{
Z_Free2(mainzone, (byte *)block + sizeof(memblock_t));
}
}
for (block = &mainzone->blocklist; block; block = next)
{
next = block->next; // get link before freeing
if (!block->user && next && !next->user)
{
block->size += next->size;
block->next = next->next;
if (next->next) // <- Final Doom, Doom GH, Eup Jap
next->next->prev = block;
next = block;
}
}
mainzone->rover = &mainzone->blocklist;
}
/*
========================
=
= Z_CheckHeap
=
========================
*/
void Z_CheckHeap (memzone_t *mainzone)//L80032640()
{
memblock_t *checkblock;
for (checkblock = &mainzone->blocklist ; checkblock; checkblock = checkblock->next)
{
if (!checkblock->next)
{
if ((byte *)checkblock + checkblock->size - (byte *)mainzone != mainzone->size)
I_Error ("Z_CheckHeap: zone size changed\n");
continue;
}
if ( (byte *)checkblock + checkblock->size != (byte *)checkblock->next)
I_Error ("Z_CheckHeap: block size does not touch the next block\n");
if ( checkblock->next->prev != checkblock)
I_Error ("Z_CheckHeap: next block doesn't have proper back link\n");
}
#if DEBUG
Z_DumpHeap(mainzone);
#endif
}
/*
========================
=
= Z_ChangeTag
=
========================
*/
void Z_ChangeTag (void *ptr, int tag)//L80032708()
{
memblock_t *block;
block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
if (block->id != ZONEID)
I_Error ("Z_ChangeTag: freed a pointer without ZONEID");
if (tag >= PU_PURGELEVEL && (int)block->user < 0x100)
I_Error ("Z_ChangeTag: an owner is required for purgable blocks");
block->tag = tag;
}
/*
========================
=
= Z_FreeMemory
=
========================
*/
int Z_FreeMemory (memzone_t *mainzone)//L80032794()
{
memblock_t *block;
int free;
free = 0;
for (block = &mainzone->blocklist ; block ; block = block->next)
{
if (!block->user)
free += block->size;
}
return free;
}
/*
========================
=
= Z_DumpHeap
=
========================
*/
void Z_DumpHeap(memzone_t *mainzone)//L800327D4()
{
#if DEBUG
memblock_t *block;
printf("zone size: %i location: %p\n", mainzone->size, mainzone);
for (block = &mainzone->blocklist; block; block = block->next)
{
printf("block:%p size:%7i user:%p tag:%3i frame:%i\n",
block, block->size, block->user, block->tag, block->lockframe);
if (!block->next)
continue;
if ((byte *)block + block->size != (byte *)block->next)
printf("ERROR: block size does not touch the next block\n");
if (block->next->prev != block)
printf("ERROR: next block doesn't have proper back link\n");
}
#endif
}
================================================
FILE: PSYQ/README.txt
================================================
Replace these files once the PSYQ SDK is installed, copy them to the following address C:\psyq\bin
CPE2X.EXE Originally from Orion http://onorisoft.free.fr/
cpe2x_gec.exe A modified version of Orion
================================================
FILE: README.md
================================================
# PSXDOOM-RE
Welcome to the complete reverse engineering of PSX Doom by [GEC], this effort took about 2 and a half years to complete, now with the departure of **[PsyDoom](https://github.com/BodbDearg/PsyDoom)** the objective is to collaborate with Psx Doom PC BackPort in addition to correcting and sharing information on both projects.
You need to download and install the Psy-Q SDK http://www.psxdev.net/downloads.html
It is necessary to visit this page for installation since it is a very old software, frequently presenting failures in modern Windows
http://www.psxdev.net/help/psyq_install.html
Once you have completed the installation process, go to copy the files in the PSYQ folder and it is necessary for the compilation.
Now everything is complete, copy the PSXDOOM-RE folder to the root "C:" of your hard drive.
You need to copy the PSXDOOM SLUS_000.77 game files, with everything and their folders, the MOVIE.STR file is impossible to copy in Windows, it is the only file that is previously in the ABIN folder.
You run the MAKEFILE.bat to compile and create the main.exe file, it will be automatically copied to the GAME folder.
In the GAME folder, you run the MAKE_CD.bat file, it will create the CD image, and it will also create 2 necessary files that are "PSXCDABS.C and PSXCDABS.H" these are automatically copied to the previous folder, this is essential since if you modify the code or the files of the game these will change your LBA address and the file size, which requires compiling it again to avoid getting loading errors.
Notes:
The project is created with CodeBlocks, although it does not serve to compile, but to have the code in order and verification.
The mkpsxiso.exe program is originally created by lameguy64, but the present version is modified by me, to create the files "PSXCDABS.C and PSXCDABS.H".
https://github.com/Lameguy64/mkpsxiso by lameguy64
Special thanks to my brothers for the help to the community in DoomWorld and Kaiser since he is the only one to see the progress of my work and helps me in several occasions.
News:
* No clip cheat code from PsyDoom.
* VRAM Viewer added from Master Edition PsxDoom.
* FPS Counter that can be deactivate/activate in the code itself.