Ejemplo n.º 1
0
void CK6_MapCliffCol(CK_object *a, CK_object *b)
{
  if (b->type == CT_Player)
  {
    if (ck_gameState.ep.ck6.rope == 0)
    {
      CA_CacheGrChunk(0x23);

      US_CenterWindow(26, 8);
      VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
      US_SetWindowW(US_GetWindowW() - 0x30);
      US_SetPrintY(US_GetPrintY() + 15);
      US_CPrint("What a tall cliff!\n"
                "Wish I had a rope\n"
                "and grappling hook.\n");
      VL_Present();
      SD_PlaySound(SOUND_NEEDKEYCARD);
      VL_DelayTics(30); // VW_WaitVBL(30);
      IN_ClearKeysDown();
      IN_WaitButton();
      RF_ForceRefresh();
      ck_nextX = -b->deltaPosX;
      ck_nextY = -b->deltaPosY;
      b->xDirection = b->yDirection = IN_motion_None;
      CK_PhysUpdateNormalObj(b);

    }
    else if (ck_gameState.ep.ck6.rope == 1)
    {
      ck_gameState.ep.ck6.rope++;
      SD_PlaySound(SOUND_KEENTHROWROPE);
      CK_SetAction2(b, CK_GetActionByName("CK6_ACT_MapKeenThrowRope0"));
      b->type = CT_Friendly;
    }
    else if (ck_gameState.ep.ck6.rope == 2)
    {
      if (a->user1)
      {
        b->posY += 0x40;
        b->user4 = 6;
        b->yDirection = IN_motion_Down;
      }
      else
      {
        b->posY -= 0x40;
        b->user4 = 6;
        b->yDirection = IN_motion_Up;
      }

      CK_SetAction(b, CK_GetActionByName("CK6_ACT_MapKeenClimbRope0"));
      b->type = CT_Friendly;
    }
  }
}
Ejemplo n.º 2
0
void T_DoDamage (objtype *ob)
{
	id0_int_t	points;


	if (!CheckHandAttack (ob))
	{
		SD_PlaySound (MONSTERMISSSND);
	}
	else
	{
		points = 0;

		switch (ob->obclass)
		{
		case orcobj:
			points = 4;
			break;
		case trollobj:
			points = 8;
			break;
		case demonobj:
			points = 15;
			break;
		}
		TakeDamage (points);
	}

	ob->state = ob->state->next;
}
Ejemplo n.º 3
0
void CK6_BloogguardSmash(CK_object *obj)
{
  SD_PlaySound(SOUND_BLOOGGUARDSMASH);
  ck6_smashScreenDistance = 25;
  if (ck_keenObj->topTI)
    CK_SetAction2(ck_keenObj, CK_GetActionByName("CK6_ACT_keenStunned0"));
}
Ejemplo n.º 4
0
void CK6_BloogletCol(CK_object *a, CK_object *b)
{
  if (b->type == CT_Player && b->currentAction->collide)
  {
    ck_keenIgnoreVertClip = true;
    CK_PhysPushX(b, a);
    ck_keenIgnoreVertClip = false;
  }
  else if (b->type == CT_Stunner)
  {
    int color = a->user1 & 3;
    if (a->user1 > 3)
    {
      CK_object *gem = CK_GetNewObj(false);
      gem->clipped = CLIP_normal;
      gem->zLayer = PRIORITIES - 2;
      gem->type = CT6_Item;
      gem->posX = a->posX;
      gem->posY = a->posY;
      gem->yDirection = IN_motion_Up;
      gem->velY = -40;
      gem->user1 = color;
      gem->user2 = gem->gfxChunk = *CK_ItemSpriteChunks[color];
      gem->user3 = gem->user2 + 2;
      CK_SetAction(gem, CK_GetActionByName("CK_ACT_fallingitem"));
      SD_PlaySound(SOUND_BLOOGLETGEM);
    }

    CK_StunCreature(a, b, CK_GetActionByName(stunnedBloogletActions[color]));
  }
}
Ejemplo n.º 5
0
void TakeDamage (int points,AActor *attacker)
{
	LastAttacker = attacker;

	if (gamestate.victoryflag)
		return;
	points = (points*gamestate.difficulty->DamageFactor)>>FRACBITS;

	if (!godmode)
		players[0].mo->health = players[0].health -= points;

	if (players[0].health<=0)
	{
		players[0].mo->Die();
		players[0].health = 0;
		playstate = ex_died;
		players[0].killerobj = attacker;
	}

	if (godmode != 2)
		StartDamageFlash (points);

	if (points > 0)
		SD_PlaySound("player/pain");

	StatusBar->UpdateFace(points);
	StatusBar->DrawStatusBar();
}
Ejemplo n.º 6
0
void CK6_BipshipFly(CK_object *obj)
{
	CK_PhysAccelHorz(obj, obj->xDirection, 20);
	int xdir = obj->xDirection;
	int ycheck = ck_keenObj->clipRects.unitY2 + 0x100 - obj->clipRects.unitY2;
	if (ycheck <= 0x200 && ycheck >= 0)
	{
		// Fire!!
		xdir = (ck_keenObj->posX < obj->posX) ? IN_motion_Left : IN_motion_Right;
		if (obj->xDirection == xdir && US_RndT() < SD_GetSpriteSync() * 2)
		{
			SD_PlaySound(SOUND_KEENSHOOT);
			CK_object *shot = CK_GetNewObj(true);
			shot->type = CT6_EnemyShot;
			shot->active = OBJ_EXISTS_ONLY_ONSCREEN;
			shot->zLayer = PRIORITIES - 3;
			if (obj->xDirection == IN_motion_Right)
			{
				shot->posX = obj->posX + 0x100;
				shot->velX = 64;
			}
			else
			{
				shot->posX = obj->posX;
				shot->velX = -64;
			}

			shot->posY = obj->posY + 0xA0;
			shot->velY = 16;
			CK_SetAction(shot, CK_GetActionByName("CK6_ACT_BipShot0"));
		}
	}

	int startx = obj->clipRects.tileXmid + 2 * xdir;
	int y = obj->clipRects.tileY1;
	uint16_t *tile = CA_TilePtrAtPos(startx, y, 1);

	for (y; y <= obj->clipRects.tileY2; y++, tile += CA_GetMapWidth())
	{
		if (TI_ForeLeft(*tile) || TI_ForeRight(*tile))
		{
			xdir = -xdir;
			goto checkTurn;
		}
	}

	// And turn around at ledge-ends
	if (!TI_ForeTop(*tile))
		xdir = -xdir;

checkTurn:

	if (obj->xDirection != xdir)
	{
		obj->xDirection = xdir;
		CK_SetAction2(obj, CK_GetActionByName("CK6_ACT_BipshipTurn0"));
	}
}
Ejemplo n.º 7
0
/*
=============================================================================

										SMALL SOUND

=============================================================================
*/
void SmallSound (objtype *ob)
{
	if (ob->temp1 != SOUNDPLAYED)
	{
		SD_PlaySound(SMALLMONSTERSND);
		ob->temp1 = SOUNDPLAYED;

	}
}
Ejemplo n.º 8
0
/*
=============================================================================

										LARGE SOUND

=============================================================================
*/
void LargeSound (objtype *ob)
{
	if (ob->temp1 != SOUNDPLAYED)
	{
		SD_PlaySound(LARGEMONSTERSND);
		ob->temp1 = SOUNDPLAYED;

	}
}
Ejemplo n.º 9
0
static bool ShowCast(CastIntermissionAction *cast)
{
	ClearStatusbar();
	DrawCastName(cast);

	SD_PlaySound(cast->Class->GetDefault()->seesound);
	const Frame *frame = cast->Class->FindState(NAME_See);
	return R_CastZoomer(frame, cast);
}
Ejemplo n.º 10
0
void GiveExtraMan (int amount)
{
	players[0].lives += amount;
	if (players[0].lives < 0)
		players[0].lives = 0;
	else if(players[0].lives > 9)
		players[0].lives = 9;
	SD_PlaySound ("misc/1up");
}
Ejemplo n.º 11
0
void CK6_BipCol(CK_object *a, CK_object *b)
{
	if (b->type == CT_Player && b->deltaPosY == 0)
	{
		SD_PlaySound(SOUND_BIPSQUISH);
		a->type = CT_Friendly;
		CK_SetAction2(a, CK_GetActionByName("CK6_ACT_BipSquished0"));
	}
}
Ejemplo n.º 12
0
/*
==========================
=
= SetSoundLocGlobal - Sets up globalsoundx & globalsoundy and then calls
=	UpdateSoundLoc() to transform that into relative channel volumes. Those
=	values are then passed to the Sound Manager so that they'll be used for
=	the next sound played (if possible).
=
= JAB
=
==========================
*/
void PlaySoundLocGlobal(word s,fixed gx,fixed gy)
{
	SetSoundLoc(gx,gy);
	SD_PositionSound(leftchannel,rightchannel);
	if (SD_PlaySound(s))
	{
		globalsoundx = gx;
		globalsoundy = gy;
	}
}
Ejemplo n.º 13
0
void CK6_RocketCol(CK_object *a, CK_object *b)
{
  if (ck_gameState.ep.ck6.passcard == 0)
  {

      CA_CacheGrChunk(0x23);

      US_CenterWindow(26, 8);
      VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
      US_SetWindowW(US_GetWindowW() - 0x30);
      US_SetPrintY(US_GetPrintY() + 5);
      US_CPrint("The door makes a loud\n"
                "blooping noise.\n"
                "It says,\n"
                "\"Passcard required\n"
                "for entry.\"");
      VL_Present();
      SD_PlaySound(SOUND_NEEDKEYCARD);
      VL_DelayTics(30); // VW_WaitVBL(30);
      IN_ClearKeysDown();
      IN_WaitButton();
      RF_ForceRefresh();
      ck_nextX = -b->deltaPosX;
      ck_nextY = -b->deltaPosY;
      b->xDirection = b->yDirection = IN_motion_None;
      CK_PhysUpdateNormalObj(b);
  }
  else if (ck_gameState.ep.ck6.passcard == 1)
  {
    a->user1 = 0;
    a->user2 = 0x100;
    CK_SetAction2(a, CK_GetActionByName("CK6_ACT_RocketFly0"));
    b->posX = a->posX;
    b->posY = a->posY + 0x100;
    b->clipped = CLIP_not;
    CK_SetAction2(b, CK_GetActionByName("CK6_ACT_MapKeenRocketSit0"));
    SD_PlaySound(SOUND_ROCKETLAUNCH);
    SD_WaitSoundDone();
  }
}
Ejemplo n.º 14
0
void CK6_NospikeFallDraw2(CK_object *obj)
{
	RF_AddSpriteDraw(&(obj->sde), obj->posX, obj->posY, obj->gfxChunk, false, obj->zLayer);

	if (obj->topTI)
	{
		obj->user1 = obj->user2 = obj->user3;
		obj->user4 = obj->type;
		CK_SetAction2(obj, CK_GetActionByName("CK6_ACT_NospikeStunned0"));
		SD_PlaySound(SOUND_NOSPIKECOLLIDE);
		obj->type = CT6_StunnedCreature;
		obj->velY = -24;
	}
}
Ejemplo n.º 15
0
static bool ShowText(const FString exitText, const FString flat, const FString music, ClusterInfo::ExitType type)
{
    // Use cluster background if set.
    if(!flat.IsEmpty())
        backgroundFlat = TexMan(flat);
    if(!backgroundFlat) // Get default if needed
        backgroundFlat = TexMan(gameinfo.FinaleFlat);

    switch(type)
    {
    case ClusterInfo::EXIT_MESSAGE:
        SD_PlaySound ("misc/1up");

        Message (exitText);

        IN_ClearKeysDown ();
        IN_Ack ();
        return false;

    case ClusterInfo::EXIT_LUMP:
    {
        int lumpNum = Wads.CheckNumForName(exitText, ns_global);
        if(lumpNum != -1)
        {
            FWadLump lump = Wads.OpenLumpNum(lumpNum);
            char* text = new char[Wads.LumpLength(lumpNum)];
            lump.Read(text, Wads.LumpLength(lumpNum));

            if(!music.IsEmpty())
                StartCPMusic(music);
            ShowArticle(text, !!(IWad::GetGame().Flags & IWad::HELPHACK));

            delete[] text;
        }

        break;
    }

    default:
        if(!music.IsEmpty())
            StartCPMusic(music);
        ShowArticle(exitText, !!(IWad::GetGame().Flags & IWad::HELPHACK));
        break;
    }

    IN_ClearKeysDown();
    if (MousePresent && IN_IsInputGrabbed())
        IN_CenterMouse();  // Clear accumulated mouse movement
    return true;
}
Ejemplo n.º 16
0
void CK6_SatelliteCol(CK_object *a, CK_object *b)
{
  if (b->currentAction == CK_GetActionByName("CK6_ACT_SatelliteInvisible0"))
  {
    a->user3 |= b->user1;
  }
  else if (b->type == CT_Player)
  {
    int var2 = a->user3 / 256;
    if (var2 == 0 || a->user4 == var2)
    {
      if (b->currentAction == CK_GetActionByName("CK6_ACT_KeenSatellite0"))
      {
        b->posX = a->posX + 0xC0;
        b->posY = a->posY + 0x100;
        CK_SetAction2(b, b->currentAction);
      }
    }
    else
    {
      SD_PlaySound(SOUND_KEENSATELLITE);
      a->user4 = var2;
      if (ck_keenObj->currentAction == CK_GetActionByName("CK6_ACT_KeenSatellite0"))
      {
        a = ck_keenObj->next;
        while (a)
        {
          if (a->type == CT6_SatelliteLoading && a->user1 == var2)
          {
            b->posX = a->posX;
            b->posY = a->posY;
            b->gfxChunk = 192;
            CK_SetAction2(ck_keenObj, CK_GetActionByName("CK_ACT_MapKeenStart"));
            b->clipped = CLIP_normal;
            break;
          }
          a = a->next;
        }
      }
      else
      {
        b->posX = a->posX + 0xC0;
        b->posY = a->posY + 0x100;
        b->clipped = CLIP_not;
        CK_SetAction2(ck_keenObj, CK_GetActionByName("CK6_ACT_KeenSatellite0"));
      }
    }
  }
}
Ejemplo n.º 17
0
void CK6_GrabbiterCol(CK_object *a, CK_object *b)
{
  if (!ck_gameState.ep.ck6.sandwich)
  {
    CA_CacheGrChunk(0x23);
    SD_PlaySound(SOUND_GRABBITER);

    US_CenterWindow(26, 8);
    VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
    US_SetWindowW(US_GetWindowW() - 0x30);
    US_SetPrintY(US_GetPrintY() + 5);
    US_CPrint("Oh no!\n"
        "It's a slavering\n"
        "Grabbiter! He says,\n"
        "\"Get me lunch and\n"
        "I'll tell ya a secret!\"");
    VL_Present();
    VL_DelayTics(30); // VW_WaitVBL(30);
    IN_ClearKeysDown();
    IN_WaitButton();
    RF_ForceRefresh();
    ck_nextX = -b->deltaPosX;
    ck_nextY = -b->deltaPosY;
    b->xDirection = b->yDirection = IN_motion_None;
    CK_PhysUpdateNormalObj(b);
  }
  else
  {
    ck_gameState.ep.ck6.sandwich++;
    CA_CacheGrChunk(0x23);
    US_CenterWindow(26, 8);
    VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
    US_SetWindowW(US_GetWindowW() - 0x30);
    US_SetPrintY(US_GetPrintY() + 2);
    US_CPrint("The Grabbiter grabs\n"
        "the gigantic sandwich,\n"
        "downs it in one bite,\n"
        "and says,\"Here's your\n"
        "secret. Big meals\n"
        "make me sleepy!\n");
    VL_Present();
    VL_DelayTics(30); // VW_WaitVBL(30);
    IN_ClearKeysDown();
    IN_WaitButton();
    CK_SetAction2(a, CK_GetActionByName("CK6_ACT_GrabbiterNapping0"));
    RF_ForceRefresh();
  }
}
Ejemplo n.º 18
0
void T_Gate (objtype *ob)
{
	id0_int_t	spot;
	objtype *check;
	id0_unsigned_t	temp;

	if (CheckHandAttack (ob) && !playstate)
	{
	//
	// warp
	//
		temp = bufferofs;
		bufferofs = 0;
		VW_Bar (26,4,232,9,STATUSCOLOR);		// clear text description
		bufferofs = temp;
		IN_ClearKeysDown ();
		if (ob->temp1)
		{
		//
		// teleport inside level
		//
			for (check=player->next;check;check=check->next)
				if (check->obclass==gateobj && check->temp1==ob->temp1 &&
					check != ob)
				{
					player->x = check->x;
					player->y = check->y;
					Thrust (player->angle,TILEGLOBAL/2);		// move forwards
					Thrust (player->angle,TILEGLOBAL/2);		// move forwards
					Thrust (player->angle,TILEGLOBAL/2);		// move forwards
					fizzlein=true;
				}
		}
		else
		{
		//
		// teleport out of level
		//
			playstate = ex_warped;
			spot = *(mapsegs[0]+farmapylookup[ob->tiley]+ob->tilex)-NAMESTART;
			if (spot<1)
				gamestate.mapon++;
			else
				gamestate.mapon=spot-1;
			SD_PlaySound(WARPUPSND);
		}
	}
}
Ejemplo n.º 19
0
void CK6_NospikeCol(CK_object *a, CK_object *b)
{
	if (b->type == CT_Player)
	{
		CK_KillKeen();
	}
	else if (b->type == CT_Stunner)
	{
		if (--a->user4 == 0)
		{
			CK_StunCreature(a, b, CK_GetActionByName("CK6_ACT_NospikeStunned0"));
		}
		else
		{
			a->xDirection = ck_keenObj->posX < a->posX ? IN_motion_Left : IN_motion_Right;
			a->user2 |= 0x400;
			a->visible = true;

			if (a->currentAction == CK_GetActionByName("CK6_ACT_NospikeSit0") ||
				a->currentAction == CK_GetActionByName("CK6_ACT_NospikeWalk0"))
				CK_SetAction2(a, CK_GetActionByName("CK6_ACT_NospikeCharge1"));
			else if (a->currentAction == CK_GetActionByName("CK6_ACT_NospikeWalk1"))
				CK_SetAction2(a, CK_GetActionByName("CK6_ACT_NospikeCharge2"));
			else if (a->currentAction == CK_GetActionByName("CK6_ACT_NospikeWalk2"))
				CK_SetAction2(a, CK_GetActionByName("CK6_ACT_NospikeCharge3"));
			else if (a->currentAction == CK_GetActionByName("CK6_ACT_NospikeWalk3"))
				CK_SetAction2(a, CK_GetActionByName("CK6_ACT_NospikeCharge0"));

			CK_ShotHit(b);
		}
	}
	else if (b->type == CT6_Nospike)
	{
		// Two charging nospikes will stun each other if they collide head on
		if ((a->user2 & 0xFF) && (b->user2 & 0xFF) && a->xDirection != b->xDirection)
		{
			a->user1 = a->user2 = a->user3 = 0;
			b->user1 = b->user2 = b->user3 = 0;
			a->user4 = b->user4 = a->type;
			CK_SetAction2(a, CK_GetActionByName("CK6_ACT_NospikeStunned0"));
			CK_SetAction2(b, CK_GetActionByName("CK6_ACT_NospikeStunned0"));
			SD_PlaySound(SOUND_NOSPIKECOLLIDE);
			a->type = b->type = CT6_StunnedCreature;
			a->velY = b->velY = -24;
		}
	}
}
Ejemplo n.º 20
0
void CK6_GikJumpDraw(CK_object *obj)
{
	if (obj->rightTI || obj->leftTI)
		obj->velX = 0;

	if (obj->bottomTI)
		obj->velY = 0;

	if (obj->topTI)
	{
		obj->velY = 0;
		SD_PlaySound(SOUND_GIKLAND);
		CK_SetAction2(obj, obj->currentAction->next);
	}

	RF_AddSpriteDraw(&(obj->sde), obj->posX, obj->posY, obj->gfxChunk, false, obj->zLayer);
}
Ejemplo n.º 21
0
void CK6_OrbatrixBounceDraw(CK_object *obj)
{
	RF_AddSpriteDraw(&(obj->sde), obj->posX, obj->posY, obj->gfxChunk, false, obj->zLayer);

	if (obj->topTI)
		obj->velY = -obj->velY;

	if (obj->topTI || obj->leftTI || obj->rightTI)
	{
		obj->velX = -obj->velX;
		SD_PlaySound(SOUND_ORBATRIXBOUNCE);

		if (obj->topTI && --obj->user1 == 0)
		{
			CK_SetAction2(obj, CK_GetActionByName("CK6_ACT_OrbatrixUncurl0"));
			obj->user2 = 0x180;
		}
	}
}
Ejemplo n.º 22
0
void CK6_GikWalk(CK_object *obj)
{
	if (obj->topTI != 9)
	{
		int dx = ck_keenObj->posX - obj->posX;

		int dy = obj->clipRects.unitY2 - ck_keenObj->clipRects.unitY2;
		if (dy >= 0 && dy <= 0x400)
		{
			obj->xDirection = dx < 0 ? IN_motion_Left : IN_motion_Right;
			if (dx >= -0x700 && dx <= 0x700 && (dx <= -0x100 || dx >= 0x100))
			{
				obj->velX = dx < 0 ? -40 : 40;
				obj->velY = -28;
				obj->currentAction = CK_GetActionByName("CK6_ACT_GikJump0");
				SD_PlaySound(SOUND_GIKJUMP);
			}
		}
	}
}
Ejemplo n.º 23
0
void CK6_FlectCol(CK_object *a, CK_object *b)
{
	if (b->type == CT_Player)
	{
		CK_PhysPushX(b, a);
	}
	else if (b->type == CT_Stunner)
	{
		if (b->xDirection == IN_motion_None)
		{
			CK_StunCreature(a, b, CK_GetActionByName("CK6_ACT_FlectStunned0"));
		}
		else if (a->xDirection != b->xDirection)
		{
			b->xDirection = a->xDirection;
			b->user4 = 1; // Shot is hazardous to keen now
			SD_PlaySound(SOUND_FLECTSHOT);
		}
	}
}
Ejemplo n.º 24
0
void CK6_ShowGetSandwich()
{
	SD_WaitSoundDone();
	SD_PlaySound(SOUND_STORYITEM);
	CA_UpLevel();
	CA_CacheGrChunk(0x23);

	US_CenterWindow(26, 8);
	VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
	US_SetWindowW(US_GetWindowW() - 0x30);
	US_SetPrintY(US_GetPrintY() + 12);
	US_CPrint("This is the second\n"
		  "biggest sandwich\n"
		  "I ever saw!\n");
	VL_Present();

	VL_DelayTics(30); // VW_WaitVBL(30);
	IN_ClearKeysDown();
	IN_WaitButton();
	CA_DownLevel();
	ck_gameState.ep.ck6.sandwich = true;
}
Ejemplo n.º 25
0
void CK6_ShowGetRope()
{
	SD_WaitSoundDone();
	SD_PlaySound(SOUND_STORYITEM);
	CA_UpLevel();
	CA_CacheGrChunk(0x23);

	US_CenterWindow(26, 8);
	VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
	US_SetWindowW(US_GetWindowW() - 0x30);
	US_SetPrintY(US_GetPrintY() + 12);
	US_CPrint("Wow! A rope and\n"
		  "grappling hook!\n"
		  "They look useful!\n");
	VL_Present();

	VL_DelayTics(30); // VW_WaitVBL(30);
	IN_ClearKeysDown();
	IN_WaitButton();
	CA_DownLevel();
	ck_gameState.ep.ck6.rope = true;
}
Ejemplo n.º 26
0
void CK6_BipshipCrash(CK_object *obj)
{
	SD_PlaySound(SOUND_BIPSHIPCRASH);

	// Spawn smoke
	CK_object *smoke = CK_GetNewObj(true);
	smoke->type = CT_Friendly;
	smoke->active = OBJ_ACTIVE;
	smoke->zLayer = PRIORITIES - 2;
	smoke->posX = obj->posX;
	smoke->posY = obj->posY - 0x180;
	CK_SetAction(smoke, CK_GetActionByName("CK6_ACT_BipshipSmoke0"));
	smoke->xDirection = US_RndT() < 0x80 ? IN_motion_Right : IN_motion_Left;

	CK_object *bip = CK_GetNewObj(true);
	bip->type = CT6_Bip;
	bip->active = OBJ_ACTIVE;
	bip->zLayer = PRIORITIES - 4;
	bip->posX = obj->posX;
	bip->posY = obj->posY - 0x80;
	bip->xDirection = US_RndT() < 0x80 ? IN_motion_Right : IN_motion_Left;
	CK_SetAction(bip, CK_GetActionByName("CK6_ACT_BipStand0"));
}
Ejemplo n.º 27
0
void CK6_ShowGetPasscard()
{
	SD_WaitSoundDone();
	SD_PlaySound(SOUND_STORYITEM);
	CA_UpLevel();
	CA_CacheGrChunk(0x23);

	US_CenterWindow(26, 8);
	VH_DrawBitmap(US_GetWindowX() + US_GetWindowW() - 0x30, US_GetWindowY(), 0x23);
	US_SetWindowW(US_GetWindowW() - 0x30);
	US_SetPrintY(US_GetPrintY() + 4);
	US_CPrint("What's this? Cool!\n"
		  "A passcard for\n"
		  "the Bloogstar Rocket!\n"
		  "(It can fly though\n"
		  "their force field.)");
	VL_Present();

	VL_DelayTics(30); // VW_WaitVBL(30);
	IN_ClearKeysDown();
	IN_WaitButton();
	CA_DownLevel();
	ck_gameState.ep.ck6.passcard = true;
}
Ejemplo n.º 28
0
void CK6_RocketFly(CK_object *obj)
{
  if (!ck_nextX && !ck_nextY)
  {
    if (!SD_SoundPlaying())
      SD_PlaySound(SOUND_ROCKETFLY);

    int delta = SD_GetSpriteSync() * 32;

    // Will we reach a new tile?
    if (obj->user2 > delta)
    {
      // No... keep moving in the same direction.
      obj->user2 -= delta;

      int dirX = ck_infoplaneArrowsX[obj->user1];
      if (dirX == 1)
      {
        // Moving right.
        ck_nextX += delta;
      }
      else if (dirX == -1)
      {
        // Moving left
        ck_nextX -= delta;
      }

      int dirY = ck_infoplaneArrowsY[obj->user1];
      if (dirY == 1)
      {
        // Moving down
        ck_nextY += delta;
      }
      else if (dirY == -1)
      {
        // Moving up
        ck_nextY -= delta;
      }
    }
    else
    {
      // Move to next tile.
      int dirX = ck_infoplaneArrowsX[obj->user1];
      if (dirX == 1)
      {
        // Moving right.
        ck_nextX += obj->user2;
      }
      else if (dirX == -1)
      {
        // Moving left
        ck_nextX -= obj->user2;
      }

      int dirY = ck_infoplaneArrowsY[obj->user1];
      if (dirY == 1)
      {
        // Moving down
        ck_nextY += obj->user2;
      }
      else if (dirY == -1)
      {
        // Moving up
        ck_nextY -= obj->user2;
      }

      int tileX = (uint16_t)RF_UnitToTile(obj->posX + ck_nextX);
      int tileY = (uint16_t)RF_UnitToTile(obj->posY + ck_nextY);

      obj->user1 = CA_TileAtPos(tileX, tileY, 2) - 0x5B;

      if ((obj->user1 < 0) || (obj->user1 > 8))
      {
        obj->posX += ck_nextX;
        obj->posY += ck_nextY;
        CK_SetAction2(obj, CK_GetActionByName("CK6_ACT_RocketSit0"));

        ck_keenObj->posX = RF_TileToUnit(tileX + 1) + 0x10;
        ck_keenObj->posY = RF_TileToUnit(tileY + 1);
        ck_keenObj->type = CT_Player;
        ck_keenObj->gfxChunk = 0xBD;
        ck_keenObj->clipped = CLIP_normal;
        CK_SetAction(ck_keenObj, CK_GetActionByName("CK_ACT_MapKeenStart"));
        ck_gameState.ep.ck6.inRocket ^= 1;
        return;
      }

      delta -= obj->user2;
      obj->user2 = 256 - delta;

      // Move in the new direction.
      dirX = ck_infoplaneArrowsX[obj->user1];
      if (dirX == 1)
      {
        // Moving right.
        ck_nextX += delta;
      }
      else if (dirX == -1)
      {
        // Moving left
        ck_nextX -= delta;
      }

      dirY = ck_infoplaneArrowsY[obj->user1];
      if (dirY == 1)
      {
        // Moving down
        ck_nextY += delta;
      }
      else if (dirY == -1)
      {
        // Moving up
        ck_nextY -= delta;
      }
    }
  }
}
Ejemplo n.º 29
0
void T_Mshot (objtype *ob)
{
	objtype	*check;
	id0_long_t	xmove,ymove/*,speed*/;

	xmove = ymove = 0;

	switch (ob->dir)
	{
	case north:
		ymove = -ob->speed*tics;
		break;
	case east:
		xmove = ob->speed*tics;
		break;
	case south:
		ymove = ob->speed*tics;
		break;
	case west:
		xmove = -ob->speed*tics;
		break;
	}

	ob->x+=xmove;
	ob->y+=ymove;

	CalcBounds (ob);

	ob->tilex = ob->x>>TILESHIFT;
	ob->tiley = ob->y>>TILESHIFT;

	if (tilemap[ob->tilex][ob->tiley])
	{
		SD_PlaySound (SHOOTWALLSND);
		ob->state = NULL;
		return;
	}

//
// check final position for monsters hit
//
	if ( ob->xl <= player->xh
	&& ob->xh >= player->xl
	&& ob->yl <= player->yh
	&& ob->yh >= player->yl)
	{
		TakeDamage (MSHOTDAMAGE*2);
		ob->state = NULL;
		return;
	}

	for (check = player->next; check; check=check->next)
		if (ob->shootable && ob->obclass != mageobj
		&& ob->xl <= check->xh
		&& ob->xh >= check->xl
		&& ob->yl <= check->yh
		&& ob->yh >= check->yl)
		{
			ShootActor (check,MSHOTDAMAGE);
			ob->state = NULL;
			return;
		}
}
Ejemplo n.º 30
0
void	CheckHighScore (long score,word other)
{
	word		i,j;
	int			n;
	HighScore	myscore;
	US_CursorStruct TermCursor = {'@',0,HIGHLIGHT_TEXT_COLOR,2};


   // Check for cheaters

   if (DebugOk)
	{
   	SD_PlaySound(NOWAYSND);
      return;
   }

	strcpy(myscore.name,"");
	myscore.score = score;
	myscore.episode = gamestate.episode;
	myscore.completed = other;
	myscore.ratio = ShowStats(0,0,ss_justcalc,&gamestuff.level[gamestate.mapon].stats);

	for (i = 0,n = -1;i < MaxScores;i++)
	{
		if ((myscore.score > Scores[i].score) ||	((myscore.score == Scores[i].score)
			&& (myscore.completed > Scores[i].completed)))
		{
			for (j = MaxScores;--j > i;)
				Scores[j] = Scores[j - 1];
			Scores[i] = myscore;
			n = i;
			break;
		}
	}

	StartCPMusic (ROSTER_MUS);
	DrawHighScores ();

	VW_FadeIn ();

	if (n != -1)
	{
		//
		// got a high score
		//

		DrawInstructions(IT_ENTER_HIGHSCORE);
		SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR,TERM_BACK_COLOR);
		PrintY = 68+(SCORE_Y_SPACING * n);
		PrintX = 45;
		use_custom_cursor = true;
		allcaps = true;
		US_CustomCursor = TermCursor;
		US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,100);
	}
	else
	{
		IN_ClearKeysDown ();
		IN_UserInput(500);
	}

   StopMusic();
	use_custom_cursor = false;
}