The Code Wizard's Musings

Diary of a husband, father and coder

More on the WinROTT port...

clock November 30, 2008 14:56 by author gharris

Update: Check out my wiki page for the latest download of WinROTT.

I'm making progress moving all extern declarations to header files and removing externs from any cpp files. I have been able to process about 50% of the CPP files.  By getting all of the declarations worked out, it will allow me to have modules consisting of a standalone header file (.h) and implementation file (.cpp). I'm also able to see declarations that belong in different modules. For instance, several variables are declared in WinROTT, but are only used in one other module and not used in WinROTT. It's generally better to  move the declarations and get rid of any global declarations.

Why do all of this? Once I get the modules properly divided up, I can begin to move code into class declarations. It will also make it easier to isolate OS and hardware specific code into separate dlls, rather than a monolithic program. It also helps me to become familiar with the code. I've already noticed several places where I can improve network code.

I'm also thinking it might be better to implement the game using a peer-to-peer protocol. Even though I am not a Microsoft fan, it might make sense to use their peer-to-peer protocol for WinROTT. I'd appreciate any comments on this. I'm interested in the MS P2P as a chance to become familiar with the protocol.

Gene

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


This stuff scares me...

clock November 29, 2008 07:49 by author gharris

It looks like an activist judge is trying to rewrite internet law. This article explains what is happening. Public pressure over cyber-bullying is going to over-react, criminalizing all sorts of behavior. Believe me, this is important to all of us.

An Amicus Brief: Issues in the Cyberbullying Case That Affect You

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


An interesting and hard to catch bug in WinROTT...

clock November 29, 2008 07:07 by author gharris

Update: Check out my wiki page for the latest download of WinROTT

While moving the WinROTT file w_wad.c to w_wad.cpp, I ran into the most interesting bug. It was very difficult to catch. The problem was only apparent when the game was compiled in Release mode. After inserting a lot of logging statements, I was able to trace the problem down to this routine.

int     W_CheckNumForName (char *name)
{
        char    name8[9];
        int             v1,v2;
        lumpinfo_t      *lump_p;
        lumpinfo_t      *endlump;

// make the name into two integers for easy compares

        strncpy (name8,name,8);
        name8[9] = 0;                   // in case the name was a fill 8 chars
        strupr (name8);                 // case insensitive

        v1 = *(int *)name8;
        v2 = *(int *)&name8[4];


// scan backwards so patch lump files take precedence

        lump_p = lumpinfo;
        endlump = lumpinfo + numlumps;

        while (lump_p != endlump)
           {
           if ( *(int *)lump_p->name == v1 && *(int *)&lump_p->name[4] == v2)
              return lump_p - lumpinfo;
           lump_p++;
           }


        return -1;
}

More...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


New WinROTT Release (#7)

clock November 27, 2008 21:02 by author gharris

Update: Check out my wiki page for the latest download of WinROTT

I managed to move all the C files to C++. It's working! I've made some code improvements and cleaned up quite a bit. The download is here.

I am currently cleaning up all the extern declarations, trying to get everything into correct header files. It's a slow process. I am in the process of creating header files for all of the DirectMusic, Input, Video, etc. source files, as many of the extern declarations are needed for linker resolution.

Enjoy the game.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Deep fried turkey, Oh how I love thee...

clock November 27, 2008 14:53 by author gharris
  • I've watched all the bad youtube videos about deep frying turkey.
  • I've heard all the bad jokes and puns about house fires and insurance rates.
  • I've read all the glib responses from psuedo intellectuals who know what's safe and good for society, and by extension, what is good and safe for me.

I've found that if you work unimpaired and control the environment around you, deep frying a turkey is about as safe as driving a car to the grocery store. It's a risk I am willing to take in order to taste the delicious wonders of a bird I am not terribly fond of when it's cooked the old fashioned way -- in an oven. It's hard to beat the flavor and texture of a deep fried turkey. My extended family agrees with me. The skin is crispy and delicious. The meat is tender and moist. I find I don't even need to use the fancy marianades and injectors that are so popular now-a-days. Just dry the bird and rub it inside and out with salt and some black pepper. Heat the oil to 325°F and fry for about three minutes per pound. The meat temperature should reach about 160°F. I like to check the meat temperature in the thigh and deep in the breast. That's all it takes. Carve the turkey and watch the family dig in. Be prepared for compliments. It is so good.

My wife, son and daughter, sister-in-law, two nieces and my wife's cousin are having a blast on the shores of lake Michigan. They went to Chicago to watch my wife's cousin in a play at the University of Chicago. Stephen has become quite the well known stage actor. The cats and dogs are great company. I've enjoyed my time alone. Now I want my family back. 'Nough said. I miss them.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Handling WinROTT's dirtype with a class in C++

clock November 25, 2008 20:40 by author gharris

Update: Check out my wiki page for the latest download of WinROTT

I haven't been blogging much lately. I've been working on WinROTT in the evenings. (I should be exercising, but that is another story.) I've published a fairly long article (mostly code listings) on how I handled the pesky dirtype typedef while porting C to C++. I finally had time tonight to implement a class to replace the dirtype enum. It's a lot safer piece of code that the older methods used by the original author. Here's the link. I hope you enjoy the article.

I'm in an unusual situation this week. My wife and daughter are in Chicago to see my wife's cousin perform in a play. My son has joined them and I am HOME ALONE. Cool This meant I was able to enjoin some activities men my age occasionally partake in:

  • I got out my new hiking boots and wore them to help break in the stiff new leather.
  • I rumaged through the garage for turkey fryer parts.
  • I tightened up a couple of dripping faucets and made a mental note to purchase some new washers.
  • I lost the mental note.
  • I tried to replace a burned out garage light bulb (outdoor) but realized we didn't have the right kind of bulb.
  • I realized I could be lazy and not go find the right bulb at Lowe's.
  • I surfed ESPN with no TV, radio or CD playing. In fact the quiet was really nice.
  • I looked at my two Spaten Optimaters in the frig but decided to save them for beer and pepperoni bread (and the Auburn - Alabama football game.

It's nice being alone for a while. I won't like it for long, but the first day or so are a nice break.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


An interesting problem porting C to C++

clock November 23, 2008 10:04 by author gharris

Update: Check out my wiki page for the latest download of WinROTT

I've completed the port of all c files to c++ for WinROTT. I'm in the process of making a release for download on the wiki.  However, testing showed a subtle bug in the c++ code.  The bug manifested itself by automatically loading the first saved game in the list of saved games.  (I'll try to get some screen shots, but it's difficult to grab a DirectX screen in full screen mode.)  I was able to track the problem down to a function that was cast to a different type of function pointer.  (Yes, c++ will allow this, so you have to be careful when casting method pointers.)

More...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



 Subscribe to RSS




Disclaimer

This blog represents my personal hobby, observations and views. It does not represent the views of my employer, clients, especially my wife, children, in-laws, clergy, the dog, the cats or my daughter's horse. In fact, I am not even sure it represents my views when I take the time to reread postings.

© Copyright 2008

Sign in