From b31663bca51b25f9fdb7aea849d0cf14da37d441 Mon Sep 17 00:00:00 2001 From: Cong Date: Mon, 19 Dec 2022 23:01:17 +1100 Subject: [PATCH] Fix character duplicating when no hair --- CMakeLists.txt | 3 + .../techdemo/cyberdogs.cdogscpn/ammo.json | 18 ++++-- .../cyberdogs.cdogscpn/characters.json | 56 +++++++++++++++++++ .../techdemo/cyberdogs.cdogscpn/guns.json | 33 +++++++---- src/cdogsed/char_editor.c | 5 +- 5 files changed, 97 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22b2a551e..74a82eb70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,9 @@ ENDIF() if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MP -W4 -WX -wd\"4996\" -wd\"4204\"") + if(DEBUG) + ADD_DEFINITIONS(-ZI) + endif() else() add_definitions( -fsigned-char diff --git a/missions/custom/techdemo/cyberdogs.cdogscpn/ammo.json b/missions/custom/techdemo/cyberdogs.cdogscpn/ammo.json index 2c697b03a..26ad77049 100644 --- a/missions/custom/techdemo/cyberdogs.cdogscpn/ammo.json +++ b/missions/custom/techdemo/cyberdogs.cdogscpn/ammo.json @@ -8,7 +8,8 @@ "Pic": "bullet_pickup" }, "Sound": "bullet_pickup", - "Amount": 100 + "Amount": 100, + "Price": 600 }, { "Name": "Grenades", @@ -17,7 +18,8 @@ "Pic": "grenade_pickup" }, "Sound": "grenade_pickup", - "Amount": 10 + "Amount": 10, + "Price": 300 }, { "Name": "Cells", @@ -27,7 +29,8 @@ "TicksPerFrame": 10 }, "Sound": "cells_pickup", - "Amount": 10 + "Amount": 10, + "Price": 100 }, { "Name": "Mini cells", @@ -37,7 +40,8 @@ "TicksPerFrame": 10 }, "Sound": "mini_cells_pickup", - "Amount": 50 + "Amount": 50, + "Price": 500 }, { "Name": "Rockets", @@ -46,7 +50,8 @@ "Pic": "rockets" }, "Sound": "grenade_pickup", - "Amount": 10 + "Amount": 10, + "Price": 1000 }, { "Name": "Gas tank", @@ -55,7 +60,8 @@ "Pic": "gas_tank" }, "Sound": "gas_tank_pickup", - "Amount": 100 + "Amount": 100, + "Price": 500 } ] } diff --git a/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json b/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json index ac80f102a..69bd3dcc7 100644 --- a/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json +++ b/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json @@ -16,5 +16,61 @@ "probabilityToTrack": 25, "probabilityToShoot": 0, "actionDelay": 15 + }, + { + "Class": "Jones", + "PlayerTemplateName": "Jones", + "Skin": "f0944bff", + "Arms": "5050a0ff", + "Body": "5050a0ff", + "Legs": "5050a0ff", + "Hair": "000000ff", + "Feet": "5050a0ff", + "speed": 256, + "Gun": "Machine gun", + "maxHealth": 40, + "flags": 1024, + "probabilityToMove": 50, + "probabilityToTrack": 25, + "probabilityToShoot": 2, + "actionDelay": 15 + }, + { + "Class": "Jones", + "PlayerTemplateName": "Ice", + "HairType": "shades", + "Skin": "f0944bff", + "Arms": "5050a0ff", + "Body": "5050a0ff", + "Legs": "5050a0ff", + "Hair": "000000ff", + "Feet": "5050a0ff", + "speed": 256, + "Gun": "Machine gun", + "maxHealth": 40, + "flags": 1024, + "probabilityToMove": 50, + "probabilityToTrack": 25, + "probabilityToShoot": 2, + "actionDelay": 15 + }, + { + "Class": "Jones", + "PlayerTemplateName": "WarBaby", + "HairType": "beret", + "Skin": "f0944bff", + "Arms": "5050a0ff", + "Body": "5050a0ff", + "Legs": "5050a0ff", + "Hair": "f30202ff", + "Feet": "5050a0ff", + "speed": 256, + "Gun": "Machine gun", + "maxHealth": 40, + "flags": 1024, + "probabilityToMove": 50, + "probabilityToTrack": 25, + "probabilityToShoot": 2, + "actionDelay": 15 }] } \ No newline at end of file diff --git a/missions/custom/techdemo/cyberdogs.cdogscpn/guns.json b/missions/custom/techdemo/cyberdogs.cdogscpn/guns.json index 08e694137..4aa07d861 100644 --- a/missions/custom/techdemo/cyberdogs.cdogscpn/guns.json +++ b/missions/custom/techdemo/cyberdogs.cdogscpn/guns.json @@ -10,7 +10,8 @@ "Lock": 0, "Sound": "", "SoundLockLength": 50, - "CanShoot": false + "CanShoot": false, + "Price": 2000 }, { "Pic": "chainsaw", @@ -21,7 +22,8 @@ "Lock": 0, "Sound": "", "SoundLockLength": 50, - "CanShoot": false + "CanShoot": false, + "Price": 2000 }, { "Pic": "chainsaw", @@ -32,7 +34,8 @@ "Lock": 0, "Sound": "", "SoundLockLength": 50, - "CanShoot": false + "CanShoot": false, + "Price": 2000 }, { "Pic": "chainsaw", @@ -43,7 +46,8 @@ "Lock": 0, "Sound": "", "SoundLockLength": 50, - "CanShoot": false + "CanShoot": false, + "Price": 2000 }, { "Pic": "chainsaw", @@ -54,7 +58,8 @@ "Lock": 0, "Sound": "", "SoundLockLength": 50, - "CanShoot": false + "CanShoot": false, + "Price": 2000 }, { "Pic": "", @@ -79,7 +84,8 @@ "SwitchSound": "mg_switch", "MuzzleFlashParticle": "muzzle_flash_mg", "Brass": "brass_big", - "Ammo": "Bullets" + "Ammo": "Bullets", + "Price": 3100 }, { "Pic": "launcher", @@ -90,7 +96,8 @@ "Sound": "bottle_pop", "SwitchSound": "swarmer_switch", "Elevation": 14, - "Ammo": "Grenades" + "Ammo": "Grenades", + "Price": 2800 }, { "Pic": "flamer", @@ -103,7 +110,8 @@ "SwitchSound": "flamer_switch", "SoundLockLength": 36, "MuzzleFlashParticle": "muzzle_flash_flamer", - "Ammo": "Gas tank" + "Ammo": "Gas tank", + "Price": 3000 }, { "Name": "Powergun", @@ -113,7 +121,8 @@ "Sound": "fusion", "SwitchSound": "powergun_switch", "MuzzleFlashParticle": "muzzle_flash_powergun", - "Ammo": "Cells" + "Ammo": "Cells", + "Price": 2100 }, { "Pic": "blaster_yellow", @@ -144,7 +153,8 @@ "Sound": "pistol", "SwitchSound": "pulse_switch", "MuzzleFlashParticle": "muzzle_flash_pulse", - "Ammo": "Mini cells" + "Ammo": "Mini cells", + "Price": 1500 }, { "Pic": "rifle", @@ -160,7 +170,8 @@ "Shake": { "Amount": 8, "CameraSubjectOnly": true - } + }, + "Price": 6500 }, { "Name": "DumbGun", diff --git a/src/cdogsed/char_editor.c b/src/cdogsed/char_editor.c index f45d1e6b1..099046004 100644 --- a/src/cdogsed/char_editor.c +++ b/src/cdogsed/char_editor.c @@ -691,7 +691,10 @@ static void AddCharacter(EditorContext *ec, const int cloneIdx) { CSTRDUP(ec->Char->PlayerTemplateName, clone->PlayerTemplateName); } - CSTRDUP(ec->Char->Hair, clone->Hair); + if (clone->Hair) + { + CSTRDUP(ec->Char->Hair, clone->Hair); + } CMALLOC(ec->Char->bot, sizeof *ec->Char->bot); memcpy(ec->Char->bot, clone->bot, sizeof *ec->Char->bot); }