Ostrich and camel corpse, different sleep speeds #712

This commit is contained in:
Cong
2025-05-11 17:53:19 +10:00
parent ce12434705
commit e78138c049
9 changed files with 107 additions and 60 deletions

View File

@@ -74,6 +74,7 @@
"Body": "ostrich",
"Sounds": "ostrich",
"Footsteps": "wood",
"Corpse": "ostrich_sleep",
"BloodColor": "00000000",
"HasHair": false,
"HasFacehair": false,
@@ -103,6 +104,7 @@
"Body": "camel",
"Sounds": "camel",
"Footsteps": "camel",
"Corpse": "camel_sleep",
"BloodColor": "00000000",
"HasHair": false,
"HasFacehair": false,

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

View File

@@ -16,11 +16,11 @@
"stand": [[0, 17]],
"idle": [[0, 17]],
"run": [
[0, 18],
[0, 17],
[0, 17],
[0, 16],
[0, 17],
[0, 18],
[0, 17],
[0, 17],
[0, 16],
[0, 17]
@@ -51,7 +51,14 @@
},
"Dir": {
"Head": [
[1, 0], [2, 0], [4, 0], [2, 0], [1, 0], [-1, 0], [-2, 0], [-1, 0]
[1, -1],
[2, 0],
[4, 0],
[2, 0],
[1, 1],
[-1, 0],
[-2, 0],
[-1, 0]
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@@ -301,7 +301,8 @@
"DamageSmoke": {
"Particle": "zzz",
"HealthThreshold": 1.0,
"Z": 10
"Z": 10,
"Ticks": 20
}
},
{
@@ -316,7 +317,40 @@
"DamageSmoke": {
"Particle": "zzz",
"HealthThreshold": 1.0,
"Z": 10
"Z": 10,
"Ticks": 20
}
},
{
"Name": "camel_sleep",
"Pic": {
"Type": "Animated",
"Sprites": "camel_sleep",
"TicksPerFrame": 300
},
"Health": 0,
"DrawBelow": true,
"DamageSmoke": {
"Particle": "zzz",
"HealthThreshold": 1.0,
"Z": 10,
"Ticks": 100
}
},
{
"Name": "ostrich_sleep",
"Pic": {
"Type": "Animated",
"Sprites": "ostrich_sleep",
"TicksPerFrame": 260
},
"Health": 0,
"DrawBelow": true,
"DamageSmoke": {
"Particle": "zzz",
"HealthThreshold": 1.0,
"Z": 10,
"Ticks": 80
}
}
]

View File

@@ -20,4 +20,4 @@
"Range": 7
}
]
}
}

View File

@@ -22,7 +22,7 @@
This file incorporates work covered by the following copyright and
permission notice:
Copyright (c) 2014, 2016-2017, 2019, 2021, 2024 Cong Xu
Copyright (c) 2014, 2016-2017, 2019, 2021, 2024-2025 Cong Xu
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -450,6 +450,8 @@ static bool TryLoadMapObject(MapObject *m, json_t *node, const int version)
&m->DamageSmoke.HealthThreshold, dSmokeNode->child,
"HealthThreshold");
LoadFloat(&m->DamageSmoke.Z, dSmokeNode->child, "Z");
m->DamageSmoke.Ticks = 20;
LoadInt(&m->DamageSmoke.Ticks, dSmokeNode->child, "Ticks");
}
return true;

View File

@@ -1,58 +1,58 @@
/*
C-Dogs SDL
A port of the legendary (and fun) action/arcade cdogs.
Copyright (C) 1995 Ronny Wester
Copyright (C) 2003 Jeremy Chin
Copyright (C) 2003-2007 Lucas Martin-King
C-Dogs SDL
A port of the legendary (and fun) action/arcade cdogs.
Copyright (C) 1995 Ronny Wester
Copyright (C) 2003 Jeremy Chin
Copyright (C) 2003-2007 Lucas Martin-King
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
This file incorporates work covered by the following copyright and
permission notice:
This file incorporates work covered by the following copyright and
permission notice:
Copyright (c) 2013-2019, 2021, 2024 Cong Xu
All rights reserved.
Copyright (c) 2013-2019, 2021, 2024-2025 Cong Xu
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <json/json.h>
#include "ammo.h"
#include "character.h"
#include "pic_manager.h"
#include "pickup_class.h"
#include <json/json.h>
typedef enum
{
@@ -100,7 +100,7 @@ typedef struct
int Health;
// Guns that are fired when this map object is destroyed
// i.e. explosion on destruction
CArray DestroyGuns; // of const WeaponClass *
CArray DestroyGuns; // of const WeaponClass *
// Bit field composed of bits shifted by PlacementFlags
int Flags;
bool DrawBelow;
@@ -108,8 +108,7 @@ typedef struct
char *FootstepSound;
color_t FootprintMask;
MapObjectType Type;
union
{
union {
const PickupClass *PickupClass;
struct
{
@@ -117,22 +116,24 @@ typedef struct
int Counter;
} Character;
} u;
CArray DestroySpawn; // of MapObjectDestroySpawn
struct {
CArray DestroySpawn; // of MapObjectDestroySpawn
struct
{
char *ParticleClass;
float HealthThreshold; // Smoke if map object damaged below this ratio
float HealthThreshold; // Smoke if map object damaged below this ratio
float Z;
int Ticks;
} DamageSmoke;
} MapObject;
typedef struct
{
CArray Classes; // of MapObject
CArray CustomClasses; // of MapObject
CArray Classes; // of MapObject
CArray CustomClasses; // of MapObject
// Names of special types of map objects; for editor support
// Reset on load
CArray Destructibles; // of char *
CArray Destructibles; // of char *
// Map objects that match "blood%d" - left over when actors die
CArray Bloods; // of char *
CArray Bloods; // of char *
} MapObjects;
extern MapObjects gMapObjects;
@@ -147,8 +148,8 @@ const MapObject *GetRandomBloodPool(void);
int MapObjectGetFlags(const MapObject *mo);
void MapObjectsInit(
MapObjects *classes, const char *filename,
const AmmoClasses *ammo, const WeaponClasses *guns);
MapObjects *classes, const char *filename, const AmmoClasses *ammo,
const WeaponClasses *guns);
void MapObjectsLoadJSON(CArray *classes, json_t *root);
void MapObjectsLoadAmmoAndGunSpawners(
MapObjects *classes, const AmmoClasses *ammo, const WeaponClasses *guns,
@@ -161,5 +162,6 @@ const Pic *MapObjectGetPic(const MapObject *mo, struct vec2i *offset);
bool MapObjectIsTileOK(
const MapObject *obj, const Tile *tile, const Tile *tileAbove);
struct vec2 MapObjectGetPlacementPos(const MapObject *mo, const struct vec2i tilePos);
struct vec2 MapObjectGetPlacementPos(
const MapObject *mo, const struct vec2i tilePos);
bool MapObjectIsOnWall(const MapObject *mo);

View File

@@ -518,7 +518,7 @@ void ObjAdd(const NMapObjectAdd amo)
&o->damageSmoke,
StrParticleClass(
&gParticleClasses, o->Class->DamageSmoke.ParticleClass),
svec2_zero(), -0.05f, 0.05f, 3, 3, 0, 0, 20);
svec2_zero(), -0.05f, 0.05f, 3, 3, 0, 0, o->Class->DamageSmoke.Ticks);
o->isInUse = true;
LOG(LM_MAIN, LL_DEBUG,
"added object uid(%d) class(%s) health(%d) pos(%d, %d)", (int)amo.UID,