Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - McCoy

Pages: 1 [2] 3
16
General Discussion / The Evolution
« on: July 13, 2003, 02:17:04 PM »
High School/Jr.High

Code: [Select]
10 PRINT "HELLO WORLD"
20 END

First year in College

Code: [Select]
program Hello(input, output)
    begin
    writeln('Hello World')
    end

Senior year in College

Code: [Select]
(defun hello
    (print
    (cons 'Hello (list 'World))))

New professional

Code: [Select]
#include <stdio.h>

void main(void)
{
    char *message[] = {"Hello ", "World"};
    int i;

    for(i = 0; i < 2; ++i)
        printf("%s", message[i]);

    printf("\n");
}

Seasoned professional

Code: [Select]
#include <iostream.h>
#include <string.h>

class string
{
    private:
    int size;
    char *ptr;

    public:
    string() : size(0), ptr(new char('\0')) {}

    string(const string &s) : size(s.size)
    {
    ptr = new char[size + 1];
     strcpy(ptr, s.ptr);
    }

    ~string()
    {
        delete [] ptr;
    }

    friend ostream &operator <<(ostream &, const string &);
    string &operator=(const char *);
};

ostream &operator<<(ostream &stream, const string &s)
{
     return(stream << s.ptr);
}


string &string::operator=(const char *chrs)
{
    if (this != &chrs)
    {
        delete [] ptr;
        size = strlen(chrs);
        ptr = new char[size + 1];
        strcpy(ptr, chrs);
    }
     return(*this);
}

int main()
{
    string str;

    str = "Hello World";
    cout << str << endl;
     return(0);
}

Master Programmer

Code: [Select]
[
uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
]

library LHello
{
    // bring in the master library
    importlib("actimp.tlb");
    importlib("actexp.tlb");


    // bring in my interfaces
    #include "pshlo.idl"


    [
    uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
    ]

    cotype THello
    {
        interface IHello;
        interface IPersistFile;
    };
};
[
exe,
uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
]
module CHelloLib
{

    // some code related header files
    importheader(<windows.h>);
    importheader(<ole2.h>);
    importheader(<except.hxx>);
    importheader("pshlo.h");
    importheader("shlo.hxx");
    importheader("mycls.hxx");

    // needed typelibs
    importlib("actimp.tlb");
    importlib("actexp.tlb");
    importlib("thlo.tlb");

    [
    uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
    aggregatable
    ]

    coclass CHello
    {
        cotype THello;
    };
};

#include "ipfix.hxx"

extern HANDLE hEvent;

class CHello : public CHelloBase
{
public:
     IPFIX(CLSID_CHello);

     CHello(IUnknown *pUnk);
     ~CHello();

     HRESULT  __stdcall PrintSz(LPWSTR pwszString);

private:
    static int cObjRef;
};

#include <windows.h>
#include <ole2.h>
#include <stdio.h>
#include <stdlib.h>
#include "thlo.h"
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

int CHello::cObjRef = 0;

CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
{
     cObjRef++;
     return;
}

HRESULT  __stdcall  CHello::PrintSz(LPWSTR pwszString)
{
     printf("%ws\n", pwszString);
     return(ResultFromScode(S_OK));
}

CHello::~CHello(void)
{
// when the object count goes to zero, stop the server
cObjRef--;
if( cObjRef == 0 )
     PulseEvent(hEvent);

return;
}

#include <windows.h>
#include <ole2.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "mycls.hxx"

HANDLE hEvent;

int _cdecl main(int argc, char * argv[])
{
    ULONG ulRef;
    DWORD dwRegistration;
    CHelloCF *pCF = new CHelloCF();
    hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

    // Initialize the OLE libraries
    CoInitializeEx(NULL, COINIT_MULTITHREADED);

    CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,  REGCLS_MULTIPLEUSE,              &dwRegistration);

    // wait on an event to stop
    WaitForSingleObject(hEvent, INFINITE);
    // revoke and release the class object
    CoRevokeClassObject(dwRegistration);
    ulRef = pCF->Release();
    // Tell OLE we are going away.
    CoUninitialize();
    return(0); }

    extern CLSID CLSID_CHello;
    extern UUID LIBID_CHelloLib;

    CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
        0x2573F891,
        0xCFEE,
        0x101A,
        { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
    };

    UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */     0x2573F890,
        0xCFEE,
        0x101A,
        { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
    };

#include <windows.h>
#include <ole2.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pshlo.h"
#include "shlo.hxx"
#include "clsid.h"

int _cdecl main(int argc, char * argv[])
{
    HRESULT  hRslt;
    IHello        *pHello;
    ULONG  ulCnt;
     IMoniker * pmk;
    WCHAR  wcsT[_MAX_PATH];
    WCHAR  wcsPath[2 * _MAX_PATH];

     // get object path
     wcsPath[0] = '\0';
     wcsT[0] = '\0';
     if( argc > 1) {
        mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
        wcsupr(wcsPath);
     }
     else {
        fprintf(stderr, "Object path must be specified\n");
        return(1);
    }

// get print string
if(argc > 2)
    mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
else
    wcscpy(wcsT, L"Hello World");

printf("Linking to object %ws\n", wcsPath);
printf("Text String %ws\n", wcsT);

// Initialize the OLE libraries
hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);

if(SUCCEEDED(hRslt)) {
    hRslt = CreateFileMoniker(wcsPath, &pmk);
    if(SUCCEEDED(hRslt))
        hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);

    if(SUCCEEDED(hRslt)) {
    // print a string out
    pHello->PrintSz(wcsT);

    Sleep(2000);
    ulCnt = pHello->Release();
   }
else
    printf("Failure to connect, status: %lx", hRslt);

// Tell OLE we are going away.
CoUninitialize();
}

return(0);

Apprentice Hacker

Code: [Select]
#!/usr/local/bin/perl
$msg="Hello, world.\n";
if ($#ARGV >= 0) {
    while(defined($arg=shift(@ARGV))) {
    $outfilename = $arg;
    open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
    print (FILE $msg);
    close(FILE) || die "Can't close $arg: $!\n";
   }
} else {
    print ($msg);
    }
1;

Experienced Hacker
Code: [Select]
#include <stdio.h>
#define S "Hello, World\n"
main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Seasoned Hacker

Code: [Select]
% cc -o a.out ~/src/misc/hw/hw.c
% a.out

Guru Hacker

Code: [Select]
% cat
Hello, world.
^D

New Manager

Code: [Select]
10 PRINT "HELLO WORLD"
20 END

Middle Manager

Code: [Select]
mail -s "Hello, world." bob@b12 <mailto:bob@b12>
Bob, could you please write me a program that prints "Hello, world."? I need it by tomorrow.
^D

Senior Manager

Code: [Select]
% zmail jim
I need a "Hello, world." program by this afternoon.

Chief Executive

Code: [Select]
% letter
letter: Command not found.
% mail
To: ^X ^F ^C
% help mail
help: Command not found.
% damn!
!: Event unrecognized
% logout

17
Technical forum / Calling Windows API function
« on: July 13, 2003, 11:48:23 AM »
It's possible in WME to call Windows API functions? If it's possible, how? Like calling an external DLL? Please, Jan, put an example with CreateFile and WriteFile if it's possible...

18
Software and games / J2ME
« on: July 08, 2003, 06:23:26 PM »
Has anyone done anything with J2ME? (Java 2 Micro Edition, a Java implementation for mobile phones). It would be difficult to learn to someone (me) with lot of VB, some JavaScript, some WME and little C++ background?
I'm thinking about buying a new mobile phone with java support, color display and all that, and I would like to do little proggies/games for it...  ;D

19
Technical forum / The best approach
« on: July 08, 2003, 11:26:44 AM »
What do you think is the best approach: a HUGE looped script attached to the game object (game_daemon.script...), with all the things that need to be checked during all the game but can not be handled by "events" (caption management, showing the corner buttons (in my case)),  or lots of little looped scripts attached to the game object, everyone managing a routine on its own (one manage the caption, another one corner buttons check...), and with sleep times adapted to every purpose? I have discovered that ALL the  slowdowns in my game are caused by the game_daemon sleep time... so i'm going to split it in little scripts, and put a 40ms sleep time for the floating caption, 250ms sleep time for the corner buttons check... and all that. I hope that will fix the slowdowns!!! Anyway, I want to know your opinions about this fact, and if anyone finds another approach... even better!  ;D

20
Technical forum / Animated cursors problem
« on: July 07, 2003, 03:53:10 PM »
I'm using an animated arrow as cursor for showing a "change location" region. But I noticed that, when the mouse adopts that cursor, the FPS drops A LOT and the main actor walks very slowly and jerky. It happends only when the animated cursor is being displayed. If I change that cursor for an static one, there's no problem. It's a bug or what I'm doing bad? The code is so simple that I don't think it could be the problem...

P.S. you can test it by going to the Sam n' max location in fred PreAlpha, clickng near a stair so fred has to walk there, and then putting the mouse over the stair, so the animated cursor appears.

21
Technical forum / Tracking the FPS
« on: July 06, 2003, 11:47:57 AM »
I'm thinking about making a little benchmark for wintermute (you know, a lot of sprites moving in the screen, some big, some little, some with transparency, some with animations, background sounds... you catch it) but I like to save the FPS in a variable to make the average and save it to a file and all that for mailing. There's anyway of tracking the FPS?

Thanx  ;D

P.S. That could be useful for other things too, like, if the game detects low FPS, it deactivates some not-crucial animations or things that eat resources and are not indispensable.

22
Game announcements / Fred English Public PreAlpha ready!!
« on: July 04, 2003, 03:43:27 PM »
I know that it has passed a lot of time since I said "the prealpha will be ready tomorrow", but blame the translator, all the delay was caused by him  ::).
But now it's ready to rock! Download the Fred English Public PreAlpha (what a long name) here!:

http://www.forbidden-games.com

And please, post your comments, i'm very interested!!  ;D

23
Software and games / Dialog editor (or something like that...)
« on: July 03, 2003, 09:16:11 PM »
Mhhh, I would like to post about a program like the topic sais, but this post is for asking for one,  sorry!

I need a program in wich you could add questions & answers to the questions, and that represents the resultant dialog tree graphically, you know, like the windows explorer, but with dialogs: questions linked to answers, and those answers linked to the questions you get after asking the other question and all that. (what a tongetwister...  :-X)

I need it because my scripters (the guys who are making the game story, no the programmers, in fact, i'm the only one programming the game ;)) give me all the things in msword, and when the dialogs are big and messy, is pretty hard to get the trail of it the way they write it in word.

Anyone knows about a program like this?

I thought about making one myself in VB, but it's stupid if there's another one already made...

Hope you understood everything...   :-[

24
Feature requests, suggestions / Command-line arguments
« on: July 03, 2003, 11:03:19 AM »
At least one like "wme -fps" to show the FPS in the compiled version, because when I test my game in other systems, or other people play the game and send me feedback, I and they must measure the game speed by eye.  :'(

25
Technical forum / Little Unimportant Bug
« on: June 29, 2003, 03:39:21 PM »
Jan, the Game.RegReadNumber() does not return null when the key doesn't exists, it returns 0 . I prefer the null but I can manage with the 0 anyway.

26
Technical forum / Something about the inventory
« on: June 28, 2003, 10:33:17 AM »
There's any way to do a free position inventory like the one in Ultima VII for example, instead of the actual cell-based inventory?

It's just curiosity, I don't have any problem with the actual inventory, I only thought that it could be cool to make a different inventory, to have something different from all the graphic adventure games...  ;D

27
I didn't know where to post this, so I'll post it here.

Right now i'm using the custom properties of the scene entities to hold the action name that the character can perform over it. Let me explain it: I made a little system for my game that, everytime you try to perform an action over an object, shows a text at the bottom of the screen that sais what the action is going to be, for example, I have a door, if you select the hand in the right-hold menu, down appears "Open door". You know, all adventure games have this  ;D. Well, but the default text I used for the hand was "Pick up", so, for displaying "Open door" instead of "Pick up door", I add a custom property to the door entity, called "hand" with the value of "Open", so it override the "Pick up" default. It's the same for other actions, like "Speak to", I add a "mouth" property and I put the value of, for example "Eat". The problem is that when I try to add a string table identifier, like /ACTION01/Open, down the screen appears /ACTION01/Open door. And if I put "/ACTION01/Open" (notice the quotation marks), the engine DELETEs the property!!! I tried to do it by SceneEdit and by editting the .scene file by hand in notepad, and it was the same. So the only way to translate the actions is to edit them by hand one by one, and the worst is that it's me who must do it, the translator only knows how to write in msword  :P

So please, Mnemonic, fix this or add this feature or anything, I don't think it would be very hard. ;D

28
Technical forum / Problems with the vBar
« on: June 25, 2003, 07:52:41 PM »
Has I wrote in an old post I was triying to do an options menu like this


Well, the code is finished, and it works perfectly in projectman, but it does not work in the compiled version!!! In projectman, when the window opens, the buttons put himself in a position that represents the actual volume value that the registry sais, and when you keep pressed the left mouse button over the button of a vBar, you can drag it up and down, changing the volume while you listen a sound/music to test it, and the cursor ever stay inside the button until you release the left mouse button. But in the compiled version, when you click on the button, the only thing it do correctly is playing the music/sound! it does not move nor keep the cursors inside itself. And it doesn't catch the registry value for the volume. What's the problem? Here's the code for the button of the SFX Volume vBar (the code for the other buttons is almost equal):

[code]#include "scripts\base.inc"


var meters; //just to hold some values
var MoveButton; //if true, the button updates its position with the mouse position
self.Text = Game.GetGlobalSFXVolume(); //get the actual sfx volume value for the text of the
                                       //button
meters.ActVol = Game.GetGlobalSFXVolume(); //same for the variable
if (meters.ActVol >= 100) self.Text = "Max"; //stupid thingie
else if (meters.ActVol <= 0) self.Text = "Off";
self.Y = self.Y - meters.ActVol; //place the button at the position desired for the actual
                                 //volume value.

on "LeftClick"
{
   
    var parent = self.Parent; //reference to the window that holds the button
    MoveButton = true; //the button must update it's position
    Game.MouseY = parent.Y + self.Y + (self.Height / 2); //place the cursor in the (vertical)
                                                         //middle of the button  
    meters.MouseY = Game.MouseY; //update the mouse position info in the variable
    Game.PlaySound("interface\system\sfx.ogg",true); //play the test sound (it's good to hear
                                                     //something while you are increasing or
                                                     //decreasing the volume).
    while (MoveButton) //loop that updates the mouse position and the volume value
    {  
   

29
Feature requests, suggestions / Speech subtitles customization
« on: June 21, 2003, 11:10:47 AM »
I already mentioned the suggestion of providing the engine with a way of customizing the way the speech text is displayed in the game in an old "How do I..." post. I write this one just to remember it to Mnemonic, because I don't see it in the TODO list...

Some ideas:
Maybe modifiying the .Talk() method to use a configurable window like the inventory does? The actual style could be just simillar to the floating caption that has the demo project of the engine: an empy window, that can be filled with any text, and then resized and placed properly using the object's coordinates as origin.

30
General Discussion / 3D Stereo Glasses
« on: June 20, 2003, 06:30:28 AM »
I'm thinking about buying the 3D Glasses from eDimensional (http://www.edimensional.co.uk). Please, if anyone has a pair of computer 3D Glasses or has ever tried them, write here your impressions, I wanna know if it's so cool as everybody says.

EDIT: corrected the link.

Pages: 1 [2] 3

Page created in 0.049 seconds with 21 queries.