Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixes for gcc 14 #73

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Conversation

sharkwouter
Copy link
Contributor

gcc 14 is a bit stricter with types, causing a compile errors. This PR makes the game able to build with it, without making any changes to how the game works. Let me know if you see any issue with it, I was able to play the game just fine.

@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void StretchMemPicture ();
// GLOBAL VARIABLES

boolean StretchScreen=0;//bn�++
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how to not change this, my editor does not support this character. What do I do?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove that character from the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've changed it now.

@@ -59,8 +59,8 @@ extern int fandc;
// math tables
//
extern short tantable[FINEANGLES];
extern fixed sintable[FINEANGLES+FINEANGLEQUAD+1];
extern fixed *costable;
extern int sintable[FINEANGLES+FINEANGLEQUAD+1];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly, these tables should be of fixed type.

Copy link
Contributor Author

@sharkwouter sharkwouter Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I set it to fixed type, I get an error in the BuildTables function, which seems like it might have some logical errors:

~/taradino/rott/rt_draw.c: In function ‘BuildTables’:
~/taradino/rott/rt_draw.c:240:23: error: passing argument 1 of ‘SwapIntelLongArray’ from incompatible pointer type [-Wincompatible-pointer-types]
  240 |    SwapIntelLongArray(&sintable[0], length);
      |                       ^~~~~~~~~~~~
      |                       |
      |                       fixed * {aka long int *}
In file included from ~/taradino/rott/rt_draw.c:40:
~/taradino/rott/rt_util.h:73:32: note: expected ‘int *’ but argument is of type ‘fixed *’ {aka ‘long int *’}
   73 | void  SwapIntelLongArray (int *l, int num);
      |                           ~~~~~^

This code over there seems a bit off, since it does not use the fixed type, but int:

//
// get size of sin/cos table
//

   memcpy(&length,ptr,sizeof(int));
   SwapIntelLong(&length);
   ptr+=sizeof(int);
   
//
// get sin/cos table
//
   memcpy(&sintable[0],ptr,length*sizeof(int));
   SwapIntelLongArray(&sintable[0], length);
   ptr+=(length)*sizeof(int);

This code can be found here: https://github.com/fabiangreffrath/taradino/blob/main/rott/rt_draw.c#L228

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it gets more and more fishy.

@erysdren
Copy link
Collaborator

erysdren commented Jul 9, 2024

Is this ready to merge @fabiangreffrath?

@fabiangreffrath
Copy link
Owner

Yes, I think so. That's why I approved them. 😉

@erysdren erysdren merged commit 14d889e into fabiangreffrath:main Jul 10, 2024
4 checks passed
@sharkwouter sharkwouter deleted the gcc-14-fixes branch July 10, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants