C Programmers, help a VB programmer here! 
Author Message
 C Programmers, help a VB programmer here!

I am having trouble trying to figure out what 0x80 means in Basic, any
C programmers want to shed light on this or convert this block of code
to basic?
Is it CHR$(&H80)) ?

Thanks!

Rick

------------------- SOURCE HERE -------------------
 */

#define PACKET_LEN 1600

/* Quake packet formats and magic numbers
 */
struct qheader  {
    unsigned char flag1;
    unsigned char flag2;
    unsigned short length;
    unsigned char op_code;

Quote:
};

struct qpacket  {
    unsigned char flag1;
    unsigned char flag2;
    unsigned short length;
    unsigned char op_code;
    unsigned char data[1500];

Quote:
};

#define Q_FLAG1                        0x80
#define Q_FLAG2                        0x00
#define Q_NET_PROTOCOL_VERSION 3
#define Q_HEADER_SIZE          5

#define Q_CCREQ_CONNECT                0x01
#define Q_CCREP_ACCEPT         0x81
#define Q_CCREP_REJECT         0x82

#define Q_CCREQ_SERVER_INFO    0x02
#define Q_CCREP_SERVER_INFO    0x83

#define Q_CCREQ_PLAYER_INFO    0x03
#define Q_CCREP_PLAYER_INFO    0x84

#define Q_CCREQ_RULE_INFO      0x04
#define Q_CCREP_RULE_INFO      0x85

#define Q_DEFAULT_SV_MAXSPEED  "320"
#define Q_DEFAULT_SV_FRICTION  "4"
#define Q_DEFAULT_SV_GRAVITY   "800"
#define Q_DEFAULT_NOEXIT       "0"
#define Q_DEFAULT_TEAMPLAY     "0"
#define Q_DEFAULT_TIMELIMIT    "0"
#define Q_DEFAULT_FRAGLIMIT    "0"

/* These packets are fixed size, so don't bother rebuilding them each
time.
 * This only works because the packets are an even number in size.
 */
struct {
    unsigned char flag1;
    unsigned char flag2;
    unsigned short length;
    unsigned char op_code;
    char name[6];
    unsigned char version;

Quote:
} qserverinfo =

       { Q_FLAG1, Q_FLAG2, sizeof(qserverinfo), Q_CCREQ_SERVER_INFO,
       "QUAKE", Q_NET_PROTOCOL_VERSION };

struct {
    unsigned char flag1;
    unsigned char flag2;
    unsigned short length;
    unsigned char op_code;
    unsigned char player_number;

Quote:
} qplayerinfo =

       { Q_FLAG1, Q_FLAG2, sizeof(qplayerinfo), Q_CCREQ_PLAYER_INFO, 0
Quote:
};



Mon, 08 Mar 1999 03:00:00 GMT  
 C Programmers, help a VB programmer here!

Quote:

>I am having trouble trying to figure out what 0x80 means in Basic, any
>C programmers want to shed light on this or convert this block of code
>to basic?
>Is it CHR$(&H80)) ?

Nope it is &H80

Which is no different than saying:

Global Const DB_SQLPASSTHROUGH = &H40

Except the scope may not be global in the example
you cited.  Unless it is a header file that is included
in each module.

Peter Mikalajunas

http://www.xnet.com/~kd9fb



Tue, 09 Mar 1999 03:00:00 GMT  
 C Programmers, help a VB programmer here!

0x80 is a number value in HEX

Quote:

> I am having trouble trying to figure out what 0x80 means in Basic, any
> C programmers want to shed light on this or convert this block of code
> to basic?
> Is it CHR$(&H80)) ?

> Thanks!

> Rick

> ------------------- SOURCE HERE -------------------
>  */

> #define PACKET_LEN 1600

> /* Quake packet formats and magic numbers
>  */
> struct qheader  {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
> };

> struct qpacket  {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
>     unsigned char data[1500];
> };

> #define Q_FLAG1                        0x80
> #define Q_FLAG2                        0x00
> #define Q_NET_PROTOCOL_VERSION 3
> #define Q_HEADER_SIZE          5

> #define Q_CCREQ_CONNECT                0x01
> #define Q_CCREP_ACCEPT         0x81
> #define Q_CCREP_REJECT         0x82

> #define Q_CCREQ_SERVER_INFO    0x02
> #define Q_CCREP_SERVER_INFO    0x83

> #define Q_CCREQ_PLAYER_INFO    0x03
> #define Q_CCREP_PLAYER_INFO    0x84

> #define Q_CCREQ_RULE_INFO      0x04
> #define Q_CCREP_RULE_INFO      0x85

> #define Q_DEFAULT_SV_MAXSPEED  "320"
> #define Q_DEFAULT_SV_FRICTION  "4"
> #define Q_DEFAULT_SV_GRAVITY   "800"
> #define Q_DEFAULT_NOEXIT       "0"
> #define Q_DEFAULT_TEAMPLAY     "0"
> #define Q_DEFAULT_TIMELIMIT    "0"
> #define Q_DEFAULT_FRAGLIMIT    "0"

> /* These packets are fixed size, so don't bother rebuilding them each
> time.
>  * This only works because the packets are an even number in size.
>  */
> struct {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
>     char name[6];
>     unsigned char version;
> } qserverinfo =
>        { Q_FLAG1, Q_FLAG2, sizeof(qserverinfo), Q_CCREQ_SERVER_INFO,
>        "QUAKE", Q_NET_PROTOCOL_VERSION };

> struct {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
>     unsigned char player_number;
> } qplayerinfo =
>        { Q_FLAG1, Q_FLAG2, sizeof(qplayerinfo), Q_CCREQ_PLAYER_INFO, 0
> };



Wed, 10 Mar 1999 03:00:00 GMT  
 C Programmers, help a VB programmer here!

Reposting article removed by rogue canceller.

0x80 is a number value in HEX

Quote:

> I am having trouble trying to figure out what 0x80 means in Basic, any
> C programmers want to shed light on this or convert this block of code
> to basic?
> Is it CHR$(&H80)) ?

> Thanks!

> Rick

> ------------------- SOURCE HERE -------------------
>  */

> #define PACKET_LEN 1600

> /* Quake packet formats and magic numbers
>  */
> struct qheader  {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
> };

> struct qpacket  {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
>     unsigned char data[1500];
> };

> #define Q_FLAG1                        0x80
> #define Q_FLAG2                        0x00
> #define Q_NET_PROTOCOL_VERSION 3
> #define Q_HEADER_SIZE          5

> #define Q_CCREQ_CONNECT                0x01
> #define Q_CCREP_ACCEPT         0x81
> #define Q_CCREP_REJECT         0x82

> #define Q_CCREQ_SERVER_INFO    0x02
> #define Q_CCREP_SERVER_INFO    0x83

> #define Q_CCREQ_PLAYER_INFO    0x03
> #define Q_CCREP_PLAYER_INFO    0x84

> #define Q_CCREQ_RULE_INFO      0x04
> #define Q_CCREP_RULE_INFO      0x85

> #define Q_DEFAULT_SV_MAXSPEED  "320"
> #define Q_DEFAULT_SV_FRICTION  "4"
> #define Q_DEFAULT_SV_GRAVITY   "800"
> #define Q_DEFAULT_NOEXIT       "0"
> #define Q_DEFAULT_TEAMPLAY     "0"
> #define Q_DEFAULT_TIMELIMIT    "0"
> #define Q_DEFAULT_FRAGLIMIT    "0"

> /* These packets are fixed size, so don't bother rebuilding them each
> time.
>  * This only works because the packets are an even number in size.
>  */
> struct {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
>     char name[6];
>     unsigned char version;
> } qserverinfo =
>        { Q_FLAG1, Q_FLAG2, sizeof(qserverinfo), Q_CCREQ_SERVER_INFO,
>        "QUAKE", Q_NET_PROTOCOL_VERSION };

> struct {
>     unsigned char flag1;
>     unsigned char flag2;
>     unsigned short length;
>     unsigned char op_code;
>     unsigned char player_number;
> } qplayerinfo =
>        { Q_FLAG1, Q_FLAG2, sizeof(qplayerinfo), Q_CCREQ_PLAYER_INFO, 0
> };



Wed, 10 Mar 1999 03:00:00 GMT  
 C Programmers, help a VB programmer here!



Quote:
>I am having trouble trying to figure out what 0x80 means in Basic, any
>C programmers want to shed light on this or convert this block of code
>to basic?
>Is it CHR$(&H80)) ?

The "0x" prefix on a number means that number is in hexadecimal.

0x10  ==  16 decimal
0xFF == 255 decimal
0x100 ==  256 decimal

The Chr$() function in VB translates 8-bit numbers into their string
equivalents.

Chr$(65) == 'A'

So, you are partially correct.

0x80 == &H80

---
My opinions are really nothing more
than onions with pi stuck in the middle.

Don't be the 3rd temp{*filter*}derivative of position.

Read.               In DoubleSpace, no one
Illiteracy sucks.   can hear your data scream.
===============================================

http://www.*-*-*.com/



Thu, 11 Mar 1999 03:00:00 GMT  
 C Programmers, help a VB programmer here!

Reposting article removed by rogue canceller.



Quote:
>I am having trouble trying to figure out what 0x80 means in Basic, any
>C programmers want to shed light on this or convert this block of code
>to basic?
>Is it CHR$(&H80)) ?

The "0x" prefix on a number means that number is in hexadecimal.

0x10  ==  16 decimal
0xFF == 255 decimal
0x100 ==  256 decimal

The Chr$() function in VB translates 8-bit numbers into their string
equivalents.

Chr$(65) == 'A'

So, you are partially correct.

0x80 == &H80

---
My opinions are really nothing more
than onions with pi stuck in the middle.

Don't be the 3rd temp{*filter*}derivative of position.

Read.               In DoubleSpace, no one
Illiteracy sucks.   can hear your data scream.
===============================================

http://www.*-*-*.com/



Thu, 11 Mar 1999 03:00:00 GMT  
 C Programmers, help a VB programmer here!

Quote:

> Reposting article removed by rogue canceller.

> 0x80 is a number value in HEX

Which is 128 decimal.

--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Jeff Kilbride                 *  BE the ball!                     +
+ Potentia Technologies         *         - Chevy Chase, Caddyshack +

+*******************************************************************+
+ The Knowledge Base:  http://www.microsoft.com/kb/                 +
+ Dan Appleman's VB Programmer's Guide to the Windows (Win32) API:  +
+     http://www.mcp.com/323794211724109/zdpress/hot_titles_lo.html +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Sat, 20 Mar 1999 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. VB programmer turns C++ programmer

2. Is VB programmer is reall programmer?

3. Why do C programmers dump on Basic programmers?

4. Why do C programmers dump on Basic programmers

5. Amateur programmer seeking amateur programmer

6. non-programmer needs programmers opinios

7. Help: Using MS Access 95 w/ VB 5 for Novice VB programmer

8. Help Wanted: VB Programmers

9. Looking for VB programmer to help with simple IVR app

10. VB Programmer, Concord CA needs help.

11. Can VB Programmers Help ME !

12. Can some ACCESS Programmers help me in VB ?

 

 
Powered by phpBB® Forum Software