War2.ru Slogan
News: New responsive forum theme available!
Click here to switch! More info here!


Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Welcome to the forums! We're glad to have you here! :) You can register your account here, then feel free to introduce yourself in the Server.War2.ru board & let us know who you are on the server.
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.

Messages - Lambchops

Pages: [1] 2 3 ... 89
1) Mods & Development / Re: Nerd's Corner
« on: June 13, 2019, 10:41:59 PM »

Any functionality to draw to warcraft 2 screen? What about an array of bytes sample also. It would then be perfect to project! Thanks brother.


Yeah sure. Sorry not finding much time to document all of this.... still working 6 days a week ( and sleeping 1 day )

For an array of bytes, you can just declare the array in your source then use memcpy or CopyMemory etc. Will try to do an example later, but you can probably work that out.

Here's the game timer plugin. It demonstrates writing a string on a bitmap, then pasting that bitmap to the wc2 screen inside the display hook.

... uses:

paste_string(clock,0,0,&clockbuf[0],4,CLOCK_COLOR);

clock is the bitmap handle
(0,0) is target co-ords on the bitmap
&clockbuf[0] is the source ANSI string
4 is the font size (only supports 4 and 6 currently)
CLOCK_COLOR is the pixel value to set on the bitmap

this is done once per second to update the bitmap, then in the sccreen display hook it uses:

wc2_trans_paste(clock,CLOCK_X,CLOCK_Y);

to paste the "clock" bitmap onto the screen buffer at co-ords (CLOCK_X,CLOCK_Y)
(assumes 0 pixels are transparent)

These functions are exported from LC.dll
Have a look at lamb.h and lamb.cpp for others

Will try to document these further later.



dllmain.cpp
Code: [Select]
                                                         //
     /////////////////////////////////////////////////////
    //   Example dll for Warcraft II plugin framework  //
   /////////////////////////////////////////////////////
  //                                    Lambchops 2019
 


// *** This is a poor way of implementing a game timer.
// Shoud really be re-written to use GetSystemTime() or similar,
// but it makes for a simple example this way.


#include <windows.h>
#include <lamb.h>

// constants for the in-game screen
#define LOC_INGAME_H 1684300900
#define LOC_INGAME_O 2155905153


// display the timer here
// * using the top of mini-map to guarantee that this part
// of the screen is updated every second *
#define CLOCK_X         22
#define CLOCK_Y         24


// color for pixels on timer bitmap
#define CLOCK_COLOR   0xFE


BOOL game_timer_on = FALSE;

int  game_secs  = 0;
int  game_mins  = 0;
int  game_hours = 0;
int  game_days  = 0;

// allocate a buffer to store timer as a string
CHAR clockbuf[16];

// create a little 32x6 bitmap to draw timer string on to
HMIBMP* clock = make_bitmap(32,6,8);

// temp storage for game "location" value supplied
// to "screen_update()" by the framework
DWORD loc;



BOOL in_game(){
    // return TRUE if we are in a game
    return (loc==LOC_INGAME_H||loc==LOC_INGAME_O);
}


void reset_timer(){
    game_secs = -1;
    game_mins = 0;
    game_hours= 0;
    game_days = 0;     
}

void game_tick(){
    // add 1 second to game time
   
    game_secs++;
    if(game_secs==60){
        game_secs=0;
        game_mins++;
        if(game_mins==60){
            game_mins=0;
            game_hours++;
            if(game_hours==24){
                game_hours=0;
                game_days++;
            }
        }
    }

    // redraw the timer display bitmap //

    wsprintf(&clockbuf[0],"%2.2d:%2.2d:%2.2d",game_hours,game_mins,game_secs);         
    zero_bitmap(clock);   
    paste_string(clock,0,0,&clockbuf[0],4,CLOCK_COLOR);
}


void CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime){
    // this is called every 1 second by the system timer we set up below
   
    if(game_timer_on){
        if(in_game()){
            // update time by 1 second
            game_tick();
        }else{
            // game ended
            game_timer_on = FALSE;
        }
    }else{
        if(in_game()){
            // game started
            game_timer_on = TRUE;
            reset_timer();
            game_tick(); 
        }       
    }
}



////// EXPORTED FUNCTIONS FOR THE FRAMEWORK TO CALL ///////

// called once at startup
extern "C" __declspec (dllexport) void w2p_init(){
    // Create a timer that ticks every 1 second     
    SetTimer(NULL,0,1000,TimerProc);
}



// called every screen update
extern "C" __declspec (dllexport) void screen_update(DWORD location){
    loc=location;
    if(game_timer_on){
        // paste the time display bitmap onto the game screen ( pixel 0 = transparent )
        wc2_trans_paste(clock,CLOCK_X,CLOCK_Y);
    }
}



BOOL APIENTRY DllMain (  HINSTANCE hInst, DWORD reason, LPVOID reserved ){ return TRUE; }



lamb.h
Code: [Select]
#include <windows.h>


#ifndef _LAMB_
#define _LAMB_

extern "C" {
    typedef struct hmibmp {
        BITMAPFILEHEADER* pFile;
        BITMAPINFOHEADER* pInfo;
        RGBQUAD*          pPal;
        BYTE*             pBits;
        int               width;
        int               height;
        int               bpp;
        int               linew;
        int               usage;
        int               size;
    }HMIBMP;
}

//hmibmp.inc
extern "C" typedef HMIBMP* (__stdcall *pfnmakebmp )(int w,int h,int bpp);
extern "C" typedef void    (__stdcall *pfnfreebmp )(HMIBMP* bmp);
extern "C" typedef int     (__stdcall *pfnzerobmp )(HMIBMP* bmp);
extern "C" typedef void    (__stdcall *pfnsavebmp )(CHAR* path,HMIBMP* bmp);
extern "C" typedef void    (__stdcall *pfnsavejpg )(CHAR* path,HMIBMP* bmp,int quality);
extern "C" typedef void    (__stdcall *pfnperfbmp )(HMIBMP* bmp);
extern "C" typedef void    (__stdcall *pfncopyimg )(HMIBMP* src,int scrx,int srcy,int srcw,int scrh,HMIBMP* dst,int dstx,int dsty,int transp);
extern "C" typedef int     (__stdcall *pfncopyfull)(HMIBMP* dstbmp,HMIBMP* srcbmp,int transp);
extern "C" typedef void    (__stdcall *pfndispimg )(HDC destDC,int x,int y,int w,int h,HMIBMP* bmp,int dx,int dy,int dw,int dh);
extern "C" typedef void    (__stdcall *pfnsetpal  )(HMIBMP* bmp,LPVOID palette);
extern "C" typedef void    (__stdcall *pfndrawrect)(HMIBMP* bmp,int x,int y,int w,int h,int color);
extern "C" typedef HMIBMP* (__stdcall *pfnsizebmp )(HMIBMP* bmp,int w,int h);
extern "C" typedef HMIBMP* (__stdcall *pfnscalebmp)(HMIBMP* bmp,int scale);
extern "C" typedef void    (__stdcall *pfnsetpixel)(HMIBMP* bmp,int x,int y,int pval);
extern "C" typedef void    (__stdcall *pfnpastestr)(HMIBMP* bmp,int x,int y,CHAR* lpsz,int point,int color);
extern "C" typedef void    (__stdcall *pfnwc2tpast)(HMIBMP* bmp,int x,int y);


extern pfnmakebmp      make_bitmap;
extern pfnfreebmp      free_bitmap;
extern pfnzerobmp      zero_bitmap;
extern pfnsavebmp      save_bitmap;
extern pfnsavejpg      save_jpeg;
extern pfnperfbmp      perforate_bitmap;
extern pfncopyimg      copy_image;
extern pfncopyfull     copy_full_image;
extern pfndispimg      display_image;
extern pfnsetpal       set_palette;
extern pfndrawrect     draw_rect;
extern pfnsizebmp      size_bitmap;
extern pfnscalebmp     scale_bitmap;
extern pfnsetpixel     set_pixel;
extern pfnpastestr     paste_string;
extern pfnwc2tpast     wc2_trans_paste;

#endif

lamb.cpp

Code: [Select]
#include <windows.h>
#include <lamb.h>


HMODULE hLambDll = LoadLibraryA("LC");

pfnmakebmp  make_bitmap         = (pfnmakebmp )GetProcAddress(hLambDll, "make_bitmap"         );
pfnfreebmp  free_bitmap         = (pfnfreebmp )GetProcAddress(hLambDll, "free_bitmap"         );
pfnzerobmp  zero_bitmap         = (pfnzerobmp )GetProcAddress(hLambDll, "zero_bitmap"         );
pfnsavebmp  save_bitmap         = (pfnsavebmp )GetProcAddress(hLambDll, "save_bitmap"         );
pfnsavejpg  save_jpeg           = (pfnsavejpg )GetProcAddress(hLambDll, "save_jpeg"           );
pfnsizebmp  size_bitmap         = (pfnsizebmp )GetProcAddress(hLambDll, "size_bitmap"         );
pfnscalebmp scale_bitmap        = (pfnscalebmp)GetProcAddress(hLambDll, "scale_bitmap"        );
pfnperfbmp  perforate_bitmap    = (pfnperfbmp )GetProcAddress(hLambDll, "perforate_bitmap"    );
pfncopyimg  copy_image          = (pfncopyimg )GetProcAddress(hLambDll, "copy_image"          );
pfncopyfull copy_full_image     = (pfncopyfull)GetProcAddress(hLambDll, "copy_full_image"     );
pfndispimg  display_image       = (pfndispimg )GetProcAddress(hLambDll, "display_td_image"    );
pfnsetpal   set_palette         = (pfnsetpal  )GetProcAddress(hLambDll, "set_palette"         );
pfndrawrect draw_rect           = (pfndrawrect)GetProcAddress(hLambDll, "draw_rect"           );
pfnsetpixel set_pixel           = (pfnsetpixel)GetProcAddress(hLambDll, "set_pixel"           );
pfnpastestr paste_string        = (pfnpastestr)GetProcAddress(hLambDll, "paste_string"        );
pfnwc2tpast wc2_trans_paste     = (pfnwc2tpast)GetProcAddress(hLambDll, "wc2_trans_paste"     );







2) Mods & Development / Re: Nerd's Corner
« on: June 13, 2019, 02:39:32 AM »

Mini-Map Black to Grey Plugin

Changes the mini-map display color for the black player to a lighter shade of grey.


This is a very simple plugin that just changes 1 byte in the wc2 process, heres the source:

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

// export a "w2p_init()" function this will run once when wc2 loads


extern "C" __declspec (dllexport) void w2p_init(){       
       
    // declare a pointer to a BYTE
    BYTE* bytePointer;
     
    // make it point to the mini-map black location
    bytePointer = (BYTE*)0x4A48B1;
   
    // set the byte to grey (0xEA)
    *bytePointer = 0xEA;   
    //   ...could also use
    //   - 0xFD Bright Pink
    //   - 0xDE Dark Purple
    //   - 0xD2 Dark Red
    //   - 0xE3 Dark OJ
 
   
}

BOOL APIENTRY DllMain (  HINSTANCE hInst, DWORD reason, LPVOID reserved ){ return TRUE; }



Just build that as a DLL file then change the filename from .dll to .w2p and put it in the "plugin" folder.

This source can be easily modified to test other mods also if you want.




3) Server.War2.ru / Re: twitch account no longer exists
« on: June 12, 2019, 01:07:31 PM »
... and most likely lambchops as well. idk what lambchops plays

Yeah probably, but I suck. Thanks for your entertaining posts, the forum was geting a bit slow. Great team effort guys ;D


4) Server.War2.ru / Re: twitch account no longer exists
« on: June 11, 2019, 05:06:30 AM »
Truth. Watching TK is very good tutorial on what NOT to do.
Poor tk


Maybe, but you have to admit: nobody self-owns quite like tk. He could teach a masterclass on that shit.


5) Flame Wars & Offtopic / Re: Fucking mongoloids with aids
« on: June 10, 2019, 06:13:05 AM »
its to hellashis lamb id rather have a tree outside byitself

trees r kool  :)

6) Server.War2.ru / Re: WAR2 FUN FACTS
« on: June 09, 2019, 07:08:29 AM »
Moths are much older creatures than butterflies. They have been around since the mid-jurassic period. Butterflies have only been around for about 50 million years.











7) Server.War2.ru / Re: twitch account no longer exists
« on: June 08, 2019, 09:38:07 PM »
looked on reddit and apparently its a fairly common issue. stream account was deleted or removed or deactivated idfk

so now im trying to make a new twitch account and it's a new layout and can't find the fking stream key.. dashboard isnt even there any more for me. there is a "Creator dashboard" but even there i cant find the stream key


it's behind the rax ;)

8) Server.War2.ru / Re: Which building placement is better?
« on: June 06, 2019, 11:32:59 AM »
With the tower below rax it becomes part of your pinch and only has 100hp as against a farm which has 400hp. If you mess up the repair and lose the tower then your pinch and tower are all gone at once.

As for the one behind the farm why wouldn't you leave space for peons to repair the farm?


... or can u prosplain why this stuff isn't a problem?

9) Mods & Development / Re: WC2 Plugins v0.1.3 fully compatible
« on: June 06, 2019, 10:28:23 AM »
                CRAZY Speed plugin    ;D


         This one is just for the lols.

Obviously you can't use this pvp unless all players are using it. You would just drop.


This doesn't actually speed up the game, it just makes all the game action delays finish instantly... so:

Peons instantly exit mines/halls/mills as soon as they enter.

Unit movement/construction/training/chopping speeds are faster (maybe 1.5x - 3x)

Repair speed is much faster 5x ?? 10x ?? idk

Towers attack speeds are insane ??x omg

Other stuff is faster (spells etc.)


The attached video is of part of a game on fastest, in real time.
(sorry for bad video quality has to be small to post)

The gold being collected is from 6 peons in a PM ;)


  -- edit --

There's 2 versions:


CrazySpd.w2p         Just gives the local player speed.
CrazySpdAll.w2p     Gives everyone speed (including comps)

You will need the second version if you want to try it out pvp for fun. (obviously don't try to use them both at once...)

IIRC With the all speed version playing vs. comps is ok until the comps get magic then they start messing you up pretty badly.

Because repair is so OP (and comps don't repair-build) you can build very fast and defend your base with 1 or 2 towers as long as you watch for cats... but when the comps get DKs you want to be ready for it.



11) Mods & Development / WC2 Plugins v0.1.3 fully compatible
« on: June 05, 2019, 10:23:20 PM »
Version 0.1.3 of the Plugin Framework is now tested and working on Windows 10, 7, and XP with all ddraw versions.

Should work with all War2 BNE 2.02 variants including all w2combat versions except 4.4

Instructions and description are HERE.

The new ZIP file is here

AFAIK it should work with all Windows versions - If you successfully install on a different OS not listed here please let me know and I will update the list.


Thanks to RandomPeasant and EC for testing and feedback  :fro: :thumbsup:






12) General Discussion / Re: Awesome game review.
« on: June 03, 2019, 09:19:24 PM »
u still got that mod? where towers shoot fast? i think it could be something

Yeah somewhere. That would make a fun plugin.

13) General Discussion / Re: Awesome game review.
« on: June 03, 2019, 10:23:48 AM »
the only thing i  dont get is plants...thier had to be 2 life forms 1 for animals 1 for plants..not even related to each other.

Plants and animals both use the same DNA mechanism that is the base of life. They both evolved from the same source of single celled organisms.

if they found anything on mars...i bet they wouldnt tell us.

OMG of course they would. Imagine the funding $$ they would get! They are just gagging to find something they can tell us about.

oh yeah i forgot u know u had a astroid explode that was bigger than a nuke?
did anyone see it?

That was way too far away for me to see, but I vividly remember seeing one about 2003. Was during the day so it wasn't bright like that but very memorable nonetheless. I thought it would have to be on the news or something, but nobody seemed to care or notice. I'm sure NASA or whoever would have logged it, but really rocks are falling out of the sky all the time - unless they fall straight on your head, it's only the really massive ones we need to worry about, and they are tracking those things whenever they come anywhere near earth.


14) Strategy & Replays / Re: How splash damage works
« on: June 02, 2019, 10:21:22 AM »
hmm

1926/2550 = 0.7553

Kind of looks like 25% to me

BTW ground attack splash damage to buildings = 0

15) General Discussion / Awesome game review.
« on: June 01, 2019, 06:17:56 AM »
Def worth checking out:

When Earth Was In Beta | The Cambrian Tier List - YouTube

Pages: [1] 2 3 ... 89