mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Implement shields that remove specific weapon (fixes #4572)
Thanks to Cellegen for graphics. Functionality works, still a bit buggy sprite display, maybe someone can quickly spot what I'm doing wrong
This commit is contained in:
parent
a8b842277a
commit
298287fb4e
BIN
data/demos/Multeasymap_bench.demo
Normal file
BIN
data/demos/Multeasymap_bench.demo
Normal file
Binary file not shown.
BIN
data/demos/RaiNyMore2_bench.demo
Normal file
BIN
data/demos/RaiNyMore2_bench.demo
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 294 KiB |
Binary file not shown.
Before Width: | Height: | Size: 293 KiB After Width: | Height: | Size: 292 KiB |
BIN
data/game.png
BIN
data/game.png
Binary file not shown.
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 130 KiB |
|
@ -259,6 +259,10 @@ container.images.Add(image_strongweak)
|
|||
|
||||
container.pickups.Add(Pickup("health"))
|
||||
container.pickups.Add(Pickup("armor"))
|
||||
container.pickups.Add(Pickup("armor_shotgun"))
|
||||
container.pickups.Add(Pickup("armor_grenade"))
|
||||
container.pickups.Add(Pickup("armor_laser"))
|
||||
container.pickups.Add(Pickup("armor_ninja"))
|
||||
container.pickups.Add(Pickup("weapon"))
|
||||
container.pickups.Add(Pickup("ninja", 90, 90))
|
||||
|
||||
|
@ -358,6 +362,10 @@ container.sprites.Add(Sprite("weapon_ninja_muzzle3", set_game, 25,8,7,4))
|
|||
|
||||
container.sprites.Add(Sprite("pickup_health", set_game, 10,2,2,2))
|
||||
container.sprites.Add(Sprite("pickup_armor", set_game, 12,2,2,2))
|
||||
container.sprites.Add(Sprite("pickup_armor_shotgun", set_game, 15,2,2,2))
|
||||
container.sprites.Add(Sprite("pickup_armor_grenade", set_game, 17,2,2,2))
|
||||
container.sprites.Add(Sprite("pickup_armor_laser", set_game, 19,2,2,2))
|
||||
container.sprites.Add(Sprite("pickup_armor_ninja", set_game, 19,4,2,2))
|
||||
container.sprites.Add(Sprite("pickup_weapon", set_game, 3,0,6,2))
|
||||
container.sprites.Add(Sprite("pickup_ninja", set_game, 2,10,8,2))
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ ProjectileFlags = ["CLIENTID_BIT{}".format(i) for i in range(8)] + [
|
|||
|
||||
Emoticons = ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"]
|
||||
|
||||
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]
|
||||
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA", "ARMOR_SHOTGUN", "ARMOR_GRENADE", "ARMOR_NINJA", "ARMOR_LASER"]
|
||||
Authed = ["NO", "HELPER", "MOD", "ADMIN"]
|
||||
EntityClasses = ["PROJECTILE", "DOOR", "DRAGGER_WEAK", "DRAGGER_NORMAL", "DRAGGER_STRONG", "GUN_NORMAL", "GUN_EXPLOSIVE", "GUN_FREEZE", "GUN_UNFREEZE", "LIGHT", "PICKUP"]
|
||||
|
||||
|
|
|
@ -141,7 +141,11 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
SPRITE_PICKUP_HEALTH,
|
||||
SPRITE_PICKUP_ARMOR,
|
||||
SPRITE_PICKUP_WEAPON,
|
||||
SPRITE_PICKUP_NINJA};
|
||||
SPRITE_PICKUP_NINJA,
|
||||
SPRITE_PICKUP_ARMOR_SHOTGUN,
|
||||
SPRITE_PICKUP_ARMOR_GRENADE,
|
||||
SPRITE_PICKUP_ARMOR_NINJA,
|
||||
SPRITE_PICKUP_ARMOR_LASER};
|
||||
|
||||
int CurWeapon = clamp(pCurrent->m_Subtype, 0, NUM_WEAPONS - 1);
|
||||
|
||||
|
@ -149,6 +153,14 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupHealth);
|
||||
else if(c[pCurrent->m_Type] == SPRITE_PICKUP_ARMOR)
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupArmor);
|
||||
else if(c[pCurrent->m_Type] == SPRITE_PICKUP_ARMOR_SHOTGUN)
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupArmorShotgun);
|
||||
else if(c[pCurrent->m_Type] == SPRITE_PICKUP_ARMOR_GRENADE)
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupArmorGrenade);
|
||||
else if(c[pCurrent->m_Type] == SPRITE_PICKUP_ARMOR_LASER)
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupArmorLaser);
|
||||
else if(c[pCurrent->m_Type] == SPRITE_PICKUP_ARMOR_NINJA)
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupArmorNinja);
|
||||
else if(c[pCurrent->m_Type] == SPRITE_PICKUP_WEAPON)
|
||||
{
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpritePickupWeapons[CurWeapon]);
|
||||
|
@ -549,6 +561,19 @@ void CItems::OnInit()
|
|||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 24.f);
|
||||
|
||||
RenderTools()->GetSpriteScale(SPRITE_PICKUP_ARMOR_SHOTGUN, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
RenderTools()->GetSpriteScale(SPRITE_PICKUP_ARMOR_GRENADE, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
RenderTools()->GetSpriteScale(SPRITE_PICKUP_ARMOR_NINJA, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
RenderTools()->GetSpriteScale(SPRITE_PICKUP_ARMOR_LASER, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
|
||||
Graphics()->QuadContainerUpload(m_ItemsQuadContainerIndex);
|
||||
}
|
||||
|
||||
|
|
|
@ -2716,6 +2716,10 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
|
|||
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupHealth);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupArmor);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupArmorShotgun);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupArmorGrenade);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupArmorLaser);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupArmorNinja);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupGrenade);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupShotgun);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpritePickupLaser);
|
||||
|
@ -2849,6 +2853,10 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
|
|||
// pickups
|
||||
m_GameSkin.m_SpritePickupHealth = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_PICKUP_HEALTH]);
|
||||
m_GameSkin.m_SpritePickupArmor = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_PICKUP_ARMOR]);
|
||||
m_GameSkin.m_SpritePickupArmorShotgun = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_PICKUP_ARMOR_SHOTGUN]);
|
||||
m_GameSkin.m_SpritePickupArmorGrenade = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_PICKUP_ARMOR_GRENADE]);
|
||||
m_GameSkin.m_SpritePickupArmorLaser = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_PICKUP_ARMOR_LASER]);
|
||||
m_GameSkin.m_SpritePickupArmorNinja = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_PICKUP_ARMOR_NINJA]);
|
||||
m_GameSkin.m_SpritePickupGrenade = Graphics()->LoadSpriteTexture(ImgInfo, &client_data7::g_pData->m_aSprites[client_data7::SPRITE_PICKUP_GRENADE]);
|
||||
m_GameSkin.m_SpritePickupShotgun = Graphics()->LoadSpriteTexture(ImgInfo, &client_data7::g_pData->m_aSprites[client_data7::SPRITE_PICKUP_SHOTGUN]);
|
||||
m_GameSkin.m_SpritePickupLaser = Graphics()->LoadSpriteTexture(ImgInfo, &client_data7::g_pData->m_aSprites[client_data7::SPRITE_PICKUP_LASER]);
|
||||
|
|
|
@ -592,6 +592,10 @@ public:
|
|||
// pickups
|
||||
IGraphics::CTextureHandle m_SpritePickupHealth;
|
||||
IGraphics::CTextureHandle m_SpritePickupArmor;
|
||||
IGraphics::CTextureHandle m_SpritePickupArmorShotgun;
|
||||
IGraphics::CTextureHandle m_SpritePickupArmorGrenade;
|
||||
IGraphics::CTextureHandle m_SpritePickupArmorLaser;
|
||||
IGraphics::CTextureHandle m_SpritePickupArmorNinja;
|
||||
IGraphics::CTextureHandle m_SpritePickupGrenade;
|
||||
IGraphics::CTextureHandle m_SpritePickupShotgun;
|
||||
IGraphics::CTextureHandle m_SpritePickupLaser;
|
||||
|
|
|
@ -50,6 +50,61 @@ void CPickup::Tick()
|
|||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_SHOTGUN:
|
||||
if(!GameWorld()->m_WorldConfig.m_IsDDRace || !GameWorld()->m_WorldConfig.m_PredictDDRace)
|
||||
continue;
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
if(pChr->GetWeaponGot(WEAPON_SHOTGUN))
|
||||
{
|
||||
pChr->SetWeaponGot(WEAPON_SHOTGUN, false);
|
||||
pChr->SetWeaponAmmo(WEAPON_SHOTGUN, 0);
|
||||
pChr->SetLastWeapon(WEAPON_GUN);
|
||||
}
|
||||
if(pChr->GetActiveWeapon() == WEAPON_SHOTGUN)
|
||||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_GRENADE:
|
||||
if(!GameWorld()->m_WorldConfig.m_IsDDRace || !GameWorld()->m_WorldConfig.m_PredictDDRace)
|
||||
continue;
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
if(pChr->GetWeaponGot(WEAPON_GRENADE))
|
||||
{
|
||||
pChr->SetWeaponGot(WEAPON_GRENADE, false);
|
||||
pChr->SetWeaponAmmo(WEAPON_GRENADE, 0);
|
||||
pChr->SetLastWeapon(WEAPON_GUN);
|
||||
}
|
||||
if(pChr->GetActiveWeapon() == WEAPON_GRENADE)
|
||||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_NINJA:
|
||||
if(!GameWorld()->m_WorldConfig.m_IsDDRace || !GameWorld()->m_WorldConfig.m_PredictDDRace)
|
||||
continue;
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
pChr->SetNinjaActivationDir(vec2(0, 0));
|
||||
pChr->SetNinjaActivationTick(-500);
|
||||
pChr->SetNinjaCurrentMoveTime(0);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_LASER:
|
||||
if(!GameWorld()->m_WorldConfig.m_IsDDRace || !GameWorld()->m_WorldConfig.m_PredictDDRace)
|
||||
continue;
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
if(pChr->GetWeaponGot(WEAPON_LASER))
|
||||
{
|
||||
pChr->SetWeaponGot(WEAPON_LASER, false);
|
||||
pChr->SetWeaponAmmo(WEAPON_LASER, 0);
|
||||
pChr->SetLastWeapon(WEAPON_GUN);
|
||||
}
|
||||
if(pChr->GetActiveWeapon() == WEAPON_LASER)
|
||||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_WEAPON:
|
||||
if(m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->GetWeaponGot(m_Subtype) || pChr->GetWeaponAmmo(m_Subtype) != -1))
|
||||
pChr->GiveWeapon(m_Subtype);
|
||||
|
|
|
@ -402,6 +402,22 @@ const char *CEditor::Explain(int ExplanationID, int Tile, int Layer) //TODO: Add
|
|||
if(Layer == LAYER_GAME || Layer == LAYER_FRONT || Layer == LAYER_SWITCH)
|
||||
return "BULLET: Bounces off the walls without explosion. Touching the bullet works like FREEZE tile (freezes for 3 seconds by default).";
|
||||
break;
|
||||
case ENTITY_OFFSET + ENTITY_ARMOR_SHOTGUN:
|
||||
if(Layer == LAYER_GAME || Layer == LAYER_FRONT || Layer == LAYER_SWITCH)
|
||||
return "SHOTGUN SHIELD: Takes shotgun away.";
|
||||
break;
|
||||
case ENTITY_OFFSET + ENTITY_ARMOR_GRENADE:
|
||||
if(Layer == LAYER_GAME || Layer == LAYER_FRONT || Layer == LAYER_SWITCH)
|
||||
return "GRENADE SHIELD: Takes grenade away.";
|
||||
break;
|
||||
case ENTITY_OFFSET + ENTITY_ARMOR_NINJA:
|
||||
if(Layer == LAYER_GAME || Layer == LAYER_FRONT || Layer == LAYER_SWITCH)
|
||||
return "NINJA SHIELD: Takes ninja away.";
|
||||
break;
|
||||
case ENTITY_OFFSET + ENTITY_ARMOR_LASER:
|
||||
if(Layer == LAYER_GAME || Layer == LAYER_FRONT || Layer == LAYER_SWITCH)
|
||||
return "LASER SHIELD: Takes laser away.";
|
||||
break;
|
||||
case ENTITY_OFFSET + ENTITY_DRAGGER_WEAK:
|
||||
if(Layer == LAYER_GAME || Layer == LAYER_FRONT || Layer == LAYER_SWITCH)
|
||||
return "DRAGGING LASER: Grabs and attracts the closest tee to it. Can't reach tees through walls and LASER BLOCKER. Weak.";
|
||||
|
|
|
@ -91,7 +91,7 @@ bool IsValidEntity(int Index)
|
|||
Index -= ENTITY_OFFSET;
|
||||
return (
|
||||
(Index >= ENTITY_SPAWN && Index <= ENTITY_LASER_O_FAST) ||
|
||||
(Index >= ENTITY_PLASMAE && Index <= ENTITY_CRAZY_SHOTGUN) ||
|
||||
(Index >= ENTITY_PLASMAE && Index <= ENTITY_ARMOR_LASER) ||
|
||||
(Index >= ENTITY_DRAGGER_WEAK && Index <= ENTITY_DRAGGER_STRONG_NW) ||
|
||||
Index == ENTITY_DOOR);
|
||||
}
|
||||
|
|
|
@ -80,6 +80,11 @@ enum
|
|||
//DDRace - Shotgun
|
||||
ENTITY_CRAZY_SHOTGUN_EX,
|
||||
ENTITY_CRAZY_SHOTGUN,
|
||||
//DDNet - Removing specific weapon
|
||||
ENTITY_ARMOR_SHOTGUN,
|
||||
ENTITY_ARMOR_GRENADE,
|
||||
ENTITY_ARMOR_NINJA,
|
||||
ENTITY_ARMOR_LASER,
|
||||
//DDRace - Draggers
|
||||
ENTITY_DRAGGER_WEAK = 42,
|
||||
ENTITY_DRAGGER_NORMAL,
|
||||
|
|
|
@ -95,6 +95,56 @@ void CPickup::Tick()
|
|||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_SHOTGUN:
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
if(pChr->GetWeaponGot(WEAPON_SHOTGUN))
|
||||
{
|
||||
pChr->SetWeaponGot(WEAPON_SHOTGUN, false);
|
||||
pChr->SetWeaponAmmo(WEAPON_SHOTGUN, 0);
|
||||
pChr->SetLastWeapon(WEAPON_GUN);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR, pChr->TeamMask());
|
||||
}
|
||||
if(pChr->GetActiveWeapon() == WEAPON_SHOTGUN)
|
||||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_GRENADE:
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
if(pChr->GetWeaponGot(WEAPON_GRENADE))
|
||||
{
|
||||
pChr->SetWeaponGot(WEAPON_GRENADE, false);
|
||||
pChr->SetWeaponAmmo(WEAPON_GRENADE, 0);
|
||||
pChr->SetLastWeapon(WEAPON_GUN);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR, pChr->TeamMask());
|
||||
}
|
||||
if(pChr->GetActiveWeapon() == WEAPON_GRENADE)
|
||||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_NINJA:
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
pChr->SetNinjaActivationDir(vec2(0, 0));
|
||||
pChr->SetNinjaActivationTick(-500);
|
||||
pChr->SetNinjaCurrentMoveTime(0);
|
||||
break;
|
||||
|
||||
case POWERUP_ARMOR_LASER:
|
||||
if(pChr->Team() == TEAM_SUPER)
|
||||
continue;
|
||||
if(pChr->GetWeaponGot(WEAPON_LASER))
|
||||
{
|
||||
pChr->SetWeaponGot(WEAPON_LASER, false);
|
||||
pChr->SetWeaponAmmo(WEAPON_LASER, 0);
|
||||
pChr->SetLastWeapon(WEAPON_GUN);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_ARMOR, pChr->TeamMask());
|
||||
}
|
||||
if(pChr->GetActiveWeapon() == WEAPON_LASER)
|
||||
pChr->SetActiveWeapon(WEAPON_HAMMER);
|
||||
break;
|
||||
|
||||
case POWERUP_WEAPON:
|
||||
|
||||
if(m_Subtype >= 0 && m_Subtype < NUM_WEAPONS && (!pChr->GetWeaponGot(m_Subtype) || pChr->GetWeaponAmmo(m_Subtype) != -1))
|
||||
|
|
|
@ -278,6 +278,14 @@ bool IGameController::OnEntity(int Index, vec2 Pos, int Layer, int Flags, int Nu
|
|||
|
||||
if(Index == ENTITY_ARMOR_1)
|
||||
Type = POWERUP_ARMOR;
|
||||
else if(Index == ENTITY_ARMOR_SHOTGUN)
|
||||
Type = POWERUP_ARMOR_SHOTGUN;
|
||||
else if(Index == ENTITY_ARMOR_GRENADE)
|
||||
Type = POWERUP_ARMOR_GRENADE;
|
||||
else if(Index == ENTITY_ARMOR_NINJA)
|
||||
Type = POWERUP_ARMOR_NINJA;
|
||||
else if(Index == ENTITY_ARMOR_LASER)
|
||||
Type = POWERUP_ARMOR_LASER;
|
||||
else if(Index == ENTITY_HEALTH_1)
|
||||
Type = POWERUP_HEALTH;
|
||||
else if(Index == ENTITY_WEAPON_SHOTGUN)
|
||||
|
|
Loading…
Reference in a new issue