This commit is contained in:
Christoph Oelckers 2015-11-03 23:55:41 +01:00
commit a5b43dfb66
28 changed files with 535 additions and 281 deletions

View file

@ -373,6 +373,7 @@ enum ActorFlag7
MF7_NODECAL = 0x00040000, // [ZK] Forces puff to have no impact decal
MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's.
MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced.
MF7_ICESHATTER = 0x00200000, // [MC] Shatters ice corpses regardless of damagetype.
};
// --- mobj.renderflags ---

View file

@ -784,7 +784,7 @@ static int PatchThing (int thingy)
bool hadStyle = false;
FStateDefinitions statedef;
bool patchedStates = false;
int oldflags;
ActorFlags oldflags;
const PClass *type;
SWORD *ednum, dummyed;
@ -1139,28 +1139,28 @@ static int PatchThing (int thingy)
}
if (vchanged[1])
{
info->flags2 = ActorFlags2::FromInt (value[1]);
if (info->flags2 & 0x00000004) // old BOUNCE1
if (value[1] & 0x00000004) // old BOUNCE1
{
info->flags2 &= ActorFlags2::FromInt (~4);
value[1] &= ~0x00000004;
info->BounceFlags = BOUNCE_DoomCompat;
}
// Damage types that once were flags but now are not
if (info->flags2 & 0x20000000)
if (value[1] & 0x20000000)
{
info->DamageType = NAME_Ice;
info->flags2 &= ActorFlags2::FromInt (~0x20000000);
value[1] &= ~0x20000000;
}
if (info->flags2 & 0x10000)
if (value[1] & 0x10000000)
{
info->DamageType = NAME_Fire;
info->flags2 &= ActorFlags2::FromInt (~0x10000);
value[1] &= ~0x10000000;
}
if (info->flags2 & 1)
if (value[1] & 0x00000001)
{
info->gravity = FRACUNIT/4;
info->flags2 &= ActorFlags2::FromInt (~1);
value[1] &= ~0x00000001;
}
info->flags2 = ActorFlags2::FromInt (value[1]);
}
if (vchanged[2])
{

View file

@ -1236,7 +1236,7 @@ void FParser::SF_ObjFlag(void)
t_return.type = svt_int;
if (mo && flagnum<26)
{
t_return.value.i = !!(mo->flags & (1 << flagnum));
t_return.value.i = !!(mo->flags & ActorFlags::FromInt(1 << flagnum));
}
else t_return.value.i = 0;
}

View file

@ -75,7 +75,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
{
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y, linetarget->x, linetarget->y);
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
&& (!(linetarget->flags2&(MF2_DORMANT+MF2_INVULNERABLE))))
&& (!(linetarget->flags2&(MF2_DORMANT|MF2_INVULNERABLE))))
{
newLife = player->health+(damage>>3);
newLife = newLife > max ? max : newLife;

View file

@ -15,10 +15,23 @@
#include "gstrings.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
#include "v_text.h"
#define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
static FRandom pr_randomspawn("RandomSpawn");
static bool IsMonster(const FDropItem *di)
{
const PClass *pclass = PClass::FindClass(di->Name);
if (NULL == pclass)
{
return false;
}
return 0 != (GetDefaultByType(pclass)->flags3 & MF3_ISMONSTER);
}
class ARandomSpawner : public AActor
{
DECLARE_CLASS (ARandomSpawner, AActor)
@ -41,7 +54,7 @@ class ARandomSpawner : public AActor
{
if (di->Name != NAME_None)
{
if (!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER))
if (!nomonsters || !IsMonster(di))
{
if (di->amount < 0) di->amount = 1; // default value is -1, we need a positive value.
n += di->amount; // this is how we can weight the list.
@ -62,7 +75,7 @@ class ARandomSpawner : public AActor
while (n > -1 && di != NULL)
{
if (di->Name != NAME_None &&
(!nomonsters || !(GetDefaultByType(PClass::FindClass(di->Name))->flags3 & MF3_ISMONSTER)))
(!nomonsters || !IsMonster(di)))
{
n -= di->amount;
if ((di->Next != NULL) && (n > -1))
@ -106,6 +119,7 @@ class ARandomSpawner : public AActor
}
else
{
Printf(TEXTCOLOR_RED "Unknown item class %s to drop from a random spawner\n", di->Name.GetChars());
Species = NAME_None;
}
}

View file

@ -385,6 +385,11 @@ FListMenuItemStaticPatch::FListMenuItemStaticPatch(int x, int y, FTextureID patc
void FListMenuItemStaticPatch::Drawer(bool selected)
{
if (!mTexture.Exists())
{
return;
}
int x = mXpos;
FTexture *tex = TexMan(mTexture);
if (mYpos >= 0)
@ -486,7 +491,7 @@ bool FListMenuItemSelectable::MouseEvent(int type, int x, int y)
{
if (type == DMenu::MOUSE_Release)
{
if (DMenu::CurrentMenu->MenuEvent(MKEY_Enter, true))
if (NULL != DMenu::CurrentMenu && DMenu::CurrentMenu->MenuEvent(MKEY_Enter, true))
{
return true;
}

View file

@ -95,6 +95,18 @@ static void DeinitMenus()
ClearSaveGames();
}
static FTextureID GetMenuTexture(const char* const name)
{
const FTextureID texture = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch);
if (!texture.Exists())
{
Printf("Missing menu texture: \"%s\"\n", name);
}
return texture;
}
//=============================================================================
//
//
@ -235,7 +247,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
else if (sc.Compare("Selector"))
{
sc.MustGetString();
desc->mSelector = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
desc->mSelector = GetMenuTexture(sc.String);
sc.MustGetStringName(",");
sc.MustGetNumber();
desc->mSelectOfsX = sc.Number;
@ -278,7 +290,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
int y = sc.Number;
sc.MustGetStringName(",");
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(sc.String);
FListMenuItem *it = new FListMenuItemStaticPatch(x, y, tex, centered);
desc->mItems.Push(it);
@ -299,7 +311,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
else if (sc.Compare("PatchItem"))
{
sc.MustGetString();
FTextureID tex = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(sc.String);
sc.MustGetStringName(",");
sc.MustGetString();
int hotkey = sc.String[0];
@ -1045,7 +1057,7 @@ static void BuildEpisodeMenu()
FListMenuItem *it;
if (AllEpisodes[i].mPicName.IsNotEmpty())
{
FTextureID tex = TexMan.CheckForTexture(AllEpisodes[i].mPicName, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
it = new FListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut,
tex, NAME_Skillmenu, i);
}
@ -1442,7 +1454,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
if (skill.PicName.Len() != 0 && pItemText == NULL)
{
FTextureID tex = TexMan.CheckForTexture(skill.PicName, FTexture::TEX_MiscPatch);
FTextureID tex = GetMenuTexture(skill.PicName);
li = new FListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, i);
}
else

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2014 Nuke.YKT
* Copyright (C) 2013-2015 Nuke.YKT(Alexey Khokholov)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -27,53 +27,31 @@
OPL2 ROMs.
*/
//version 1.5
//version 1.6
/* Changelog:
v1.1:
Vibrato's sign fix
Vibrato's sign fix.
v1.2:
Operator key fix
Corrected 4-operator mode
Corrected rhythm mode
Some small fixes
v1.2.1:
Small envelope generator fix
Removed EX_Get function(not used)
v1.3:
Complete rewrite
(Not released)
v1.4:
New envelope and waveform generator
Operator key fix.
Corrected 4-operator mode.
Corrected rhythm mode.
Some small fixes.
v1.2.1:
Small envelope generator fix.
v1.3:
Complete rewrite.
v1.4:
New envelope and waveform generator.
Some small fixes.
(Not released)
v1.4.1:
Envelope generator rate calculation fix
(Not released)
Envelope generator rate calculation fix.
v1.4.2:
Version for ZDoom.
v1.5:
Optimizations
*/
/* Verified:
Noise generator.
Waveform generator.
Envelope generator increase table.
Tremolo.
*/
/* TODO:
Verify:
kslrom[15] value(is it 128?).
Sustain level = 15.
Vibrato, Phase generator.
Rhythm part.
Envelope generator state switching(decay->sustain when egt = 1 and decay->release).
Feedback.
Register write.
4-operator.
Optimizations.
v1.6:
Improved emulation output.
*/
#include <stdlib.h>
@ -216,19 +194,17 @@ envelope_sinfunc envelope_sin[8] = {
};
void envelope_gen_off(opl_slot *slott);
void envelope_gen_change(opl_slot *slott);
void envelope_gen_attack(opl_slot *slott);
void envelope_gen_decay(opl_slot *slott);
void envelope_gen_sustain(opl_slot *slott);
void envelope_gen_release(opl_slot *slott);
envelope_genfunc envelope_gen[6] = {
envelope_genfunc envelope_gen[5] = {
envelope_gen_off,
envelope_gen_attack,
envelope_gen_decay,
envelope_gen_sustain,
envelope_gen_release,
envelope_gen_change
envelope_gen_release
};
enum envelope_gen_num {
@ -252,7 +228,7 @@ Bit8u envelope_calc_rate(opl_slot *slot, Bit8u reg_rate) {
}
void envelope_update_ksl(opl_slot *slot) {
Bit16s ksl = (kslrom[slot->channel->f_num >> 6] << 1) - ((slot->channel->block ^ 0x07) << 5) - 0x20;
Bit16s ksl = (kslrom[slot->channel->f_num >> 6] << 2) - ((0x08 - slot->channel->block) << 5);
if (ksl < 0) {
ksl = 0;
}
@ -281,28 +257,25 @@ void envelope_gen_off(opl_slot *slot) {
slot->eg_rout = 0x1ff;
}
void envelope_gen_change(opl_slot *slot) {
slot->eg_gen = slot->eg_gennext;
envelope_update_rate(slot);
}
void envelope_gen_attack(opl_slot *slot) {
if (slot->eg_rout == 0x00) {
slot->eg_gen = envelope_gen_num_decay;
envelope_update_rate(slot);
return;
}
slot->eg_rout += ((~slot->eg_rout) *slot->eg_inc) >> 3;
if (slot->eg_rout < 0x00) {
slot->eg_rout = 0x00;
}
if (!slot->eg_rout) {
slot->eg_gen = envelope_gen_num_change;
slot->eg_gennext = envelope_gen_num_decay;
}
}
void envelope_gen_decay(opl_slot *slot) {
slot->eg_rout += slot->eg_inc;
if (slot->eg_rout >= slot->reg_sl << 4) {
slot->eg_gen = envelope_gen_num_change;
slot->eg_gennext = envelope_gen_num_sustain;
slot->eg_gen = envelope_gen_num_sustain;
envelope_update_rate(slot);
return;
}
slot->eg_rout += slot->eg_inc;
}
void envelope_gen_sustain(opl_slot *slot) {
@ -312,11 +285,13 @@ void envelope_gen_sustain(opl_slot *slot) {
}
void envelope_gen_release(opl_slot *slot) {
slot->eg_rout += slot->eg_inc;
if (slot->eg_rout >= 0x1ff) {
slot->eg_gen = envelope_gen_num_change;
slot->eg_gennext = envelope_gen_num_off;
slot->eg_gen = envelope_gen_num_off;
slot->eg_rout = 0x1ff;
envelope_update_rate(slot);
return;
}
slot->eg_rout += slot->eg_inc;
}
void envelope_calc(opl_slot *slot) {
@ -324,10 +299,7 @@ void envelope_calc(opl_slot *slot) {
rate_h = slot->eg_rate >> 2;
rate_l = slot->eg_rate & 3;
Bit8u inc = 0;
if (slot->eg_gen == envelope_gen_num_attack && rate_h == 0x0f) {
inc = 8;
}
else if (eg_incsh[rate_h] > 0) {
if (eg_incsh[rate_h] > 0) {
if ((slot->chip->timer & ((1 << eg_incsh[rate_h]) - 1)) == 0) {
inc = eg_incstep[eg_incdesc[rate_h]][rate_l][((slot->chip->timer) >> eg_incsh[rate_h]) & 0x07];
}
@ -336,14 +308,19 @@ void envelope_calc(opl_slot *slot) {
inc = eg_incstep[eg_incdesc[rate_h]][rate_l][slot->chip->timer & 0x07] << (-eg_incsh[rate_h]);
}
slot->eg_inc = inc;
envelope_gen[slot->eg_gen](slot);
slot->eg_out = slot->eg_rout + (slot->reg_tl << 2) + (slot->eg_ksl >> kslshift[slot->reg_ksl]) + *slot->trem;
envelope_gen[slot->eg_gen](slot);
}
void eg_keyon(opl_slot *slot, Bit8u type) {
if (!slot->key) {
slot->eg_gen = envelope_gen_num_change;
slot->eg_gennext = envelope_gen_num_attack;
slot->eg_gen = envelope_gen_num_attack;
envelope_update_rate(slot);
if ((slot->eg_rate >> 2) == 0x0f) {
slot->eg_gen = envelope_gen_num_decay;
envelope_update_rate(slot);
slot->eg_rout = 0x00;
}
slot->pg_phase = 0x00;
}
slot->key |= type;
@ -353,8 +330,8 @@ void eg_keyoff(opl_slot *slot, Bit8u type) {
if (slot->key) {
slot->key &= (~type);
if (!slot->key) {
slot->eg_gen = envelope_gen_num_change;
slot->eg_gennext = envelope_gen_num_release;
slot->eg_gen = envelope_gen_num_release;
envelope_update_rate(slot);
}
}
}
@ -366,7 +343,7 @@ void eg_keyoff(opl_slot *slot, Bit8u type) {
void pg_generate(opl_slot *slot) {
Bit16u f_num = slot->channel->f_num;
if (slot->reg_vib) {
Bit8u f_num_high = f_num >> (7 + vib_table[(slot->chip->timer >> 10)&0x07] + (0x01 - slot->chip->dvb));
Bit8u f_num_high = f_num >> (7 + vib_table[(slot->chip->timer >> 10) & 0x07] + (0x01 - slot->chip->dvb));
f_num += f_num_high * vibsgn_table[(slot->chip->timer >> 10) & 0x07];
}
slot->pg_phase += (((f_num << slot->channel->block) >> 1) * mt[slot->reg_mult]) >> 1;
@ -387,7 +364,7 @@ void n_generate(opl_chip *chip) {
// Slot
//
void slot_write20(opl_slot *slot,Bit8u data) {
void slot_write20(opl_slot *slot, Bit8u data) {
if ((data >> 7) & 0x01) {
slot->trem = &slot->chip->tremval;
}
@ -434,14 +411,14 @@ void slot_generatephase(opl_slot *slot, Bit16u phase) {
}
void slot_generate(opl_slot *slot) {
slot->out = envelope_sin[slot->reg_wf]((slot->pg_phase >> 9) + (*slot->mod), slot->eg_out);
slot->out = envelope_sin[slot->reg_wf]((Bit16u)(slot->pg_phase >> 9) + (*slot->mod), slot->eg_out);
}
void slot_generatezm(opl_slot *slot) {
slot->out = envelope_sin[slot->reg_wf]((slot->pg_phase >> 9), slot->eg_out);
slot->out = envelope_sin[slot->reg_wf]((Bit16u)(slot->pg_phase >> 9), slot->eg_out);
}
void slot_calgfb(opl_slot *slot) {
void slot_calcfb(opl_slot *slot) {
slot->prout[1] = slot->prout[0];
slot->prout[0] = slot->out;
if (slot->channel->fb != 0x00) {
@ -461,57 +438,61 @@ void chan_setupalg(opl_channel *channel);
void chan_updaterhythm(opl_chip *chip, Bit8u data) {
chip->rhy = data & 0x3f;
if (chip->rhy & 0x20) {
chip->channel[6].out[0] = &chip->slot[13].out;
chip->channel[6].out[1] = &chip->slot[13].out;
chip->channel[6].out[2] = &chip->zeromod;
chip->channel[6].out[3] = &chip->zeromod;
chip->channel[7].out[0] = &chip->slot[14].out;
chip->channel[7].out[1] = &chip->slot[14].out;
chip->channel[7].out[2] = &chip->slot[15].out;
chip->channel[7].out[3] = &chip->slot[15].out;
chip->channel[8].out[0] = &chip->slot[16].out;
chip->channel[8].out[1] = &chip->slot[16].out;
chip->channel[8].out[2] = &chip->slot[17].out;
chip->channel[8].out[3] = &chip->slot[17].out;
opl_channel *channel6 = &chip->channel[6];
opl_channel *channel7 = &chip->channel[7];
opl_channel *channel8 = &chip->channel[8];
channel6->out[0] = &channel6->slots[1]->out;
channel6->out[1] = &channel6->slots[1]->out;
channel6->out[2] = &chip->zeromod;
channel6->out[3] = &chip->zeromod;
channel7->out[0] = &channel7->slots[0]->out;
channel7->out[1] = &channel7->slots[0]->out;
channel7->out[2] = &channel7->slots[1]->out;
channel7->out[3] = &channel7->slots[1]->out;
channel8->out[0] = &channel8->slots[0]->out;
channel8->out[1] = &channel8->slots[0]->out;
channel8->out[2] = &channel8->slots[1]->out;
channel8->out[3] = &channel8->slots[1]->out;
for (Bit8u chnum = 6; chnum < 9; chnum++) {
chip->channel[chnum].chtype = ch_drum;
}
chan_setupalg(channel6);
//hh
if (chip->rhy & 0x01) {
eg_keyon(&chip->slot[14], egk_drum);
eg_keyon(channel7->slots[0], egk_drum);
}
else {
eg_keyoff(&chip->slot[14], egk_drum);
eg_keyoff(channel7->slots[0], egk_drum);
}
//tc
if (chip->rhy & 0x02) {
eg_keyon(&chip->slot[17], egk_drum);
eg_keyon(channel8->slots[1], egk_drum);
}
else {
eg_keyoff(&chip->slot[17], egk_drum);
eg_keyoff(channel8->slots[1], egk_drum);
}
//tom
if (chip->rhy & 0x04) {
eg_keyon(&chip->slot[16], egk_drum);
eg_keyon(channel8->slots[0], egk_drum);
}
else {
eg_keyoff(&chip->slot[16], egk_drum);
eg_keyoff(channel8->slots[0], egk_drum);
}
//sd
if (chip->rhy & 0x08) {
eg_keyon(&chip->slot[15], egk_drum);
eg_keyon(channel7->slots[1], egk_drum);
}
else {
eg_keyoff(&chip->slot[15], egk_drum);
eg_keyoff(channel7->slots[1], egk_drum);
}
//bd
if (chip->rhy & 0x10) {
eg_keyon(&chip->slot[12], egk_drum);
eg_keyon(&chip->slot[13], egk_drum);
eg_keyon(channel6->slots[0], egk_drum);
eg_keyon(channel6->slots[1], egk_drum);
}
else {
eg_keyoff(&chip->slot[12], egk_drum);
eg_keyoff(&chip->slot[13], egk_drum);
eg_keyoff(channel6->slots[0], egk_drum);
eg_keyoff(channel6->slots[1], egk_drum);
}
}
else {
@ -566,6 +547,16 @@ void chan_writeb0(opl_channel *channel, Bit8u data) {
void chan_setupalg(opl_channel *channel) {
if (channel->chtype == ch_drum) {
switch (channel->alg & 0x01) {
case 0x00:
channel->slots[0]->mod = &channel->slots[0]->fbmod;
channel->slots[1]->mod = &channel->slots[0]->out;
break;
case 0x01:
channel->slots[0]->mod = &channel->slots[0]->fbmod;
channel->slots[1]->mod = &channel->chip->zeromod;
break;
}
return;
}
if (channel->alg & 0x08) {
@ -672,49 +663,39 @@ void chan_writec0(opl_channel *channel, Bit8u data) {
}
}
void chan_generaterhythm(opl_chip *chip) {
if (chip->rhy & 0x20) {
opl_channel *channel6 = &chip->channel[6];
opl_channel *channel7 = &chip->channel[7];
opl_channel *channel8 = &chip->channel[8];
slot_generate(channel6->slots[0]);
slot_generate(channel6->slots[1]);
Bit16u phase14 = channel7->slots[0]->pg_phase & 0x3ff;
Bit16u phase17 = channel8->slots[1]->pg_phase & 0x3ff;
Bit16u phase = 0x00;
//hh tc phase bit
Bit16u phasebit = ((phase14 & 0x08) | (((phase14 >> 5) ^ phase14) & 0x04) | (((phase17 >> 2) ^ phase17) & 0x08)) ? 0x01 : 0x00;
//hh
phase = (phasebit << 9) | (0x34 << ((phasebit ^ (chip->noise & 0x01) << 1)));
slot_generatephase(channel7->slots[0], phase);
//sd
phase = (0x100 << ((phase14 >> 8) & 0x01)) ^ ((chip->noise & 0x01) << 8);
slot_generatephase(channel7->slots[1], phase);
//tt
slot_generatezm(channel8->slots[0]);
//tc
phase = 0x100 | (phasebit << 9);
slot_generatephase(channel8->slots[1], phase);
}
void chan_generaterhythm1(opl_chip *chip) {
opl_channel *channel6 = &chip->channel[6];
opl_channel *channel7 = &chip->channel[7];
opl_channel *channel8 = &chip->channel[8];
slot_generate(channel6->slots[0]);
Bit16u phase14 = (channel7->slots[0]->pg_phase >> 9) & 0x3ff;
Bit16u phase17 = (channel8->slots[1]->pg_phase >> 9) & 0x3ff;
Bit16u phase = 0x00;
//hh tc phase bit
Bit16u phasebit = ((phase14 & 0x08) | (((phase14 >> 5) ^ phase14) & 0x04) | (((phase17 >> 2) ^ phase17) & 0x08)) ? 0x01 : 0x00;
//hh
phase = (phasebit << 9) | (0x34 << ((phasebit ^ (chip->noise & 0x01) << 1)));
slot_generatephase(channel7->slots[0], phase);
//tt
slot_generatezm(channel8->slots[0]);
}
void chan_generate(opl_channel *channel) {
if (channel->chtype == ch_drum) {
return;
}
if (channel->alg & 0x08) {
return;
}
if (channel->alg & 0x04) {
slot_generate(channel->pair->slots[0]);
slot_generate(channel->pair->slots[1]);
slot_generate(channel->slots[0]);
slot_generate(channel->slots[1]);
}
else {
slot_generate(channel->slots[0]);
slot_generate(channel->slots[1]);
}
void chan_generaterhythm2(opl_chip *chip) {
opl_channel *channel6 = &chip->channel[6];
opl_channel *channel7 = &chip->channel[7];
opl_channel *channel8 = &chip->channel[8];
slot_generate(channel6->slots[1]);
Bit16u phase14 = (channel7->slots[0]->pg_phase >> 9) & 0x3ff;
Bit16u phase17 = (channel8->slots[1]->pg_phase >> 9) & 0x3ff;
Bit16u phase = 0x00;
//hh tc phase bit
Bit16u phasebit = ((phase14 & 0x08) | (((phase14 >> 5) ^ phase14) & 0x04) | (((phase17 >> 2) ^ phase17) & 0x08)) ? 0x01 : 0x00;
//sd
phase = (0x100 << ((phase14 >> 8) & 0x01)) ^ ((chip->noise & 0x01) << 8);
slot_generatephase(channel7->slots[1], phase);
//tc
phase = 0x100 | (phasebit << 9);
slot_generatephase(channel8->slots[1], phase);
}
void chan_enable(opl_channel *channel) {
@ -782,21 +763,132 @@ Bit16s limshort(Bit32s a) {
return (Bit16s)a;
}
void chip_generate(opl_chip *chip, Bit16s *buff) {
buff[1] = limshort(chip->mixbuff[1]);
for (Bit8u ii = 0; ii < 12; ii++) {
slot_calcfb(&chip->slot[ii]);
pg_generate(&chip->slot[ii]);
envelope_calc(&chip->slot[ii]);
slot_generate(&chip->slot[ii]);
}
for (Bit8u ii = 12; ii < 15; ii++) {
slot_calcfb(&chip->slot[ii]);
pg_generate(&chip->slot[ii]);
envelope_calc(&chip->slot[ii]);
}
if (chip->rhy & 0x20) {
chan_generaterhythm1(chip);
}
else {
slot_generate(&chip->slot[12]);
slot_generate(&chip->slot[13]);
slot_generate(&chip->slot[14]);
}
chip->mixbuff[0] = 0;
for (Bit8u ii = 0; ii < 18; ii++) {
Bit16s accm = 0;
for (Bit8u jj = 0; jj < 4; jj++) {
accm += *chip->channel[ii].out[jj];
}
if (chip->FullPan) {
chip->mixbuff[0] += (Bit16s)(accm * chip->channel[ii].fcha);
}
else {
chip->mixbuff[0] += (Bit16s)(accm & chip->channel[ii].cha);
}
}
for (Bit8u ii = 15; ii < 18; ii++) {
slot_calcfb(&chip->slot[ii]);
pg_generate(&chip->slot[ii]);
envelope_calc(&chip->slot[ii]);
}
if (chip->rhy & 0x20) {
chan_generaterhythm2(chip);
}
else {
slot_generate(&chip->slot[15]);
slot_generate(&chip->slot[16]);
slot_generate(&chip->slot[17]);
}
buff[0] = limshort(chip->mixbuff[0]);
for (Bit8u ii = 18; ii < 33; ii++) {
slot_calcfb(&chip->slot[ii]);
pg_generate(&chip->slot[ii]);
envelope_calc(&chip->slot[ii]);
slot_generate(&chip->slot[ii]);
}
chip->mixbuff[1] = 0;
for (Bit8u ii = 0; ii < 18; ii++) {
Bit16s accm = 0;
for (Bit8u jj = 0; jj < 4; jj++) {
accm += *chip->channel[ii].out[jj];
}
if (chip->FullPan) {
chip->mixbuff[1] += (Bit16s)(accm * chip->channel[ii].fchb);
}
else {
chip->mixbuff[1] += (Bit16s)(accm & chip->channel[ii].chb);
}
}
for (Bit8u ii = 33; ii < 36; ii++) {
slot_calcfb(&chip->slot[ii]);
pg_generate(&chip->slot[ii]);
envelope_calc(&chip->slot[ii]);
slot_generate(&chip->slot[ii]);
}
n_generate(chip);
if ((chip->timer & 0x3f) == 0x3f) {
if (!chip->tremdir) {
if (chip->tremtval == 105) {
chip->tremtval--;
chip->tremdir = 1;
}
else {
chip->tremtval++;
}
}
else {
if (chip->tremtval == 0) {
chip->tremtval++;
chip->tremdir = 0;
}
else {
chip->tremtval--;
}
}
chip->tremval = (chip->tremtval >> 2) >> ((1 - chip->dam) << 1);
}
chip->timer++;
}
void NukedOPL3::Reset() {
memset(&opl3, 0, sizeof(opl_chip));
for (Bit8u slotnum = 0; slotnum < 36; slotnum++) {
opl3.slot[slotnum].channel = &opl3.channel[slotnum / 2];
opl3.slot[slotnum].chip = &opl3;
opl3.slot[slotnum].mod = &opl3.zeromod;
opl3.slot[slotnum].eg_rout = 0x1ff;
opl3.slot[slotnum].eg_out = 0x1ff;
opl3.slot[slotnum].eg_gen = envelope_gen_num_off;
opl3.slot[slotnum].eg_gennext = envelope_gen_num_off;
opl3.slot[slotnum].trem = (Bit8u*)&opl3.zeromod;
}
for (Bit8u channum = 0; channum < 18; channum++) {
opl3.channel[channum].slots[0] = &opl3.slot[2 * channum];
opl3.channel[channum].slots[1] = &opl3.slot[2 * channum + 1];
opl3.channel[channum].slots[0] = &opl3.slot[ch_slot[channum]];
opl3.channel[channum].slots[1] = &opl3.slot[ch_slot[channum] + 3];
opl3.slot[ch_slot[channum]].channel = &opl3.channel[channum];
opl3.slot[ch_slot[channum] + 3].channel = &opl3.channel[channum];
if ((channum % 9) < 3) {
opl3.channel[channum].pair = &opl3.channel[channum + 3];
}
@ -816,6 +908,8 @@ void NukedOPL3::Reset() {
chan_setupalg(&opl3.channel[channum]);
}
opl3.noise = 0x306600;
opl3.timer = 0;
opl3.FullPan = FullPan;
}
void NukedOPL3::WriteReg(int reg, int v) {
@ -903,58 +997,11 @@ void NukedOPL3::WriteReg(int reg, int v) {
}
void NukedOPL3::Update(float* sndptr, int numsamples) {
Bit32s outa, outb;
Bit16s buffer[2];
for (Bit32u i = 0; i < (Bit32u)numsamples; i++) {
outa = 0;
outb = 0;
for (Bit8u ii = 0; ii < 36; ii++) {
slot_calgfb(&opl3.slot[ii]);
}
chan_generaterhythm(&opl3);
for (Bit8u ii = 0; ii < 18; ii++) {
chan_generate(&opl3.channel[ii]);
Bit16s accm = 0;
for (Bit8u jj = 0; jj < 4; jj++) {
accm += *opl3.channel[ii].out[jj];
}
if (FullPan) {
outa += (Bit16s)(accm * opl3.channel[ii].fcha);
outb += (Bit16s)(accm * opl3.channel[ii].fchb);
}
else {
outa += (Bit16s)(accm & opl3.channel[ii].cha);
outb += (Bit16s)(accm & opl3.channel[ii].chb);
}
}
for (Bit8u ii = 0; ii < 36; ii++) {
envelope_calc(&opl3.slot[ii]);
pg_generate(&opl3.slot[ii]);
}
n_generate(&opl3);
opl3.timer++;
if (!(opl3.timer & 0x3f)) {
if (!opl3.tremdir) {
if (opl3.tremtval == 105) {
opl3.tremtval--;
opl3.tremdir = 1;
}
else {
opl3.tremtval++;
}
}
else {
if (opl3.tremtval == 0) {
opl3.tremtval++;
opl3.tremdir = 0;
}
else {
opl3.tremtval--;
}
}
opl3.tremval = (opl3.tremtval >> 2) >> ((1 - opl3.dam) << 1);
}
*sndptr++ += (float)(outa / 10240.0);
*sndptr++ += (float)(outb / 10240.0);
chip_generate(&opl3, buffer);
*sndptr++ += (float)(buffer[0] / 10240.0);
*sndptr++ += (float)(buffer[1] / 10240.0);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2014 Nuke.YKT
* Copyright (C) 2013-2015 Nuke.YKT(Alexey Khokholov)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -27,7 +27,7 @@
OPL2 ROMs.
*/
//version 1.5
//version 1.6
#include "opl.h"
#include "muslib.h"
@ -116,7 +116,7 @@ static const Bit8u mt[16] = { 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 20, 24, 24,
// ksl table
//
static const Bit8u kslrom[16] = { 0, 64, 80, 90, 96, 102, 106, 110, 112, 116, 118, 120, 122, 124, 126, 127 };
static const Bit8u kslrom[16] = { 0, 32, 40, 45, 48, 51, 53, 55, 56, 58, 59, 60, 61, 62, 63, 64 };
static const Bit8u kslshift[4] = { 8, 1, 2, 0 };
@ -133,7 +133,7 @@ static const Bit8s vibsgn_table[8] = { 1, 1, 1, 1, -1, -1, -1, -1 };
static const Bit8u eg_incstep[3][4][8] = {
{ { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } },
{ { 0, 1, 0, 1, 0, 1, 0, 1 }, { 1, 1, 0, 1, 0, 1, 0, 1 }, { 1, 1, 0, 1, 1, 1, 0, 1 }, { 1, 1, 1, 1, 1, 1, 0, 1 } },
{ { 0, 1, 0, 1, 0, 1, 0, 1 }, { 0, 1, 0, 1, 1, 1, 0, 1 }, { 0, 1, 1, 1, 0, 1, 1, 1 }, { 0, 1, 1, 1, 1, 1, 1, 1 } },
{ { 1, 1, 1, 1, 1, 1, 1, 1 }, { 2, 2, 1, 1, 1, 1, 1, 1 }, { 2, 2, 1, 1, 2, 2, 1, 1 }, { 2, 2, 2, 2, 2, 2, 1, 1 } }
};
@ -149,8 +149,8 @@ static const Bit8s eg_incsh[16] = {
// address decoding
//
static const Bit8s ad_slot[0x20] = { 0, 2, 4, 1, 3, 5, -1, -1, 6, 8, 10, 7, 9, 11, -1, -1, 12, 14, 16, 13, 15, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
static const Bit8s ad_slot[0x20] = { 0, 1, 2, 3, 4, 5, -1, -1, 6, 7, 8, 9, 10, 11, -1, -1, 12, 13, 14, 15, 16, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
static const Bit8u ch_slot[18] = { 0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 24, 25, 26, 30, 31, 32 };
struct opl_chip;
struct opl_slot;
@ -167,7 +167,6 @@ struct opl_slot {
Bit16s eg_out;
Bit8u eg_inc;
Bit8u eg_gen;
Bit8u eg_gennext;
Bit8u eg_rate;
Bit8u eg_ksl;
Bit8u *trem;
@ -217,6 +216,8 @@ struct opl_chip {
Bit8u tremdir;
Bit32u noise;
Bit16s zeromod;
Bit32s mixbuff[2];
Bit8u FullPan;
};

View file

@ -3365,6 +3365,14 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
if (info != NULL)
{
info = info->GetReplacement ();
if ((GetDefaultByType (info)->flags3 & MF3_ISMONSTER) &&
((dmflags & DF_NO_MONSTERS) || (level.flags2 & LEVEL2_NOMONSTERS)))
{
return 0;
}
actor = Spawn (info, x, y, z, ALLOW_REPLACE);
if (actor != NULL)
{
@ -5761,9 +5769,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
return 0;
}
DWORD actorMask = MF_SHOOTABLE;
ActorFlags actorMask = MF_SHOOTABLE;
if (argCount >= 6) {
actorMask = args[5];
actorMask = ActorFlags::FromInt(args[5]);
}
DWORD wallMask = ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN;
@ -5864,6 +5872,8 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : "";
bool exact = argCount > 7 ? !!args[7] : false;
fixed_t heightoffset = argCount > 8 ? args[8] : 0;
fixed_t radiusoffset = argCount > 9 ? args[9] : 0;
fixed_t pitch = argCount > 10 ? args[10] : 0;
FState *state = argCount > 6 ? activator->GetClass()->ActorInfo->FindStateByString(statename, exact) : 0;
@ -5881,7 +5891,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
if (!reference)
return false;
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset))
if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset, radiusoffset, pitch))
{
if (state && argCount > 6)
{

View file

@ -970,7 +970,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
}
if (target->health <= 0)
{
if (inflictor && mod == NAME_Ice)
if (inflictor && mod == NAME_Ice && !(inflictor->flags7 & MF7_ICESHATTER))
{
return -1;
}

View file

@ -176,7 +176,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser);
bool P_Thing_CanRaise(AActor *thing);
const PClass *P_GetSpawnableType(int spawnnum);
void InitSpawnablesFromMapinfo();
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset);
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset, fixed_t radiusoffset, angle_t pitch);
enum WARPF
{
@ -198,6 +198,8 @@ enum WARPF
WARPF_MOVEPTR = 0x1000,
WARPF_USEPTR = 0x2000,
WARPF_USETID = 0x2000,
WARPF_COPYVELOCITY = 0x4000,
WARPF_COPYPITCH = 0x8000,
};
@ -500,7 +502,7 @@ enum // P_LineAttack flags
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL);
AActor *P_LinePickActor (AActor *t1, angle_t angle, fixed_t distance, int pitch, DWORD actorMask, DWORD wallMask);
AActor *P_LinePickActor (AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version

View file

@ -3912,7 +3912,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
//==========================================================================
AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
DWORD actorMask, DWORD wallMask)
ActorFlags actorMask, DWORD wallMask)
{
fixed_t vx, vy, vz, shootz;

View file

@ -6467,25 +6467,25 @@ void PrintMiscActorInfo(AActor *query)
Printf("%s @ %p has the following flags:\n flags: %x", query->GetTag(), query, query->flags.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags));
if (query->flags & ActorFlags::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags));
Printf("\n flags2: %x", query->flags2.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags2 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags2));
if (query->flags2 & ActorFlags2::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags2));
Printf("\n flags3: %x", query->flags3.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags3 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags3));
if (query->flags3 & ActorFlags3::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags3));
Printf("\n flags4: %x", query->flags4.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags4 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags4));
if (query->flags4 & ActorFlags4::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags4));
Printf("\n flags5: %x", query->flags5.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags5 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags5));
if (query->flags5 & ActorFlags5::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags5));
Printf("\n flags6: %x", query->flags6.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags6 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags6));
if (query->flags6 & ActorFlags6::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags6));
Printf("\n flags7: %x", query->flags7.GetValue());
for (flagi = 0; flagi <= 31; flagi++)
if (query->flags7 & 1<<flagi) Printf(" %s", FLAG_NAME(1<<flagi, flags7));
if (query->flags7 & ActorFlags7::FromInt(1<<flagi)) Printf(" %s", FLAG_NAME(1<<flagi, flags7));
Printf("\nBounce flags: %x\nBounce factors: f:%f, w:%f",
query->BounceFlags.GetValue(), FIXED2FLOAT(query->bouncefactor),
FIXED2FLOAT(query->wallbouncefactor));

View file

@ -2353,7 +2353,16 @@ static void P_LoopSidedefs (bool firstloop)
// instead of as part of another loop
if (line->frontsector == line->backsector)
{
right = DWORD(line->sidedef[!sidetemp[i].b.lineside] - sides);
const side_t* const rightside = line->sidedef[!sidetemp[i].b.lineside];
if (NULL == rightside)
{
// There is no right side!
if (firstloop) Printf ("Line %d's right edge is unconnected\n", linemap[unsigned(line-lines)]);
continue;
}
right = DWORD(rightside - sides);
}
else
{

View file

@ -680,7 +680,7 @@ void InitSpawnablesFromMapinfo()
}
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset)
int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset, fixed_t radiusoffset, angle_t pitch)
{
if (flags & WARPF_MOVEPTR)
{
@ -692,7 +692,6 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
fixed_t oldx = caller->x;
fixed_t oldy = caller->y;
fixed_t oldz = caller->z;
zofs += FixedMul(reference->height, heightoffset);
@ -700,11 +699,14 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle;
}
const fixed_t rad = FixedMul(radiusoffset, reference->radius);
const angle_t fineangle = angle >> ANGLETOFINESHIFT;
if (!(flags & WARPF_ABSOLUTEPOSITION))
{
if (!(flags & WARPF_ABSOLUTEOFFSET))
{
angle_t fineangle = angle >> ANGLETOFINESHIFT;
fixed_t xofs1 = xofs;
// (borrowed from A_SpawnItemEx, assumed workable)
@ -722,15 +724,16 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
// assigning position again with.
// extra unlink, link and environment calculation
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->floorz + zofs);
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
reference->z);
caller->z = caller->floorz + zofs;
}
else
{
caller->SetOrigin(
reference->x + xofs,
reference->y + yofs,
reference->x + xofs + FixedMul(rad, finecosine[fineangle]),
reference->y + yofs + FixedMul(rad, finesine[fineangle]),
reference->z + zofs);
}
}
@ -738,11 +741,12 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
if (flags & WARPF_TOFLOOR)
{
caller->SetOrigin(xofs, yofs, caller->floorz + zofs);
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
caller->z = caller->floorz + zofs;
}
else
{
caller->SetOrigin(xofs, yofs, zofs);
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs);
}
}
@ -756,6 +760,18 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
{
caller->angle = angle;
if (flags & WARPF_COPYPITCH)
caller->SetPitch(reference->pitch, false);
if (pitch)
caller->SetPitch(caller->pitch + pitch, false);
if (flags & WARPF_COPYVELOCITY)
{
caller->velx = reference->velx;
caller->vely = reference->vely;
caller->velz = reference->velz;
}
if (flags & WARPF_STOP)
{
caller->velx = 0;

View file

@ -42,7 +42,8 @@ struct FTraceInfo
{
fixed_t StartX, StartY, StartZ;
fixed_t Vx, Vy, Vz;
DWORD ActorMask, WallMask;
ActorFlags ActorMask;
DWORD WallMask;
AActor *IgnoreThis;
FTraceResults *Results;
sector_t *CurSector;
@ -70,7 +71,7 @@ static bool EditTraceResult (DWORD flags, FTraceResults &res);
bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
fixed_t vx, fixed_t vy, fixed_t vz, fixed_t maxDist,
DWORD actorMask, DWORD wallMask, AActor *ignore,
ActorFlags actorMask, DWORD wallMask, AActor *ignore,
FTraceResults &res,
DWORD flags, ETraceStatus (*callback)(FTraceResults &res, void *), void *callbackdata)
{

View file

@ -35,6 +35,7 @@
#define __P_TRACE_H__
#include <stddef.h>
#include "actor.h"
#include "textures/textures.h"
struct sector_t;
@ -96,7 +97,7 @@ enum ETraceStatus
bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
fixed_t vx, fixed_t vy, fixed_t vz, fixed_t maxDist,
DWORD ActorMask, DWORD WallMask, AActor *ignore,
ActorFlags ActorMask, DWORD WallMask, AActor *ignore,
FTraceResults &res,
DWORD traceFlags=0,
ETraceStatus (*callback)(FTraceResults &res, void *)=NULL, void *callbackdata=NULL);

View file

@ -342,17 +342,19 @@ VideoModes[] =
{ 1680, 1050 }, // 16:10
{ 1920, 1080 },
{ 1920, 1200 },
{ 2048, 1152 }, // 16:9, iMac Retina 4K 21.5", HiDPI off
{ 2048, 1536 },
{ 2304, 1440 },
{ 2304, 1440 }, // 16:10, MacBook Retina 12"
{ 2560, 1440 },
{ 2560, 1600 },
{ 2560, 2048 },
{ 2880, 1800 },
{ 2880, 1800 }, // 16:10, MacBook Pro Retina 15"
{ 3200, 1800 },
{ 3840, 2160 },
{ 3840, 2400 },
{ 4096, 2160 },
{ 5120, 2880 }
{ 4096, 2304 }, // 16:9, iMac Retina 4K 21.5"
{ 5120, 2880 } // 16:9, iMac Retina 5K 27"
};

View file

@ -94,6 +94,10 @@ public:
static Self FromInt (TT value) { return Self (static_cast<T> (value)); }
private:
template<typename X> Self operator| (X value) const { return Self::FromInt (Value | value); }
template<typename X> Self operator& (X value) const { return Self::FromInt (Value & value); }
template<typename X> Self operator^ (X value) const { return Self::FromInt (Value ^ value); }
TT Value;
};

View file

@ -660,18 +660,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange)
//==========================================================================
void DoJumpIfCloser(AActor *target, DECLARE_PARAMINFO)
{
ACTION_PARAM_START(2);
ACTION_PARAM_START(3);
ACTION_PARAM_FIXED(dist, 0);
ACTION_PARAM_STATE(jump, 1);
ACTION_PARAM_BOOL(noz, 2);
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
// No target - no jump
if (target != NULL && P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
( (self->z > target->z && self->z - (target->z + target->height) < dist) ||
(self->z <=target->z && target->z - (self->z + self->height) < dist)
)
)
if (!target)
return;
if (P_AproxDistance(self->x-target->x, self->y-target->y) < dist &&
(noz ||
((self->z > target->z && self->z - (target->z + target->height) < dist) ||
(self->z <= target->z && target->z - (self->z + self->height) < dist))))
{
ACTION_JUMP(jump);
}
@ -1012,7 +1014,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
targ=owner;
missile->target=owner;
// automatic handling of seeker missiles
if (self->flags & missile->flags2 & MF2_SEEKERMISSILE)
if (self->flags2 & missile->flags2 & MF2_SEEKERMISSILE)
{
missile->tracer=self->tracer;
}
@ -3412,7 +3414,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
lof_data.Flags = flags;
lof_data.BadActor = false;
Trace(x1, y1, z1, sec, vx, vy, vz, range, 0xFFFFFFFF, ML_BLOCKEVERYTHING, self, trace, 0,
Trace(x1, y1, z1, sec, vx, vy, vz, range, ActorFlags::FromInt(0xFFFFFFFF), ML_BLOCKEVERYTHING, self, trace, 0,
CheckLOFTraceFunc, &lof_data);
if (trace.HitType == TRACE_HitActor ||
@ -4673,7 +4675,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
{
ACTION_PARAM_START(8);
ACTION_PARAM_START(10);
ACTION_PARAM_INT(destination_selector, 0);
ACTION_PARAM_FIXED(xofs, 1);
@ -4682,7 +4684,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
ACTION_PARAM_ANGLE(angle, 4);
ACTION_PARAM_INT(flags, 5);
ACTION_PARAM_STATE(success_state, 6);
ACTION_PARAM_FIXED(heightoffset,7)
ACTION_PARAM_FIXED(heightoffset, 7);
ACTION_PARAM_FIXED(radiusoffset, 8);
ACTION_PARAM_ANGLE(pitch, 9);
AActor *reference;
@ -4702,7 +4706,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp)
return;
}
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset))
if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset, radiusoffset, pitch))
{
if (success_state)
{
@ -5111,6 +5115,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed)
ref->FloatSpeed = speed;
}
//==========================================================================
//
// A_SetPainThreshold
//
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPainThreshold)
{
ACTION_PARAM_START(2);
ACTION_PARAM_INT(threshold, 0);
ACTION_PARAM_INT(ptr, 1);
AActor *ref = COPY_AAPTR(self, ptr);
if (!ref)
{
ACTION_SET_RESULT(false);
return;
}
ref->PainThreshold = threshold;
}
//===========================================================================
//
// Common A_Damage handler
@ -5846,3 +5872,62 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax)
self->RipLevelMax = max;
}
/*===========================================================================
A_CheckBlock
(state block, int flags, int ptr)
Checks if something is blocking the actor('s pointer) 'ptr'.
The SET pointer flags only affect the caller, not the pointer.
===========================================================================*/
enum CBF
{
CBF_NOLINES = 1 << 0, //Don't check actors.
CBF_SETTARGET = 1 << 1, //Sets the caller/pointer's target to the actor blocking it. Actors only.
CBF_SETMASTER = 1 << 2, //^ but with master.
CBF_SETTRACER = 1 << 3, //^ but with tracer.
CBF_SETONPTR = 1 << 4, //Sets the pointer change on the actor doing the checking instead of self.
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
{
ACTION_PARAM_START(3);
ACTION_PARAM_STATE(block, 0);
ACTION_PARAM_INT(flags, 1);
ACTION_PARAM_INT(ptr, 2);
AActor *mobj = COPY_AAPTR(self, ptr);
ACTION_SET_RESULT(false);
//Needs at least one state jump to work.
if (!mobj)
{
return;
}
//Nothing to block it so skip the rest.
if (P_TestMobjLocation(mobj)) return;
if (mobj->BlockingMobj)
{
AActor *setter = (flags & CBF_SETONPTR) ? mobj : self;
if (setter)
{
if (flags & CBF_SETTARGET) setter->target = mobj->BlockingMobj;
if (flags & CBF_SETMASTER) setter->master = mobj->BlockingMobj;
if (flags & CBF_SETTRACER) setter->tracer = mobj->BlockingMobj;
}
}
//[MC] If modders don't want jumping, but just getting the pointer, only abort at
//this point. I.e. A_CheckBlock("",CBF_SETTRACER) is like having CBF_NOLINES.
//It gets the mobj blocking, if any, and doesn't jump at all.
if (!block)
return;
//[MC] Easiest way to tell if an actor is blocking it, use the pointers.
if (mobj->BlockingMobj || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL))
{
ACTION_JUMP(block);
}
}

View file

@ -253,12 +253,10 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF7, HITTARGET, AActor, flags7),
DEFINE_FLAG(MF7, HITMASTER, AActor, flags7),
DEFINE_FLAG(MF7, HITTRACER, AActor, flags7),
// [ZK] Decal flags
DEFINE_FLAG(MF7, NODECAL, AActor, flags7),
DEFINE_FLAG(MF7, NODECAL, AActor, flags7), // [ZK] Decal flags
DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7),
DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7),
DEFINE_FLAG(MF7, ICESHATTER, AActor, flags7),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),

View file

@ -1808,18 +1808,16 @@ void WI_updateStats ()
if (acceleratestage && sp_state != 10)
{
if (acceleratestage)
{
acceleratestage = 0;
sp_state = 10;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
}
acceleratestage = 0;
sp_state = 10;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
cnt_kills[0] = plrs[me].skills;
cnt_items[0] = plrs[me].sitems;
cnt_secret[0] = plrs[me].ssecret;
cnt_time = Tics2Seconds(plrs[me].stime);
cnt_par = wbs->partime / TICRATE;
cnt_total_time = Tics2Seconds(wbs->totaltime);
cnt_total_time = Tics2Seconds(wbs->totaltime);
}
if (sp_state == 2)

View file

@ -137,6 +137,7 @@ extern bool ConWindowHidden;
// PUBLIC DATA DEFINITIONS -------------------------------------------------
CVAR (String, queryiwad_key, "shift", CVAR_GLOBALCONFIG|CVAR_ARCHIVE);
CVAR (Bool, con_debugoutput, false, 0);
double PerfToSec, PerfToMillisec;
UINT TimerPeriod;
@ -1053,6 +1054,31 @@ static TArray<FString> bufferedConsoleStuff;
void I_PrintStr(const char *cp)
{
if (con_debugoutput)
{
// Strip out any color escape sequences before writing to debug output
char * copy = new char[strlen(cp)+1];
const char * srcp = cp;
char * dstp = copy;
while (*srcp != 0)
{
if (*srcp!=0x1c && *srcp!=0x1d && *srcp!=0x1e && *srcp!=0x1f)
{
*dstp++=*srcp++;
}
else
{
if (srcp[1]!=0) srcp+=2;
else break;
}
}
*dstp=0;
OutputDebugStringA(copy);
delete [] copy;
}
if (ConWindowHidden)
{
bufferedConsoleStuff.Push(cp);

View file

@ -212,9 +212,9 @@ ACTOR Actor native //: Thinker
action native A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET);
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270);
action native A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT);
action native A_JumpIfCloser(float distance, state label);
action native A_JumpIfTracerCloser(float distance, state label);
action native A_JumpIfMasterCloser(float distance, state label);
action native A_JumpIfCloser(float distance, state label, bool noz = false);
action native A_JumpIfTracerCloser(float distance, state label, bool noz = false);
action native A_JumpIfMasterCloser(float distance, state label, bool noz = false);
action native A_JumpIfTargetOutsideMeleeRange(state label);
action native A_JumpIfTargetInsideMeleeRange(state label);
action native A_JumpIfInventory(class<Inventory> itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT);
@ -249,7 +249,7 @@ ACTOR Actor native //: Thinker
action native A_PlayerSkinCheck(state label);
action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight);
action native A_Teleport(state teleportstate = "", class<SpecialSpot> targettype = "BossSpot", class<Actor> fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT);
action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0);
action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0, float radiusoffset = 0, float pitch = 0);
action native A_ThrowGrenade(class<Actor> itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true);
action native A_Weave(int xspeed, int yspeed, float xdist, float ydist);
@ -305,6 +305,7 @@ ACTOR Actor native //: Thinker
action native A_DropItem(class<Actor> item, int dropamount = -1, int chance = 256);
action native A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT);
action native A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT);
action native A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT);
action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = "None", name species = "None");
@ -336,7 +337,7 @@ ACTOR Actor native //: Thinker
action native A_SetRipperLevel(int level);
action native A_SetRipMin(int min);
action native A_SetRipMax(int max);
action native A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT);
action native A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
action native A_CheckRange(float distance, state label, bool two_dimension = false);

View file

@ -362,6 +362,8 @@ Const Int WARPF_ABSOLUTEPOSITION = 0x400;
Const Int WARPF_BOB = 0x800;
Const Int WARPF_MOVEPTR = 0x1000;
Const Int WARPF_USETID = 0x2000;
Const Int WARPF_COPYVELOCITY = 0x4000;
Const Int WARPF_COPYPITCH = 0x8000;
// flags for A_SetPitch/SetAngle/SetRoll
const int SPF_FORCECLAMP = 1;
@ -482,5 +484,17 @@ enum
QF_WAVE = 1 << 5,
};
// Flags for A_CheckBlock
// These flags only affect the calling actor('s pointer), not the ones being searched.
enum
{
CBF_NOLINES = 1 << 0, //Don't check actors.
CBF_SETTARGET = 1 << 1, //Sets the caller/pointer's target to the actor blocking it. Actors only.
CBF_SETMASTER = 1 << 2, //^ but with master.
CBF_SETTRACER = 1 << 3, //^ but with tracer.
CBF_SETONPTR = 1 << 4, //Sets the pointer change on the actor doing the checking instead of self.
};
// This is only here to provide one global variable for testing.
native int testglobalvar;

View file

@ -534,7 +534,13 @@ SoundMap
"skeleton/active",
"skeleton/sight",
"skeleton/attack",
"misc/chat"
"misc/chat",
"dog/sight",
"dog/attack",
"dog/active",
"dog/death",
"dog/pain",
};
// Names of different actor types, in original Doom 2 order

View file

@ -456,6 +456,7 @@ OptionMenu "CustomizeControls"
Control "Look down", "+lookdown"
Control "Center view", "centerview"
Control "Run", "+speed"
Control "Toggle Run", "toggle cl_run"
Control "Strafe", "+strafe"
Control "Show Scoreboard", "+showscores"
Control "Toggle Scoreboard", "togglescoreboard"