cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/27/19:18:44

From: "Siddiqui" <siddiqui AT dircon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: type mismatch problem
Date: Thu, 27 Aug 1998 21:23:26 +0100
Lines: 58
Organization: family
NNTP-Posting-Host: 194.112.61.179
Message-ID: <35e5bc22.0@newsread1.dircon.co.uk>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm using allegro to do a little rendering type of thing, but gcc warns me:

"Warning:  type mismatch in implicit declaration
                   for built-in function `sqrt' "

and

"Warning:  type mismatch in implicit
                   declaration for built-in function `cos' "

It is refering to my use of the sqrt and cos. It warns me well intentonaly
:) bcause my program crashes. The code is wrtten below:


render(int xpiv, int ypiv, int screen_pivx, int screen_pivy, int angle)
     {
     double dist;
     double temp_angle;

     draw_sprite(
                           screen, player.image[0], player.screen_x,
                           player.screen_y
                          );


     dist=sqrt(
               (double)(
                        pow( (double)player.world_x
                               - (double)enemy.xpos, 2)
                       +pow( (double)player.world_y
                               -(double)enemy.ypos, 2)
                             )
              );
     temp_angle=itorad( (double)(64-256-angle) );

     rotate_sprite(screen, enemy.image[0],
                   enemy.xpos+dist*cos(temp_angle),
                   enemy.ypos-dist*cos(temp_angle),
                   itofix(256-angle+enemy.angle)
                  );
     }

The macro itorad(x) I wrote like this:

#define itorad(x)   (double)(PI*360*(((double)x)/256))/180

It aims to turn an integer(used as an angle for input into itofix(x)
therfore max = 256) into a radian with type double.

Hope someone can help me here. As you can see I've been trying to add loads
of coersons but to no avail!

Ali





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019