- Arreglats un milló de warnings tontos (i alguno serio)
This commit is contained in:
@@ -1757,7 +1757,7 @@ namespace actor
|
|||||||
std::vector<actor_t> actors;
|
std::vector<actor_t> actors;
|
||||||
for (auto act : templates)
|
for (auto act : templates)
|
||||||
{
|
{
|
||||||
if (act.template_category >= categories.size())
|
if (act.template_category >= (int)categories.size())
|
||||||
act.template_category = 0;
|
act.template_category = 0;
|
||||||
if (categories[act.template_category] == catname)
|
if (categories[act.template_category] == catname)
|
||||||
actors.push_back(act);
|
actors.push_back(act);
|
||||||
@@ -1783,7 +1783,7 @@ namespace actor
|
|||||||
|
|
||||||
actor_t *getByName(const char *name)
|
actor_t *getByName(const char *name)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < templates.size(); ++i)
|
for (int i = 0; i < (int)templates.size(); ++i)
|
||||||
if (util::strcomp(name, templates[i].name))
|
if (util::strcomp(name, templates[i].name))
|
||||||
return &templates[i];
|
return &templates[i];
|
||||||
// for (auto t : templates) if (util::strcomp(name, t.name)) return &t;
|
// for (auto t : templates) if (util::strcomp(name, t.name)) return &t;
|
||||||
@@ -1837,9 +1837,9 @@ namespace actor
|
|||||||
|
|
||||||
void swapCategories(const int a, const int b)
|
void swapCategories(const int a, const int b)
|
||||||
{
|
{
|
||||||
if (a >= categories.size() || a < 0)
|
if (a >= (int)categories.size() || a < 0)
|
||||||
return;
|
return;
|
||||||
if (b >= categories.size() || b < 0)
|
if (b >= (int)categories.size() || b < 0)
|
||||||
return;
|
return;
|
||||||
auto str = categories[a];
|
auto str = categories[a];
|
||||||
categories[a] = categories[b];
|
categories[a] = categories[b];
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ namespace console
|
|||||||
const int getIndexFromString(char *str, std::vector<const char*> list)
|
const int getIndexFromString(char *str, std::vector<const char*> list)
|
||||||
{
|
{
|
||||||
//static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
|
//static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
|
||||||
for (int i=0;i<list.size();++i)
|
for (int i=0; i<(int)list.size(); ++i)
|
||||||
{
|
{
|
||||||
if (strcmp(str, list[i])==0)
|
if (strcmp(str, list[i])==0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ namespace audio
|
|||||||
// Inicialitza el sistema de só
|
// Inicialitza el sistema de só
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
int result = Mix_Init(MIX_INIT_OGG | MIX_INIT_WAVPACK);
|
//int result =
|
||||||
|
Mix_Init(MIX_INIT_OGG);// | MIX_INIT_WAVPACK);
|
||||||
// Al final he ficat la configuració automàtica i au. Si en el futur necesitem canviar-ho pos se canvia
|
// Al final he ficat la configuració automàtica i au. Si en el futur necesitem canviar-ho pos se canvia
|
||||||
result = Mix_OpenAudio(48000, AUDIO_S16, 2, 512);
|
//result =
|
||||||
|
Mix_OpenAudio(48000, AUDIO_S16, 2, 512);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tanca el sistema de só (no shit, sherlock)
|
// Tanca el sistema de só (no shit, sherlock)
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ namespace draw
|
|||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
char *n = buffer;
|
char *n = buffer;
|
||||||
while (*n!=0) {
|
while (*n!=0) {
|
||||||
while (*n!='\n') n++; *n=0;
|
while (*n!='\n') n++;
|
||||||
|
*n=0;
|
||||||
loadSurface(p);
|
loadSurface(p);
|
||||||
p=++n;
|
p=++n;
|
||||||
}
|
}
|
||||||
@@ -614,7 +615,8 @@ namespace draw
|
|||||||
const uint32_t size = screen->w * screen->h; // tamany de la superficie
|
const uint32_t size = screen->w * screen->h; // tamany de la superficie
|
||||||
|
|
||||||
// Bloquejem la textura SDL i agafem els seus pixels (son enters de 32 bits amb format 0xAARRGGBB)
|
// Bloquejem la textura SDL i agafem els seus pixels (son enters de 32 bits amb format 0xAARRGGBB)
|
||||||
int result = SDL_LockTexture(sdl_texture, NULL, (void **)&sdl_pixels, &sdl_pitch);
|
//int result =
|
||||||
|
SDL_LockTexture(sdl_texture, NULL, (void **)&sdl_pixels, &sdl_pitch);
|
||||||
|
|
||||||
// Cada pixel de la superficie "screen" es un enter de 8 bits que representa un index en la paleta de colors
|
// Cada pixel de la superficie "screen" es un enter de 8 bits que representa un index en la paleta de colors
|
||||||
// Per tant, per a pintar en la textura SDL, pillem el color de la paleta que correspon al index en "screen"
|
// Per tant, per a pintar en la textura SDL, pillem el color de la paleta que correspon al index en "screen"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace util
|
|||||||
{
|
{
|
||||||
char lowercase[255];
|
char lowercase[255];
|
||||||
strcpy(lowercase, value);
|
strcpy(lowercase, value);
|
||||||
for (int i=0; i<strlen(value);++i) lowercase[i]=tolower(value[i]);
|
for (int i=0; i<(int)strlen(value);++i) lowercase[i]=tolower(value[i]);
|
||||||
|
|
||||||
const int max_size = strings.size()<values.size()?strings.size():values.size();
|
const int max_size = strings.size()<values.size()?strings.size():values.size();
|
||||||
for (int i=0;i<max_size;++i)
|
for (int i=0;i<max_size;++i)
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ namespace modules
|
|||||||
|
|
||||||
actor::actor_t *sel = actor::getSelected();
|
actor::actor_t *sel = actor::getSelected();
|
||||||
|
|
||||||
if (input::keyDown(SDL_SCANCODE_UP)) if (!ctrl) sel->bmp_rect.y--; else sel->bmp_rect.h--;
|
if (input::keyDown(SDL_SCANCODE_UP)) { if (!ctrl) sel->bmp_rect.y--; else sel->bmp_rect.h--; }
|
||||||
if (input::keyDown(SDL_SCANCODE_DOWN)) if (!ctrl) sel->bmp_rect.y++; else sel->bmp_rect.h++;
|
if (input::keyDown(SDL_SCANCODE_DOWN)) { if (!ctrl) sel->bmp_rect.y++; else sel->bmp_rect.h++; }
|
||||||
if (input::keyDown(SDL_SCANCODE_LEFT)) if (!ctrl) sel->bmp_rect.x--; else sel->bmp_rect.w--;
|
if (input::keyDown(SDL_SCANCODE_LEFT)) { if (!ctrl) sel->bmp_rect.x--; else sel->bmp_rect.w--; }
|
||||||
if (input::keyDown(SDL_SCANCODE_RIGHT)) if (!ctrl) sel->bmp_rect.x++; else sel->bmp_rect.w++;
|
if (input::keyDown(SDL_SCANCODE_RIGHT)) { if (!ctrl) sel->bmp_rect.x++; else sel->bmp_rect.w++; }
|
||||||
|
|
||||||
if (input::mouseBtn(1))
|
if (input::mouseBtn(1))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ namespace modules
|
|||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
char *n = buffer;
|
char *n = buffer;
|
||||||
while (*n!=0) {
|
while (*n!=0) {
|
||||||
while (*n!='\n') n++; *n=0;
|
while (*n!='\n') n++;
|
||||||
|
*n=0;
|
||||||
gifs.push_back(p);
|
gifs.push_back(p);
|
||||||
p=++n;
|
p=++n;
|
||||||
}
|
}
|
||||||
@@ -39,7 +40,7 @@ namespace modules
|
|||||||
const int x = input::mouseX()/80;
|
const int x = input::mouseX()/80;
|
||||||
const int y = input::mouseY()/80;
|
const int y = input::mouseY()/80;
|
||||||
const int selected = x+y*6;
|
const int selected = x+y*6;
|
||||||
if (selected < gifs.size())
|
if (selected < (int)gifs.size())
|
||||||
{
|
{
|
||||||
actor::actor_t* act = actor::getSelected();
|
actor::actor_t* act = actor::getSelected();
|
||||||
strcpy(act->bmp, gifs[selected].c_str());
|
strcpy(act->bmp, gifs[selected].c_str());
|
||||||
@@ -54,18 +55,18 @@ namespace modules
|
|||||||
const int x = input::mouseX()/80;
|
const int x = input::mouseX()/80;
|
||||||
const int y = input::mouseY()/80;
|
const int y = input::mouseY()/80;
|
||||||
selected = x+y*6;
|
selected = x+y*6;
|
||||||
if (selected >= gifs.size()) selected = -1;
|
if (selected >= (int)gifs.size()) selected = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw::cls(2);
|
draw::cls(2);
|
||||||
int bx = 0;
|
int bx = 0;
|
||||||
int by = 0;
|
int by = 0;
|
||||||
for (int i=0; i<gifs.size(); ++i)
|
for (int i=0; i<(int)gifs.size(); ++i)
|
||||||
{
|
{
|
||||||
draw::surface *surf = draw::getSurface(gifs[i].c_str());
|
draw::surface *surf = draw::getSurface(gifs[i].c_str());
|
||||||
draw::setSource(surf);
|
draw::setSource(surf);
|
||||||
const float aspect = float(surf->w) / float(surf->h);
|
//const float aspect = float(surf->w) / float(surf->h);
|
||||||
const int width = 64.0f*aspect;
|
//const int width = 64.0f*aspect;
|
||||||
draw::draw(2+80*bx, 2+by*80, surf->w, surf->h, 0, 0, 0, 64, 64);
|
draw::draw(2+80*bx, 2+by*80, surf->w, surf->h, 0, 0, 0, 64, 64);
|
||||||
draw::print(gifs[i].c_str(), 2+80*bx + 32 - (gifs[0].size()/2)*4, 70+by*80, LIGHT+WHITE, PAPER);
|
draw::print(gifs[i].c_str(), 2+80*bx + 32 - (gifs[0].size()/2)*4, 70+by*80, LIGHT+WHITE, PAPER);
|
||||||
bx++; if (bx>5) { bx=0; by++; }
|
bx++; if (bx>5) { bx=0; by++; }
|
||||||
|
|||||||
@@ -104,9 +104,9 @@ namespace modules
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
auto actors = actor::templates::getByCategory(categories[current_category].c_str());
|
auto actors = actor::templates::getByCategory(categories[current_category].c_str());
|
||||||
|
|
||||||
if (input::keyPressed(SDL_SCANCODE_X) && (hovered_actor < actors.size())) strcpy(actor_cut, actors[hovered_actor].name);
|
if (input::keyPressed(SDL_SCANCODE_X) && (hovered_actor < (int)actors.size())) strcpy(actor_cut, actors[hovered_actor].name);
|
||||||
|
|
||||||
if (input::keyPressed(SDL_SCANCODE_W) && (hovered_actor < actors.size()) && actor_cut[0]!=0)
|
if (input::keyPressed(SDL_SCANCODE_W) && (hovered_actor < (int)actors.size()) && actor_cut[0]!=0)
|
||||||
{
|
{
|
||||||
actor::actor_t *act = actor::templates::getByName(actor_cut);
|
actor::actor_t *act = actor::templates::getByName(actor_cut);
|
||||||
actor::actor_t *other = actor::templates::getByName(actors[hovered_actor].name);
|
actor::actor_t *other = actor::templates::getByName(actors[hovered_actor].name);
|
||||||
@@ -135,12 +135,12 @@ namespace modules
|
|||||||
|
|
||||||
current_category += input::mouseWheel();
|
current_category += input::mouseWheel();
|
||||||
if (current_category < 0) current_category = categories.size()-1;
|
if (current_category < 0) current_category = categories.size()-1;
|
||||||
if (current_category >= categories.size()) current_category = 0;
|
if (current_category >= (int)categories.size()) current_category = 0;
|
||||||
|
|
||||||
if (input::mouseClk(1))
|
if (input::mouseClk(1))
|
||||||
{
|
{
|
||||||
if (input::mouseY()>12) {
|
if (input::mouseY()>12) {
|
||||||
if (hovered_actor<=actors.size()) {
|
if (hovered_actor <= (int)actors.size()) {
|
||||||
actor::actor_t *new_act = actor::duplicate(&actors[hovered_actor]);
|
actor::actor_t *new_act = actor::duplicate(&actors[hovered_actor]);
|
||||||
actor::setUniqueName(new_act);
|
actor::setUniqueName(new_act);
|
||||||
actor::setDirty(new_act, true);
|
actor::setDirty(new_act, true);
|
||||||
@@ -156,7 +156,7 @@ namespace modules
|
|||||||
init_text_edit();
|
init_text_edit();
|
||||||
} else {
|
} else {
|
||||||
int clicked_category = (input::mouseX()-11)/40;
|
int clicked_category = (input::mouseX()-11)/40;
|
||||||
if (clicked_category<categories.size())
|
if (clicked_category < (int)categories.size())
|
||||||
{
|
{
|
||||||
if (input::keyDown(SDL_SCANCODE_LCTRL))
|
if (input::keyDown(SDL_SCANCODE_LCTRL))
|
||||||
{
|
{
|
||||||
@@ -171,7 +171,7 @@ namespace modules
|
|||||||
else if (input::mouseClk(3))
|
else if (input::mouseClk(3))
|
||||||
{
|
{
|
||||||
if (input::mouseX()>12) {
|
if (input::mouseX()>12) {
|
||||||
if (hovered_actor<=actors.size()) {
|
if (hovered_actor <= (int)actors.size()) {
|
||||||
actor_edited = actor::templates::getByName(actors[hovered_actor].name);
|
actor_edited = actor::templates::getByName(actors[hovered_actor].name);
|
||||||
edit_mode = EDITING_ACTOR_NAME;
|
edit_mode = EDITING_ACTOR_NAME;
|
||||||
init_text_edit();
|
init_text_edit();
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ namespace modules
|
|||||||
|
|
||||||
int mx = draw::getLocalX(input::mouseX());
|
int mx = draw::getLocalX(input::mouseX());
|
||||||
int my = draw::getLocalY(input::mouseY());
|
int my = draw::getLocalY(input::mouseY());
|
||||||
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
//const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
||||||
const bool btnClk = input::mouseClk(1) || input::mouseClk(3);
|
const bool btnClk = input::mouseClk(1) || input::mouseClk(3);
|
||||||
|
|
||||||
if (mx>=0 && mx <=100 && my>=0 && my<=221)
|
if (mx>=0 && mx <=100 && my>=0 && my<=221)
|
||||||
|
|||||||
@@ -112,14 +112,14 @@ namespace modules
|
|||||||
{
|
{
|
||||||
int x = pixels[pixel].x - 25;
|
int x = pixels[pixel].x - 25;
|
||||||
int y = 3 - pixels[pixel].y;
|
int y = 3 - pixels[pixel].y;
|
||||||
pixels[pixel].distance = sqrtf(x*x + y*y);
|
pixels[pixel].distance = SDL_sqrtf(x*x + y*y);
|
||||||
pixels[pixel].angle = atan2f(y, x)/(M_PI/180.0f);
|
pixels[pixel].angle = SDL_atan2f(y, x)/(M_PI/180.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculate_coords_from_dist_angle(int pixel)
|
void calculate_coords_from_dist_angle(int pixel)
|
||||||
{
|
{
|
||||||
pixels[pixel].x = 25 + roundf(cosf((pixels[pixel].angle+pixels[pixel].ai)*(M_PI/180.0f)) * (pixels[pixel].distance*pixels[pixel].di));
|
pixels[pixel].x = 25 + SDL_roundf(SDL_cosf((pixels[pixel].angle+pixels[pixel].ai)*(M_PI/180.0f)) * (pixels[pixel].distance*pixels[pixel].di));
|
||||||
pixels[pixel].y = 3 - roundf(sinf((pixels[pixel].angle+pixels[pixel].ai)*(M_PI/180.0f)) * (pixels[pixel].distance*pixels[pixel].di));
|
pixels[pixel].y = 3 - SDL_roundf(SDL_sinf((pixels[pixel].angle+pixels[pixel].ai)*(M_PI/180.0f)) * (pixels[pixel].distance*pixels[pixel].di));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,10 +32,14 @@ namespace modules
|
|||||||
return OPTION_EIXIR;
|
return OPTION_EIXIR;
|
||||||
}
|
}
|
||||||
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
||||||
|
{
|
||||||
selected_option++; if (selected_option==5) selected_option=0;
|
selected_option++; if (selected_option==5) selected_option=0;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP))
|
if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP))
|
||||||
|
{
|
||||||
selected_option--; if (selected_option<0) selected_option=4;
|
selected_option--; if (selected_option<0) selected_option=4;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE) ) {
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE) ) {
|
||||||
return selected_option;
|
return selected_option;
|
||||||
|
|||||||
Reference in New Issue
Block a user