Skip to content

Commit

Permalink
Camel #712
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Sep 27, 2024
1 parent ebefb02 commit b3b98ef
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 32 deletions.
2 changes: 1 addition & 1 deletion data/.wolf3d/N3Ddata.cdogscpn/character_classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"Type": "Directional",
"Sprites": "chars/heads/sheep"
},
"Body": "big",
"Body": "camel",
"Sounds": "camel"
},
{
Expand Down
8 changes: 4 additions & 4 deletions data/.wolf3d/N3Ddata.cdogscpn/characters.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@
},
{
"Class": "Camel",
"Skin": "ffbf73ff",
"Skin": "f5921dff",
"Arms": "0c08f0ff",
"Body": "0016ffff",
"Legs": "0820fcff",
"Hair": "fcfa0aff",
"Feet": "0200f7ff",
"Legs": "fc9b08ff",
"Hair": "bf7f00ff",
"Feet": "f79722ff",
"Facehair": "fcfa0aff",
"Hat": "fcfa0aff",
"Glasses": "fcfa0aff",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"Dir": {
"Head": [
[0, -3], [4, -3], [6, 0], [6, 4], [0, 6], [-6, 4], [-7, 0], [-5, -3]
[-1, -15], [11, -12], [15, -7], [12, 3], [0, 6], [-12, 3], [-16, -6], [-12, -12]
]
}
}
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/.wolf3d/N3Ddata.cdogscpn/graphics/chars/bodies/camel/src.blend
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions graphics/chars/bodies/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
axis = 2 # z-axis
platform = D.objects["armature"]
scene = D.scenes[0]
# Zoom out to show big characters - change RESOLUTION to account for this
scene.camera.data.ortho_scale = RESOLUTION
try:
platform.animation_data.action = D.actions[action]
except KeyError:
Expand Down
63 changes: 37 additions & 26 deletions src/cdogsed/char_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ typedef struct
char *PickupNames;
CArray texidsChars; // of GLuint[BODY_PART_COUNT]
GLuint texidsPreview[BODY_PART_COUNT];
CArray texIdsCharClasses; // of GLuint
CArray texIdsHeadParts[HEAD_PART_COUNT]; // of GLuint
CArray texIdsGuns; // of GLuint
CArray texIdsMelees; // of GLuint
CArray texIdsPickups; // of GLuint
CArray texIdsCharClasses; // of GLuint
CArray texIdsHeadParts[HEAD_PART_COUNT]; // of GLuint
CArray texIdsGuns; // of GLuint
CArray texIdsMelees; // of GLuint
CArray texIdsPickups; // of GLuint
Animation anim;
direction_e previewDir;
gunstate_e gunState;
Expand Down Expand Up @@ -115,12 +115,11 @@ void CharEditor(
ec.CharacterClassNames =
GetClassNames(NumCharacterClasses(), IndexCharacterClassName);
const char *(*indexHeadPartFuncs[HEAD_PART_COUNT])(int) = {
IndexHairName, IndexFacehairName, IndexHatName, IndexGlassesName
};
IndexHairName, IndexFacehairName, IndexHatName, IndexGlassesName};
for (HeadPart hp = HEAD_PART_HAIR; hp < HEAD_PART_COUNT; hp++)
{
ec.HeadPartNames[hp] =
GetClassNames(gPicManager.headPartNames[hp].size, *indexHeadPartFuncs[hp]);
ec.HeadPartNames[hp] = GetClassNames(
gPicManager.headPartNames[hp].size, *indexHeadPartFuncs[hp]);
}
ec.GunNames = GetClassNames(NumGuns(), IndexGunName);
ec.MeleeNames = GetClassNames(NumMelees(), IndexMeleeName);
Expand All @@ -145,10 +144,12 @@ void CharEditor(

for (HeadPart hp = HEAD_PART_HAIR; hp < HEAD_PART_COUNT; hp++)
{
TexArrayInit(&ec.texIdsHeadParts[hp], gPicManager.headPartNames[hp].size);
TexArrayInit(
&ec.texIdsHeadParts[hp], gPicManager.headPartNames[hp].size);
CA_FOREACH(const GLuint, texid, ec.texIdsHeadParts[hp])
const char *name = IndexHeadPartName(_ca_index, hp);
LoadTexFromPic(*texid, GetHeadPartPic(name, hp, DIRECTION_DOWN, false, &cc));
LoadTexFromPic(
*texid, GetHeadPartPic(name, hp, DIRECTION_DOWN, false, &cc));
CA_FOREACH_END()
}

Expand All @@ -157,7 +158,7 @@ void CharEditor(
const WeaponClass *wc = IndexWeaponClassReal(_ca_index);
LoadTexFromPic(*texid, wc->Icon);
CA_FOREACH_END()

TexArrayInit(&ec.texIdsMelees, NumMelees());
CA_FOREACH(const GLuint, texid, ec.texIdsMelees)
const WeaponClass *wc = IndexWeaponClassMelee(_ca_index);
Expand Down Expand Up @@ -194,9 +195,8 @@ void CharEditor(
(GLsizei)(BODY_PART_COUNT * ec.texidsChars.size), ec.texidsChars.data);
CArrayTerminate(&ec.texidsChars);
glDeleteTextures(BODY_PART_COUNT, ec.texidsPreview);
#define DELTEX(_tx) \
glDeleteTextures( \
(GLsizei)(_tx).size, (_tx).data); \
#define DELTEX(_tx) \
glDeleteTextures((GLsizei)(_tx).size, (_tx).data); \
TexArrayTerminate(&(_tx));
DELTEX(ec.texIdsCharClasses);
for (HeadPart hp = HEAD_PART_HAIR; hp < HEAD_PART_COUNT; hp++)
Expand All @@ -219,8 +219,8 @@ static const char *IndexHeadPartName(const int i, const HeadPart hp)
}
static int NumCharacterClasses(void)
{
return (
int)(gCharacterClasses.Classes.size + gCharacterClasses.CustomClasses.size);
return (int)(gCharacterClasses.Classes.size +
gCharacterClasses.CustomClasses.size);
}
static const char *IndexGunName(const int i)
{
Expand Down Expand Up @@ -364,7 +364,9 @@ static int NumMelees(void)
}
static int NumPickups(void)
{
return (int)(gPickupClasses.Classes.size + gPickupClasses.CustomClasses.size + gPickupClasses.KeyClasses.size + 1);
return (int)(gPickupClasses.Classes.size +
gPickupClasses.CustomClasses.size +
gPickupClasses.KeyClasses.size + 1);
}
static int GunIndex(const WeaponClass *wc)
{
Expand Down Expand Up @@ -566,7 +568,7 @@ static bool Draw(SDL_Window *win, struct nk_context *ctx, void *data)

if (ec->Char != NULL)
{
const float previewWidth = 80;
const float previewWidth = 100;
if (nk_begin(
ctx, "Preview",
nk_rect(
Expand All @@ -587,7 +589,7 @@ static bool Draw(SDL_Window *win, struct nk_context *ctx, void *data)
(int)ec->previewDir - 1, 0, DIRECTION_UPLEFT);
}
// Preview
nk_layout_row_dynamic(ctx, 32 * PIC_SCALE, 1);
nk_layout_row_dynamic(ctx, 48 * PIC_SCALE, 1);
gunstate_e gunStates[MAX_BARRELS];
for (int i = 0; i < MAX_BARRELS; i++)
{
Expand Down Expand Up @@ -642,16 +644,21 @@ static bool Draw(SDL_Window *win, struct nk_context *ctx, void *data)
if (hasStyle)
{
nk_layout_row(ctx, NK_DYNAMIC, ROW_HEIGHT, 2, colRatios);
const int current = HeadPartIndex(ec->Char->HeadParts[hp], hp);
const int current =
HeadPartIndex(ec->Char->HeadParts[hp], hp);
sprintf(buf, "%s:", HeadPartStr(hp));
int selected = DrawClassSelection(ctx, ec, buf, ec->texIdsHeadParts[hp].data, ec->HeadPartNames[hp], current, gPicManager.headPartNames[hp].size);
int selected = DrawClassSelection(
ctx, ec, buf, ec->texIdsHeadParts[hp].data,
ec->HeadPartNames[hp], current,
gPicManager.headPartNames[hp].size);
if (selected == -1)
{
selected = 0;
}
if (current != selected)
{
CharacterSetHeadPart(ec->Char, hp, IndexHeadPartName(selected, hp));
CharacterSetHeadPart(
ec->Char, hp, IndexHeadPartName(selected, hp));
}
}
else
Expand All @@ -670,15 +677,18 @@ static bool Draw(SDL_Window *win, struct nk_context *ctx, void *data)
{
*ec->FileChanged = true;
}
if (ColorPicker(ctx, ROW_HEIGHT, "Facial Hair:", &ec->Char->Colors.Facehair))
if (ColorPicker(
ctx, ROW_HEIGHT,
"Facial Hair:", &ec->Char->Colors.Facehair))
{
*ec->FileChanged = true;
}
if (ColorPicker(ctx, ROW_HEIGHT, "Hat:", &ec->Char->Colors.Hat))
{
*ec->FileChanged = true;
}
if (ColorPicker(ctx, ROW_HEIGHT, "Glasses:", &ec->Char->Colors.Glasses))
if (ColorPicker(
ctx, ROW_HEIGHT, "Glasses:", &ec->Char->Colors.Glasses))
{
*ec->FileChanged = true;
}
Expand Down Expand Up @@ -749,7 +759,8 @@ static bool Draw(SDL_Window *win, struct nk_context *ctx, void *data)
nk_property_int(
ctx, "Max Health:", 10, &ec->Char->maxHealth, 2000, 10, 1);
nk_property_int(
ctx, "Excess Health:", ec->Char->maxHealth, &ec->Char->excessHealth, 2000, 10, 1);
ctx, "Excess Health:", ec->Char->maxHealth,
&ec->Char->excessHealth, 2000, 10, 1);

nk_layout_row_dynamic(ctx, ROW_HEIGHT, 2);
DrawFlag(ctx, ec, "Asbestos", FLAGS_ASBESTOS, "Immune to fire");
Expand Down

0 comments on commit b3b98ef

Please sign in to comment.