
--
-- Copyright (C) 2023  <fastrgv@gmail.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You may read the full text of the GNU General Public License
-- at <http://www.gnu.org/licenses/>.
--



separate (avent)


procedure setup_temple is -- scene=4

	hwdoor : constant float := 0.8; --halfWidth
	fhdoor : constant float := 2.0; --fullHeight
	tdoor : constant float := 0.1;

begin

--if not restore_temple then --first time

-- aheight=0.5 so lets try to live with that...
-- default room size is [x,y,z] in [-10..10, -3..3, -10..10]

	--walls
	droomobj.setroomwithZMdoor2( tdo,
		--dx, dy
		hwdoor, fhdoor,
		0.0, 0.0, 0.0,
		ixmax/3.0,iymax,izmax-0.5*htobj,

		ixmax/6.0,iymax/2.0,izmax/4.0); --old scaling method
		--2.0, 2.0, 4.0 ); --newX paradigm


	--mural on front (north=ZP) wall
	pictobj.setrect(zpmural, 5,
		0.0,-0.5, izmax-htobj, 
		ixmax/5.0,1.0,0.5*htobj, 
		j1,j2,j3,j4,j5,j6);

	--minoan tapestry east X- wall
	pictobj.setrect(xmmural, 2,
		-ixmax/3.0+htobj, -2.0, 5.0,
		0.0, 0.5, 1.0,
		j1,j2,j3,j4,j5,j6);


	--trireme tapestry west X+ wall
	pictobj.setrect(xpmural, 1,
		+ixmax/3.0-htobj, -2.0, 5.0,
		0.0, 0.5, 1.0,
		j1,j2,j3,j4,j5,j6);




	-- Greek-key design begin:-------------------
	pictobj.setrect(zpwall2, 5,
		0.0, 2.5, izmax-htobj,  --htobj=0.02
		ixmax/3.0,0.25,0.5*htobj, 
		2.0,1.0);

	pictobj.setrect(zmwall2, 6,
		0.0, 2.5, -izmax+htobj, 
		ixmax/3.0,0.25,0.5*htobj, 
		2.0,1.0);

	pictobj.setrect(xpwall2, 1,
		ixmax/3.0-htobj, -0.5, 0.0, 
		0.5*htobj, 0.25, izmax,
		5.0,1.0);

	pictobj.setrect(xmwall2, 2,
		-ixmax/3.0+htobj, -0.5, 0.0, 
		0.5*htobj, 0.25, izmax,
		5.0,1.0);
	-- Greek-key design end.---------------------


	--ceiling
	rectobj.setrect(rceil, 
		0.0,iymax-0.01,0.0, 
		ixmax/3.0+0.5,0.0,izmax, 
		j1,j2,j3,j4,j5,j6);

	rectobj.setrect(tfloor, 
		0.0,-iymax+0.01,0.0, 
		ixmax/3.0+0.5,0.0,izmax, 
		j1,j2,j3,j4,j5,j6);


-- define temple entry hall:
	ixtmpl:=0.0;
	iytmpl:=-iymax+fhdoor/2.0;
	iztmpl:=-izmax+htobj;


-- next 3 objects in sync with same objects in M6: pillar 1,2 + beam12

	--marble entry top beam
	pictobj.osetrect( 
		beam34,
		ixtmpl,iytmpl+fhdoor/2.0,iztmpl,
		hwdoor+0.6, 0.2, 0.3,
		j1,j2,j3,j4,j5,j6);

	--2 marble entry pillars
	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar3,
		ixtmpl-hwdoor,iytmpl,iztmpl,
		fhdoor/2.0, 0.25,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );

	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar4,
		ixtmpl+hwdoor,iytmpl,iztmpl,
		fhdoor/2.0, 0.25,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );





--------- begin 6 tall marble pillars

	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar5,
		-ixmax/3.0+0.25, 0.0, -izmax+0.25, --SE
		iymax, 0.25,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );


	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar6,
		-ixmax/3.0, 0.0, +izmax, --NE
		iymax, 0.5,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );

	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar7,
		-ixmax/3.0, 0.0, 0.0, --EA
		iymax, 0.5,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );




	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar8,
		+ixmax/3.0-0.25, 0.0, -izmax+0.25, --SW
		iymax, 0.25,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );


	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar9,
		+ixmax/3.0, 0.0, +izmax, --NW
		iymax, 0.5,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );

	nko:=nko+1;
	koscene(nko):=4;
	cylobj.setcyl(
		pillar10,
		+ixmax/3.0, 0.0, 0.0, --WE
		iymax, 0.5,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );
















--define rocksafe
	nko:=nko+1;
	koscene(nko):=4;
	pictobj.osetrect( 
		rsafe,
		0.0,-iymax+0.3, izmax-0.3,
		0.3, 0.3, 0.3,
		koxlo(nko),koxhi(nko), koylo(nko),
		koyhi(nko), kozlo(nko),kozhi(nko) );


	xchalice:=(0.0);
	ychalice:=hcup + (-iymax+0.6);
	zchalice:=(izmax-0.3);
	schalice:=4;
	drawchalice:=true;



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


--end if; -- restore

	interior:=true;


	ixtmpl:=0.0;
	iytmpl:=-iymax+fhdoor/2.0;
	iztmpl:=-izmax;


--restore_temple:=true; --flag indicates already prepped

end setup_temple;



