Example #1
0
int KillBreakSprite(short BreakSprite)
    {
    SPRITEp bp = &sprite[BreakSprite];
    USERp bu = User[BreakSprite];
    short i;
    
    // Does not actually kill the sprite so it will be valid for the rest
    // of the loop traversal. 
    
    // IMPORTANT: Do not change the statnum if possible so that NEXTI in 
    // SpriteControl loop traversals will maintain integrity.
    
    SpriteQueueDelete(BreakSprite);
    
    if (bu)
        {
        if (bp->statnum == STAT_DEFAULT)
            // special case allow kill of sprites on STAT_DEFAULT list
            // a few things have users and are not StateControlled
            KillSprite(BreakSprite); 
        else
            SetSuicide(BreakSprite);
        }
    else
        {
        change_sprite_stat(BreakSprite, STAT_SUICIDE);
        }
    
    return(0);    
    }
Example #2
0
void CCursorMgr::UseCursor(LTBOOL bUseCursor, LTBOOL bLockCursorToCenter)
{
	m_bUseCursor = bUseCursor;

	// New hardware code:
	// if the cursor is visible and being used, ONLY enable the hardware
	// cursor if no sprite has been specified
	if (m_bUseCursor && m_bUseHardwareCursor && !m_pCursorSprite)
	{
		g_pLTClient->Cursor()->SetCursorMode(CM_Hardware);
		// copied the following 4 lines from Init()
		if (g_pLTClient->Cursor()->SetCursor(m_hCursor) != LT_OK)
		{
			g_pLTClient->CPrint("can't set cursor.");
		}
	}
	else
	{
        g_pLTClient->Cursor()->SetCursorMode(CM_None);
		
		// Kill any cursor sprite
		KillSprite();
	}

	// Lock or don't lock the cursor to the center of the screen
	if(bLockCursorToCenter)
	{
		g_pLTClient->RunConsoleString("CursorCenter 1");
	}
	else
	{
		g_pLTClient->RunConsoleString("CursorCenter 0");
	}
}
Example #3
0
static void DoWallBreakSpriteMatch ( short match )
{
    short i, nexti;
    TRAVERSE_SPRITE_STAT ( headspritestat[STAT_ENEMY], i, nexti )
    {
        SPRITEp sp = &sprite[i];
        
        if ( sp->hitag == match )
        {
            KillSprite ( i );
        }
    }
Example #4
0
void CopySectorMatch(short match)
    {
    short ed,nexted,ss,nextss;
    SPRITEp dest_sp, src_sp;
    SECTORp dsectp,ssectp;
    short kill, nextkill;
    SPRITEp k;
    
    TRAVERSE_SPRITE_STAT(headspritestat[STAT_COPY_DEST], ed, nexted)    
        {
        dest_sp = &sprite[ed];
        dsectp = &sector[dest_sp->sectnum];

        if (match != sprite[ed].lotag)
            continue;
        
        TRAVERSE_SPRITE_STAT(headspritestat[STAT_COPY_SOURCE], ss, nextss)    
            {
            src_sp = &sprite[ss];
            
            if (SP_TAG2(src_sp) == SPRITE_TAG2(ed) &&
                SP_TAG3(src_sp) == SPRITE_TAG3(ed))
                {
                short src_move, nextsrc_move;
                ssectp = &sector[src_sp->sectnum];
                
                // !!!!!AAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH
                // Don't kill anything you don't have to
                // this wall killing things on a Queue causing
                // invalid situations
                    
                #if 1
                // kill all sprites in the dest sector that need to be
                TRAVERSE_SPRITE_SECT(headspritesect[dest_sp->sectnum], kill, nextkill)    
                    {
                    k = &sprite[kill];
                    
                    // kill anything not invisible
                    if (!TEST(k->cstat, CSTAT_SPRITE_INVISIBLE))
                        {
                        if (User[kill])
                            {
                            // be safe with the killing
                            //SetSuicide(kill);
                            }
                        else
                            {    
                            SpriteQueueDelete(kill); // new function to allow killing - hopefully
                            KillSprite(kill);
                            }
                        }
                    }
Example #5
0
void CCursorMgr::UseSprite(CScreenSprite * pSprite)
{
	if (m_pCursorSprite == pSprite)
		return;

	KillSprite();

	if (!pSprite)
	{
		return;
	}


	// See if this sprite is in our list.
	ScreenSpriteArray::iterator iter = m_SpriteArray.begin();
	while (iter != m_SpriteArray.end())
	{
		// If it is, then set it to "active"
		if (!strcmpi((*iter)->GetName(), pSprite->GetName()))
		{
			m_pCursorSprite = *iter;
			m_pCursorSprite->SetCenter(m_CursorCenter);
			m_pCursorSprite->Show(LTTRUE);
			UseHardwareCursor(LTFALSE);
			return;
		}
		iter++;
	}

	// This sprite has not been used before.  Add it to our local array
	// ABM 2/20/02 TWEAK add a new sprite that is a DUPLICATE of the one passed in
	CScreenSprite * pNewSprite = g_pScreenSpriteMgr->CreateScreenSprite(pSprite->GetName(), LTFALSE, SPRITELAYER_CURSOR_FOREGROUND);
	_ASSERT(pNewSprite != LTNULL);
	if (!pNewSprite)
		return;

	// Default center coordinates
	pNewSprite->SetCenter(m_CursorCenter);
	pNewSprite->Show(LTTRUE);
	m_SpriteArray.push_back(pNewSprite);
	m_pCursorSprite = pNewSprite;
	UseHardwareCursor(LTFALSE);
}
Example #6
0
void CCursorMgr::UseSprite(char * pFile)
{
	KillSprite();

	// if pFile is null, just turn the sprite off and set the pointer to null
	if (!pFile)
		return;

	// See if this sprite is in the list
	ScreenSpriteArray::iterator iter = m_SpriteArray.begin();
	while (iter != m_SpriteArray.end())
	{
		// If it is, then set it to "active"
		if (!strcmpi(pFile, (*iter)->GetName()))
		{
			m_pCursorSprite = *iter;
			m_pCursorSprite->Show(LTTRUE);
			m_pCursorSprite->SetCenter(m_CursorCenter);
			UseHardwareCursor(LTFALSE);
			return;
		}
		iter++;
	}

	// No sprite exists, so create one using this file name
	CScreenSprite * pSprite = g_pScreenSpriteMgr->CreateScreenSprite(pFile, LTFALSE, SPRITELAYER_CURSOR_FOREGROUND);
	_ASSERT(pSprite != LTNULL);

	if (!pSprite)
		return;

	// Default center coordinates
	pSprite->SetCenter(m_CursorCenter);
	pSprite->Show(LTTRUE);
	m_SpriteArray.push_back(pSprite);
	m_pCursorSprite = pSprite;
	UseHardwareCursor(LTFALSE);
}
Example #7
0
int AutoBreakWall(WALLp wallp, long hitx, long hity, long hitz, short ang, short type)
    {
    BREAK_INFOp break_info;
    short BreakSprite;
    WALLp nwp;
    SPRITEp bsp;
    
    //DSPRINTF(ds,"wallnum %d, pic %d, lo %d, hi %d",wallp-wall, wallp->picnum, wallp->lotag, wallp->hitag);
    MONO_PRINT(ds);
    
    wallp->lotag = 0;
    if (wallp->nextwall >= 0)
        {
        nwp = &wall[wallp->nextwall];

        // get rid of both sides
        // only break ONE of the walls

        if (nwp->lotag == TAG_WALL_BREAK &&
            nwp->overpicnum > 0 &&
            TEST(nwp->cstat, CSTAT_WALL_MASKED))
            {
            nwp->lotag = 0;
            }
        }
    
    if (wallp->overpicnum > 0 && TEST(wallp->cstat, CSTAT_WALL_MASKED))    
        break_info = FindWallBreakInfo(wallp->overpicnum);
    else    
        break_info = FindWallBreakInfo(wallp->picnum);
        
    if (!break_info)    
        {
        //DSPRINTF(ds,"Break Info not found - wall %d", wallp - wall);
        MONO_PRINT(ds);
        
        return(FALSE);
        }
    
    // Check to see if it should break with current weapon type
    if(!CheckBreakToughness(break_info, type)) return(FALSE);

    if (hitx != MAXLONG)    
        {
        // need correct location for spawning shrap
        BreakSprite = COVERinsertsprite(0, STAT_DEFAULT);
        ASSERT(BreakSprite >= 0);
        bsp = &sprite[BreakSprite];
        bsp->cstat = 0;
        bsp->extra = 0;
        bsp->ang = ang;
        bsp->picnum = ST1;
        bsp->xrepeat = bsp->yrepeat = 64;
        setsprite(BreakSprite, hitx, hity, hitz);
        
        // pass Break Info Globally
        GlobBreakInfo = break_info;
        SpawnShrap(BreakSprite, -1);
        GlobBreakInfo = NULL;
        
        KillSprite(BreakSprite);
        }
    
    // change the wall
    if (wallp->overpicnum > 0 && TEST(wallp->cstat, CSTAT_WALL_MASKED))    
        {
        if (break_info->breaknum == -1)
            {
            RESET(wallp->cstat, CSTAT_WALL_MASKED|CSTAT_WALL_1WAY|CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK);
            wallp->overpicnum = 0;
            if (wallp->nextwall >= 0)
                {
                nwp = &wall[wallp->nextwall];
                RESET(nwp->cstat, CSTAT_WALL_MASKED|CSTAT_WALL_1WAY|CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK);
                nwp->overpicnum = 0;
                }
            }
        else
            {
            RESET(wallp->cstat, CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK);
            wallp->overpicnum = break_info->breaknum;
            if (wallp->nextwall >= 0)
                {
                nwp = &wall[wallp->nextwall];
                RESET(nwp->cstat, CSTAT_WALL_BLOCK_HITSCAN|CSTAT_WALL_BLOCK);
                nwp->overpicnum = break_info->breaknum;
                }
            }    
        }
    else    
        {
        if (break_info->breaknum == -1)
            wallp->picnum = 594; // temporary break pic
        else
            {
            wallp->picnum = break_info->breaknum;
            if( wallp->hitag < 0)    
                DoWallBreakSpriteMatch( wallp->hitag );
            }    
        }    
        
    
    return(TRUE);    
    }