/*
Copyright (C) 2003, 2010 - Wolfire Games
-Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
+Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file)
This file is part of Lugaru.
sscanf(args, "%f%f%f%f", &headprop, &bodyprop, &armprop, &legprop);
- if (Person::players[pnum]->creature == wolftype) {
- Person::players[pnum]->proportionhead = 1.1 * headprop;
- Person::players[pnum]->proportionbody = 1.1 * bodyprop;
- Person::players[pnum]->proportionarms = 1.1 * armprop;
- Person::players[pnum]->proportionlegs = 1.1 * legprop;
- } else if (Person::players[pnum]->creature == rabbittype) {
- Person::players[pnum]->proportionhead = 1.2 * headprop;
- Person::players[pnum]->proportionbody = 1.05 * bodyprop;
- Person::players[pnum]->proportionarms = 1.00 * armprop;
- Person::players[pnum]->proportionlegs = 1.1 * legprop;
- Person::players[pnum]->proportionlegs.y = 1.05 * legprop;
- }
+ Person::players[pnum]->setProportions(headprop, bodyprop, armprop, legprop);
}
static void set_protection(int pnum, const char* args)
{
Person::players[pnum]->numclothes = 0;
Person::players[pnum]->skeleton.drawmodel.textureptr.load(
- creatureskin[Person::players[pnum]->creature][Person::players[pnum]->whichskin], 1,
+ PersonType::types[Person::players[pnum]->creature].skins[Person::players[pnum]->whichskin], 1,
&Person::players[pnum]->skeleton.skinText[0], &Person::players[pnum]->skeleton.skinsize);
}
char buf[64];
snprintf(buf, 63, "Textures/%s.png", args);
+ const std::string file_path = Folders::getResourcePath(buf);
+ FILE* tfile;
+ tfile = fopen(file_path.c_str(), "rb");
+ if (tfile == NULL) {
+ perror((std::string("Couldn't find file ") + file_path + " to assign as clothes").c_str());
+
+ // FIXME: Reduce code duplication with GameTick (should come from a Console class)
+ for (int k = 14; k >= 1; k--) {
+ consoletext[k] = consoletext[k - 1];
+ }
+ consoletext[0] = std::string("Could not load the requested texture '") + args + "', aborting.";
+ consoleselected = 0;
+
+ return;
+ }
+
int id = Person::players[pnum]->numclothes;
strncpy(Person::players[pnum]->clothes[id], buf, 64);
Person::players[pnum]->clothestintr[id] = tintr;
fpackf(tfile, "Bf Bf Bf", Person::players[j]->protectionhead, Person::players[j]->protectionhigh, Person::players[j]->protectionlow);
fpackf(tfile, "Bf Bf Bf", Person::players[j]->metalhead, Person::players[j]->metalhigh, Person::players[j]->metallow);
fpackf(tfile, "Bf Bf", Person::players[j]->power, Person::players[j]->speedmult);
-
- float headprop, bodyprop, armprop, legprop;
- if (Person::players[j]->creature == wolftype) {
- headprop = Person::players[j]->proportionhead.x / 1.1;
- bodyprop = Person::players[j]->proportionbody.x / 1.1;
- armprop = Person::players[j]->proportionarms.x / 1.1;
- legprop = Person::players[j]->proportionlegs.x / 1.1;
- } else {
- // rabbittype
- headprop = Person::players[j]->proportionhead.x / 1.2;
- bodyprop = Person::players[j]->proportionbody.x / 1.05;
- armprop = Person::players[j]->proportionarms.x / 1.00;
- legprop = Person::players[j]->proportionlegs.x / 1.1;
- }
-
- fpackf(tfile, "Bf Bf Bf Bf", headprop, bodyprop, armprop, legprop);
+ fpackf(tfile, "Bf Bf Bf Bf", Person::players[j]->getProportion(0), Person::players[j]->getProportion(1), Person::players[j]->getProportion(2), Person::players[j]->getProportion(3));
fpackf(tfile, "Bi", Person::players[j]->numclothes);
if (Person::players[j]->numclothes) {
void ch_cellophane(const char*)
{
cellophane = !cellophane;
- float mul = (cellophane ? 0 : 1);
-
- for (auto player : Person::players) {
- player->proportionhead.z = player->proportionhead.x * mul;
- player->proportionbody.z = player->proportionbody.x * mul;
- player->proportionarms.z = player->proportionarms.x * mul;
- player->proportionlegs.z = player->proportionlegs.x * mul;
- }
}
void ch_funnybunny(const char*)
{
Person::players[0]->creature = wolftype;
Person::players[0]->skeletonLoad();
+ Person::players[0]->scale = .23;
Person::players[0]->damagetolerance = 300;
set_proportion(0, "1 1 1 1");
}
-void ch_wolfieisgod(const char* args)
-{
- ch_wolfie(args);
-}
-
void ch_wolf(const char*)
{
Person::players[0]->skeleton.drawmodel.textureptr.load("Textures/Wolf.jpg", 1, &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
Person::players[0]->metallow = 1;
Person::players[0]->power = 1;
Person::players[0]->speedmult = 1;
- Person::players[0]->scale = 1;
-
if (Person::players[0]->creature == wolftype) {
- Person::players[0]->proportionhead = 1.1;
- Person::players[0]->proportionbody = 1.1;
- Person::players[0]->proportionarms = 1.1;
- Person::players[0]->proportionlegs = 1.1;
+ Person::players[0]->scale = .23;
} else if (Person::players[0]->creature == rabbittype) {
- Person::players[0]->proportionhead = 1.2;
- Person::players[0]->proportionbody = 1.05;
- Person::players[0]->proportionarms = 1.00;
- Person::players[0]->proportionlegs = 1.1;
- Person::players[0]->proportionlegs.y = 1.05;
+ Person::players[0]->scale = .2;
}
+ Person::players[0]->setProportions(1, 1, 1, 1);
+
Person::players[0]->numclothes = 0;
Person::players[0]->skeleton.drawmodel.textureptr.load(
- creatureskin[Person::players[0]->creature][Person::players[0]->whichskin], 1,
+ PersonType::types[Person::players[0]->creature].skins[Person::players[0]->whichskin], 1,
&Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
editoractive = typeactive;