#2511472 - 05/10/08 05:14 AM
Re: 7217 bull s h i t
[Re: Brit44 'Aldo']
|
Joined: Jan 2006
Posts: 1,506
Brit44 'Aldo'
Every Human is Unique
|
Every Human is Unique
Member
Joined: Jan 2006
Posts: 1,506
|
__declspec(dllexport) void WINAPI rrSendTexturePart(uint32 id,uint32 aniInfo,uint32 palNo,int w,int h,unsigned char *gfx,int8 bytespp) { int32 bx,by,bw,bh; int32 x,y,matType; int32 BPP;
BPP=16*bytespp;
// for object editor, where is 0xff00ff sent for tlb #8 60507,aldo // Gfx is wrong?
// Set Texture in 256 Chunks and Save ID and Start Adr rrTextLibPartIDs [rrTextLibPartCount]=id; rrTextLibPartIDPalNos[rrTextLibPartCount]=palNo; // tlb # rrTextLibPartIDStarts[rrTextLibPartCount]=rrTextLibStartPos; rrTextLibPartSizeX [rrTextLibPartCount]=w/bytespp; // 32-bit rrTextLibPartSizeY [rrTextLibPartCount]=h; rrTextLibPartAniType [rrTextLibPartCount]=(aniInfo>>4) & 0x3f; rrTextLibPartAniStep [rrTextLibPartCount]= aniInfo & 0xf;
#ifdef HAL_SUPPORT matType = screenWin16PalMatID[palNo*256]; if( (rrTextLibPartIDHALStarts[rrTextLibPartCount]=halSendTextureBMP(matType,w,h,gfx,(struct tagRGBQUAD *)rrTextLibPals[palNo],scalingInfo[palNo],HTC_OBJECT,bytespp))==-1) doExitProgramm(); #endif
if(palNo==10) //aldo note! load infantry tlb here palNo==4 {
#ifdef HAL_SUPPORT rrTextInfantryList[rrTextInfantryCount]=rrTextLibPartIDHALStarts[rrTextLibPartCount]; #else rrTextInfantryList[rrTextInfantryCount]=(uint32)(rrTextLibPartIDStarts[rrTextLibPartCount])|palNo; #endif
rrTextInfantryListX[rrTextInfantryCount]=w/bytespp; rrTextInfantryListY[rrTextInfantryCount]=h;
// sprintf(msgBuf," %x ",rrTextInfantryList[rrTextInfantryCount]); // displayStringTop(800,20+rrTextInfantryCount*16,msgBuf);
rrTextInfantryCount++; }
rrTextLibPartCount++;
// Daten in die Texture Lib einkopieren bw=w/16/bytespp; bh=h/16;
for(by=0;by!=bh;by++) { for(bx=0;bx!=bw;bx++) { // Ein Block for(y=0;y!=16;y++) { for(x=0;x!=BPP;x++) { #ifdef HICOLOR rrTextLibStartPos[x+(y*BPP)] = gfx[(bx*BPP)+x+((by*16+y)*w)]; // fills the first block properly, then misses a byte. #else rrTextLibStartPos[x+y*16]=gfx[bx*16+x+((by*16+y)*w)]; #endif } } rrTextLibStartPos +=(256*bytespp); } }
// rrMessageBox(NULL,"successfully went through loop","",MB_OK); rrTextLibPartIDStarts[rrTextLibPartCount]=rrTextLibStartPos; if(rrTextLibPartCount>=MAX_TEXTPARTS) rrMessageBox(NULL,"To mutch Texture Gfx!!!","To mutch Texture Gfx!!!",MB_OK); }
/****************************************************************************************\ Function name : halSendTextureBMP Description : Return type : int32 CCONV Argument : int32 MatIndex Argument : int32 Width Argument : int32 Height Argument : uint8 *lpData Argument : RGBQUAD *lpPal Argument : int32 Scale Argument : int32 TexClass \****************************************************************************************/ int32 CCONV halSendTextureBMP(int32 MatIndex,int32 Width,int32 Height,uint8 *lpData,RGBQUAD *lpPal,int32 Scale,int32 TexClass,int8 bytespp) { int RetVal,wid;
wid=Width; if (bytespp==3) wid/=3; // --- Freien Platz in 256x256 Texturen suchen --- -- free space in 256x256 textures looks for -- RetVal=SearchPos(wid,Height,Scale,MatIndex,TexClass);
// if ((RetVal & 15)==0) FastTextOut(0,0,"%d ",RetVal);
if (RetVal==-1) { _AddToLog(LGFATAL,"halSendTextureBMP","Out of TextureMem"); return FALSE; }
AddTexturePartBMP(RetVal,Width,Height,lpData,lpPal,TexClass,bytespp);
return RetVal; }
/****************************************************************************************\ Function name : AddTexturePartBMP Description : Return type : int Argument : int id Argument : int Width Argument : int Height Argument : uint8 *lpSource Argument : RGBQUAD *lpPal \****************************************************************************************/
static int AddTexturePartBMP(int id,int Width,int Height,uint8 *lpSource,RGBQUAD *lpPal,int TexClass,int8 bytespp) { int x,y,m,i,yl,xl,wx; int r,b,g,a; int x2,y2; int Offset; int ScaleShift,Scale,ScaleID; uint16 *lpTexData16,*lpData16,v16; uint32 *lpTexData32,*lpData32,v32; uint8 *lpLine; int masked; int r2,b2,g2;
ScaleID=TextureID[id].Scale; x=TextureID[id].x << 3; y=TextureID[id].y << 3; m=TextureID[id].TexHandle;
switch(ScaleID) { case 0: ScaleShift=0; Scale=1; break; case 1: ScaleShift=2; Scale=2; break; case 2: ScaleShift=4; Scale=4; break; case 3: ScaleShift=8; Scale=8; break; default: ScaleShift=0; Scale=1; break; }
Offset=x+(y << (8-halTexInfo[m].TexSize));
if (bytespp!=3) wx=Width; else wx=Width/3;
if (Scale==1)// --- Copy 1:1 --- { if (halTexInfo[m].bpp==32)// --- 32 Bit Texturformat --- { lpTexData32=(uint32 *)LockTextureHAL(&halTexInfo[m]); for(yl=0;yl<Height;yl++) { lpData32=lpTexData32+((yl << (8-halTexInfo[m].TexSize))/Scale)+Offset; lpLine=&lpSource[yl*Width]; for(xl=0;xl<wx;xl++,lpLine++) //this is reading pixal by pixal correctly { masked=0; i=*lpLine; if (bytespp!=3) { b=lpPal[i].rgbRed; g=lpPal[i].rgbGreen; r=lpPal[i].rgbBlue; if(i==0 && TexClass!=HTC_GROUND) masked=0x7; } else { b = *(lpLine); g = *(lpLine+1); r = *(lpLine+2); lpLine = lpLine + 2;
if(r==255) { masked=1; if(b==255) masked|=2; if(g==0 || g==255) masked|=4; } }
if (masked==0x7) { r=g=b=128; a = 0; } else a=255;
v32=(r >> halTexInfo[m].RScale) << halTexInfo[m].RShift; v32|=(g >> halTexInfo[m].GScale) << halTexInfo[m].GShift; v32|=(b >> halTexInfo[m].BScale) << halTexInfo[m].BShift; v32|=(a >> halTexInfo[m].AScale) << halTexInfo[m].AShift;
*lpData32=v32; lpData32++; } } } else { // --- 16 Bit Texturformat --- lpTexData16=(uint16 *)LockTextureHAL(&halTexInfo[m]); for(yl=0;yl<Height;yl++) { lpData16=lpTexData16+((yl << (8-halTexInfo[m].TexSize))/Scale)+Offset; lpLine=&lpSource[yl*Width]; for(xl=0;xl<wx;xl++,lpLine++) { masked=0; if (bytespp==3) // Arthur - If we're a 24 bit image... { // Treat these next 3 bytes as the BGR colors b = *(lpLine); g = *(lpLine+1); r = *(lpLine+2); if(r==255) { masked=1; if(b==255) masked|=2; if(g==0 || g==255) masked|=4; } lpLine = lpLine + 2; } else { i=*lpLine; b=lpPal[i].rgbRed; g=lpPal[i].rgbGreen; r=lpPal[i].rgbBlue; if(i==0 && TexClass!=HTC_GROUND) masked=0x7; } if (masked==0x7) { r=g=b=128; a = 0; } else a=255; v16=(uint16)((r >> halTexInfo[m].RScale) << halTexInfo[m].RShift); v16|=(g >> halTexInfo[m].GScale) << halTexInfo[m].GShift; v16|=(b >> halTexInfo[m].BScale) << halTexInfo[m].BShift; v16|=(a >> halTexInfo[m].AScale) << halTexInfo[m].AShift;
*lpData16++=v16; } } } } else // --- Resample --- { if (halTexInfo[m].bpp==32) // --- 32 Bit Texturformat --- { lpTexData32=(uint32 *)LockTextureHAL(&halTexInfo[m]); for(yl=0;yl<Height;yl+=Scale) { lpData32=lpTexData32+((yl << (8-halTexInfo[m].TexSize))/Scale)+Offset; for(xl=0;xl<wx;xl+=Scale) { r=g=b=a=0; for(y2=yl;y2<yl+Scale;y2++) { for(x2=xl;x2<xl+Scale;x2++) { masked=0; if (bytespp!=3) { i=lpSource[x2+y2*Width]; b2=lpPal[i].rgbRed; g2=lpPal[i].rgbGreen; r2=lpPal[i].rgbBlue;
if(i==0 && TexClass!=HTC_GROUND) { r2=g2=b2=128; } else a+=255;
b+=b2; g+=g2; r+=r2; } else { lpLine=&lpSource[(x2*bytespp)+y2*Width]; b2= *(lpLine); g2= *(lpLine+1); r2= *(lpLine+2);
if(r2==255) { masked=1; if(b2==255) masked|=2; if(g2==0 || g2==255) masked|=4; } if (masked==0x7) { r2=g2=b2=128; } else a+=255;
b+=b2; g+=g2; r+=r2;
} } } r>>=ScaleShift; g>>=ScaleShift; b>>=ScaleShift; a>>=ScaleShift; v32=(r >> halTexInfo[m].RScale) << halTexInfo[m].RShift; v32|=(g >> halTexInfo[m].GScale) << halTexInfo[m].GShift; v32|=(b >> halTexInfo[m].BScale) << halTexInfo[m].BShift; v32|=(a >> halTexInfo[m].AScale) << halTexInfo[m].AShift;
*lpData32++=v32; } } } else { // --- 16 Bit Texturformat --- lpTexData16=(uint16 *)LockTextureHAL(&halTexInfo[m]); for(yl=0;yl<Height;yl+=Scale) { lpData16=lpTexData16+((yl << (8-halTexInfo[m].TexSize))/Scale)+Offset; for(xl=0;xl<wx;xl+=Scale) { r=g=b=a=0; for(y2=yl;y2<yl+Scale;y2++) { for(x2=xl;x2<xl+Scale;x2++) { masked=0; if (bytespp!=3) { i=lpSource[x2+y2*Width]; b2=lpPal[i].rgbRed; g2=lpPal[i].rgbGreen; r2=lpPal[i].rgbBlue;
if (i==0 && TexClass!=HTC_GROUND) { r2=g2=b2=128; } else a+=255;
b+=b2; g+=g2; r+=r2; } else { lpLine=&lpSource[(x2*bytespp)+y2*Width]; b2= *(lpLine); g2= *(lpLine+1); r2= *(lpLine+2);
if(r2==255) { masked=1; if(b2==255) masked|=2; if(g2==0 || g2==255) masked|=4; } if (masked==0x7) { r2=g2=b2=128; } else a+=255;
b+=b2; g+=g2; r+=r2;
} } } r>>=ScaleShift; g>>=ScaleShift; b>>=ScaleShift; a>>=ScaleShift;
v16=(uint16)((r >> halTexInfo[m].RScale) << halTexInfo[m].RShift); v16|=(g >> halTexInfo[m].GScale) << halTexInfo[m].GShift; v16|=(b >> halTexInfo[m].BScale) << halTexInfo[m].BShift; v16|=(a >> halTexInfo[m].AScale) << halTexInfo[m].AShift;
*lpData16++=v16; } } // OutLine16(lpTexData16,Offset,Width >> 1,Height >> 1,1 << (7-halTexInfo[m].TexSize)); } }
UnlockTextureHAL(&halTexInfo[m]); return TRUE; }
TPA who TWI "The 10th Amendment simply says that any powers that aren’t mentioned in the Constitution as belonging to the government belong to the states themselves."
|
|
#2511517 - 05/10/08 08:24 AM
Re: 7217 bull s h i t
[Re: Brit44 'Aldo']
|
Joined: Oct 2004
Posts: 1,460
sydbod
Member
|
Member
Joined: Oct 2004
Posts: 1,460
Sydney Australia
|
Hi Brit44 'Aldo', The problem we face has a number of fronts. It is normally easy enough to convert an 8 bit image pixel per pixel into a 24 bit or 32 bit frame buffer by just doing a lookup of the palette index value for the particular pixel. The trouble we face is that we do not have static menu screens. There are dynamically changing sprites blitted to the screen as well. This adds an extra level of complexity. Then we have to handle the remapping of the mouse pointer and the selection of the hotspots. Because of the above the screens are updated through a continuous loop. For some strange reason certain video drivers in conjunction with certain particular video chipsets then start to suffer tearing of the screen image. It is just looking to be easier to rewrite the front end menu code totally in a Windows compliant format and be done with it. I will have a quick look at the code you posted, it could have some good value in it. Thank you for posting it. I do not know if you are running a Team Speak client on your machine, but if you are, then drop in to the server many of the code group use for a chat. ServerAddres: sydbod.homedns.org Nickname: Whatever_You_Like Anonymous: selected Regards sydbod Sorry for the late reply, but I had to go out for a few hours.
"Peace, love and eternal grooviness, man."
|
|
#2511643 - 05/10/08 04:10 PM
Re: 7217 bull s h i t
[Re: sydbod]
|
Joined: Jan 2006
Posts: 1,506
Brit44 'Aldo'
Every Human is Unique
|
Every Human is Unique
Member
Joined: Jan 2006
Posts: 1,506
|
well, it looks like you have thought about this farther then any of the code I posted would help.
Arn't the mouse pointer and hot spots just screen offsets?
If you are blitting, does that mean you are still using directX 7 or older? If so, you may consider converting to directX 9. It's a daunting task to try on your own, but I could email you our conversion of PE. I used a #ifdef DX9 statement so both versions are in the sorce. example: #ifdef DX9 if(gl.lpSet->RenderBPP[gl.lpSet->ActRenderer] == 32) format = D3DFMT_A8R8G8B8; else format = D3DFMT_A4R4G4B4;
EXEC(gl.d3dDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, format, D3DPOOL_DEFAULT, &DeviceTexture,NULL)) //D3DFMT_A8R8G8B8
Cache[CacheLine].UserParm[1]=(int32)DeviceTexture; //DX9 Testing Cache[CacheLine].UserParm[2]=(int32)Width; #else EXEC(gl.dd->CreateSurface(&ddsd, &VideoMemTexture, NULL)) EXEC(VideoMemTexture->QueryInterface(IID_IDirect3DTexture2, (void**)&DeviceTexture)) EXEC(VideoMemTexture->SetColorKey(DDCKEY_SRCBLT, &ddck)) Cache[CacheLine].UserParm[0]=(int32)DeviceTexture; // VideoMemTextureHandle; Cache[CacheLine].UserParm[1]=(int32)VideoMemTexture; Cache[CacheLine].UserParm[2]=(int32)ddsd.dwWidth; #endif
TPA who TWI "The 10th Amendment simply says that any powers that aren’t mentioned in the Constitution as belonging to the government belong to the states themselves."
|
|
#2512031 - 05/11/08 06:15 AM
Re: 7217 bull s h i t
[Re: MrJelly]
|
Joined: Oct 2004
Posts: 1,460
sydbod
Member
|
Member
Joined: Oct 2004
Posts: 1,460
Sydney Australia
|
Hi Brit44 'Aldo', You are correct in that the mouse just requires a basic offset adjustment. What we find frustrating, is that the code does not use the standard and well defined functions or Win API calls, everything to a large extent is written with its own internal functions many times over as the game evolved. Then on top of that, there have been many changes by different development teams in the code,....remember...this basic code was upgraded from one type of game through a few generations up to another type of game.....and during this process it was upgraded from a DOS based game into a windows based game. A number of different teams worked on this code. There are areas in the code where code fragments do one thing and then other code fragments unwind what has just been done. One can see how various programming teams were under pressure at various times, and therefore just "cludged" the code to quickly make progress. Basically, what I am trying to say is that it takes a long time to sort out any changes in the code as it stands. Unless a number of people are prepared to work through all the modules and clean everything up to reintroduce a bit of clear structure back into the code, it just becomes easier to try to cut out the offending code and replace it with a complete new block of code. I did try a few weeks back to upgrade the code to ANSI compliancy and clean it up a bit and although I can get things to compile without errors in a compliant compiler, this upgraded version crashed when it gets into the 3D part of the game.....have not had time to look at this either. It does however STILL compile and work within the VC++6 compiler, this is very strange. We are using the DX6 SDK at the moment, although the DX7 SDK should also work. The reason we are not using the DX9 SDK is because a few flags for some of the DX library functions in our code have been depreciated in this later version and causes errors. Although these flag problems have been sorted a few months ago, we have not gotten around to switching over to the later SDK as the earlier one does not cause us any problems at the moment. By chance, would you be interested in joining our little group. We sure could use the help.
"Peace, love and eternal grooviness, man."
|
|
#2512033 - 05/11/08 06:19 AM
Re: 7217 bull s h i t
[Re: MrJelly]
|
Joined: Oct 2004
Posts: 1,460
sydbod
Member
|
Member
Joined: Oct 2004
Posts: 1,460
Sydney Australia
|
Vista 32 bit which I assume is using DX10. With the video card you are using you will find Vista is using DX9 in your case. Even if you had a DX10 compliant video card you will find that all the function calls that are used by EAW will be going through the DX9 interface of Vista.
"Peace, love and eternal grooviness, man."
|
|
#2512208 - 05/11/08 03:34 PM
Re: 7217 bull s h i t
[Re: sydbod]
|
Joined: Jan 2006
Posts: 1,506
Brit44 'Aldo'
Every Human is Unique
|
Every Human is Unique
Member
Joined: Jan 2006
Posts: 1,506
|
Jel, WinXP has a built in compatability function to work in 256 color. This is probably why the card makers dropped support for it. I would suspect that Micro$oft fixed a bug in this (only worked on most things) function for Vista. sydbod, I undestand the frustration. PE started life from the code of a Win95 demo for the first directx, the tools were made by different people using different compilers. It took us around a year of learning to get it ported over to VS6. The tools are still not done. The reason we are not using the DX9 SDK is because a few flags for some of the DX library functions in our code have been depreciated in this later version and causes errors. It took ChuckD over 6 months to learn and change the basic call changes. It took me another 3 months to finish things like restoring the bufers after alt-tabbing out of the game,etc. This was not consecutive months but time put in over the years. During this time I made the code selectable between DX6 and DX9. If you ever want a project that has DX6 and DX9 calls side by side, let me know. You may find switching to DX9 allows you to remove a lot of the ugly code. I did try a few weeks back to upgrade the code to ANSI compliancy and clean it up a bit and although I can get things to compile without errors in a compliant compiler, this upgraded version crashed when it gets into the 3D part of the game.....have not had time to look at this either. It does however STILL compile and work within the VC++6 compiler, this is very strange. This happened to me when I restructured the layout of PE's AI. I had to recompile all modules that used this dll. By using dumpbin.exe (a command line tool that comes with VS6), I found that the other modules of the simulation and the mainmenu call functions in desertAI.dll. My changes caused the parts to access the wrong area of memory. I already have a full time hobby in PE-X (models, skins and code). We both know how bad this hobby is for your sanity, could you imagine working on 2 old game engines Maybe we could work out a trade. I need a tool that reads one of our object files and inserts it into the selected LOD of another.
TPA who TWI "The 10th Amendment simply says that any powers that aren’t mentioned in the Constitution as belonging to the government belong to the states themselves."
|
|
#2512618 - 05/12/08 02:36 AM
Re: 7217 bull s h i t
[Re: Wudpecker]
|
Joined: Oct 2004
Posts: 1,460
sydbod
Member
|
Member
Joined: Oct 2004
Posts: 1,460
Sydney Australia
|
Hi Brit44 'Aldo', It may be a good idea to pull this conversation away from an open forum. For general game tools, the person to talk with is MrJelly.(as Wudpecker has stated) It may be worth your while to give him a Personal Message and start a private dialog. Regards sydbod
"Peace, love and eternal grooviness, man."
|
|
#2514952 - 05/15/08 05:55 PM
Re: 7217 bull s h i t
[Re: MrJelly]
|
Joined: Apr 2006
Posts: 209
Dornil
Member
|
Member
Joined: Apr 2006
Posts: 209
|
Strange... I have 7600GT - no tearing at all! Do you mean that only half menu screen visible? If so, it is easily corrected by turning on Anti Aliasing 8x. Looking forward to new exe than!:)
Last edited by Logrus; 05/15/08 05:56 PM.
|
|
|
|
|
|
|
|
|
|
|
|
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
|
|