War2.ru Slogan
News: Watch live streams at War2TV and replays of
past streams at War2TV Reruns!


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 ... 72
1) Server.War2.ru / Re: tupac dealing final blow to War2
« on: October 17, 2018, 09:40:09 PM »
If you had people lying about you and wishing you dead for things you didn't do, and then they slipped on their own vomit and bonked their head, how sorry for them would you feel?

lol nicely put.

frankly this goes both ways. the only thing babyshark & tupac are for-sure guilty of here is leaving bait that everyone is unable to stop themselves from taking. banning them doesn't solve anything, it just makes you all feel slightly better about the fact that ru is getting straight-up owned and we're powerless to stop it. sure whoever is attacking the server is a huge weirdo creep, but in all honesty it's not a very strong attack & it's only been possible because ru is a dilapidated pile of crap with no systems in place for dealing with it, no chain of command, no way to delegate access, etc. the way the server is running now is untenable & this is a wake up call to that fact, we can either pull together as a community to deal with it or continue to shove our problems under the rug & pretend that's going to solve anything.

instead of all this gratuitous name calling & finger pointing, why dont we instead discuss pooling resources & finding a real solution?

+10 sanity points for Mousey.


But I must say, you are never going to get a cohesive community with an administration that condones or even encourages extreme bullying and racism.

I also think a bot that instanly bans anyone that swears is a bit over the top, but I prefer that any day to a few snotty assholes getting celebrated for making a big show of being as vile and hateful as possible.

Surely there must be a happy medium somewhere? .... lets call it "sanity-land" lol.


2) Mods & Development / Re: Nerd's Corner
« on: October 14, 2018, 07:42:34 AM »
Nice thanks! ^-^ :thumbsup:

Interesting that they save the transition type value from the marching squares algorithm in the pud directly instead of calculating it once at load time. It means your map editor has to save these calculated values in the pud but it also means you can save a pud files with very weird transitions if you would like to that could look funny. (:

 :critter:



yw :)

The terrain transition tile values can be derived like THIS.

For displaying terrain in the PUDPIC program I cheated - big time ;)

I generated a list of possible MTXM values based on my assumptions of the format, then also searched every pud in my maps directory for any crazy custom values I had missed and added them too.

Then I auto generated maps with arrays of these MTXM values, then loaded the maps, took SS, and then processed the SS to pull out the exact 32x32 block of pixels for each map value.


 ... stuff like this:






Finally I searched all the pixel blocks and weeded out any repeats, then turned them into an array of pixel data indexed by the MTXM value list - with multiple indexes to the same pixels for different tile values that displayed them.

In this way when rendering there is no need to calculate and locate the 4 different 8x8 mini-tiles that make up each MTXM location, it just uses the raw MTXM value to do a lookup in a pointertable  which supplies the exact location of the full 32x32 block.

                                                                                :critter:


 -- edit --

The units are all rendered using the original grp files, using the method detailed HERE



3) Server.War2.ru / Re: Ripe not posting warvid
« on: October 14, 2018, 12:46:30 AM »
If the rules of a tourney specify providing warvid and the participant refuses to provide it, then surely they would be disqualified from the tournament.

If a player is going to mess up tournament results by getting themselves disqualified without a decent reason then possibly organizers of future tournaments should consider excluding that person, and also be careful to make sure that all players understand the rules before taking part.





4) Mods & Development / Re: Nerd's Corner
« on: October 13, 2018, 03:20:27 AM »
So for future reference here's a working re-written version of PUDPIC.exe

It draws the terrain and the units.

It doesn't process command line switches or passed filename, just uses the filenames: "this.pud" "this.bmp", and "this.jpg".

I'm sure anyone capable of building it can add those bits if they want.


Lamb.h

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


#ifndef _LAMB_
#define _LAMB_

#define sTYPE 0x45505954 // "TYPE"
#define sVER_ 0x20524556 // "VER "
#define sDESC 0x43534544 // "DESC"
#define sOWNR 0x524E574F // "OWNR"
#define sERA_ 0x20415245 // "ERA "
#define sERAX 0x54415245 // "ERAX"
#define sDIM_ 0x204D4944 // "DIM "
#define sUDTA 0x41544455 // "UDTA"
#define sUNIT 0x54494E55 // "UNIT"
#define sUGRD 0x44524755 // "UGRD"

#define sSIDE 0x45444953 // "SIDE"
#define sSGLD 0x444C4753 // "SGLD"
#define sSLBR 0x52424C53 // "SLBR"
#define sSOIL 0x4C494F53 // "SOIL"
#define sAIPL 0x4C504941 // "AIPL"

#define sMTXM 0x4D58544D // "MTXM"
#define sSQM_ 0x204D5153 // "SQM "
#define sOILM 0x4D4C494F // "OILM"
#define sREGM 0x4D474552 // "REGM"

#define sSIGN 0x4E474953 // "SIGN"
#define sALOW 0x574F4C41 // "ALOW"

#define FOREST     0
#define WINTER     1
#define WASTELAND  2
#define SWAMP      3


#define TILEW  32
#define TILEW2 16


extern "C" {
    typedef struct pudsect {
        DWORD Reserved;
        DWORD name;
        DWORD size;
        LPVOID data;
    }PUDSECT;
}

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;
}

extern "C" {
    typedef struct pudunit{
    WORD x;
    WORD y;
    BYTE type;
    BYTE owner;
    WORD ai;     // 0-passive 1-active or (gold or oil)/2500
    }PUDUNIT;
}


// LambRES.dll
extern "C" typedef CHAR*   (__stdcall *rfngetname )(int utype);
extern "C" typedef LPVOID  (__stdcall *rfntileset )(int ntileset);
extern "C" typedef LPVOID  (__stdcall *rfngetpal  )(int npalette);
extern "C" typedef LPVOID  (__stdcall *rfngetgrp  )();


//PUDfile.inc
extern "C" typedef LPVOID  (__stdcall *pfnpudload )(CHAR* path);
extern "C" typedef int     (__stdcall *pfnpudsave )(LPVOID hpud,CHAR* path);

//PUDpud.inc
extern "C" typedef int     (__stdcall *pfnsectcnt )(LPVOID hpud);
extern "C" typedef void    (__stdcall *pfndestroy )(LPVOID hpud);
extern "C" typedef LPVOID  (__stdcall *pfndelsect )(LPVOID hpud,LPVOID hsect);
extern "C" typedef PUDSECT*(__stdcall *pfnfindsect)(LPVOID hpud,DWORD sectname);
extern "C" typedef int     (__stdcall *pfnupdsect )(LPVOID hpud,LPVOID hsect,LPVOID lpnew,int nbytes);
extern "C" typedef PUDSECT*(__stdcall *pfngetsect )(LPVOID hpud,int nsect);
extern "C" typedef int     (__stdcall *pfnsectndx )(LPVOID hpud,DWORD sectname);
extern "C" typedef LPVOID  (__stdcall *pfnsectset )(LPVOID hpud,LPVOID hsect,int nsect);
extern "C" typedef BOOL    (__stdcall *pfnsectcre )(LPVOID hpud,DWORD sectname,LPVOID lpnew,int nbytes);
extern "C" typedef LPVOID  (__stdcall *pfnrealloc )(PUDSECT* hSect,int nbytes);

//PUDunit.inc
extern "C" typedef int     (__stdcall *pfnunitsize)(int utype);
extern "C" typedef int     (__stdcall *pfnuniticof)(int utype);
extern "C" typedef int     (__stdcall *pfnlistget )(int list,int ndx);
extern "C" typedef int     (__stdcall *pfnlistnext)(int list,int utype);
extern "C" typedef int     (__stdcall *pfnlistprev)(int list,int utype);
extern "C" typedef LPVOID  (__stdcall *pfnlistname)(int list);

//PUDtile.inc
extern "C" typedef void    (__stdcall *pfnrndrmap )(LPVOID hbmp,LPVOID mtxm,int mapw);
extern "C" typedef void    (__stdcall *pfnrndrtile)(LPVOID hbmp,int tile,int x,int y);
extern "C" typedef LPVOID  (__stdcall *pfngettile )(int tile);
extern "C" typedef void    (__stdcall *pfntileset )(LPVOID tileset);
extern "C" typedef void    (__stdcall *pfnblack   )(HDC dc,int x,int y,int w,int h);

//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);

//PUDgrp.inc
extern "C" typedef LPVOID  (__stdcall *pfngrpinit )(LPVOID grplubase);
extern "C" typedef void    (__stdcall *pfndrawgrp )(int grp,int nframe,LPVOID daddr,int dwidth,int owner,int centre,int mirror);
extern "C" typedef void    (__stdcall *pfndrawbtn )(LPVOID bmp, int xpos, int ypos, int icon, int state);




extern rfngetname      RESgetName;
extern rfntileset      RESgetTileset;
extern rfngetpal       RESgetPalette;
extern rfngetgrp       RESgetGrp;

extern pfnpudload      PUDload;
extern pfnpudsave      PUDsave;

extern pfnsectcnt      PUDsection_count;
extern pfndestroy      PUDdestroy;
extern pfndelsect      PUDdelete_section;
extern pfnfindsect     PUDfind_section;
extern pfnupdsect      PUDupdate_section;
extern pfngetsect      PUDget_section;
extern pfnsectndx      PUDsection_index;
extern pfnsectset      PUDsection_set_index;
extern pfnsectcre      PUDcreate_section;
extern pfnrealloc      PUDsection_realloc;

extern pfnunitsize     PUDunitSize;
extern pfnuniticof     PUDunitIconFrame;
extern pfnlistget      PUDlistGet;
extern pfnlistnext     PUDlistNext;
extern pfnlistprev     PUDlistPrev;
extern pfnlistname     PUDlistName;

extern pfnrndrmap      PUDrenderMap;
extern pfnrndrtile     PUDrenderTile;
extern pfngettile      PUDgetTile;
extern pfntileset      PUDtileset;
extern pfnblack        PUDblack;

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 pfngrpinit      GRPinit;
extern pfndrawgrp      GRPdraw;
extern pfndrawbtn      GRPdrawButton;


#endif


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


HMODULE hResDll  = LoadLibraryA("LambRES");
HMODULE hLambDll = LoadLibraryA("LambWC2");


rfngetpal   RESgetPalette       = (rfngetpal  )GetProcAddress(hResDll , "RESgetPalette"       );
rfngetgrp   RESgetGrp           = (rfngetgrp  )GetProcAddress(hResDll , "RESgetGrp"           );
rfngetname  RESgetName          = (rfngetname )GetProcAddress(hResDll , "RESgetName"          );
rfntileset  RESgetTileset       = (rfntileset )GetProcAddress(hResDll , "RESgetTileset"       );


pfnpudload  PUDload             = (pfnpudload )GetProcAddress(hLambDll, "PUDload"             );
pfnpudsave  PUDsave             = (pfnpudsave )GetProcAddress(hLambDll, "PUDsave"             );

pfnsectcnt  PUDsection_count    = (pfnsectcnt )GetProcAddress(hLambDll, "PUDsection_count"    );
pfndestroy  PUDdestroy          = (pfndestroy )GetProcAddress(hLambDll, "PUDdestroy"          );
pfndelsect  PUDdelete_section   = (pfndelsect )GetProcAddress(hLambDll, "PUDdelete_section"   );
pfnfindsect PUDfind_section     = (pfnfindsect)GetProcAddress(hLambDll, "PUDfind_section"     );
pfnupdsect  PUDupdate_section   = (pfnupdsect )GetProcAddress(hLambDll, "PUDupdate_section"   );
pfngetsect  PUDget_section      = (pfngetsect )GetProcAddress(hLambDll, "PUDget_section"      );
pfnsectndx  PUDsection_index    = (pfnsectndx )GetProcAddress(hLambDll, "PUDsection_index"    );
pfnsectset  PUDsection_set_index= (pfnsectset )GetProcAddress(hLambDll, "PUDsection_set_index");
pfnsectcre  PUDcreate_section   = (pfnsectcre )GetProcAddress(hLambDll, "PUDcreate_section"   );
pfnrealloc  PUDsection_realloc  = (pfnrealloc )GetProcAddress(hLambDll, "PUDsection_realloc"   );


pfnunitsize PUDunitSize         = (pfnunitsize)GetProcAddress(hLambDll, "PUDunitSize"         );
pfnuniticof PUDunitIconFrame    = (pfnuniticof)GetProcAddress(hLambDll, "PUDunitIconFrame"    );
pfnlistget  PUDlistGet          = (pfnlistget )GetProcAddress(hLambDll, "PUDlistGet"          );
pfnlistnext PUDlistNext         = (pfnlistnext)GetProcAddress(hLambDll, "PUDlistNext"         );
pfnlistprev PUDlistPrev         = (pfnlistprev)GetProcAddress(hLambDll, "PUDlistPrev"         );
pfnlistname PUDlistName         = (pfnlistname)GetProcAddress(hLambDll, "PUDlistName"         );

pfnrndrmap  PUDrenderMap        = (pfnrndrmap )GetProcAddress(hLambDll, "PUDrenderMap"        );
pfnrndrtile PUDrenderTile       = (pfnrndrtile)GetProcAddress(hLambDll, "PUDrenderTile"       );
pfngettile  PUDgetTile          = (pfngettile )GetProcAddress(hLambDll, "PUDgetTile"          );
pfntileset  PUDtileset          = (pfntileset )GetProcAddress(hLambDll, "PUDtileset"          );
pfnblack    PUDblack            = (pfnblack   )GetProcAddress(hLambDll, "PUDblack"            );

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"         );
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"           );

pfngrpinit  GRPinit             = (pfngrpinit )GetProcAddress(hLambDll, "GRPinit"             );
pfndrawgrp  GRPdraw             = (pfndrawgrp )GetProcAddress(hLambDll, "GRPdraw"             );
pfndrawbtn  GRPdrawButton       = (pfndrawbtn )GetProcAddress(hLambDll, "GRPdrawButton"       );


CHAR* pudpath = "this.pud";
CHAR* bmppath = "this.bmp";
CHAR* jpgpath = "this.jpg";

BYTE* sectionData(LPVOID hpud, DWORD sname){
    PUDSECT* sptr = PUDfind_section(hpud,sname);
    if (sptr!=NULL) return (BYTE*)sptr->data;
    return NULL;
}

int sectionSize(LPVOID hpud, DWORD sname){
    PUDSECT* sptr = PUDfind_section(hpud,sname);
    if (sptr!=NULL) return sptr->size;
    return 0;
}

int getPudSize(LPVOID hpud){
    WORD* pdim = (WORD*) sectionData(hpud,sDIM_);
    if(pdim) return (int) *pdim;
    return 0;
}

int getTerrainType(LPVOID hpud){
    WORD* pter = (WORD*) sectionData(hpud,sERA_);
    if(pter) return (int) *pter;
    return 0;
}

BOOL isBuilding(int utype){
    // is the unit a building?
    return utype>=0x3A;
}

void renderUnit(HMIBMP* hbm, PUDUNIT* unit){
    // draw a unit grp
   
    int   frame = 0;
    int   x=(unit->x+1)*TILEW;
    int   y=(unit->y+1)*TILEW;
    int   centre = 0;
    int   rev = 0;
   
   
    if(!isBuilding(unit->type)){
       // units need to be centred and offset
       centre = 1;
       x+=TILEW2;
       y+=TILEW2;
       
       // pick a random direction so they dont all face the same way
       frame = rand()%5;
       rev   = rand()%2;    // draw reversed?
    }
   
    GRPdraw( unit->type, frame, hbm->pBits+x+(y*hbm->linew), hbm->linew, unit->owner, centre, rev );

}


///////// START /////////


    // load the pud file
    LPVOID hPud = PUDload(pudpath);
   
   
    // get some info from the pud
    int mapsize = getPudSize(hPud);
    int terrain = getTerrainType(hPud);
   

    // make a bitmap in memory (tiles are 32x32 pixels)
    HMIBMP* hbm = make_bitmap(mapsize*TILEW,mapsize*TILEW,8);
   
   
   
    /// TERRAIN ///
   
    // use the tiles for the map terrain type
    PUDtileset(RESgetTileset(terrain));
   
    // don't forget this if you are using GRPs, only needs to be done once to initialize
    GRPinit(RESgetGrp());
   
    //paste all the tile graphics for the pud onto the bitmap
    PUDrenderMap( hbm, sectionData(hPud,sMTXM) , mapsize);
   
       
    /// UNITS ///
           
    // get a pointer to the "UNIT" section
    PUDSECT* units = PUDfind_section(hPud,sUNIT);
       
    if(units){
         
        // make a slightly larger bitmap to paste units on
        // --> some units like flyers can be placed in locations where they
        //     will render off the edge of the map (crash and burn).
        //
        // so here we make a bitmap with a safety margin around the edge
       
        HMIBMP* hUbm = make_bitmap((mapsize+2)*TILEW,(mapsize+2)*TILEW,8);
             
        // how many units on the pud?
        // ( includes mines, start locations etc.)
        int nUnits  = units->size/sizeof(PUDUNIT);
       
        // draw the unit GRPs on the 'safe' bitmap
        PUDUNIT* pUnit = (PUDUNIT*)units->data;
        for(int i=0;i<nUnits;i++){
            renderUnit(hUbm,pUnit);
            pUnit++;
        }
       
        // copy the unit bitmap (less the border area) onto the terrain bitmap
        copy_image(hUbm,TILEW,TILEW,hbm->width,hbm->height,hbm,0,0,0); // <- last 0 is the transparent index
                                                                       //    pass -1 for none.
        // dispose of the unit bitmap
        free_bitmap(hUbm);
    }
   
   
    // ensure the bmp file has the correct palette for the terrain type
    set_palette(hbm , RESgetPalette( terrain ));
   
    // save the full bitmap to a .bmp file
    save_bitmap(bmppath,hbm);
   
    // resize the bitmap then save to a .jpg file
    HMIBMP* hJbm = size_bitmap(hbm,1024,1024);
    save_jpeg(jpgpath,hJbm,90); // <-- quality 90 looks nice
   
    // dispose of bitmaps
    free_bitmap(hbm);
    free_bitmap(hJbm);
   
    // dispose of the pud structure
    PUDdestroy(hPud);


                                                            :critter:


5) Mods & Development / Re: Nerd's Corner
« on: October 11, 2018, 10:49:14 PM »
nless you really want to use these as a way to get noticed by employers or because you want that to be part of your resume or portfolio. <= which also could be quite a good idea but that is indeed more work

Exactly, and perhaps taking a small amount of pride in my work?

6) Mods & Development / Re: Nerd's Corner
« on: October 11, 2018, 10:41:05 AM »
The reason is, I checked your archive and it is flagged as malicious by most common anti viruses,


PFFFFFFFF
^Read this^

If anyone wants to actually put any work into programming I am always the first person to help. I have already spent quite a few hours of my time in reply to your request (YOU'RE WELCOME).

I sometimes publish source to try to help people, but mostly I don't do it for 2 reasons:

   1) Vanity

Most programming jobs involve using personal libraries of code and mashing together various bits that I have been writing my entire life.

To publish the source fpr a specific app I would want to go through it all and cut out all the bits that aren't needed for that app, and make sure that there isn't any noobish trashy things I wrote 20 years ago, and I would be embarrassed to have people see without re-writing them properly.

Also source code often ends up with random notes and comments, non-functional first-attempts at things commented out or not... even notes from phone calls I answered while coding.

It can be very time consuming to check, reorganise and sometimes re-write thousands of lines of code to make it appropriate for public viewing. Just publishing hundreds of source files is like emptying out your underwear draw in a public place.

   2) Why would I bother?

Sorry, but quite honestly I've been publishing a large amount of information about programming and the WC2 client for years now, and I'm yet to see one single line of source code that anyone else has written that has helped me with anything.

I have attempted to collaborate with others before and the only thing that happened is I wasted a heap of hours and nobody else contributed anything.

My first thought when you asked for the source was "sure, why not?"

Then I started looking through all the source files for the 3 different elements of PUDPIC and realised it was probably going to take a couple of days to vet and re-assemble the entire lot into a publishable collection and thought... meh - none of these people ever do anything with any of it, why would I waste my time?

If anyone actually wants to do something with it, there is lots to work with here .... go for it!
If anyone can't ....or more likely can't be bothered, to work out even the small amount I have posted here, then there is no way they will ever do anything useful with the rest.

Want to do some programming? Great... there's a BIG start. How about you post your source here and I will help you with it ok? If you can get you own a version of PUDPIC working I will find a way to make the dlls acceptable... the only issue might be copyright because they contain pretty much all the graphics for the game. :-\


The virus detection matters because even if we know it is perfectly safe if we want to put it in the downloads section of the site for everyone to find easily, and google runs a basic automated test like they always do on hosted files, they will flag the whole war2.ru site as malicious, as it happened before.


This is a valid issue, if anyone running the server asked me about this because they wanted to host my progs, I would try to find a solution. For PUDPIC probably just uncompressing the files might work, idk I havn't even looked at it because nobody has ever suggested that.

Some things I am less comfortable exposing because they work with the WC2 exe and could potentially be exploited for hacks, but PUDPIC only works with pud files so there is no issue there.


Are these sources somewhere on Github? That would be much handier to read/propose changes or additions  .... / snip /.... Do you think it could be a good idea? :-)


This would be really nice. It would mean a lot of work for me, which I would be much more inclined to do if I thought there was any chance at all that anyone else would actually contribute anything, but going on past experience, that is very unlikely.



         ------------------------------

Just while I'm on the subject .... if there is anyone here paranoid enough to actually be concerned about any real malware in any of my stuff, here's a couple of points to ponder:

All you have to do to spot a trojan is firewall it... if its doing anything nasty it will try to phone home... otherwise what's the point?

...and if you actually think that:

a) I am the type of person that would invade people's privacy for my own petty ends
         or
b) that even if I was that kind of person, that I care enough about anyone here's personal life (or even WC2 life) to bother,

.... then the answer is very easy: don't use my programs, and also eat a large bag of dicks :)


7) Mods & Development / Re: Nerd's Corner
« on: October 11, 2018, 05:59:36 AM »
@Cel

Ok so the HMIBMP structure is what I use internally to handle bitmaps.

Its just a conveniant way to handle device independent bitmaps without having to get bogged down with a lot of the unnecessary/unused stuff, although you can still get to the underlying windows structures if you need to.


It has these members:

Code: [Select]
pFile        pointer to the BITMAPFILEHEADER struct
pInfo        pointer to the BITMAPINFOHEADER struct
pPal         pointer to the palette (if the bitmap has one)
pBits        pointer to the pixmap (actual pixel data - depends on the format)
width        duh
height       duh
bpp          bits per pixel (this will be 8 for most WC2 things)
linew        internal size in bytes for one line of pixels
usage        (pixel color values or palette entries)
size         total size of all structures


so if you do:

Code: [Select]
HMIBMP* MyBmp = make_bitmap(300,200,8);

You will get a handle to a 300x200 8-bit bitmap. All the underlying windows structures are created automatically.

when finished use:

Code: [Select]
free_bitmap(MyBmp);

to deallocate all the memory.

*** These bitmap functions are not complete for every format, I have just added to them whenever I needed to do something .... most of it works for 8-bit bitmaps - because that's what I mostly play with for WC2 stuff. Some things work for 32 or 24 bit bitmaps. Pretty much none of it will work for 4 or 16 bit bmps (but who cares about that crap lol). ***

For WC2 stuff you will just want 8-bit bmps, the only thing you would use any other format for is the size_bitmap() func which will resize an 8-bit bmp and blend the colors then return a 32-bit bitmap of the requested size.

Code: [Select]
LPVOID MyPud = PUDload("c:\\someMap.pud");

Will return a handle to a linked list of PUDSECT structures, which contain pointers to the actual data for each section.

You can get a pointer to the data for a given section like this:

Code: [Select]
BYTE* sectionData(LPVOID hPud, DWORD sname){
    PUDSECT* sptr = PUDfind_section(hPud,sname);
    if (sptr!=NULL) return sptr->data;
    return NULL;
}

NOTE: the section name is a DWORD not a string .... all pud section names are 4 bytes, so you want constants like this:


Code: [Select]
#define sTYPE 0x45505954 // "TYPE"
#define sVER_ 0x20524556 // "VER "
#define sDESC 0x43534544 // "DESC"
#define sOWNR 0x524E574F // "OWNR"
#define sERA_ 0x20415245 // "ERA "
#define sERAX 0x54415245 // "ERAX"
#define sDIM_ 0x204D4944 // "DIM "
#define sUDTA 0x41544455 // "UDTA"
#define sUNIT 0x54494E55 // "UNIT"
#define sUGRD 0x44524755 // "UGRD"

#define sSIDE 0x45444953 // "SIDE"
#define sSGLD 0x444C4753 // "SGLD"
#define sSLBR 0x52424C53 // "SLBR"
#define sSOIL 0x4C494F53 // "SOIL"
#define sAIPL 0x4C504941 // "AIPL"

#define sMTXM 0x4D58544D // "MTXM"
#define sSQM_ 0x204D5153 // "SQM "
#define sOILM 0x4D4C494F // "OILM"
#define sREGM 0x4D474552 // "REGM"

#define sSIGN 0x4E474953 // "SIGN"
#define sALOW 0x574F4C41 // "ALOW"


so you can get the map size of a pud file from the "DIM " section like:

Code: [Select]
int getPudDim(LPVOID hpud){
    WORD* pdim = (WORD*) sectionData(hpud,sDIM_)
    if (pdim) return (int) *pdim;
    return 0;
}

If you get a "tile" value from the MTXM section you can draw that square of terrain on the bitmap at (x,y) with:

Code: [Select]
PUDrenderTile(MyBmp, tileValue , int x, int y);

or

Code: [Select]
PUDrenderMap(MyBmp, MTXM_section, size);

will do the terrain for the whole map - but make sure the bitmap is the right size or you will crash.


The different terrain styles can be selected like this:

Code: [Select]
#define FOREST     0
#define WINTER     1
#define WASTELAND  2
#define SWAMP      3

PUDtileset(RESgetTileset( WINTER ));

you will also need to set the appropriate palette in your bitmap or the colors will come out wrong.

Code: [Select]
set_palette(MyBmp , RESgetPalette( WINTER ));


so you should be able to make a bmp file of just the terrain for a PUD file with something like:

Code: [Select]
//     # UNTESTED # - probably has errors/typos

#include <windows.h>
//#include HEADER FILE WITH IMPORT DEFS FROM PREVIOUS POST AND CONSTANT DEFS (ABOVE)



CHAR* pudpath = "myMap.pud";
CHAR* bmppath = "this.bmp";


// load the pud file
LPVOID hPud = PUDload(pudpath);


BYTE* sectionData(LPVOID hpud, DWORD sname){
    PUDSECT* sptr = PUDfind_section(hpud,sname);
    if (sptr!=NULL) return (BYTE*)sptr->data;
    return NULL;
}

int getPudSize(LPVOID hpud){
    WORD* pdim = (WORD*) sectionData(hpud,sDIM_);
    if(pdim) return (int) *pdim;
    return 0;
}

int getTerrainType(LPVOID hpud){
    WORD* pter = (WORD*) sectionData(hpud,sERA_);
    if(pter) return (int) *pter;
    return 0;
}


// get some info from the pud
int   mapsize = getPudSize(hPud);
int   terrain = getTerrainType(hPud);


// make a bitmap in memory (tiles are 32x32 pixels)
HMIBMP* hbm = make_bitmap(mapsize*32,mapsize*32,8);

// use the tiles for the map terrain type
PUDtileset(RESgetTileset(terrain));

// don't forget this if you are using GRPs, only needs to be done once to initialize
// can't remember if it needs to be done for only the terrain, but it cant hurt lol
GRPinit(RESgetGrp());

//paste all the tile graphics for the pud onto the bitmap
PUDrenderMap( hbm, sectionData(hpud,sMTXM) , mapsize);


// ensure the bmp file has the correct palette for the terrain type
set_palette(hbm , RESgetPalette( terrain ));

// save the bitmap to a file
save_bitmap(bmppath,hbm);

// dispose of the bitmap
free_bitmap(hbm);

// dispose of the pud structure
PUDdestroy(hPud);


Obviously you will also need the two dlls from PUDPIC, #define statements for used constants, and the function import stuff and structure defs from the previous post.

Play with that stuff and let me know how you go ....      HF :)




p.s. also if you want you can display your bitmap (or part of it) on a Windows device context with:

Code: [Select]

display_image( dc, windowX, windowY, displayWidth, displayHeight, hbm, bmX, bmY, bmW, bmH   );


if you pass 0 for the width and height they will default to the bitmap width and height, so:
Code: [Select]
display_image(dc,0,0,0,0,hbm,0,0,0,0);
will just display the bitmap on the window without any resizing.

                                                                                               :critter:

8) Mods & Development / Re: Nerd's Corner
« on: October 10, 2018, 08:04:20 PM »
@Lambchops May we have the sources of that nice little program of yours?  (The PUDPIC program) ^-^


Yeah I dont mind sharing, but it's a pretty tangled mess of code ... 2 ASM dll projects and C++ project that uses the dlls

The C++ is from a half written pud editor that still has lots of stuff not used by the pudpic program.

Its about 130 source files in all. A lot of that is just all the WC2 graphics repackaged into LambRES.dll


>> What do you want to do with it?


Probably your easiest path to drawing WC2 stuff is to call the functions from the 2 dll files:

Code: [Select]

// This stuff in .h file  <-----

extern "C" { 
    typedef struct pudsect {
        DWORD Reserved;
        DWORD name;
        DWORD size;
        LPVOID data;
    }PUDSECT;
}

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;
}


// LambRES.dll
extern "C" typedef CHAR*   (__stdcall *rfngetname )(int utype);
extern "C" typedef LPVOID  (__stdcall *rfntileset )(int ntileset);
extern "C" typedef LPVOID  (__stdcall *rfngetpal  )(int npalette);
extern "C" typedef LPVOID  (__stdcall *rfngetgrp  )();


//PUDfile.inc
extern "C" typedef LPVOID  (__stdcall *pfnpudload )(CHAR* path);
extern "C" typedef int     (__stdcall *pfnpudsave )(LPVOID hpud,CHAR* path);

//PUDpud.inc
extern "C" typedef int     (__stdcall *pfnsectcnt )(LPVOID hpud);
extern "C" typedef void    (__stdcall *pfndestroy )(LPVOID hpud);
extern "C" typedef LPVOID  (__stdcall *pfndelsect )(LPVOID hpud,LPVOID hsect);
extern "C" typedef PUDSECT*(__stdcall *pfnfindsect)(LPVOID hpud,DWORD sectname);
extern "C" typedef int     (__stdcall *pfnupdsect )(LPVOID hpud,LPVOID hsect,LPVOID lpnew,int nbytes);
extern "C" typedef PUDSECT*(__stdcall *pfngetsect )(LPVOID hpud,int nsect);
extern "C" typedef int     (__stdcall *pfnsectndx )(LPVOID hpud,DWORD sectname);
extern "C" typedef LPVOID  (__stdcall *pfnsectset )(LPVOID hpud,LPVOID hsect,int nsect);
extern "C" typedef BOOL    (__stdcall *pfnsectcre )(LPVOID hpud,DWORD sectname,LPVOID lpnew,int nbytes);
extern "C" typedef LPVOID  (__stdcall *pfnrealloc )(PUDSECT* hSect,int nbytes);

//PUDunit.inc
extern "C" typedef int     (__stdcall *pfnunitsize)(int utype);
extern "C" typedef int     (__stdcall *pfnuniticof)(int utype);
extern "C" typedef int     (__stdcall *pfnlistget )(int list,int ndx);
extern "C" typedef int     (__stdcall *pfnlistnext)(int list,int utype);
extern "C" typedef int     (__stdcall *pfnlistprev)(int list,int utype);
extern "C" typedef LPVOID  (__stdcall *pfnlistname)(int list);

//PUDtile.inc
extern "C" typedef void    (__stdcall *pfnrndrmap )(LPVOID hbmp,LPVOID mtxm,int mapw);
extern "C" typedef void    (__stdcall *pfnrndrtile)(LPVOID hbmp,int tile,int x,int y);
extern "C" typedef LPVOID  (__stdcall *pfngettile )(int tile);
extern "C" typedef void    (__stdcall *pfntileset )(LPVOID tileset);
extern "C" typedef void    (__stdcall *pfnblack   )(HDC dc,int x,int y,int w,int h);

//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);

//PUDgrp.inc
extern "C" typedef LPVOID  (__stdcall *pfngrpinit )(LPVOID grplubase);
extern "C" typedef void    (__stdcall *pfndrawgrp )(int grp,int nframe,LPVOID daddr,int dwidth,int owner,int centre,int mirror);
extern "C" typedef void    (__stdcall *pfndrawbtn )(LPVOID bmp, int xpos, int ypos, int icon, int state);




extern rfngetname      RESgetName;
extern rfntileset      RESgetTileset;
extern rfngetpal       RESgetPalette;
extern rfngetgrp       RESgetGrp;

extern pfnpudload      PUDload;
extern pfnpudsave      PUDsave;

extern pfnsectcnt      PUDsection_count;
extern pfndestroy      PUDdestroy;
extern pfndelsect      PUDdelete_section;
extern pfnfindsect     PUDfind_section;
extern pfnupdsect      PUDupdate_section;
extern pfngetsect      PUDget_section;
extern pfnsectndx      PUDsection_index;
extern pfnsectset      PUDsection_set_index;
extern pfnsectcre      PUDcreate_section;
extern pfnrealloc      PUDsection_realloc;

extern pfnunitsize     PUDunitSize;
extern pfnuniticof     PUDunitIconFrame;
extern pfnlistget      PUDlistGet;
extern pfnlistnext     PUDlistNext;
extern pfnlistprev     PUDlistPrev;
extern pfnlistname     PUDlistName;

extern pfnrndrmap      PUDrenderMap;
extern pfnrndrtile     PUDrenderTile;
extern pfngettile      PUDgetTile;
extern pfntileset      PUDtileset;
extern pfnblack        PUDblack;

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 pfngrpinit      GRPinit;
extern pfndrawgrp      GRPdraw;
extern pfndrawbtn      GRPdrawButton;


///////////////////////////////////////////////////////////////////////////////

// This stuff in .cpp file   <-------



HMODULE hResDll  = LoadLibraryA("LambRES");
HMODULE hLambDll = LoadLibraryA("LambWC2");


rfngetpal   RESgetPalette       = (rfngetpal  )GetProcAddress(hResDll , "RESgetPalette"       );
rfngetgrp   RESgetGrp           = (rfngetgrp  )GetProcAddress(hResDll , "RESgetGrp"           );
rfngetname  RESgetName          = (rfngetname )GetProcAddress(hResDll , "RESgetName"          );
rfntileset  RESgetTileset       = (rfntileset )GetProcAddress(hResDll , "RESgetTileset"       );


pfnpudload  PUDload             = (pfnpudload )GetProcAddress(hLambDll, "PUDload"             );
pfnpudsave  PUDsave             = (pfnpudsave )GetProcAddress(hLambDll, "PUDsave"             );

pfnsectcnt  PUDsection_count    = (pfnsectcnt )GetProcAddress(hLambDll, "PUDsection_count"    );
pfndestroy  PUDdestroy          = (pfndestroy )GetProcAddress(hLambDll, "PUDdestroy"          );
pfndelsect  PUDdelete_section   = (pfndelsect )GetProcAddress(hLambDll, "PUDdelete_section"   );
pfnfindsect PUDfind_section     = (pfnfindsect)GetProcAddress(hLambDll, "PUDfind_section"     );
pfnupdsect  PUDupdate_section   = (pfnupdsect )GetProcAddress(hLambDll, "PUDupdate_section"   );
pfngetsect  PUDget_section      = (pfngetsect )GetProcAddress(hLambDll, "PUDget_section"      );
pfnsectndx  PUDsection_index    = (pfnsectndx )GetProcAddress(hLambDll, "PUDsection_index"    );
pfnsectset  PUDsection_set_index= (pfnsectset )GetProcAddress(hLambDll, "PUDsection_set_index");
pfnsectcre  PUDcreate_section   = (pfnsectcre )GetProcAddress(hLambDll, "PUDcreate_section"   );
pfnrealloc  PUDsection_realloc  = (pfnrealloc )GetProcAddress(hLambDll, "PUDsection_realloc"   );


pfnunitsize PUDunitSize         = (pfnunitsize)GetProcAddress(hLambDll, "PUDunitSize"         );
pfnuniticof PUDunitIconFrame    = (pfnuniticof)GetProcAddress(hLambDll, "PUDunitIconFrame"    );
pfnlistget  PUDlistGet          = (pfnlistget )GetProcAddress(hLambDll, "PUDlistGet"          );
pfnlistnext PUDlistNext         = (pfnlistnext)GetProcAddress(hLambDll, "PUDlistNext"         );
pfnlistprev PUDlistPrev         = (pfnlistprev)GetProcAddress(hLambDll, "PUDlistPrev"         );
pfnlistname PUDlistName         = (pfnlistname)GetProcAddress(hLambDll, "PUDlistName"         );

pfnrndrmap  PUDrenderMap        = (pfnrndrmap )GetProcAddress(hLambDll, "PUDrenderMap"        );
pfnrndrtile PUDrenderTile       = (pfnrndrtile)GetProcAddress(hLambDll, "PUDrenderTile"       );
pfngettile  PUDgetTile          = (pfngettile )GetProcAddress(hLambDll, "PUDgetTile"          );
pfntileset  PUDtileset          = (pfntileset )GetProcAddress(hLambDll, "PUDtileset"          );
pfnblack    PUDblack            = (pfnblack   )GetProcAddress(hLambDll, "PUDblack"            );

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"         );
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"           );

pfngrpinit  GRPinit             = (pfngrpinit )GetProcAddress(hLambDll, "GRPinit"             );
pfndrawgrp  GRPdraw             = (pfndrawgrp )GetProcAddress(hLambDll, "GRPdraw"             );
pfndrawbtn  GRPdrawButton       = (pfndrawbtn )GetProcAddress(hLambDll, "GRPdrawButton"       );




The pud load/save routines and format are from HERE



Make sure you first do:

Code: [Select]
PUDtileset(RESgetTileset(0));
GRPinit(RESgetGrp());


This sets some internal pointers, otherwise you will get GP faults if you try to use stuff.


I have to go out right now, I can give you more info later when I have more time.

9) Server.War2.ru / Re: The State of The Servers
« on: October 05, 2018, 01:22:46 AM »

god you guys are so new. You can hardly  knock peoples teeth out with a mouthguard required in a professional match...

jordan you dick sucks

The no teeth thing is actually an advantage there ;)

10) General Discussion / Re: witchcraft
« on: October 05, 2018, 12:56:17 AM »
greenwindows  glowing on a house idk waht it means

if they're red it I think it means they're selling sex, green idk .... selling pot maybe? lol

11) Server.War2.ru / Re: http://server.war2.ru/status/
« on: October 02, 2018, 06:11:16 AM »
its not tupac he woulda braged about it i know him
Forgive me for not taking your word for it. You drunk 90% of the time you post here.

Like I said already there isn't proof it is tupac. But it does look very suspicious.


Actually for me this is the most compelling fact. EC is right on the money, Tupac has been known to be a naughty boy occasionally, but he is not malicious, and he does love to have a good laugh about his exploits.

If he did do that I can't see him even not telling me about it, let alone not telling EC - those two are as thick as thieves.... plus I just don't see him as an "attack the server" kind of guy, he doesn't have a big resentful asshole chip on his shoulders, like sg or one of those other little pissants.


12) General Discussion / Re: eat less meat imo
« on: October 01, 2018, 10:18:58 PM »
Stopped watching when it started talking about how humans are genocidal for killing animals for food.
You know it was a tye dye white boy that made that vid.

Lol totally.

i still get a little amazed at how stupid you are

Hint: if you're calling everyone else stupid all the time it's probably you ;)


13) Server.War2.ru / Re: http://server.war2.ru/status/
« on: October 01, 2018, 10:12:04 PM »
That's total bullshit, I have not ddosed any server period.

Ignore them, it's just trolling at this point.

someone is though  >:(

Yep.


14) Website & Forum Discussion / Re: Ban Babyshark and Tupac from forums #2
« on: September 30, 2018, 06:21:45 AM »
You seem retarded thats all. Hope you're doing alright.
I don't think anybody is this thread is on your side. You should watch how you speak fool. Still waiting for you to respond on babyshark owning your ass. Dude come on really!? Are totally gonna ignore the fact she whipped that ass? Boi gtfo and get good plz.


I think you'll fail to find a single person on these forums apart from your butch online GF who likes you


I like Tupac, and I KNOW you're a total wanker...  so I guess we can just chalk that up as yet another epic sg fail.


15) Website & Forum Discussion / Re: Ban Babyshark and Tupac from forums #2
« on: September 30, 2018, 12:23:47 AM »
Yah its a total coincidence the bots appeared the same day they announce their war2 server for the mentally ill :-\ :-\ :-\ Youd make a good female blid



Obviously it's not a coincidence but that doesn't identify the source, you brainless pleb.



Pages: [1] 2 3 ... 72