Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexf2 committed Jan 18, 2018
1 parent ff00339 commit ed24495
Show file tree
Hide file tree
Showing 431 changed files with 52,343 additions and 0 deletions.
102 changes: 102 additions & 0 deletions 2DARRAY.HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#if !defined(_T2DArray_)
#define _T2DArray_

#include <bwcc.h>

class TLineDef
{
public:
TLineDef( int ) {}

};


template<class T> class T2DArray
{
public:

//friend template<class T> T2DString operator[]( T2DArray<T>& rA, int ind );
//friend template<class T> T& operator[]( T2DString rS, int ind )

T2DArray( int iClm, int iStr );
T2DArray( const T2DArray& rObj )
{
Copy( rObj );
}
virtual ~T2DArray();

int Clm() const { return iClm; }
int Str() const { return iStr; }

T2DArray& operator,( TLineDef );
T2DArray& operator,( T );
T** operator()() const { return (T**)pData; }
T2DArray& operator=( const T2DArray& );

private:
int iClm, iStr;
T *pData;

int iCountStr, iCountClm;

void Copy( const T2DArray& rObj );
};


template<class T> T2DArray<T>& operator=( const T2DArray<T>& rObj )
{
if( pData ) {delete pData; pData = NULL; }
Copy( rObj );
return *this;
}

template<class T> void T2DArray<T>::Copy( const T2DArray<T>& rObj )
{
iClm = rObj.iClm; iStr = rObj.iStr;
pData = new T[ iClm * iStr ];
if( pData ) _fmemcpy( pData, rObj.pData, sizeof(T) * iClm * iStr );
}

template<class T> T2DArray<T>& T2DArray<T>::operator,( TLineDef )
{
iCountStr++; iCountClm = 0;
return *this;
}

template<class T> T2DArray<T>& T2DArray<T>::operator,( T tElem )
{
if( iCountClm >= iClm || iCountStr >= iStr )
{
BWCCMessageBox( NULL, "Bounds error 2DArray", "Error", MB_ICONSTOP | MB_OK | MB_APPLMODAL );
return *this;
}

pData[ iCountStr * iClm + iCountClm++ ] = tElem;
return *this;
}


/*template<class T> T& operator[]( T2DArray::T2DString rS, int ind )
{
return *(&rS + ind);
}
template<class T> T2DArray<T>::T2DString operator[]( T2DArray<T>& rA, int ind )
{
return *(pData + iClm * ind);
}*/


template<class T> T2DArray<T>::T2DArray( int iClm_, int iStr_ )
{
iClm = iClm_; iStr = iStr_;
pData = new T[ iClm * iStr ];
iCountStr = iCountClm = 0;
}

template<class T> T2DArray<T>::~T2DArray()
{
if( pData ) { delete pData; pData = NULL; }
}

#endif
61 changes: 61 additions & 0 deletions 3DW.CPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//#pragma option -v-

#include "app.hpp"
#include <dialog.h>



HINSTANCE hInstRC = NULL;
PTModule pMRC = NULL;

int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine,
int nCmdShow )
{
if( hPrevInst )
{
/* static DLGPROC lpfnDlgProc;
BOOL bRes;
lpfnDlgProc = (DLGPROC)MakeProcInstance( (FARPROC)DupStartDlgProc,
hInst );
bRes = DialogBox( hInst, MAKEINTRESOURCE(DL_DUPSTART), 0, lpfnDlgProc );
FreeProcInstance( (FARPROC)lpfnDlgProc );*/

MessageBox( 0, "You cann't run more when one copy !", "3D World Power",
MB_OK | MB_ICONSTOP | MB_SYSTEMMODAL);
/*
PostAppMessage( hInst, WM_ACTIVATEAPP, (WPARAM)TRUE,
(LPARAM)MAKELONG(hPrevInst, 0) );
*/
return FALSE;
}

hInstRC = LoadLibrary( "_3dw_rc.dll" );
if( !hInstRC )
{
MessageBox( 0, "Cann't load resource, need '_3dw_rc.dll'", "3DWorld 1.0a",
MB_OK | MB_ICONSTOP | MB_SYSTEMMODAL);
return 1;
}

T3dWorldApp _3dWorldApp = T3dWorldApp( "3D World 1.0a", hInst, hPrevInst,
lpCmdLine, nCmdShow );

pMRC = new TModule( "_3DW_RC", hInstRC, NULL );
if( !pMRC || pMRC->Status )
{
if( pMRC ) delete pMRC; pMRC = NULL;
MessageBox( 0, "Error create RC module", "3DWorld 1.0a",
MB_OK | MB_ICONSTOP | MB_SYSTEMMODAL);
return 1;
}

_3dWorldApp.Run();

delete pMRC; pMRC = NULL;
FreeLibrary( hInstRC );

return _3dWorldApp.Status;
}

#pragma option -v.
8 changes: 8 additions & 0 deletions 3DW.DEF
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
;NAME 3dw
DESCRIPTION '(c)AlexCorp. 1995 3D World Power V1.0'
EXETYPE windows
STUB 'winstub.exe'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 512
STACKSIZE 20480
Binary file added 3DW.PRJ
Binary file not shown.
190 changes: 190 additions & 0 deletions ABDIALOG.CPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
//#pragma option -v-

#include <bbutton.h>
#include <bgrpbox.h>
#include <bwcc.h>

#include "fullscr.hpp"
#include "abdialog.hpp"
#include "autorc.hpp"
#include "measur.mac"
#include "INC\aboutbmp.inc"
#include "INC\img256.inc"

#ifdef __DLL__
extern PTModule pModule;
#else
static PTModule pModule = NULL;
#endif

extern HINSTANCE hInstRC;

//#include <owl.h>

TAboutDialog::TAboutDialog( PTWindowsObject AParent, LPSTR AName, int id256,
BOOL bCompress, PTModule AModule ):
TCenterDialog( AParent, AName, AModule )
{
//TDialog Attr TApplication
TAutoCursorRc crcCursor( LoadCursor(NULL, IDC_WAIT) );
HWND hwndCap = AParent ? SetCapture( AParent->HWindow ):NULL;


if( !(AboutBmp = new TBitMap( GetApplication(), GetApplication()->hInstance,
id256, bCompress, this, 105, "", 0, 0 )) ||
AboutBmp->Status )
Status = AboutBmp->Status ? AboutBmp->Status:ER_CREATEOBJECT;


ReleaseCapture();
SetCapture( hwndCap );


/*pBtn = new TBButton( this, IDOK, "&Ok", 1, 1, 64, 40,
TRUE, AModule );
((PTBButton)pBtn)->Attr.Style = BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP;
pGr = new TBGroupBox( this, 103, NULL, RX(6), RY(182), RX(284), RY(2),
AModule );
((PTBGroupBox)pGr)->Attr.Style = 4 | WS_CHILD | WS_VISIBLE;*/

};


void TAboutDialog::WMQueryNewPalette( RTMessage Msg )
{
if( AboutBmp ) AboutBmp->WMQueryNewPalette( Msg );
}

void TAboutDialog::WMPaletteChanged( RTMessage Msg )
{
if( AboutBmp ) AboutBmp->WMPaletteChanged( Msg );
}


void TAboutDialog::SetupWindow()
{
static char *cAb = "(c) AlexCorp. 1995 3D World 1.0";
RECT WinRect;
POINT PtLeftUp;
int W, H;

//MoveWindow( HWindow, 1, 1, RX(345), RY(285), FALSE );
TCenterDialog::SetupWindow();

TSendTxt stSend;
stSend.handle = 0;
stSend.lpTxt = cAb;
SendMessage( Parent->HWindow, WM_COMMAND, CM_SENDTEXT, (LPARAM)&stSend );


//RECT r;
//GetWindowRect( pBtn->HWindow, &r );
GetClientRect( HWindow, &WinRect );
//int wid = r.right - r.left,
// high = r.bottom - r.top;
//MoveWindow( pBtn->HWindow, (WinRect.right - wid) / 2, RY(232), wid, high, FALSE );

int wid = double(WinRect.right) * 0.95;
//MoveWindow( pGr->HWindow, (WinRect.right - wid) / 2, RY(225), wid, 2, FALSE );

if( AboutBmp )
{
GetClientRect( HWindow, &WinRect );

PtLeftUp.x = (WinRect.right - WinRect.left - AboutBmp->Attr.W) / 2;
PtLeftUp.y = 10;

MoveWindow( AboutBmp->HWindow, PtLeftUp.x, PtLeftUp.y,
AboutBmp->Attr.W, AboutBmp->Attr.H, FALSE );
}

grcBtnBmp[0].grcN = LoadBitmap( hInstRC, MAKEINTRESOURCE(ABOUTDLG_BMP_TM_N) );
grcBtnBmp[0].grcS = LoadBitmap( hInstRC, MAKEINTRESOURCE(ABOUTDLG_BMP_TM_S) );
grcBtnBmp[0].grcH = LoadBitmap( hInstRC, MAKEINTRESOURCE(ABOUTDLG_BMP_TM_H) );

if( !grcBtnBmp[0].grcN || !grcBtnBmp[0].grcS || !grcBtnBmp[0].grcH )
{
Status = ER_BITMAPLOAD;
GetApplication()->Error( ER_BITMAPLOAD );
TMessage msg; _fsetmem( &msg, sizeof(TMessage), 0 );
Cancel( msg );
return;
}

HBITMAP hbm[3] = { grcBtnBmp[0].grcN(), grcBtnBmp[0].grcH(), grcBtnBmp[0].grcS() };
SendDlgItemMessage( HWindow, BTN_TM, BBM_SETBITS, 0, (LONG)(LPSTR)(hbm) );
}


TAboutDialog::~TAboutDialog()

{
}


/*LPSTR TAboutDialog::GetClassName()
{
return "3DW:ABOUT";
}*/



/*void TAboutDialog::GetWindowClass(WNDCLASS _FAR & AWndClass)
{
TCenterDialog::GetWindowClass( AWndClass );
//AWndClass.hbrBackground = NULL;
}*/


void TAboutDialog::DefCommandProc( RTMessage Msg )
{
if( Msg.WParam == IDCANCEL )
{
Cancel( Msg );
Msg.Result = 0;
}
else
TCenterDialog::DefCommandProc( Msg );
}

void TAboutDialog::DefWndProc( RTMessage Msg )
{
if( Msg.Message == WM_USER_FULLSCRDONE )
{
mrcImg.FreeRc();
Msg.Result = 0;
return;
}
else if( Msg.Message == WM_COMMAND && Msg.WParam == BTN_TM &&
HIWORD(Msg.LParam) == BN_CLICKED
)
{
mrcImg = new TDIB( DDB256_About2, TRUE, GetApplication() );
if( !mrcImg || mrcImg()->ErStatus )
{
mrcImg.FreeRc();
GetApplication()->Error( !!mrcImg ? mrcImg()->ErStatus:ER_CREATEOBJECT );

return;
}

PTFullScrWindow pfswWin = new TFullScrWindow( (PTAboutDialog)this, NULL, mrcImg(), NULL, GetModule() );
if( pfswWin && pfswWin->Status )
{
mrcImg.FreeRc();
GetApplication()->Error( pfswWin->Status );
pfswWin->CloseWindow();
}
else GetApplication()->MakeWindow( pfswWin );

Msg.Result = 0;
return;
}


TCenterDialog::DefWndProc( Msg );
}

#pragma option -v.
Loading

0 comments on commit ed24495

Please sign in to comment.