Loobinex / keeperfx-unofficial

KeeperFX - Unofficial release
60 stars 7 forks source link

cleanup #103

Closed Trass3r closed 4 years ago

Trass3r commented 4 years ago

fix portability issues and warnings clean up legacy

Loobinex commented 4 years ago

@Trass3r I'm getting loads of new warnings when I build this. Here's a small selection:

Building file: src/room_util.c
gcc -I"sdl/include" -c -fmessage-length=0 -Wall -W -Wshadow -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -MMD -MP -MF"obj/std/room_util.d" -MT"obj/std/room_util.d" -march=i686 -fno-omit-frame-pointer -O3   -DBFDEBUG_LEVEL=0  -o"obj/std/room_util.o" "src/room_util.c"
src/room_util.c: In function 'delete_room_slab':
src/room_util.c:282:9: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat=]
         ERRORLOG("Slab (%ld,%ld) is not a room",slb_x, slb_y);
         ^
src/room_util.c:282:9: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'int' [-Wformat=]
src/room_util.c: In function 'check_and_asimilate_thing_by_room':
src/room_util.c:330:13: warning: format '%d' expects argument of type 'int', but argument 4 has type 'const char *' [-Wformat=]
             ERRORLOG("Found %s outside of %d room; removing",thing_model_name(thing),room_code_name(RoK_TREASURE));
             ^
Finished building: src/room_util.c

src/thing_objects.c:1195:18: warning: shadowed declaration is here [-Wshadow]
     MapSlabCoord slb_x, slb_y;
                  ^
src/thing_objects.c:1219:28: warning: declaration of 'slb_y' shadows a previous local [-Wshadow]
         MapSlabCoord slb_x,slb_y;
                            ^
src/thing_objects.c:1195:25: warning: shadowed declaration is here [-Wshadow]
     MapSlabCoord slb_x, slb_y;
                         ^

Building file: src/vidmode.c
gcc -I"sdl/include" -c -fmessage-length=0 -Wall -W -Wshadow -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -MMD -MP -MF"obj/std/vidmode.d" -MT"obj/std/vidmode.d" -march=i686 -fno-omit-frame-pointer -O3   -DBFDEBUG_LEVEL=0  -o"obj/std/vidmode.o" "src/vidmode.c"
src/vidmode.c: In function 'get_higher_vidmode':
src/vidmode.c:225:27: warning: declaration of 'mdinfo' shadows a previous local [-Wshadow]
         TbScreenModeInfo *mdinfo;
                           ^
src/vidmode.c:213:23: warning: shadowed declaration is here [-Wshadow]
     TbScreenModeInfo *mdinfo;
                       ^
src/vidmode.c: In function 'set_pointer_graphic':
src/vidmode.c:466:5: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
     WARNLOG("Unrecognized Mouse Pointer index, %d",ptr_idx);
     ^
src/vidmode.c: In function 'init_fades_table':
src/vidmode.c:505:23: warning: unused variable 'textname' [-Wunused-variable]
     static const char textname[] = "fade table";
                       ^
src/vidmode.c: In function 'init_alpha_table':
src/vidmode.c:528:23: warning: unused variable 'textname' [-Wunused-variable]
     static const char textname[] = "alpha color table";
                       ^
src/vidmode.c: In function 'init_rgb2idx_table':
src/vidmode.c:543:23: warning: unused variable 'textname' [-Wunused-variable]
     static const char textname[] = "rgb-to-index color table";
                       ^
src/vidmode.c: In function 'init_redpal_table':
src/vidmode.c:558:23: warning: unused variable 'textname' [-Wunused-variable]
     static const char textname[] = "red-blended color table";
                       ^
src/vidmode.c: In function 'init_whitepal_table':
src/vidmode.c:573:23: warning: unused variable 'textname' [-Wunused-variable]
     static const char textname[] = "white-blended color table";
                       ^
Finished building: src/vidmode.c

Building file: src/KeeperSpeechImp.c
gcc -I"sdl/include" -c -fmessage-length=0 -Wall -W -Wshadow -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -MMD -MP -MF"obj/std/KeeperSpeechImp.d" -MT"obj/std/KeeperSpeechImp.d" -march=i686 -fno-omit-frame-pointer -O3   -DBFDEBUG_LEVEL=0  -o"obj/std/KeeperSpeechImp.o" "src/KeeperSpeechImp.c"
src/KeeperSpeechImp.c:39:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
 } static ks_fn;
 ^
Finished building: src/KeeperSpeechImp.c

Building file: src/main.cpp
g++ -I"sdl/include" -c -fmessage-length=0 -Wall -W -Wshadow -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -MMD -MP -MF"obj/std/main.d" -MT"obj/std/main.d" -march=i686 -fno-omit-frame-pointer -O3   -DBFDEBUG_LEVEL=0  -o"obj/std/main.o" "src/main.cpp"
In file included from src/keeperfx.hpp:22:0,
                 from src/main.cpp:6:
src/main.cpp: In function 'short int setup_game()':
src/globals.h:108:66: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'long int' [-Wformat=]
 #define SYNCMSG(format, ...) LbSyncLog(format "\n", ##__VA_ARGS__)
                                                                  ^
src/main.cpp:1059:3: note: in expansion of macro 'SYNCMSG'
   SYNCMSG("CPU %s type %d family %d model %d stepping %d features %08x",cpu_info.vendor,
   ^
src/main.cpp: In function 'void find_map_location_coords(long int, long int*, long int*, const char*)':
src/globals.h:107:66: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
 #define WARNMSG(format, ...) LbWarnLog(format "\n", ##__VA_ARGS__)
                                                                  ^
src/main.cpp:1996:11: note: in expansion of macro 'WARNMSG'
           WARNMSG("%s: Action Point %d location not found",func_name,i);
           ^
src/globals.h:107:66: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
 #define WARNMSG(format, ...) LbWarnLog(format "\n", ##__VA_ARGS__)
                                                                  ^
src/main.cpp:2006:11: note: in expansion of macro 'WARNMSG'
           WARNMSG("%s: Hero Gate %d location not found",func_name,i);
           ^
src/globals.h:107:66: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
 #define WARNMSG(format, ...) LbWarnLog(format "\n", ##__VA_ARGS__)
                                                                  ^
src/main.cpp:2020:11: note: in expansion of macro 'WARNMSG'
           WARNMSG("%s: Dungeon Heart location for player %d not found",func_name,i);
           ^
src/globals.h:107:66: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
 #define WARNMSG(format, ...) LbWarnLog(format "\n", ##__VA_ARGS__)
                                                                  ^
src/main.cpp:2034:11: note: in expansion of macro 'WARNMSG'
           WARNMSG("%s: Thing %d location not found",func_name,i);
           ^
src/main.cpp: In function 'void process_payday()':
src/main.cpp:2412:22: warning: declaration of 'plyr_idx' shadows a previous local [-Wshadow]
         PlayerNumber plyr_idx;
                      ^
src/main.cpp:2393:18: note: shadowed declaration is here
     PlayerNumber plyr_idx;
                  ^
In file included from src/keeperfx.hpp:22:0,
                 from src/main.cpp:6:
src/main.cpp: In function 'TbBool swap_creature(long int, long int)':
src/globals.h:115:86: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
 #define ERRORLOG(format, ...) LbErrorLog("%s: " format "\n", __func__ , ##__VA_ARGS__)
                                                                                      ^
src/main.cpp:3910:9: note: in expansion of macro 'ERRORLOG'
         ERRORLOG("Creature index %d is invalid", crtr_id);
         ^
src/globals.h:115:86: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
 #define ERRORLOG(format, ...) LbErrorLog("%s: " format "\n", __func__ , ##__VA_ARGS__)
                                                                                      ^
src/main.cpp:3915:9: note: in expansion of macro 'ERRORLOG'
         ERRORLOG("Creature of index %d already swapped", crtr_id);
         ^
src/main.cpp: In function 'void wait_at_frontend()':
src/main.cpp:4201:10: warning: declaration of 'last_loop_time' shadows a global declaration [-Wshadow]
     long last_loop_time = LbTimerClock();
          ^
src/main.cpp:148:13: note: shadowed declaration is here
 TbClockMSec last_loop_time=0;
AdamPlenty commented 4 years ago

And for me it breaks the game; the Dungeon Heart and creatures no longer appear.

Loobinex commented 4 years ago

That doesn't happen for me. I briefly ran a level with frameskip and it went all right.

AdamPlenty commented 4 years ago

I also tried a few screen resolutions but there was no difference. What resolution are you playing the game at?

Loobinex commented 4 years ago

I also tried a few screen resolutions but there was no difference. What resolution are you playing the game at?

I don't think screen resolution would make any difference with a thing like this, but I play in 1920x1080x32

AdamPlenty commented 4 years ago

1920x1080x32 doesn't seem to work properly.

Trass3r commented 4 years ago

@Trass3r I'm getting loads of new warnings when I build this. Here's a small selection:

Yeah be32120 enables format warnings.

And for me it breaks the game; the Dungeon Heart and creatures no longer appear.

Odd, no clue which commit could possibly cause this. Debug or Release?

Loobinex commented 4 years ago

Why do we want that?

Loobinex commented 4 years ago

o, and if you have discord, it would be nice of you to join, easier to talk there.

AdamPlenty commented 4 years ago

We've determined that the problem happens in Forced Perspective mode. Something in this commit breaks it, it would seem. Sorry Trass3r.

Loobinex commented 4 years ago

Odd, no clue which commit could possibly cause this. Debug or Release?

Release. Adam and I have been talking, and in forced perspective I cannot see units anymore either.

Loobinex commented 4 years ago

@Trass3r Do you consider this this pull request ready to merge, or is there still something to do?

Trass3r commented 4 years ago

LGTM.