Skip to content

Commit

Permalink
DMU API: Renamed DMU_BASE; removed DMU_LINE_COUNT, DMU_HEDGE_COUNT
Browse files Browse the repository at this point in the history
DMU_EMITTER is a better name for this property as it references the
sub-component of the relevant map element used for emitting sounds.

The presently unused DMU_LINE_COUNT and DMU_HEDGE_COUNT property
identifiers were removed as these set the wrong precedent for how
the linked objects of a map element should be enumerated.

If in future we have call to enumerate the linked objects of some
map element, this functionality should be implemented as a runtime
query (e.g., numlines = P_Countp(sectorPtr, DMU_LINE)).
  • Loading branch information
danij-deng committed Apr 30, 2013
1 parent 06cbfe8 commit 2f4b630
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 46 deletions.
4 changes: 1 addition & 3 deletions doomsday/api/dd_share.h
Expand Up @@ -396,7 +396,6 @@ enum {
DMU_OFFSET_XY,

DMU_VALID_COUNT,
DMU_LINE_COUNT,
DMU_COLOR, ///< RGB
DMU_COLOR_RED, ///< red component
DMU_COLOR_GREEN, ///< green component
Expand All @@ -406,12 +405,11 @@ enum {
DMU_LIGHT_LEVEL,
DMT_MOBJS, ///< pointer to start of sector mobjList
DMU_BOUNDING_BOX, ///< AABoxd
DMU_BASE,
DMU_EMITTER,
DMU_WIDTH,
DMU_HEIGHT,
DMU_TARGET_HEIGHT,
DMU_SPEED,
DMU_HEDGE_COUNT,
DMU_FLOOR_PLANE,
DMU_CEILING_PLANE
};
Expand Down
4 changes: 1 addition & 3 deletions doomsday/client/src/map/p_dmu.cpp
Expand Up @@ -123,7 +123,6 @@ char const *DMU_Str(uint prop)
{ DMU_OFFSET_XY, "DMU_OFFSET_XY" },
{ DMU_BLENDMODE, "DMU_BLENDMODE" },
{ DMU_VALID_COUNT, "DMU_VALID_COUNT" },
{ DMU_LINE_COUNT, "DMU_LINE_COUNT" },
{ DMU_COLOR, "DMU_COLOR" },
{ DMU_COLOR_RED, "DMU_COLOR_RED" },
{ DMU_COLOR_GREEN, "DMU_COLOR_GREEN" },
Expand All @@ -132,11 +131,10 @@ char const *DMU_Str(uint prop)
{ DMU_LIGHT_LEVEL, "DMU_LIGHT_LEVEL" },
{ DMT_MOBJS, "DMT_MOBJS" },
{ DMU_BOUNDING_BOX, "DMU_BOUNDING_BOX" },
{ DMU_BASE, "DMU_BASE" },
{ DMU_EMITTER, "DMU_EMITTER" },
{ DMU_WIDTH, "DMU_WIDTH" },
{ DMU_HEIGHT, "DMU_HEIGHT" },
{ DMU_TARGET_HEIGHT, "DMU_TARGET_HEIGHT" },
{ DMU_HEDGE_COUNT, "DMU_HEDGE_COUNT" },
{ DMU_SPEED, "DMU_SPEED" },
{ DMU_FLOOR_PLANE, "DMU_FLOOR_PLANE" },
{ DMU_CEILING_PLANE, "DMU_CEILING_PLANE" },
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/map/plane.cpp
Expand Up @@ -332,7 +332,7 @@ int Plane::property(setargs_t &args) const
{
switch(args.prop)
{
case DMU_BASE:
case DMU_EMITTER:
DMU_GetValue(DMT_PLANE_BASE, &d->soundEmitter, &args, 0);
break;
case DMU_SECTOR:
Expand Down
6 changes: 1 addition & 5 deletions doomsday/client/src/map/sector.cpp
Expand Up @@ -467,14 +467,10 @@ int Sector::property(setargs_t &args) const
case DMU_COLOR_BLUE:
DMU_GetValue(DMT_SECTOR_RGB, &_lightColor.z, &args, 0);
break;
case DMU_BASE: {
case DMU_EMITTER: {
ddmobj_base_t const *soundEmitterAdr = &d->soundEmitter;
DMU_GetValue(DMT_SECTOR_BASE, &soundEmitterAdr, &args, 0);
break; }
case DMU_LINE_COUNT: {
int val = lineCount();
DMU_GetValue(DDVT_INT, &val, &args, 0);
break; }
case DMT_MOBJS:
DMU_GetValue(DMT_SECTOR_MOBJLIST, &_mobjList, &args, 0);
break;
Expand Down
11 changes: 5 additions & 6 deletions doomsday/plugins/common/include/dmu_lib.h
Expand Up @@ -54,7 +54,7 @@
#define DMU_TOP_COLOR_RED (DMU_TOP_OF_SIDE | DMU_COLOR_RED)
#define DMU_TOP_COLOR_GREEN (DMU_TOP_OF_SIDE | DMU_COLOR_GREEN)
#define DMU_TOP_COLOR_BLUE (DMU_TOP_OF_SIDE | DMU_COLOR_BLUE)
#define DMU_TOP_BASE (DMU_TOP_OF_SIDE | DMU_BASE)
#define DMU_TOP_BASE (DMU_TOP_OF_SIDE | DMU_EMITTER)

#define DMU_MIDDLE_MATERIAL (DMU_MIDDLE_OF_SIDE | DMU_MATERIAL)
#define DMU_MIDDLE_MATERIAL_OFFSET_X (DMU_MIDDLE_OF_SIDE | DMU_OFFSET_X)
Expand All @@ -67,7 +67,7 @@
#define DMU_MIDDLE_COLOR_BLUE (DMU_MIDDLE_OF_SIDE | DMU_COLOR_BLUE)
#define DMU_MIDDLE_ALPHA (DMU_MIDDLE_OF_SIDE | DMU_ALPHA)
#define DMU_MIDDLE_BLENDMODE (DMU_MIDDLE_OF_SIDE | DMU_BLENDMODE)
#define DMU_MIDDLE_BASE (DMU_MIDDLE_OF_SIDE | DMU_BASE)
#define DMU_MIDDLE_BASE (DMU_MIDDLE_OF_SIDE | DMU_EMITTER)

#define DMU_BOTTOM_MATERIAL (DMU_BOTTOM_OF_SIDE | DMU_MATERIAL)
#define DMU_BOTTOM_MATERIAL_OFFSET_X (DMU_BOTTOM_OF_SIDE | DMU_OFFSET_X)
Expand All @@ -78,13 +78,13 @@
#define DMU_BOTTOM_COLOR_RED (DMU_BOTTOM_OF_SIDE | DMU_COLOR_RED)
#define DMU_BOTTOM_COLOR_GREEN (DMU_BOTTOM_OF_SIDE | DMU_COLOR_GREEN)
#define DMU_BOTTOM_COLOR_BLUE (DMU_BOTTOM_OF_SIDE | DMU_COLOR_BLUE)
#define DMU_BOTTOM_BASE (DMU_BOTTOM_OF_SIDE | DMU_BASE)
#define DMU_BOTTOM_BASE (DMU_BOTTOM_OF_SIDE | DMU_EMITTER)

#define DMU_FLOOR_HEIGHT (DMU_FLOOR_OF_SECTOR | DMU_HEIGHT)
#define DMU_FLOOR_TARGET_HEIGHT (DMU_FLOOR_OF_SECTOR | DMU_TARGET_HEIGHT)
#define DMU_FLOOR_SPEED (DMU_FLOOR_OF_SECTOR | DMU_SPEED)
#define DMU_FLOOR_MATERIAL (DMU_FLOOR_OF_SECTOR | DMU_MATERIAL)
#define DMU_FLOOR_BASE (DMU_FLOOR_OF_SECTOR | DMU_BASE)
#define DMU_FLOOR_BASE (DMU_FLOOR_OF_SECTOR | DMU_EMITTER)
#define DMU_FLOOR_FLAGS (DMU_FLOOR_OF_SECTOR | DMU_FLAGS)
#define DMU_FLOOR_COLOR (DMU_FLOOR_OF_SECTOR | DMU_COLOR)
#define DMU_FLOOR_COLOR_RED (DMU_FLOOR_OF_SECTOR | DMU_COLOR_RED)
Expand All @@ -110,7 +110,7 @@
#define DMU_CEILING_TARGET_HEIGHT (DMU_CEILING_OF_SECTOR | DMU_TARGET_HEIGHT)
#define DMU_CEILING_SPEED (DMU_CEILING_OF_SECTOR | DMU_SPEED)
#define DMU_CEILING_MATERIAL (DMU_CEILING_OF_SECTOR | DMU_MATERIAL)
#define DMU_CEILING_BASE (DMU_CEILING_OF_SECTOR | DMU_BASE)
#define DMU_CEILING_BASE (DMU_CEILING_OF_SECTOR | DMU_EMITTER)
#define DMU_CEILING_FLAGS (DMU_CEILING_OF_SECTOR | DMU_FLAGS)
#define DMU_CEILING_COLOR (DMU_CEILING_OF_SECTOR | DMU_COLOR)
#define DMU_CEILING_COLOR_RED (DMU_CEILING_OF_SECTOR | DMU_COLOR_RED)
Expand Down Expand Up @@ -259,7 +259,6 @@ float P_SectorLight(Sector* sector);
void P_SectorSetLight(Sector* sector, float level);
void P_SectorModifyLight(Sector* sector, float value);
void P_SectorModifyLightx(Sector* sector, fixed_t value);
void* P_SectorOrigin(Sector* sector);

void P_TranslateSideMaterialOrigin(Side* side, SideSection section, float deltaXY[2]);
void P_TranslateSideMaterialOriginXY(Side* side, SideSection section, float deltaX, float deltaY);
Expand Down
5 changes: 0 additions & 5 deletions doomsday/plugins/common/src/dmu_lib.c
Expand Up @@ -680,11 +680,6 @@ void P_SectorModifyLightx(Sector* sector, fixed_t value)
P_SetFloatp(sector, DMU_LIGHT_LEVEL, P_SectorLight(sector) + FIX2FLT(value) / 255.0f);
}

void* P_SectorOrigin(Sector* sec)
{
return P_GetPtrp(sec, DMU_BASE);
}

const terraintype_t* P_PlaneMaterialTerrainType(Sector* sec, int plane)
{
return P_TerrainTypeForMaterial(P_GetPtrp(sec, (plane? DMU_CEILING_MATERIAL : DMU_FLOOR_MATERIAL)));
Expand Down
8 changes: 4 additions & 4 deletions doomsday/plugins/common/src/p_ceiling.c
Expand Up @@ -132,7 +132,7 @@ void T_MoveCeiling(void *ceilingThinkerPtr)
if(res == pastdest)
{
#if __JHEXEN__
SN_StopSequence(P_SectorOrigin(ceiling->sector));
SN_StopSequence(P_GetPtrp(ceiling->sector, DMU_EMITTER));
#endif
switch(ceiling->type)
{
Expand Down Expand Up @@ -192,7 +192,7 @@ void T_MoveCeiling(void *ceilingThinkerPtr)
if(res == pastdest)
{
#if __JHEXEN__
SN_StopSequence(P_SectorOrigin(ceiling->sector));
SN_StopSequence(P_GetPtrp(ceiling->sector, DMU_EMITTER));
#endif
switch(ceiling->type)
{
Expand Down Expand Up @@ -431,7 +431,7 @@ static int EV_DoCeiling2(int tag, float basespeed, ceilingtype_e type)
#if __JHEXEN__
if(rtn)
{
SN_StartSequence(P_SectorOrigin(ceiling->sector),
SN_StartSequence(P_GetPtrp(ceiling->sector, DMU_EMITTER),
SEQ_PLATFORM + P_ToXSector(ceiling->sector)->seqType);
}
#endif
Expand Down Expand Up @@ -529,7 +529,7 @@ static int deactivateCeiling(thinker_t* th, void* context)
#if __JHEXEN__
if(ceiling->tag == (int) params->tag)
{ // Destroy it.
SN_StopSequence(P_SectorOrigin(ceiling->sector));
SN_StopSequence(P_GetPtrp(ceiling->sector, DMU_EMITTER));
stopCeiling(ceiling);
params->count++;
return true; // Stop iteration.
Expand Down
10 changes: 5 additions & 5 deletions doomsday/plugins/common/src/p_door.c
Expand Up @@ -139,7 +139,7 @@ void T_Door(void *doorThinkerPtr)
case DT_NORMAL:
door->state = DS_DOWN; // Time to go back down.
#if __JHEXEN__
SN_StartSequence(P_SectorOrigin(door->sector),
SN_StartSequence(P_GetPtrp(door->sector, DMU_EMITTER),
SEQ_DOOR_STONE + xsec->seqType);
#else
S_PlaneSound(P_GetPtrp(door->sector, DMU_CEILING_PLANE), SFX_DOORCLOSING);
Expand Down Expand Up @@ -187,7 +187,7 @@ void T_Door(void *doorThinkerPtr)
if(res == pastdest)
{
#if __JHEXEN__
SN_StopSequence(P_SectorOrigin(door->sector));
SN_StopSequence(P_GetPtrp(door->sector, DMU_EMITTER));
#endif
switch(door->type)
{
Expand Down Expand Up @@ -267,7 +267,7 @@ void T_Door(void *doorThinkerPtr)
if(res == pastdest)
{
#if __JHEXEN__
SN_StopSequence(P_SectorOrigin(door->sector));
SN_StopSequence(P_GetPtrp(door->sector, DMU_EMITTER));
#endif
switch(door->type)
{
Expand Down Expand Up @@ -422,7 +422,7 @@ static int EV_DoDoor2(int tag, float speed, int topwait, doortype_e type)

// Play a sound?
#if __JHEXEN__
SN_StartSequence(P_SectorOrigin(door->sector), sound);
SN_StartSequence(P_GetPtrp(door->sector, DMU_EMITTER), sound);
#else
if(sound)
S_PlaneSound(P_GetPtrp(door->sector, DMU_CEILING_PLANE), sound);
Expand Down Expand Up @@ -761,7 +761,7 @@ boolean EV_VerticalDoor(Line* line, mobj_t* mo)

// Play a sound?
#if __JHEXEN__
SN_StartSequence(P_SectorOrigin(door->sector),
SN_StartSequence(P_GetPtrp(door->sector, DMU_EMITTER),
SEQ_DOOR_STONE + P_ToXSector(door->sector)->seqType);
#else
switch(xline->special)
Expand Down
8 changes: 4 additions & 4 deletions doomsday/plugins/common/src/p_floor.c
Expand Up @@ -370,7 +370,7 @@ void T_MoveFloor(void *floorThinkerPtr)
P_SetFloatp(floor->sector, DMU_FLOOR_SPEED, 0);

#if __JHEXEN__
SN_StopSequence(P_GetPtrp(floor->sector, DMU_BASE));
SN_StopSequence(P_GetPtrp(floor->sector, DMU_EMITTER));
#else
# if __JHERETIC__
if(floor->type == FT_RAISEBUILDSTEP)
Expand Down Expand Up @@ -941,7 +941,7 @@ int EV_DoFloor(Line* line, floortype_e floortype)
#if __JHEXEN__
if(rtn && floor)
{
SN_StartSequence(P_GetPtrp(floor->sector, DMU_BASE),
SN_StartSequence(P_GetPtrp(floor->sector, DMU_EMITTER),
SEQ_PLATFORM + P_ToXSector(floor->sector)->seqType);
}
#endif
Expand Down Expand Up @@ -1223,7 +1223,7 @@ static void processStairSector(Sector* sec, int type, coord_t height,
break;
}

SN_StartSequence(P_GetPtrp(sec, DMU_BASE),
SN_StartSequence(P_GetPtrp(sec, DMU_EMITTER),
SEQ_PLATFORM + P_ToXSector(sec)->seqType);

params.type = type;
Expand Down Expand Up @@ -1404,7 +1404,7 @@ static int stopFloorCrush(thinker_t* th, void* context)
if(floor->type == FT_RAISEFLOORCRUSH)
{
// Completely remove the crushing floor
SN_StopSequence(P_GetPtrp(floor->sector, DMU_BASE));
SN_StopSequence(P_GetPtrp(floor->sector, DMU_EMITTER));
P_ToXSector(floor->sector)->specialData = NULL;
P_TagFinished(P_ToXSector(floor->sector)->tag);
Thinker_Remove(&floor->thinker);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/p_saveg.cpp
Expand Up @@ -4785,7 +4785,7 @@ static void readSoundSequences()
mobj_t *sndMobj = 0;
if(!polySnd)
{
sndMobj = (mobj_t*)P_GetPtr(DMU_SECTOR, secNum, DMU_BASE);
sndMobj = (mobj_t*)P_GetPtr(DMU_SECTOR, secNum, DMU_EMITTER);
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions doomsday/plugins/common/src/p_sound.c
Expand Up @@ -67,7 +67,7 @@ void S_SectorSound(Sector* sec, int id)
if(!sec) return;

S_SectorStopSounds(sec);
S_StartSound(id, (mobj_t*) P_GetPtrp(sec, DMU_BASE));
S_StartSound(id, (mobj_t*) P_GetPtrp(sec, DMU_EMITTER));
}

void S_SectorStopSounds(Sector* sec)
Expand All @@ -76,15 +76,15 @@ void S_SectorStopSounds(Sector* sec)

// Stop other sounds playing from origins in this sector.
/// @todo Add a compatibility option allowing origins to work independently?
S_StopSound2(0, (mobj_t*) P_GetPtrp(sec, DMU_BASE), SSF_ALL_SECTOR);
S_StopSound2(0, (mobj_t*) P_GetPtrp(sec, DMU_EMITTER), SSF_ALL_SECTOR);
}

void S_PlaneSound(Plane* pln, int id)
{
if(!pln) return;

S_SectorStopSounds((Sector*) P_GetPtrp(pln, DMU_SECTOR));
S_StartSound(id, (mobj_t*) P_GetPtrp(pln, DMU_BASE));
S_StartSound(id, (mobj_t*) P_GetPtrp(pln, DMU_EMITTER));
}

#ifdef __JHEXEN__
Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/hexen/src/p_acs.c
Expand Up @@ -1673,7 +1673,7 @@ static int CmdSectorSound(void)
if(ACScript->line)
{
Sector *front = P_GetPtrp(ACScript->line, DMU_FRONT_SECTOR);
mobj = P_GetPtrp(front, DMU_BASE);
mobj = P_GetPtrp(front, DMU_EMITTER);
}
volume = Pop();

Expand Down Expand Up @@ -1736,7 +1736,7 @@ static int CmdSoundSequence(void)
Sector* front =
P_GetPtrp(ACScript->line, DMU_FRONT_SECTOR);

mobj = P_GetPtrp(front, DMU_BASE);
mobj = P_GetPtrp(front, DMU_EMITTER);
}
SN_StartSequenceName(mobj, GetACString(Pop()));

Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/hexen/src/p_pillar.c
Expand Up @@ -137,7 +137,7 @@ int EV_BuildPillar(Line* line, byte* args, boolean crush)
pillar->ceilingDest = newHeight;
pillar->direction = 1;
pillar->crush = crush * (int) args[3];
SN_StartSequence(P_GetPtrp(pillar->sector, DMU_BASE),
SN_StartSequence(P_GetPtrp(pillar->sector, DMU_EMITTER),
SEQ_PLATFORM + P_ToXSector(pillar->sector)->seqType);
}
return rtn;
Expand Down Expand Up @@ -210,7 +210,7 @@ int EV_OpenPillar(Line* line, byte* args)
}

pillar->direction = -1; // Open the pillar.
SN_StartSequence(P_GetPtrp(pillar->sector, DMU_BASE),
SN_StartSequence(P_GetPtrp(pillar->sector, DMU_EMITTER),
SEQ_PLATFORM + P_ToXSector(pillar->sector)->seqType);
}

Expand Down
4 changes: 2 additions & 2 deletions doomsday/plugins/hexen/src/sn_sonix.c
Expand Up @@ -304,13 +304,13 @@ void SN_StartSequence(mobj_t* mobj, int sequence)

void SN_StartSequenceInSec(Sector* sector, int seqBase)
{
SN_StartSequence(P_GetPtrp(sector, DMU_BASE),
SN_StartSequence(P_GetPtrp(sector, DMU_EMITTER),
seqBase + P_ToXSector(sector)->seqType);
}

void SN_StopSequenceInSec(Sector* sector)
{
SN_StopSequence(P_GetPtrp(sector, DMU_BASE));
SN_StopSequence(P_GetPtrp(sector, DMU_EMITTER));
}

void SN_StartSequenceName(mobj_t* mobj, const char* name)
Expand Down

0 comments on commit 2f4b630

Please sign in to comment.