From 9ca1e59f4438326d0377cb081ca960fb0fe9dfe6 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Thu, 3 Oct 2024 13:40:54 +0200 Subject: [PATCH] =?UTF-8?q?-=20Arreglats=20un=20mill=C3=B3=20de=20warnings?= =?UTF-8?q?=20tontos=20(i=20alguno=20serio)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/actor.cpp | 8 ++++---- source/console.cpp | 2 +- source/jaudio.cpp | 6 ++++-- source/jdraw.cpp | 6 ++++-- source/jutil.cpp | 2 +- source/m_editor_bitmap.cpp | 8 ++++---- source/m_editor_bitmap_file.cpp | 13 +++++++------ source/m_editor_templates.cpp | 12 ++++++------ source/m_game.cpp | 2 +- source/m_logo.cpp | 8 ++++---- source/m_menu.cpp | 4 ++++ 11 files changed, 40 insertions(+), 31 deletions(-) diff --git a/source/actor.cpp b/source/actor.cpp index 720a387..566decb 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -1757,7 +1757,7 @@ namespace actor std::vector actors; for (auto act : templates) { - if (act.template_category >= categories.size()) + if (act.template_category >= (int)categories.size()) act.template_category = 0; if (categories[act.template_category] == catname) actors.push_back(act); @@ -1783,7 +1783,7 @@ namespace actor 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)) return &templates[i]; // 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) { - if (a >= categories.size() || a < 0) + if (a >= (int)categories.size() || a < 0) return; - if (b >= categories.size() || b < 0) + if (b >= (int)categories.size() || b < 0) return; auto str = categories[a]; categories[a] = categories[b]; diff --git a/source/console.cpp b/source/console.cpp index d7275f3..e06d546 100644 --- a/source/console.cpp +++ b/source/console.cpp @@ -173,7 +173,7 @@ namespace console const int getIndexFromString(char *str, std::vector list) { //static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"}; - for (int i=0;iw * screen->h; // tamany de la superficie // 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 // Per tant, per a pintar en la textura SDL, pillem el color de la paleta que correspon al index en "screen" diff --git a/source/jutil.cpp b/source/jutil.cpp index 8f2c1c5..b9a19da 100644 --- a/source/jutil.cpp +++ b/source/jutil.cpp @@ -8,7 +8,7 @@ namespace util { char lowercase[255]; strcpy(lowercase, value); - for (int i=0; ibmp_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_RIGHT)) if (!ctrl) sel->bmp_rect.x++; else sel->bmp_rect.w++; + 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_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::mouseBtn(1)) { diff --git a/source/m_editor_bitmap_file.cpp b/source/m_editor_bitmap_file.cpp index 320f353..22106d7 100644 --- a/source/m_editor_bitmap_file.cpp +++ b/source/m_editor_bitmap_file.cpp @@ -23,7 +23,8 @@ namespace modules char *p = buffer; char *n = buffer; while (*n!=0) { - while (*n!='\n') n++; *n=0; + while (*n!='\n') n++; + *n=0; gifs.push_back(p); p=++n; } @@ -39,7 +40,7 @@ namespace modules const int x = input::mouseX()/80; const int y = input::mouseY()/80; const int selected = x+y*6; - if (selected < gifs.size()) + if (selected < (int)gifs.size()) { actor::actor_t* act = actor::getSelected(); strcpy(act->bmp, gifs[selected].c_str()); @@ -54,18 +55,18 @@ namespace modules const int x = input::mouseX()/80; const int y = input::mouseY()/80; selected = x+y*6; - if (selected >= gifs.size()) selected = -1; + if (selected >= (int)gifs.size()) selected = -1; } draw::cls(2); int bx = 0; int by = 0; - for (int i=0; iw) / float(surf->h); - const int width = 64.0f*aspect; + //const float aspect = float(surf->w) / float(surf->h); + //const int width = 64.0f*aspect; 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); bx++; if (bx>5) { bx=0; by++; } diff --git a/source/m_editor_templates.cpp b/source/m_editor_templates.cpp index 655d523..3db8565 100644 --- a/source/m_editor_templates.cpp +++ b/source/m_editor_templates.cpp @@ -104,9 +104,9 @@ namespace modules int i = 0; 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 *other = actor::templates::getByName(actors[hovered_actor].name); @@ -135,12 +135,12 @@ namespace modules current_category += input::mouseWheel(); 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::mouseY()>12) { - if (hovered_actor<=actors.size()) { + if (hovered_actor <= (int)actors.size()) { actor::actor_t *new_act = actor::duplicate(&actors[hovered_actor]); actor::setUniqueName(new_act); actor::setDirty(new_act, true); @@ -156,7 +156,7 @@ namespace modules init_text_edit(); } else { int clicked_category = (input::mouseX()-11)/40; - if (clicked_category12) { - if (hovered_actor<=actors.size()) { + if (hovered_actor <= (int)actors.size()) { actor_edited = actor::templates::getByName(actors[hovered_actor].name); edit_mode = EDITING_ACTOR_NAME; init_text_edit(); diff --git a/source/m_game.cpp b/source/m_game.cpp index 7de81f7..3eeb47d 100644 --- a/source/m_game.cpp +++ b/source/m_game.cpp @@ -547,7 +547,7 @@ namespace modules int mx = draw::getLocalX(input::mouseX()); 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); if (mx>=0 && mx <=100 && my>=0 && my<=221) diff --git a/source/m_logo.cpp b/source/m_logo.cpp index 5b2cb87..8e06416 100644 --- a/source/m_logo.cpp +++ b/source/m_logo.cpp @@ -112,14 +112,14 @@ namespace modules { int x = pixels[pixel].x - 25; int y = 3 - pixels[pixel].y; - pixels[pixel].distance = sqrtf(x*x + y*y); - pixels[pixel].angle = atan2f(y, x)/(M_PI/180.0f); + pixels[pixel].distance = SDL_sqrtf(x*x + y*y); + pixels[pixel].angle = SDL_atan2f(y, x)/(M_PI/180.0f); } 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].y = 3 - roundf(sinf((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 - SDL_roundf(SDL_sinf((pixels[pixel].angle+pixels[pixel].ai)*(M_PI/180.0f)) * (pixels[pixel].distance*pixels[pixel].di)); } } } \ No newline at end of file diff --git a/source/m_menu.cpp b/source/m_menu.cpp index 760c8bc..95ae7ac 100644 --- a/source/m_menu.cpp +++ b/source/m_menu.cpp @@ -32,10 +32,14 @@ namespace modules return OPTION_EIXIR; } if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN)) + { selected_option++; if (selected_option==5) selected_option=0; + } if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP)) + { selected_option--; if (selected_option<0) selected_option=4; + } if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE) ) { return selected_option;