yet another problem

Started by
3 comments, last by PPCThug 22 years, 1 month ago
this should probably be obvious to me but I can''t figure it out. if (FAILED(lpddsprimary->GetAttachedSurface(&ddsd.ddsCaps, &lpddsback))) return(0); if (FAILED(lpdd4->CreateClipper(0, &lpddclipper, NULL))) return(0); RECT ddclprect; ddclprect.left = 0; ddclprect.top = 0; ddclprect.right = SCREENWIDTH; ddclprect.bottom = SCREENHEIGHT; LPRGNDATA region_data; region_data = (LPRGNDATA)new(sizeof(RGNDATAHEADER)+sizeof(RECT)) -> memcpy( region_data->Buffer, ddclprect, sizeof(RECT)); region_data->rdh.dwSize = sizeof(RGNDATAHEADER); region_data->rdh.iType = RDH_RECTANGLES; region_data->rdh.nCount = 1; region_data->rdh.nRgnSize = sizeof(RECT); region_data->rdh.rcBound.left = 64000; region_data->rdh.rcBound.top = 64000; region_data->rdh.rcBound.right = -64000; region_data->rdh.rcBound.bottom = -64000; if (FAILED(lpddclipper->SetClipList(region_data, 0))) -> { delete(region_data); return(NULL); } if (FAILED(lpddsback->SetClipper(lpddclipper))) { delete(region_data); return(NULL); } delete(region_data); (335) : error C2061: syntax error : identifier ''memcpy'' (348) : error C2143: syntax error : missing '';'' before ''{'' the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis
Advertisement
You''re missing a semicolon at the end of the previous statement.

When searching for this type of error, think of how the compiler operates. It processes each ''token'' (punctuation, identifier, number, etc) one at a time. When it finds a token that it is not expecting, it usually emits a syntax error. So, when you get a syntax error, look at the form of the statement right before it reported the error; it is usually there.

Also, many compilers will get confused after syntax errors, and may report bogus errors after a certain point. If you fix the first errors, and recompile, sometimes a lot of error messages disappear.
RECT ddclprect;
ddclprect.left = 0;
ddclprect.top = 0;
ddclprect.right = SCREENWIDTH;
ddclprect.bottom = SCREENHEIGHT;

LPRGNDATA region_data;

-> region_data = (LPRGNDATA)new(sizeof(RGNDATAHEADER)+sizeof(RECT));

-> memcpy( region_data->Buffer, ddclprect, sizeof(RECT));

region_data->rdh.dwSize = sizeof(RGNDATAHEADER);
region_data->rdh.iType = RDH_RECTANGLES;
region_data->rdh.nCount = 1;
region_data->rdh.nRgnSize = sizeof(RECT);

region_data->rdh.rcBound.left = 64000;
region_data->rdh.rcBound.top = 64000;
region_data->rdh.rcBound.right = -64000;
region_data->rdh.rcBound.bottom = -64000;

(333) : error C2059: syntax error : '';''
(335) : error C2664: ''memcpy'' : cannot convert parameter 2 from ''struct tagRECT'' to ''const void *''



the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis
This should work:

region_data = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+sizeof(RECT));

memcpy( region_data->Buffer, (void *)&ddclprect, sizeof(RECT));


why do you use "sizeof(RGNDATAHEADER)+sizeof(RECT)"?

because I read it some where. from 102 errors to 0 in a minute that''s got to be a new personal record!
so if I got this code right any bitmaps I blt to the backbuffer will be clipped to the backbuffer.

if (FAILED(lpdd4->CreateClipper(0, &lpddclipper, NULL)))
return(0);

RECT ddclprect;
ddclprect.left = 0;
ddclprect.top = 0;
ddclprect.right = SCREENWIDTH;
ddclprect.bottom = SCREENHEIGHT;

LPRGNDATA region_data;

region_data = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+sizeof(RECT));

memcpy( region_data->Buffer, (void *)&ddclprect, sizeof(RECT));

region_data->rdh.dwSize = sizeof(RGNDATAHEADER);
region_data->rdh.iType = RDH_RECTANGLES;
region_data->rdh.nCount = 1;
region_data->rdh.nRgnSize = sizeof(RECT);

region_data->rdh.rcBound.left = 64000;
region_data->rdh.rcBound.top = 64000;
region_data->rdh.rcBound.right = -64000;
region_data->rdh.rcBound.bottom = -64000;

if (FAILED(lpddclipper->SetClipList(region_data, 0)))
{
free(region_data);
return(NULL);
}

if (FAILED(lpddsback->SetClipper(lpddclipper)))
{
free(region_data);
return(NULL);
}

free(region_data);


the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.
Bloodshed Dev-C++ 4.9.8.0 Mingw DX 9.0a DX SDK 6.1win2k#define WIN32_LEAN_AND_MEANthe Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.mechwarrior 2 mercenaries, 4 particle projection cannons, thug chassis

This topic is closed to new replies.

Advertisement