mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-17 09:42:04 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
4b0ce7a8db
7 changed files with 111 additions and 40 deletions
|
@ -979,10 +979,12 @@ static void PrintPickupMessage (const char *str)
|
||||||
|
|
||||||
void AInventory::Touch (AActor *toucher)
|
void AInventory::Touch (AActor *toucher)
|
||||||
{
|
{
|
||||||
|
player_t *player = toucher->player;
|
||||||
|
|
||||||
// If a voodoo doll touches something, pretend the real player touched it instead.
|
// If a voodoo doll touches something, pretend the real player touched it instead.
|
||||||
if (toucher->player != NULL)
|
if (player != NULL)
|
||||||
{
|
{
|
||||||
toucher = toucher->player->mo;
|
toucher = player->mo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool localview = toucher->CheckLocalView(consoleplayer);
|
bool localview = toucher->CheckLocalView(consoleplayer);
|
||||||
|
@ -1010,12 +1012,12 @@ void AInventory::Touch (AActor *toucher)
|
||||||
|
|
||||||
// Special check so voodoo dolls picking up items cause the
|
// Special check so voodoo dolls picking up items cause the
|
||||||
// real player to make noise.
|
// real player to make noise.
|
||||||
if (toucher->player != NULL)
|
if (player != NULL)
|
||||||
{
|
{
|
||||||
PlayPickupSound (toucher->player->mo);
|
PlayPickupSound (player->mo);
|
||||||
if (!(ItemFlags & IF_NOSCREENFLASH))
|
if (!(ItemFlags & IF_NOSCREENFLASH))
|
||||||
{
|
{
|
||||||
toucher->player->bonuscount = BONUSADD;
|
player->bonuscount = BONUSADD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1029,16 +1031,16 @@ void AInventory::Touch (AActor *toucher)
|
||||||
|
|
||||||
if (flags & MF_COUNTITEM)
|
if (flags & MF_COUNTITEM)
|
||||||
{
|
{
|
||||||
if (toucher->player != NULL)
|
if (player != NULL)
|
||||||
{
|
{
|
||||||
toucher->player->itemcount++;
|
player->itemcount++;
|
||||||
}
|
}
|
||||||
level.found_items++;
|
level.found_items++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags5 & MF5_COUNTSECRET)
|
if (flags5 & MF5_COUNTSECRET)
|
||||||
{
|
{
|
||||||
P_GiveSecret(toucher, true, true, -1);
|
P_GiveSecret(player != NULL? (AActor*)player->mo : toucher, true, true, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Added by MC: Check if item taken was the roam destination of any bot
|
//Added by MC: Check if item taken was the roam destination of any bot
|
||||||
|
|
|
@ -848,7 +848,7 @@ public:
|
||||||
bool MouseEvent(int type, int x, int y)
|
bool MouseEvent(int type, int x, int y)
|
||||||
{
|
{
|
||||||
int sel = -1;
|
int sel = -1;
|
||||||
int fh = SmallFont->GetHeight();
|
int fh = OptionSettings.mLinespacing;
|
||||||
|
|
||||||
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
|
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
|
||||||
x = ((x - (screen->GetWidth() / 2)) / CleanXfac) + 160;
|
x = ((x - (screen->GetWidth() / 2)) / CleanXfac) + 160;
|
||||||
|
|
|
@ -342,16 +342,16 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
|
||||||
floor->m_Speed = height;
|
floor->m_Speed = height;
|
||||||
case DFloor::floorLowerByValue:
|
case DFloor::floorLowerByValue:
|
||||||
floor->m_Direction = -1;
|
floor->m_Direction = -1;
|
||||||
newheight = sec->floorplane.ZatPoint (0, 0) - height;
|
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) - height;
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (0, 0, newheight);
|
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DFloor::floorRaiseInstant:
|
case DFloor::floorRaiseInstant:
|
||||||
floor->m_Speed = height;
|
floor->m_Speed = height;
|
||||||
case DFloor::floorRaiseByValue:
|
case DFloor::floorRaiseByValue:
|
||||||
floor->m_Direction = 1;
|
floor->m_Direction = 1;
|
||||||
newheight = sec->floorplane.ZatPoint (0, 0) + height;
|
newheight = sec->floorplane.ZatPoint (sec->soundorg[0], sec->soundorg[1]) + height;
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist (0, 0, newheight);
|
floor->m_FloorDestDist = sec->floorplane.PointToDist (sec->soundorg[0], sec->soundorg[1], newheight);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DFloor::floorMoveToValue:
|
case DFloor::floorMoveToValue:
|
||||||
|
|
|
@ -1917,8 +1917,6 @@ void S_UpdateSounds (AActor *listenactor)
|
||||||
S_ActivatePlayList(false);
|
S_ActivatePlayList(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenactor != NULL)
|
|
||||||
{
|
|
||||||
// should never happen
|
// should never happen
|
||||||
S_SetListener(listener, listenactor);
|
S_SetListener(listener, listenactor);
|
||||||
|
|
||||||
|
@ -1944,7 +1942,6 @@ void S_UpdateSounds (AActor *listenactor)
|
||||||
S_RestoreEvictedChannels();
|
S_RestoreEvictedChannels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
|
|
@ -344,6 +344,11 @@ void MIDIStreamer::Play(bool looping, int subsong)
|
||||||
if (MIDI == NULL || 0 != MIDI->Open(Callback, this))
|
if (MIDI == NULL || 0 != MIDI->Open(Callback, this))
|
||||||
{
|
{
|
||||||
Printf(PRINT_BOLD, "Could not open MIDI out device\n");
|
Printf(PRINT_BOLD, "Could not open MIDI out device\n");
|
||||||
|
if (MIDI != NULL)
|
||||||
|
{
|
||||||
|
delete MIDI;
|
||||||
|
MIDI = NULL;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5995,6 +5995,13 @@ enum CPXFflags
|
||||||
CPXF_COUNTDEAD = 1 << 3,
|
CPXF_COUNTDEAD = 1 << 3,
|
||||||
CPXF_DEADONLY = 1 << 4,
|
CPXF_DEADONLY = 1 << 4,
|
||||||
CPXF_EXACT = 1 << 5,
|
CPXF_EXACT = 1 << 5,
|
||||||
|
CPXF_SETTARGET = 1 << 6,
|
||||||
|
CPXF_SETMASTER = 1 << 7,
|
||||||
|
CPXF_SETTRACER = 1 << 8,
|
||||||
|
CPXF_FARTHEST = 1 << 9,
|
||||||
|
CPXF_CLOSEST = 1 << 10,
|
||||||
|
CPXF_SETONPTR = 1 << 11,
|
||||||
|
CPXF_CHECKSIGHT = 1 << 12,
|
||||||
};
|
};
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
|
||||||
{
|
{
|
||||||
|
@ -6007,17 +6014,26 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
|
||||||
ACTION_PARAM_INT(ptr, 5);
|
ACTION_PARAM_INT(ptr, 5);
|
||||||
|
|
||||||
ACTION_SET_RESULT(false); //No inventory chain results please.
|
ACTION_SET_RESULT(false); //No inventory chain results please.
|
||||||
|
|
||||||
|
if (!jump)
|
||||||
|
{
|
||||||
|
if (!(flags & (CPXF_SETTARGET | CPXF_SETMASTER | CPXF_SETTRACER)))
|
||||||
|
return;
|
||||||
|
}
|
||||||
AActor *ref = COPY_AAPTR(self, ptr);
|
AActor *ref = COPY_AAPTR(self, ptr);
|
||||||
|
|
||||||
//We need these to check out.
|
//We need these to check out.
|
||||||
if (!ref || !jump || !classname || distance <= 0)
|
if (!ref || !classname || (distance <= 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
fixed_t closer = distance, farther = 0, current = distance;
|
||||||
|
const bool ptrWillChange = !!(flags & (CPXF_SETTARGET | CPXF_SETMASTER | CPXF_SETTRACER));
|
||||||
|
const bool ptrDistPref = !!(flags & (CPXF_CLOSEST | CPXF_FARTHEST));
|
||||||
|
|
||||||
TThinkerIterator<AActor> it;
|
TThinkerIterator<AActor> it;
|
||||||
AActor * mo;
|
AActor *mo, *dist = NULL;
|
||||||
|
|
||||||
//[MC] Process of elimination, I think, will get through this as quickly and
|
//[MC] Process of elimination, I think, will get through this as quickly and
|
||||||
//efficiently as possible.
|
//efficiently as possible.
|
||||||
|
@ -6036,12 +6052,35 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
|
||||||
else if (classname != mo->GetClass())
|
else if (classname != mo->GetClass())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Make sure it's in range and respect the desire for Z or not.
|
//[MC]Make sure it's in range and respect the desire for Z or not. The function forces it to use
|
||||||
if (ref->AproxDistance(mo) < distance &&
|
//Z later for ensuring CLOSEST and FARTHEST flags are respected perfectly.
|
||||||
|
//Ripped from sphere checking in A_RadiusGive (along with a number of things).
|
||||||
|
if ((ref->AproxDistance(mo) < distance &&
|
||||||
((flags & CPXF_NOZ) ||
|
((flags & CPXF_NOZ) ||
|
||||||
((ref->Z() > mo->Z() && ref->Top() < distance) ||
|
((ref->Z() > mo->Z() && ref->Z() - mo->Top() < distance) ||
|
||||||
(ref->Z() <= mo->Z() && mo->Z() - ref->Top() < distance))))
|
(ref->Z() <= mo->Z() && mo->Z() - ref->Top() < distance)))))
|
||||||
{
|
{
|
||||||
|
if ((flags & CPXF_CHECKSIGHT) && !(P_CheckSight(mo, ref, SF_IGNOREVISIBILITY | SF_IGNOREWATERBOUNDARY)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (ptrWillChange)
|
||||||
|
{
|
||||||
|
current = ref->AproxDistance(mo);
|
||||||
|
|
||||||
|
if ((flags & CPXF_CLOSEST) && (current < closer))
|
||||||
|
{
|
||||||
|
dist = mo;
|
||||||
|
closer = current; //This actor's closer. Set the new standard.
|
||||||
|
}
|
||||||
|
else if ((flags & CPXF_FARTHEST) && (current > farther))
|
||||||
|
{
|
||||||
|
dist = mo;
|
||||||
|
farther = current;
|
||||||
|
}
|
||||||
|
else if (!dist)
|
||||||
|
dist = mo; //Just get the first one and call it quits if there's nothing selected.
|
||||||
|
}
|
||||||
|
|
||||||
if (mo->flags6 & MF6_KILLED)
|
if (mo->flags6 & MF6_KILLED)
|
||||||
{
|
{
|
||||||
if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY)))
|
if (!(flags & (CPXF_COUNTDEAD | CPXF_DEADONLY)))
|
||||||
|
@ -6059,17 +6098,38 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity)
|
||||||
if (counter > count)
|
if (counter > count)
|
||||||
{
|
{
|
||||||
result = (flags & (CPXF_LESSOREQUAL | CPXF_EXACT)) ? false : true;
|
result = (flags & (CPXF_LESSOREQUAL | CPXF_EXACT)) ? false : true;
|
||||||
|
|
||||||
|
//However, if we have one SET* flag and either the closest or farthest flags, keep the function going.
|
||||||
|
if (ptrWillChange && ptrDistPref)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ptrWillChange && dist != NULL)
|
||||||
|
{
|
||||||
|
if (flags & CPXF_SETONPTR)
|
||||||
|
{
|
||||||
|
if (flags & CPXF_SETTARGET) ref->target = dist;
|
||||||
|
if (flags & CPXF_SETMASTER) ref->master = dist;
|
||||||
|
if (flags & CPXF_SETTRACER) ref->tracer = dist;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flags & CPXF_SETTARGET) self->target = dist;
|
||||||
|
if (flags & CPXF_SETMASTER) self->master = dist;
|
||||||
|
if (flags & CPXF_SETTRACER) self->tracer = dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (counter == count)
|
if (counter == count)
|
||||||
result = true;
|
result = true;
|
||||||
else if (counter < count)
|
else if (counter < count)
|
||||||
result = !!((flags & CPXF_LESSOREQUAL) && !(flags & CPXF_EXACT));
|
result = !!((flags & CPXF_LESSOREQUAL) && !(flags & CPXF_EXACT));
|
||||||
|
|
||||||
|
if (!jump) return;
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -498,6 +498,13 @@ enum
|
||||||
CPXF_COUNTDEAD = 1 << 3,
|
CPXF_COUNTDEAD = 1 << 3,
|
||||||
CPXF_DEADONLY = 1 << 4,
|
CPXF_DEADONLY = 1 << 4,
|
||||||
CPXF_EXACT = 1 << 5,
|
CPXF_EXACT = 1 << 5,
|
||||||
|
CPXF_SETTARGET = 1 << 6,
|
||||||
|
CPXF_SETMASTER = 1 << 7,
|
||||||
|
CPXF_SETTRACER = 1 << 8,
|
||||||
|
CPXF_FARTHEST = 1 << 9,
|
||||||
|
CPXF_CLOSEST = 1 << 10,
|
||||||
|
CPXF_SETONPTR = 1 << 11,
|
||||||
|
CPXF_CHECKSIGHT = 1 << 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for A_CheckBlock
|
// Flags for A_CheckBlock
|
||||||
|
|
Loading…
Reference in a new issue