Skip to content

Commit

Permalink
Converted the new spechit list implementation into a line list object…
Browse files Browse the repository at this point in the history
…. A linelist can now be used to replace the other playsim, line_t* array fixed size limits such as MAXBUTTONs, MAXLINEANIMS etc, etc.
  • Loading branch information
danij committed Sep 17, 2006
1 parent c2187af commit e3e70bc
Show file tree
Hide file tree
Showing 34 changed files with 327 additions and 180 deletions.
2 changes: 1 addition & 1 deletion doomsday/build/win32/doom64tc_cl.rsp
Expand Up @@ -31,7 +31,7 @@
./../../plugins/doom64tc/src/p_plats.c
./../../plugins/doom64tc/src/p_mobj.c
./../../plugins/doom64tc/src/p_maputl.c
./../../plugins/common/src/p_spechit.c
./../../plugins/common/src/p_linelist.c
./../../plugins/common/src/p_map.c
./../../plugins/doom64tc/src/p_lights.c
./../../plugins/doom64tc/src/p_inter.c
Expand Down
2 changes: 1 addition & 1 deletion doomsday/build/win32/jdoom_cl.rsp
Expand Up @@ -32,7 +32,7 @@
./../../plugins/jdoom/src/p_oldsvg.c
./../../plugins/jdoom/src/p_mobj.c
./../../plugins/jdoom/src/p_maputl.c
./../../plugins/common/src/p_spechit.c
./../../plugins/common/src/p_linelist.c
./../../plugins/common/src/p_map.c
./../../plugins/jdoom/src/p_lights.c
./../../plugins/jdoom/src/p_inter.c
Expand Down
2 changes: 1 addition & 1 deletion doomsday/build/win32/jheretic_cl.rsp
Expand Up @@ -33,7 +33,7 @@
./../../plugins/jheretic/src/p_oldsvg.c
./../../plugins/jheretic/src/p_mobj.c
./../../plugins/jheretic/src/p_maputl.c
./../../plugins/common/src/p_spechit.c
./../../plugins/common/src/p_linelist.c
./../../plugins/common/src/p_map.c
./../../plugins/jheretic/src/p_lights.c
./../../plugins/jheretic/src/p_inter.c
Expand Down
2 changes: 1 addition & 1 deletion doomsday/build/win32/jhexen_cl.rsp
Expand Up @@ -31,7 +31,7 @@
./../../plugins/jhexen/src/p_plats.c
./../../plugins/jhexen/src/p_mobj.c
./../../plugins/jhexen/src/p_maputl.c
./../../plugins/common/src/p_spechit.c
./../../plugins/common/src/p_linelist.c
./../../plugins/common/src/p_map.c
./../../plugins/jhexen/src/p_lights.c
./../../plugins/jhexen/src/p_inter.c
Expand Down
2 changes: 1 addition & 1 deletion doomsday/build/win32/wolftc_cl.rsp
Expand Up @@ -31,7 +31,7 @@
./../../plugins/wolftc/src/p_plats.c
./../../plugins/wolftc/src/p_mobj.c
./../../plugins/wolftc/src/p_maputl.c
./../../plugins/common/src/p_spechit.c
./../../plugins/common/src/p_linelist.c
./../../plugins/common/src/p_map.c
./../../plugins/wolftc/src/p_lights.c
./../../plugins/wolftc/src/p_inter.c
Expand Down
28 changes: 19 additions & 9 deletions doomsday/plugins/common/include/p_spechit.h
Expand Up @@ -19,17 +19,27 @@
* Compiles for jDoom/jHeretic/jHexen/WolfTC
*/

#ifndef __COMMON_SPECHIT_H__
#define __COMMON_SPECHIT_H__
#ifndef __COMMON_LINELIST_H__
#define __COMMON_LINELIST_H__

#include "dd_api.h"

int P_AddLineToSpecHit(line_t *ld);
line_t* P_PopSpecHit(void);
line_t* P_SpecHitIterator(void);
void P_SpecHitResetIterator(void);
void P_EmptySpecHit(void);
int P_SpecHitSize(void);
void P_FreeSpecHit(void);
typedef struct linelist_s {
line_t **list;
int max;
int count;
int rover; // used during iteration
} linelist_t;

linelist_t *P_CreateLineList(void);
void P_DestroyLineList(linelist_t *list);

int P_AddLineToLineList(linelist_t *list, line_t *ld);
line_t *P_PopLineList(linelist_t *list);

line_t *P_LineListIterator(linelist_t *list);
void P_LineListResetIterator(linelist_t *list);

void P_EmptyLineList(linelist_t *list);
int P_LineListSize(linelist_t *list);
#endif
10 changes: 7 additions & 3 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -478,9 +478,10 @@ void G_PreInit(void)
DetectIWADs();
}

/*
* Common Post Engine Initialization routine.
* Game-specific post init actions should be placed in eg D_PostInit() (for jDoom)
/**
* Common Post Engine Initialization routine.
* Game-specific post init actions should be placed in eg D_PostInit()
* (for jDoom) and NOT here.
*/
void G_PostInit(void)
{
Expand Down Expand Up @@ -509,6 +510,9 @@ void G_PostInit(void)

Con_Message("MN_Init: Init miscellaneous info.\n");
MN_Init();

// Create the various line lists (spechits, anims, buttons etc).
spechit = P_CreateLineList();
}

/*
Expand Down
27 changes: 14 additions & 13 deletions doomsday/plugins/common/src/p_map.c
Expand Up @@ -37,7 +37,7 @@
#include "d_net.h"
#include "g_common.h"
#include "dmu_lib.h"
#include "p_spechit.h"
#include "p_linelist.h"

// MACROS ------------------------------------------------------------------

Expand Down Expand Up @@ -236,7 +236,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, boolean alwaysstomp)
tmfloorpic = P_GetIntp(newsubsec, DMU_FLOOR_TEXTURE);

validCount++;
P_EmptySpecHit();
P_EmptyLineList(spechit);

// stomp on any things contacted
P_PointToBlock(tmbbox[BOXLEFT] - MAXRADIUS, tmbbox[BOXBOTTOM] - MAXRADIUS,
Expand Down Expand Up @@ -768,7 +768,7 @@ static boolean PIT_CheckThing(mobj_t *thing, void *data)
if(thing->dplayer)
thing->dplayer->flags |= DDPF_FIXMOM;
}
P_EmptySpecHit();
P_EmptyLineList(spechit);
return true;
}

Expand Down Expand Up @@ -902,7 +902,7 @@ static boolean PIT_CheckLine(line_t *ld, void *data)
if(tmthing->flags & MF_MISSILE)
{ // Missiles can trigger impact specials
if(P_XLine(ld)->special)
P_AddLineToSpecHit(ld);
P_AddLineToLineList(spechit, ld);
}
return false;
}
Expand Down Expand Up @@ -980,7 +980,8 @@ static boolean PIT_CheckLine(line_t *ld, void *data)

// if contacted a special line, add it to the list
if(P_XLine(ld)->special)
P_AddLineToSpecHit(ld);
P_AddLineToLineList(spechit, ld);

#if !__JHEXEN__
tmthing->wallhit = false;
#endif
Expand Down Expand Up @@ -1050,7 +1051,7 @@ boolean P_CheckPosition2(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
tmfloorpic = P_GetIntp(newsec, DMU_FLOOR_TEXTURE);

validCount++;
P_EmptySpecHit();
P_EmptyLineList(spechit);

#if __JHEXEN__
if((tmthing->flags & MF_NOCLIP) && !(tmthing->flags & MF_SKULLFLY))
Expand Down Expand Up @@ -1335,7 +1336,7 @@ static boolean P_TryMove2(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff)
// if any special lines were hit, do the effect
if(!(thing->flags & (MF_TELEPORT | MF_NOCLIP)))
{
while((ld = P_PopSpecHit()) != NULL)
while((ld = P_PopLineList(spechit)) != NULL)
{
// see if the line was crossed
if(P_XLine(ld)->special)
Expand Down Expand Up @@ -1376,8 +1377,8 @@ static boolean P_TryMove2(mobj_t *thing, fixed_t x, fixed_t y, boolean dropoff)
P_DamageMobj(tmthing, NULL, NULL, tmthing->info->mass >> 5);
}

P_SpecHitResetIterator();
while((ld = P_SpecHitIterator()) != NULL)
P_LineListResetIterator(spechit);
while((ld = P_LineListIterator(spechit)) != NULL)
{
// see if the line was crossed
side = P_PointOnLineSide(thing->pos[VX], thing->pos[VY], ld);
Expand Down Expand Up @@ -2535,16 +2536,16 @@ boolean P_TestMobjLocation(mobj_t *mobj)
static void CheckMissileImpact(mobj_t *mobj)
{
line_t* ld;
int size = P_SpecHitSize();
int size = P_LineListSize(spechit);

if(!size || !(mobj->flags & MF_MISSILE) || !mobj->target)
return;

if(!mobj->target->player)
return;

P_SpecHitResetIterator();
while((ld = P_SpecHitIterator()) != NULL)
P_LineListResetIterator(spechit);
while((ld = P_LineListIterator(spechit)) != NULL)
P_ActivateLine(ld, mobj->target, 0, SPAC_IMPACT);
}
#endif
Expand Down Expand Up @@ -2658,7 +2659,7 @@ mobj_t *P_CheckOnmobj(mobj_t *thing)
tmfloorpic = P_GetIntp(newsubsec, DMU_FLOOR_TEXTURE);

validCount++;
P_EmptySpecHit();
P_EmptyLineList(spechit);

if(tmthing->flags & MF_NOCLIP)
return NULL;
Expand Down

0 comments on commit e3e70bc

Please sign in to comment.